PageSourceSearch

https://weyaxi-merge-lora.hf.space/assets/Index-4a602a74.js

js weyaxi-merge-lora.hf.space collected 2026-10-03 10:24:05 UTC 46,200 bytes, 1,682 lines download raw bytes

1import { B as Block } from './Button-05bf7cea.js';
2import { S as Static } from './Index-2cec2c56.js';
3import { B as BlockLabel } from './BlockLabel-09bb0248.js';
4import { I as IconButton } from './IconButton-fb69b8dd.js';
5import { E as Empty } from './Empty-2eeff83e.js';
6import { S as ShareButton } from './ShareButton-b044e1b5.js';
7import { D as Download } from './Download-ea83bae3.js';
8import { I as Image } from './Image-6cbf81d1.js';
9import { n as normalise_file } from './index-5550136d.js';
10/* empty css                                                     */import { M as ModifyUpload } from './ModifyUpload-772201f4.js';
11import { d as dequal } from './index-f38d9616.js';
12import { u as uploadToHuggingFace } from './utils-8f25e669.js';
13import './svelte/svelte.js';
14import './Clear-9760deed.js';
15import './Undo-6c110254.js';
16
17async function format_gallery_for_sharing(value) {
18  if (!value)
19    return "";
20  let urls = await Promise.all(
21    value.map(async ([image, _]) => {
22      if (image === null || !image.url)
23        return "";
24      return await uploadToHuggingFace(image.url, "url");
25    })
26  );
27  return `<div style="display: flex; flex-wrap: wrap; gap: 16px">${urls.map((url) => `<img src="${url}" style="height: 400px" />`).join("")}</div>`;
28}
29
30const Gallery_svelte_svelte_type_style_lang = '';
31
32/* home/runner/work/gradio/gradio/js/gallery/shared/Gallery.svelte generated by Svelte v4.2.2 */
33const {
34	SvelteComponent: SvelteComponent$1,
35	add_iframe_resize_listener,
36	add_render_callback,
37	append,
38	attr,
39	binding_callbacks: binding_callbacks$1,
40	bubble,
41	check_outros,
42	create_component: create_component$1,
43	destroy_component: destroy_component$1,
44	destroy_each,
45	detach: detach$1,
46	element,
47	empty,
48	ensure_array_like,
49	globals,
50	group_outros,
51	init: init$1,
52	insert: insert$1,
53	listen,
54	mount_component: mount_component$1,
55	run_all,
56	safe_not_equal: safe_not_equal$1,
57	set_data,
58	set_style,
59	space: space$1,
60	src_url_equal,
61	text,
62	toggle_class,
63	transition_in: transition_in$1,
64	transition_out: transition_out$1
65} = window.__gradio__svelte__internal;
66const { window: window_1 } = globals;
67const { createEventDispatcher: createEventDispatcher$1 } = window.__gradio__svelte__internal;const { tick } = window.__gradio__svelte__internal;
68function get_each_context(ctx, list, i) {
69	const child_ctx = ctx.slice();
70	child_ctx[39] = list[i];
71	child_ctx[41] = i;
72	return child_ctx;
73}
74
75function get_each_context_1(ctx, list, i) {
76	const child_ctx = ctx.slice();
77	child_ctx[42] = list[i];
78	child_ctx[43] = list;
79	child_ctx[41] = i;
80	return child_ctx;
81}
82
83// (153:0) {#if show_label}
84function create_if_block_6(ctx) {
85	let blocklabel;
86	let current;
87
88	blocklabel = new BlockLabel({
89			props: {
90				show_label: /*show_label*/ ctx[1],
91				Icon: Image,
92				label: /*label*/ ctx[2] || "Gallery"
93			}
94		});
95
96	return {
97		c() {
98			create_component$1(blocklabel.$$.fragment);
99		},
100		m(target, anchor) {
101			mount_component$1(blocklabel, target, anchor);
102			current = true;
103		},
104		p(ctx, dirty) {
105			const blocklabel_changes = {};
106			if (dirty[0] & /*show_label*/ 2) blocklabel_changes.show_label = /*show_label*/ ctx[1];
107			if (dirty[0] & /*label*/ 4) blocklabel_changes.label = /*label*/ ctx[2] || "Gallery";
108			blocklabel.$set(blocklabel_changes);
109		},
110		i(local) {
111			if (current) return;
112			transition_in$1(blocklabel.$$.fragment, local);
113			current = true;
114		},
115		o(local) {
116			transition_out$1(blocklabel.$$.fragment, local);
117			current = false;
118		},
119		d(detaching) {
120			destroy_component$1(blocklabel, detaching);
121		}
122	};
123}
124
125// (158:0) {:else}
126function create_else_block(ctx) {
127	let t0;
128	let div1;
129	let div0;
130	let t1;
131	let div1_resize_listener;
132	let current;
133	let if_block0 = /*selected_index*/ ctx[0] !== null && /*allow_preview*/ ctx[7] && create_if_block_3(ctx);
134	let if_block1 = /*show_share_button*/ ctx[9] && create_if_block_2(ctx);
135	let each_value = ensure_array_like(/*_value*/ ctx[12]);
136	let each_blocks = [];
137
138	for (let i = 0; i < each_value.length; i += 1) {
139		each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
140	}
141
142	return {
143		c() {
144			if (if_block0) if_block0.c();
145			t0 = space$1();
146			div1 = element("div");
147			div0 = element("div");
148			if (if_block1) if_block1.c();
149			t1 = space$1();
150
151			for (let i = 0; i < each_blocks.length; i += 1) {
152				each_blocks[i].c();
153			}
154
155			attr(div0, "class", "grid-container svelte-fiatpe");
156			set_style(div0, "--grid-cols", /*columns*/ ctx[4]);
157			set_style(div0, "--grid-rows", /*rows*/ ctx[5]);
158			set_style(div0, "--object-fit", /*object_fit*/ ctx[8]);
159			set_style(div0, "height", /*height*/ ctx[6]);
160			toggle_class(div0, "pt-6", /*show_label*/ ctx[1]);
161			attr(div1, "class", "grid-wrap svelte-fiatpe");
162			add_render_callback(() => /*div1_elementresize_handler*/ ctx[34].call(div1));
163			toggle_class(div1, "fixed-height", !/*height*/ ctx[6] || /*height*/ ctx[6] == "auto");
164		},
165		m(target, anchor) {
166			if (if_block0) if_block0.m(target, anchor);
167			insert$1(target, t0, anchor);
168			insert$1(target, div1, anchor);
169			append(div1, div0);
170			if (if_block1) if_block1.m(div0, null);
171			append(div0, t1);
172
173			for (let i = 0; i < each_blocks.length; i += 1) {
174				if (each_blocks[i]) {
175					each_blocks[i].m(div0, null);
176				}
177			}
178
179			div1_resize_listener = add_iframe_resize_listener(div1, /*div1_elementresize_handler*/ ctx[34].bind(div1));
180			current = true;
181		},
182		p(ctx, dirty) {
183			if (/*selected_index*/ ctx[0] !== null && /*allow_preview*/ ctx[7]) {
184				if (if_block0) {
185					if_block0.p(ctx, dirty);
186
187					if (dirty[0] & /*selected_index, allow_preview*/ 129) {
188						transition_in$1(if_block0, 1);
189					}
190				} else {
191					if_block0 = create_if_block_3(ctx);
192					if_block0.c();
193					transition_in$1(if_block0, 1);
194					if_block0.m(t0.parentNode, t0);
195				}
196			} else if (if_block0) {
197				group_outros();
198
199				transition_out$1(if_block0, 1, 1, () => {
200					if_block0 = null;
201				});
202
203				check_outros();
204			}
205
206			if (/*show_share_button*/ ctx[9]) {
207				if (if_block1) {
208					if_block1.p(ctx, dirty);
209
210					if (dirty[0] & /*show_share_button*/ 512) {
211						transition_in$1(if_block1, 1);
212					}
213				} else {
214					if_block1 = create_if_block_2(ctx);
215					if_block1.c();
216					transition_in$1(if_block1, 1);
217					if_block1.m(div0, t1);
218				}
219			} else if (if_block1) {
220				group_outros();
221
222				transition_out$1(if_block1, 1, 1, () => {
223					if_block1 = null;
224				});
225
226				check_outros();
227			}
228
229			if (dirty[0] & /*_value, selected_index*/ 4097) {
230				each_value = ensure_array_like(/*_value*/ ctx[12]);
231				let i;
232
233				for (i = 0; i < each_value.length; i += 1) {
234					const child_ctx = get_each_context(ctx, each_value, i);
235
236					if (each_blocks[i]) {
237						each_blocks[i].p(child_ctx, dirty);
238					} else {
239						each_blocks[i] = create_each_block(child_ctx);
240						each_blocks[i].c();
241						each_blocks[i].m(div0, null);
242					}
243				}
244
245				for (; i < each_blocks.length; i += 1) {
246					each_blocks[i].d(1);
247				}
248
249				each_blocks.length = each_value.length;
250			}
251
252			if (!current || dirty[0] & /*columns*/ 16) {
253				set_style(div0, "--grid-cols", /*columns*/ ctx[4]);
254			}
255
256			if (!current || dirty[0] & /*rows*/ 32) {
257				set_style(div0, "--grid-rows", /*rows*/ ctx[5]);
258			}
259
260			if (!current || dirty[0] & /*object_fit*/ 256) {
261				set_style(div0, "--object-fit", /*object_fit*/ ctx[8]);
262			}
263
264			if (!current || dirty[0] & /*height*/ 64) {
265				set_style(div0, "height", /*height*/ ctx[6]);
266			}
267
268			if (!current || dirty[0] & /*show_label*/ 2) {
269				toggle_class(div0, "pt-6", /*show_label*/ ctx[1]);
270			}
271
272			if (!current || dirty[0] & /*height*/ 64) {
273				toggle_class(div1, "fixed-height", !/*height*/ ctx[6] || /*height*/ ctx[6] == "auto");
274			}
275		},
276		i(local) {
277			if (current) return;
278			transition_in$1(if_block0);
279			transition_in$1(if_block1);
280			current = true;
281		},
282		o(local) {
283			transition_out$1(if_block0);
284			transition_out$1(if_block1);
285			current = false;
286		},
287		d(detaching) {
288			if (detaching) {
289				detach$1(t0);
290				detach$1(div1);
291			}
292
293			if (if_block0) if_block0.d(detaching);
294			if (if_block1) if_block1.d();
295			destroy_each(each_blocks, detaching);
296			div1_resize_listener();
297		}
298	};
299}
300
301// (156:0) {#if value === null || _value === null || _value.length === 0}
302function create_if_block(ctx) {
303	let empty_1;
304	let current;
305
306	empty_1 = new Empty({
307			props: {
308				unpadded_box: true,
309				size: "large",
310				$$slots: { default: [create_default_slot$1] },
311				$$scope: { ctx }
312			}
313		});
314
315	return {
316		c() {
317			create_component$1(empty_1.$$.fragment);
318		},
319		m(target, anchor) {
320			mount_component$1(empty_1, target, anchor);
321			current = true;
322		},
323		p(ctx, dirty) {
324			const empty_1_changes = {};
325
326			if (dirty[1] & /*$$scope*/ 8192) {
327				empty_1_changes.$$scope = { dirty, ctx };
328			}
329
330			empty_1.$set(empty_1_changes);
331		},
332		i(local) {
333			if (current) return;
334			transition_in$1(empty_1.$$.fragment, local);
335			current = true;
336		},
337		o(local) {
338			transition_out$1(empty_1.$$.fragment, local);
339			current = false;
340		},
341		d(detaching) {
342			destroy_component$1(empty_1, detaching);
343		}
344	};
345}
346
347// (159:1) {#if selected_index !== null && allow_preview}
348function create_if_block_3(ctx) {
349	let button1;
350	let div0;
351	let t0;
352	let modifyupload;
353	let t1;
354	let button0;
355	let img;
356	let img_src_value;
357	let img_alt_value;
358	let img_title_value;
359	let t2;
360	let t3;
361	let div1;
362	let current;
363	let mounted;
364	let dispose;
365	let if_block0 = /*show_download_button*/ ctx[10] && create_if_block_5(ctx);
366
367	modifyupload = new ModifyUpload({
368			props: { i18n: /*i18n*/ ctx[11], absolute: false }
369		});
370
371	modifyupload.$on("clear", /*clear_handler*/ ctx[26]);
372	let if_block1 = /*_value*/ ctx[12][/*selected_index*/ ctx[0]]?.caption && create_if_block_4(ctx);
373	let each_value_1 = ensure_array_like(/*_value*/ ctx[12]);
374	let each_blocks = [];
375
376	for (let i = 0; i < each_value_1.length; i += 1) {
377		each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
378	}
379
380	return {
381		c() {
382			button1 = element("button");
383			div0 = element("div");
384			if (if_block0) if_block0.c();
385			t0 = space$1();
386			create_component$1(modifyupload.$$.fragment);
387			t1 = space$1();
388			button0 = element("button");
389			img = element("img");
390			t2 = space$1();
391			if (if_block1) if_block1.c();
392			t3 = space$1();
393			div1 = element("div");
394
395			for (let i = 0; i < each_blocks.length; i += 1) {
396				each_blocks[i].c();
397			}
398
399			attr(div0, "class", "icon-buttons svelte-fiatpe");
400			attr(img, "data-testid", "detailed-image");
401			if (!src_url_equal(img.src, img_src_value = /*_value*/ ctx[12][/*selected_index*/ ctx[0]].image.url)) attr(img, "src", img_src_value);
402			attr(img, "alt", img_alt_value = /*_value*/ ctx[12][/*selected_index*/ ctx[0]].caption || "");
403			attr(img, "title", img_title_value = /*_value*/ ctx[12][/*selected_index*/ ctx[0]].caption || null);
404			attr(img, "loading", "lazy");
405			attr(img, "class", "svelte-fiatpe");
406			toggle_class(img, "with-caption", !!/*_value*/ ctx[12][/*selected_index*/ ctx[0]].caption);
407			attr(button0, "class", "image-button svelte-fiatpe");
408
409			set_style(button0, "height", "calc(100% - " + (/*_value*/ ctx[12][/*selected_index*/ ctx[0]].caption
410			? '80px'
411			: '60px') + ")");
412
413			attr(button0, "aria-label", "detailed view of selected image");
414			attr(div1, "class", "thumbnails scroll-hide svelte-fiatpe");
415			attr(div1, "data-testid", "container_el");
416			attr(button1, "class", "preview svelte-fiatpe");
417		},
418		m(target, anchor) {
419			insert$1(target, button1, anchor);
420			append(button1, div0);
421			if (if_block0) if_block0.m(div0, null);
422			append(div0, t0);
423			mount_component$1(modifyupload, div0, null);
424			append(button1, t1);
425			append(button1, button0);
426			append(button0, img);
427			append(button1, t2);
428			if (if_block1) if_block1.m(button1, null);
429			append(button1, t3);
430			append(button1, div1);
431
432			for (let i = 0; i < each_blocks.length; i += 1) {
433				if (each_blocks[i]) {
434					each_blocks[i].m(div1, null);
435				}
436			}
437
438			/*div1_binding*/ ctx[30](div1);
439			current = true;
440
441			if (!mounted) {
442				dispose = [
443					listen(button0, "click", /*click_handler*/ ctx[27]),
444					listen(button1, "keydown", /*on_keydown*/ ctx[18])
445				];
446
447				mounted = true;
448			}
449		},
450		p(ctx, dirty) {
451			if (/*show_download_button*/ ctx[10]) {
452				if (if_block0) {
453					if_block0.p(ctx, dirty);
454
455					if (dirty[0] & /*show_download_button*/ 1024) {
456						transition_in$1(if_block0, 1);
457					}
458				} else {
459					if_block0 = create_if_block_5(ctx);
460					if_block0.c();
461					transition_in$1(if_block0, 1);
462					if_block0.m(div0, t0);
463				}
464			} else if (if_block0) {
465				group_outros();
466
467				transition_out$1(if_block0, 1, 1, () => {
468					if_block0 = null;
469				});
470
471				check_outros();
472			}
473
474			const modifyupload_changes = {};
475			if (dirty[0] & /*i18n*/ 2048) modifyupload_changes.i18n = /*i18n*/ ctx[11];
476			modifyupload.$set(modifyupload_changes);
477
478			if (!current || dirty[0] & /*_value, selected_index*/ 4097 && !src_url_equal(img.src, img_src_value = /*_value*/ ctx[12][/*selected_index*/ ctx[0]].image.url)) {
479				attr(img, "src", img_src_value);
480			}
481
482			if (!current || dirty[0] & /*_value, selected_index*/ 4097 && img_alt_value !== (img_alt_value = /*_value*/ ctx[12][/*selected_index*/ ctx[0]].caption || "")) {
483				attr(img, "alt", img_alt_value);
484			}
485
486			if (!current || dirty[0] & /*_value, selected_index*/ 4097 && img_title_value !== (img_title_value = /*_value*/ ctx[12][/*selected_index*/ ctx[0]].caption || null)) {
487				attr(img, "title", img_title_value);
488			}
489
490			if (!current || dirty[0] & /*_value, selected_index*/ 4097) {
491				toggle_class(img, "with-caption", !!/*_value*/ ctx[12][/*selected_index*/ ctx[0]].caption);
492			}
493
494			if (!current || dirty[0] & /*_value, selected_index*/ 4097) {
495				set_style(button0, "height", "calc(100% - " + (/*_value*/ ctx[12][/*selected_index*/ ctx[0]].caption
496				? '80px'
497				: '60px') + ")");
498			}
499
500			if (/*_value*/ ctx[12][/*selected_index*/ ctx[0]]?.caption) {
501				if (if_block1) {
502					if_block1.p(ctx, dirty);
503				} else {
504					if_block1 = create_if_block_4(ctx);
505					if_block1.c();
506					if_block1.m(button1, t3);
507				}
508			} else if (if_block1) {
509				if_block1.d(1);
510				if_block1 = null;
511			}
512
513			if (dirty[0] & /*_value, el, selected_index*/ 12289) {
514				each_value_1 = ensure_array_like(/*_value*/ ctx[12]);
515				let i;
516
517				for (i = 0; i < each_value_1.length; i += 1) {
518					const child_ctx = get_each_context_1(ctx, each_value_1, i);
519
520					if (each_blocks[i]) {
521						each_blocks[i].p(child_ctx, dirty);
522					} else {
523						each_blocks[i] = create_each_block_1(child_ctx);
524						each_blocks[i].c();
525						each_blocks[i].m(div1, null);
526					}
527				}
528
529				for (; i < each_blocks.length; i += 1) {
530					each_blocks[i].d(1);
531				}
532
533				each_blocks.length = each_value_1.length;
534			}
535		},
536		i(local) {
537			if (current) return;
538			transition_in$1(if_block0);
539			transition_in$1(modifyupload.$$.fragment, local);
540			current = true;
541		},
542		o(local) {
543			transition_out$1(if_block0);
544			transition_out$1(modifyupload.$$.fragment, local);
545			current = false;
546		},
547		d(detaching) {
548			if (detaching) {
549				detach$1(button1);
550			}
551
552			if (if_block0) if_block0.d();
553			destroy_component$1(modifyupload);
554			if (if_block1) if_block1.d();
555			destroy_each(each_blocks, detaching);
556			/*div1_binding*/ ctx[30](null);
557			mounted = false;
558			run_all(dispose);
559		}
560	};
561}
562
563// (162:4) {#if show_download_button}
564function create_if_block_5(ctx) {
565	let a;
566	let iconbutton;
567	let a_href_value;
568	let current;
569
570	iconbutton = new IconButton({
571			props: {
572				Icon: Download,
573				label: /*i18n*/ ctx[11]("common.download")
574			}
575		});
576
577	return {
578		c() {
579			a = element("a");
580			create_component$1(iconbutton.$$.fragment);
581			attr(a, "href", a_href_value = getHrefValue(/*value*/ ctx[3][/*selected_index*/ ctx[0]]));
582			attr(a, "target", window.__is_colab__ ? "_blank" : null);
583			attr(a, "download", "image");
584			attr(a, "class", "svelte-fiatpe");
585		},
586		m(target, anchor) {
587			insert$1(target, a, anchor);
588			mount_component$1(iconbutton, a, null);
589			current = true;
590		},
591		p(ctx, dirty) {
592			const iconbutton_changes = {};
593			if (dirty[0] & /*i18n*/ 2048) iconbutton_changes.label = /*i18n*/ ctx[11]("common.download");
594			iconbutton.$set(iconbutton_changes);
595
596			if (!current || dirty[0] & /*value, selected_index*/ 9 && a_href_value !== (a_href_value = getHrefValue(/*value*/ ctx[3][/*selected_index*/ ctx[0]]))) {
597				attr(a, "href", a_href_value);
598			}
599		},
600		i(local) {
601			if (current) return;
602			transition_in$1(iconbutton.$$.fragment, local);
603			current = true;
604		},
605		o(local) {
606			transition_out$1(iconbutton.$$.fragment, local);
607			current = false;
608		},
609		d(detaching) {
610			if (detaching) {
611				detach$1(a);
612			}
613
614			destroy_component$1(iconbutton);
615		}
616	};
617}
618
619// (195:3) {#if _value[selected_index]?.caption}
620function create_if_block_4(ctx) {
621	let caption;
622	let t_value = /*_value*/ ctx[12][/*selected_index*/ ctx[0]].caption + "";
623	let t;
624
625	return {
626		c() {
627			caption = element("caption");
628			t = text(t_value);
629			attr(caption, "class", "caption svelte-fiatpe");
630		},
631		m(target, anchor) {
632			insert$1(target, caption, anchor);
633			append(caption, t);
634		},
635		p(ctx, dirty) {
636			if (dirty[0] & /*_value, selected_index*/ 4097 && t_value !== (t_value = /*_value*/ ctx[12][/*selected_index*/ ctx[0]].caption + "")) set_data(t, t_value);
637		},
638		d(detaching) {
639			if (detaching) {
640				detach$1(caption);
641			}
642		}
643	};
644}
645
646// (205:4) {#each _value as image, i}
647function create_each_block_1(ctx) {
648	let button;
649	let img;
650	let img_src_value;
651	let img_title_value;
652	let t;
653	let button_aria_label_value;
654	let i = /*i*/ ctx[41];
655	let mounted;
656	let dispose;
657	const assign_button = () => /*button_binding*/ ctx[28](button, i);
658	const unassign_button = () => /*button_binding*/ ctx[28](null, i);
659
660	function click_handler_1() {
661		return /*click_handler_1*/ ctx[29](/*i*/ ctx[41]);
662	}
663
664	return {
665		c() {
666			button = element("button");
667			img = element("img");
668			t = space$1();
669			if (!src_url_equal(img.src, img_src_value = /*image*/ ctx[42].image.url)) attr(img, "src", img_src_value);
670			attr(img, "title", img_title_value = /*image*/ ctx[42].caption || null);
671			attr(img, "data-testid", "thumbnail " + (/*i*/ ctx[41] + 1));
672			attr(img, "alt", "");
673			attr(img, "loading", "lazy");
674			attr(img, "class", "svelte-fiatpe");
675			attr(button, "class", "thumbnail-item thumbnail-small svelte-fiatpe");
676			attr(button, "aria-label", button_aria_label_value = "Thumbnail " + (/*i*/ ctx[41] + 1) + " of " + /*_value*/ ctx[12].length);
677			toggle_class(button, "selected", /*selected_index*/ ctx[0] === /*i*/ ctx[41]);
678		},
679		m(target, anchor) {
680			insert$1(target, button, anchor);
681			append(button, img);
682			append(button, t);
683			assign_button();
684
685			if (!mounted) {
686				dispose = listen(button, "click", click_handler_1);
687				mounted = true;
688			}
689		},
690		p(new_ctx, dirty) {
691			ctx = new_ctx;
692
693			if (dirty[0] & /*_value*/ 4096 && !src_url_equal(img.src, img_src_value = /*image*/ ctx[42].image.url)) {
694				attr(img, "src", img_src_value);
695			}
696
697			if (dirty[0] & /*_value*/ 4096 && img_title_value !== (img_title_value = /*image*/ ctx[42].caption || null)) {
698				attr(img, "title", img_title_value);
699			}
700
701			if (dirty[0] & /*_value*/ 4096 && button_aria_label_value !== (button_aria_label_value = "Thumbnail " + (/*i*/ ctx[41] + 1) + " of " + /*_value*/ ctx[12].length)) {
702				attr(button, "aria-label", button_aria_label_value);
703			}
704
705			if (i !== /*i*/ ctx[41]) {
706				unassign_button();
707				i = /*i*/ ctx[41];
708				assign_button();
709			}
710
711			if (dirty[0] & /*selected_index*/ 1) {
712				toggle_class(button, "selected", /*selected_index*/ ctx[0] === /*i*/ ctx[41]);
713			}
714		},
715		d(detaching) {
716			if (detaching) {
717				detach$1(button);
718			}
719
720			unassign_button();
721			mounted = false;
722			dispose();
723		}
724	};
725}
726
727// (236:3) {#if show_share_button}
728function create_if_block_2(ctx) {
729	let div;
730	let sharebutton;
731	let current;
732
733	sharebutton = new ShareButton({
734			props: {
735				i18n: /*i18n*/ ctx[11],
736				value: /*_value*/ ctx[12],
737				formatter: format_gallery_for_sharing
738			}
739		});
740
741	sharebutton.$on("share", /*share_handler*/ ctx[31]);
742	sharebutton.$on("error", /*error_handler*/ ctx[32]);
743
744	return {
745		c() {
746			div = element("div");
747			create_component$1(sharebutton.$$.fragment);
748			attr(div, "class", "icon-button svelte-fiatpe");
749		},
750		m(target, anchor) {
751			insert$1(target, div, anchor);
752			mount_component$1(sharebutton, div, null);
753			current = true;
754		},
755		p(ctx, dirty) {
756			const sharebutton_changes = {};
757			if (dirty[0] & /*i18n*/ 2048) sharebutton_changes.i18n = /*i18n*/ ctx[11];
758			if (dirty[0] & /*_value*/ 4096) sharebutton_changes.value = /*_value*/ ctx[12];
759			sharebutton.$set(sharebutton_changes);
760		},
761		i(local) {
762			if (current) return;
763			transition_in$1(sharebutton.$$.fragment, local);
764			current = true;
765		},
766		o(local) {
767			transition_out$1(sharebutton.$$.fragment, local);
768			current = false;
769		},
770		d(detaching) {
771			if (detaching) {
772				detach$1(div);
773			}
774
775			destroy_component$1(sharebutton);
776		}
777	};
778}
779
780// (261:5) {#if entry.caption}
781function create_if_block_1(ctx) {
782	let div;
783	let t_value = /*entry*/ ctx[39].caption + "";
784	let t;
785
786	return {
787		c() {
788			div = element("div");
789			t = text(t_value);
790			attr(div, "class", "caption-label svelte-fiatpe");
791		},
792		m(target, anchor) {
793			insert$1(target, div, anchor);
794			append(div, t);
795		},
796		p(ctx, dirty) {
797			if (dirty[0] & /*_value*/ 4096 && t_value !== (t_value = /*entry*/ ctx[39].caption + "")) set_data(t, t_value);
798		},
799		d(detaching) {
800			if (detaching) {
801				detach$1(div);
802			}
803		}
804	};
805}
806
807// (247:3) {#each _value as entry, i}
808function create_each_block(ctx) {
809	let button;
810	let img;
811	let img_alt_value;
812	let img_src_value;
813	let t0;
814	let t1;
815	let button_aria_label_value;
816	let mounted;
817	let dispose;
818	let if_block = /*entry*/ ctx[39].caption && create_if_block_1(ctx);
819
820	function click_handler_2() {
821		return /*click_handler_2*/ ctx[33](/*i*/ ctx[41]);
822	}
823
824	return {
825		c() {
826			button = element("button");
827			img = element("img");
828			t0 = space$1();
829			if (if_block) if_block.c();
830			t1 = space$1();
831			attr(img, "alt", img_alt_value = /*entry*/ ctx[39].caption || "");
832
833			if (!src_url_equal(img.src, img_src_value = typeof /*entry*/ ctx[39].image === "string"
834			? /*entry*/ ctx[39].image
835			: /*entry*/ ctx[39].image.url)) attr(img, "src", img_src_value);
836
837			attr(img, "loading", "lazy");
838			attr(img, "class", "svelte-fiatpe");
839			attr(button, "class", "thumbnail-item thumbnail-lg svelte-fiatpe");
840			attr(button, "aria-label", button_aria_label_value = "Thumbnail " + (/*i*/ ctx[41] + 1) + " of " + /*_value*/ ctx[12].length);
841			toggle_class(button, "selected", /*selected_index*/ ctx[0] === /*i*/ ctx[41]);
842		},
843		m(target, anchor) {
844			insert$1(target, button, anchor);
845			append(button, img);
846			append(button, t0);
847			if (if_block) if_block.m(button, null);
848			append(button, t1);
849
850			if (!mounted) {
851				dispose = listen(button, "click", click_handler_2);
852				mounted = true;
853			}
854		},
855		p(new_ctx, dirty) {
856			ctx = new_ctx;
857
858			if (dirty[0] & /*_value*/ 4096 && img_alt_value !== (img_alt_value = /*entry*/ ctx[39].caption || "")) {
859				attr(img, "alt", img_alt_value);
860			}
861
862			if (dirty[0] & /*_value*/ 4096 && !src_url_equal(img.src, img_src_value = typeof /*entry*/ ctx[39].image === "string"
863			? /*entry*/ ctx[39].image
864			: /*entry*/ ctx[39].image.url)) {
865				attr(img, "src", img_src_value);
866			}
867
868			if (/*entry*/ ctx[39].caption) {
869				if (if_block) {
870					if_block.p(ctx, dirty);
871				} else {
872					if_block = create_if_block_1(ctx);
873					if_block.c();
874					if_block.m(button, t1);
875				}
876			} else if (if_block) {
877				if_block.d(1);
878				if_block = null;
879			}
880
881			if (dirty[0] & /*_value*/ 4096 && button_aria_label_value !== (button_aria_label_value = "Thumbnail " + (/*i*/ ctx[41] + 1) + " of " + /*_value*/ ctx[12].length)) {
882				attr(button, "aria-label", button_aria_label_value);
883			}
884
885			if (dirty[0] & /*selected_index*/ 1) {
886				toggle_class(button, "selected", /*selected_index*/ ctx[0] === /*i*/ ctx[41]);
887			}
888		},
889		d(detaching) {
890			if (detaching) {
891				detach$1(button);
892			}
893
894			if (if_block) if_block.d();
895			mounted = false;
896			dispose();
897		}
898	};
899}
900
901// (157:1) <Empty unpadded_box={true} size="large">
902function create_default_slot$1(ctx) {
903	let image_1;
904	let current;
905	image_1 = new Image({});
906
907	return {
908		c() {
909			create_component$1(image_1.$$.fragment);
910		},
911		m(target, anchor) {
912			mount_component$1(image_1, target, anchor);
913			current = true;
914		},
915		i(local) {
916			if (current) return;
917			transition_in$1(image_1.$$.fragment, local);
918			current = true;
919		},
920		o(local) {
921			transition_out$1(image_1.$$.fragment, local);
922			current = false;
923		},
924		d(detaching) {
925			destroy_component$1(image_1, detaching);
926		}
927	};
928}
929
930function create_fragment$1(ctx) {
931	let t;
932	let current_block_type_index;
933	let if_block1;
934	let if_block1_anchor;
935	let current;
936	let mounted;
937	let dispose;
938	add_render_callback(/*onwindowresize*/ ctx[25]);
939	let if_block0 = /*show_label*/ ctx[1] && create_if_block_6(ctx);
940	const if_block_creators = [create_if_block, create_else_block];
941	const if_blocks = [];
942
943	function select_block_type(ctx, dirty) {
944		if (/*value*/ ctx[3] === null || /*_value*/ ctx[12] === null || /*_value*/ ctx[12].length === 0) return 0;
945		return 1;
946	}
947
948	current_block_type_index = select_block_type(ctx);
949	if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
950
951	return {
952		c() {
953			if (if_block0) if_block0.c();
954			t = space$1();
955			if_block1.c();
956			if_block1_anchor = empty();
957		},
958		m(target, anchor) {
959			if (if_block0) if_block0.m(target, anchor);
960			insert$1(target, t, anchor);
961			if_blocks[current_block_type_index].m(target, anchor);
962			insert$1(target, if_block1_anchor, anchor);
963			current = true;
964
965			if (!mounted) {
966				dispose = listen(window_1, "resize", /*onwindowresize*/ ctx[25]);
967				mounted = true;
968			}
969		},
970		p(ctx, dirty) {
971			if (/*show_label*/ ctx[1]) {
972				if (if_block0) {
973					if_block0.p(ctx, dirty);
974
975					if (dirty[0] & /*show_label*/ 2) {
976						transition_in$1(if_block0, 1);
977					}
978				} else {
979					if_block0 = create_if_block_6(ctx);
980					if_block0.c();
981					transition_in$1(if_block0, 1);
982					if_block0.m(t.parentNode, t);
983				}
984			} else if (if_block0) {
985				group_outros();
986
987				transition_out$1(if_block0, 1, 1, () => {
988					if_block0 = null;
989				});
990
991				check_outros();
992			}
993
994			let previous_block_index = current_block_type_index;
995			current_block_type_index = select_block_type(ctx);
996
997			if (current_block_type_index === previous_block_index) {
998				if_blocks[current_block_type_index].p(ctx, dirty);
999			} else {
1000				group_outros();
1001
1002				transition_out$1(if_blocks[previous_block_index], 1, 1, () => {
1003					if_blocks[previous_block_index] = null;
1004				});
1005
1006				check_outros();
1007				if_block1 = if_blocks[current_block_type_index];
1008
1009				if (!if_block1) {
1010					if_block1 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
1011					if_block1.c();
1012				} else {
1013					if_block1.p(ctx, dirty);
1014				}
1015
1016				transition_in$1(if_block1, 1);
1017				if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
1018			}
1019		},
1020		i(local) {
1021			if (current) return;
1022			transition_in$1(if_block0);
1023			transition_in$1(if_block1);
1024			current = true;
1025		},
1026		o(local) {
1027			transition_out$1(if_block0);
1028			transition_out$1(if_block1);
1029			current = false;
1030		},
1031		d(detaching) {
1032			if (detaching) {
1033				detach$1(t);
1034				detach$1(if_block1_anchor);
1035			}
1036
1037			if (if_block0) if_block0.d(detaching);
1038			if_blocks[current_block_type_index].d(detaching);
1039			mounted = false;
1040			dispose();
1041		}
1042	};
1043}
1044
1045function isFileData(obj) {
1046	return typeof obj === "object" && obj !== null && "data" in obj;
1047}
1048
1049function getHrefValue(selected) {
1050	if (isFileData(selected)) {
1051		return selected.path;
1052	} else if (typeof selected === "string") {
1053		return selected;
1054	} else if (Array.isArray(selected)) {
1055		return getHrefValue(selected[0]);
1056	}
1057
1058	return "";
1059}
1060
1061function instance$1($$self, $$props, $$invalidate) {
1062	let previous;
1063	let next;
1064	let { show_label = true } = $$props;
1065	let { label } = $$props;
1066	let { root = "" } = $$props;
1067	let { proxy_url = null } = $$props;
1068	let { value = null } = $$props;
1069	let { columns = [2] } = $$props;
1070	let { rows = undefined } = $$props;
1071	let { height = "auto" } = $$props;
1072	let { preview } = $$props;
1073	let { allow_preview = true } = $$props;
1074	let { object_fit = "cover" } = $$props;
1075	let { show_share_button = false } = $$props;
1076	let { show_download_button = false } = $$props;
1077	let { i18n } = $$props;
1078	let { selected_index = null } = $$props;
1079	const dispatch = createEventDispatcher$1();
1080
1081	// tracks whether the value of the gallery was reset
1082	let was_reset = true;
1083
1084	let _value = null;
1085	let prevValue = value;
1086
1087	if (selected_index === null && preview && value?.length) {
1088		selected_index = 0;
1089	}
1090
1091	let old_selected_index = selected_index;
1092
1093	function handle_preview_click(event) {
1094		const element = event.target;
1095		const x = event.clientX;
1096		const width = element.offsetWidth;
1097		const centerX = width / 2;
1098
1099		if (x < centerX) {
1100			$$invalidate(0, selected_index = previous);
1101		} else {
1102			$$invalidate(0, selected_index = next);
1103		}
1104	}
1105
1106	function on_keydown(e) {
1107		switch (e.code) {
1108			case "Escape":
1109				e.preventDefault();
1110				$$invalidate(0, selected_index = null);
1111				break;
1112			case "ArrowLeft":
1113				e.preventDefault();
1114				$$invalidate(0, selected_index = previous);
1115				break;
1116			case "ArrowRight":
1117				e.preventDefault();
1118				$$invalidate(0, selected_index = next);
1119				break;
1120		}
1121	}
1122
1123	let el = [];
1124	let container_element;
1125
1126	async function scroll_to_img(index) {
1127		if (typeof index !== "number") return;
1128		await tick();
1129		if (el[index] === undefined) return;
1130		el[index]?.focus();
1131		const { left: container_left, width: container_width } = container_element.getBoundingClientRect();
1132		const { left, width } = el[index].getBoundingClientRect();
1133		const relative_left = left - container_left;
1134		const pos = relative_left + width / 2 - container_width / 2 + container_element.scrollLeft;
1135
1136		if (container_element && typeof container_element.scrollTo === "function") {
1137			container_element.scrollTo({
1138				left: pos < 0 ? 0 : pos,
1139				behavior: "smooth"
1140			});
1141		}
1142	}
1143
1144	let client_height = 0;
1145	let window_height = 0;
1146
1147	function onwindowresize() {
1148		$$invalidate(16, window_height = window_1.innerHeight);
1149	}
1150
1151	const clear_handler = () =>
1151 $$invalidate(0, selected_index = null);
1152	const click_handler = event => handle_preview_click(event);
1153
1154	function button_binding($$value, i) {
1155		binding_callbacks$1[$$value ? 'unshift' : 'push'](() => {
1156			el[i] = $$value;
1157			$$invalidate(13, el);
1158		});
1159	}
1160
1161	const click_handler_1 = i => $$invalidate(0, selected_index = i);
1162
1163	function div1_binding($$value) {
1164		binding_callbacks$1[$$value ? 'unshift' : 'push'](() => {
1165			container_element = $$value;
1166			$$invalidate(14, container_element);
1167		});
1168	}
1169
1170	function share_handler(event) {
1171		bubble.call(this, $$self, event);
1172	}
1173
1174	function error_handler(event) {
1175		bubble.call(this, $$self, event);
1176	}
1177
1178	const click_handler_2 = i => $$invalidate(0, selected_index = i);
1179
1180	function div1_elementresize_handler() {
1181		client_height = this.clientHeight;
1182		$$invalidate(15, client_height);
1183	}
1184
1185	$$self.$$set = $$props => {
1186		if ('show_label' in $$props) $$invalidate(1, show_label = $$props.show_label);
1187		if ('label' in $$props) $$invalidate(2, label = $$props.label);
1188		if ('root' in $$props) $$invali
1188date(19, root = $$props.root);
1189		if ('proxy_url' in $$props) $$invalidate(20, proxy_url = $$props.proxy_url);
1190		if ('value' in $$props) $$invalidate(3, value = $$props.value);
1191		if ('columns' in $$props) $$invalidate(4, columns = $$props.columns);
1192		if ('rows' in $$props) $$invalidate(5, rows = $$props.rows);
1193		if ('height' in $$props) $$invalidate(6, height = $$props.height);
1194		if ('preview' in $$props) $$invalidate(21, preview = $$props.preview);
1195		if ('allow_preview' in $$props) $$invalidate(7, allow_preview = $$props.allow_preview);
1196		if ('object_fit' in $$props) $$invalidate(8, object_fit = $$props.object_fit);
1197		if ('show_share_button' in $$props) $$invalidate(9, show_share_button = $$props.show_share_button);
1198		if ('show_download_button' in $$props) $$invalidate(10, show_download_button = $$props.show_download_button);
1199		if ('i18n' in $$props) $$invalidate(11, i18n = $$props.i18n);
1200		if ('selected_index' in $$props) $$invalidate(0, selected_index = $$props.selected_index);
1201	};
1202
1203	$$self.$$.update = () => {
1204		if ($$self.$$.dirty[0] & /*value, was_reset*/ 4194312) {
1205			$$invalidate(22, was_reset = value == null || value.length == 0 ? true : was_reset);
1206		}
1207
1208		if ($$self.$$.dirty[0] & /*value, root, proxy_url*/ 1572872) {
1209			$$invalidate(12, _value = value === null
1210			? null
1211			: value.map(data => ({
1212					image: normalise_file(data.image, root, proxy_url),
1213					caption: data.caption
1214				})));
1215		}
1216
1217		if ($$self.$$.dirty[0] & /*prevValue, value, was_reset, preview, selected_index*/ 14680073) {
1218			if (!dequal(prevValue, value)) {
1219				// When value is falsy (clear button or first load),
1220				// preview determines the selected image
1221				if (was_reset) {
1222					$$invalidate(0, selected_index = preview && value?.length ? 0 : null);
1223					$$invalidate(22, was_reset = false);
1224				} else // gallery has at least as many elements as it did before
1225				{
1226					$$invalidate(
1227						0,
1228						selected_index = selected_index !== null && value !== null && selected_index < value.length
1229						? selected_index
1230						: null
1231					);
1232				}
1233
1234				dispatch("change");
1235				$$invalidate(23, prevValue = value);
1236			}
1237		}
1238
1239		if ($$self.$$.dirty[0] & /*selected_index, _value*/ 4097) {
1240			previous = ((selected_index ?? 0) + (_value?.length ?? 0) - 1) % (_value?.length ?? 0);
1241		}
1242
1243		if ($$self.$$.dirty[0] & /*selected_index, _value*/ 4097) {
1244			next = ((selected_index ?? 0) + 1) % (_value?.length ?? 0);
1245		}
1246
1247		if ($$self.$$.dirty[0] & /*selected_index, old_selected_index, _value*/ 16781313) {
1248			{
1249				if (selected_index !== old_selected_index) {
1250					$$invalidate(24, old_selected_index = selected_index);
1251
1252					if (selected_index !== null) {
1253						dispatch("select", {
1254							index: selected_index,
1255							value: _value?.[selected_index]
1256						});
1257					}
1258				}
1259			}
1260		}
1261
1262		if ($$self.$$.dirty[0] & /*allow_preview, selected_index*/ 129) {
1263			if (allow_preview) {
1264				scroll_to_img(selected_index);
1265			}
1266		}
1267	};
1268
1269	return [
1270		selected_index,
1271		show_label,
1272		label,
1273		value,
1274		columns,
1275		rows,
1276		height,
1277		allow_preview,
1278		object_fit,
1279		show_share_button,
1280		show_download_button,
1281		i18n,
1282		_value,
1283		el,
1284		container_element,
1285		client_height,
1286		window_height,
1287		handle_preview_click,
1288		on_keydown,
1289		root,
1290		proxy_url,
1291		preview,
1292		was_reset,
1293		prevValue,
1294		old_selected_index,
1295		onwindowresize,
1296		clear_handler,
1297		click_handler,
1298		button_binding,
1299		click_handler_1,
1300		div1_binding,
1301		share_handler,
1302		error_handler,
1303		click_handler_2,
1304		div1_elementresize_handler
1305	];
1306}
1307
1308class Gallery extends SvelteComponent$1 {
1309	constructor(options) {
1310		super();
1311
1312		init$1(
1313			this,
1314			options,
1315			instance$1,
1316			create_fragment$1,
1317			safe_not_equal$1,
1318			{
1319				show_label: 1,
1320				label: 2,
1321				root: 19,
1322				proxy_url: 20,
1323				value: 3,
1324				columns: 4,
1325				rows: 5,
1326				height: 6,
1327				preview: 21,
1328				allow_preview: 7,
1329				object_fit: 8,
1330				show_share_button: 9,
1331				show_download_button: 10,
1332				i18n: 11,
1333				selected_index: 0
1334			},
1335			null,
1336			[-1, -1]
1337		);
1338	}
1339}
1340
1341const Gallery$1 = Gallery;
1342
1343/* home/runner/work/gradio/gradio/js/gallery/Index.svelte generated by Svelte v4.2.2 */
1344const {
1345	SvelteComponent,
1346	add_flush_callback,
1347	assign,
1348	bind,
1349	binding_callbacks,
1350	create_component,
1351	destroy_component,
1352	detach,
1353	get_spread_object,
1354	get_spread_update,
1355	init,
1356	insert,
1357	mount_component,
1358	safe_not_equal,
1359	space,
1360	transition_in,
1361	transition_out
1362} = window.__gradio__svelte__internal;const { createEventDispatcher }
1362 = window.__gradio__svelte__internal;
1363function create_default_slot(ctx) {
1364	let statustracker;
1365	let t;
1366	let gallery;
1367	let updating_selected_index;
1368	let current;
1369
1370	const statustracker_spread_levels = [
1371		{
1372			autoscroll: /*gradio*/ ctx[21].autoscroll
1373		},
1374		{ i18n: /*gradio*/ ctx[21].i18n },
1375		/*loading_status*/ ctx[1]
1376	];
1377
1378	let statustracker_props = {};
1379
1380	for (let i = 0; i < statustracker_spread_levels.length; i += 1) {
1381		statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]);
1382	}
1383
1384	statustracker = new Static({ props: statustracker_props });
1385
1386	function gallery_selected_index_binding(value) {
1387		/*gallery_selected_index_binding*/ ctx[22](value);
1388	}
1389
1390	let gallery_props = {
1391		label: /*label*/ ctx[3],
1392		value: /*value*/ ctx[9],
1393		show_label: /*show_label*/ ctx[2],
1394		root: /*root*/ ctx[4],
1395		proxy_url: /*proxy_url*/ ctx[5],
1396		columns: /*columns*/ ctx[13],
1397		rows: /*rows*/ ctx[14],
1398		height: /*height*/ ctx[15],
1399		preview: /*preview*/ ctx[16],
1400		object_fit: /*object_fit*/ ctx[18],
1401		allow_preview: /*allow_preview*/ ctx[17],
1402		show_share_button: /*show_share_button*/ ctx[19],
1403		show_download_button: /*show_download_button*/ ctx[20],
1404		i18n: /*gradio*/ ctx[21].i18n
1405	};
1406
1407	if (/*selected_index*/ ctx[0] !== void 0) {
1408		gallery_props.selected_index = /*selected_index*/ ctx[0];
1409	}
1410
1411	gallery = new Gallery$1({ props: gallery_props });
1412	binding_callbacks.push(() => bind(gallery, 'selected_index', gallery_selected_index_binding));
1413	gallery.$on("change", /*change_handler*/ ctx[23]);
1414	gallery.$on("select", /*select_handler*/ ctx[24]);
1415	gallery.$on("share", /*share_handler*/ ctx[25]);
1416	gallery.$on("error", /*error_handler*/ ctx[26]);
1417
1418	return {
1419		c() {
1420			create_component(statustracker.$$.fragment);
1421			t = space();
1422			create_component(gallery.$$.fragment);
1423		},
1424		m(target, anchor) {
1425			mount_component(statustracker, target, anchor);
1426			insert(target, t, anchor);
1427			mount_component(gallery, target, anchor);
1428			current = true;
1429		},
1430		p(ctx, dirty) {
1431			const statustracker_changes = (dirty & /*gradio, loading_status*/ 2097154)
1432			? get_spread_update(statustracker_spread_levels, [
1433					dirty & /*gradio*/ 2097152 && {
1434						autoscroll: /*gradio*/ ctx[21].autoscroll
1435					},
1436					dirty & /*gradio*/ 2097152 && { i18n: /*gradio*/ ctx[21].i18n },
1437					dirty & /*loading_status*/ 2 && get_spread_object(/*loading_status*/ ctx[1])
1438				])
1439			: {};
1440
1441			statustracker.$set(statustracker_changes);
1442			const gallery_changes = {};
1443			if (dirty & /*label*/ 8) gallery_changes.label = /*label*/ ctx[3];
1444			if (dirty & /*value*/ 512) gallery_changes.value = /*value*/ ctx[9];
1445			if (dirty & /*show_label*/ 4) gallery_changes.show_label = /*show_label*/ ctx[2];
1446			if (dirty & /*root*/ 16) gallery_changes.root = /*root*/ ctx[4];
1447			if (dirty & /*proxy_url*/ 32) gallery_changes.proxy_url = /*proxy_url*/ ctx[5];
1448			if (dirty & /*columns*/ 8192) gallery_changes.columns = /*columns*/ ctx[13];
1449			if (dirty & /*rows*/ 16384) gallery_changes.rows = /*rows*/ ctx[14];
1450			if (dirty & /*height*/ 32768) gallery_changes.height = /*height*/ ctx[15];
1451			if (dirty & /*preview*/ 65536) gallery_changes.preview = /*preview*/ ctx[16];
1452			if (dirty & /*object_fit*/ 262144) gallery_changes.object_fit = /*object_fit*/ ctx[18];
1453			if (dirty & /*allow_preview*/ 131072) gallery_changes.allow_preview = /*allow_preview*/ ctx[17];
1454			if (dirty & /*show_share_button*/ 524288) gallery_changes.show_share_button = /*show_share_button*/ ctx[19];
1455			if (dirty & /*show_download_button*/ 1048576) gallery_changes.show_download_button = /*show_download_button*/ ctx[20];
1456			if (dirty & /*gradio*/ 2097152) gallery_changes.i18n = /*gradio*/ ctx[21].i18n;
1457
1458			if (!updating_selected_index && dirty & /*selected_index*/ 1) {
1459				updating_selected_index = true;
1460				gallery_changes.selected_index = /*selected_index*/ ctx[0];
1461				add_flush_callback(() => updating_selected_index = false);
1462			}
1463
1464			gallery.$set(gallery_changes);
1465		},
1466		i(local) {
1467			if (current) return;
1468			transition_in(statustracker.$$.fragment, local);
1469			transition_in(gallery.$$.fragment, local);
1470			current = true;
1471		},
1472		o(local) {
1473			transition_out(statustracker.$$.fragment, local);
1474			transition_out(gallery.$$.fragment, local);
1475			current = false;
1476		},
1477		d(detaching) {
1478			if (detaching) {
1479				detach(t);
1480			}
1481
1482			destroy_component(statustracker, detaching);
1483			destroy_component(gallery, detaching);
1484		}
1485	};
1486}
1487
1488function create_fragment(ctx) {
1489	let block;
1490	let current;
1491
1492	block = new Block({
1493			props: {
1494				visible: /*visible*/ ctx[8],
1495				variant: "solid",
1496				padding: false,
1497				elem_id: /*elem_id*/ ctx[6],
1498				elem_classes: /*elem_classes*/ ctx[7],
1499				container: /*container*/ ctx[10],
1500				scale: /*scale*/ ctx[11],
1501				min_width: /*min_width*/ ctx[12],
1502				allow_overflow: false,
1503				height: typeof /*height*/ ctx[15] === "number"
1504				? /*height*/ ctx[15]
1505				: undefined,
1506				$$slots: { default: [create_default_slot] },
1507				$$scope: { ctx }
1508			}
1509		});
1510
1511	return {
1512		c() {
1513			create_component(block.$$.fragment);
1514		},
1515		m(target, anchor) {
1516			mount_component(block, target, anchor);
1517			current = true;
1518		},
1519		p(ctx, [dirty]) {
1520			const block_changes = {};
1521			if (dirty & /*visible*/ 256) block_changes.visible = /*visible*/ ctx[8];
1522			if (dirty & /*elem_id*/ 64) block_changes.elem_id = /*elem_id*/ ctx[6];
1523			if (dirty & /*elem_classes*/ 128) block_changes.elem_classes = /*elem_classes*/ ctx[7];
1524			if (dirty & /*container*/ 1024) block_changes.container = /*container*/ ctx[10];
1525			if (dirty & /*scale*/ 2048) block_changes.scale = /*scale*/ ctx[11];
1526			if (dirty & /*min_width*/ 4096) block_changes.min_width = /*min_width*/ ctx[12];
1527
1528			if (dirty & /*height*/ 32768) block_changes.height = typeof /*height*/ ctx[15] === "number"
1529			? /*height*/ ctx[15]
1530			: undefined;
1531
1532			if (dirty & /*$$scope, label, value, show_label, root, proxy_url, columns, rows, height, preview, object_fit, allow_preview, show_share_button, show_download_button, gradio, selected_index, loading_status*/ 272622143) {
1533				block_changes.$$scope = { dirty, ctx };
1534			}
1535
1536			block.$set(block_changes);
1537		},
1538		i(local) {
1539			if (current) return;
1540			transition_in(block.$$.fragment, local);
1541			current = true;
1542		},
1543		o(local) {
1544			transition_out(block.$$.fragment, local);
1545			current = false;
1546		},
1547		d(detaching) {
1548			destroy_component(block, detaching);
1549		}
1550	};
1551}
1552
1553function instance($$self, $$props, $$invalidate) {
1554	let { loading_status } = $$props;
1555	let { show_label } = $$props;
1556	let { label } = $$props;
1557	let { root } = $$props;
1558	let { proxy_url } = $$props;
1559	let { elem_id = "" } = $$props;
1560	let { elem_classes = [] } = $$props;
1561	let { visible = true } = $$props;
1562	let { value = null } = $$props;
1563	let { container = true } = $$props;
1564	let { scale = null } = $$props;
1565	let { min_width = undefined } = $$props;
1566	let { columns = [2] } = $$props;
1567	let { rows = undefined } = $$props;
1568	let { height = "auto" } = $$props;
1569	let { preview } = $$props;
1570	let { allow_preview = true } = $$props;
1571	let { selected_index = null } = $$props;
1572	let { object_fit = "cover" } = $$props;
1573	let { show_share_button = false } = $$props;
1574	let { show_download_button = false } = $$props;
1575	let { gradio } = $$props;
1576	const dispatch = createEventDispatcher();
1577
1578	function gallery_selected_index_binding(value) {
1579		selected_index = value;
1580		$$invalidate(0, selected_index);
1581	}
1582
1583	const change_handler = () => gradio.dispatch("change", value);
1584	const select_handler = e => gradio.dispatch("select", e.detail);
1585	const share_handler = e => gradio.dispatch("share", e.detail);
1586	const error_handler = e => gradio.dispatch("error", e.detail);
1587
1588	$$self.$$set = $$props => {
1589		if ('loading_status' in $$props) $$invalidate(1, loading_status = $$props.loading_status);
1590		if ('show_label' in $$props) $$invalidate(2, show_label = $$props.show_label);
1591		if ('label' in $$props) $$invalidate(3, label = $$props.label);
1592		if ('root' in $$props) $$invalidate(4, root = $$props.root);
1593		if ('proxy_url' in $$props) $$invalidate(5, proxy_url = $$props.proxy_url);
1594		if ('elem_id' in $$props) $$invalidate(6, elem_id = $$props.elem_id);
1595		if ('elem_classes' in $$props) $$invalidate(7, elem_classes = $$props.elem_classes);
1596		if ('visible' in $$props) $$invalidate(8, visible = $$props.visible);
1597		if ('value' in $$props) $$invalidate(9, value = $$props.value);
1598		if ('container' in $$props) $$invalidate(10, container = $$props.container);
1599		if ('scale' in $$props) $$invalidate(11, scale = $$props.scale);
1600		if ('min_width' in $$props) $$invalidate(12, min_width = $$props.min_width);
1601		if ('columns' in $$props) $$invalidate(13, columns = $$props.columns);
1602		if ('rows' in $$props) $$invalidate(14, rows = $$props.rows);
1603		if ('height' in $$props) $$invalidate(15, height = $$props.height);
1604		if ('preview' in $$props) $$invalidate(16, preview = $$props.preview);
1605		if ('allow_preview' in $$props) $$invalidate(17, allow_preview = $$props.allow_preview);
1606		if ('selected_index' in $$props) $$invalidate(0, selected_index = $$props.selected_index);
1607		if ('object_fit' in $$props) $$invalidate(18, object_fit = $$props.object_fit);
1608		if ('show_share_button' in $$props) $$invalidate(19, show_share_button = $$props.show_share_button);
1609		if ('show_download_button' in $$props) $$invalidate(20, show_download_button = $$props.show_download_button);
1610		if ('gradio' in $$props) $$invalidate(21, gradio = $$props.gradio);
1611	};
1612
1613	$$self.$$.update = () => {
1614		if ($$self.$$.dirty & /*selected_index*/ 1) {
1615			(dispatch("prop_change", { selected_index }));
1616		}
1617	};
1618
1619	return [
1620		selected_index,
1621		loading_status,
1622		show_label,
1623		label,
1624		root,
1625		proxy_url,
1626		elem_id,
1627		elem_classes,
1628		visible,
1629		value,
1630		container,
1631		scale,
1632		min_width,
1633		columns,
1634		rows,
1635		height,
1636		preview,
1637		allow_preview,
1638		object_fit,
1639		show_share_button,
1640		show_download_button,
1641		gradio,
1642		gallery_selected_index_binding,
1643		change_handler,
1644		select_handler,
1645		share_handler,
1646		error_handler
1647	];
1648}
1649
1650class Index extends SvelteComponent {
1651	constructor(options) {
1652		super();
1653
1654		init(this, options, instance, create_fragment, safe_not_equal, {
1655			loading_status: 1,
1656			show_label: 2,
1657			label: 3,
1658			root: 4,
1659			proxy_url: 5,
1660			elem_id: 6,
1661			elem_classes: 7,
1662			visible: 8,
1663			value: 9,
1664			container: 10,
1665			scale: 11,
1666			min_width: 12,
1667			columns: 13,
1668			rows: 14,
1669			height: 15,
1670			preview: 16,
1671			allow_preview: 17,
1672			selected_index: 0,
1673			object_fit: 18,
1674			show_share_button: 19,
1675			show_download_button: 20,
1676			gradio: 21
1677		});
1678	}
1679}
1680
1681export { Gallery$1 as BaseGallery, Index as default };
1682//# sourceMappingURL=Index-4a602a74.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.