PageSourceSearch

https://metabonetglucose-leaderboard.hf.space/assets/Index-CMslNhWu.js

js metabonetglucose-leaderboard.hf.space collected 2026-10-03 10:23:56 UTC 10,578 bytes, 386 lines download raw bytes

1import { p as prop, i as if_block, d as bind_this, f as set_style, a as set_attribute, k as each, b as set_class, r as rest_props } from './i18n-CGlVUOvE.js';
2import { M as push, a8 as onMount, t as template_effect, Z as get, X as set_text, U as event, a as append, O as pop, ab as state, S as sibling, Q as child, R as from_html, $ as set, a2 as user_derived, T as reset, N as first_child } from './index-Bq2njFOY.js';
3import { G as Gradio } from './utils.svelte-Bi9ASwv9.js';
4import { h as html } from './html-Bwif0JPw.js';
5import { P as Prism$1 } from './prism-python-NrKIQnfs.js';
6
7var prismTypescript = {};
8
9var hasRequiredPrismTypescript;
10
11function requirePrismTypescript () {
12	if (hasRequiredPrismTypescript) return prismTypescript;
13	hasRequiredPrismTypescript = 1;
14	(function (Prism) {
15
16		Prism.languages.typescript = Prism.languages.extend('javascript', {
17			'class-name': {
18				pattern: /(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,
19				lookbehind: true,
20				greedy: true,
21				inside: null // see below
22			},
23			'builtin': /\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/,
24		});
25
26		// The keywords TypeScript adds to JavaScript
27		Prism.languages.typescript.keyword.push(
28			/\b(?:abstract|declare|is|keyof|readonly|require)\b/,
29			// keywords that have to be followed by an identifier
30			/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,
31			// This is for `import type *, {}`
32			/\btype\b(?=\s*(?:[\{*]|$))/
33		);
34
35		// doesn't work with TS because TS is too complex
36		delete Prism.languages.typescript['parameter'];
37		delete Prism.languages.typescript['literal-property'];
38
39		// a version of typescript specifically for highlighting types
40		var typeInside = Prism.languages.extend('typescript', {});
41		delete typeInside['class-name'];
42
43		Prism.languages.typescript['class-name'].inside = typeInside;
44
45		Prism.languages.insertBefore('typescript', 'function', {
46			'decorator': {
47				pattern: /@[$\w\xA0-\uFFFF]+/,
48				inside: {
49					'at': {
50						pattern: /^@/,
51						alias: 'operator'
52					},
53					'function': /^[\s\S]+/
54				}
55			},
56			'generic-function': {
57				// e.g. foo<T extends "bar" | "baz">( ...
58				pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,
59				greedy: true,
60				inside: {
61					'function': /^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,
62					'generic': {
63						pattern: /<[\s\S]+/, // everything after the first <
64						alias: 'class-name',
65						inside: typeInside
66					}
67				}
68			}
69		});
70
71		Prism.languages.ts = Prism.languages.typescript;
72
73	}(Prism));
74	return prismTypescript;
75}
76
77requirePrismTypescript();
78
79var root_1 = from_html(`<span class="title svelte-1kuiw39"> </span>`);
80var root_4 = from_html(`<a class="param-link svelte-1kuiw39"><span class="link-icon svelte-1kuiw39">🔗</span></a>`);
81var root_5 = from_html(`: <!>`, 1);
82var root_6 = from_html(`<div><span class="svelte-1kuiw39">default</span> <code class="svelte-1kuiw39">= <!></code></div>`);
83var root_7 = from_html(`<div class="description svelte-1kuiw39"><p><!></p></div>`);
84var root_3 = from_html(`<details class="param md svelte-1kuiw39"><summary class="type svelte-1kuiw39"><!> <pre><code class="svelte-1kuiw39"> <!></code></pre></summary> <!> <!></details>`);
85var root_2 = from_html(`<div class="param-content svelte-1kuiw39"></div>`);
86var root = from_html(`<div class="wrap svelte-1kuiw39"><div class="header svelte-1kuiw39"><!> <button class="toggle-all svelte-1kuiw39"> </button></div> <!></div>`);
87
88function ParamViewer($$anchor, $$props) {
89	push($$props, true);
90
91	let linkify = prop($$props, 'linkify', 19, () => []);
92	let component_root;
93	let all_open = state(false);
94	let lang = "python";
95	let _docs = user_derived(() => highlight_code($$props.docs, lang));
96
97	function create_slug(name, anchor_links) {
98		let prefix = "param-";
99
100		if (typeof anchor_links === "string") {
101			prefix += anchor_links + "-";
102		}
103
104		return prefix + name.toLowerCase().replace(/[^a-z0-9]+/g, "-");
105	}
106
107	function highlight(code, lang) {
108		let highlighted = Prism$1.highlight(code, Prism$1.languages[lang], lang);
109
110		for (const link of linkify()) {
111			highlighted = highlighted.replace(new RegExp(link, "g"), `<a href="#h-${link.toLocaleLowerCase()}">${link}</a>`);
112		}
113
114		return highlighted;
115	}
116
117	function highlight_code(_docs, lang) {
118		if (!_docs) {
119			return [];
120		}
121
122		return Object.entries(_docs).map(([name, { type, description, default: _default }]) => {
123			let highlighted_type = type ? highlight(type, lang) : null;
124
125			return {
126				name,
127				type: highlighted_type,
128				description,
129				default: _default ? highlight(_default, lang) : null
130			};
131		});
132	}
133
134	function toggle_all() {
135		set(all_open, !get(all_open));
136
137		const details = component_root.querySelectorAll(".param");
138
139		details.forEach((detail) => {
140			if (detail instanceof HTMLDetailsElement) {
141				detail.open = get(all_open);
142			}
143		});
144	}
145
146	function render_links(description) {
147		const escaped = description.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
148		const markdown_links = escaped.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank">$1</a>');
149
150		return markdown_links;
151	}
152
153	onMount(() => {
154		if (window.location.hash) {
155			open_parameter_from_hash(window.location.hash);
156		}
157
158		window.addEventListener("hashchange", (e) => {
159			open_parameter_from_hash(window.location.hash);
160		});
161	});
162
163	function open_parameter_from_hash(hash) {
164		if (!component_root) return;
165
166		const id = hash.slice(1);
167		const detail = component_root.querySelector(`#${id}`);
168
169		if (detail instanceof HTMLDetailsElement) {
170			detail.open = true;
171			detail.scrollIntoView({ behavior: "smooth" });
172		}
173	}
174
175	const get_dimension = (dimension_value) => {
176		if (dimension_value === undefined) {
177			return undefined;
178		}
179
180		if (typeof dimension_value === "number") {
181			return dimension_value + "px";
182		} else if (typeof dimension_value === "string") {
183			return dimension_value;
184		}
185	};
186
187	var div = root();
188	let styles;
189	var div_1 = child(div);
190	var node = child(div_1);
191
192	{
193		var consequent = ($$anchor) => {
194			var span = root_1();
195			var text = child(span, true);
196
197			reset(span);
198			template_effect(() => set_text(text, $$props.header));
199			append($$anchor, span);
200		};
201
202		if_block(node, ($$render) => {
203			if ($$props.header !== null) $$render(consequent);
204		});
205	}
206
207	var button = sibling(node, 2);
208	var text_1 = child(button, true);
209
210	reset(button);
211	reset(div_1);
212
213	var node_1 = sibling(div_1, 2);
214
215	{
216		var consequent_5 = ($$anchor) => {
217			var div_2 = root_2();
218
219			each(div_2, 21, () => get(_docs), ({ type, description, default: _default, name }) => name, ($$anchor, $$item) => {
220				let type = () => get($$item).type;
221				let description = () => get($$item).description;
222				let _default = () => get($$item).default;
223				let name = () => get($$item).name;
224				var details_1 = root_3();
225				var summary = child(details_1);
226				var node_2 = child(summary);
227
228				{
229					var consequent_1 = ($$anchor) => {
230						var a = root_4();
231
232						template_effect(($0) => set_attribute(a, 'href', `#${$0 ?? ''}`), [() => create_slug(name() || '', $$props.anchor_links)]);
233						append($$anchor, a);
234					};
235
236					if_block(node_2, ($$render) => {
237						if ($$props.anchor_links) $$render(consequent_1);
238					});
239				}
240
241				var pre = sibling(node_2, 2);
242
243				set_class(pre, 1, 'language-python svelte-1kuiw39');
244
245				var code_1 = child(pre);
246				var text_2 = child(code_1, true);
247				var node_3 = sibling(text_2);
248
249				{
250					var consequent_2 = ($$anchor) => {
251						var fragment = root_5();
252						var node_4 = sibling(first_child(fragment));
253
254						html(node_4, type);
255						append($$anchor, fragment);
256					};
257
258					if_block(node_3, ($$render) => {
259						if (type()) $$render(consequent_2);
260					});
261				}
262
263				reset(code_1);
264				reset(pre);
265				reset(summary);
266
267				var node_5 = sibling(summary, 2);
268
269				{
270					var consequent_3 = ($$anchor) => {
271						var div_3 = root_6();
272						let classes;
273						var span_1 = child(div_3);
274
275						set_style(span_1, '', {}, { 'padding-right': "4px" });
276
277						var code_2 = sibling(span_1, 2);
278						var node_6 = sibling(child(code_2));
279
280						html(node_6, _default);
281						reset(code_2);
282						reset(div_3);
283						template_effect(() => classes = set_class(div_3, 1, 'default svelte-1kuiw39', null, classes, { last: !description() }));
284						append($$anchor, div_3);
285					};
286
287					if_block(node_5, ($$render) => {
288						if (_default()) $$render(consequent_3);
289					});
290				}
291
292				var node_7 = sibling(node_5, 2);
293
294				{
295					var consequent_4 = ($$anchor) => {
296						var div_4 = root_7();
297						var p = child(div_4);
298						var node_8 = child(p);
299
300						html(node_8, () => render_links(description()));
301						reset(p);
302						reset(div_4);
303						append($$anchor, div_4);
304					};
305
306					if_block(node_7, ($$render) => {
307						if (description()) $$render(consequent_4);
308					});
309				}
310
311				reset(details_1);
312
313				template_effect(
314					($0) => {
315						set_attribute(details_1, 'id', $0);
316						set_text(text_2, name());
317					},
318					[
319						() => $$props.anchor_links
320							? create_slug(name() || "", $$props.anchor_links)
321							: undefined
322					]
323				);
324
325				append($$anchor, details_1);
326			});
327
328			reset(div_2);
329			append($$anchor, div_2);
330		};
331
332		if_block(node_1, ($$render) => {
333			if (get(_docs)) $$render(consequent_5);
334		});
335	}
336
337	reset(div);
338	bind_this(div, ($$value) => component_root = $$value, () => component_root);
339
340	template_effect(
341		($0) => {
342			styles = set_style(div, '', styles, $0);
343			set_attribute(button, 'title', get(all_open) ? "Close All" : "Open All");
344			set_text(text_1, get(all_open) ? "▲" : "▼");
345		},
346		[() => ({ 'max-height': get_dimension($$props.max_height) })]
347	);
348
349	event('click', button, toggle_all);
350	append($$anchor, div);
351	pop();
352}
353
354function Index($$anchor, $$props) {
355	push($$props, true);
356
357	const props = rest_props($$props, ['$$slots', '$$events', '$$legacy']);
358	const gradio = new Gradio(props);
359
360	ParamViewer($$anchor, {
361		get docs() {
362			return gradio.props.value;
363		},
364
365		get linkify() {
366			return gradio.props.linkify;
367		},
368
369		get header() {
370			return gradio.props.header;
371		},
372
373		get anchor_links() {
374			return gradio.props.anchor_links;
375		},
376
377		get max_height() {
378			return gradio.props.max_height;
379		}
380	});
381
382	pop();
383}
384
385export { Index as default };
386//# sourceMappingURL=Index-CMslNhWu.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.