PageSourceSearch

https://hfc1957-triposr.hf.space/assets/Example-bac8e01d.js

js hfc1957-triposr.hf.space collected 2026-10-03 16:56:21 UTC 8,825 bytes, 422 lines download raw bytes

1const Example_svelte_svelte_type_style_lang = '';
2
3/* home/runner/work/gradio/gradio/js/dataframe/Example.svelte generated by Svelte v4.2.2 */
4const {
5	SvelteComponent,
6	append,
7	attr,
8	destroy_each,
9	detach,
10	element,
11	empty,
12	ensure_array_like,
13	init,
14	insert,
15	listen,
16	noop,
17	run_all,
18	safe_not_equal,
19	space,
20	text,
21	toggle_class
22} = window.__gradio__svelte__internal;
23function get_each_context(ctx, list, i) {
24	const child_ctx = ctx.slice();
25	child_ctx[9] = list[i];
26	child_ctx[11] = i;
27	return child_ctx;
28}
29
30function get_each_context_1(ctx, list, i) {
31	const child_ctx = ctx.slice();
32	child_ctx[12] = list[i];
33	child_ctx[14] = i;
34	return child_ctx;
35}
36
37// (10:0) {#if loaded}
38function create_if_block(ctx) {
39	let div;
40	let mounted;
41	let dispose;
42
43	function select_block_type(ctx, dirty) {
44		if (typeof /*loaded_value*/ ctx[5] === "string") return create_if_block_1;
45		return create_else_block;
46	}
47
48	let current_block_type = select_block_type(ctx);
49	let if_block = current_block_type(ctx);
50
51	return {
52		c() {
53			div = element("div");
54			if_block.c();
55			attr(div, "class", "svelte-1cib1xd");
56			toggle_class(div, "table", /*type*/ ctx[1] === "table");
57			toggle_class(div, "gallery", /*type*/ ctx[1] === "gallery");
58			toggle_class(div, "selected", /*selected*/ ctx[2]);
59		},
60		m(target, anchor) {
61			insert(target, div, anchor);
62			if_block.m(div, null);
63
64			if (!mounted) {
65				dispose = [
66					listen(div, "mouseenter", /*mouseenter_handler*/ ctx[7]),
67					listen(div, "mouseleave", /*mouseleave_handler*/ ctx[8])
68				];
69
70				mounted = true;
71			}
72		},
73		p(ctx, dirty) {
74			if_block.p(ctx, dirty);
75
76			if (dirty & /*type*/ 2) {
77				toggle_class(div, "table", /*type*/ ctx[1] === "table");
78			}
79
80			if (dirty & /*type*/ 2) {
81				toggle_class(div, "gallery", /*type*/ ctx[1] === "gallery");
82			}
83
84			if (dirty & /*selected*/ 4) {
85				toggle_class(div, "selected", /*selected*/ ctx[2]);
86			}
87		},
88		d(detaching) {
89			if (detaching) {
90				detach(div);
91			}
92
93			if_block.d();
94			mounted = false;
95			run_all(dispose);
96		}
97	};
98}
99
100// (22:2) {:else}
101function create_else_block(ctx) {
102	let table;
103	let t;
104	let each_value = ensure_array_like(/*loaded_value*/ ctx[5].slice(0, 3));
105	let each_blocks = [];
106
107	for (let i = 0; i < each_value.length; i += 1) {
108		each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
109	}
110
111	let if_block = /*value*/ ctx[0].length > 3 && create_if_block_2(ctx);
112
113	return {
114		c() {
115			table = element("table");
116
117			for (let i = 0; i < each_blocks.length; i += 1) {
118				each_blocks[i].c();
119			}
120
121			t = space();
122			if (if_block) if_block.c();
123			attr(table, "class", " svelte-1cib1xd");
124		},
125		m(target, anchor) {
126			insert(target, table, anchor);
127
128			for (let i = 0; i < each_blocks.length; i += 1) {
129				if (each_blocks[i]) {
130					each_blocks[i].m(table, null);
131				}
132			}
133
134			append(table, t);
135			if (if_block) if_block.m(table, null);
136		},
137		p(ctx, dirty) {
138			if (dirty & /*loaded_value*/ 32) {
139				each_value = ensure_array_like(/*loaded_value*/ ctx[5].slice(0, 3));
140				let i;
141
142				for (i = 0; i < each_value.length; i += 1) {
143					const child_ctx = get_each_context(ctx, each_value, i);
144
145					if (each_blocks[i]) {
146						each_blocks[i].p(child_ctx, dirty);
147					} else {
148						each_blocks[i] = create_each_block(child_ctx);
149						each_blocks[i].c();
150						each_blocks[i].m(table, t);
151					}
152				}
153
154				for (; i < each_blocks.length; i += 1) {
155					each_blocks[i].d(1);
156				}
157
158				each_blocks.length = each_value.length;
159			}
160
161			if (/*value*/ ctx[0].length > 3) {
162				if (if_block) {
163					if_block.p(ctx, dirty);
164				} else {
165					if_block = create_if_block_2(ctx);
166					if_block.c();
167					if_block.m(table, null);
168				}
169			} else if (if_block) {
170				if_block.d(1);
171				if_block = null;
172			}
173		},
174		d(detaching) {
175			if (detaching) {
176				detach(table);
177			}
178
179			destroy_each(each_blocks, detaching);
180			if (if_block) if_block.d();
181		}
182	};
183}
184
185// (20:2) {#if typeof loaded_value === "string"}
186function create_if_block_1(ctx) {
187	let t;
188
189	return {
190		c() {
191			t = text(/*loaded_value*/ ctx[5]);
192		},
193		m(target, anchor) {
194			insert(target, t, anchor);
195		},
196		p: noop,
197		d(detaching) {
198			if (detaching) {
199				detach(t);
200			}
201		}
202	};
203}
204
205// (26:6) {#each row.slice(0, 3) as cell, j}
206function create_each_block_1(ctx) {
207	let td;
208
209	return {
210		c() {
211			td = element("td");
212			td.textContent = `${/*cell*/ ctx[12]}`;
213			attr(td, "class", "svelte-1cib1xd");
214		},
215		m(target, anchor) {
216			insert(target, td, anchor);
217		},
218		p: noop,
219		d(detaching) {
220			if (detaching) {
221				detach(td);
222			}
223		}
224	};
225}
226
227// (29:6) {#if row.length > 3}
228function create_if_block_3(ctx) {
229	let td;
230
231	return {
232		c() {
233			td = element("td");
234			td.textContent = "…";
235			attr(td, "class", "svelte-1cib1xd");
236		},
237		m(target, anchor) {
238			insert(target, td, anchor);
239		},
240		d(detaching) {
241			if (detaching) {
242				detach(td);
243			}
244		}
245	};
246}
247
248// (24:4) {#each loaded_value.slice(0, 3) as row, i}
249function create_each_block(ctx) {
250	let tr;
251	let t;
252	let each_value_1 = ensure_array_like(/*row*/ ctx[9].slice(0, 3));
253	let each_blocks = [];
254
255	for (let i = 0; i < each_value_1.length; i += 1) {
256		each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
257	}
258
259	let if_block = /*row*/ ctx[9].length > 3 && create_if_block_3();
260
261	return {
262		c() {
263			tr = element("tr");
264
265			for (let i = 0; i < each_blocks.length; i += 1) {
266				each_blocks[i].c();
267			}
268
269			t = space();
270			if (if_block) if_block.c();
271		},
272		m(target, anchor) {
273			insert(target, tr, anchor);
274
275			for (let i = 0; i < each_blocks.length; i += 1) {
276				if (each_blocks[i]) {
277					each_blocks[i].m(tr, null);
278				}
279			}
280
281			append(tr, t);
282			if (if_block) if_block.m(tr, null);
283		},
284		p(ctx, dirty) {
285			if (dirty & /*loaded_value*/ 32) {
286				each_value_1 = ensure_array_like(/*row*/ ctx[9].slice(0, 3));
287				let i;
288
289				for (i = 0; i < each_value_1.length; i += 1) {
290					const child_ctx = get_each_context_1(ctx, each_value_1, i);
291
292					if (each_blocks[i]) {
293						each_blocks[i].p(child_ctx, dirty);
294					} else {
295						each_blocks[i] = create_each_block_1(child_ctx);
296						each_blocks[i].c();
297						each_blocks[i].m(tr, t);
298					}
299				}
300
301				for (; i < each_blocks.length; i += 1) {
302					each_blocks[i].d(1);
303				}
304
305				each_blocks.length = each_value_1.length;
306			}
307		},
308		d(detaching) {
309			if (detaching) {
310				detach(tr);
311			}
312
313			destroy_each(each_blocks, detaching);
314			if (if_block) if_block.d();
315		}
316	};
317}
318
319// (34:4) {#if value.length > 3}
320function create_if_block_2(ctx) {
321	let div;
322
323	return {
324		c() {
325			div = element("div");
326			attr(div, "class", "overlay svelte-1cib1xd");
327			toggle_class(div, "odd", /*index*/ ctx[3] % 2 != 0);
328			toggle_class(div, "even", /*index*/ ctx[3] % 2 == 0);
329			toggle_class(div, "button", /*type*/ ctx[1] === "gallery");
330		},
331		m(target, anchor) {
332			insert(target, div, anchor);
333		},
334		p(ctx, dirty) {
335			if (dirty & /*index*/ 8) {
336				toggle_class(div, "odd", /*index*/ ctx[3] % 2 != 0);
337			}
338
339			if (dirty & /*index*/ 8) {
340				toggle_class(div, "even", /*index*/ ctx[3] % 2 == 0);
341			}
342
343			if (dirty & /*type*/ 2) {
344				toggle_class(div, "button", /*type*/ ctx[1] === "gallery");
345			}
346		},
347		d(detaching) {
348			if (detaching) {
349				detach(div);
350			}
351		}
352	};
353}
354
355function create_fragment(ctx) {
356	let if_block_anchor;
357	let if_block = /*loaded*/ ctx[6] && create_if_block(ctx);
358
359	return {
360		c() {
361			if (if_block) if_block.c();
362			if_block_anchor = empty();
363		},
364		m(target, anchor) {
365			if (if_block) if_block.m(target, anchor);
366			insert(target, if_block_anchor, anchor);
367		},
368		p(ctx, [dirty]) {
369			if (/*loaded*/ ctx[6]) if_block.p(ctx, dirty);
370		},
371		i: noop,
372		o: noop,
373		d(detaching) {
374			if (detaching) {
375				detach(if_block_anchor);
376			}
377
378			if (if_block) if_block.d(detaching);
379		}
380	};
381}
382
383function instance($$self, $$props, $$invalidate) {
384	let { value } = $$props;
385	let { type } = $$props;
386	let { selected = false } = $$props;
387	let { index } = $$props;
388	let hovered = false;
389	let loaded_value = value;
390	let loaded = Array.isArray(loaded_value);
391	const mouseenter_handler = () =>
391 $$invalidate(4, hovered = true);
392	const mouseleave_handler = () => $$invalidate(4, hovered = false);
393
394	$$self.$$set = $$props => {
395		if ('value' in $$props) $$invalidate(0, value = $$props.value);
396		if ('type' in $$props) $$invalidate(1, type = $$props.type);
397		if ('selected' in $$props) $$invalidate(2, selected = $$props.selected);
398		if ('index' in $$props) $$invalidate(3, index = $$props.index);
399	};
400
401	return [
402		value,
403		type,
404		selected,
405		index,
406		hovered,
407		loaded_value,
408		loaded,
409		mouseenter_handler,
410		mouseleave_handler
411	];
412}
413
414class Example extends SvelteComponent {
415	constructor(options) {
416		super();
417		init(this, options, instance, create_fragment, safe_not_equal, { value: 0, type: 1, selected: 2, index: 3 });
418	}
419}
420
421export { Example as default };
422//# sourceMappingURL=Example-bac8e01d.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.