PageSourceSearch

https://merve-owlv2.hf.space/assets/Index-fa027128.js

js merve-owlv2.hf.space collected 2026-10-03 10:21:47 UTC 35,986 bytes, 1,410 lines download raw bytes

1import { B as Block } from './Button-f2ef1e3f.js';
2import './Index-f4e7a341.js';
3import { g as get_fetchable_url_or_file } from './index-546f83db.js';
4import './svelte/svelte.js';
5
6const Index_svelte_svelte_type_style_lang = '';
7
8/* home/runner/work/gradio/gradio/js/dataset/Index.svelte generated by Svelte v4.2.2 */
9const {
10	SvelteComponent,
11	append,
12	assign,
13	attr,
14	check_outros,
15	construct_svelte_component,
16	create_component,
17	destroy_component,
18	destroy_each,
19	detach,
20	element,
21	empty,
22	ensure_array_like,
23	get_spread_object,
24	get_spread_update,
25	group_outros,
26	init,
27	insert,
28	listen,
29	mount_component,
30	noop,
31	null_to_empty,
32	run_all,
33	safe_not_equal,
34	set_data,
35	set_style,
36	space,
37	svg_element,
38	text,
39	toggle_class,
40	transition_in,
41	transition_out
42} = window.__gradio__svelte__internal;
43function get_each_context(ctx, list, i) {
44	const child_ctx = ctx.slice();
45	child_ctx[35] = list[i];
46	return child_ctx;
47}
48
49function get_each_context_2(ctx, list, i) {
50	const child_ctx = ctx.slice();
51	child_ctx[38] = list[i];
52	child_ctx[40] = i;
53	return child_ctx;
54}
55
56function get_each_context_3(ctx, list, i) {
57	const child_ctx = ctx.slice();
58	child_ctx[0] = list[i].value;
59	child_ctx[42] = list[i].component;
60	child_ctx[45] = i;
61	const constants_0 = /*components*/ child_ctx[1][/*j*/ child_ctx[45]];
62	child_ctx[43] = constants_0;
63	return child_ctx;
64}
65
66function get_each_context_4(ctx, list, i) {
67	const child_ctx = ctx.slice();
68	child_ctx[46] = list[i];
69	return child_ctx;
70}
71
72function get_each_context_1(ctx, list, i) {
73	const child_ctx = ctx.slice();
74	child_ctx[38] = list[i];
75	child_ctx[40] = i;
76	return child_ctx;
77}
78
79// (122:1) {:else}
80function create_else_block_1(ctx) {
81	let div;
82	let table;
83	let thead;
84	let tr;
85	let t;
86	let tbody;
87	let current;
88	let each_value_4 = ensure_array_like(/*headers*/ ctx[5]);
89	let each_blocks_1 = [];
90
91	for (let i = 0; i < each_value_4.length; i += 1) {
92		each_blocks_1[i] = create_each_block_4(get_each_context_4(ctx, each_value_4, i));
93	}
94
95	let each_value_2 = ensure_array_like(/*component_meta*/ ctx[17]);
96	let each_blocks = [];
97
98	for (let i = 0; i < each_value_2.length; i += 1) {
99		each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i));
100	}
101
102	const out = i => transition_out(each_blocks[i], 1, 1, () => {
103		each_blocks[i] = null;
104	});
105
106	return {
107		c() {
108			div = element("div");
109			table = element("table");
110			thead = element("thead");
111			tr = element("tr");
112
113			for (let i = 0; i < each_blocks_1.length; i += 1) {
114				each_blocks_1[i].c();
115			}
116
117			t = space();
118			tbody = element("tbody");
119
120			for (let i = 0; i < each_blocks.length; i += 1) {
121				each_blocks[i].c();
122			}
123
124			attr(tr, "class", "tr-head svelte-13hsdno");
125			attr(table, "tabindex", "0");
126			attr(table, "role", "grid");
127			attr(table, "class", "svelte-13hsdno");
128			attr(div, "class", "table-wrap svelte-13hsdno");
129		},
130		m(target, anchor) {
131			insert(target, div, anchor);
132			append(div, table);
133			append(table, thead);
134			append(thead, tr);
135
136			for (let i = 0; i < each_blocks_1.length; i += 1) {
137				if (each_blocks_1[i]) {
138					each_blocks_1[i].m(tr, null);
139				}
140			}
141
142			append(table, t);
143			append(table, tbody);
144
145			for (let i = 0; i < each_blocks.length; i += 1) {
146				if (each_blocks[i]) {
147					each_blocks[i].m(tbody, null);
148				}
149			}
150
151			current = true;
152		},
153		p(ctx, dirty) {
154			if (dirty[0] & /*headers*/ 32) {
155				each_value_4 = ensure_array_like(/*headers*/ ctx[5]);
156				let i;
157
158				for (i = 0; i < each_value_4.length; i += 1) {
159					const child_ctx = get_each_context_4(ctx, each_value_4, i);
160
161					if (each_blocks_1[i]) {
162						each_blocks_1[i].p(child_ctx, dirty);
163					} else {
164						each_blocks_1[i] = create_each_block_4(child_ctx);
165						each_blocks_1[i].c();
166						each_blocks_1[i].m(tr, null);
167					}
168				}
169
170				for (; i < each_blocks_1.length; i += 1) {
171					each_blocks_1[i].d(1);
172				}
173
174				each_blocks_1.length = each_value_4.length;
175			}
176
177			if (dirty[0] & /*value, page, samples_per_page, gradio, handle_mouseenter, handle_mouseleave, component_meta, components, component_props, samples_dir, current_hover, component_map*/ 7025167) {
178				each_value_2 = ensure_array_like(/*component_meta*/ ctx[17]);
179				let i;
180
181				for (i = 0; i < each_value_2.length; i += 1) {
182					const child_ctx = get_each_context_2(ctx, each_value_2, i);
183
184					if (each_blocks[i]) {
185						each_blocks[i].p(child_ctx, dirty);
186						transition_in(each_blocks[i], 1);
187					} else {
188						each_blocks[i] = create_each_block_2(child_ctx);
189						each_blocks[i].c();
190						transition_in(each_blocks[i], 1);
191						each_blocks[i].m(tbody, null);
192					}
193				}
194
195				group_outros();
196
197				for (i = each_value_2.length; i < each_blocks.length; i += 1) {
198					out(i);
199				}
200
201				check_outros();
202			}
203		},
204		i(local) {
205			if (current) return;
206
207			for (let i = 0; i < each_value_2.length; i += 1) {
208				transition_in(each_blocks[i]);
209			}
210
211			current = true;
212		},
213		o(local) {
214			each_blocks = each_blocks.filter(Boolean);
215
216			for (let i = 0; i < each_blocks.length; i += 1) {
217				transition_out(each_blocks[i]);
218			}
219
220			current = false;
221		},
222		d(detaching) {
223			if (detaching) {
224				detach(div);
225			}
226
227			destroy_each(each_blocks_1, detaching);
228			destroy_each(each_blocks, detaching);
229		}
230	};
231}
232
233// (95:1) {#if gallery}
234function create_if_block_2(ctx) {
235	let div;
236	let current;
237	let each_value_1 = ensure_array_like(/*selected_samples*/ ctx[14]);
238	let each_blocks = [];
239
240	for (let i = 0; i < each_value_1.length; i += 1) {
241		each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
242	}
243
244	const out = i => transition_out(each_blocks[i], 1, 1, () => {
245		each_blocks[i] = null;
246	});
247
248	return {
249		c() {
250			div = element("div");
251
252			for (let i = 0; i < each_blocks.length; i += 1) {
253				each_blocks[i].c();
254			}
255
256			attr(div, "class", "gallery svelte-13hsdno");
257		},
258		m(target, anchor) {
259			insert(target, div, anchor);
260
261			for (let i = 0; i < each_blocks.length; i += 1) {
262				if (each_blocks[i]) {
263					each_blocks[i].m(div, null);
264				}
265			}
266
267			current = true;
268		},
269		p(ctx, dirty) {
270			if (dirty[0] & /*value, page, samples_per_page, gradio, selected_samples, handle_mouseenter, handle_mouseleave, component_meta, component_props, samples_dir, current_hover, component_map, components*/ 7041551) {
271				each_value_1 = ensure_array_like(/*selected_samples*/ ctx[14]);
272				let i;
273
274				for (i = 0; i < each_value_1.length; i += 1) {
275					const child_ctx = get_each_context_1(ctx, each_value_1, i);
276
277					if (each_blocks[i]) {
278						each_blocks[i].p(child_ctx, dirty);
279						transition_in(each_blocks[i], 1);
280					} else {
281						each_blocks[i] = create_each_block_1(child_ctx);
282						each_blocks[i].c();
283						transition_in(each_blocks[i], 1);
284						each_blocks[i].m(div, null);
285					}
286				}
287
288				group_outros();
289
290				for (i = each_value_1.length; i < each_blocks.length; i += 1) {
291					out(i);
292				}
293
294				check_outros();
295			}
296		},
297		i(local) {
298			if (current) return;
299
300			for (let i = 0; i < each_value_1.length; i += 1) {
301				transition_in(each_blocks[i]);
302			}
303
304			current = true;
305		},
306		o(local) {
307			each_blocks = each_blocks.filter(Boolean);
308
309			for (let i = 0; i < each_blocks.length; i += 1) {
310				transition_out(each_blocks[i]);
311			}
312
313			current = false;
314		},
315		d(detaching) {
316			if (detaching) {
317				detach(div);
318			}
319
320			destroy_each(each_blocks, detaching);
321		}
322	};
323}
324
325// (127:6) {#each headers as header}
326function create_each_block_4(ctx) {
327	let th;
328	let t0_value = /*header*/ ctx[46] + "";
329	let t0;
330	let t1;
331
332	return {
333		c() {
334			th = element("th");
335			t0 = text(t0_value);
336			t1 = space();
337			attr(th, "class", "svelte-13hsdno");
338		},
339		m(target, anchor) {
340			insert(target, th, anchor);
341			append(th, t0);
342			append(th, t1);
343		},
344		p(ctx, dirty) {
345			if (dirty[0] & /*headers*/ 32 && t0_value !== (t0_value = /*header*/ ctx[46] + "")) set_data(t0, t0_value);
346		},
347		d(detaching) {
348			if (detaching) {
349				detach(th);
350			}
351		}
352	};
353}
354
355// (147:8) {#if component_name !== undefined && component_map.get(component_name) !== undefined}
356function create_if_block_4(ctx) {
357	let td;
358	let switch_instance;
359	let td_class_value;
360	let current;
361
362	const switch_instance_spread_levels = [
363		/*component_props*/ ctx[2][/*j*/ ctx[45]],
364		{ value: /*value*/ ctx[0] },
365		{ samples_dir: /*samples_dir*/ ctx[19] },
366		{ type: "table" },
367		{
368			selected: /*current_hover*/ ctx[16] === /*i*/ ctx[40]
369		},
370		{ index: /*i*/ ctx[40] }
371	];
372
373	var switch_value = /*component*/ ctx[42];
374
375	function switch_props(ctx, dirty) {
376		let switch_instance_props = {};
377
378		if (dirty !== undefined && dirty[0] & /*component_props, component_meta, samples_dir, current_hover*/ 720900) {
379			switch_instance_props = get_spread_update(switch_instance_spread_levels, [
380				dirty[0] & /*component_props*/ 4 && get_spread_object(/*component_props*/ ctx[2][/*j*/ ctx[45]]),
381				dirty[0] & /*component_meta*/ 131072 && { value: /*value*/ ctx[0] },
382				dirty[0] & /*samples_dir*/ 524288 && { samples_dir: /*samples_dir*/ ctx[19] },
383				switch_instance_spread_levels[3],
384				dirty[0] & /*current_hover*/ 65536 && {
385					selected: /*current_hover*/ ctx[16] === /*i*/ ctx[40]
386				},
387				switch_instance_spread_levels[5]
388			]);
389		} else {
390			for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
391				switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]);
392			}
393		}
394
395		return { props: switch_instance_props };
396	}
397
398	if (switch_value) {
399		switch_instance = construct_svelte_component(switch_value, switch_props(ctx));
400	}
401
402	return {
403		c() {
404			td = element("td");
405			if (switch_instance) create_component(switch_instance.$$.fragment);
406
407			set_style(td, "max-width", /*component_name*/ ctx[43] === 'textbox'
408			? '35ch'
409			: 'auto');
410
411			attr(td, "class", td_class_value = "" + (null_to_empty(/*component_name*/ ctx[43]) + " svelte-13hsdno"));
412		},
413		m(target, anchor) {
414			insert(target, td, anchor);
415			if (switch_instance) mount_component(switch_instance, td, null);
416			current = true;
417		},
418		p(ctx, dirty) {
419			if (dirty[0] & /*component_meta*/ 131072 && switch_value !== (switch_value = /*component*/ ctx[42])) {
420				if (switch_instance) {
421					group_outros();
422					const old_component = switch_instance;
423
424					transition_out(old_component.$$.fragment, 1, 0, () => {
425						destroy_component(old_component, 1);
426					});
427
428					check_outros();
429				}
430
431				if (switch_value) {
432					switch_instance = construct_svelte_component(switch_value, switch_props(ctx, dirty));
433					create_component(switch_instance.$$.fragment);
434					transition_in(switch_instance.$$.fragment, 1);
435					mount_component(switch_instance, td, null);
436				} else {
437					switch_instance = null;
438				}
439			} else if (switch_value) {
440				const switch_instance_changes = (dirty[0] & /*component_props, component_meta, samples_dir, current_hover*/ 720900)
441				? get_spread_update(switch_instance_spread_levels, [
442						dirty[0] & /*component_props*/ 4 && get_spread_object(/*component_props*/ ctx[2][/*j*/ ctx[45]]),
443						dirty[0] & /*component_meta*/ 131072 && { value: /*value*/ ctx[0] },
444						dirty[0] & /*samples_dir*/ 524288 && { samples_dir: /*samples_dir*/ ctx[19] },
445						switch_instance_spread_levels[3],
446						dirty[0] & /*current_hover*/ 65536 && {
447							selected: /*current_hover*/ ctx[16] === /*i*/ ctx[40]
448						},
449						switch_instance_spread_levels[5]
450					])
451				: {};
452
453				switch_instance.$set(switch_instance_changes);
454			}
455
456			if (!current || dirty[0] & /*components*/ 2) {
457				set_style(td, "max-width", /*component_name*/ ctx[43] === 'textbox'
458				? '35ch'
459				: 'auto');
460			}
461
462			if (!current || dirty[0] & /*components*/ 2 && td_class_value !== (td_class_value = "" + (null_to_empty(/*component_name*/ ctx[43]) + " svelte-13hsdno"))) {
463				attr(td, "class", td_class_value);
464			}
465		},
466		i(local) {
467			if (current) return;
468			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
469			current = true;
470		},
471		o(local) {
472			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
473			current = false;
474		},
475		d(detaching) {
476			if (detaching) {
477				detach(td);
478			}
479
480			if (switch_instance) destroy_component(switch_instance);
481		}
482	};
483}
484
485// (145:7) {#each sample_row as { value, component }
486function create_each_block_3(ctx) {
487	let show_if = /*component_name*/ ctx[43] !== undefined && /*component_map*/ ctx[3].get(/*component_name*/ ctx[43]) !== undefined;
488	let if_block_anchor;
489	let current;
490	let if_block = show_if && create_if_block_4(ctx);
491
492	return {
493		c() {
494			if (if_block) if_block.c();
495			if_block_anchor = empty();
496		},
497		m(target, anchor) {
498			if (if_block) if_block.m(target, anchor);
499			insert(target, if_block_anchor, anchor);
500			current = true;
501		},
502		p(ctx, dirty) {
503			if (dirty[0] & /*components, component_map*/ 10) show_if = /*component_name*/ ctx[43] !== undefined && /*component_map*/ ctx[3].get(/*component_name*/ ctx[43]) !== undefined;
504
505			if (show_if) {
506				if (if_block) {
507					if_block.p(ctx, dirty);
508
509					if (dirty[0] & /*components, component_map*/ 10) {
510						transition_in(if_block, 1);
511					}
512				} else {
513					if_block = create_if_block_4(ctx);
514					if_block.c();
515					transition_in(if_block, 1);
516					if_block.m(if_block_anchor.parentNode, if_block_anchor);
517				}
518			} else if (if_block) {
519				group_outros();
520
521				transition_out(if_block, 1, 1, () => {
522					if_block = null;
523				});
524
525				check_outros();
526			}
527		},
528		i(local) {
529			if (current) return;
530			transition_in(if_block);
531			current = true;
532		},
533		o(local) {
534			transition_out(if_block);
535			current = false;
536		},
537		d(detaching) {
538			if (detaching) {
539				detach(if_block_anchor);
540			}
541
542			if (if_block) if_block.d(detaching);
543		}
544	};
545}
546
547// (135:5) {#each component_meta as sample_row, i}
548function create_each_block_2(ctx) {
549	let tr;
550	let t;
551	let current;
552	let mounted;
553	let dispose;
554	let each_value_3 = ensure_array_like(/*sample_row*/ ctx[38]);
555	let each_blocks = [];
556
557	for (let i = 0; i < each_value_3.length; i += 1) {
558		each_blocks[i] = create_each_block_3(get_each_context_3(ctx, each_value_3, i));
559	}
560
561	const out = i => transition_out(each_blocks[i], 1, 1, () => {
562		each_blocks[i] = null;
563	});
564
565	function click_handler_1() {
566		return /*click_handler_1*/ ctx[30](/*i*/ ctx[40]);
567	}
568
569	function mouseenter_handler_1() {
570		return /*mouseenter_handler_1*/ ctx[31](/*i*/ ctx[40]);
571	}
572
573	return {
574		c() {
575			tr = element("tr");
576
577			for (let i = 0; i < each_blocks.length; i += 1) {
578				each_blocks[i].c();
579			}
580
581			t = space();
582			attr(tr, "class", "tr-body svelte-13hsdno");
583		},
584		m(target, anchor) {
585			insert(target, tr, anchor);
586
587			for (let i = 0; i < each_blocks.length; i += 1) {
588				if (each_blocks[i]) {
589					each_blocks[i].m(tr, null);
590				}
591			}
592
593			append(tr, t);
594			current = true;
595
596			if (!mounted) {
597				dispose = [
598					listen(tr, "click", click_handler_1),
599					listen(tr, "mouseenter", mouseenter_handler_1),
600					listen(tr, "mouseleave", /*mouseleave_handler_1*/ ctx[32])
601				];
602
603				mounted = true;
604			}
605		},
606		p(new_ctx, dirty) {
607			ctx = new_ctx;
608
609			if (dirty[0] & /*components, component_meta, component_props, samples_dir, current_hover, component_map*/ 720910) {
610				each_value_3 = ensure_array_like(/*sample_row*/ ctx[38]);
611				let i;
612
613				for (i = 0; i < each_value_3.length; i += 1) {
614					const child_ctx = get_each_context_3(ctx, each_value_3, i);
615
616					if (each_blocks[i]) {
617						each_blocks[i].p(child_ctx, dirty);
618						transition_in(each_blocks[i], 1);
619					} else {
620						each_blocks[i] = create_each_block_3(child_ctx);
621						each_blocks[i].c();
622						transition_in(each_blocks[i], 1);
623						each_blocks[i].m(tr, t);
624					}
625				}
626
627				group_outros();
628
629				for (i = each_value_3.length; i < each_blocks.length; i += 1) {
630					out(i);
631				}
632
633				check_outros();
634			}
635		},
636		i(local) {
637			if (current) return;
638
639			for (let i = 0; i < each_value_3.length; i += 1) {
640				transition_in(each_blocks[i]);
641			}
642
643			current = true;
644		},
645		o(local) {
646			each_blocks = each_blocks.filter(Boolean);
647
648			for (let i = 0; i < each_blocks.length; i += 1) {
649				transition_out(each_blocks[i]);
650			}
651
652			current = false;
653		},
654		d(detaching) {
655			if (detaching) {
656				detach(tr);
657			}
658
659			destroy_each(each_blocks, detaching);
660			mounted = false;
661			run_all(dispose);
662		}
663	};
664}
665
666// (108:5) {#if component_meta.length && component_map.get(components[0])}
667function create_if_block_3(ctx) {
668	let switch_instance;
669	let switch_instance_anchor;
670	let current;
671
672	const switch_instance_spread_levels = [
673		/*component_props*/ ctx[2][0],
674		{ value: /*sample_row*/ ctx[38][0] },
675		{ samples_dir: /*samples_dir*/ ctx[19] },
676		{ type: "gallery" },
677		{
678			selected: /*current_hover*/ ctx[16] === /*i*/ ctx[40]
679		},
680		{ index: /*i*/ ctx[40] }
681	];
682
683	var switch_value = /*component_meta*/ ctx[17][0][0].component;
684
685	function switch_props(ctx, dirty) {
686		let switch_instance_props = {};
687
688		if (dirty !== undefined && dirty[0] & /*component_props, selected_samples, samples_dir, current_hover*/ 606212) {
689			switch_instance_props = get_spread_update(switch_instance_spread_levels, [
690				dirty[0] & /*component_props*/ 4 && get_spread_object(/*component_props*/ ctx[2][0]),
691				dirty[0] & /*selected_samples*/ 16384 && { value: /*sample_row*/ ctx[38][0] },
692				dirty[0] & /*samples_dir*/ 524288 && { samples_dir: /*samples_dir*/ ctx[19] },
693				switch_instance_spread_levels[3],
694				dirty[0] & /*current_hover*/ 65536 && {
695					selected: /*current_hover*/ ctx[16] === /*i*/ ctx[40]
696				},
697				switch_instance_spread_levels[5]
698			]);
699		} else {
700			for (let i = 0; i < switch_instance_spread_levels.length; i += 1) {
701				switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]);
702			}
703		}
704
705		return { props: switch_instance_props };
706	}
707
708	if (switch_value) {
709		switch_instance = construct_svelte_component(switch_value, switch_props(ctx));
710	}
711
712	return {
713		c() {
714			if (switch_instance) create_component(switch_instance.$$.fragment);
715			switch_instance_anchor = empty();
716		},
717		m(target, anchor) {
718			if (switch_instance) mount_component(switch_instance, target, anchor);
719			insert(target, switch_instance_anchor, anchor);
720			current = true;
721		},
722		p(ctx, dirty) {
723			if (dirty[0] & /*component_meta*/ 131072 && switch_value !== (switch_value = /*component_meta*/ ctx[17][0][0].component)) {
724				if (switch_instance) {
725					group_outros();
726					const old_component = switch_instance;
727
728					transition_out(old_component.$$.fragment, 1, 0, () => {
729						destroy_component(old_component, 1);
730					});
731
732					check_outros();
733				}
734
735				if (switch_value) {
736					switch_instance = construct_svelte_component(switch_value, switch_props(ctx, dirty));
737					create_component(switch_instance.$$.fragment);
738					transition_in(switch_instance.$$.fragment, 1);
739					mount_component(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor);
740				} else {
741					switch_instance = null;
742				}
743			} else if (switch_value) {
744				const switch_instance_changes = (dirty[0] & /*component_props, selected_samples, samples_dir, current_hover*/ 606212)
745				? get_spread_update(switch_instance_spread_levels, [
746						dirty[0] & /*component_props*/ 4 && get_spread_object(/*component_props*/ ctx[2][0]),
747						dirty[0] & /*selected_samples*/ 16384 && { value: /*sample_row*/ ctx[38][0] },
748						dirty[0] & /*samples_dir*/ 524288 && { samples_dir: /*samples_dir*/ ctx[19] },
749						switch_instance_spread_levels[3],
750						dirty[0] & /*current_hover*/ 65536 && {
751							selected: /*current_hover*/ ctx[16] === /*i*/ ctx[40]
752						},
753						switch_instance_spread_levels[5]
754					])
755				: {};
756
757				switch_instance.$set(switch_instance_changes);
758			}
759		},
760		i(local) {
761			if (current) return;
762			if (switch_instance) transition_in(switch_instance.$$.fragment, local);
763			current = true;
764		},
765		o(local) {
766			if (switch_instance) transition_out(switch_instance.$$.fragment, local);
767			current = false;
768		},
769		d(detaching) {
770			if (detaching) {
771				detach(switch_instance_anchor);
772			}
773
774			if (switch_instance) destroy_component(switch_instance, detaching);
775		}
776	};
777}
778
779// (97:3) {#each selected_samples as sample_row, i}
780function create_each_block_1(ctx) {
781	let button;
782	let show_if = /*component_meta*/ ctx[17].length && /*component_map*/ ctx[3].get(/*components*/ ctx[1][0]);
783	let t;
784	let current;
785	let mounted;
786	let dispose;
787	let if_block = show_if && create_if_block_3(ctx);
788
789	function click_handler() {
790		return /*click_handler*/ ctx[27](/*i*/ ctx[40], /*sample_row*/ ctx[38]);
791	}
792
793	function mouseenter_handler() {
794		return /*mouseenter_handler*/ ctx[28](/*i*/ ctx[40]);
795	}
796
797	return {
798		c() {
799			button = element("button");
800			if (if_block) if_block.c();
801			t = space();
802			attr(button, "class", "gallery-item svelte-13hsdno");
803		},
804		m(target, anchor) {
805			insert(target, button, anchor);
806			if (if_block) if_block.m(button, null);
807			append(button, t);
808			current = true;
809
810			if (!mounted) {
811				dispose = [
812					listen(button, "click", click_handler),
813					listen(button, "mouseenter", mouseenter_handler),
814					listen(button, "mouseleave", /*mouseleave_handler*/ ctx[29])
815				];
816
817				mounted = true;
818			}
819		},
820		p(new_ctx, dirty) {
821			ctx = new_ctx;
822			if (dirty[0] & /*component_meta, component_map, components*/ 131082) show_if = /*component_meta*/ ctx[17].length && /*component_map*/ ctx[3].get(/*components*/ ctx[1][0]);
823
824			if (show_if) {
825				if (if_block) {
826					if_block.p(ctx, dirty);
827
828					if (dirty[0] & /*component_meta, component_map, components*/ 131082) {
829						transition_in(if_block, 1);
830					}
831				} else {
832					if_block = create_if_block_3(ctx);
833					if_block.c();
834					transition_in(if_block, 1);
835					if_block.m(button, t);
836				}
837			} else if (if_block) {
838				group_outros();
839
840				transition_out(if_block, 1, 1, () => {
841					if_block = null;
842				});
843
844				check_outros();
845			}
846		},
847		i(local) {
848			if (current) return;
849			transition_in(if_block);
850			current = true;
851		},
852		o(local) {
853			transition_out(if_block);
854			current = false;
855		},
856		d(detaching) {
857			if (detaching) {
858				detach(button);
859			}
860
861			if (if_block) if_block.d();
862			mounted = false;
863			run_all(dispose);
864		}
865	};
866}
867
868// (172:1) {#if paginate}
869function create_if_block(ctx) {
870	let div;
871	let t;
872	let each_value = ensure_array_like(/*visible_pages*/ ctx[15]);
873	let each_blocks = [];
874
875	for (let i = 0; i < each_value.length; i += 1) {
876		each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
877	}
878
879	return {
880		c() {
881			div = element("div");
882			t = text("Pages:\n\t\t\t");
883
884			for (let i = 0; i < each_blocks.length; i += 1) {
885				each_blocks[i].c();
886			}
887
888			attr(div, "class", "paginate svelte-13hsdno");
889		},
890		m(target, anchor) {
891			insert(target, div, anchor);
892			append(div, t);
893
894			for (let i = 0; i < each_blocks.length; i += 1) {
895				if (each_blocks[i]) {
896					each_blocks[i].m(div, null);
897				}
898			}
899		},
900		p(ctx, dirty) {
901			if (dirty[0] & /*visible_pages, page*/ 40960) {
902				each_value = ensure_array_like(/*visible_pages*/ ctx[15]);
903				let i;
904
905				for (i = 0; i < each_value.length; i += 1) {
906					const child_ctx = get_each_context(ctx, each_value, i);
907
908					if (each_blocks[i]) {
909						each_blocks[i].p(child_ctx, dirty);
910					} else {
911						each_blocks[i] = create_each_block(child_ctx);
912						each_blocks[i].c();
913						each_blocks[i].m(div, null);
914					}
915				}
916
917				for (; i < each_blocks.length; i += 1) {
918					each_blocks[i].d(1);
919				}
920
921				each_blocks.length = each_value.length;
922			}
923		},
924		d(detaching) {
925			if (detaching) {
926				detach(div);
927			}
928
929			destroy_each(each_blocks, detaching);
930		}
931	};
932}
933
934// (178:4) {:else}
935function create_else_block(ctx) {
936	let button;
937	let t0_value = /*visible_page*/ ctx[35] + 1 + "";
938	let t0;
939	let t1;
940	let mounted;
941	let dispose;
942
943	function click_handler_2() {
944		return /*click_handler_2*/ ctx[33](/*visible_page*/ ctx[35]);
945	}
946
947	return {
948		c() {
949			button = element("button");
950			t0 = text(t0_value);
951			t1 = space();
952			attr(button, "class", "svelte-13hsdno");
953			toggle_class(button, "current-page", /*page*/ ctx[13] === /*visible_page*/ ctx[35]);
954		},
955		m(target, anchor) {
956			insert(target, button, anchor);
957			append(button, t0);
958			append(button, t1);
959
960			if (!mounted) {
961				dispose = listen(button, "click", click_handler_2);
962				mounted = true;
963			}
964		},
965		p(new_ctx, dirty) {
966			ctx = new_ctx;
967			if (dirty[0] & /*visible_pages*/ 32768 && t0_value !== (t0_value = /*visible_page*/ ctx[35] + 1 + "")) set_data(t0, t0_value);
968
969			if (dirty[0] & /*page, visible_pages*/ 40960) {
970				toggle_class(button, "current-page", /*page*/ ctx[13] === /*visible_page*/ ctx[35]);
971			}
972		},
973		d(detaching) {
974			if (detaching) {
975				detach(button);
976			}
977
978			mounted = false;
979			dispose();
980		}
981	};
982}
983
984// (176:4) {#if visible_page === -1}
985function create_if_block_1(ctx) {
986	let div;
987
988	return {
989		c() {
990			div = element("div");
991			div.textContent = "...";
992		},
993		m(target, anchor) {
994			insert(target, div, anchor);
995		},
996		p: noop,
997		d(detaching) {
998			if (detaching) {
999				detach(div);
1000			}
1001		}
1002	};
1003}
1004
1005// (175:3) {#each visible_pages as visible_page}
1006function create_each_block(ctx) {
1007	let if_block_anchor;
1008
1009	function select_block_type_1(ctx, dirty) {
1010		if (/*visible_page*/ ctx[35] === -1) return create_if_block_1;
1011		return create_else_block;
1012	}
1013
1014	let current_block_type = select_block_type_1(ctx);
1015	let if_block = current_block_type(ctx);
1016
1017	return {
1018		c() {
1019			if_block.c();
1020			if_block_anchor = empty();
1021		},
1022		m(target, anchor) {
1023			if_block.m(target, anchor);
1024			insert(target, if_block_anchor, anchor);
1025		},
1026		p(ctx, dirty) {
1027			if (current_block_type === (current_block_type = select_block_type_1(ctx)) && if_block) {
1028				if_block.p(ctx, dirty);
1029			} else {
1030				if_block.d(1);
1031				if_block = current_block_type(ctx);
1032
1033				if (if_block) {
1034					if_block.c();
1035					if_block.m(if_block_anchor.parentNode, if_block_anchor);
1036				}
1037			}
1038		},
1039		d(detaching) {
1040			if (detaching) {
1041				detach(if_block_anchor);
1042			}
1043
1044			if_block.d(detaching);
1045		}
1046	};
1047}
1048
1049// (67:0) <Block  {visible}  padding={false}  {elem_id}  {elem_classes}  {scale}  {min_width}  allow_overflow={false}  container={false} >
1050function create_default_slot(ctx) {
1051	let div;
1052	let svg;
1053	let path;
1054	let t0;
1055	let t1;
1056	let t2;
1057	let current_block_type_index;
1058	let if_block0;
1059	let t3;
1060	let if_block1_anchor;
1061	let current;
1062	const if_block_creators = [create_if_block_2, create_else_block_1];
1063	const if_blocks = [];
1064
1065	function select_block_type(ctx, dirty) {
1066		if (/*gallery*/ ctx[18]) return 0;
1067		return 1;
1068	}
1069
1070	current_block_type_index = select_block_type(ctx);
1071	if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
1072	let if_block1 = /*paginate*/ ctx[20] && create_if_block(ctx);
1073
1074	return {
1075		c() {
1076			div = element("div");
1077			svg = svg_element("svg");
1078			path = svg_element("path");
1079			t0 = space();
1080			t1 = text(/*label*/ ctx[4]);
1081			t2 = space();
1082			if_block0.c();
1083			t3 = space();
1084			if (if_block1) if_block1.c();
1085			if_block1_anchor = empty();
1086			attr(path, "fill", "currentColor");
1087			attr(path, "d", "M10 6h18v2H10zm0 18h18v2H10zm0-9h18v2H10zm-6 0h2v2H4zm0-9h2v2H4zm0 18h2v2H4z");
1088			attr(svg, "xmlns", "http://www.w3.org/2000/svg");
1089			attr(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink");
1090			attr(svg, "aria-hidden", "true");
1091			attr(svg, "role", "img");
1092			attr(svg, "width", "1em");
1093			attr(svg, "height", "1em");
1094			attr(svg, "preserveAspectRatio", "xMidYMid meet");
1095			attr(svg, "viewBox", "0 0 32 32");
1096			attr(svg, "class", "svelte-13hsdno");
1097			attr(div, "class", "label svelte-13hsdno");
1098		},
1099		m(target, anchor) {
1100			insert(target, div, anchor);
1101			append(div, svg);
1102			append(svg, path);
1103			append(div, t0);
1104			append(div, t1);
1105			insert(target, t2, anchor);
1106			if_blocks[current_block_type_index].m(target, anchor);
1107			insert(target, t3, anchor);
1108			if (if_block1) if_block1.m(target, anchor);
1109			insert(target, if_block1_anchor, anchor);
1110			current = true;
1111		},
1112		p(ctx, dirty) {
1113			if (!current || dirty[0] & /*label*/ 16) set_data(t1, /*label*/ ctx[4]);
1114			let previous_block_index = current_block_type_index;
1115			current_block_type_index = select_block_type(ctx);
1116
1117			if (current_block_type_index === previous_block_index) {
1118				if_blocks[current_block_type_index].p(ctx, dirty);
1119			} else {
1120				group_outros();
1121
1122				transition_out(if_blocks[previous_block_index], 1, 1, () => {
1123					if_blocks[previous_block_index] = null;
1124				});
1125
1126				check_outros();
1127				if_block0 = if_blocks[current_block_type_index];
1128
1129				if (!if_block0) {
1130					if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
1131					if_block0.c();
1132				} else {
1133					if_block0.p(ctx, dirty);
1134				}
1135
1136				transition_in(if_block0, 1);
1137				if_block0.m(t3.parentNode, t3);
1138			}
1139
1140			if (/*paginate*/ ctx[20]) if_block1.p(ctx, dirty);
1141		},
1142		i(local) {
1143			if (current) return;
1144			transition_in(if_block0);
1145			current = true;
1146		},
1147		o(local) {
1148			transition_out(if_block0);
1149			current = false;
1150		},
1151		d(detaching) {
1152			if (detaching) {
1153				detach(div);
1154				detach(t2);
1155				detach(t3);
1156				detach(if_block1_anchor);
1157			}
1158
1159			if_blocks[current_block_type_index].d(detaching);
1160			if (if_block1) if_block1.d(detaching);
1161		}
1162	};
1163}
1164
1165function create_fragment(ctx) {
1166	let block;
1167	let current;
1168
1169	block = new Block({
1170			props: {
1171				visible: /*visible*/ ctx[8],
1172				padding: false,
1173				elem_id: /*elem_id*/ ctx[6],
1174				elem_classes: /*elem_classes*/ ctx[7],
1175				scale: /*scale*/ ctx[10],
1176				min_width: /*min_width*/ ctx[11],
1177				allow_overflow: false,
1178				container: false,
1179				$$slots: { default: [create_default_slot] },
1180				$$scope: { ctx }
1181			}
1182		});
1183
1184	return {
1185		c() {
1186			create_component(block.$$.fragment);
1187		},
1188		m(target, anchor) {
1189			mount_component(block, target, anchor);
1190			current = true;
1191		},
1192		p(ctx, dirty) {
1193			const block_changes = {};
1194			if (dirty[0] & /*visible*/ 256) block_changes.visible = /*visible*/ ctx[8];
1195			if (dirty[0] & /*elem_id*/ 64) block_changes.elem_id = /*elem_id*/ ctx[6];
1196			if (dirty[0] & /*elem_classes*/ 128) block_changes.elem_classes = /*elem_classes*/ ctx[7];
1197			if (dirty[0] & /*scale*/ 1024) block_changes.scale = /*scale*/ ctx[10];
1198			if (dirty[0] & /*min_width*/ 2048) block_changes.min_width = /*min_width*/ ctx[11];
1199
1200			if (dirty[0] & /*visible_pages, page, selected_samples, value, samples_per_page, gradio, component_meta, component_props, current_hover, component_map, components, gallery, headers, label*/ 520767 | dirty[1] & /*$$scope*/ 262144) {
1201				block_changes.$$scope = { dirty, ctx };
1202			}
1203
1204			block.$set(block_changes);
1205		},
1206		i(local) {
1207			if (current) return;
1208			transition_in(block.$$.fragment, local);
1209			current = true;
1210		},
1211		o(local) {
1212			transition_out(block.$$.fragment, local);
1213			current = false;
1214		},
1215		d(detaching) {
1216			destroy_component(block, detaching);
1217		}
1218	};
1219}
1220
1221function instance($$self, $$props, $$invalidate) {
1222	let gallery;
1223	let { components } = $$props;
1224	let { component_props } = $$props;
1225	let { component_map } = $$props;
1226	let { label = "Examples" } = $$props;
1227	let { headers } = $$props;
1228	let { samples } = $$props;
1229	let { elem_id = "" } = $$props;
1230	let { elem_classes = [] } = $$props;
1231	let { visible = true } = $$props;
1232	let { value = null } = $$props;
1233	let { root } = $$props;
1234	let { proxy_url } = $$props;
1235	let { samples_per_page = 10 } = $$props;
1236	let { scale = null } = $$props;
1237	let { min_width = undefined } = $$props;
1238	let { gradio } = $$props;
1239	let samples_dir = get_fetchable_url_or_file(null, root, proxy_url);
1240	let page = 0;
1241	let paginate = samples.length > samples_per_page;
1242	let selected_samples;
1243	let page_count;
1244	let visible_pages = [];
1245	let current_hover = -1;
1246
1247	function handle_mouseenter(i) {
1248		$$invalidate(16, current_hover = i);
1249	}
1250
1251	function handle_mouseleave() {
1252		$$invalidate(16, current_hover = -1);
1253	}
1254
1255	let component_meta = [];
1256
1257	async function get_component_meta(selected_samples) {
1258		$$invalidate(17, component_meta = await Promise.all(selected_samples.map(async sample_row => await Promise.all(sample_row.map(async (sample_cell, j) => {
1259			return {
1260				value: sample_cell,
1261				component: (await component_map.get(components[j]))?.component?.default
1262			};
1263		})))));
1264	}
1265
1266	const click_handler = (i, sample_row) => {
1267		$$invalidate(0, value = i + page * samples_per_page);
1268		gradio.dispatch("click", value);
1269		gradio.dispatch("select", { index: value, value: sample_row });
1270	};
1271
1272	const mouseenter_handler = i => handle_mouseenter(i);
1273	const mouseleave_handler = () => handle_mouseleave();
1274
1275	const click_handler_1 = i => {
1276		$$invalidate(0, value = i + page * samples_per_page);
1277		gradio.dispatch("click", value);
1278	};
1279
1280	const mouseenter_handler_1 = i => handle_mouseenter(i);
1281	const mouseleave_handler_1 = () => handle_mouseleave();
1282	const click_handler_2 = visible_page => $$invalidate(13, page = visible_page);
1283
1284	$$self.$$set = $$props => {
1285		if ('components' in $$props) $$invalidate(1, components = $$props.components);
1286		if ('component_props' in $$props) $$invalidate(2, component_props = $$props.component_props);
1287		if ('component_map' in $$props) $$invalidate(3, component_map = $$props.component_map);
1288		if ('label' in $$props) $$invalidate(4, label = $$props.label);
1289		if ('headers' in $$props) $$invalidate(5, headers = $$props.headers);
1290		if ('samples' in $$props) $$invalidate(23, samples = $$props.samples);
1291		if ('elem_id' in $$props) $$invalidate(6, elem_id = $$props.elem_id);
1292		if ('elem_classes' in $$props) $$invalidate(7, elem_classes = $$props.elem_classes);
1293		if ('visible' in $$props) $$invalidate(8, visible = $$props.visible);
1294		if ('value' in $$props) $$invalidate(0, value = $$props.value);
1295		if ('root' in $$props) $$invalidate(24, root = $$props.root);
1296		if ('proxy_url' in $$props) $$invalidate(25, proxy_url = $$props.proxy_url);
1297		if ('samples_per_page' in $$props) $$invalidate(9, samples_per_page = $$props.samples_per_page);
1298		if ('scale' in $$props) $$invali
1298date(10, scale = $$props.scale);
1299		if ('min_width' in $$props) $$invalidate(11, min_width = $$props.min_width);
1300		if ('gradio' in $$props) $$invalidate(12, gradio = $$props.gradio);
1301	};
1302
1303	$$self.$$.update = () => {
1304		if ($$self.$$.dirty[0] & /*components*/ 2) {
1305			$$invalidate(18, gallery = components.length < 2);
1306		}
1307
1308		if ($$self.$$.dirty[0] & /*samples, page, samples_per_page, page_count, visible_pages*/ 75538944) {
1309			{
1310				if (paginate) {
1311					$$invalidate(15, visible_pages = []);
1312					$$invalidate(14, selected_samples = samples.slice(page * samples_per_page, (page + 1) * samples_per_page));
1313					$$invalidate(26, page_count = Math.ceil(samples.length / samples_per_page));
1314
1315					[0, page, page_count - 1].forEach(anchor => {
1316						for (let i = anchor - 2; i <= anchor + 2; i++) {
1317							if (i >= 0 && i < page_count && !visible_pages.includes(i)) {
1318								if (visible_pages.length > 0 && i - visible_pages[visible_pages.length - 1] > 1) {
1319									visible_pages.push(-1);
1320								}
1321
1322								visible_pages.push(i);
1323							}
1324						}
1325					});
1326				} else {
1327					$$invalidate(14, selected_samples = samples.slice());
1328				}
1329			}
1330		}
1331
1332		if ($$self.$$.dirty[0] & /*selected_samples*/ 16384) {
1333			get_component_meta(selected_samples);
1334		}
1335	};
1336
1337	return [
1338		value,
1339		components,
1340		component_props,
1341		component_map,
1342		label,
1343		headers,
1344		elem_id,
1345		elem_classes,
1346		visible,
1347		samples_per_page,
1348		scale,
1349		min_width,
1350		gradio,
1351		page,
1352		selected_samples,
1353		visible_pages,
1354		current_hover,
1355		component_meta,
1356		gallery,
1357		samples_dir,
1358		paginate,
1359		handle_mouseenter,
1360		handle_mouseleave,
1361		samples,
1362		root,
1363		proxy_url,
1364		page_count,
1365		click_handler,
1366		mouseenter_handler,
1367		mouseleave_handler,
1368		click_handler_1,
1369		mouseenter_handler_1,
1370		mouseleave_handler_1,
1371		click_handler_2
1372	];
1373}
1374
1375class Index extends SvelteComponent {
1376	constructor(options) {
1377		super();
1378
1379		init(
1380			this,
1381			options,
1382			instance,
1383			create_fragment,
1384			safe_not_equal,
1385			{
1386				components: 1,
1387				component_props: 2,
1388				component_map: 3,
1389				label: 4,
1390				headers: 5,
1391				samples: 23,
1392				elem_id: 6,
1393				elem_classes: 7,
1394				visible: 8,
1395				value: 0,
1396				root: 24,
1397				proxy_url: 25,
1398				samples_per_page: 9,
1399				scale: 10,
1400				min_width: 11,
1401				gradio: 12
1402			},
1403			null,
1404			[-1, -1]
1405		);
1406	}
1407}
1408
1409export { Index as default };
1410//# sourceMappingURL=Index-fa027128.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.