PageSourceSearch

https://jonjimenez-career-suggestion.hf.space/assets/Index-5efeb121.js

js jonjimenez-career-suggestion.hf.space collected 2026-10-03 10:22:02 UTC 100,859 bytes, 3,914 lines download raw bytes

1import { g as get_next_color } from './color-20ad9c0d.js';
2import { c as colors, B as Block } from './Button-05bf7cea.js';
3import { B as BlockLabel } from './BlockLabel-09bb0248.js';
4import { E as Empty } from './Empty-2eeff83e.js';
5import { S as Static } from './Index-2cec2c56.js';
6import './index-5550136d.js';
7import './svelte/svelte.js';
8
9/* home/runner/work/gradio/gradio/js/icons/src/TextHighlight.svelte generated by Svelte v4.2.2 */
10const {
11	SvelteComponent: SvelteComponent$4,
12	append: append$2,
13	attr: attr$3,
14	detach: detach$4,
15	init: init$4,
16	insert: insert$4,
17	noop: noop$2,
18	safe_not_equal: safe_not_equal$4,
19	svg_element
20} = window.__gradio__svelte__internal;
21function create_fragment$4(ctx) {
22	let svg;
23	let path0;
24	let path1;
25
26	return {
27		c() {
28			svg = svg_element("svg");
29			path0 = svg_element("path");
30			path1 = svg_element("path");
31			attr$3(path0, "fill", "currentColor");
32			attr$3(path0, "d", "M12 15H5a3 3 0 0 1-3-3v-2a3 3 0 0 1 3-3h5V5a1 1 0 0 0-1-1H3V2h6a3 3 0 0 1 3 3zM5 9a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h5V9zm15 14v2a1 1 0 0 0 1 1h5v-4h-5a1 1 0 0 0-1 1z");
33			attr$3(path1, "fill", "currentColor");
34			attr$3(path1, "d", "M2 30h28V2Zm26-2h-7a3 3 0 0 1-3-3v-2a3 3 0 0 1 3-3h5v-2a1 1 0 0 0-1-1h-6v-2h6a3 3 0 0 1 3 3Z");
35			attr$3(svg, "xmlns", "http://www.w3.org/2000/svg");
36			attr$3(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink");
37			attr$3(svg, "aria-hidden", "true");
38			attr$3(svg, "role", "img");
39			attr$3(svg, "class", "iconify iconify--carbon");
40			attr$3(svg, "width", "100%");
41			attr$3(svg, "height", "100%");
42			attr$3(svg, "preserveAspectRatio", "xMidYMid meet");
43			attr$3(svg, "viewBox", "0 0 32 32");
44		},
45		m(target, anchor) {
46			insert$4(target, svg, anchor);
47			append$2(svg, path0);
48			append$2(svg, path1);
49		},
50		p: noop$2,
51		i: noop$2,
52		o: noop$2,
53		d(detaching) {
54			if (detaching) {
55				detach$4(svg);
56			}
57		}
58	};
59}
60
61class TextHighlight extends SvelteComponent$4 {
62	constructor(options) {
63		super();
64		init$4(this, options, null, create_fragment$4, safe_not_equal$4, {});
65	}
66}
67
68function name_to_rgba(name, a, ctx) {
69  if (!ctx) {
70    var canvas = document.createElement("canvas");
71    ctx = canvas.getContext("2d");
72  }
73  ctx.fillStyle = name;
74  ctx.fillRect(0, 0, 1, 1);
75  const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data;
76  ctx.clearRect(0, 0, 1, 1);
77  return `rgba(${r}, ${g}, ${b}, ${255 / a})`;
78}
79function correct_color_map(color_map, _color_map, browser, ctx) {
80  for (const col in color_map) {
81    const _c = color_map[col].trim();
82    if (_c in colors) {
83      _color_map[col] = colors[_c];
84    } else {
85      _color_map[col] = {
86        primary: browser ? name_to_rgba(color_map[col], 1, ctx) : color_map[col],
87        secondary: browser ? name_to_rgba(color_map[col], 0.5, ctx) : color_map[col]
88      };
89    }
90  }
91}
92function merge_elements(value, mergeMode) {
93  let result = [];
94  let tempStr = null;
95  let tempVal = null;
96  for (const val of value) {
97    if (mergeMode === "empty" && val.class_or_confidence === null || mergeMode === "equal" && tempVal === val.class_or_confidence) {
98      tempStr = tempStr ? tempStr + val.token : val.token;
99    } else {
100      if (tempStr !== null) {
101        result.push({
102          token: tempStr,
103          class_or_confidence: tempVal
104        });
105      }
106      tempStr = val.token;
107      tempVal = val.class_or_confidence;
108    }
109  }
110  if (tempStr !== null) {
111    result.push({
112      token: tempStr,
113      class_or_confidence: tempVal
114    });
115  }
116  return result;
117}
118
119const StaticHighlightedtext_svelte_svelte_type_style_lang = '';
120
121/* home/runner/work/gradio/gradio/js/highlightedtext/shared/StaticHighlightedtext.svelte generated by Svelte v4.2.2 */
122const {
123	SvelteComponent: SvelteComponent$3,
124	append: append$1,
125	attr: attr$2,
126	destroy_each: destroy_each$1,
127	detach: detach$3,
128	element: element$2,
129	empty: empty$3,
130	ensure_array_like: ensure_array_like$1,
131	init: init$3,
132	insert: insert$3,
133	listen: listen$2,
134	noop: noop$1,
135	run_all: run_all$2,
136	safe_not_equal: safe_not_equal$3,
137	set_data: set_data$1,
138	set_style: set_style$2,
139	space: space$2,
140	text: text$1,
141	toggle_class: toggle_class$1
142} = window.__gradio__svelte__internal;const { createEventDispatcher: createEventDispatcher$1 } = window.__gradio__svelte__internal;
143function get_each_context_3$1(ctx, list, i) {
144	const child_ctx = ctx.slice();
145	child_ctx[17] = list[i];
146
147	const constants_0 = typeof /*v*/ child_ctx[17].class_or_confidence === "string"
148	? parseInt(/*v*/ child_ctx[17].class_or_confidence)
149	: /*v*/ child_ctx[17].class_or_confidence;
150
151	child_ctx[26] = constants_0;
152	return child_ctx;
153}
154
155function get_each_context$1(ctx, list, i) {
156	const child_ctx = ctx.slice();
157	child_ctx[17] = list[i];
158	child_ctx[19] = i;
159	return child_ctx;
160}
161
162function get_each_context_1$1(ctx, list, i) {
163	const child_ctx = ctx.slice();
164	child_ctx[20] = list[i];
165	child_ctx[22] = i;
166	return child_ctx;
167}
168
169function get_each_context_2$1(ctx, list, i) {
170	const child_ctx = ctx.slice();
171	child_ctx[23] = list[i][0];
172	child_ctx[24] = list[i][1];
173	child_ctx[19] = i;
174	return child_ctx;
175}
176
177// (131:1) {:else}
178function create_else_block$3(ctx) {
179	let t;
180	let div;
181	let if_block = /*show_legend*/ ctx[1] && create_if_block_5$1();
182	let each_value_3 = ensure_array_like$1(/*value*/ ctx[0]);
183	let each_blocks = [];
184
185	for (let i = 0; i < each_value_3.length; i += 1) {
186		each_blocks[i] = create_each_block_3$1(get_each_context_3$1(ctx, each_value_3, i));
187	}
188
189	return {
190		c() {
191			if (if_block) if_block.c();
192			t = space$2();
193			div = element$2("div");
194
195			for (let i = 0; i < each_blocks.length; i += 1) {
196				each_blocks[i].c();
197			}
198
199			attr$2(div, "class", "textfield svelte-ju12zg");
200			attr$2(div, "data-testid", "highlighted-text:textfield");
201		},
202		m(target, anchor) {
203			if (if_block) if_block.m(target, anchor);
204			insert$3(target, t, anchor);
205			insert$3(target, div, anchor);
206
207			for (let i = 0; i < each_blocks.length; i += 1) {
208				if (each_blocks[i]) {
209					each_blocks[i].m(div, null);
210				}
211			}
212		},
213		p(ctx, dirty) {
214			if (/*show_legend*/ ctx[1]) {
215				if (if_block) ; else {
216					if_block = create_if_block_5$1();
217					if_block.c();
218					if_block.m(t.parentNode, t);
219				}
220			} else if (if_block) {
221				if_block.d(1);
222				if_block = null;
223			}
224
225			if (dirty & /*value, parseInt*/ 1) {
226				each_value_3 = ensure_array_like$1(/*value*/ ctx[0]);
227				let i;
228
229				for (i = 0; i < each_value_3.length; i += 1) {
230					const child_ctx = get_each_context_3$1(ctx, each_value_3, i);
231
232					if (each_blocks[i]) {
233						each_blocks[i].p(child_ctx, dirty);
234					} else {
235						each_blocks[i] = create_each_block_3$1(child_ctx);
236						each_blocks[i].c();
237						each_blocks[i].m(div, null);
238					}
239				}
240
241				for (; i < each_blocks.length; i += 1) {
242					each_blocks[i].d(1);
243				}
244
245				each_blocks.length = each_value_3.length;
246			}
247		},
248		d(detaching) {
249			if (detaching) {
250				detach$3(t);
251				detach$3(div);
252			}
253
254			if (if_block) if_block.d(detaching);
255			destroy_each$1(each_blocks, detaching);
256		}
257	};
258}
259
260// (60:1) {#if mode === "categories"}
261function create_if_block$3(ctx) {
262	let t;
263	let div;
264	let if_block = /*show_legend*/ ctx[1] && create_if_block_4$2(ctx);
265	let each_value = ensure_array_like$1(/*value*/ ctx[0]);
266	let each_blocks = [];
267
268	for (let i = 0; i < each_value.length; i += 1) {
269		each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i));
270	}
271
272	return {
273		c() {
274			if (if_block) if_block.c();
275			t = space$2();
276			div = element$2("div");
277
278			for (let i = 0; i < each_blocks.length; i += 1) {
279				each_blocks[i].c();
280			}
281
282			attr$2(div, "class", "textfield svelte-ju12zg");
283		},
284		m(target, anchor) {
285			if (if_block) if_block.m(target, anchor);
286			insert$3(target, t, anchor);
287			insert$3(target, div, anchor);
288
289			for (let i = 0; i < each_blocks.length; i += 1) {
290				if (each_blocks[i]) {
291					each_blocks[i].m(div, null);
292				}
293			}
294		},
295		p(ctx, dirty) {
296			if (/*show_legend*/ ctx[1]) {
297				if (if_block) {
298					if_block.p(ctx, dirty);
299				} else {
300					if_block = create_if_block_4$2(ctx);
301					if_block.c();
302					if_block.m(t.parentNode, t);
303				}
304			} else if (if_block) {
305				if_block.d(1);
306				if_block = null;
307			}
308
309			if (dirty & /*splitTextByNewline, value, active, selectable, _color_map, dispatch, show_legend*/ 111) {
310				each_value = ensure_array_like$1(/*value*/ ctx[0]);
311				let i;
312
313				for (i = 0; i < each_value.length; i += 1) {
314					const child_ctx = get_each_context$1(ctx, each_value, i);
315
316					if (each_blocks[i]) {
317						each_blocks[i].p(child_ctx, dirty);
318					} else {
319						each_blocks[i] = create_each_block$1(child_ctx);
320						each_blocks[i].c();
321						each_blocks[i].m(div, null);
322					}
323				}
324
325				for (; i < each_blocks.length; i += 1) {
326					each_blocks[i].d(1);
327				}
328
329				each_blocks.length = each_value.length;
330			}
331		},
332		d(detaching) {
333			if (detaching) {
334				detach$3(t);
335				detach$3(div);
336			}
337
338			if (if_block) if_block.d(detaching);
339			destroy_each$1(each_blocks, detaching);
340		}
341	};
342}
343
344// (132:2) {#if show_legend}
345function create_if_block_5$1(ctx) {
346	let div;
347
348	return {
349		c() {
350			div = element$2("div");
351			div.innerHTML = `<span>-1</span> <span>0</span> <span>+1</span>`;
352			attr$2(div, "class", "color-legend svelte-ju12zg");
353			attr$2(div, "data-testid", "highlighted-text:color-legend");
354		},
355		m(target, anchor) {
356			insert$3(target, div, anchor);
357		},
358		d(detaching) {
359			if (detaching) {
360				detach$3(div);
361			}
362		}
363	};
364}
365
366// (140:3) {#each value as v}
367function create_each_block_3$1(ctx) {
368	let span1;
369	let span0;
370	let t0_value = /*v*/ ctx[17].token + "";
371	let t0;
372	let t1;
373	let span1_style_value;
374
375	return {
376		c() {
377			span1 = element$2("span");
378			span0 = element$2("span");
379			t0 = text$1(t0_value);
380			t1 = space$2();
381			attr$2(span0, "class", "text svelte-ju12zg");
382			attr$2(span1, "class", "textspan score-text svelte-ju12zg");
383
384			attr$2(span1, "style", span1_style_value = "background-color: rgba(" + (/*score*/ ctx[26] && /*score*/ ctx[26] < 0
385			? "128, 90, 213," + -/*score*/ ctx[26]
386			: "239, 68, 60," + /*score*/ ctx[26]) + ")");
387		},
388		m(target, anchor) {
389			insert$3(target, span1, anchor);
390			append$1(span1, span0);
391			append$1(span0, t0);
392			append$1(span1, t1);
393		},
394		p(ctx, dirty) {
395			if (dirty & /*value*/ 1 && t0_value !== (t0_value = /*v*/ ctx[17].token + "")) set_data$1(t0, t0_value);
396
397			if (dirty & /*value*/ 1 && span1_style_value !== (span1_style_value = "background-color: rgba(" + (/*score*/ ctx[26] && /*score*/ ctx[26] < 0
398			? "128, 90, 213," + -/*score*/ ctx[26]
399			: "239, 68, 60," + /*score*/ ctx[26]) + ")")) {
400				attr$2(span1, "style", span1_style_value);
401			}
402		},
403		d(detaching) {
404			if (detaching) {
405				detach$3(span1);
406			}
407		}
408	};
409}
410
411// (61:2) {#if show_legend}
412function create_if_block_4$2(ctx) {
413	let div;
414	let each_value_2 = ensure_array_like$1(Object.entries(/*_color_map*/ ctx[5]));
415	let each_blocks = [];
416
417	for (let i = 0; i < each_value_2.length; i += 1) {
418		each_blocks[i] = create_each_block_2$1(get_each_context_2$1(ctx, each_value_2, i));
419	}
420
421	return {
422		c() {
423			div = element$2("div");
424
425			for (let i = 0; i < each_blocks.length; i += 1) {
426				each_blocks[i].c();
427			}
428
429			attr$2(div, "class", "category-legend svelte-ju12zg");
430			attr$2(div, "data-testid", "highlighted-text:category-legend");
431		},
432		m(target, anchor) {
433			insert$3(target, div, anchor);
434
435			for (let i = 0; i < each_blocks.length; i += 1) {
436				if (each_blocks[i]) {
437					each_blocks[i].m(div, null);
438				}
439			}
440		},
441		p(ctx, dirty) {
442			if (dirty & /*Object, _color_map, handle_mouseover, handle_mouseout*/ 416) {
443				each_value_2 = ensure_array_like$1(Object.entries(/*_color_map*/ ctx[5]));
444				let i;
445
446				for (i = 0; i < each_value_2.length; i += 1) {
447					const child_ctx = get_each_context_2$1(ctx, each_value_2, i);
448
449					if (each_blocks[i]) {
450						each_blocks[i].p(child_ctx, dirty);
451					} else {
452						each_blocks[i] = create_each_block_2$1(child_ctx);
453						each_blocks[i].c();
454						each_blocks[i].m(div, null);
455					}
456				}
457
458				for (; i < each_blocks.length; i += 1) {
459					each_blocks[i].d(1);
460				}
461
462				each_blocks.length = each_value_2.length;
463			}
464		},
465		d(detaching) {
466			if (detaching) {
467				detach$3(div);
468			}
469
470			destroy_each$1(each_blocks, detaching);
471		}
472	};
473}
474
475// (66:4) {#each Object.entries(_color_map) as [category, color], i}
476function create_each_block_2$1(ctx) {
477	let div;
478	let t0_value = /*category*/ ctx[23] + "";
479	let t0;
480	let t1;
481	let mounted;
482	let dispose;
483
484	function mouseover_handler() {
485		return /*mouseover_handler*/ ctx[10](/*category*/ ctx[23]);
486	}
487
488	function focus_handler() {
489		return /*focus_handler*/ ctx[11](/*category*/ ctx[23]);
490	}
491
492	return {
493		c() {
494			div = element$2("div");
495			t0 = text$1(t0_value);
496			t1 = space$2();
497			attr$2(div, "class", "category-label svelte-ju12zg");
498			attr$2(div, "style", "background-color:" + /*color*/ ctx[24].secondary);
499		},
500		m(target, anchor) {
501			insert$3(target, div, anchor);
502			append$1(div, t0);
503			append$1(div, t1);
504
505			if (!mounted) {
506				dispose = [
507					listen$2(div, "mouseover", mouseover_handler),
508					listen$2(div, "focus", focus_handler),
509					listen$2(div, "mouseout", /*mouseout_handler*/ ctx[12]),
510					listen$2(div, "blur", /*blur_handler*/ ctx[13])
511				];
512
513				mounted = true;
514			}
515		},
516		p(new_ctx, dirty) {
517			ctx = new_ctx;
518		},
519		d(detaching) {
520			if (detaching) {
521				detach$3(div);
522			}
523
524			mounted = false;
525			run_all$2(dispose);
526		}
527	};
528}
529
530// (85:5) {#if line.trim() !== ""}
531function create_if_block_2$2(ctx) {
532	let span1;
533	let span0;
534	let t0_value = /*line*/ ctx[20] + "";
535	let t0;
536	let t1;
537	let mounted;
538	let dispose;
539	let if_block = !/*show_legend*/ ctx[1] && /*v*/ ctx[17].class_or_confidence !== null && create_if_block_3$2(ctx);
540
541	function click_handler() {
542		return /*click_handler*/ ctx[14](/*i*/ ctx[19], /*v*/ ctx[17]);
543	}
544
545	return {
546		c() {
547			span1 = element$2("span");
548			span0 = element$2("span");
549			t0 = text$1(t0_value);
550			t1 = space$2();
551			if (if_block) if_block.c();
552			attr$2(span0, "class", "text svelte-ju12zg");
553			toggle_class$1(span0, "no-label", /*v*/ ctx[17].class_or_confidence === null || !/*_color_map*/ ctx[5][/*v*/ ctx[17].class_or_confidence]);
554			attr$2(span1, "class", "textspan svelte-ju12zg");
555			toggle_class$1(span1, "no-cat", /*v*/ ctx[17].class_or_confidence === null || /*active*/ ctx[3] && /*active*/ ctx[3] !== /*v*/ ctx[17].class_or_confidence);
556			toggle_class$1(span1, "hl", /*v*/ ctx[17].class_or_confidence !== null);
557			toggle_class$1(span1, "selectable", /*selectable*/ ctx[2]);
558
559			set_style$2(span1, "background-color", /*v*/ ctx[17].class_or_confidence === null || /*active*/ ctx[3] && /*active*/ ctx[3] !== /*v*/ ctx[17].class_or_confidence
560			? ""
561			: /*_color_map*/ ctx[5][/*v*/ ctx[17].class_or_confidence].secondary);
562		},
563		m(target, anchor) {
564			insert$3(target, span1, anchor);
565			append$1(span1, span0);
566			append$1(span0, t0);
567			append$1(span1, t1);
568			if (if_block) if_block.m(span1, null);
569
570			if (!mounted) {
571				dispose = listen$2(span1, "click", click_handler);
572				mounted = true;
573			}
574		},
575		p(new_ctx, dirty) {
576			ctx = new_ctx;
577			if (dirty & /*value*/ 1 && t0_value !== (t0_value = /*line*/ ctx[20] + "")) set_data$1(t0, t0_value);
578
579			if (dirty & /*value, _color_map*/ 33) {
580				toggle_class$1(span0, "no-label", /*v*/ ctx[17].class_or_confidence === null || !/*_color_map*/ ctx[5][/*v*/ ctx[17].class_or_confidence]);
581			}
582
583			if (!/*show_legend*/ ctx[1] && /*v*/ ctx[17].class_or_confidence !== null) {
584				if (if_block) {
585					if_block.p(ctx, dirty);
586				} else {
587					if_block = create_if_block_3$2(ctx);
588					if_block.c();
589					if_block.m(span1, null);
590				}
591			} else if (if_block) {
592				if_block.d(1);
593				if_block = null;
594			}
595
596			if (dirty & /*value, active*/ 9) {
597				toggle_class$1(span1, "no-cat", /*v*/ ctx[17].class_or_confidence === null || /*active*/ ctx[3] && /*active*/ ctx[3] !== /*v*/ ctx[17].class_or_confidence);
598			}
599
600			if (dirty & /*value*/ 1) {
601				toggle_class$1(span1, "hl", /*v*/ ctx[17].class_or_confidence !== null);
602			}
603
604			if (dirty & /*selectable*/ 4) {
605				toggle_class$1(span1, "selectable", /*selectable*/ ctx[2]);
606			}
607
608			if (dirty & /*value, active*/ 9) {
609				set_style$2(span1, "background-color", /*v*/ ctx[17].class_or_confidence === null || /*active*/ ctx[3] && /*active*/ ctx[3] !== /*v*/ ctx[17].class_or_confidence
610				? ""
611				: /*_color_map*/ ctx[5][/*v*/ ctx[17].class_or_confidence].secondary);
612			}
613		},
614		d(detaching) {
615			if (detaching) {
616				detach$3(span1);
617			}
618
619			if (if_block) if_block.d();
620			mounted = false;
621			dispose();
622		}
623	};
624}
625
626// (111:7) {#if !show_legend && v.class_or_confidence !== null}
627function create_if_block_3$2(ctx) {
628	let t0;
629	let span;
630	let t1_value = /*v*/ ctx[17].class_or_confidence + "";
631	let t1;
632
633	return {
634		c() {
635			t0 = text$1(" \n\t\t\t\t\t\t\t\t");
636			span = element$2("span");
637			t1 = text$1(t1_value);
638			attr$2(span, "class", "label svelte-ju12zg");
639
640			set_style$2(span, "background-color", /*v*/ ctx[17].class_or_confidence === null || /*active*/ ctx[3] && /*active*/ ctx[3] !== /*v*/ ctx[17].class_or_confidence
641			? ""
642			: /*_color_map*/ ctx[5][/*v*/ ctx[17].class_or_confidence].primary);
643		},
644		m(target, anchor) {
645			insert$3(target, t0, anchor);
646			insert$3(target, span, anchor);
647			append$1(span, t1);
648		},
649		p(ctx, dirty) {
650			if (dirty & /*value*/ 1 && t1_value !== (t1_value = /*v*/ ctx[17].class_or_confidence + "")) set_data$1(t1, t1_value);
651
652			if (dirty & /*value, active*/ 9) {
653				set_style$2(span, "background-color", /*v*/ ctx[17].class_or_confidence === null || /*active*/ ctx[3] && /*active*/ ctx[3] !== /*v*/ ctx[17].class_or_confidence
654				? ""
655				: /*_color_map*/ ctx[5][/*v*/ ctx[17].class_or_confidence].primary);
656			}
657		},
658		d(detaching) {
659			if (detaching) {
660				detach$3(t0);
661				detach$3(span);
662			}
663		}
664	};
665}
666
667// (125:5) {#if j < splitTextByNewline(v.token).length - 1}
668function create_if_block_1$2(ctx) {
669	let br;
670
671	return {
672		c() {
673			br = element$2("br");
674		},
675		m(target, anchor) {
676			insert$3(target, br, anchor);
677		},
678		d(detaching) {
679			if (detaching) {
680				detach$3(br);
681			}
682		}
683	};
684}
685
686// (84:4) {#each splitTextByNewline(v.token) as line, j}
687function create_each_block_1$1(ctx) {
688	let show_if_1 = /*line*/ ctx[20].trim() !== "";
689	let t;
690	let show_if = /*j*/ ctx[22] < splitTextByNewline$1(/*v*/ ctx[17].token).length - 1;
691	let if_block1_anchor;
692	let if_block0 = show_if_1 && create_if_block_2$2(ctx);
693	let if_block1 = show_if && create_if_block_1$2();
694
695	return {
696		c() {
697			if (if_block0) if_block0.c();
698			t = space$2();
699			if (if_block1) if_block1.c();
700			if_block1_anchor = empty$3();
701		},
702		m(target, anchor) {
703			if (if_block0) if_block0.m(target, anchor);
704			insert$3(target, t, anchor);
705			if (if_block1) if_block1.m(target, anchor);
706			insert$3(target, if_block1_anchor, anchor);
707		},
708		p(ctx, dirty) {
709			if (dirty & /*value*/ 1) show_if_1 = /*line*/ ctx[20].trim() !== "";
710
711			if (show_if_1) {
712				if (if_block0) {
713					if_block0.p(ctx, dirty);
714				} else {
715					if_block0 = create_if_block_2$2(ctx);
716					if_block0.c();
717					if_block0.m(t.parentNode, t);
718				}
719			} else if (if_block0) {
720				if_block0.d(1);
721				if_block0 = null;
722			}
723
724			if (dirty & /*value*/ 1) show_if = /*j*/ ctx[22] < splitTextByNewline$1(/*v*/ ctx[17].token).length - 1;
725
726			if (show_if) {
727				if (if_block1) ; else {
728					if_block1 = create_if_block_1$2();
729					if_block1.c();
730					if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
731				}
732			} else if (if_block1) {
733				if_block1.d(1);
734				if_block1 = null;
735			}
736		},
737		d(detaching) {
738			if (detaching) {
739				detach$3(t);
740				detach$3(if_block1_anchor);
741			}
742
743			if (if_block0) if_block0.d(detaching);
744			if (if_block1) if_block1.d(detaching);
745		}
746	};
747}
748
749// (83:3) {#each value as v, i}
750function create_each_block$1(ctx) {
751	let each_1_anchor;
752	let each_value_1 = ensure_array_like$1(splitTextByNewline$1(/*v*/ ctx[17].token));
753	let each_blocks = [];
754
755	for (let i = 0; i < each_value_1.length; i += 1) {
756		each_blocks[i] = create_each_block_1$1(get_each_context_1$1(ctx, each_value_1, i));
757	}
758
759	return {
760		c() {
761			for (let i = 0; i < each_blocks.length; i += 1) {
762				each_blocks[i].c();
763			}
764
765			each_1_anchor = empty$3();
766		},
767		m(target, anchor) {
768			for (let i = 0; i < each_blocks.length; i += 1) {
769				if (each_blocks[i]) {
770					each_blocks[i].m(target, anchor);
771				}
772			}
773
774			insert$3(target, each_1_anchor, anchor);
775		},
776		p(ctx, dirty) {
777			if (dirty & /*splitTextByNewline, value, active, selectable, _color_map, dispatch, show_legend*/ 111) {
778				each_value_1 = ensure_array_like$1(splitTextByNewline$1(/*v*/ ctx[17].token));
779				let i;
780
781				for (i = 0; i < each_value_1.length; i += 1) {
782					const child_ctx = get_each_context_1$1(ctx, each_value_1, i);
783
784					if (each_blocks[i]) {
785						each_blocks[i].p(child_ctx, dirty);
786					} else {
787						each_blocks[i] = create_each_block_1$1(child_ctx);
788						each_blocks[i].c();
789						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
790					}
791				}
792
793				for (; i < each_blocks.length; i += 1) {
794					each_blocks[i].d(1);
795				}
796
797				each_blocks.length = each_value_1.length;
798			}
799		},
800		d(detaching) {
801			if (detaching) {
802				detach$3(each_1_anchor);
803			}
804
805			destroy_each$1(each_blocks, detaching);
806		}
807	};
808}
809
810function create_fragment$3(ctx) {
811	let div;
812
813	function select_block_type(ctx, dirty) {
814		if (/*mode*/ ctx[4] === "categories") return create_if_block$3;
815		return create_else_block$3;
816	}
817
818	let current_block_type = select_block_type(ctx);
819	let if_block = current_block_type(ctx);
820
821	return {
822		c() {
823			div = element$2("div");
824			if_block.c();
825			attr$2(div, "class", "container svelte-ju12zg");
826		},
827		m(target, anchor) {
828			insert$3(target, div, anchor);
829			if_block.m(div, null);
830		},
831		p(ctx, [dirty]) {
832			if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
833				if_block.p(ctx, dirty);
834			} else {
835				if_block.d(1);
836				if_block = current_block_type(ctx);
837
838				if (if_block) {
839					if_block.c();
840					if_block.m(div, null);
841				}
842			}
843		},
844		i: noop$1,
845		o: noop$1,
846		d(detaching) {
847			if (detaching) {
848				detach$3(div);
849			}
850
851			if_block.d();
852		}
853	};
854}
855
856function splitTextByNewline$1(text) {
857	return text.split("\n");
858}
859
860function instance$3($$self, $$props, $$invalidate) {
861	const browser = typeof document !== "undefined";
862	let { value = [] } = $$props;
863	let { show_legend = false } = $$props;
864	let { color_map = {} } = $$props;
865	let { selectable = false } = $$props;
866	let ctx;
867	let _color_map = {};
868	let active = "";
869	const dispatch = createEventDispatcher$1();
870	let mode;
871
872	function handle_mouseover(label) {
873		$$invalidate(3, active = label);
874	}
875
876	function handle_mouseout() {
877		$$invalidate(3, active = "");
878	}
879
880	const mouseover_handler = category => handle_mouseover(category);
881	const focus_handler = category => handle_mouseover(category);
882	const mouseout_handler = () => handle_mouseout();
883	const blur_handler = () => handle_mouseout();
884
885	const click_handler = (i, v) => {
886		dispatch("select", {
887			index: i,
888			value: [v.token, v.class_or_confidence]
889		});
890	};
891
892	$$self.$$set = $$props => {
893		if ('value' in $$props) $$invalidate(0, value = $$props.value);
894		if ('show_legend' in $$props) $$invalidate(1, show_legend = $$props.show_legend);
895		if ('color_map' in $$props) $$invalidate(9, color_map = $$props.color_map);
896		if ('selectable' in $$props) $$invalidate(2, selectable = $$props.selectable);
897	};
898
899	$$self.$$.update = () => {
900		if ($$self.$$.dirty & /*color_map, value*/ 513) {
901			{
902				if (!color_map) {
903					$$invalidate(9, color_map = {});
904				}
905
906				if (value.length > 0) {
907					for (let entry of value) {
908						if (entry.class_or_confidence !== null) {
909							if (typeof entry.class_or_confidence === "string") {
910								$$invalidate(4, mode = "categories");
911
912								if (!(entry.class_or_confidence in color_map)) {
913									let color = get_next_color(Object.keys(color_map).length);
914									$$invalidate(9, color_map[entry.class_or_confidence] = color, color_map);
915								}
916							} else {
917								$$invalidate(4, mode = "scores");
918							}
919						}
920					}
921				}
922
923				correct_color_map(color_map, _color_map, browser, ctx);
924			}
925		}
926	};
927
928	return [
929		value,
930		show_legend,
931		selectable,
932		active,
933		mode,
934		_color_map,
935		dispatch,
936		handle_mouseover,
937		handle_mouseout,
938		color_map,
939		mouseover_handler,
940		focus_handler,
941		mouseout_handler,
942		blur_handler,
943		click_handler
944	];
945}
946
947class StaticHighlightedtext extends SvelteComponent$3 {
948	constructor(options) {
949		super();
950
951		init$3(this, options, instance$3, create_fragment$3, safe_not_equal$3, {
952			value: 0,
953			show_legend: 1,
954			color_map: 9,
955			selectable: 2
956		});
957	}
958}
959
960const StaticHighlightedText = StaticHighlightedtext;
961
962const LabelInput_svelte_svelte_type_style_lang = '';
963
964/* home/runner/work/gradio/gradio/js/highlightedtext/shared/LabelInput.svelte generated by Svelte v4.2.2 */
965const {
966	SvelteComponent: SvelteComponent$2,
967	attr: attr$1,
968	detach: detach$2,
969	element: element$1,
970	empty: empty$2,
971	init: init$2,
972	insert: insert$2,
973	listen: listen$1,
974	noop,
975	run_all: run_all$1,
976	safe_not_equal: safe_not_equal$2,
977	set_style: set_style$1
978} = window.__gradio__svelte__internal;
979function create_else_block$2(ctx) {
980	let input;
981	let input_style_value;
982	let mounted;
983	let dispose;
984
985	return {
986		c() {
987			input = element$1("input");
988			attr$1(input, "class", "label-input svelte-1cag2po");
989			input.autofocus = true;
990			attr$1(input, "type", "number");
991			attr$1(input, "step", "0.1");
992
993			attr$1(input, "style", input_style_value = "background-color: rgba(" + (typeof /*category*/ ctx[1] === "number" && /*category*/ ctx[1] < 0
994			? "128, 90, 213," + -/*category*/ ctx[1]
995			: "239, 68, 60," + /*category*/ ctx[1]) + ")");
996
997			input.value = /*category*/ ctx[1];
998			set_style$1(input, "width", `7ch`);
999		},
1000		m(target, anchor) {
1001			insert$2(target, input, anchor);
1002			input.focus();
1003
1004			if (!mounted) {
1005				dispose = [
1006					listen$1(input, "input", /*handleInput*/ ctx[8]),
1007					listen$1(input, "blur", /*blur_handler_1*/ ctx[14]),
1008					listen$1(input, "keydown", /*keydown_handler_1*/ ctx[15])
1009				];
1010
1011				mounted = true;
1012			}
1013		},
1014		p(ctx, dirty) {
1015			if (dirty & /*category*/ 2 && input_style_value !== (input_style_value = "background-color: rgba(" + (typeof /*category*/ ctx[1] === "number" && /*category*/ ctx[1] < 0
1016			? "128, 90, 213," + -/*category*/ ctx[1]
1017			: "239, 68, 60," + /*category*/ ctx[1]) + ")")) {
1018				attr$1(input, "style", input_style_value);
1019			}
1020
1021			if (dirty & /*category*/ 2 && input.value !== /*category*/ ctx[1]) {
1022				input.value = /*category*/ ctx[1];
1023			}
1024
1025			const style_changed = dirty & /*category*/ 2;
1026
1027			if (dirty & /*category*/ 2 || style_changed) {
1028				set_style$1(input, "width", `7ch`);
1029			}
1030		},
1031		d(detaching) {
1032			if (detaching) {
1033				detach$2(input);
1034			}
1035
1036			mounted = false;
1037			run_all$1(dispose);
1038		}
1039	};
1040}
1041
1042// (43:0) {#if !isScoresMode}
1043function create_if_block$2(ctx) {
1044	let input;
1045	let input_id_value;
1046	let mounted;
1047	let dispose;
1048
1049	return {
1050		c() {
1051			input = element$1("input");
1052			attr$1(input, "class", "label-input svelte-1cag2po");
1053			input.autofocus = true;
1054			attr$1(input, "id", input_id_value = `label-input-${/*indexOfLabel*/ ctx[3]}`);
1055			attr$1(input, "type", "text");
1056			attr$1(input, "placeholder", "label");
1057			input.value = /*category*/ ctx[1];
1058
1059			set_style$1(input, "background-color", /*category*/ ctx[1] === null || /*active*/ ctx[2] && /*active*/ ctx[2] !== /*category*/ ctx[1]
1060			? ""
1061			: /*_color_map*/ ctx[6][/*category*/ ctx[1]].primary);
1062
1063			set_style$1(input, "width", /*_input_value*/ ctx[7]
1064			? /*_input_value*/ ctx[7].toString()?.length + 4 + "ch"
1065			: "8ch");
1066		},
1067		m(target, anchor) {
1068			insert$2(target, input, anchor);
1069			input.focus();
1070
1071			if (!mounted) {
1072				dispose = [
1073					listen$1(input, "input", /*handleInput*/ ctx[8]),
1074					listen$1(input, "blur", /*blur_handler*/ ctx[12]),
1075					listen$1(input, "keydown", /*keydown_handler*/ ctx[13]),
1076					listen$1(input, "focus", clearPlaceHolderOnFocus)
1077				];
1078
1079				mounted = true;
1080			}
1081		},
1082		p(ctx, dirty) {
1083			if (dirty & /*indexOfLabel*/ 8 && input_id_value !== (input_id_value = `label-input-${/*indexOfLabel*/ ctx[3]}`)) {
1084				attr$1(input, "id", input_id_value);
1085			}
1086
1087			if (dirty & /*category*/ 2 && input.value !== /*category*/ ctx[1]) {
1088				input.value = /*category*/ ctx[1];
1089			}
1090
1091			if (dirty & /*category, active, _color_map*/ 70) {
1092				set_style$1(input, "background-color", /*category*/ ctx[1] === null || /*active*/ ctx[2] && /*active*/ ctx[2] !== /*category*/ ctx[1]
1093				? ""
1094				: /*_color_map*/ ctx[6][/*category*/ ctx[1]].primary);
1095			}
1096
1097			if (dirty & /*_input_value*/ 128) {
1098				set_style$1(input, "width", /*_input_value*/ ctx[7]
1099				? /*_input_value*/ ctx[7].toString()?.length + 4 + "ch"
1100				: "8ch");
1101			}
1102		},
1103		d(detaching) {
1104			if (detaching) {
1105				detach$2(input);
1106			}
1107
1108			mounted = false;
1109			run_all$1(dispose);
1110		}
1111	};
1112}
1113
1114function create_fragment$2(ctx) {
1115	let if_block_anchor;
1116
1117	function select_block_type(ctx, dirty) {
1118		if (!/*isScoresMode*/ ctx[5]) return create_if_block$2;
1119		return create_else_block$2;
1120	}
1121
1122	let current_block_type = select_block_type(ctx);
1123	let if_block = current_block_type(ctx);
1124
1125	return {
1126		c() {
1127			if_block.c();
1128			if_block_anchor = empty$2();
1129		},
1130		m(target, anchor) {
1131			if_block.m(target, anchor);
1132			insert$2(target, if_block_anchor, anchor);
1133		},
1134		p(ctx, [dirty]) {
1135			if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) {
1136				if_block.p(ctx, dirty);
1137			} else {
1138				if_block.d(1);
1139				if_block = current_block_type(ctx);
1140
1141				if (if_block) {
1142					if_block.c();
1143					if_block.m(if_block_anchor.parentNode, if_block_anchor);
1144				}
1145			}
1146		},
1147		i: noop,
1148		o: noop,
1149		d(detaching) {
1150			if (detaching) {
1151				detach$2(if_block_anchor);
1152			}
1153
1154			if_block.d(detaching);
1155		}
1156	};
1157}
1158
1159function clearPlaceHolderOnFocus(e) {
1160	let target = e.target;
1161	if (target && target.placeholder) target.placeholder = "";
1162}
1163
1164function instance$2($$self, $$props, $$invalidate) {
1165	let { value } = $$props;
1166	let { category } = $$props;
1167	let { active } = $$props;
1168	let { labelToEdit } = $$props;
1169	let { indexOfLabel } = $$props;
1170	let { text } = $$props;
1171	let { handleValueChange } = $$props;
1172	let { isScoresMode = false } = $$props;
1173	let { _color_map } = $$props;
1174	let _input_value = category;
1175
1176	function handleInput(e) {
1177		let target = e.target;
1178
1179		if (target) {
1180			$$invalidate(7, _input_value = target.value);
1181		}
1182	}
1183
1184	function updateLabelValue(e, elementIndex, text) {
1185		let target = e.target;
1186
1187		$$invalidate(10, value = [
1188			...value.slice(0, elementIndex),
1189			{
1190				token: text,
1191				class_or_confidence: target.value === ""
1192				? null
1193				: isScoresMode ? Number(target.value) : target.value
1194			},
1195			...value.slice(elementIndex + 1)
1196		]);
1197
1198		handleValueChange();
1199	}
1200
1201	const blur_handler = e => updateLabelValue(e, indexOfLabel, text);
1202
1203	const keydown_handler = e => {
1204		if (e.key === "Enter") {
1205			updateLabelValue(e, indexOfLabel, text);
1206			$$invalidate(0, labelToEdit = -1);
1207		}
1208	};
1209
1210	const blur_handler_1 = e => updateLabelValue(e, indexOfLabel, text);
1211
1212	const keydown_handler_1 = e => {
1213		if (e.key === "Enter") {
1214			updateLabelValue(e, indexOfLabel, text);
1215			$$invalidate(0, labelToEdit = -1);
1216		}
1217	};
1218
1219	$$self.$$set = $$props => {
1220		if ('value' in $$props) $$invalidate(10, value = $$props.value);
1221		if ('category' in $$props) $$invalidate(1, category = $$props.category);
1222		if ('active' in $$props) $$invalidate(2, active = $$props.active);
1223		if ('labelToEdit' in $$props) $$invalidate(0, labelToEdit = $$props.labelToEdit);
1224		if ('indexOfLabel' in $$props) $$invalidate(3, indexOfLabel = $$props.indexOfLabel);
1225		if ('text' in $$props) $$invalidate(4, text = $$props.text);
1226		if ('handleValueChange' in $$props) $$invalidate(11, handleValueChange = $$props.handleValueChange);
1227		if ('isScoresMode' in $$props) $$invalidate(5, isScoresMode = $$props.isScoresMode);
1228		if ('_color_map' in $$props) $$invalidate(6, _color_map = $$props._color_map);
1229	};
1230
1231	return [
1232		labelToEdit,
1233		category,
1234		active,
1235		indexOfLabel,
1236		text,
1237		isScoresMode,
1238		_color_map,
1239		_input_value,
1240		handleInput,
1241		updateLabelValue,
1242		value,
1243		handleValueChange,
1244		blur_handler,
1245		keydown_handler,
1246		blur_handler_1,
1247		keydown_handler_1
1248	];
1249}
1250
1251class LabelInput extends SvelteComponent$2 {
1252	constructor(options) {
1253		super();
1254
1255		init$2(this, options, instance$2, create_fragment$2, safe_not_equal$2, {
1256			value: 10,
1257			category: 1,
1258			active: 2,
1259			labelToEdit: 0,
1260			indexOfLabel: 3,
1261			text: 4,
1262			handleValueChange: 11,
1263			isScoresMode: 5,
1264			_color_map: 6
1265		});
1266	}
1267}
1268
1269const InteractiveHighlightedtext_svelte_svelte_type_style_lang = '';
1270
1271/* home/runner/work/gradio/gradio/js/highlightedtext/shared/InteractiveHighlightedtext.svelte generated by Svelte v4.2.2 */
1272const {
1273	SvelteComponent: SvelteComponent$1,
1274	add_flush_callback: add_flush_callback$1,
1275	append,
1276	attr,
1277	bind: bind$1,
1278	binding_callbacks: binding_callbacks$1,
1279	check_outros: check_outros$1,
1280	create_component: create_component$1,
1281	destroy_component: destroy_component$1,
1282	destroy_each,
1283	detach: detach$1,
1284	element,
1285	empty: empty$1,
1286	ensure_array_like,
1287	group_outros: group_outros$1,
1288	init: init$1,
1289	insert: insert$1,
1290	listen,
1291	mount_component: mount_component$1,
1292	run_all,
1293	safe_not_equal: safe_not_equal$1,
1294	set_data,
1295	set_style,
1296	space: space$1,
1297	text,
1298	toggle_class,
1299	transition_in: transition_in$1,
1300	transition_out: transition_out$1
1301} = window.__gradio__svelte__internal;const { createEventDispatcher, onMount } = window.__gradio__svelte__internal;
1302function get_each_context_3(ctx, list, i) {
1303	const child_ctx = ctx.slice();
1304	child_ctx[45] = list[i].token;
1305	child_ctx[46] = list[i].class_or_confidence;
1306	child_ctx[48] = i;
1307
1308	const constants_0 = typeof /*class_or_confidence*/ child_ctx[46] === "string"
1309	? parseInt(/*class_or_confidence*/ child_ctx[46])
1310	: /*class_or_confidence*/ child_ctx[46];
1311
1312	child_ctx[54] = constants_0;
1313	return child_ctx;
1314}
1315
1316function get_each_context(ctx, list, i) {
1317	const child_ctx = ctx.slice();
1318	child_ctx[45] = list[i].token;
1319	child_ctx[46] = list[i].class_or_confidence;
1320	child_ctx[48] = i;
1321	return child_ctx;
1322}
1323
1324function get_each_context_1(ctx, list, i) {
1325	const child_ctx = ctx.slice();
1326	child_ctx[49] = list[i];
1327	child_ctx[51] = i;
1328	return child_ctx;
1329}
1330
1331function get_each_context_2(ctx, list, i) {
1332	const child_ctx = ctx.slice();
1333	child_ctx[46] = list[i][0];
1334	child_ctx[52] = list[i][1];
1335	child_ctx[48] = i;
1336	return child_ctx;
1337}
1338
1339// (254:1) {:else}
1340function create_else_block$1(ctx) {
1341	let t;
1342	let div;
1343	let current;
1344	let if_block = /*show_legend*/ ctx[1] && create_if_block_10();
1345	let each_value_3 = ensure_array_like(/*value*/ ctx[0]);
1346	let each_blocks = [];
1347
1348	for (let i = 0; i < each_value_3.length; i += 1) {
1349		each_blocks[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i));
1350	}
1351
1352	const out = i => transition_out$1(each_blocks[i], 1, 1, () => {
1353		each_blocks[i] = null;
1354	});
1355
1356	return {
1357		c() {
1358			if (if_block) if_block.c();
1359			t = space$1();
1360			div = element("div");
1361
1362			for (let i = 0; i < each_blocks.length; i += 1) {
1363				each_blocks[i].c();
1364			}
1365
1366			attr(div, "class", "textfield svelte-1ozsnjl");
1367			attr(div, "data-testid", "highlighted-text:textfield");
1368		},
1369		m(target, anchor) {
1370			if (if_block) if_block.m(target, anchor);
1371			insert$1(target, t, anchor);
1372			insert$1(target, div, anchor);
1373
1374			for (let i = 0; i < each_blocks.length; i += 1) {
1375				if (each_blocks[i]) {
1376					each_blocks[i].m(div, null);
1377				}
1378			}
1379
1380			current = true;
1381		},
1382		p(ctx, dirty) {
1383			if (/*show_legend*/ ctx[1]) {
1384				if (if_block) ; else {
1385					if_block = create_if_block_10();
1386					if_block.c();
1387					if_block.m(t.parentNode, t);
1388				}
1389			} else if (if_block) {
1390				if_block.d(1);
1391				if_block = null;
1392			}
1393
1394			if (dirty[0] & /*removeHighlightedText, value, activeElementIndex, active, labelToEdit, _color_map, handleValueChange*/ 889) {
1395				each_value_3 = ensure_array_like(/*value*/ ctx[0]);
1396				let i;
1397
1398				for (i = 0; i < each_value_3.length; i += 1) {
1399					const child_ctx = get_each_context_3(ctx, each_value_3, i);
1400
1401					if (each_blocks[i]) {
1402						each_blocks[i].p(child_ctx, dirty);
1403						transition_in$1(each_blocks[i], 1);
1404					} else {
1405						each_blocks[i] = create_each_block_3(child_ctx);
1406						each_blocks[i].c();
1407						transition_in$1(each_blocks[i], 1);
1408						each_blocks[i].m(div, null);
1409					}
1410				}
1411
1412				group_outros$1();
1413
1414				for (i = each_value_3.length; i < each_blocks.length; i += 1) {
1415					out(i);
1416				}
1417
1418				check_outros$1();
1419			}
1420		},
1421		i(local) {
1422			if (current) return;
1423
1424			for (let i = 0; i < each_value_3.length; i += 1) {
1425				transition_in$1(each_blocks[i]);
1426			}
1427
1428			current = true;
1429		},
1430		o(local) {
1431			each_blocks = each_blocks.filter(Boolean);
1432
1433			for (let i = 0; i < each_blocks.length; i += 1) {
1434				transition_out$1(each_blocks[i]);
1435			}
1436
1437			current = false;
1438		},
1439		d(detaching) {
1440			if (detaching) {
1441				detach$1(t);
1442				detach$1(div);
1443			}
1444
1445			if (if_block) if_block.d(detaching);
1446			destroy_each(each_blocks, detaching);
1447		}
1448	};
1449}
1450
1451// (130:1) {#if mode === "categories"}
1452function create_if_block$1(ctx) {
1453	let t;
1454	let div;
1455	let current;
1456	let if_block = /*show_legend*/ ctx[1] && create_if_block_6(ctx);
1457	let each_value = ensure_array_like(/*value*/ ctx[0]);
1458	let each_blocks = [];
1459
1460	for (let i = 0; i < each_value.length; i += 1) {
1461		each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
1462	}
1463
1464	const out = i => transition_out$1(each_blocks[i], 1, 1, () => {
1465		each_blocks[i] = null;
1466	});
1467
1468	return {
1469		c() {
1470			if (if_block) if_block.c();
1471			t = space$1();
1472			div = element("div");
1473
1474			for (let i = 0; i < each_blocks.length; i += 1) {
1475				each_blocks[i].c();
1476			}
1477
1478			attr(div, "class", "textfield svelte-1ozsnjl");
1479		},
1480		m(target, anchor) {
1481			if (if_block) if_block.m(target, anchor);
1482			insert$1(target, t, anchor);
1483			insert$1(target, div, anchor);
1484
1485			for (let i = 0; i < each_blocks.length; i += 1) {
1486				if (each_blocks[i]) {
1487					each_blocks[i].m(div, null);
1488				}
1489			}
1490
1491			current = true;
1492		},
1493		p(ctx, dirty) {
1494			if (/*show_legend*/ ctx[1]) {
1495				if (if_block) {
1496					if_block.p(ctx, dirty);
1497				} else {
1498					if_block = create_if_block_6(ctx);
1499					if_block.c();
1500					if_block.m(t.parentNode, t);
1501				}
1502			} else if (if_block) {
1503				if_block.d(1);
1504				if_block = null;
1505			}
1506
1507			if (dirty[0] & /*value, removeHighlightedText, active, selectable, _color_map, handleSelect, labelToEdit, handleKeydownSelection, activeElementIndex, handleValueChange, show_legend*/ 13183) {
1508				each_value = ensure_array_like(/*value*/ ctx[0]);
1509				let i;
1510
1511				for (i = 0; i < each_value.length; i += 1) {
1512					const child_ctx = get_each_context(ctx, each_value, i);
1513
1514					if (each_blocks[i]) {
1515						each_blocks[i].p(child_ctx, dirty);
1516						transition_in$1(each_blocks[i], 1);
1517					} else {
1518						each_blocks[i] = create_each_block(child_ctx);
1519						each_blocks[i].c();
1520						transition_in$1(each_blocks[i], 1);
1521						each_blocks[i].m(div, null);
1522					}
1523				}
1524
1525				group_outros$1();
1526
1527				for (i = each_value.length; i < each_blocks.length; i += 1) {
1528					out(i);
1529				}
1530
1531				check_outros$1();
1532			}
1533		},
1534		i(local) {
1535			if (current) return;
1536
1537			for (let i = 0; i < each_value.length; i += 1) {
1538				transition_in$1(each_blocks[i]);
1539			}
1540
1541			current = true;
1542		},
1543		o(local) {
1544			each_blocks = each_blocks.filter(Boolean);
1545
1546			for (let i = 0; i < each_blocks.length; i += 1) {
1547				transition_out$1(each_blocks[i]);
1548			}
1549
1550			current = false;
1551		},
1552		d(detaching) {
1553			if (detaching) {
1554				detach$1(t);
1555				detach$1(div);
1556			}
1557
1558			if (if_block) if_block.d(detaching);
1559			destroy_each(each_blocks, detaching);
1560		}
1561	};
1562}
1563
1564// (255:2) {#if show_legend}
1565function create_if_block_10(ctx) {
1566	let div;
1567
1568	return {
1569		c() {
1570			div = element("div");
1571			div.innerHTML = `<span>-1</span> <span>0</span> <span>+1</span>`;
1572			attr(div, "class", "color-legend svelte-1ozsnjl");
1573			attr(div, "data-testid", "highlighted-text:color-legend");
1574		},
1575		m(target, anchor) {
1576			insert$1(target, div, anchor);
1577		},
1578		d(detaching) {
1579			if (detaching) {
1580				detach$1(div);
1581			}
1582		}
1583	};
1584}
1585
1586// (292:6) {#if class_or_confidence && labelToEdit === i}
1587function create_if_block_9(ctx) {
1588	let labelinput;
1589	let updating_value;
1590	let current;
1591
1592	function labelinput_value_binding_1(value) {
1593		/*labelinput_value_binding_1*/ ctx[32](value);
1594	}
1595
1596	let labelinput_props = {
1597		labelToEdit: /*labelToEdit*/ ctx[6],
1598		_color_map: /*_color_map*/ ctx[3],
1599		category: /*class_or_confidence*/ ctx[46],
1600		active: /*active*/ ctx[5],
1601		indexOfLabel: /*i*/ ctx[48],
1602		text: /*token*/ ctx[45],
1603		handleValueChange: /*handleValueChange*/ ctx[9],
1604		isScoresMode: true
1605	};
1606
1607	if (/*value*/ ctx[0] !== void 0) {
1608		labelinput_props.value = /*value*/ ctx[0];
1609	}
1610
1611	labelinput = new LabelInput({ props: labelinput_props });
1612	binding_callbacks$1.push(() => bind$1(labelinput, 'value', labelinput_value_binding_1));
1613
1614	return {
1615		c() {
1616			create_component$1(labelinput.$$.fragment);
1617		},
1618		m(target, anchor) {
1619			mount_component$1(labelinput, target, anchor);
1620			current = true;
1621		},
1622		p(ctx, dirty) {
1623			const labelinput_changes = {};
1624			if (dirty[0] & /*labelToEdit*/ 64) labelinput_changes.labelToEdit = /*labelToEdit*/ ctx[6];
1625			if (dirty[0] & /*_color_map*/ 8) labelinput_changes._color_map = /*_color_map*/ ctx[3];
1626			if (dirty[0] & /*value*/ 1) labelinput_changes.category = /*class_or_confidence*/ ctx[46];
1627			if (dirty[0] & /*active*/ 32) labelinput_changes.active = /*active*/ ctx[5];
1628			if (dirty[0] & /*value*/ 1) labelinput_changes.text = /*token*/ ctx[45];
1629
1630			if (!updating_value && dirty[0] & /*value*/ 1) {
1631				updating_value = true;
1632				labelinput_changes.value = /*value*/ ctx[0];
1633				add_flush_callback$1(() => updating_value = false);
1634			}
1635
1636			labelinput.$set(labelinput_changes);
1637		},
1638		i(local) {
1639			if (current) return;
1640			transition_in$1(labelinput.$$.fragment, local);
1641			current = true;
1642		},
1643		o(local) {
1644			transition_out$1(labelinput.$$.fragment, local);
1645			current = false;
1646		},
1647		d(detaching) {
1648			destroy_component$1(labelinput, detaching);
1649		}
1650	};
1651}
1652
1653// (306:5) {#if class_or_confidence && activeElementIndex === i}
1654function create_if_block_8(ctx) {
1655	let span;
1656	let mounted;
1657	let dispose;
1658
1659	function click_handler_5() {
1660		return /*click_handler_5*/ ctx[37](/*i*/ ctx[48]);
1661	}
1662
1663	function keydown_handler_5(...args) {
1664		return /*keydown_handler_5*/ ctx[38](/*i*/ ctx[48], ...args);
1665	}
1666
1667	return {
1668		c() {
1669			span = element("span");
1670			span.textContent = "×";
1671			attr(span, "class", "label-clear-button svelte-1ozsnjl");
1672			attr(span, "role", "button");
1673			attr(span, "aria-roledescription", "Remove label from text");
1674			attr(span, "tabindex", "0");
1675		},
1676		m(target, anchor) {
1677			insert$1(target, span, anchor);
1678
1679			if (!mounted) {
1680				dispose = [
1681					listen(span, "click", click_handler_5),
1682					listen(span, "keydown", keydown_handler_5)
1683				];
1684
1685				mounted = true;
1686			}
1687		},
1688		p(new_ctx, dirty) {
1689			ctx = new_ctx;
1690		},
1691		d(detaching) {
1692			if (detaching) {
1693				detach$1(span);
1694			}
1695
1696			mounted = false;
1697			run_all(dispose);
1698		}
1699	};
1700}
1701
1702// (264:3) {#each value as { token, class_or_confidence }
1703function create_each_block_3(ctx) {
1704	let span2;
1705	let span1;
1706	let span0;
1707	let t0_value = /*token*/ ctx[45] + "";
1708	let t0;
1709	let t1;
1710	let span1_style_value;
1711	let t2;
1712	let t3;
1713	let current;
1714	let mounted;
1715	let dispose;
1716	let if_block0 = /*class_or_confidence*/ ctx[46] && /*labelToEdit*/ ctx[6] === /*i*/ ctx[48] && create_if_block_9(ctx);
1717
1718	function mouseover_handler_3() {
1719		return /*mouseover_handler_3*/ ctx[33](/*i*/ ctx[48]);
1720	}
1721
1722	function focus_handler_3() {
1723		return /*focus_handler_3*/ ctx[34](/*i*/ ctx[48]);
1724	}
1725
1726	function click_handler_4() {
1727		return /*click_handler_4*/ ctx[35](/*i*/ ctx[48]);
1728	}
1729
1730	function keydown_handler_4(...args) {
1731		return /*keydown_handler_4*/ ctx[36](/*i*/ ctx[48], ...args);
1732	}
1733
1734	let if_block1 = /*class_or_confidence*/ ctx[46] && /*activeElementIndex*/ ctx[4] === /*i*/ ctx[48] && create_if_block_8(ctx);
1735
1736	return {
1737		c() {
1738			span2 = element("span");
1739			span1 = element("span");
1740			span0 = element("span");
1741			t0 = text(t0_value);
1742			t1 = space$1();
1743			if (if_block0) if_block0.c();
1744			t2 = space$1();
1745			if (if_block1) if_block1.c();
1746			t3 = space$1();
1747			attr(span0, "class", "text svelte-1ozsnjl");
1748			attr(span1, "class", "textspan score-text svelte-1ozsnjl");
1749			attr(span1, "role", "button");
1750			attr(span1, "tabindex", "0");
1751
1752			attr(span1, "style", span1_style_value = "background-color: rgba(" + (/*score*/ ctx[54] && /*score*/ ctx[54] < 0
1753			? "128, 90, 213," + -/*score*/ ctx[54]
1754			: "239, 68, 60," + /*score*/ ctx[54]) + ")");
1755
1756			toggle_class(span1, "no-cat", /*class_or_confidence*/ ctx[46] === null || /*active*/ ctx[5] && /*active*/ ctx[5] !== /*class_or_confidence*/ ctx[46]);
1757			toggle_class(span1, "hl", /*class_or_confidence*/ ctx[46] !== null);
1758			attr(span2, "class", "score-text-container svelte-1ozsnjl");
1759		},
1760		m(target, anchor) {
1761			insert$1(target, span2, anchor);
1762			append(span2, span1);
1763			append(span1, span0);
1764			append(span0, t0);
1765			append(span1, t1);
1766			if (if_block0) if_block0.m(span1, null);
1767			append(span2, t2);
1768			if (if_block1) if_block1.m(span2, null);
1769			append(span2, t3);
1770			current = true;
1771
1772			if (!mounted) {
1773				dispose = [
1774					listen(span1, "mouseover", mouseover_handler_3),
1775					listen(span1, "focus", focus_handler_3),
1776					listen(span1, "click", click_handler_4),
1777					listen(span1, "keydown", keydown_handler_4)
1778				];
1779
1780				mounted = true;
1781			}
1782		},
1783		p(new_ctx, dirty) {
1784			ctx = new_ctx;
1785			if ((!current || dirty[0] & /*value*/ 1) && t0_value !== (t0_value = /*token*/ ctx[45] + "")) set_data(t0, t0_value);
1786
1787			if (/*class_or_confidence*/ ctx[46] && /*labelToEdit*/ ctx[6] === /*i*/ ctx[48]) {
1788				if (if_block0) {
1789					if_block0.p(ctx, dirty);
1790
1791					if (dirty[0] & /*value, labelToEdit*/ 65) {
1792						transition_in$1(if_block0, 1);
1793					}
1794				} else {
1795					if_block0 = create_if_block_9(ctx);
1796					if_block0.c();
1797					transition_in$1(if_block0, 1);
1798					if_block0.m(span1, null);
1799				}
1800			} else if (if_block0) {
1801				group_outros$1();
1802
1803				transition_out$1(if_block0, 1, 1, () => {
1804					if_block0 = null;
1805				});
1806
1807				check_outros$1();
1808			}
1809
1810			if (!current || dirty[0] & /*value*/ 1 && span1_style_value !== (span1_style_value = "background-color: rgba(" + (/*score*/ ctx[54] && /*score*/ ctx[54] < 0
1811			? "128, 90, 213," + -/*score*/ ctx[54]
1812			: "239, 68, 60," + /*score*/ ctx[54]) + ")")) {
1813				attr(span1, "style", span1_style_value);
1814			}
1815
1816			if (!current || dirty[0] & /*value, active*/ 33) {
1817				toggle_class(span1, "no-cat", /*class_or_confidence*/ ctx[46] === null || /*active*/ ctx[5] && /*active*/ ctx[5] !== /*class_or_confidence*/ ctx[46]);
1818			}
1819
1820			if (!current || dirty[0] & /*value*/ 1) {
1821				toggle_class(span1, "hl", /*class_or_confidence*/ ctx[46] !== null);
1822			}
1823
1824			if (/*class_or_confidence*/ ctx[46] && /*activeElementIndex*/ ctx[4] === /*i*/ ctx[48]) {
1825				if (if_block1) {
1826					if_block1.p(ctx, dirty);
1827				} else {
1828					if_block1 = create_if_block_8(ctx);
1829					if_block1.c();
1830					if_block1.m(span2, t3);
1831				}
1832			} else if (if_block1) {
1833				if_block1.d(1);
1834				if_block1 = null;
1835			}
1836		},
1837		i(local) {
1838			if (current) return;
1839			transition_in$1(if_block0);
1840			current = true;
1841		},
1842		o(local) {
1843			transition_out$1(if_block0);
1844			current = false;
1845		},
1846		d(detaching) {
1847			if (detaching) {
1848				detach$1(span2);
1849			}
1850
1851			if (if_block0) if_block0.d();
1852			if (if_block1) if_block1.d();
1853			mounted = false;
1854			run_all(dispose);
1855		}
1856	};
1857}
1858
1859// (131:2) {#if show_legend}
1860function create_if_block_6(ctx) {
1861	let div;
1862	let if_block = /*_color_map*/ ctx[3] && create_if_block_7(ctx);
1863
1864	return {
1865		c() {
1866			div = element("div");
1867			if (if_block) if_block.c();
1868			attr(div, "class", "class_or_confidence-legend svelte-1ozsnjl");
1869			attr(div, "data-testid", "highlighted-text:class_or_confidence-legend");
1870		},
1871		m(target, anchor) {
1872			insert$1(target, div, anchor);
1873			if (if_block) if_block.m(div, null);
1874		},
1875		p(ctx, dirty) {
1876			if (/*_color_map*/ ctx[3]) {
1877				if (if_block) {
1878					if_block.p(ctx, dirty);
1879				} else {
1880					if_block = create_if_block_7(ctx);
1881					if_block.c();
1882					if_block.m(div, null);
1883				}
1884			} else if (if_block) {
1885				if_block.d(1);
1886				if_block = null;
1887			}
1888		},
1889		d(detaching) {
1890			if (detaching) {
1891				detach$1(div);
1892			}
1893
1894			if (if_block) if_block.d();
1895		}
1896	};
1897}
1898
1899// (136:4) {#if _color_map}
1900function create_if_block_7(ctx) {
1901	let each_1_anchor;
1902	let each_value_2 = ensure_array_like(Object.entries(/*_color_map*/ ctx[3]));
1903	let each_blocks = [];
1904
1905	for (let i = 0; i < each_value_2.length; i += 1) {
1906		each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i));
1907	}
1908
1909	return {
1910		c() {
1911			for (let i = 0; i < each_blocks.length; i += 1) {
1912				each_blocks[i].c();
1913			}
1914
1915			each_1_anchor = empty$1();
1916		},
1917		m(target, anchor) {
1918			for (let i = 0; i < each_blocks.length; i += 1) {
1919				if (each_blocks[i]) {
1920					each_blocks[i].m(target, anchor);
1921				}
1922			}
1923
1924			insert$1(target, each_1_anchor, anchor);
1925		},
1926		p(ctx, dirty) {
1927			if (dirty[0] & /*_color_map, handle_mouseover, handle_mouseout*/ 3080) {
1928				each_value_2 = ensure_array_like(Object.entries(/*_color_map*/ ctx[3]));
1929				let i;
1930
1931				for (i = 0; i < each_value_2.length; i += 1) {
1932					const child_ctx = get_each_context_2(ctx, each_value_2, i);
1933
1934					if (each_blocks[i]) {
1935						each_blocks[i].p(child_ctx, dirty);
1936					} else {
1937						each_blocks[i] = create_each_block_2(child_ctx);
1938						each_blocks[i].c();
1939						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
1940					}
1941				}
1942
1943				for (; i < each_blocks.length; i += 1) {
1944					each_blocks[i].d(1);
1945				}
1946
1947				each_blocks.length = each_value_2.length;
1948			}
1949		},
1950		d(detaching) {
1951			if (detaching) {
1952				detach$1(each_1_anchor);
1953			}
1954
1955			destroy_each(each_blocks, detaching);
1956		}
1957	};
1958}
1959
1960// (137:5) {#each Object.entries(_color_map) as [class_or_confidence, color], i}
1961function create_each_block_2(ctx) {
1962	let div;
1963	let t0_value = /*class_or_confidence*/ ctx[46] + "";
1964	let t0;
1965	let t1;
1966	let div_style_value;
1967	let mounted;
1968	let dispose;
1969
1970	function mouseover_handler() {
1971		return /*mouseover_handler*/ ctx[15](/*class_or_confidence*/ ctx[46]);
1972	}
1973
1974	function focus_handler() {
1975		return /*focus_handler*/ ctx[16](/*class_or_confidence*/ ctx[46]);
1976	}
1977
1978	return {
1979		c() {
1980			div = element("div");
1981			t0 = text(t0_value);
1982			t1 = space$1();
1983			attr(div, "role", "button");
1984			attr(div, "aria-roledescription", "Categories of highlighted text. Hover to see text with this class_or_confidence highlighted.");
1985			attr(div, "tabindex", "0");
1986			attr(div, "class", "class_or_confidence-label svelte-1ozsnjl");
1987			attr(div, "style", div_style_value = "background-color:" + /*color*/ ctx[52].secondary);
1988		},
1989		m(target, anchor) {
1990			insert$1(target, div, anchor);
1991			append(div, t0);
1992			append(div, t1);
1993
1994			if (!mounted) {
1995				dispose = [
1996					listen(div, "mouseover", mouseover_handler),
1997					listen(div, "focus", focus_handler),
1998					listen(div, "mouseout", /*mouseout_handler*/ ctx[17]),
1999					listen(div, "blur", /*blur_handler*/ ctx[18])
2000				];
2001
2002				mounted = true;
2003			}
2004		},
2005		p(new_ctx, dirty) {
2006			ctx = new_ctx;
2007			if (dirty[0] & /*_color_map*/ 8 && t0_value !== (t0_value = /*class_or_confidence*/ ctx[46] + "")) set_data(t0, t0_value);
2008
2009			if (dirty[0] & /*_color_map*/ 8 && div_style_value !== (div_style_value = "background-color:" + /*color*/ ctx[52].secondary)) {
2010				attr(div, "style", div_style_value);
2011			}
2012		},
2013		d(detaching) {
2014			if (detaching) {
2015				detach$1(div);
2016			}
2017
2018			mounted = false;
2019			run_all(dispose);
2020		}
2021	};
2022}
2023
2024// (159:5) {#if line.trim() !== ""}
2025function create_if_block_2$1(ctx) {
2026	let span2;
2027	let span1;
2028	let span0;
2029	let t0_value = /*line*/ ctx[49] + "";
2030	let t0;
2031	let t1;
2032	let t2;
2033	let t3;
2034	let current;
2035	let mounted;
2036	let dispose;
2037
2038	function focus_handler_1() {
2039		return /*focus_handler_1*/ ctx[20](/*i*/ ctx[48]);
2040	}
2041
2042	function mouseover_handler_1() {
2043		return /*mouseover_handler_1*/ ctx[21](/*i*/ ctx[48]);
2044	}
2045
2046	function click_handler() {
2047		return /*click_handler*/ ctx[22](/*i*/ ctx[48]);
2048	}
2049
2050	let if_block0 = !/*show_legend*/ ctx[1] && /*class_or_confidence*/ ctx[46] !== null && /*labelToEdit*/ ctx[6] !== /*i*/ ctx[48] && create_if_block_5(ctx);
2051	let if_block1 = /*labelToEdit*/ ctx[6] === /*i*/ ctx[48] && /*class_or_confidence*/ ctx[46] !== null && create_if_block_4$1(ctx);
2052
2053	function click_handler_2() {
2054		return /*click_handler_2*/ ctx[26](/*class_or_confidence*/ ctx[46], /*i*/ ctx[48], /*token*/ ctx[45]);
2055	}
2056
2057	function keydown_handler_2(...args) {
2058		return /*keydown_handler_2*/ ctx[27](/*class_or_confidence*/ ctx[46], /*i*/ ctx[48], /*token*/ ctx[45], ...args);
2059	}
2060
2061	function focus_handler_2() {
2062		return /*focus_handler_2*/ ctx[28](/*i*/ ctx[48]);
2063	}
2064
2065	function mouseover_handler_2() {
2066		return /*mouseover_handler_2*/ ctx[29](/*i*/ ctx[48]);
2067	}
2068
2069	let if_block2 = /*class_or_confidence*/ ctx[46] !== null && create_if_block_3$1(ctx);
2070
2071	return {
2072		c() {
2073			span2 = element("span");
2074			span1 = element("span");
2075			span0 = element("span");
2076			t0 = text(t0_value);
2077			t1 = space$1();
2078			if (if_block0) if_block0.c();
2079			t2 = space$1();
2080			if (if_block1) if_block1.c();
2081			t3 = space$1();
2082			if (if_block2) if_block2.c();
2083			attr(span0, "class", "text svelte-1ozsnjl");
2084			attr(span0, "role", "button");
2085			attr(span0, "tabindex", "0");
2086			toggle_class(span0, "no-label", /*class_or_confidence*/ ctx[46] === null);
2087			attr(span1, "role", "button");
2088			attr(span1, "tabindex", "0");
2089			attr(span1, "class", "textspan svelte-1ozsnjl");
2090			toggle_class(span1, "no-cat", /*class_or_confidence*/ ctx[46] === null || /*active*/ ctx[5] && /*active*/ ctx[5] !== /*class_or_confidence*/ ctx[46]);
2091			toggle_class(span1, "hl", /*class_or_confidence*/ ctx[46] !== null);
2092			toggle_class(span1, "selectable", /*selectable*/ ctx[2]);
2093
2094			set_style(span1, "background-color", /*class_or_confidence*/ ctx[46] === null || /*active*/ ctx[5] && /*active*/ ctx[5] !== /*class_or_confidence*/ ctx[46]
2095			? ""
2096			: /*class_or_confidence*/ ctx[46] && /*_color_map*/ ctx[3][/*class_or_confidence*/ ctx[46]]
2097				? /*_color_map*/ ctx[3][/*class_or_confidence*/ ctx[46]].secondary
2098				: "");
2099
2100			attr(span2, "class", "text-class_or_confidence-container svelte-1ozsnjl");
2101		},
2102		m(target, anchor) {
2103			insert$1(target, span2, anchor);
2104			append(span2, span1);
2105			append(span1, span0);
2106			append(span0, t0);
2107			append(span1, t1);
2108			if (if_block0) if_block0.m(span1, null);
2109			append(span1, t2);
2110			if (if_block1) if_block1.m(span1, null);
2111			append(span2, t3);
2112			if (if_block2) if_block2.m(span2, null);
2113			current = true;
2114
2115			if (!mounted) {
2116				dispose = [
2117					listen(span0, "keydown", /*keydown_handler*/ ctx[19]),
2118					listen(span0, "focus", focus_handler_1),
2119					listen(span0, "mouseover", mouseover_handler_1),
2120					listen(span0, "click", click_handler),
2121					listen(span1, "click", click_handler_2),
2122					listen(span1, "keydown", keydown_handler_2),
2123					listen(span1, "focus", focus_handler_2),
2124					listen(span1, "mouseover", mouseover_handler_2)
2125				];
2126
2127				mounted = true;
2128			}
2129		},
2130		p(new_ctx, dirty) {
2131			ctx = new_ctx;
2132			if ((!current || dirty[0] & /*value*/ 1) && t0_value !== (t0_value = /*line*/ ctx[49] + "")) set_data(t0, t0_value);
2133
2134			if (!current || dirty[0] & /*value*/ 1) {
2135				toggle_class(span0, "no-label", /*class_or_confidence*/ ctx[46] === null);
2136			}
2137
2138			if (!/*show_legend*/ ctx[1] && /*class_or_confidence*/ ctx[46] !== null && /*labelToEdit*/ ctx[6] !== /*i*/ ctx[48]) {
2139				if (if_block0) {
2140					if_block0.p(ctx, dirty);
2141				} else {
2142					if_block0 = create_if_block_5(ctx);
2143					if_block0.c();
2144					if_block0.m(span1, t2);
2145				}
2146			} else if (if_block0) {
2147				if_block0.d(1);
2148				if_block0 = null;
2149			}
2150
2151			if (/*labelToEdit*/ ctx[6] === /*i*/ ctx[48] && /*class_or_confidence*/ ctx[46] !== null) {
2152				if (if_block1) {
2153					if_block1.p(ctx, dirty);
2154
2155					if (dirty[0] & /*labelToEdit, value*/ 65) {
2156						transition_in$1(if_block1, 1);
2157					}
2158				} else {
2159					if_block1 = create_if_block_4$1(ctx);
2160					if_block1.c();
2161					transition_in$1(if_block1, 1);
2162					if_block1.m(span1, null);
2163				}
2164			} else if (if_block1) {
2165				group_outros$1();
2166
2167				transition_out$1(if_block1, 1, 1, () => {
2168					if_block1 = null;
2169				});
2170
2171				check_outros$1();
2172			}
2173
2174			if (!current || dirty[0] & /*value, active*/ 33) {
2175				toggle_class(span1, "no-cat", /*class_or_confidence*/ ctx[46] === null || /*active*/ ctx[5] && /*active*/ ctx[5] !== /*class_or_confidence*/ ctx[46]);
2176			}
2177
2178			if (!current || dirty[0] & /*value*/ 1) {
2179				toggle_class(span1, "hl", /*class_or_confidence*/ ctx[46] !== null);
2180			}
2181
2182			if (!current || dirty[0] & /*selectable*/ 4) {
2183				toggle_class(span1, "selectable", /*selectable*/ ctx[2]);
2184			}
2185
2186			if (dirty[0] & /*value, active, _color_map*/ 41) {
2187				set_style(span1, "background-color", /*class_or_confidence*/ ctx[46] === null || /*active*/ ctx[5] && /*active*/ ctx[5] !== /*class_or_confidence*/ ctx[46]
2188				? ""
2189				: /*class_or_confidence*/ ctx[46] && /*_color_map*/ ctx[3][/*class_or_confidence*/ ctx[46]]
2190					? /*_color_map*/ ctx[3][/*class_or_confidence*/ ctx[46]].secondary
2191					: "");
2192			}
2193
2194			if (/*class_or_confidence*/ ctx[46] !== null) {
2195				if (if_block2) {
2196					if_block2.p(ctx, dirty);
2197				} else {
2198					if_block2 = create_if_block_3$1(ctx);
2199					if_block2.c();
2200					if_block2.m(span2, null);
2201				}
2202			} else if (if_block2) {
2203				if_block2.d(1);
2204				if_block2 = null;
2205			}
2206		},
2207		i(local) {
2208			if (current) return;
2209			transition_in$1(if_block1);
2210			current = true;
2211		},
2212		o(local) {
2213			transition_out$1(if_block1);
2214			current = false;
2215		},
2216		d(detaching) {
2217			if (detaching) {
2218				detach$1(span2);
2219			}
2220
2221			if (if_block0) if_block0.d();
2222			if (if_block1) if_block1.d();
2223			if (if_block2) if_block2.d();
2224			mounted = false;
2225			run_all(dispose);
2226		}
2227	};
2228}
2229
2230// (201:8) {#if !show_legend && class_or_confidence !== null && labelToEdit !== i}
2231function create_if_block_5(ctx) {
2232	let span;
2233	let t_value = /*class_or_confidence*/ ctx[46] + "";
2234	let t;
2235	let mounted;
2236	let dispose;
2237
2238	function click_handler_1() {
2239		return /*click_handler_1*/ ctx[23](/*i*/ ctx[48]);
2240	}
2241
2242	function keydown_handler_1() {
2243		return /*keydown_handler_1*/ ctx[24](/*i*/ ctx[48]);
2244	}
2245
2246	return {
2247		c() {
2248			span = element("span");
2249			t = text(t_value);
2250			attr(span, "id", `label-tag-${/*i*/ ctx[48]}`);
2251			attr(span, "class", "label svelte-1ozsnjl");
2252			attr(span, "role", "button");
2253			attr(span, "tabindex", "0");
2254
2255			set_style(span, "background-color", /*class_or_confidence*/ ctx[46] === null || /*active*/ ctx[5] && /*active*/ ctx[5] !== /*class_or_confidence*/ ctx[46]
2256			? ""
2257			: /*_color_map*/ ctx[3][/*class_or_confidence*/ ctx[46]].primary);
2258		},
2259		m(target, anchor) {
2260			insert$1(target, span, anchor);
2261			append(span, t);
2262
2263			if (!mounted) {
2264				dispose = [
2265					listen(span, "click", click_handler_1),
2266					listen(span, "keydown", keydown_handler_1)
2267				];
2268
2269				mounted = true;
2270			}
2271		},
2272		p(new_ctx, dirty) {
2273			ctx = new_ctx;
2274			if (dirty[0] & /*value*/ 1 && t_value !== (t_value = /*class_or_confidence*/ ctx[46] + "")) set_data(t, t_value);
2275
2276			if (dirty[0] & /*value, active, _color_map*/ 41) {
2277				set_style(span, "background-color", /*class_or_confidence*/ ctx[46] === null || /*active*/ ctx[5] && /*active*/ ctx[5] !== /*class_or_confidence*/ ctx[46]
2278				? ""
2279				: /*_color_map*/ ctx[3][/*class_or_confidence*/ ctx[46]].primary);
2280			}
2281		},
2282		d(detaching) {
2283			if (detaching) {
2284				detach$1(span);
2285			}
2286
2287			mounted = false;
2288			run_all(dispose);
2289		}
2290	};
2291}
2292
2293// (217:8) {#if labelToEdit === i && class_or_confidence !== null}
2294function create_if_block_4$1(ctx) {
2295	let t;
2296	let labelinput;
2297	let updating_value;
2298	let current;
2299
2300	function labelinput_value_binding(value) {
2301		/*labelinput_value_binding*/ ctx[25](value);
2302	}
2303
2304	let labelinput_props = {
2305		labelToEdit: /*labelToEdit*/ ctx[6],
2306		category: /*class_or_confidence*/ ctx[46],
2307		active: /*active*/ ctx[5],
2308		_color_map: /*_color_map*/ ctx[3],
2309		indexOfLabel: /*i*/ ctx[48],
2310		text: /*token*/ ctx[45],
2311		handleValueChange: /*handleValueChange*/ ctx[9]
2312	};
2313
2314	if (/*value*/ ctx[0] !== void 0) {
2315		labelinput_props.value = /*value*/ ctx[0];
2316	}
2317
2318	labelinput = new LabelInput({ props: labelinput_props });
2319	binding_callbacks$1.push(() => bind$1(labelinput, 'value', labelinput_value_binding));
2320
2321	return {
2322		c() {
2323			t = text(" \n\t\t\t\t\t\t\t\t\t");
2324			create_component$1(labelinput.$$.fragment);
2325		},
2326		m(target, anchor) {
2327			insert$1(target, t, anchor);
2328			mount_component$1(labelinput, target, anchor);
2329			current = true;
2330		},
2331		p(ctx, dirty) {
2332			const labelinput_changes = {};
2333			if (dirty[0] & /*labelToEdit*/ 64) labelinput_changes.labelToEdit = /*labelToEdit*/ ctx[6];
2334			if (dirty[0] & /*value*/ 1) labelinput_changes.category = /*class_or_confidence*/ ctx[46];
2335			if (dirty[0] & /*active*/ 32) labelinput_changes.active = /*active*/ ctx[5];
2336			if (dirty[0] & /*_color_map*/ 8) labelinput_changes._color_map = /*_color_map*/ ctx[3];
2337			if (dirty[0] & /*value*/ 1) labelinput_changes.text = /*token*/ ctx[45];
2338
2339			if (!updating_value && dirty[0] & /*value*/ 1) {
2340				updating_value = true;
2341				labelinput_changes.value = /*value*/ ctx[0];
2342				add_flush_callback$1(() => updating_value = false);
2343			}
2344
2345			labelinput.$set(labelinput_changes);
2346		},
2347		i(local) {
2348			if (current) return;
2349			transition_in$1(labelinput.$$.fragment, local);
2350			current = true;
2351		},
2352		o(local) {
2353			transition_out$1(labelinput.$$.fragment, local);
2354			current = false;
2355		},
2356		d(detaching) {
2357			if (detaching) {
2358				detach$1(t);
2359			}
2360
2361			destroy_component$1(labelinput, detaching);
2362		}
2363	};
2364}
2365
2366// (231:7) {#if class_or_confidence !== null}
2367function create_if_block_3$1(ctx) {
2368	let span;
2369	let mounted;
2370	let dispose;
2371
2372	function click_handler_3() {
2373		return /*click_handler_3*/ ctx[30](/*i*/ ctx[48]);
2374	}
2375
2376	function keydown_handler_3(...args) {
2377		return /*keydown_handler_3*/ ctx[31](/*i*/ ctx[48], ...args);
2378	}
2379
2380	return {
2381		c() {
2382			span = element("span");
2383			span.textContent = "×";
2384			attr(span, "class", "label-clear-button svelte-1ozsnjl");
2385			attr(span, "role", "button");
2386			attr(span, "aria-roledescription", "Remove label from text");
2387			attr(span, "tabindex", "0");
2388		},
2389		m(target, anchor) {
2390			insert$1(target, span, anchor);
2391
2392			if (!mounted) {
2393				dispose = [
2394					listen(span, "click", click_handler_3),
2395					listen(span, "keydown", keydown_handler_3)
2396				];
2397
2398				mounted = true;
2399			}
2400		},
2401		p(new_ctx, dirty) {
2402			ctx = new_ctx;
2403		},
2404		d(detaching) {
2405			if (detaching) {
2406				detach$1(span);
2407			}
2408
2409			mounted = false;
2410			run_all(dispose);
2411		}
2412	};
2413}
2414
2415// (248:5) {#if j < splitTextByNewline(token).length - 1}
2416function create_if_block_1$1(ctx) {
2417	let br;
2418
2419	return {
2420		c() {
2421			br = element("br");
2422		},
2423		m(target, anchor) {
2424			insert$1(target, br, anchor);
2425		},
2426		d(detaching) {
2427			if (detaching) {
2428				detach$1(br);
2429			}
2430		}
2431	};
2432}
2433
2434// (158:4) {#each splitTextByNewline(token) as line, j}
2435function create_each_block_1(ctx) {
2436	let show_if_1 = /*line*/ ctx[49].trim() !== "";
2437	let t;
2438	let show_if = /*j*/ ctx[51] < splitTextByNewline(/*token*/ ctx[45]).length - 1;
2439	let if_block1_anchor;
2440	let current;
2441	let if_block0 = show_if_1 && create_if_block_2$1(ctx);
2442	let if_block1 = show_if && create_if_block_1$1();
2443
2444	return {
2445		c() {
2446			if (if_block0) if_block0.c();
2447			t = space$1();
2448			if (if_block1) if_block1.c();
2449			if_block1_anchor = empty$1();
2450		},
2451		m(target, anchor) {
2452			if (if_block0) if_block0.m(target, anchor);
2453			insert$1(target, t, anchor);
2454			if (if_block1) if_block1.m(target, anchor);
2455			insert$1(target, if_block1_anchor, anchor);
2456			current = true;
2457		},
2458		p(ctx, dirty) {
2459			if (dirty[0] & /*value*/ 1) show_if_1 = /*line*/ ctx[49].trim() !== "";
2460
2461			if (show_if_1) {
2462				if (if_block0) {
2463					if_block0.p(ctx, dirty);
2464
2465					if (dirty[0] & /*value*/ 1) {
2466						transition_in$1(if_block0, 1);
2467					}
2468				} else {
2469					if_block0 = create_if_block_2$1(ctx);
2470					if_block0.c();
2471					transition_in$1(if_block0, 1);
2472					if_block0.m(t.parentNode, t);
2473				}
2474			} else if (if_block0) {
2475				group_outros$1();
2476
2477				transition_out$1(if_block0, 1, 1, () => {
2478					if_block0 = null;
2479				});
2480
2481				check_outros$1();
2482			}
2483
2484			if (dirty[0] & /*value*/ 1) show_if = /*j*/ ctx[51] < splitTextByNewline(/*token*/ ctx[45]).length - 1;
2485
2486			if (show_if) {
2487				if (if_block1) ; else {
2488					if_block1 = create_if_block_1$1();
2489					if_block1.c();
2490					if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
2491				}
2492			} else if (if_block1) {
2493				if_block1.d(1);
2494				if_block1 = null;
2495			}
2496		},
2497		i(local) {
2498			if (current) return;
2499			transition_in$1(if_block0);
2500			current = true;
2501		},
2502		o(local) {
2503			transition_out$1(if_block0);
2504			current = false;
2505		},
2506		d(detaching) {
2507			if (detaching) {
2508				detach$1(t);
2509				detach$1(if_block1_anchor);
2510			}
2511
2512			if (if_block0) if_block0.d(detaching);
2513			if (if_block1) if_block1.d(detaching);
2514		}
2515	};
2516}
2517
2518// (157:3) {#each value as { token, class_or_confidence }
2519function create_each_block(ctx) {
2520	let each_1_anchor;
2521	let current;
2522	let each_value_1 = ensure_array_like(splitTextByNewline(/*token*/ ctx[45]));
2523	let each_blocks = [];
2524
2525	for (let i = 0; i < each_value_1.length; i += 1) {
2526		each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
2527	}
2528
2529	const out = i => transition_out$1(each_blocks[i], 1, 1, () => {
2530		each_blocks[i] = null;
2531	});
2532
2533	return {
2534		c() {
2535			for (let i = 0; i < each_blocks.length; i += 1) {
2536				each_blocks[i].c();
2537			}
2538
2539			each_1_anchor = empty$1();
2540		},
2541		m(target, anchor) {
2542			for (let i = 0; i < each_blocks.length; i += 1) {
2543				if (each_blocks[i]) {
2544					each_blocks[i].m(target, anchor);
2545				}
2546			}
2547
2548			insert$1(target, each_1_anchor, anchor);
2549			current = true;
2550		},
2551		p(ctx, dirty) {
2552			if (dirty[0] & /*value, removeHighlightedText, active, selectable, _color_map, handleSelect, labelToEdit, handleKeydownSelection, activeElementIndex, handleValueChange, show_legend*/ 13183) {
2553				each_value_1 = ensure_array_like(splitTextByNewline(/*token*/ ctx[45]));
2554				let i;
2555
2556				for (i = 0; i < each_value_1.length; i += 1) {
2557					const child_ctx = get_each_context_1(ctx, each_value_1, i);
2558
2559					if (each_blocks[i]) {
2560						each_blocks[i].p(child_ctx, dirty);
2561						transition_in$1(each_blocks[i], 1);
2562					} else {
2563						each_blocks[i] = create_each_block_1(child_ctx);
2564						each_blocks[i].c();
2565						transition_in$1(each_blocks[i], 1);
2566						each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
2567					}
2568				}
2569
2570				group_outros$1();
2571
2572				for (i = each_value_1.length; i < each_blocks.length; i += 1) {
2573					out(i);
2574				}
2575
2576				check_outros$1();
2577			}
2578		},
2579		i(local) {
2580			if (current) return;
2581
2582			for (let i = 0; i < each_value_1.length; i += 1) {
2583				transition_in$1(each_blocks[i]);
2584			}
2585
2586			current = true;
2587		},
2588		o(local) {
2589			each_blocks = each_blocks.filter(Boolean);
2590
2591			for (let i = 0; i < each_blocks.length; i += 1) {
2592				transition_out$1(each_blocks[i]);
2593			}
2594
2595			current = false;
2596		},
2597		d(detaching) {
2598			if (detaching) {
2599				detach$1(each_1_anchor);
2600			}
2601
2602			destroy_each(each_blocks, detaching);
2603		}
2604	};
2605}
2606
2607function create_fragment$1(ctx) {
2608	let div;
2609	let current_block_type_index;
2610	let if_block;
2611	let current;
2612	const if_block_creators = [create_if_block$1, create_else_block$1];
2613	const if_blocks = [];
2614
2615	function select_block_type(ctx, dirty) {
2616		if (/*mode*/ ctx[7] === "categories") return 0;
2617		return 1;
2618	}
2619
2620	current_block_type_index = select_block_type(ctx);
2621	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
2622
2623	return {
2624		c() {
2625			div = element("div");
2626			if_block.c();
2627			attr(div, "class", "container svelte-1ozsnjl");
2628		},
2629		m(target, anchor) {
2630			insert$1(target, div, anchor);
2631			if_blocks[current_block_type_index].m(div, null);
2632			current = true;
2633		},
2634		p(ctx, dirty) {
2635			let previous_block_index = current_block_type_index;
2636			current_block_type_index = select_block_type(ctx);
2637
2638			if (current_block_type_index === previous_block_index) {
2639				if_blocks[current_block_type_index].p(ctx, dirty);
2640			} else {
2641				group_outros$1();
2642
2643				transition_out$1(if_blocks[previous_block_index], 1, 1, () => {
2644					if_blocks[previous_block_index] = null;
2645				});
2646
2647				check_outros$1();
2648				if_block = if_blocks[current_block_type_index];
2649
2650				if (!if_block) {
2651					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
2652					if_block.c();
2653				} else {
2654					if_block.p(ctx, dirty);
2655				}
2656
2657				transition_in$1(if_block, 1);
2658				if_block.m(div, null);
2659			}
2660		},
2661		i(local) {
2662			if (current) return;
2663			transition_in$1(if_block);
2664			current = true;
2665		},
2666		o(local) {
2667			transition_out$1(if_block);
2668			current = false;
2669		},
2670		d(detaching) {
2671			if (detaching) {
2672				detach$1(div);
2673			}
2674
2675			if_blocks[current_block_type_index].d();
2676		}
2677	};
2678}
2679
2680function splitTextByNewline(text) {
2681	return text.split("\n");
2682}
2683
2684function instance$1($$self, $$props, $$invalidate) {
2685	const browser = typeof document !== "undefined";
2686	let { value = [] } = $$props;
2687	let { show_legend = false } = $$props;
2688	let { color_map = {} } = $$props;
2689	let { selectable = false } = $$props;
2690	let activeElementIndex = -1;
2691	let ctx;
2692	let _color_map = {};
2693	let active = "";
2694	let selection;
2695	let labelToEdit = -1;
2696
2697	onMount(() => {
2698		const mouseUpHandler = () => {
2699			selection = window.getSelection();
2700			handleSelectionComplete();
2701			window.removeEventListener("mouseup", mouseUpHandler);
2702		};
2703
2704		window.addEventListener("mousedown", () => {
2705			window.addEventListener("mouseup", mouseUpHandler);
2706		});
2707	});
2708
2709	async function handleTextSelected(startIndex, endIndex) {
2710		if (selection?.toString() && activeElementIndex !== -1 && value[activeElementIndex].token.toString().includes(selection.toString())) {
2711			const tempFlag = Symbol();
2712			const str = value[activeElementIndex].token;
2713
2714			const [before, selected, after] = [
2715				str.substring(0, startIndex),
2716				str.substring(startIndex, endIndex),
2717				str.substring(endIndex)
2718			];
2719
2720			let tempValue = [
2721				...value.slice(0, activeElementIndex),
2722				{ token: before, class_or_confidence: null },
2723				{
2724					token: selected,
2725					class_or_confidence: mode === "scores" ? 1 : "label",
2726					flag: tempFlag
2727				},
2728				{ token: after, class_or_confidence: null },
2729				...value.slice(activeElementIndex + 1)
2730			];
2731
2732			// store the index of the new highlighted text element and remove the flag
2733			$$invalidate(6, labelToEdit = tempValue.findIndex(({ flag }) => flag === tempFlag));
2734
2735			// tempValue[labelToEdit].pop();
2736			// remove elements with empty labels
2737			tempValue = tempValue.filter(item => item.token.trim() !== "");
2738
2739			$$invalidate(0, value = tempValue.map(({ flag, ...rest }) => rest));
2740			handleValueChange();
2741			document.getElementById(`label-input-${labelToEdit}`)?.focus();
2742		}
2743	}
2744
2745	const dispatch = createEventDispatcher();
2746
2747	function removeHighlightedText(index) {
2748		if (!value || index < 0 || index >= value.length) return;
2749		$$invalidate(0, value[index].class_or_confidence = null, value);
2750		$$invalidate(0, value = merge_elements(value, "equal"));
2751		handleValueChange();
2752		window.getSelection()?.empty();
2753	}
2754
2755	function handleValueChange() {
2756		dispatch("change", value);
2757		$$invalidate(6, labelToEdit = -1);
2758
2759		// reset legend color maps
2760		if (show_legend) {
2761			$$invalidate(14, color_map = {});
2762			$$invalidate(3, _color_map = {});
2763		}
2764	}
2765
2766	let mode;
2767
2768	function handle_mouseover(label) {
2769		$$invalidate(5, active = label);
2770	}
2771
2772	function handle_mouseout() {
2773		$$invalidate(5, active = "");
2774	}
2775
2776	async function handleKeydownSelection(event) {
2777		selection = window.getSelection();
2778
2779		if (event.key === "Enter") {
2780			handleSelectionComplete();
2781		}
2782	}
2783
2784	function handleSelectionComplete() {
2785		if (selection && selection?.toString().trim() !== "") {
2786			const textBeginningIndex = selection.getRangeAt(0).startOffset;
2787			const textEndIndex = selection.getRangeAt(0).endOffset;
2788			handleTextSelected(textBeginningIndex, textEndIndex);
2789		}
2790	}
2791
2792	function handleSelect(i, text, class_or_confidence) {
2793		dispatch("select", {
2794			index: i,
2795			value: [text, class_or_confidence]
2796		});
2797	}
2798
2799	const mouseover_handler = class_or_confidence => handle_mouseover(class_or_confidence);
2800	const focus_handler = class_or_confidence => handle_mouseover(class_or_confidence);
2801	const mouseout_handler = () => handle_mouseout();
2802	const blur_handler = () => handle_mouseout();
2803	const keydown_handler = e => handleKeydownSelection(e);
2804	const focus_handler_1 = i =>
2804 $$invalidate(4, activeElementIndex = i);
2805	const mouseover_handler_1 = i => $$invalidate(4, activeElementIndex = i);
2806	const click_handler = i => $$invalidate(6, labelToEdit = i);
2807	const click_handler_1 = i => $$invalidate(6, labelToEdit = i);
2808	const keydown_handler_1 = i => $$invalidate(6, labelToEdit = i);
2809
2810	function labelinput_value_binding(value$1) {
2811		value = value$1;
2812		$$invalidate(0, value);
2813	}
2814
2815	const click_handler_2 = (class_or_confidence, i, token) => {
2816		if (class_or_confidence !== null) {
2817			handleSelect(i, token, class_or_confidence);
2818		}
2819	};
2820
2821	const keydown_handler_2 = (class_or_confidence, i, token, e) => {
2822		if (class_or_confidence !== null) {
2823			$$invalidate(6, labelToEdit = i);
2824			handleSelect(i, token, class_or_confidence);
2825		} else {
2826			handleKeydownSelection(e);
2827		}
2828	};
2829
2830	const focus_handler_2 = i => $$invalidate(4, activeElementIndex = i);
2831	const mouseover_handler_2 = i => $$invalidate(4, activeElementIndex = i);
2832	const click_handler_3 = i => removeHighlightedText(i);
2833
2834	const keydown_handler_3 = (i, event) => {
2835		if (event.key === "Enter") {
2836			removeHighlightedText(i);
2837		}
2838	};
2839
2840	function labelinput_value_binding_1(value$1) {
2841		value = value$1;
2842		$$invalidate(0, value);
2843	}
2844
2845	const mouseover_handler_3 = i =>
2845 $$invalidate(4, activeElementIndex = i);
2846	const focus_handler_3 = i => $$invalidate(4, activeElementIndex = i);
2847	const click_handler_4 = i => $$invalidate(6, labelToEdit = i);
2848
2849	const keydown_handler_4 = (i, e) => {
2850		if (e.key === "Enter") {
2851			$$invalidate(6, labelToEdit = i);
2852		}
2853	};
2854
2855	const click_handler_5 = i => removeHighlightedText(i);
2856
2857	const keydown_handler_5 = (i, event) => {
2858		if (event.key === "Enter") {
2859			removeHighlightedText(i);
2860		}
2861	};
2862
2863	$$self.$$set = $$props => {
2864		if ('value' in $$props) $$invalidate(0, value = $$props.value);
2865		if ('show_legend' in $$props) $$invalidate(1, show_legend = $$props.show_legend);
2866		if ('color_map' in $$props) $$invalidate(14, color_map = $$props.color_map);
2867		if ('selectable' in $$props) $$invalidate(2, selectable = $$props.selectable);
2868	};
2869
2870	$$self.$$.update = () => {
2871		if ($$self.$$.dirty[0] & /*color_map, value, _color_map*/ 16393) {
2872			{
2873				if (!color_map) {
2874					$$invalidate(14, color_map = {});
2875				}
2876
2877				if (value.length > 0) {
2878					for (let entry of value) {
2879						if (entry.class_or_confidence !== null) {
2880							if (typeof entry.class_or_confidence === "string") {
2881								$$invalidate(7, mode = "categories");
2882
2883								if (!(entry.class_or_confidence in color_map)) {
2884									let color = get_next_color(Object.keys(color_map).length);
2885									$$invalidate(14, color_map[entry.class_or_confidence] = color, color_map);
2886								}
2887							} else {
2888								$$invalidate(7, mode = "scores");
2889							}
2890						}
2891					}
2892				}
2893
2894				correct_color_map(color_map, _color_map, browser, ctx);
2895			}
2896		}
2897	};
2898
2899	return [
2900		value,
2901		show_legend,
2902		selectable,
2903		_color_map,
2904		activeElementIndex,
2905		active,
2906		labelToEdit,
2907		mode,
2908		removeHighlightedText,
2909		handleValueChange,
2910		handle_mouseover,
2911		handle_mouseout,
2912		handleKeydownSelection,
2913		handleSelect,
2914		color_map,
2915		mouseover_handler,
2916		focus_handler,
2917		mouseout_handler,
2918		blur_handler,
2919		keydown_handler,
2920		focus_handler_1,
2921		mouseover_handler_1,
2922		click_handler,
2923		click_handler_1,
2924		keydown_handler_1,
2925		labelinput_value_binding,
2926		click_handler_2,
2927		keydown_handler_2,
2928		focus_handler_2,
2929		mouseover_handler_2,
2930		click_handler_3,
2931		keydown_handler_3,
2932		labelinput_value_binding_1,
2933		mouseover_handler_3,
2934		focus_handler_3,
2935		click_handler_4,
2936		keydown_handler_4,
2937		click_handler_5,
2938		keydown_handler_5
2939	];
2940}
2941
2942class InteractiveHighlightedtext extends SvelteComponent$1 {
2943	constructor(options) {
2944		super();
2945
2946		init$1(
2947			this,
2948			options,
2949			instance$1,
2950			create_fragment$1,
2951			safe_not_equal$1,
2952			{
2953				value: 0,
2954				show_legend: 1,
2955				color_map: 14,
2956				selectable: 2
2957			},
2958			null,
2959			[-1, -1]
2960		);
2961	}
2962}
2963
2964const InteractiveHighlightedText = InteractiveHighlightedtext;
2965
2966/* home/runner/work/gradio/gradio/js/highlightedtext/Index.svelte generated by Svelte v4.2.2 */
2967const {
2968	SvelteComponent,
2969	add_flush_callback,
2970	assign,
2971	bind,
2972	binding_callbacks,
2973	check_outros,
2974	create_component,
2975	destroy_component,
2976	detach,
2977	empty,
2978	get_spread_object,
2979	get_spread_update,
2980	group_outros,
2981	init,
2982	insert,
2983	mount_component,
2984	safe_not_equal,
2985	space,
2986	transition_in,
2987	transition_out
2988} = window.__gradio__svelte__internal;
2989function create_else_block_1(ctx) {
2990	let block;
2991	let current;
2992
2993	block = new Block({
2994			props: {
2995				variant: /*interactive*/ ctx[12] ? "dashed" : "solid",
2996				test_id: "highlighted-text",
2997				visible: /*visible*/ ctx[5],
2998				elem_id: /*elem_id*/ ctx[3],
2999				elem_classes: /*elem_classes*/ ctx[4],
3000				padding: false,
3001				container: /*container*/ ctx[8],
3002				scale: /*scale*/ ctx[9],
3003				min_width: /*min_width*/ ctx[10],
3004				$$slots: { default: [create_default_slot_2] },
3005				$$scope: { ctx }
3006			}
3007		});
3008
3009	return {
3010		c() {
3011			create_component(block.$$.fragment);
3012		},
3013		m(target, anchor) {
3014			mount_component(block, target, anchor);
3015			current = true;
3016		},
3017		p(ctx, dirty) {
3018			const block_changes = {};
3019			if (dirty & /*interactive*/ 4096) block_changes.variant = /*interactive*/ ctx[12] ? "dashed" : "solid";
3020			if (dirty & /*visible*/ 32) block_changes.visible = /*visible*/ ctx[5];
3021			if (dirty & /*elem_id*/ 8) block_changes.elem_id = /*elem_id*/ ctx[3];
3022			if (dirty & /*elem_classes*/ 16) block_changes.elem_classes = /*elem_classes*/ ctx[4];
3023			if (dirty & /*container*/ 256) block_changes.container = /*container*/ ctx[8];
3024			if (dirty & /*scale*/ 512) block_changes.scale = /*scale*/ ctx[9];
3025			if (dirty & /*min_width*/ 1024) block_changes.min_width = /*min_width*/ ctx[10];
3026
3027			if (dirty & /*$$scope, _selectable, show_legend, color_map, value, gradio, label, container, loading_status*/ 534983) {
3028				block_changes.$$scope = { dirty, ctx };
3029			}
3030
3031			block.$set(block_changes);
3032		},
3033		i(local) {
3034			if (current) return;
3035			transition_in(block.$$.fragment, local);
3036			current = true;
3037		},
3038		o(local) {
3039			transition_out(block.$$.fragment, local);
3040			current = false;
3041		},
3042		d(detaching) {
3043			destroy_component(block, detaching);
3044		}
3045	};
3046}
3047
3048// (41:0) {#if !interactive}
3049function create_if_block(ctx) {
3050	let block;
3051	let current;
3052
3053	block = new Block({
3054			props: {
3055				variant: "solid",
3056				test_id: "highlighted-text",
3057				visible: /*visible*/ ctx[5],
3058				elem_id: /*elem_id*/ ctx[3],
3059				elem_classes: /*elem_classes*/ ctx[4],
3060				padding: false,
3061				container: /*container*/ ctx[8],
3062				scale: /*scale*/ ctx[9],
3063				min_width: /*min_width*/ ctx[10],
3064				$$slots: { default: [create_default_slot] },
3065				$$scope: { ctx }
3066			}
3067		});
3068
3069	return {
3070		c() {
3071			create_component(block.$$.fragment);
3072		},
3073		m(target, anchor) {
3074			mount_component(block, target, anchor);
3075			current = true;
3076		},
3077		p(ctx, dirty) {
3078			const block_changes = {};
3079			if (dirty & /*visible*/ 32) block_changes.visible = /*visible*/ ctx[5];
3080			if (dirty & /*elem_id*/ 8) block_changes.elem_id = /*elem_id*/ ctx[3];
3081			if (dirty & /*elem_classes*/ 16) block_changes.elem_classes = /*elem_classes*/ ctx[4];
3082			if (dirty & /*container*/ 256) block_changes.container = /*container*/ ctx[8];
3083			if (dirty & /*scale*/ 512) block_changes.scale = /*scale*/ ctx[9];
3084			if (dirty & /*min_width*/ 1024) block_changes.min_width = /*min_width*/ ctx[10];
3085
3086			if (dirty & /*$$scope, _selectable, value, show_legend, color_map, gradio, label, container, loading_status*/ 534983) {
3087				block_changes.$$scope = { dirty, ctx };
3088			}
3089
3090			block.$set(block_changes);
3091		},
3092		i(local) {
3093			if (current) return;
3094			transition_in(block.$$.fragment, local);
3095			current = true;
3096		},
3097		o(local) {
3098			transition_out(block.$$.fragment, local);
3099			current = false;
3100		},
3101		d(detaching) {
3102			destroy_component(block, detaching);
3103		}
3104	};
3105}
3106
3107// (98:2) {#if label}
3108function create_if_block_4(ctx) {
3109	let blocklabel;
3110	let current;
3111
3112	blocklabel = new BlockLabel({
3113			props: {
3114				Icon: TextHighlight,
3115				label: /*label*/ ctx[7],
3116				float: false,
3117				disable: /*container*/ ctx[8] === false
3118			}
3119		});
3120
3121	return {
3122		c() {
3123			create_component(blocklabel.$$.fragment);
3124		},
3125		m(target, anchor) {
3126			mount_component(blocklabel, target, anchor);
3127			current = true;
3128		},
3129		p(ctx, dirty) {
3130			const blocklabel_changes = {};
3131			if (dirty & /*label*/ 128) blocklabel_changes.label = /*label*/ ctx[7];
3132			if (dirty & /*container*/ 256) blocklabel_changes.disable = /*container*/ ctx[8] === false;
3133			blocklabel.$set(blocklabel_changes);
3134		},
3135		i(local) {
3136			if (current) return;
3137			transition_in(blocklabel.$$.fragment, local);
3138			current = true;
3139		},
3140		o(local) {
3141			transition_out(blocklabel.$$.fragment, local);
3142			current = false;
3143		},
3144		d(detaching) {
3145			destroy_component(blocklabel, detaching);
3146		}
3147	};
3148}
3149
3150// (115:2) {:else}
3151function create_else_block_2(ctx) {
3152	let empty_1;
3153	let current;
3154
3155	empty_1 = new Empty({
3156			props: {
3157				$$slots: { default: [create_default_slot_3] },
3158				$$scope: { ctx }
3159			}
3160		});
3161
3162	return {
3163		c() {
3164			create_component(empty_1.$$.fragment);
3165		},
3166		m(target, anchor) {
3167			mount_component(empty_1, target, anchor);
3168			current = true;
3169		},
3170		p(ctx, dirty) {
3171			const empty_1_changes = {};
3172
3173			if (dirty & /*$$scope*/ 524288) {
3174				empty_1_changes.$$scope = { dirty, ctx };
3175			}
3176
3177			empty_1.$set(empty_1_changes);
3178		},
3179		i(local) {
3180			if (current) return;
3181			transition_in(empty_1.$$.fragment, local);
3182			current = true;
3183		},
3184		o(local) {
3185			transition_out(empty_1.$$.fragment, local);
3186			current = false;
3187		},
3188		d(detaching) {
3189			destroy_component(empty_1, detaching);
3190		}
3191	};
3192}
3193
3194// (107:2) {#if value}
3195function create_if_block_3(ctx) {
3196	let interactivehighlightedtext;
3197	let updating_value;
3198	let current;
3199
3200	function interactivehighlightedtext_value_binding(value) {
3201		/*interactivehighlightedtext_value_binding*/ ctx[17](value);
3202	}
3203
3204	let interactivehighlightedtext_props = {
3205		selectable: /*_selectable*/ ctx[11],
3206		show_legend: /*show_legend*/ ctx[6],
3207		color_map: /*color_map*/ ctx[1]
3208	};
3209
3210	if (/*value*/ ctx[0] !== void 0) {
3211		interactivehighlightedtext_props.value = /*value*/ ctx[0];
3212	}
3213
3214	interactivehighlightedtext = new InteractiveHighlightedText({ props: interactivehighlightedtext_props });
3215	binding_callbacks.push(() => bind(interactivehighlightedtext, 'value', interactivehighlightedtext_value_binding));
3216	interactivehighlightedtext.$on("change", /*change_handler*/ ctx[18]);
3217
3218	return {
3219		c() {
3220			create_component(interactivehighlightedtext.$$.fragment);
3221		},
3222		m(target, anchor) {
3223			mount_component(interactivehighlightedtext, target, anchor);
3224			current = true;
3225		},
3226		p(ctx, dirty) {
3227			const interactivehighlightedtext_changes = {};
3228			if (dirty & /*_selectable*/ 2048) interactivehighlightedtext_changes.selectable = /*_selectable*/ ctx[11];
3229			if (dirty & /*show_legend*/ 64) interactivehighlightedtext_changes.show_legend = /*show_legend*/ ctx[6];
3230			if (dirty & /*color_map*/ 2) interactivehighlightedtext_changes.color_map = /*color_map*/ ctx[1];
3231
3232			if (!updating_value && dirty & /*value*/ 1) {
3233				updating_value = true;
3234				interactivehighlightedtext_changes.value = /*value*/ ctx[0];
3235				add_flush_callback(() => updating_value = false);
3236			}
3237
3238			interactivehighlightedtext.$set(interactivehighlightedtext_changes);
3239		},
3240		i(local) {
3241			if (current) return;
3242			transition_in(interactivehighlightedtext.$$.fragment, local);
3243			current = true;
3244		},
3245		o(local) {
3246			transition_out(interactivehighlightedtext.$$.fragment, local);
3247			current = false;
3248		},
3249		d(detaching) {
3250			destroy_component(interactivehighlightedtext, detaching);
3251		}
3252	};
3253}
3254
3255// (116:3) <Empty>
3256function create_default_slot_3(ctx) {
3257	let texthighlight;
3258	let current;
3259	texthighlight = new TextHighlight({});
3260
3261	return {
3262		c() {
3263			create_component(texthighlight.$$.fragment);
3264		},
3265		m(target, anchor) {
3266			mount_component(texthighlight, target, anchor);
3267			current = true;
3268		},
3269		i(local) {
3270			if (current) return;
3271			transition_in(texthighlight.$$.fragment, local);
3272			current = true;
3273		},
3274		o(local) {
3275			transition_out(texthighlight.$$.fragment, local);
3276			current = false;
3277		},
3278		d(detaching) {
3279			destroy_component(texthighlight, detaching);
3280		}
3281	};
3282}
3283
3284// (82:1) <Block   variant={interactive ? "dashed" : "solid"}   test_id="highlighted-text"   {visible}   {elem_id}   {elem_classes}   padding={false}   {container}   {scale}   {min_width}  >
3285function create_default_slot_2(ctx) {
3286	let statustracker;
3287	let t0;
3288	let t1;
3289	let current_block_type_index;
3290	let if_block1;
3291	let if_block1_anchor;
3292	let current;
3293
3294	const statustracker_spread_levels = [
3295		{ autoscroll: /*gradio*/ ctx[2].autoscroll },
3296		/*loading_status*/ ctx[13],
3297		{ i18n: /*gradio*/ ctx[2].i18n }
3298	];
3299
3300	let statustracker_props = {};
3301
3302	for (let i = 0; i < statustracker_spread_levels.length; i += 1) {
3303		statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]);
3304	}
3305
3306	statustracker = new Static({ props: statustracker_props });
3307	let if_block0 = /*label*/ ctx[7] && create_if_block_4(ctx);
3308	const if_block_creators = [create_if_block_3, create_else_block_2];
3309	const if_blocks = [];
3310
3311	function select_block_type_2(ctx, dirty) {
3312		if (/*value*/ ctx[0]) return 0;
3313		return 1;
3314	}
3315
3316	current_block_type_index = select_block_type_2(ctx);
3317	if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3318
3319	return {
3320		c() {
3321			create_component(statustracker.$$.fragment);
3322			t0 = space();
3323			if (if_block0) if_block0.c();
3324			t1 = space();
3325			if_block1.c();
3326			if_block1_anchor = empty();
3327		},
3328		m(target, anchor) {
3329			mount_component(statustracker, target, anchor);
3330			insert(target, t0, anchor);
3331			if (if_block0) if_block0.m(target, anchor);
3332			insert(target, t1, anchor);
3333			if_blocks[current_block_type_index].m(target, anchor);
3334			insert(target, if_block1_anchor, anchor);
3335			current = true;
3336		},
3337		p(ctx, dirty) {
3338			const statustracker_changes = (dirty & /*gradio, loading_status*/ 8196)
3339			? get_spread_update(statustracker_spread_levels, [
3340					dirty & /*gradio*/ 4 && { autoscroll: /*gradio*/ ctx[2].autoscroll },
3341					dirty & /*loading_status*/ 8192 && get_spread_object(/*loading_status*/ ctx[13]),
3342					dirty & /*gradio*/ 4 && { i18n: /*gradio*/ ctx[2].i18n }
3343				])
3344			: {};
3345
3346			statustracker.$set(statustracker_changes);
3347
3348			if (/*label*/ ctx[7]) {
3349				if (if_block0) {
3350					if_block0.p(ctx, dirty);
3351
3352					if (dirty & /*label*/ 128) {
3353						transition_in(if_block0, 1);
3354					}
3355				} else {
3356					if_block0 = create_if_block_4(ctx);
3357					if_block0.c();
3358					transition_in(if_block0, 1);
3359					if_block0.m(t1.parentNode, t1);
3360				}
3361			} else if (if_block0) {
3362				group_outros();
3363
3364				transition_out(if_block0, 1, 1, () => {
3365					if_block0 = null;
3366				});
3367
3368				check_outros();
3369			}
3370
3371			let previous_block_index = current_block_type_index;
3372			current_block_type_index = select_block_type_2(ctx);
3373
3374			if (current_block_type_index === previous_block_index) {
3375				if_blocks[current_block_type_index].p(ctx, dirty);
3376			} else {
3377				group_outros();
3378
3379				transition_out(if_blocks[previous_block_index], 1, 1, () => {
3380					if_blocks[previous_block_index] = null;
3381				});
3382
3383				check_outros();
3384				if_block1 = if_blocks[current_block_type_index];
3385
3386				if (!if_block1) {
3387					if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3388					if_block1.c();
3389				} else {
3390					if_block1.p(ctx, dirty);
3391				}
3392
3393				transition_in(if_block1, 1);
3394				if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
3395			}
3396		},
3397		i(local) {
3398			if (current) return;
3399			transition_in(statustracker.$$.fragment, local);
3400			transition_in(if_block0);
3401			transition_in(if_block1);
3402			current = true;
3403		},
3404		o(local) {
3405			transition_out(statustracker.$$.fragment, local);
3406			transition_out(if_block0);
3407			transition_out(if_block1);
3408			current = false;
3409		},
3410		d(detaching) {
3411			if (detaching) {
3412				detach(t0);
3413				detach(t1);
3414				detach(if_block1_anchor);
3415			}
3416
3417			destroy_component(statustracker, detaching);
3418			if (if_block0) if_block0.d(detaching);
3419			if_blocks[current_block_type_index].d(detaching);
3420		}
3421	};
3422}
3423
3424// (58:2) {#if label}
3425function create_if_block_2(ctx) {
3426	let blocklabel;
3427	let current;
3428
3429	blocklabel = new BlockLabel({
3430			props: {
3431				Icon: TextHighlight,
3432				label: /*label*/ ctx[7],
3433				float: false,
3434				disable: /*container*/ ctx[8] === false
3435			}
3436		});
3437
3438	return {
3439		c() {
3440			create_component(blocklabel.$$.fragment);
3441		},
3442		m(target, anchor) {
3443			mount_component(blocklabel, target, anchor);
3444			current = true;
3445		},
3446		p(ctx, dirty) {
3447			const blocklabel_changes = {};
3448			if (dirty & /*label*/ 128) blocklabel_changes.label = /*label*/ ctx[7];
3449			if (dirty & /*container*/ 256) blocklabel_changes.disable = /*container*/ ctx[8] === false;
3450			blocklabel.$set(blocklabel_changes);
3451		},
3452		i(local) {
3453			if (current) return;
3454			transition_in(blocklabel.$$.fragment, local);
3455			current = true;
3456		},
3457		o(local) {
3458			transition_out(blocklabel.$$.fragment, local);
3459			current = false;
3460		},
3461		d(detaching) {
3462			destroy_component(blocklabel, detaching);
3463		}
3464	};
3465}
3466
3467// (75:2) {:else}
3468function create_else_block(ctx) {
3469	let empty_1;
3470	let current;
3471
3472	empty_1 = new Empty({
3473			props: {
3474				$$slots: { default: [create_default_slot_1] },
3475				$$scope: { ctx }
3476			}
3477		});
3478
3479	return {
3480		c() {
3481			create_component(empty_1.$$.fragment);
3482		},
3483		m(target, anchor) {
3484			mount_component(empty_1, target, anchor);
3485			current = true;
3486		},
3487		p(ctx, dirty) {
3488			const empty_1_changes = {};
3489
3490			if (dirty & /*$$scope*/ 524288) {
3491				empty_1_changes.$$scope = { dirty, ctx };
3492			}
3493
3494			empty_1.$set(empty_1_changes);
3495		},
3496		i(local) {
3497			if (current) return;
3498			transition_in(empty_1.$$.fragment, local);
3499			current = true;
3500		},
3501		o(local) {
3502			transition_out(empty_1.$$.fragment, local);
3503			current = false;
3504		},
3505		d(detaching) {
3506			destroy_component(empty_1, detaching);
3507		}
3508	};
3509}
3510
3511// (67:2) {#if value}
3512function create_if_block_1(ctx) {
3513	let statichighlightedtext;
3514	let current;
3515
3516	statichighlightedtext = new StaticHighlightedText({
3517			props: {
3518				selectable: /*_selectable*/ ctx[11],
3519				value: /*value*/ ctx[0],
3520				show_legend: /*show_legend*/ ctx[6],
3521				color_map: /*color_map*/ ctx[1]
3522			}
3523		});
3524
3525	statichighlightedtext.$on("select", /*select_handler*/ ctx[16]);
3526
3527	return {
3528		c() {
3529			create_component(statichighlightedtext.$$.fragment);
3530		},
3531		m(target, anchor) {
3532			mount_component(statichighlightedtext, target, anchor);
3533			current = true;
3534		},
3535		p(ctx, dirty) {
3536			const statichighlightedtext_changes = {};
3537			if (dirty & /*_selectable*/ 2048) statichighlightedtext_changes.selectable = /*_selectable*/ ctx[11];
3538			if (dirty & /*value*/ 1) statichighlightedtext_changes.value = /*value*/ ctx[0];
3539			if (dirty & /*show_legend*/ 64) statichighlightedtext_changes.show_legend = /*show_legend*/ ctx[6];
3540			if (dirty & /*color_map*/ 2) statichighlightedtext_changes.color_map = /*color_map*/ ctx[1];
3541			statichighlightedtext.$set(statichighlightedtext_changes);
3542		},
3543		i(local) {
3544			if (current) return;
3545			transition_in(statichighlightedtext.$$.fragment, local);
3546			current = true;
3547		},
3548		o(local) {
3549			transition_out(statichighlightedtext.$$.fragment, local);
3550			current = false;
3551		},
3552		d(detaching) {
3553			destroy_component(statichighlightedtext, detaching);
3554		}
3555	};
3556}
3557
3558// (76:3) <Empty>
3559function create_default_slot_1(ctx) {
3560	let texthighlight;
3561	let current;
3562	texthighlight = new TextHighlight({});
3563
3564	return {
3565		c() {
3566			create_component(texthighlight.$$.fragment);
3567		},
3568		m(target, anchor) {
3569			mount_component(texthighlight, target, anchor);
3570			current = true;
3571		},
3572		i(local) {
3573			if (current) return;
3574			transition_in(texthighlight.$$.fragment, local);
3575			current = true;
3576		},
3577		o(local) {
3578			transition_out(texthighlight.$$.fragment, local);
3579			current = false;
3580		},
3581		d(detaching) {
3582			destroy_component(texthighlight, detaching);
3583		}
3584	};
3585}
3586
3587// (42:1) <Block   variant={"solid"}   test_id="highlighted-text"   {visible}   {elem_id}   {elem_classes}   padding={false}   {container}   {scale}   {min_width}  >
3588function create_default_slot(ctx) {
3589	let statustracker;
3590	let t0;
3591	let t1;
3592	let current_block_type_index;
3593	let if_block1;
3594	let if_block1_anchor;
3595	let current;
3596
3597	const statustracker_spread_levels = [
3598		{ autoscroll: /*gradio*/ ctx[2].autoscroll },
3599		{ i18n: /*gradio*/ ctx[2].i18n },
3600		/*loading_status*/ ctx[13]
3601	];
3602
3603	let statustracker_props = {};
3604
3605	for (let i = 0; i < statustracker_spread_levels.length; i += 1) {
3606		statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]);
3607	}
3608
3609	statustracker = new Static({ props: statustracker_props });
3610	let if_block0 = /*label*/ ctx[7] && create_if_block_2(ctx);
3611	const if_block_creators = [create_if_block_1, create_else_block];
3612	const if_blocks = [];
3613
3614	function select_block_type_1(ctx, dirty) {
3615		if (/*value*/ ctx[0]) return 0;
3616		return 1;
3617	}
3618
3619	current_block_type_index = select_block_type_1(ctx);
3620	if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3621
3622	return {
3623		c() {
3624			create_component(statustracker.$$.fragment);
3625			t0 = space();
3626			if (if_block0) if_block0.c();
3627			t1 = space();
3628			if_block1.c();
3629			if_block1_anchor = empty();
3630		},
3631		m(target, anchor) {
3632			mount_component(statustracker, target, anchor);
3633			insert(target, t0, anchor);
3634			if (if_block0) if_block0.m(target, anchor);
3635			insert(target, t1, anchor);
3636			if_blocks[current_block_type_index].m(target, anchor);
3637			insert(target, if_block1_anchor, anchor);
3638			current = true;
3639		},
3640		p(ctx, dirty) {
3641			const statustracker_changes = (dirty & /*gradio, loading_status*/ 8196)
3642			? get_spread_update(statustracker_spread_levels, [
3643					dirty & /*gradio*/ 4 && { autoscroll: /*gradio*/ ctx[2].autoscroll },
3644					dirty & /*gradio*/ 4 && { i18n: /*gradio*/ ctx[2].i18n },
3645					dirty & /*loading_status*/ 8192 && get_spread_object(/*loading_status*/ ctx[13])
3646				])
3647			: {};
3648
3649			statustracker.$set(statustracker_changes);
3650
3651			if (/*label*/ ctx[7]) {
3652				if (if_block0) {
3653					if_block0.p(ctx, dirty);
3654
3655					if (dirty & /*label*/ 128) {
3656						transition_in(if_block0, 1);
3657					}
3658				} else {
3659					if_block0 = create_if_block_2(ctx);
3660					if_block0.c();
3661					transition_in(if_block0, 1);
3662					if_block0.m(t1.parentNode, t1);
3663				}
3664			} else if (if_block0) {
3665				group_outros();
3666
3667				transition_out(if_block0, 1, 1, () => {
3668					if_block0 = null;
3669				});
3670
3671				check_outros();
3672			}
3673
3674			let previous_block_index = current_block_type_index;
3675			current_block_type_index = select_block_type_1(ctx);
3676
3677			if (current_block_type_index === previous_block_index) {
3678				if_blocks[current_block_type_index].p(ctx, dirty);
3679			} else {
3680				group_outros();
3681
3682				transition_out(if_blocks[previous_block_index], 1, 1, () => {
3683					if_blocks[previous_block_index] = null;
3684				});
3685
3686				check_outros();
3687				if_block1 = if_blocks[current_block_type_index];
3688
3689				if (!if_block1) {
3690					if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3691					if_block1.c();
3692				} else {
3693					if_block1.p(ctx, dirty);
3694				}
3695
3696				transition_in(if_block1, 1);
3697				if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
3698			}
3699		},
3700		i(local) {
3701			if (current) return;
3702			transition_in(statustracker.$$.fragment, local);
3703			transition_in(if_block0);
3704			transition_in(if_block1);
3705			current = true;
3706		},
3707		o(local) {
3708			transition_out(statustracker.$$.fragment, local);
3709			transition_out(if_block0);
3710			transition_out(if_block1);
3711			current = false;
3712		},
3713		d(detaching) {
3714			if (detaching) {
3715				detach(t0);
3716				detach(t1);
3717				detach(if_block1_anchor);
3718			}
3719
3720			destroy_component(statustracker, detaching);
3721			if (if_block0) if_block0.d(detaching);
3722			if_blocks[current_block_type_index].d(detaching);
3723		}
3724	};
3725}
3726
3727function create_fragment(ctx) {
3728	let current_block_type_index;
3729	let if_block;
3730	let if_block_anchor;
3731	let current;
3732	const if_block_creators = [create_if_block, create_else_block_1];
3733	const if_blocks = [];
3734
3735	function select_block_type(ctx, dirty) {
3736		if (!/*interactive*/ ctx[12]) return 0;
3737		return 1;
3738	}
3739
3740	current_block_type_index = select_block_type(ctx);
3741	if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3742
3743	return {
3744		c() {
3745			if_block.c();
3746			if_block_anchor = empty();
3747		},
3748		m(target, anchor) {
3749			if_blocks[current_block_type_index].m(target, anchor);
3750			insert(target, if_block_anchor, anchor);
3751			current = true;
3752		},
3753		p(ctx, [dirty]) {
3754			let previous_block_index = current_block_type_index;
3755			current_block_type_index = select_block_type(ctx);
3756
3757			if (current_block_type_index === previous_block_index) {
3758				if_blocks[current_block_type_index].p(ctx, dirty);
3759			} else {
3760				group_outros();
3761
3762				transition_out(if_blocks[previous_block_index], 1, 1, () => {
3763					if_blocks[previous_block_index] = null;
3764				});
3765
3766				check_outros();
3767				if_block = if_blocks[current_block_type_index];
3768
3769				if (!if_block) {
3770					if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
3771					if_block.c();
3772				} else {
3773					if_block.p(ctx, dirty);
3774				}
3775
3776				transition_in(if_block, 1);
3777				if_block.m(if_block_anchor.parentNode, if_block_anchor);
3778			}
3779		},
3780		i(local) {
3781			if (current) return;
3782			transition_in(if_block);
3783			current = true;
3784		},
3785		o(local) {
3786			transition_out(if_block);
3787			current = false;
3788		},
3789		d(detaching) {
3790			if (detaching) {
3791				detach(if_block_anchor);
3792			}
3793
3794			if_blocks[current_block_type_index].d(detaching);
3795		}
3796	};
3797}
3798
3799function instance($$self, $$props, $$invalidate) {
3800	let { gradio } = $$props;
3801	let { elem_id = "" } = $$props;
3802	let { elem_classes = [] } = $$props;
3803	let { visible = true } = $$props;
3804	let { value } = $$props;
3805	let old_value;
3806	let { show_legend } = $$props;
3807	let { color_map = {} } = $$props;
3808	let { label = gradio.i18n("highlighted_text.highlighted_text") } = $$props;
3809	let { container = true } = $$props;
3810	let { scale = null } = $$props;
3811	let { min_width = undefined } = $$props;
3812	let { _selectable = false } = $$props;
3813	let { combine_adjacent = false } = $$props;
3814	let { interactive } = $$props;
3815	let { loading_status } = $$props;
3816	const select_handler = ({ detail }) => gradio.dispatch("select", detail);
3817
3818	function interactivehighlightedtext_value_binding(value$1) {
3819		value = value$1;
3820		($$invalidate(0, value), $$invalidate(14, combine_adjacent));
3821	}
3822
3823	const change_handler = () => gradio.dispatch("change");
3824
3825	$$self.$$set = $$props => {
3826		if ('gradio' in $$props) $$invalidate(2, gradio = $$props.gradio);
3827		if ('elem_id' in $$props) $$invalidate(3, elem_id = $$props.elem_id);
3828		if ('elem_classes' in $$props) $$invalidate(4, elem_classes = $$props.elem_classes);
3829		if ('visible' in $$props) $$invalidate(5, visible = $$props.visible);
3830		if ('value' in $$props) $$invalidate(0, value = $$props.value);
3831		if ('show_legend' in $$props) $$invalidate(6, show_legend = $$props.show_legend);
3832		if ('color_map' in $$props) $$invalidate(1, color_map = $$props.color_map);
3833		if ('label' in $$props) $$invalidate(7, label = $$props.label);
3834		if ('container' in $$props) $$invalidate(8, container = $$props.container);
3835		if ('scale' in $$props) $$invalidate(9, scale = $$props.scale);
3836		if ('min_width' in $$props) $$invalidate(10, min_width = $$props.min_width);
3837		if ('_selectable' in $$props) $$invalidate(11, _selectable = $$props._selectable);
3838		if ('combine_adjacent' in $$props) $$invalidate(14, combine_adjacent = $$props.combine_adjacent);
3839		if ('interactive' in $$props) $$invali
3839date(12, interactive = $$props.interactive);
3840		if ('loading_status' in $$props) $$invalidate(13, loading_status = $$props.loading_status);
3841	};
3842
3843	$$self.$$.update = () => {
3844		if ($$self.$$.dirty & /*color_map*/ 2) {
3845			if (!color_map && Object.keys(color_map).length) {
3846				$$invalidate(1, color_map);
3847			}
3848		}
3849
3850		if ($$self.$$.dirty & /*value, combine_adjacent*/ 16385) {
3851			if (value && combine_adjacent) {
3852				$$invalidate(0, value = merge_elements(value, "equal"));
3853			}
3854		}
3855
3856		if ($$self.$$.dirty & /*value, old_value, gradio*/ 32773) {
3857			{
3858				if (value !== old_value) {
3859					$$invalidate(15, old_value = value);
3860					gradio.dispatch("change");
3861				}
3862			}
3863		}
3864	};
3865
3866	return [
3867		value,
3868		color_map,
3869		gradio,
3870		elem_id,
3871		elem_classes,
3872		visible,
3873		show_legend,
3874		label,
3875		container,
3876		scale,
3877		min_width,
3878		_selectable,
3879		interactive,
3880		loading_status,
3881		combine_adjacent,
3882		old_value,
3883		select_handler,
3884		interactivehighlightedtext_value_binding,
3885		change_handler
3886	];
3887}
3888
3889class Index extends SvelteComponent {
3890	constructor(options) {
3891		super();
3892
3893		init(this, options, instance, create_fragment, safe_not_equal, {
3894			gradio: 2,
3895			elem_id: 3,
3896			elem_classes: 4,
3897			visible: 5,
3898			value: 0,
3899			show_legend: 6,
3900			color_map: 1,
3901			label: 7,
3902			container: 8,
3903			scale: 9,
3904			min_width: 10,
3905			_selectable: 11,
3906			combine_adjacent: 14,
3907			interactive: 12,
3908			loading_status: 13
3909		});
3910	}
3911}
3912
3913export { InteractiveHighlightedText as BaseInteractiveHighlightedText, StaticHighlightedText as BaseStaticHighlightedText, Index as default };
3914//# sourceMappingURL=Index-5efeb121.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.