PageSourceSearch

https://vikhyatk-moondream1.hf.space/assets/Index-19483a90.js

js vikhyatk-moondream1.hf.space collected 2026-10-03 10:24:00 UTC 48,149 bytes, 1,767 lines download raw bytes

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