import { _ as __vitePreload } from './index-9dc32a9d.js'; import { b as is_function, w as writable, L as Loader, d as get_store_value, $ as $format, e as setupi18n } from './Index-a77cc637.js'; import { d as cubicOut, f as fade, B as Block, a as Button } from './Button-ab11cb83.js'; /** * The flip function calculates the start and end position of an element and animates between them, translating the x and y values. * `flip` stands for [First, Last, Invert, Play](https://aerotwist.com/blog/flip-your-animations/). * * https://svelte.dev/docs/svelte-animate#flip * @param {Element} node * @param {{ from: DOMRect; to: DOMRect }} fromTo * @param {import('./public.js').FlipParams} params * @returns {import('./public.js').AnimationConfig} */ function flip(node, { from, to }, params = {}) { const style = getComputedStyle(node); const transform = style.transform === 'none' ? '' : style.transform; const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat); const dx = from.left + (from.width * ox) / to.width - (to.left + ox); const dy = from.top + (from.height * oy) / to.height - (to.top + oy); const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing = cubicOut } = params; return { delay, duration: is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration, easing, css: (t, u) => { const x = u * dx; const y = u * dy; const sx = t + (u * from.width) / to.width; const sy = t + (u * from.height) / to.height; return `transform: ${transform} translate(${x}px, ${y}px) scale(${sx}, ${sy});`; } }; } /* home/runner/work/gradio/gradio/js/icons/src/Error.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$g, append: append$d, attr: attr$d, detach: detach$f, init: init$g, insert: insert$f, noop: noop$8, safe_not_equal: safe_not_equal$g, svg_element: svg_element$3 } = window.__gradio__svelte__internal; function create_fragment$g(ctx) { let svg; let path; return { c() { svg = svg_element$3("svg"); path = svg_element$3("path"); attr$d(path, "stroke-linecap", "round"); attr$d(path, "stroke-linejoin", "round"); attr$d(path, "d", "M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"); attr$d(svg, "fill", "none"); attr$d(svg, "stroke", "currentColor"); attr$d(svg, "viewBox", "0 0 24 24"); attr$d(svg, "width", "100%"); attr$d(svg, "height", "100%"); attr$d(svg, "xmlns", "http://www.w3.org/2000/svg"); attr$d(svg, "aria-hidden", "true"); attr$d(svg, "stroke-width", "2"); attr$d(svg, "stroke-linecap", "round"); attr$d(svg, "stroke-linejoin", "round"); }, m(target, anchor) { insert$f(target, svg, anchor); append$d(svg, path); }, p: noop$8, i: noop$8, o: noop$8, d(detaching) { if (detaching) { detach$f(svg); } } }; } let Error$1 = class Error extends SvelteComponent$g { constructor(options) { super(); init$g(this, options, null, create_fragment$g, safe_not_equal$g, {}); } }; /* home/runner/work/gradio/gradio/js/icons/src/Info.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$f, append: append$c, attr: attr$c, detach: detach$e, init: init$f, insert: insert$e, noop: noop$7, safe_not_equal: safe_not_equal$f, svg_element: svg_element$2 } = window.__gradio__svelte__internal; function create_fragment$f(ctx) { let svg; let path; return { c() { svg = svg_element$2("svg"); path = svg_element$2("path"); attr$c(path, "stroke-linecap", "round"); attr$c(path, "stroke-linejoin", "round"); attr$c(path, "d", "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"); attr$c(svg, "fill", "none"); attr$c(svg, "stroke", "currentColor"); attr$c(svg, "viewBox", "0 0 24 24"); attr$c(svg, "width", "100%"); attr$c(svg, "height", "100%"); attr$c(svg, "xmlns", "http://www.w3.org/2000/svg"); attr$c(svg, "aria-hidden", "true"); attr$c(svg, "stroke-width", "2"); attr$c(svg, "stroke-linecap", "round"); attr$c(svg, "stroke-linejoin", "round"); }, m(target, anchor) { insert$e(target, svg, anchor); append$c(svg, path); }, p: noop$7, i: noop$7, o: noop$7, d(detaching) { if (detaching) { detach$e(svg); } } }; } class Info extends SvelteComponent$f { constructor(options) { super(); init$f(this, options, null, create_fragment$f, safe_not_equal$f, {}); } } /* home/runner/work/gradio/gradio/js/icons/src/Warning.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$e, append: append$b, attr: attr$b, detach: detach$d, init: init$e, insert: insert$d, noop: noop$6, safe_not_equal: safe_not_equal$e, svg_element: svg_element$1 } = window.__gradio__svelte__internal; function create_fragment$e(ctx) { let svg; let path; return { c() { svg = svg_element$1("svg"); path = svg_element$1("path"); attr$b(path, "stroke-linecap", "round"); attr$b(path, "stroke-linejoin", "round"); attr$b(path, "d", "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"); attr$b(svg, "fill", "none"); attr$b(svg, "stroke", "currentColor"); attr$b(svg, "stroke-width", "2"); attr$b(svg, "viewBox", "0 0 24 24"); attr$b(svg, "width", "100%"); attr$b(svg, "height", "100%"); attr$b(svg, "xmlns", "http://www.w3.org/2000/svg"); attr$b(svg, "aria-hidden", "true"); attr$b(svg, "stroke-linecap", "round"); attr$b(svg, "stroke-linejoin", "round"); }, m(target, anchor) { insert$d(target, svg, anchor); append$b(svg, path); }, p: noop$6, i: noop$6, o: noop$6, d(detaching) { if (detaching) { detach$d(svg); } } }; } class Warning extends SvelteComponent$e { constructor(options) { super(); init$e(this, options, null, create_fragment$e, safe_not_equal$e, {}); } } /* home/runner/work/gradio/gradio/js/statustracker/static/ToastContent.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$d, add_render_callback, append: append$a, attr: attr$a, bubble: bubble$3, check_outros: check_outros$7, create_component: create_component$b, create_in_transition, create_out_transition, destroy_component: destroy_component$b, detach: detach$c, element: element$9, group_outros: group_outros$7, init: init$d, insert: insert$c, listen: listen$4, mount_component: mount_component$b, run_all, safe_not_equal: safe_not_equal$d, set_data: set_data$7, space: space$8, stop_propagation, text: text$8, transition_in: transition_in$b, transition_out: transition_out$b } = window.__gradio__svelte__internal;const { createEventDispatcher: createEventDispatcher$5, onMount: onMount$3 } = window.__gradio__svelte__internal; function create_if_block_2$4(ctx) { let error; let current; error = new Error$1({}); return { c() { create_component$b(error.$$.fragment); }, m(target, anchor) { mount_component$b(error, target, anchor); current = true; }, i(local) { if (current) return; transition_in$b(error.$$.fragment, local); current = true; }, o(local) { transition_out$b(error.$$.fragment, local); current = false; }, d(detaching) { destroy_component$b(error, detaching); } }; } // (32:28) function create_if_block_1$5(ctx) { let info; let current; info = new Info({}); return { c() { create_component$b(info.$$.fragment); }, m(target, anchor) { mount_component$b(info, target, anchor); current = true; }, i(local) { if (current) return; transition_in$b(info.$$.fragment, local); current = true; }, o(local) { transition_out$b(info.$$.fragment, local); current = false; }, d(detaching) { destroy_component$b(info, detaching); } }; } // (30:2) {#if type === "warning"} function create_if_block$8(ctx) { let warning; let current; warning = new Warning({}); return { c() { create_component$b(warning.$$.fragment); }, m(target, anchor) { mount_component$b(warning, target, anchor); current = true; }, i(local) { if (current) return; transition_in$b(warning.$$.fragment, local); current = true; }, o(local) { transition_out$b(warning.$$.fragment, local); current = false; }, d(detaching) { destroy_component$b(warning, detaching); } }; } function create_fragment$d(ctx) { let div5; let div0; let current_block_type_index; let if_block; let div0_class_value; let t0; let div3; let div1; let t1; let div1_class_value; let t2; let div2; let t3; let div2_class_value; let div3_class_value; let t4; let button; let span; let button_class_value; let t6; let div4; let div4_class_value; let div5_class_value; let div5_intro; let div5_outro; let current; let mounted; let dispose; const if_block_creators = [create_if_block$8, create_if_block_1$5, create_if_block_2$4]; const if_blocks = []; function select_block_type(ctx, dirty) { if (/*type*/ ctx[1] === "warning") return 0; if (/*type*/ ctx[1] === "info") return 1; if (/*type*/ ctx[1] === "error") return 2; return -1; } if (~(current_block_type_index = select_block_type(ctx))) { if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); } return { c() { div5 = element$9("div"); div0 = element$9("div"); if (if_block) if_block.c(); t0 = space$8(); div3 = element$9("div"); div1 = element$9("div"); t1 = text$8(/*type*/ ctx[1]); t2 = space$8(); div2 = element$9("div"); t3 = text$8(/*message*/ ctx[0]); t4 = space$8(); button = element$9("button"); span = element$9("span"); span.textContent = "×"; t6 = space$8(); div4 = element$9("div"); attr$a(div0, "class", div0_class_value = "toast-icon " + /*type*/ ctx[1] + " svelte-z3l7qj"); attr$a(div1, "class", div1_class_value = "toast-title " + /*type*/ ctx[1] + " svelte-z3l7qj"); attr$a(div2, "class", div2_class_value = "toast-text " + /*type*/ ctx[1] + " svelte-z3l7qj"); attr$a(div3, "class", div3_class_value = "toast-details " + /*type*/ ctx[1] + " svelte-z3l7qj"); attr$a(span, "aria-hidden", "true"); attr$a(button, "class", button_class_value = "toast-close " + /*type*/ ctx[1] + " svelte-z3l7qj"); attr$a(button, "type", "button"); attr$a(button, "aria-label", "Close"); attr$a(button, "data-testid", "toast-close"); attr$a(div4, "class", div4_class_value = "timer " + /*type*/ ctx[1] + " svelte-z3l7qj"); attr$a(div5, "class", div5_class_value = "toast-body " + /*type*/ ctx[1] + " svelte-z3l7qj"); attr$a(div5, "role", "alert"); attr$a(div5, "data-testid", "toast-body"); }, m(target, anchor) { insert$c(target, div5, anchor); append$a(div5, div0); if (~current_block_type_index) { if_blocks[current_block_type_index].m(div0, null); } append$a(div5, t0); append$a(div5, div3); append$a(div3, div1); append$a(div1, t1); append$a(div3, t2); append$a(div3, div2); append$a(div2, t3); append$a(div5, t4); append$a(div5, button); append$a(button, span); append$a(div5, t6); append$a(div5, div4); current = true; if (!mounted) { dispose = [ listen$4(button, "click", /*close_message*/ ctx[2]), listen$4(div5, "click", stop_propagation(/*click_handler*/ ctx[4])), listen$4(div5, "keydown", stop_propagation(/*keydown_handler*/ ctx[5])) ]; mounted = true; } }, p(ctx, [dirty]) { let previous_block_index = current_block_type_index; current_block_type_index = select_block_type(ctx); if (current_block_type_index !== previous_block_index) { if (if_block) { group_outros$7(); transition_out$b(if_blocks[previous_block_index], 1, 1, () => { if_blocks[previous_block_index] = null; }); check_outros$7(); } if (~current_block_type_index) { if_block = if_blocks[current_block_type_index]; if (!if_block) { if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); if_block.c(); } transition_in$b(if_block, 1); if_block.m(div0, null); } else { if_block = null; } } if (!current || dirty & /*type*/ 2 && div0_class_value !== (div0_class_value = "toast-icon " + /*type*/ ctx[1] + " svelte-z3l7qj")) { attr$a(div0, "class", div0_class_value); } if (!current || dirty & /*type*/ 2) set_data$7(t1, /*type*/ ctx[1]); if (!current || dirty & /*type*/ 2 && div1_class_value !== (div1_class_value = "toast-title " + /*type*/ ctx[1] + " svelte-z3l7qj")) { attr$a(div1, "class", div1_class_value); } if (!current || dirty & /*message*/ 1) set_data$7(t3, /*message*/ ctx[0]); if (!current || dirty & /*type*/ 2 && div2_class_value !== (div2_class_value = "toast-text " + /*type*/ ctx[1] + " svelte-z3l7qj")) { attr$a(div2, "class", div2_class_value); } if (!current || dirty & /*type*/ 2 && div3_class_value !== (div3_class_value = "toast-details " + /*type*/ ctx[1] + " svelte-z3l7qj")) { attr$a(div3, "class", div3_class_value); } if (!current || dirty & /*type*/ 2 && button_class_value !== (button_class_value = "toast-close " + /*type*/ ctx[1] + " svelte-z3l7qj")) { attr$a(button, "class", button_class_value); } if (!current || dirty & /*type*/ 2 && div4_class_value !== (div4_class_value = "timer " + /*type*/ ctx[1] + " svelte-z3l7qj")) { attr$a(div4, "class", div4_class_value); } if (!current || dirty & /*type*/ 2 && div5_class_value !== (div5_class_value = "toast-body " + /*type*/ ctx[1] + " svelte-z3l7qj")) { attr$a(div5, "class", div5_class_value); } }, i(local) { if (current) return; transition_in$b(if_block); if (local) { add_render_callback(() => { if (!current) return; if (div5_outro) div5_outro.end(1); div5_intro = create_in_transition(div5, fade, { duration: 200, delay: 100 }); div5_intro.start(); }); } current = true; }, o(local) { transition_out$b(if_block); if (div5_intro) div5_intro.invalidate(); if (local) { div5_outro = create_out_transition(div5, fade, { duration: 200 }); } current = false; }, d(detaching) { if (detaching) { detach$c(div5); } if (~current_block_type_index) { if_blocks[current_block_type_index].d(); } if (detaching && div5_outro) div5_outro.end(); mounted = false; run_all(dispose); } }; } function instance$c($$self, $$props, $$invalidate) { let { message = "" } = $$props; let { type } = $$props; let { id } = $$props; const dispatch = createEventDispatcher$5(); function close_message() { dispatch("close", id); } onMount$3(() => { setTimeout( () => { close_message(); }, 10000 ); }); function click_handler(event) { bubble$3.call(this, $$self, event); } function keydown_handler(event) { bubble$3.call(this, $$self, event); } $$self.$$set = $$props => { if ('message' in $$props) $$invalidate(0, message = $$props.message); if ('type' in $$props) $$invalidate(1, type = $$props.type); if ('id' in $$props) $$invalidate(3, id = $$props.id); }; return [message, type, close_message, id, click_handler, keydown_handler]; } class ToastContent extends SvelteComponent$d { constructor(options) { super(); init$d(this, options, instance$c, create_fragment$d, safe_not_equal$d, { message: 0, type: 1, id: 3 }); } } /* home/runner/work/gradio/gradio/js/statustracker/static/Toast.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$c, append: append$9, attr: attr$9, bubble: bubble$2, check_outros: check_outros$6, create_animation, create_component: create_component$a, destroy_component: destroy_component$a, detach: detach$b, element: element$8, ensure_array_like: ensure_array_like$4, fix_and_outro_and_destroy_block, fix_position, group_outros: group_outros$6, init: init$c, insert: insert$b, mount_component: mount_component$a, noop: noop$5, safe_not_equal: safe_not_equal$c, set_style: set_style$2, space: space$7, transition_in: transition_in$a, transition_out: transition_out$a, update_keyed_each: update_keyed_each$1 } = window.__gradio__svelte__internal; function get_each_context$4(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[2] = list[i].type; child_ctx[3] = list[i].message; child_ctx[4] = list[i].id; return child_ctx; } // (15:1) {#each messages as { type, message, id } function create_each_block$4(key_1, ctx) { let div; let toastcontent; let t; let rect; let stop_animation = noop$5; let current; toastcontent = new ToastContent({ props: { type: /*type*/ ctx[2], message: /*message*/ ctx[3], id: /*id*/ ctx[4] } }); toastcontent.$on("close", /*close_handler*/ ctx[1]); return { key: key_1, first: null, c() { div = element$8("div"); create_component$a(toastcontent.$$.fragment); t = space$7(); set_style$2(div, "width", `100%`); this.first = div; }, m(target, anchor) { insert$b(target, div, anchor); mount_component$a(toastcontent, div, null); append$9(div, t); current = true; }, p(new_ctx, dirty) { ctx = new_ctx; const toastcontent_changes = {}; if (dirty & /*messages*/ 1) toastcontent_changes.type = /*type*/ ctx[2]; if (dirty & /*messages*/ 1) toastcontent_changes.message = /*message*/ ctx[3]; if (dirty & /*messages*/ 1) toastcontent_changes.id = /*id*/ ctx[4]; toastcontent.$set(toastcontent_changes); }, r() { rect = div.getBoundingClientRect(); }, f() { fix_position(div); stop_animation(); }, a() { stop_animation(); stop_animation = create_animation(div, rect, flip, { duration: 300 }); }, i(local) { if (current) return; transition_in$a(toastcontent.$$.fragment, local); current = true; }, o(local) { transition_out$a(toastcontent.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$b(div); } destroy_component$a(toastcontent); } }; } function create_fragment$c(ctx) { let div; let each_blocks = []; let each_1_lookup = new Map(); let current; let each_value = ensure_array_like$4(/*messages*/ ctx[0]); const get_key = ctx => /*id*/ ctx[4]; for (let i = 0; i < each_value.length; i += 1) { let child_ctx = get_each_context$4(ctx, each_value, i); let key = get_key(child_ctx); each_1_lookup.set(key, each_blocks[i] = create_each_block$4(key, child_ctx)); } return { c() { div = element$8("div"); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } attr$9(div, "class", "toast-wrap svelte-pu0yf1"); }, m(target, anchor) { insert$b(target, div, anchor); for (let i = 0; i < each_blocks.length; i += 1) { if (each_blocks[i]) { each_blocks[i].m(div, null); } } current = true; }, p(ctx, [dirty]) { if (dirty & /*messages*/ 1) { each_value = ensure_array_like$4(/*messages*/ ctx[0]); group_outros$6(); for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].r(); each_blocks = update_keyed_each$1(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div, fix_and_outro_and_destroy_block, create_each_block$4, null, get_each_context$4); for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].a(); check_outros$6(); } }, i(local) { if (current) return; for (let i = 0; i < each_value.length; i += 1) { transition_in$a(each_blocks[i]); } current = true; }, o(local) { for (let i = 0; i < each_blocks.length; i += 1) { transition_out$a(each_blocks[i]); } current = false; }, d(detaching) { if (detaching) { detach$b(div); } for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].d(); } } }; } function scroll_to_top(_messages) { if (_messages.length > 0) { if ("parentIFrame" in window) { window.parentIFrame?.scrollTo(0, 0); } } } function instance$b($$self, $$props, $$invalidate) { let { messages = [] } = $$props; function close_handler(event) { bubble$2.call(this, $$self, event); } $$self.$$set = $$props => { if ('messages' in $$props) $$invalidate(0, messages = $$props.messages); }; $$self.$$.update = () => { if ($$self.$$.dirty & /*messages*/ 1) { scroll_to_top(messages); } }; return [messages, close_handler]; } class Toast extends SvelteComponent$c { constructor(options) { super(); init$c(this, options, instance$b, create_fragment$c, safe_not_equal$c, { messages: 0 }); } } const component_map = { "accordion": { component: () => __vitePreload(() => import('./Index-04111dcd.js'),true?["./Index-04111dcd.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./Index-24a33ce1.js","./Index-2abed479.css","./Index-a90cda25.css"]:void 0,import.meta.url) }, "annotatedimage": { component: () => __vitePreload(() => import('./Index-35a244af.js'),true?["./Index-35a244af.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./BlockLabel-f22cfddb.js","./Empty-fef21b7d.js","./Image-6cbf81d1.js","./Index-1454732f.css"]:void 0,import.meta.url) }, "audio": { example: () => __vitePreload(() => import('./Example-01f23d62.js'),true?["./Example-01f23d62.js","./Example-55d94c71.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./index-8fb7a44f.js'),true?["./index-8fb7a44f.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./utils-8f25e669.js","./BlockLabel-f22cfddb.js","./IconButton-1ba1e4af.js","./Empty-fef21b7d.js","./ShareButton-92b4d41a.js","./Download-ea83bae3.js","./Trim-7bd312df.js","./Undo-6c110254.js","./file-url-a54881a3.js","./DownloadLink-6272d37b.js","./Upload-ed8e3e33.js","./ModifyUpload-968871a9.css","./ModifyUpload-ddd7e65e.js","./Clear-9760deed.js","./SelectSource-6a0ec811.js","./Upload-c5c1b405.js","./UploadText-2e352a35.js","./Example-01f23d62.js","./Example-55d94c71.css","./index-ffdd75d0.css"]:void 0,import.meta.url) }, "box": { component: () => __vitePreload(() => import('./Index-202575aa.js'),true?["./Index-202575aa.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css"]:void 0,import.meta.url) }, "button": { component: () => __vitePreload(() => import('./Index-23840dd4.js'),true?["./Index-23840dd4.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css"]:void 0,import.meta.url) }, "chatbot": { component: () => __vitePreload(() => import('./Index-97cd67af.js'),true?["./Index-97cd67af.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./utils-8f25e669.js","./index-21d69e4c.js","./ShareButton-92b4d41a.js","./IconButton-1ba1e4af.js","./Index.svelte_svelte_type_style_lang-4dd408ad.js","./Example.svelte_svelte_type_style_lang-3f7f456e.js","./Example-579c64d0.css","./Index-11e1685d.css","./Check-f7edb5d9.js","./Copy-a69620a8.js","./BlockLabel-f22cfddb.js","./Index-c436aa63.css"]:void 0,import.meta.url) }, "checkbox": { example: () => __vitePreload(() => import('./Example-c3dd8bb4.js'),true?["./Example-c3dd8bb4.js","./Example-55d94c71.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-99473d34.js'),true?["./Index-99473d34.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./Info-b271c224.js","./Index-6224b77c.css"]:void 0,import.meta.url) }, "checkboxgroup": { example: () => __vitePreload(() => import('./Example-5a888e08.js'),true?["./Example-5a888e08.js","./Example-55d94c71.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-d42ffc8f.js'),true?["./Index-d42ffc8f.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./BlockTitle-05ec971b.js","./Info-b271c224.js","./Index-5676d3d3.css"]:void 0,import.meta.url) }, "code": { example: () => __vitePreload(() => import('./Example-ef3222e9.js'),true?["./Example-ef3222e9.js","./Example-c56e7331.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-2edbbd25.js').then(n => n.F),true?["./Index-2edbbd25.js","./index-9dc32a9d.js","./index-078de39b.css","./Button-ab11cb83.js","./Index-a77cc637.js","./Index-99651b20.css","./Button-2a9911a9.css","./Check-f7edb5d9.js","./Copy-a69620a8.js","./Download-ea83bae3.js","./DownloadLink-6272d37b.js","./file-url-a54881a3.js","./BlockLabel-f22cfddb.js","./Empty-fef21b7d.js","./Example-ef3222e9.js","./Example-c56e7331.css","./Index-9369397e.css"]:void 0,import.meta.url) }, "colorpicker": { example: () => __vitePreload(() => import('./Example-510d9c7e.js'),true?["./Example-510d9c7e.js","./Example-5be72496.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-b24dcaa2.js'),true?["./Index-b24dcaa2.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./BlockTitle-05ec971b.js","./Info-b271c224.js","./Example-510d9c7e.js","./Example-5be72496.css","./Index-497c6364.css"]:void 0,import.meta.url) }, "column": { component: () => __vitePreload(() => import('./Index-24a33ce1.js'),true?["./Index-24a33ce1.js","./Index-2abed479.css"]:void 0,import.meta.url) }, "dataframe": { example: () => __vitePreload(() => import('./Example-7d6bb9b6.js'),true?["./Example-7d6bb9b6.js","./dsv-a37bb3db.js","./Example-aca1592e.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-1212d8a6.js'),true?["./Index-1212d8a6.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./index-21d69e4c.js","./utils-8f25e669.js","./Upload-ed8e3e33.js","./ModifyUpload-968871a9.css","./Index.svelte_svelte_type_style_lang-4dd408ad.js","./Example.svelte_svelte_type_style_lang-3f7f456e.js","./Example-579c64d0.css","./Index-11e1685d.css","./dsv-a37bb3db.js","./Example-7d6bb9b6.js","./Example-aca1592e.css","./Index-2584e216.css"]:void 0,import.meta.url) }, "dataset": { component: () => __vitePreload(() => import('./Index-6243c7b5.js'),true?["./Index-6243c7b5.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./Index-52db28fc.css"]:void 0,import.meta.url) }, "dropdown": { example: () => __vitePreload(() => import('./Example-7b848c75.js'),true?["./Example-7b848c75.js","./Example-55d94c71.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-f0c875f0.js'),true?["./Index-f0c875f0.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-ab11cb83.js","./Button-2a9911a9.css","./BlockTitle-05ec971b.js","./Info-b271c224.js","./DropdownArrow-19dd6e93.js","./Example-7b848c75.js","./Example-55d94c71.css","./Index-4cf39c3f.css"]:void 0,import.meta.url) }, "file": { example: () => __vitePreload(() => import('./Example-d9b38e6f.js'),true?["./Example-d9b38e6f.js","./Example-4f56d95a.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-b4e0b627.js'),true?["./Index-b4e0b627.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./BlockLabel-f22cfddb.js","./Empty-fef21b7d.js","./File-e96cd7d6.js","./DownloadLink-6272d37b.js","./file-url-a54881a3.js","./Upload-ed8e3e33.js","./ModifyUpload-968871a9.css","./ModifyUpload-ddd7e65e.js","./IconButton-1ba1e4af.js","./Clear-9760deed.js","./Undo-6c110254.js","./UploadText-2e352a35.js","./Upload-c5c1b405.js","./Example-d9b38e6f.js","./Example-4f56d95a.css","./Index-e08bb775.css"]:void 0,import.meta.url) }, "fileexplorer": { example: () => __vitePreload(() => import('./Example-3e057617.js'),true?["./Example-3e057617.js","./Example-7cc47009.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-5a1410bd.js'),true?["./Index-5a1410bd.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./File-e96cd7d6.js","./Button-ab11cb83.js","./Button-2a9911a9.css","./BlockLabel-f22cfddb.js","./index-f38d9616.js","./Empty-fef21b7d.js","./Index-e18b14d2.css"]:void 0,import.meta.url) }, "form": { component: () => __vitePreload(() => import('./Index-0d7ad3de.js'),true?["./Index-0d7ad3de.js","./Index-7ab72019.css"]:void 0,import.meta.url) }, "gallery": { component: () => __vitePreload(() => import('./Index-5ee3e19d.js'),true?["./Index-5ee3e19d.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./BlockLabel-f22cfddb.js","./IconButton-1ba1e4af.js","./Empty-fef21b7d.js","./ShareButton-92b4d41a.js","./utils-8f25e669.js","./Download-ea83bae3.js","./Image-6cbf81d1.js","./ModifyUpload-ddd7e65e.js","./Clear-9760deed.js","./Undo-6c110254.js","./ModifyUpload-968871a9.css","./index-f38d9616.js","./Index-d81484b7.css"]:void 0,import.meta.url) }, "group": { component: () => __vitePreload(() => import('./Index-a3ffbeb0.js'),true?["./Index-a3ffbeb0.js","./Index-e45a2b11.css"]:void 0,import.meta.url) }, "highlightedtext": { component: () => __vitePreload(() => import('./Index-f334f8b8.js'),true?["./Index-f334f8b8.js","./color-24a3c670.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./BlockLabel-f22cfddb.js","./Empty-fef21b7d.js","./Index-a4c50cbd.css"]:void 0,import.meta.url) }, "html": { example: () => __vitePreload(() => import('./Example-39f519bd.js'),true?["./Example-39f519bd.js","./Example-eac655f5.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-975b1604.js'),true?["./Index-975b1604.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-ab11cb83.js","./Button-2a9911a9.css","./Index-5538a1d8.css"]:void 0,import.meta.url) }, "image": { example: () => __vitePreload(() => import('./Example-f0e90bb7.js'),true?["./Example-f0e90bb7.js","./Example.svelte_svelte_type_style_lang-655d8b16.js","./file-url-a54881a3.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Example-0ce19e52.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-a54c272b.js'),true?["./Index-a54c272b.js","./ImageUploader-6e670801.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./utils-8f25e669.js","./BlockLabel-f22cfddb.js","./IconButton-1ba1e4af.js","./Empty-fef21b7d.js","./ShareButton-92b4d41a.js","./Download-ea83bae3.js","./Image-6cbf81d1.js","./Example.svelte_svelte_type_style_lang-655d8b16.js","./file-url-a54881a3.js","./Example-0ce19e52.css","./DownloadLink-6272d37b.js","./SelectSource-6a0ec811.js","./Upload-c5c1b405.js","./DropdownArrow-19dd6e93.js","./Upload-ed8e3e33.js","./ModifyUpload-968871a9.css","./Clear-9760deed.js","./ImageUploader-29d3a2c4.css","./UploadText-2e352a35.js","./Example-f0e90bb7.js"]:void 0,import.meta.url) }, "imageeditor": { example: () => __vitePreload(() => import('./Example-88c066a7.js'),true?["./Example-88c066a7.js","./ImageUploader-6e670801.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./utils-8f25e669.js","./BlockLabel-f22cfddb.js","./IconButton-1ba1e4af.js","./Empty-fef21b7d.js","./ShareButton-92b4d41a.js","./Download-ea83bae3.js","./Image-6cbf81d1.js","./Example.svelte_svelte_type_style_lang-655d8b16.js","./file-url-a54881a3.js","./Example-0ce19e52.css","./DownloadLink-6272d37b.js","./SelectSource-6a0ec811.js","./Upload-c5c1b405.js","./DropdownArrow-19dd6e93.js","./Upload-ed8e3e33.js","./ModifyUpload-968871a9.css","./Clear-9760deed.js","./ImageUploader-29d3a2c4.css","./Example-2b10ae8c.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-223af506.js'),true?["./Index-223af506.js","./ImageUploader-6e670801.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./utils-8f25e669.js","./BlockLabel-f22cfddb.js","./IconButton-1ba1e4af.js","./Empty-fef21b7d.js","./ShareButton-92b4d41a.js","./Download-ea83bae3.js","./Image-6cbf81d1.js","./Example.svelte_svelte_type_style_lang-655d8b16.js","./file-url-a54881a3.js","./Example-0ce19e52.css","./DownloadLink-6272d37b.js","./SelectSource-6a0ec811.js","./Upload-c5c1b405.js","./DropdownArrow-19dd6e93.js","./Upload-ed8e3e33.js","./ModifyUpload-968871a9.css","./Clear-9760deed.js","./ImageUploader-29d3a2c4.css","./__vite-browser-external-cb19bde2.js","./Check-f7edb5d9.js","./Undo-6c110254.js","./Index-272d55a6.css"]:void 0,import.meta.url) }, "json": { component: () => __vitePreload(() => import('./Index-58dc7961.js'),true?["./Index-58dc7961.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./Check-f7edb5d9.js","./Copy-a69620a8.js","./Empty-fef21b7d.js","./BlockLabel-f22cfddb.js","./Index-8659c753.css"]:void 0,import.meta.url) }, "label": { component: () => __vitePreload(() => import('./Index-4bb63637.js'),true?["./Index-4bb63637.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-ab11cb83.js","./Button-2a9911a9.css","./BlockLabel-f22cfddb.js","./Empty-fef21b7d.js","./Index-d2e7a806.css"]:void 0,import.meta.url) }, "markdown": { example: () => __vitePreload(() => import('./Example-8a688c80.js'),true?["./Example-8a688c80.js","./Example.svelte_svelte_type_style_lang-3f7f456e.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Example-579c64d0.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-7051594b.js'),true?["./Index-7051594b.js","./Index.svelte_svelte_type_style_lang-4dd408ad.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./utils-8f25e669.js","./Example.svelte_svelte_type_style_lang-3f7f456e.js","./Example-579c64d0.css","./Index-11e1685d.css","./Example-8a688c80.js"]:void 0,import.meta.url) }, "model3d": { example: () => __vitePreload(() => import('./Example-b5441cb7.js'),true?["./Example-b5441cb7.js","./Example-55d94c71.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-9d1199c3.js'),true?["./Index-9d1199c3.js","./index-9dc32a9d.js","./index-078de39b.css","./Button-ab11cb83.js","./Index-a77cc637.js","./Index-99651b20.css","./Button-2a9911a9.css","./BlockLabel-f22cfddb.js","./IconButton-1ba1e4af.js","./Download-ea83bae3.js","./File-e96cd7d6.js","./Undo-6c110254.js","./Upload-ed8e3e33.js","./ModifyUpload-968871a9.css","./ModifyUpload-ddd7e65e.js","./Clear-9760deed.js","./Empty-fef21b7d.js","./UploadText-2e352a35.js","./Upload-c5c1b405.js","./Example-b5441cb7.js","./Example-55d94c71.css","./Index-6795bfc7.css"]:void 0,import.meta.url) }, "number": { example: () => __vitePreload(() => import('./Example-8d59e00b.js'),true?["./Example-8d59e00b.js","./Example-55d94c71.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-be325a61.js'),true?["./Index-be325a61.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./BlockTitle-05ec971b.js","./Info-b271c224.js","./Index-8bd4bdf3.css"]:void 0,import.meta.url) }, "plot": { component: () => __vitePreload(() => import('./Index-8767f96e.js'),true?["./Index-8767f96e.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-ab11cb83.js","./Button-2a9911a9.css","./color-24a3c670.js","./dsv-a37bb3db.js","./Empty-fef21b7d.js","./BlockLabel-f22cfddb.js","./Index-31740b2a.css"]:void 0,import.meta.url) }, "radio": { example: () => __vitePreload(() => import('./Example-0b753ad4.js'),true?["./Example-0b753ad4.js","./Example-55d94c71.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-ef219b2c.js'),true?["./Index-ef219b2c.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./BlockTitle-05ec971b.js","./Info-b271c224.js","./Example-0b753ad4.js","./Example-55d94c71.css","./Index-f43ff834.css"]:void 0,import.meta.url) }, "row": { component: () => __vitePreload(() => import('./Index-7cbc3ec9.js'),true?["./Index-7cbc3ec9.js","./Index-815f98ca.css"]:void 0,import.meta.url) }, "slider": { example: () => __vitePreload(() => import('./Example-94402048.js'),true?["./Example-94402048.js","./Example-55d94c71.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-b9ce960d.js'),true?["./Index-b9ce960d.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./BlockTitle-05ec971b.js","./Info-b271c224.js","./Index-61d7d897.css"]:void 0,import.meta.url) }, "state": { component: () => __vitePreload(() => import('./Index-b2efa79d.js'),true?[]:void 0,import.meta.url) }, "statustracker": { component: () => __vitePreload(() => import('./index-58cd1dfc.js'),true?["./index-58cd1dfc.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-ab11cb83.js","./Button-2a9911a9.css"]:void 0,import.meta.url) }, "tabitem": { component: () => __vitePreload(() => import('./Index-7072da38.js'),true?["./Index-7072da38.js","./Tabs-e68bab48.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Tabs-fd1bbe79.css","./Index-24a33ce1.js","./Index-2abed479.css","./Index-f5395e19.css"]:void 0,import.meta.url) }, "tabs": { component: () => __vitePreload(() => import('./Index-2c55158b.js'),true?["./Index-2c55158b.js","./Tabs-e68bab48.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Tabs-fd1bbe79.css"]:void 0,import.meta.url) }, "textbox": { example: () => __vitePreload(() => import('./Example-abcadb77.js'),true?["./Example-abcadb77.js","./Example-e8628e88.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./Index-607322b7.js'),true?["./Index-607322b7.js","./Textbox-8d1e9b1f.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./BlockTitle-05ec971b.js","./Info-b271c224.js","./Check-f7edb5d9.js","./Copy-a69620a8.js","./Textbox-4c6022f4.css","./Example-abcadb77.js","./Example-e8628e88.css"]:void 0,import.meta.url) }, "uploadbutton": { component: () => __vitePreload(() => import('./Index-46909d7b.js'),true?["./Index-46909d7b.js","./Button-ab11cb83.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Button-2a9911a9.css","./Index-dc08ef34.css"]:void 0,import.meta.url) }, "video": { example: () => __vitePreload(() => import('./Example-40880a3c.js').then(n => n.c),true?["./Example-40880a3c.js","./file-url-a54881a3.js","./Index-a77cc637.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-99651b20.css","./Example-3fb4e67a.css"]:void 0,import.meta.url), component: () => __vitePreload(() => import('./index-f9beb704.js'),true?["./index-f9beb704.js","./Upload-ed8e3e33.js","./index-9dc32a9d.js","./index-078de39b.css","./Index-a77cc637.js","./Index-99651b20.css","./ModifyUpload-968871a9.css","./ModifyUpload-ddd7e65e.js","./Button-ab11cb83.js","./Button-2a9911a9.css","./IconButton-1ba1e4af.js","./Clear-9760deed.js","./Undo-6c110254.js","./BlockLabel-f22cfddb.js","./SelectSource-6a0ec811.js","./Upload-c5c1b405.js","./ImageUploader-6e670801.js","./utils-8f25e669.js","./Empty-fef21b7d.js","./ShareButton-92b4d41a.js","./Download-ea83bae3.js","./Image-6cbf81d1.js","./Example.svelte_svelte_type_style_lang-655d8b16.js","./file-url-a54881a3.js","./Example-0ce19e52.css","./DownloadLink-6272d37b.js","./DropdownArrow-19dd6e93.js","./ImageUploader-29d3a2c4.css","./Example-40880a3c.js","./Example-3fb4e67a.css","./Trim-7bd312df.js","./UploadText-2e352a35.js","./index-bea7352a.css"]:void 0,import.meta.url) }, }; // @ts-nocheck async function load_component({ api_url, name, id, variant }) { const comps = window.__GRADIO__CC__; const _component_map = { // eslint-disable-next-line no-undef ...component_map, ...(!comps ? {} : comps) }; try { const c = await ( _component_map?.[id]?.[variant] || // for dev mode custom components _component_map?.[name]?.[variant] )(); return { name, component: c }; } catch (e) { console.error(e); try { await load_css(`${api_url}/custom_component/${id}/${variant}/style.css`); const c = await __vitePreload(() => import( /* @vite-ignore */ `${api_url}/custom_component/${id}/${variant}/index.js` ),true?[]:void 0,import.meta.url); return { name, component: c }; } catch (e) { if (variant === "example") { return { name, component: await __vitePreload(() => import('./Example-b742dabd.js'),true?["./Example-b742dabd.js","./Example-55d94c71.css"]:void 0,import.meta.url) }; } console.error(`failed to load: ${name}`); console.error(e); throw e; } } } function load_css(url) { return new Promise((resolve, reject) => { const link = document.createElement("link"); link.rel = "stylesheet"; link.href = url; document.head.appendChild(link); link.onload = () => resolve(); link.onerror = () => reject(); }); } function create_loading_status_store() { const store = writable({}); const fn_inputs = []; const fn_outputs = []; const pending_outputs = /* @__PURE__ */ new Map(); const pending_inputs = /* @__PURE__ */ new Map(); const inputs_to_update = /* @__PURE__ */ new Map(); const fn_status = []; function update({ fn_index, status, queue = true, size, position = null, eta = null, message = null, progress }) { const outputs = fn_outputs[fn_index]; const inputs = fn_inputs[fn_index]; const last_status = fn_status[fn_index]; const outputs_to_update = outputs.map((id) => { let new_status; const pending_count = pending_outputs.get(id) || 0; if (last_status === "pending" && status !== "pending") { let new_count = pending_count - 1; pending_outputs.set(id, new_count < 0 ? 0 : new_count); new_status = new_count > 0 ? "pending" : status; } else if (last_status === "pending" && status === "pending") { new_status = "pending"; } else if (last_status !== "pending" && status === "pending") { new_status = "pending"; pending_outputs.set(id, pending_count + 1); } else { new_status = status; } return { id, queue_position: position, queue_size: size, eta, status: new_status, message, progress }; }); inputs.forEach((id) => { const pending_count = pending_inputs.get(id) || 0; if (last_status === "pending" && status !== "pending") { let new_count = pending_count - 1; pending_inputs.set(id, new_count < 0 ? 0 : new_count); inputs_to_update.set(id, status); } else if (last_status !== "pending" && status === "pending") { pending_inputs.set(id, pending_count + 1); inputs_to_update.set(id, status); } else { inputs_to_update.delete(id); } }); store.update((outputs2) => { outputs_to_update.forEach( ({ id, queue_position, queue_size, eta: eta2, status: status2, message: message2, progress: progress2 }) => { outputs2[id] = { queue, queue_size, queue_position, eta: eta2, message: message2, progress: progress2, status: status2, fn_index }; } ); return outputs2; }); fn_status[fn_index] = status; } function register(index, inputs, outputs) { fn_inputs[index] = inputs; fn_outputs[index] = outputs; } return { update, register, subscribe: store.subscribe, get_status_for_fn(i) { return fn_status[i]; }, get_inputs_to_update() { return inputs_to_update; } }; } /* src/api_docs/img/clear.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$b, append: append$8, attr: attr$8, detach: detach$a, init: init$b, insert: insert$a, noop: noop$4, safe_not_equal: safe_not_equal$b, set_style: set_style$1, svg_element } = window.__gradio__svelte__internal; function create_fragment$b(ctx) { let svg; let g; let path0; let path1; return { c() { svg = svg_element("svg"); g = svg_element("g"); path0 = svg_element("path"); path1 = svg_element("path"); attr$8(path0, "d", "M3.789,0.09C3.903,-0.024 4.088,-0.024 4.202,0.09L4.817,0.705C4.931,0.819 4.931,1.004 4.817,1.118L1.118,4.817C1.004,4.931 0.819,4.931 0.705,4.817L0.09,4.202C-0.024,4.088 -0.024,3.903 0.09,3.789L3.789,0.09Z"); attr$8(path1, "d", "M4.825,3.797C4.934,3.907 4.934,4.084 4.825,4.193L4.193,4.825C4.084,4.934 3.907,4.934 3.797,4.825L0.082,1.11C-0.027,1.001 -0.027,0.823 0.082,0.714L0.714,0.082C0.823,-0.027 1.001,-0.027 1.11,0.082L4.825,3.797Z"); attr$8(svg, "width", "100%"); attr$8(svg, "height", "100%"); attr$8(svg, "viewBox", "0 0 5 5"); attr$8(svg, "version", "1.1"); attr$8(svg, "xmlns", "http://www.w3.org/2000/svg"); attr$8(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink"); attr$8(svg, "xml:space", "preserve"); set_style$1(svg, "fill", "currentColor"); set_style$1(svg, "fill-rule", "evenodd"); set_style$1(svg, "clip-rule", "evenodd"); set_style$1(svg, "stroke-linejoin", "round"); set_style$1(svg, "stroke-miterlimit", "2"); }, m(target, anchor) { insert$a(target, svg, anchor); append$8(svg, g); append$8(g, path0); append$8(g, path1); }, p: noop$4, i: noop$4, o: noop$4, d(detaching) { if (detaching) { detach$a(svg); } } }; } class Clear extends SvelteComponent$b { constructor(options) { super(); init$b(this, options, null, create_fragment$b, safe_not_equal$b, {}); } } const NoApi_svelte_svelte_type_style_lang = ''; /* src/api_docs/NoApi.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$a, append: append$7, attr: attr$7, create_component: create_component$9, destroy_component: destroy_component$9, detach: detach$9, element: element$7, init: init$a, insert: insert$9, listen: listen$3, mount_component: mount_component$9, safe_not_equal: safe_not_equal$a, set_data: set_data$6, space: space$6, text: text$7, transition_in: transition_in$9, transition_out: transition_out$9 } = window.__gradio__svelte__internal; const { createEventDispatcher: createEventDispatcher$4 } = window.__gradio__svelte__internal; function create_fragment$a(ctx) { let div; let h1; let t1; let p0; let t2; let code0; let t3; let t4; let p1; let t15; let button; let clear; let current; let mounted; let dispose; clear = new Clear({}); return { c() { div = element$7("div"); h1 = element$7("h1"); h1.textContent = "API Docs"; t1 = space$6(); p0 = element$7("p"); t2 = text$7("No API Routes found for\n\t\t"); code0 = element$7("code"); t3 = text$7(/*root*/ ctx[0]); t4 = space$6(); p1 = element$7("p"); p1.innerHTML = `To expose an API endpoint of your app in this page, set the api_name parameter of the event listener.
For more information, visit the API Page guide . To hide the API documentation button and this page, set show_api=False in the Blocks.launch() method.`; t15 = space$6(); button = element$7("button"); create_component$9(clear.$$.fragment); attr$7(code0, "class", "svelte-e1ha0f"); attr$7(p0, "class", "attention svelte-e1ha0f"); attr$7(div, "class", "wrap prose svelte-e1ha0f"); attr$7(button, "class", "svelte-e1ha0f"); }, m(target, anchor) { insert$9(target, div, anchor); append$7(div, h1); append$7(div, t1); append$7(div, p0); append$7(p0, t2); append$7(p0, code0); append$7(code0, t3); append$7(div, t4); append$7(div, p1); insert$9(target, t15, anchor); insert$9(target, button, anchor); mount_component$9(clear, button, null); current = true; if (!mounted) { dispose = listen$3(button, "click", /*click_handler*/ ctx[2]); mounted = true; } }, p(ctx, [dirty]) { if (!current || dirty & /*root*/ 1) set_data$6(t3, /*root*/ ctx[0]); }, i(local) { if (current) return; transition_in$9(clear.$$.fragment, local); current = true; }, o(local) { transition_out$9(clear.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$9(div); detach$9(t15); detach$9(button); } destroy_component$9(clear); mounted = false; dispose(); } }; } function instance$a($$self, $$props, $$invalidate) { const dispatch = createEventDispatcher$4(); let { root } = $$props; const click_handler = () => dispatch("close"); $$self.$$set = $$props => { if ('root' in $$props) $$invalidate(0, root = $$props.root); }; return [root, dispatch, click_handler]; } class NoApi extends SvelteComponent$a { constructor(options) { super(); init$a(this, options, instance$a, create_fragment$a, safe_not_equal$a, { root: 0 }); } } function represent_value(value, type, lang = null) { if (type === void 0) { return lang === "py" ? "None" : null; } if (type === "string" || type === "str" || type == "filepath") { return lang === null ? value : '"' + value + '"'; } else if (type === "number") { return lang === null ? parseFloat(value) : value; } else if (type === "boolean" || type == "bool") { if (lang === "py") { value = String(value); return value === "true" ? "True" : "False"; } else if (lang === "js") { return value; } return value === "true"; } else if (type === "List[str]") { value = JSON.stringify(value); return value; } else if (type.startsWith("Literal['")) { return '"' + value + '"'; } if (lang === null) { return value === "" ? null : JSON.parse(value); } else if (typeof value === "string") { if (value === "") { return lang === "py" ? "None" : "null"; } return value; } return JSON.stringify(value); } const api_logo = ""+new URL('api-logo-5346f193.svg', import.meta.url).href+""; const ApiBanner_svelte_svelte_type_style_lang = ''; /* src/api_docs/ApiBanner.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$9, append: append$6, attr: attr$6, create_component: create_component$8, destroy_component: destroy_component$8, detach: detach$8, element: element$6, init: init$9, insert: insert$8, listen: listen$2, mount_component: mount_component$8, safe_not_equal: safe_not_equal$9, set_data: set_data$5, space: space$5, src_url_equal: src_url_equal$2, text: text$6, transition_in: transition_in$8, transition_out: transition_out$8 } = window.__gradio__svelte__internal; const { createEventDispatcher: createEventDispatcher$3 } = window.__gradio__svelte__internal; function create_if_block$7(ctx) { let t; return { c() { t = text$6("s"); }, m(target, anchor) { insert$8(target, t, anchor); }, d(detaching) { if (detaching) { detach$8(t); } } }; } function create_fragment$9(ctx) { let h2; let img; let img_src_value; let t0; let div1; let t1; let div0; let t2; let t3; let span1; let span0; let t4; let t5; let t6; let button; let clear; let current; let mounted; let dispose; let if_block = /*api_count*/ ctx[1] > 1 && create_if_block$7(); clear = new Clear({}); return { c() { h2 = element$6("h2"); img = element$6("img"); t0 = space$5(); div1 = element$6("div"); t1 = text$6("API documentation\n\t\t"); div0 = element$6("div"); t2 = text$6(/*root*/ ctx[0]); t3 = space$5(); span1 = element$6("span"); span0 = element$6("span"); t4 = text$6(/*api_count*/ ctx[1]); t5 = text$6(" API endpoint"); if (if_block) if_block.c(); t6 = space$5(); button = element$6("button"); create_component$8(clear.$$.fragment); if (!src_url_equal$2(img.src, img_src_value = api_logo)) attr$6(img, "src", img_src_value); attr$6(img, "alt", ""); attr$6(img, "class", "svelte-3n2nxs"); attr$6(div0, "class", "url svelte-3n2nxs"); attr$6(span0, "class", "url svelte-3n2nxs"); attr$6(span1, "class", "counts svelte-3n2nxs"); attr$6(h2, "class", "svelte-3n2nxs"); attr$6(button, "class", "svelte-3n2nxs"); }, m(target, anchor) { insert$8(target, h2, anchor); append$6(h2, img); append$6(h2, t0); append$6(h2, div1); append$6(div1, t1); append$6(div1, div0); append$6(div0, t2); append$6(h2, t3); append$6(h2, span1); append$6(span1, span0); append$6(span0, t4); append$6(span1, t5); if (if_block) if_block.m(span1, null); insert$8(target, t6, anchor); insert$8(target, button, anchor); mount_component$8(clear, button, null); current = true; if (!mounted) { dispose = listen$2(button, "click", /*click_handler*/ ctx[3]); mounted = true; } }, p(ctx, [dirty]) { if (!current || dirty & /*root*/ 1) set_data$5(t2, /*root*/ ctx[0]); if (!current || dirty & /*api_count*/ 2) set_data$5(t4, /*api_count*/ ctx[1]); if (/*api_count*/ ctx[1] > 1) { if (if_block) ; else { if_block = create_if_block$7(); if_block.c(); if_block.m(span1, null); } } else if (if_block) { if_block.d(1); if_block = null; } }, i(local) { if (current) return; transition_in$8(clear.$$.fragment, local); current = true; }, o(local) { transition_out$8(clear.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$8(h2); detach$8(t6); detach$8(button); } if (if_block) if_block.d(); destroy_component$8(clear); mounted = false; dispose(); } }; } function instance$9($$self, $$props, $$invalidate) { let { root } = $$props; let { api_count } = $$props; const dispatch = createEventDispatcher$3(); const click_handler = () => dispatch("close"); $$self.$$set = $$props => { if ('root' in $$props) $$invalidate(0, root = $$props.root); if ('api_count' in $$props) $$invalidate(1, api_count = $$props.api_count); }; return [root, api_count, dispatch, click_handler]; } class ApiBanner extends SvelteComponent$9 { constructor(options) { super(); init$9(this, options, instance$9, create_fragment$9, safe_not_equal$9, { root: 0, api_count: 1 }); } } const ResponseObject_svelte_svelte_type_style_lang = ''; /* src/api_docs/ResponseObject.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$8, append: append$5, attr: attr$5, check_outros: check_outros$5, create_component: create_component$7, destroy_component: destroy_component$7, destroy_each: destroy_each$2, detach: detach$7, element: element$5, empty: empty$5, ensure_array_like: ensure_array_like$3, group_outros: group_outros$5, init: init$8, insert: insert$7, mount_component: mount_component$7, safe_not_equal: safe_not_equal$8, set_data: set_data$4, space: space$4, text: text$5, toggle_class, transition_in: transition_in$7, transition_out: transition_out$7 } = window.__gradio__svelte__internal; function get_each_context$3(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[4] = list[i].label; child_ctx[5] = list[i].type; child_ctx[6] = list[i].python_type; child_ctx[7] = list[i].component; child_ctx[8] = list[i].serializer; child_ctx[10] = i; return child_ctx; } // (18:3) {#if endpoint_returns.length > 1} function create_if_block_6$2(ctx) { let t; return { c() { t = text$5("("); }, m(target, anchor) { insert$7(target, t, anchor); }, d(detaching) { if (detaching) { detach$7(t); } } }; } // (23:132) {:else} function create_else_block$3(ctx) { let t_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].type + ""; let t; let if_block_anchor; let if_block = /*js_returns*/ ctx[2][/*i*/ ctx[10]].description && create_if_block_5$2(ctx); return { c() { t = text$5(t_value); if (if_block) if_block.c(); if_block_anchor = empty$5(); }, m(target, anchor) { insert$7(target, t, anchor); if (if_block) if_block.m(target, anchor); insert$7(target, if_block_anchor, anchor); }, p(ctx, dirty) { if (dirty & /*js_returns*/ 4 && t_value !== (t_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].type + "")) set_data$4(t, t_value); if (/*js_returns*/ ctx[2][/*i*/ ctx[10]].description) { if (if_block) { if_block.p(ctx, dirty); } else { if_block = create_if_block_5$2(ctx); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } } else if (if_block) { if_block.d(1); if_block = null; } }, d(detaching) { if (detaching) { detach$7(t); detach$7(if_block_anchor); } if (if_block) if_block.d(detaching); } }; } // (23:11) {#if current_language === "python"} function create_if_block_3$3(ctx) { let t_value = /*python_type*/ ctx[6].type + ""; let t; let if_block_anchor; let if_block = /*python_type*/ ctx[6]?.description && create_if_block_4$2(ctx); return { c() { t = text$5(t_value); if (if_block) if_block.c(); if_block_anchor = empty$5(); }, m(target, anchor) { insert$7(target, t, anchor); if (if_block) if_block.m(target, anchor); insert$7(target, if_block_anchor, anchor); }, p(ctx, dirty) { if (dirty & /*endpoint_returns*/ 2 && t_value !== (t_value = /*python_type*/ ctx[6].type + "")) set_data$4(t, t_value); if (/*python_type*/ ctx[6]?.description) { if (if_block) { if_block.p(ctx, dirty); } else { if_block = create_if_block_4$2(ctx); if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } } else if (if_block) { if_block.d(1); if_block = null; } }, d(detaching) { if (detaching) { detach$7(t); detach$7(if_block_anchor); } if (if_block) if_block.d(detaching); } }; } // (25:14) {#if js_returns[i].description} function create_if_block_5$2(ctx) { let t0; let t1_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].description + ""; let t1; let t2; return { c() { t0 = text$5(" ("); t1 = text$5(t1_value); t2 = text$5(")"); }, m(target, anchor) { insert$7(target, t0, anchor); insert$7(target, t1, anchor); insert$7(target, t2, anchor); }, p(ctx, dirty) { if (dirty & /*js_returns*/ 4 && t1_value !== (t1_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].description + "")) set_data$4(t1, t1_value); }, d(detaching) { if (detaching) { detach$7(t0); detach$7(t1); detach$7(t2); } } }; } // (23:64) {#if python_type?.description} function create_if_block_4$2(ctx) { let t0; let t1_value = /*python_type*/ ctx[6].description + ""; let t1; let t2; return { c() { t0 = text$5(" ("); t1 = text$5(t1_value); t2 = text$5(")"); }, m(target, anchor) { insert$7(target, t0, anchor); insert$7(target, t1, anchor); insert$7(target, t2, anchor); }, p(ctx, dirty) { if (dirty & /*endpoint_returns*/ 2 && t1_value !== (t1_value = /*python_type*/ ctx[6].description + "")) set_data$4(t1, t1_value); }, d(detaching) { if (detaching) { detach$7(t0); detach$7(t1); detach$7(t2); } } }; } // (32:6) {#if endpoint_returns.length > 1} function create_if_block_2$3(ctx) { let t; return { c() { t = text$5(","); }, m(target, anchor) { insert$7(target, t, anchor); }, d(detaching) { if (detaching) { detach$7(t); } } }; } // (19:3) {#each endpoint_returns as { label, type, python_type, component, serializer } function create_each_block$3(ctx) { let div; let span; let t0; let t1; let t2_value = /*label*/ ctx[4] + ""; let t2; let t3; let t4_value = /*component*/ ctx[7] + ""; let t4; let t5; function select_block_type(ctx, dirty) { if (/*current_language*/ ctx[3] === "python") return create_if_block_3$3; return create_else_block$3; } let current_block_type = select_block_type(ctx); let if_block0 = current_block_type(ctx); let if_block1 = /*endpoint_returns*/ ctx[1].length > 1 && create_if_block_2$3(); return { c() { div = element$5("div"); span = element$5("span"); t0 = text$5("# "); if_block0.c(); t1 = text$5("\n\t\t\t\t\t\trepresenting output in '"); t2 = text$5(t2_value); t3 = text$5("' "); t4 = text$5(t4_value); t5 = text$5("\n\t\t\t\t\t\tcomponent"); if (if_block1) if_block1.c(); attr$5(span, "class", "desc svelte-1c7hj3i"); attr$5(div, "class", "svelte-1c7hj3i"); toggle_class(div, "second-level", /*endpoint_returns*/ ctx[1].length > 1); }, m(target, anchor) { insert$7(target, div, anchor); append$5(div, span); append$5(span, t0); if_block0.m(span, null); append$5(span, t1); append$5(span, t2); append$5(span, t3); append$5(span, t4); append$5(span, t5); if (if_block1) if_block1.m(div, null); }, p(ctx, dirty) { if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block0) { if_block0.p(ctx, dirty); } else { if_block0.d(1); if_block0 = current_block_type(ctx); if (if_block0) { if_block0.c(); if_block0.m(span, t1); } } if (dirty & /*endpoint_returns*/ 2 && t2_value !== (t2_value = /*label*/ ctx[4] + "")) set_data$4(t2, t2_value); if (dirty & /*endpoint_returns*/ 2 && t4_value !== (t4_value = /*component*/ ctx[7] + "")) set_data$4(t4, t4_value); if (/*endpoint_returns*/ ctx[1].length > 1) { if (if_block1) ; else { if_block1 = create_if_block_2$3(); if_block1.c(); if_block1.m(div, null); } } else if (if_block1) { if_block1.d(1); if_block1 = null; } if (dirty & /*endpoint_returns*/ 2) { toggle_class(div, "second-level", /*endpoint_returns*/ ctx[1].length > 1); } }, d(detaching) { if (detaching) { detach$7(div); } if_block0.d(); if (if_block1) if_block1.d(); } }; } // (35:3) {#if endpoint_returns.length > 1} function create_if_block_1$4(ctx) { let t; return { c() { t = text$5(")"); }, m(target, anchor) { insert$7(target, t, anchor); }, d(detaching) { if (detaching) { detach$7(t); } } }; } // (37:2) {#if is_running} function create_if_block$6(ctx) { let div; let loader; let current; loader = new Loader({ props: { margin: false } }); return { c() { div = element$5("div"); create_component$7(loader.$$.fragment); attr$5(div, "class", "load-wrap svelte-1c7hj3i"); }, m(target, anchor) { insert$7(target, div, anchor); mount_component$7(loader, div, null); current = true; }, i(local) { if (current) return; transition_in$7(loader.$$.fragment, local); current = true; }, o(local) { transition_out$7(loader.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$7(div); } destroy_component$7(loader); } }; } // (15:0) function create_default_slot$4(ctx) { let div1; let div0; let t0; let t1; let t2; let current; let if_block0 = /*endpoint_returns*/ ctx[1].length > 1 && create_if_block_6$2(); let each_value = ensure_array_like$3(/*endpoint_returns*/ ctx[1]); let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { each_blocks[i] = create_each_block$3(get_each_context$3(ctx, each_value, i)); } let if_block1 = /*endpoint_returns*/ ctx[1].length > 1 && create_if_block_1$4(); let if_block2 = /*is_running*/ ctx[0] && create_if_block$6(); return { c() { div1 = element$5("div"); div0 = element$5("div"); if (if_block0) if_block0.c(); t0 = space$4(); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } t1 = space$4(); if (if_block1) if_block1.c(); t2 = space$4(); if (if_block2) if_block2.c(); attr$5(div0, "class", "svelte-1c7hj3i"); toggle_class(div0, "hide", /*is_running*/ ctx[0]); attr$5(div1, "class", "response-wrap svelte-1c7hj3i"); }, m(target, anchor) { insert$7(target, div1, anchor); append$5(div1, div0); if (if_block0) if_block0.m(div0, null); append$5(div0, t0); for (let i = 0; i < each_blocks.length; i += 1) { if (each_blocks[i]) { each_blocks[i].m(div0, null); } } append$5(div0, t1); if (if_block1) if_block1.m(div0, null); append$5(div1, t2); if (if_block2) if_block2.m(div1, null); current = true; }, p(ctx, dirty) { if (/*endpoint_returns*/ ctx[1].length > 1) { if (if_block0) ; else { if_block0 = create_if_block_6$2(); if_block0.c(); if_block0.m(div0, t0); } } else if (if_block0) { if_block0.d(1); if_block0 = null; } if (dirty & /*endpoint_returns, current_language, js_returns*/ 14) { each_value = ensure_array_like$3(/*endpoint_returns*/ ctx[1]); let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context$3(ctx, each_value, i); if (each_blocks[i]) { each_blocks[i].p(child_ctx, dirty); } else { each_blocks[i] = create_each_block$3(child_ctx); each_blocks[i].c(); each_blocks[i].m(div0, t1); } } for (; i < each_blocks.length; i += 1) { each_blocks[i].d(1); } each_blocks.length = each_value.length; } if (/*endpoint_returns*/ ctx[1].length > 1) { if (if_block1) ; else { if_block1 = create_if_block_1$4(); if_block1.c(); if_block1.m(div0, null); } } else if (if_block1) { if_block1.d(1); if_block1 = null; } if (!current || dirty & /*is_running*/ 1) { toggle_class(div0, "hide", /*is_running*/ ctx[0]); } if (/*is_running*/ ctx[0]) { if (if_block2) { if (dirty & /*is_running*/ 1) { transition_in$7(if_block2, 1); } } else { if_block2 = create_if_block$6(); if_block2.c(); transition_in$7(if_block2, 1); if_block2.m(div1, null); } } else if (if_block2) { group_outros$5(); transition_out$7(if_block2, 1, 1, () => { if_block2 = null; }); check_outros$5(); } }, i(local) { if (current) return; transition_in$7(if_block2); current = true; }, o(local) { transition_out$7(if_block2); current = false; }, d(detaching) { if (detaching) { detach$7(div1); } if (if_block0) if_block0.d(); destroy_each$2(each_blocks, detaching); if (if_block1) if_block1.d(); if (if_block2) if_block2.d(); } }; } function create_fragment$8(ctx) { let h4; let t1; let block; let current; block = new Block({ props: { $$slots: { default: [create_default_slot$4] }, $$scope: { ctx } } }); return { c() { h4 = element$5("h4"); h4.innerHTML = `
Return Type(s)`; t1 = space$4(); create_component$7(block.$$.fragment); attr$5(h4, "class", "svelte-1c7hj3i"); }, m(target, anchor) { insert$7(target, h4, anchor); insert$7(target, t1, anchor); mount_component$7(block, target, anchor); current = true; }, p(ctx, [dirty]) { const block_changes = {}; if (dirty & /*$$scope, is_running, endpoint_returns, current_language, js_returns*/ 2063) { block_changes.$$scope = { dirty, ctx }; } block.$set(block_changes); }, i(local) { if (current) return; transition_in$7(block.$$.fragment, local); current = true; }, o(local) { transition_out$7(block.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$7(h4); detach$7(t1); } destroy_component$7(block, detaching); } }; } function instance$8($$self, $$props, $$invalidate) { let { is_running } = $$props; let { endpoint_returns } = $$props; let { js_returns } = $$props; let { current_language } = $$props; $$self.$$set = $$props => { if ('is_running' in $$props) $$invalidate(0, is_running = $$props.is_running); if ('endpoint_returns' in $$props) $$invalidate(1, endpoint_returns = $$props.endpoint_returns); if ('js_returns' in $$props) $$invalidate(2, js_returns = $$props.js_returns); if ('current_language' in $$props) $$invalidate(3, current_language = $$props.current_language); }; return [is_running, endpoint_returns, js_returns, current_language]; } class ResponseObject extends SvelteComponent$8 { constructor(options) { super(); init$8(this, options, instance$8, create_fragment$8, safe_not_equal$8, { is_running: 0, endpoint_returns: 1, js_returns: 2, current_language: 3 }); } } /* src/api_docs/CopyButton.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$7, create_component: create_component$6, destroy_component: destroy_component$6, detach: detach$6, init: init$7, insert: insert$6, mount_component: mount_component$6, safe_not_equal: safe_not_equal$7, set_data: set_data$3, text: text$4, transition_in: transition_in$6, transition_out: transition_out$6 } = window.__gradio__svelte__internal; function create_default_slot$3(ctx) { let t; return { c() { t = text$4(/*copy_text*/ ctx[0]); }, m(target, anchor) { insert$6(target, t, anchor); }, p(ctx, dirty) { if (dirty & /*copy_text*/ 1) set_data$3(t, /*copy_text*/ ctx[0]); }, d(detaching) { if (detaching) { detach$6(t); } } }; } function create_fragment$7(ctx) { let basebutton; let current; basebutton = new Button({ props: { size: "sm", $$slots: { default: [create_default_slot$3] }, $$scope: { ctx } } }); basebutton.$on("click", /*copy*/ ctx[1]); return { c() { create_component$6(basebutton.$$.fragment); }, m(target, anchor) { mount_component$6(basebutton, target, anchor); current = true; }, p(ctx, [dirty]) { const basebutton_changes = {}; if (dirty & /*$$scope, copy_text*/ 9) { basebutton_changes.$$scope = { dirty, ctx }; } basebutton.$set(basebutton_changes); }, i(local) { if (current) return; transition_in$6(basebutton.$$.fragment, local); current = true; }, o(local) { transition_out$6(basebutton.$$.fragment, local); current = false; }, d(detaching) { destroy_component$6(basebutton, detaching); } }; } function instance$7($$self, $$props, $$invalidate) { let { code } = $$props; let copy_text = "copy"; function copy() { navigator.clipboard.writeText(code); $$invalidate(0, copy_text = "copied!"); setTimeout( () => { $$invalidate(0, copy_text = "copy"); }, 1500 ); } $$self.$$set = $$props => { if ('code' in $$props) $$invalidate(2, code = $$props.code); }; return [copy_text, copy, code]; } class CopyButton extends SvelteComponent$7 { constructor(options) { super(); init$7(this, options, instance$7, create_fragment$7, safe_not_equal$7, { code: 2 }); } } const InstallSnippet_svelte_svelte_type_style_lang = ''; /* src/api_docs/InstallSnippet.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$6, append: append$4, attr: attr$4, check_outros: check_outros$4, create_component: create_component$5, destroy_component: destroy_component$5, detach: detach$5, element: element$4, group_outros: group_outros$4, init: init$6, insert: insert$5, mount_component: mount_component$5, noop: noop$3, safe_not_equal: safe_not_equal$6, space: space$3, transition_in: transition_in$5, transition_out: transition_out$5 } = window.__gradio__svelte__internal; function create_if_block_1$3(ctx) { let div0; let copybutton; let t0; let div1; let pre; let current; copybutton = new CopyButton({ props: { code: js_install } }); return { c() { div0 = element$4("div"); create_component$5(copybutton.$$.fragment); t0 = space$3(); div1 = element$4("div"); pre = element$4("pre"); pre.textContent = `\$ ${js_install}`; attr$4(div0, "class", "copy svelte-hq8ezf"); attr$4(pre, "class", "svelte-hq8ezf"); }, m(target, anchor) { insert$5(target, div0, anchor); mount_component$5(copybutton, div0, null); insert$5(target, t0, anchor); insert$5(target, div1, anchor); append$4(div1, pre); current = true; }, p: noop$3, i(local) { if (current) return; transition_in$5(copybutton.$$.fragment, local); current = true; }, o(local) { transition_out$5(copybutton.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$5(div0); detach$5(t0); detach$5(div1); } destroy_component$5(copybutton); } }; } // (10:2) {#if current_language === "python"} function create_if_block$5(ctx) { let div0; let copybutton; let t0; let div1; let pre; let current; copybutton = new CopyButton({ props: { code: py_install } }); return { c() { div0 = element$4("div"); create_component$5(copybutton.$$.fragment); t0 = space$3(); div1 = element$4("div"); pre = element$4("pre"); pre.textContent = `\$ ${py_install}`; attr$4(div0, "class", "copy svelte-hq8ezf"); attr$4(pre, "class", "svelte-hq8ezf"); }, m(target, anchor) { insert$5(target, div0, anchor); mount_component$5(copybutton, div0, null); insert$5(target, t0, anchor); insert$5(target, div1, anchor); append$4(div1, pre); current = true; }, p: noop$3, i(local) { if (current) return; transition_in$5(copybutton.$$.fragment, local); current = true; }, o(local) { transition_out$5(copybutton.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$5(div0); detach$5(t0); detach$5(div1); } destroy_component$5(copybutton); } }; } // (8:0) function create_default_slot$2(ctx) { let code; let current_block_type_index; let if_block; let current; const if_block_creators = [create_if_block$5, create_if_block_1$3]; const if_blocks = []; function select_block_type(ctx, dirty) { if (/*current_language*/ ctx[0] === "python") return 0; if (/*current_language*/ ctx[0] === "javascript") return 1; return -1; } if (~(current_block_type_index = select_block_type(ctx))) { if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); } return { c() { code = element$4("code"); if (if_block) if_block.c(); attr$4(code, "class", "svelte-hq8ezf"); }, m(target, anchor) { insert$5(target, code, anchor); if (~current_block_type_index) { if_blocks[current_block_type_index].m(code, null); } current = true; }, p(ctx, dirty) { let previous_block_index = current_block_type_index; current_block_type_index = select_block_type(ctx); if (current_block_type_index === previous_block_index) { if (~current_block_type_index) { if_blocks[current_block_type_index].p(ctx, dirty); } } else { if (if_block) { group_outros$4(); transition_out$5(if_blocks[previous_block_index], 1, 1, () => { if_blocks[previous_block_index] = null; }); check_outros$4(); } if (~current_block_type_index) { if_block = if_blocks[current_block_type_index]; if (!if_block) { if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); if_block.c(); } else { if_block.p(ctx, dirty); } transition_in$5(if_block, 1); if_block.m(code, null); } else { if_block = null; } } }, i(local) { if (current) return; transition_in$5(if_block); current = true; }, o(local) { transition_out$5(if_block); current = false; }, d(detaching) { if (detaching) { detach$5(code); } if (~current_block_type_index) { if_blocks[current_block_type_index].d(); } } }; } function create_fragment$6(ctx) { let block; let current; block = new Block({ props: { $$slots: { default: [create_default_slot$2] }, $$scope: { ctx } } }); return { c() { create_component$5(block.$$.fragment); }, m(target, anchor) { mount_component$5(block, target, anchor); current = true; }, p(ctx, [dirty]) { const block_changes = {}; if (dirty & /*$$scope, current_language*/ 3) { block_changes.$$scope = { dirty, ctx }; } block.$set(block_changes); }, i(local) { if (current) return; transition_in$5(block.$$.fragment, local); current = true; }, o(local) { transition_out$5(block.$$.fragment, local); current = false; }, d(detaching) { destroy_component$5(block, detaching); } }; } let py_install = "pip install gradio_client"; let js_install = "npm i -D @gradio/client"; function instance$6($$self, $$props, $$invalidate) { let { current_language } = $$props; $$self.$$set = $$props => { if ('current_language' in $$props) $$invalidate(0, current_language = $$props.current_language); }; return [current_language]; } class InstallSnippet extends SvelteComponent$6 { constructor(options) { super(); init$6(this, options, instance$6, create_fragment$6, safe_not_equal$6, { current_language: 0 }); } } const EndpointDetail_svelte_svelte_type_style_lang = ''; /* src/api_docs/EndpointDetail.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$5, append: append$3, attr: attr$3, detach: detach$4, element: element$3, empty: empty$4, init: init$5, insert: insert$4, noop: noop$2, safe_not_equal: safe_not_equal$5, set_data: set_data$2, text: text$3 } = window.__gradio__svelte__internal; function create_else_block$2(ctx) { let h3; let t0; let span; let t1; return { c() { h3 = element$3("h3"); t0 = text$3("fn_index:\n\t\t"); span = element$3("span"); t1 = text$3(/*fn_index*/ ctx[1]); attr$3(span, "class", "post svelte-41kcm6"); attr$3(h3, "class", "svelte-41kcm6"); }, m(target, anchor) { insert$4(target, h3, anchor); append$3(h3, t0); append$3(h3, span); append$3(span, t1); }, p(ctx, dirty) { if (dirty & /*fn_index*/ 2) set_data$2(t1, /*fn_index*/ ctx[1]); }, d(detaching) { if (detaching) { detach$4(h3); } } }; } // (6:0) {#if named} function create_if_block$4(ctx) { let h3; let t0; let span; let t1_value = "/" + /*api_name*/ ctx[0] + ""; let t1; return { c() { h3 = element$3("h3"); t0 = text$3("api_name:\n\t\t"); span = element$3("span"); t1 = text$3(t1_value); attr$3(span, "class", "post svelte-41kcm6"); attr$3(h3, "class", "svelte-41kcm6"); }, m(target, anchor) { insert$4(target, h3, anchor); append$3(h3, t0); append$3(h3, span); append$3(span, t1); }, p(ctx, dirty) { if (dirty & /*api_name*/ 1 && t1_value !== (t1_value = "/" + /*api_name*/ ctx[0] + "")) set_data$2(t1, t1_value); }, d(detaching) { if (detaching) { detach$4(h3); } } }; } function create_fragment$5(ctx) { let if_block_anchor; function select_block_type(ctx, dirty) { if (/*named*/ ctx[2]) return create_if_block$4; return create_else_block$2; } let current_block_type = select_block_type(ctx); let if_block = current_block_type(ctx); return { c() { if_block.c(); if_block_anchor = empty$4(); }, m(target, anchor) { if_block.m(target, anchor); insert$4(target, if_block_anchor, anchor); }, p(ctx, [dirty]) { if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { if_block.p(ctx, dirty); } else { if_block.d(1); if_block = current_block_type(ctx); if (if_block) { if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } } }, i: noop$2, o: noop$2, d(detaching) { if (detaching) { detach$4(if_block_anchor); } if_block.d(detaching); } }; } function instance$5($$self, $$props, $$invalidate) { let { api_name = null } = $$props; let { fn_index = null } = $$props; let { named } = $$props; $$self.$$set = $$props => { if ('api_name' in $$props) $$invalidate(0, api_name = $$props.api_name); if ('fn_index' in $$props) $$invalidate(1, fn_index = $$props.fn_index); if ('named' in $$props) $$invalidate(2, named = $$props.named); }; return [api_name, fn_index, named]; } class EndpointDetail extends SvelteComponent$5 { constructor(options) { super(); init$5(this, options, instance$5, create_fragment$5, safe_not_equal$5, { api_name: 0, fn_index: 1, named: 2 }); } } const CodeSnippets_svelte_svelte_type_style_lang = ''; /* src/api_docs/CodeSnippets.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$4, append: append$2, attr: attr$2, binding_callbacks: binding_callbacks$1, check_outros: check_outros$3, create_component: create_component$4, destroy_component: destroy_component$4, destroy_each: destroy_each$1, detach: detach$3, element: element$2, empty: empty$3, ensure_array_like: ensure_array_like$2, group_outros: group_outros$3, init: init$4, insert: insert$3, mount_component: mount_component$4, noop: noop$1, safe_not_equal: safe_not_equal$4, set_data: set_data$1, space: space$2, text: text$2, transition_in: transition_in$4, transition_out: transition_out$4 } = window.__gradio__svelte__internal; function get_each_context_1$1(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[14] = list[i].label; child_ctx[15] = list[i].type; child_ctx[16] = list[i].python_type; child_ctx[17] = list[i].component; child_ctx[18] = list[i].example_input; child_ctx[19] = list[i].serializer; child_ctx[21] = i; return child_ctx; } function get_each_context_2(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[14] = list[i].label; child_ctx[15] = list[i].type; child_ctx[16] = list[i].python_type; child_ctx[17] = list[i].component; child_ctx[18] = list[i].example_input; child_ctx[19] = list[i].serializer; child_ctx[21] = i; return child_ctx; } function get_each_context$2(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[14] = list[i].label; child_ctx[15] = list[i].type; child_ctx[16] = list[i].python_type; child_ctx[17] = list[i].component; child_ctx[18] = list[i].example_input; child_ctx[19] = list[i].serializer; child_ctx[21] = i; return child_ctx; } // (22:1) {:else} function create_else_block_2(ctx) { let endpointdetail; let current; endpointdetail = new EndpointDetail({ props: { named: /*named*/ ctx[6], fn_index: /*dependency_index*/ ctx[1] } }); return { c() { create_component$4(endpointdetail.$$.fragment); }, m(target, anchor) { mount_component$4(endpointdetail, target, anchor); current = true; }, p(ctx, dirty) { const endpointdetail_changes = {}; if (dirty & /*named*/ 64) endpointdetail_changes.named = /*named*/ ctx[6]; if (dirty & /*dependency_index*/ 2) endpointdetail_changes.fn_index = /*dependency_index*/ ctx[1]; endpointdetail.$set(endpointdetail_changes); }, i(local) { if (current) return; transition_in$4(endpointdetail.$$.fragment, local); current = true; }, o(local) { transition_out$4(endpointdetail.$$.fragment, local); current = false; }, d(detaching) { destroy_component$4(endpointdetail, detaching); } }; } // (20:1) {#if named} function create_if_block_7(ctx) { let endpointdetail; let current; endpointdetail = new EndpointDetail({ props: { named: /*named*/ ctx[6], api_name: /*dependency*/ ctx[0].api_name } }); return { c() { create_component$4(endpointdetail.$$.fragment); }, m(target, anchor) { mount_component$4(endpointdetail, target, anchor); current = true; }, p(ctx, dirty) { const endpointdetail_changes = {}; if (dirty & /*named*/ 64) endpointdetail_changes.named = /*named*/ ctx[6]; if (dirty & /*dependency*/ 1) endpointdetail_changes.api_name = /*dependency*/ ctx[0].api_name; endpointdetail.$set(endpointdetail_changes); }, i(local) { if (current) return; transition_in$4(endpointdetail.$$.fragment, local); current = true; }, o(local) { transition_out$4(endpointdetail.$$.fragment, local); current = false; }, d(detaching) { destroy_component$4(endpointdetail, detaching); } }; } // (61:47) function create_if_block_3$2(ctx) { let div0; let copybutton; let t0; let div1; let pre; let t1; let t2; let span; let t3; let t4; let t5; let t6; let t7; let t8; let current; copybutton = new CopyButton({ props: { code: /*js_code*/ ctx[9]?.innerText } }); let each_value_2 = ensure_array_like$2(/*blob_examples*/ ctx[11]); let each_blocks_1 = []; for (let i = 0; i < each_value_2.length; i += 1) { each_blocks_1[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i)); } function select_block_type_2(ctx, dirty) { if (/*named*/ ctx[6]) return create_if_block_6$1; return create_else_block_1; } let current_block_type = select_block_type_2(ctx); let if_block = current_block_type(ctx); let each_value_1 = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); let each_blocks = []; for (let i = 0; i < each_value_1.length; i += 1) { each_blocks[i] = create_each_block_1$1(get_each_context_1$1(ctx, each_value_1, i)); } return { c() { div0 = element$2("div"); create_component$4(copybutton.$$.fragment); t0 = space$2(); div1 = element$2("div"); pre = element$2("pre"); t1 = text$2("import { client } from \"@gradio/client\";\n"); for (let i = 0; i < each_blocks_1.length; i += 1) { each_blocks_1[i].c(); } t2 = text$2("\nconst app = await client("); span = element$2("span"); t3 = text$2("\""); t4 = text$2(/*root*/ ctx[2]); t5 = text$2("\""); t6 = text$2(");\nconst result = await app.predict("); if_block.c(); t7 = text$2(", ["); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } t8 = text$2("\n\t]);\n\nconsole.log(result.data);\n"); attr$2(div0, "class", "copy svelte-1d98qmk"); attr$2(span, "class", "token string svelte-1d98qmk"); attr$2(pre, "class", "svelte-1d98qmk"); }, m(target, anchor) { insert$3(target, div0, anchor); mount_component$4(copybutton, div0, null); insert$3(target, t0, anchor); insert$3(target, div1, anchor); append$2(div1, pre); append$2(pre, t1); for (let i = 0; i < each_blocks_1.length; i += 1) { if (each_blocks_1[i]) { each_blocks_1[i].m(pre, null); } } append$2(pre, t2); append$2(pre, span); append$2(span, t3); append$2(span, t4); append$2(span, t5); append$2(pre, t6); if_block.m(pre, null); append$2(pre, t7); for (let i = 0; i < each_blocks.length; i += 1) { if (each_blocks[i]) { each_blocks[i].m(pre, null); } } append$2(pre, t8); /*div1_binding_1*/ ctx[13](div1); current = true; }, p(ctx, dirty) { const copybutton_changes = {}; if (dirty & /*js_code*/ 512) copybutton_changes.code = /*js_code*/ ctx[9]?.innerText; copybutton.$set(copybutton_changes); if (dirty & /*blob_examples*/ 2048) { each_value_2 = ensure_array_like$2(/*blob_examples*/ ctx[11]); let i; for (i = 0; i < each_value_2.length; i += 1) { const child_ctx = get_each_context_2(ctx, each_value_2, i); if (each_blocks_1[i]) { each_blocks_1[i].p(child_ctx, dirty); } else { each_blocks_1[i] = create_each_block_2(child_ctx); each_blocks_1[i].c(); each_blocks_1[i].m(pre, t2); } } for (; i < each_blocks_1.length; i += 1) { each_blocks_1[i].d(1); } each_blocks_1.length = each_value_2.length; } if (!current || dirty & /*root*/ 4) set_data$1(t4, /*root*/ ctx[2]); if (current_block_type === (current_block_type = select_block_type_2(ctx)) && if_block) { if_block.p(ctx, dirty); } else { if_block.d(1); if_block = current_block_type(ctx); if (if_block) { if_block.c(); if_block.m(pre, t7); } } if (dirty & /*endpoint_parameters, blob_components, js_parameters*/ 1072) { each_value_1 = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); let i; for (i = 0; i < each_value_1.length; i += 1) { const child_ctx = get_each_context_1$1(ctx, each_value_1, i); if (each_blocks[i]) { each_blocks[i].p(child_ctx, dirty); } else { each_blocks[i] = create_each_block_1$1(child_ctx); each_blocks[i].c(); each_blocks[i].m(pre, t8); } } for (; i < each_blocks.length; i += 1) { each_blocks[i].d(1); } each_blocks.length = each_value_1.length; } }, i(local) { if (current) return; transition_in$4(copybutton.$$.fragment, local); current = true; }, o(local) { transition_out$4(copybutton.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$3(div0); detach$3(t0); detach$3(div1); } destroy_component$4(copybutton); destroy_each$1(each_blocks_1, detaching); if_block.d(); destroy_each$1(each_blocks, detaching); /*div1_binding_1*/ ctx[13](null); } }; } // (27:3) {#if current_language === "python"} function create_if_block$3(ctx) { let div0; let copybutton; let t0; let div1; let pre; let t1; let span; let t2; let t3; let t4; let t5; let t6; let t7_value = /*dependency*/ ctx[0].api_name + ""; let t7; let t8; let current; copybutton = new CopyButton({ props: { code: /*python_code*/ ctx[8]?.innerText } }); let each_value = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i)); } return { c() { div0 = element$2("div"); create_component$4(copybutton.$$.fragment); t0 = space$2(); div1 = element$2("div"); pre = element$2("pre"); t1 = text$2("from gradio_client import Client\n\nclient = Client("); span = element$2("span"); t2 = text$2("\""); t3 = text$2(/*root*/ ctx[2]); t4 = text$2("\""); t5 = text$2(")\nresult = client.predict("); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } t6 = text$2("\n\t\tapi_name=\"/"); t7 = text$2(t7_value); t8 = text$2("\"\n)\nprint(result)"); attr$2(div0, "class", "copy svelte-1d98qmk"); attr$2(span, "class", "token string svelte-1d98qmk"); attr$2(pre, "class", "svelte-1d98qmk"); }, m(target, anchor) { insert$3(target, div0, anchor); mount_component$4(copybutton, div0, null); insert$3(target, t0, anchor); insert$3(target, div1, anchor); append$2(div1, pre); append$2(pre, t1); append$2(pre, span); append$2(span, t2); append$2(span, t3); append$2(span, t4); append$2(pre, t5); for (let i = 0; i < each_blocks.length; i += 1) { if (each_blocks[i]) { each_blocks[i].m(pre, null); } } append$2(pre, t6); append$2(pre, t7); append$2(pre, t8); /*div1_binding*/ ctx[12](div1); current = true; }, p(ctx, dirty) { const copybutton_changes = {}; if (dirty & /*python_code*/ 256) copybutton_changes.code = /*python_code*/ ctx[8]?.innerText; copybutton.$set(copybutton_changes); if (!current || dirty & /*root*/ 4) set_data$1(t3, /*root*/ ctx[2]); if (dirty & /*endpoint_parameters, dependency_failures, dependency_index*/ 26) { each_value = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context$2(ctx, each_value, i); if (each_blocks[i]) { each_blocks[i].p(child_ctx, dirty); } else { each_blocks[i] = create_each_block$2(child_ctx); each_blocks[i].c(); each_blocks[i].m(pre, t6); } } for (; i < each_blocks.length; i += 1) { each_blocks[i].d(1); } each_blocks.length = each_value.length; } if ((!current || dirty & /*dependency*/ 1) && t7_value !== (t7_value = /*dependency*/ ctx[0].api_name + "")) set_data$1(t7, t7_value); }, i(local) { if (current) return; transition_in$4(copybutton.$$.fragment, local); current = true; }, o(local) { transition_out$4(copybutton.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$3(div0); detach$3(t0); detach$3(div1); } destroy_component$4(copybutton); destroy_each$1(each_blocks, detaching); /*div1_binding*/ ctx[12](null); } }; } // (67:0) {#each blob_examples as { label, type, python_type, component, example_input, serializer } function create_each_block_2(ctx) { let t0; let t1; let t2; let t3_value = /*example_input*/ ctx[18] + ""; let t3; let t4; let t5_value = /*component*/ ctx[17] + ""; let t5; let t6; let t7; let t8; return { c() { t0 = text$2("\nconst response_"); t1 = text$2(/*i*/ ctx[21]); t2 = text$2(" = await fetch(\""); t3 = text$2(t3_value); t4 = text$2("\");\nconst example"); t5 = text$2(t5_value); t6 = text$2(" = await response_"); t7 = text$2(/*i*/ ctx[21]); t8 = text$2(".blob();\n\t\t\t\t\t\t"); }, m(target, anchor) { insert$3(target, t0, anchor); insert$3(target, t1, anchor); insert$3(target, t2, anchor); insert$3(target, t3, anchor); insert$3(target, t4, anchor); insert$3(target, t5, anchor); insert$3(target, t6, anchor); insert$3(target, t7, anchor); insert$3(target, t8, anchor); }, p: noop$1, d(detaching) { if (detaching) { detach$3(t0); detach$3(t1); detach$3(t2); detach$3(t3); detach$3(t4); detach$3(t5); detach$3(t6); detach$3(t7); detach$3(t8); } } }; } // (74:68) {:else} function create_else_block_1(ctx) { let t; return { c() { t = text$2(/*dependency_index*/ ctx[1]); }, m(target, anchor) { insert$3(target, t, anchor); }, p(ctx, dirty) { if (dirty & /*dependency_index*/ 2) set_data$1(t, /*dependency_index*/ ctx[1]); }, d(detaching) { if (detaching) { detach$3(t); } } }; } // (74:33) {#if named} function create_if_block_6$1(ctx) { let t0; let t1_value = /*dependency*/ ctx[0].api_name + ""; let t1; let t2; return { c() { t0 = text$2("\"/"); t1 = text$2(t1_value); t2 = text$2("\""); }, m(target, anchor) { insert$3(target, t0, anchor); insert$3(target, t1, anchor); insert$3(target, t2, anchor); }, p(ctx, dirty) { if (dirty & /*dependency*/ 1 && t1_value !== (t1_value = /*dependency*/ ctx[0].api_name + "")) set_data$1(t1, t1_value); }, d(detaching) { if (detaching) { detach$3(t0); detach$3(t1); detach$3(t2); } } }; } // (88:5) {:else} function create_else_block$1(ctx) { let t0; let span0; let t1_value = represent_value(/*example_input*/ ctx[18], /*python_type*/ ctx[16].type, "js") + ""; let t1; let t2; let span1; let t3; let t4_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].type + ""; let t4; let t5; let t6; let t7_value = /*label*/ ctx[14] + ""; let t7; let t8; let t9_value = /*component*/ ctx[17] + ""; let t9; let t10; let if_block = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].description && create_if_block_5$1(ctx); return { c() { t0 = text$2("\t\t\n\t\t\t\t"); span0 = element$2("span"); t1 = text$2(t1_value); t2 = text$2(", "); span1 = element$2("span"); t3 = text$2("// "); t4 = text$2(t4_value); t5 = text$2(" "); if (if_block) if_block.c(); t6 = text$2(" in '"); t7 = text$2(t7_value); t8 = text$2("' "); t9 = text$2(t9_value); t10 = text$2(" component"); attr$2(span0, "class", "example-inputs svelte-1d98qmk"); attr$2(span1, "class", "desc svelte-1d98qmk"); }, m(target, anchor) { insert$3(target, t0, anchor); insert$3(target, span0, anchor); append$2(span0, t1); insert$3(target, t2, anchor); insert$3(target, span1, anchor); append$2(span1, t3); append$2(span1, t4); append$2(span1, t5); if (if_block) if_block.m(span1, null); append$2(span1, t6); append$2(span1, t7); append$2(span1, t8); append$2(span1, t9); append$2(span1, t10); }, p(ctx, dirty) { if (dirty & /*endpoint_parameters*/ 16 && t1_value !== (t1_value = represent_value(/*example_input*/ ctx[18], /*python_type*/ ctx[16].type, "js") + "")) set_data$1(t1, t1_value); if (dirty & /*js_parameters*/ 32 && t4_value !== (t4_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].type + "")) set_data$1(t4, t4_value); if (/*js_parameters*/ ctx[5][/*i*/ ctx[21]].description) { if (if_block) { if_block.p(ctx, dirty); } else { if_block = create_if_block_5$1(ctx); if_block.c(); if_block.m(span1, t6); } } else if (if_block) { if_block.d(1); if_block = null; } if (dirty & /*endpoint_parameters*/ 16 && t7_value !== (t7_value = /*label*/ ctx[14] + "")) set_data$1(t7, t7_value); if (dirty & /*endpoint_parameters*/ 16 && t9_value !== (t9_value = /*component*/ ctx[17] + "")) set_data$1(t9, t9_value); }, d(detaching) { if (detaching) { detach$3(t0); detach$3(span0); detach$3(t2); detach$3(span1); } if (if_block) if_block.d(); } }; } // (76:5) {#if blob_components.includes(component)} function create_if_block_4$1(ctx) { let t0; let span0; let t1; let t2_value = /*component*/ ctx[17] + ""; let t2; let t3; let span1; let t4; let t5_value = /*label*/ ctx[14] + ""; let t5; let t6; let t7_value = /*component*/ ctx[17] + ""; let t7; let t8; return { c() { t0 = text$2("\n\t\t\t\t"); span0 = element$2("span"); t1 = text$2("example"); t2 = text$2(t2_value); t3 = text$2(", "); span1 = element$2("span"); t4 = text$2("\t// blob in '"); t5 = text$2(t5_value); t6 = text$2("' "); t7 = text$2(t7_value); t8 = text$2(" component"); attr$2(span0, "class", "example-inputs svelte-1d98qmk"); attr$2(span1, "class", "desc svelte-1d98qmk"); }, m(target, anchor) { insert$3(target, t0, anchor); insert$3(target, span0, anchor); append$2(span0, t1); append$2(span0, t2); insert$3(target, t3, anchor); insert$3(target, span1, anchor); append$2(span1, t4); append$2(span1, t5); append$2(span1, t6); append$2(span1, t7); append$2(span1, t8); }, p(ctx, dirty) { if (dirty & /*endpoint_parameters*/ 16 && t2_value !== (t2_value = /*component*/ ctx[17] + "")) set_data$1(t2, t2_value); if (dirty & /*endpoint_parameters*/ 16 && t5_value !== (t5_value = /*label*/ ctx[14] + "")) set_data$1(t5, t5_value); if (dirty & /*endpoint_parameters*/ 16 && t7_value !== (t7_value = /*component*/ ctx[17] + "")) set_data$1(t7, t7_value); }, d(detaching) { if (detaching) { detach$3(t0); detach$3(span0); detach$3(t3); detach$3(span1); } } }; } // (100:17) {#if js_parameters[i].description} function create_if_block_5$1(ctx) { let t0; let t1_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].description + ""; let t1; let t2; return { c() { t0 = text$2("("); t1 = text$2(t1_value); t2 = text$2(")"); }, m(target, anchor) { insert$3(target, t0, anchor); insert$3(target, t1, anchor); insert$3(target, t2, anchor); }, p(ctx, dirty) { if (dirty & /*js_parameters*/ 32 && t1_value !== (t1_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].description + "")) set_data$1(t1, t1_value); }, d(detaching) { if (detaching) { detach$3(t0); detach$3(t1); detach$3(t2); } } }; } // (75:3) {#each endpoint_parameters as { label, type, python_type, component, example_input, serializer } function create_each_block_1$1(ctx) { let show_if; let if_block_anchor; function select_block_type_3(ctx, dirty) { if (dirty & /*endpoint_parameters*/ 16) show_if = null; if (show_if == null) show_if = !!/*blob_components*/ ctx[10].includes(/*component*/ ctx[17]); if (show_if) return create_if_block_4$1; return create_else_block$1; } let current_block_type = select_block_type_3(ctx, -1); let if_block = current_block_type(ctx); return { c() { if_block.c(); if_block_anchor = empty$3(); }, m(target, anchor) { if_block.m(target, anchor); insert$3(target, if_block_anchor, anchor); }, p(ctx, dirty) { if (current_block_type === (current_block_type = select_block_type_3(ctx, dirty)) && if_block) { if_block.p(ctx, dirty); } else { if_block.d(1); if_block = current_block_type(ctx); if (if_block) { if_block.c(); if_block.m(if_block_anchor.parentNode, if_block_anchor); } } }, d(detaching) { if (detaching) { detach$3(if_block_anchor); } if_block.d(detaching); } }; } // (42:6) {#if dependency_failures[dependency_index][i]} function create_if_block_2$2(ctx) { let span; return { c() { span = element$2("span"); span.textContent = "ERROR"; attr$2(span, "class", "error svelte-1d98qmk"); }, m(target, anchor) { insert$3(target, span, anchor); }, d(detaching) { if (detaching) { detach$3(span); } } }; } // (49:28) {#if python_type.description} function create_if_block_1$2(ctx) { let t0; let t1_value = /*python_type*/ ctx[16].description + ""; let t1; let t2; return { c() { t0 = text$2("("); t1 = text$2(t1_value); t2 = text$2(")"); }, m(target, anchor) { insert$3(target, t0, anchor); insert$3(target, t1, anchor); insert$3(target, t2, anchor); }, p(ctx, dirty) { if (dirty & /*endpoint_parameters*/ 16 && t1_value !== (t1_value = /*python_type*/ ctx[16].description + "")) set_data$1(t1, t1_value); }, d(detaching) { if (detaching) { detach$3(t0); detach$3(t1); detach$3(t2); } } }; } // (36:3) {#each endpoint_parameters as { label, type, python_type, component, example_input, serializer } function create_each_block$2(ctx) { let t0; let span0; let t1_value = represent_value(/*example_input*/ ctx[18], /*python_type*/ ctx[16].type, "py") + ""; let t1; let t2; let span1; let t3; let t4_value = /*python_type*/ ctx[16].type + ""; let t4; let t5; let t6; let t7_value = /*label*/ ctx[14] + ""; let t7; let t8; let t9_value = /*component*/ ctx[17] + ""; let t9; let t10; let if_block0 = /*dependency_failures*/ ctx[3][/*dependency_index*/ ctx[1]][/*i*/ ctx[21]] && create_if_block_2$2(); let if_block1 = /*python_type*/ ctx[16].description && create_if_block_1$2(ctx); return { c() { t0 = text$2("\n\t\t"); span0 = element$2("span"); t1 = text$2(t1_value); t2 = text$2(","); if (if_block0) if_block0.c(); span1 = element$2("span"); t3 = text$2("\t# "); t4 = text$2(t4_value); t5 = text$2(" "); if (if_block1) if_block1.c(); t6 = text$2(" in '"); t7 = text$2(t7_value); t8 = text$2("' "); t9 = text$2(t9_value); t10 = text$2(" component"); attr$2(span0, "class", "example-inputs svelte-1d98qmk"); attr$2(span1, "class", "desc svelte-1d98qmk"); }, m(target, anchor) { insert$3(target, t0, anchor); insert$3(target, span0, anchor); append$2(span0, t1); insert$3(target, t2, anchor); if (if_block0) if_block0.m(target, anchor); insert$3(target, span1, anchor); append$2(span1, t3); append$2(span1, t4); append$2(span1, t5); if (if_block1) if_block1.m(span1, null); append$2(span1, t6); append$2(span1, t7); append$2(span1, t8); append$2(span1, t9); append$2(span1, t10); }, p(ctx, dirty) { if (dirty & /*endpoint_parameters*/ 16 && t1_value !== (t1_value = represent_value(/*example_input*/ ctx[18], /*python_type*/ ctx[16].type, "py") + "")) set_data$1(t1, t1_value); if (/*dependency_failures*/ ctx[3][/*dependency_index*/ ctx[1]][/*i*/ ctx[21]]) { if (if_block0) ; else { if_block0 = create_if_block_2$2(); if_block0.c(); if_block0.m(span1.parentNode, span1); } } else if (if_block0) { if_block0.d(1); if_block0 = null; } if (dirty & /*endpoint_parameters*/ 16 && t4_value !== (t4_value = /*python_type*/ ctx[16].type + "")) set_data$1(t4, t4_value); if (/*python_type*/ ctx[16].description) { if (if_block1) { if_block1.p(ctx, dirty); } else { if_block1 = create_if_block_1$2(ctx); if_block1.c(); if_block1.m(span1, t6); } } else if (if_block1) { if_block1.d(1); if_block1 = null; } if (dirty & /*endpoint_parameters*/ 16 && t7_value !== (t7_value = /*label*/ ctx[14] + "")) set_data$1(t7, t7_value); if (dirty & /*endpoint_parameters*/ 16 && t9_value !== (t9_value = /*component*/ ctx[17] + "")) set_data$1(t9, t9_value); }, d(detaching) { if (detaching) { detach$3(t0); detach$3(span0); detach$3(t2); detach$3(span1); } if (if_block0) if_block0.d(detaching); if (if_block1) if_block1.d(); } }; } // (25:1) function create_default_slot$1(ctx) { let code; let current_block_type_index; let if_block; let current; const if_block_creators = [create_if_block$3, create_if_block_3$2]; const if_blocks = []; function select_block_type_1(ctx, dirty) { if (/*current_language*/ ctx[7] === "python") return 0; if (/*current_language*/ ctx[7] === "javascript") return 1; return -1; } if (~(current_block_type_index = select_block_type_1(ctx))) { if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); } return { c() { code = element$2("code"); if (if_block) if_block.c(); attr$2(code, "class", "svelte-1d98qmk"); }, m(target, anchor) { insert$3(target, code, anchor); if (~current_block_type_index) { if_blocks[current_block_type_index].m(code, null); } current = true; }, p(ctx, dirty) { let previous_block_index = current_block_type_index; current_block_type_index = select_block_type_1(ctx); if (current_block_type_index === previous_block_index) { if (~current_block_type_index) { if_blocks[current_block_type_index].p(ctx, dirty); } } else { if (if_block) { group_outros$3(); transition_out$4(if_blocks[previous_block_index], 1, 1, () => { if_blocks[previous_block_index] = null; }); check_outros$3(); } if (~current_block_type_index) { if_block = if_blocks[current_block_type_index]; if (!if_block) { if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); if_block.c(); } else { if_block.p(ctx, dirty); } transition_in$4(if_block, 1); if_block.m(code, null); } else { if_block = null; } } }, i(local) { if (current) return; transition_in$4(if_block); current = true; }, o(local) { transition_out$4(if_block); current = false; }, d(detaching) { if (detaching) { detach$3(code); } if (~current_block_type_index) { if_blocks[current_block_type_index].d(); } } }; } function create_fragment$4(ctx) { let div; let current_block_type_index; let if_block; let t; let block; let current; const if_block_creators = [create_if_block_7, create_else_block_2]; const if_blocks = []; function select_block_type(ctx, dirty) { if (/*named*/ ctx[6]) return 0; return 1; } current_block_type_index = select_block_type(ctx); if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); block = new Block({ props: { $$slots: { default: [create_default_slot$1] }, $$scope: { ctx } } }); return { c() { div = element$2("div"); if_block.c(); t = space$2(); create_component$4(block.$$.fragment); attr$2(div, "class", "container svelte-1d98qmk"); }, m(target, anchor) { insert$3(target, div, anchor); if_blocks[current_block_type_index].m(div, null); append$2(div, t); mount_component$4(block, div, null); current = true; }, p(ctx, [dirty]) { let previous_block_index = current_block_type_index; current_block_type_index = select_block_type(ctx); if (current_block_type_index === previous_block_index) { if_blocks[current_block_type_index].p(ctx, dirty); } else { group_outros$3(); transition_out$4(if_blocks[previous_block_index], 1, 1, () => { if_blocks[previous_block_index] = null; }); check_outros$3(); if_block = if_blocks[current_block_type_index]; if (!if_block) { if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); if_block.c(); } else { if_block.p(ctx, dirty); } transition_in$4(if_block, 1); if_block.m(div, t); } const block_changes = {}; if (dirty & /*$$scope, python_code, dependency, endpoint_parameters, dependency_failures, dependency_index, root, current_language, js_code, js_parameters, named*/ 16778239) { block_changes.$$scope = { dirty, ctx }; } block.$set(block_changes); }, i(local) { if (current) return; transition_in$4(if_block); transition_in$4(block.$$.fragment, local); current = true; }, o(local) { transition_out$4(if_block); transition_out$4(block.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$3(div); } if_blocks[current_block_type_index].d(); destroy_component$4(block); } }; } function instance$4($$self, $$props, $$invalidate) { let { dependency } = $$props; let { dependency_index } = $$props; let { root } = $$props; let { dependency_failures } = $$props; let { endpoint_parameters } = $$props; let { js_parameters } = $$props; let { named } = $$props; let { current_language } = $$props; let python_code; let js_code; let blob_components = ["Audio", "File", "Image", "Video"]; let blob_examples = endpoint_parameters.filter(param => blob_components.includes(param.component)); function div1_binding($$value) { binding_callbacks$1[$$value ? 'unshift' : 'push'](() => { python_code = $$value; $$invalidate(8, python_code); }); } function div1_binding_1($$value) { binding_callbacks$1[$$value ? 'unshift' : 'push'](() => { js_code = $$value; $$invalidate(9, js_code); }); } $$self.$$set = $$props => { if ('dependency' in $$props) $$invalidate(0, dependency = $$props.dependency); if ('dependency_index' in $$props) $$invalidate(1, dependency_index = $$props.dependency_index); if ('root' in $$props) $$invalidate(2, root = $$props.root); if ('dependency_failures' in $$props) $$invalidate(3, dependency_failures = $$props.dependency_failures); if ('endpoint_parameters' in $$props) $$invalidate(4, endpoint_parameters = $$props.endpoint_parameters); if ('js_parameters' in $$props) $$invalidate(5, js_parameters = $$props.js_parameters); if ('named' in $$props) $$invalidate(6, named = $$props.named); if ('current_language' in $$props) $$invalidate(7, current_language = $$props.current_language); }; return [ dependency, dependency_index, root, dependency_failures, endpoint_parameters, js_parameters, named, current_language, python_code, js_code, blob_components, blob_examples, div1_binding, div1_binding_1 ]; } class CodeSnippets extends SvelteComponent$4 { constructor(options) { super(); init$4(this, options, instance$4, create_fragment$4, safe_not_equal$4, { dependency: 0, dependency_index: 1, root: 2, dependency_failures: 3, endpoint_parameters: 4, js_parameters: 5, named: 6, current_language: 7 }); } } const python = ""+new URL('python-20e39c92.svg', import.meta.url).href+""; const javascript = ""+new URL('javascript-850cf94b.svg', import.meta.url).href+""; const ApiDocs_svelte_svelte_type_style_lang = ''; /* src/api_docs/ApiDocs.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$3, append: append$1, attr: attr$1, bubble: bubble$1, check_outros: check_outros$2, create_component: create_component$3, destroy_component: destroy_component$3, destroy_each, detach: detach$2, element: element$1, empty: empty$2, ensure_array_like: ensure_array_like$1, group_outros: group_outros$2, init: init$3, insert: insert$2, listen: listen$1, mount_component: mount_component$3, safe_not_equal: safe_not_equal$3, space: space$1, src_url_equal: src_url_equal$1, text: text$1, transition_in: transition_in$3, transition_out: transition_out$3 } = window.__gradio__svelte__internal; const { onMount: onMount$2, createEventDispatcher: createEventDispatcher$2 } = window.__gradio__svelte__internal; function get_each_context$1(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[18] = list[i]; child_ctx[20] = i; return child_ctx; } function get_each_context_1(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[21] = list[i][0]; child_ctx[22] = list[i][1]; return child_ctx; } // (103:0) {#if info} function create_if_block$2(ctx) { let show_if; let current_block_type_index; let if_block; let if_block_anchor; let current; const if_block_creators = [create_if_block_1$1, create_else_block]; const if_blocks = []; function select_block_type(ctx, dirty) { if (dirty & /*dependencies*/ 2) show_if = null; if (show_if == null) show_if = !!/*dependencies*/ ctx[1].filter(func).length; if (show_if) return 0; return 1; } current_block_type_index = select_block_type(ctx, -1); if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); return { c() { if_block.c(); if_block_anchor = empty$2(); }, m(target, anchor) { if_blocks[current_block_type_index].m(target, anchor); insert$2(target, if_block_anchor, anchor); current = true; }, p(ctx, dirty) { let previous_block_index = current_block_type_index; current_block_type_index = select_block_type(ctx, dirty); if (current_block_type_index === previous_block_index) { if_blocks[current_block_type_index].p(ctx, dirty); } else { group_outros$2(); transition_out$3(if_blocks[previous_block_index], 1, 1, () => { if_blocks[previous_block_index] = null; }); check_outros$2(); if_block = if_blocks[current_block_type_index]; if (!if_block) { if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); if_block.c(); } else { if_block.p(ctx, dirty); } transition_in$3(if_block, 1); if_block.m(if_block_anchor.parentNode, if_block_anchor); } }, i(local) { if (current) return; transition_in$3(if_block); current = true; }, o(local) { transition_out$3(if_block); current = false; }, d(detaching) { if (detaching) { detach$2(if_block_anchor); } if_blocks[current_block_type_index].d(detaching); } }; } // (183:1) {:else} function create_else_block(ctx) { let noapi; let current; noapi = new NoApi({ props: { root: /*root*/ ctx[0] } }); noapi.$on("close", /*close_handler_1*/ ctx[12]); return { c() { create_component$3(noapi.$$.fragment); }, m(target, anchor) { mount_component$3(noapi, target, anchor); current = true; }, p(ctx, dirty) { const noapi_changes = {}; if (dirty & /*root*/ 1) noapi_changes.root = /*root*/ ctx[0]; noapi.$set(noapi_changes); }, i(local) { if (current) return; transition_in$3(noapi.$$.fragment, local); current = true; }, o(local) { transition_out$3(noapi.$$.fragment, local); current = false; }, d(detaching) { destroy_component$3(noapi, detaching); } }; } // (104:1) {#if dependencies.filter((dependency) => dependency.show_api).length} function create_if_block_1$1(ctx) { let div0; let apibanner; let t0; let div4; let div1; let t6; let div3; let div2; let t7; let installsnippet; let t8; let show_if = Object.keys(/*info*/ ctx[5].named_endpoints).length; let t9; let current; apibanner = new ApiBanner({ props: { root: /*root*/ ctx[0], api_count: /*dependencies*/ ctx[1].filter(func_1).length } }); apibanner.$on("close", /*close_handler*/ ctx[10]); let each_value_1 = ensure_array_like$1(/*langs*/ ctx[7]); let each_blocks_1 = []; for (let i = 0; i < each_value_1.length; i += 1) { each_blocks_1[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); } installsnippet = new InstallSnippet({ props: { current_language: /*current_language*/ ctx[2] } }); let if_block = show_if && create_if_block_3$1(); let each_value = ensure_array_like$1(/*dependencies*/ ctx[1]); let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i)); } const out = i => transition_out$3(each_blocks[i], 1, 1, () => { each_blocks[i] = null; }); return { c() { div0 = element$1("div"); create_component$3(apibanner.$$.fragment); t0 = space$1(); div4 = element$1("div"); div1 = element$1("div"); div1.innerHTML = `

Use the gradio_client Python library or the @gradio/client Javascript package to query the demo via API.

`; t6 = space$1(); div3 = element$1("div"); div2 = element$1("div"); for (let i = 0; i < each_blocks_1.length; i += 1) { each_blocks_1[i].c(); } t7 = space$1(); create_component$3(installsnippet.$$.fragment); t8 = space$1(); if (if_block) if_block.c(); t9 = space$1(); for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } attr$1(div0, "class", "banner-wrap svelte-bdjvpc"); attr$1(div1, "class", "client-doc svelte-bdjvpc"); attr$1(div2, "class", "snippets svelte-bdjvpc"); attr$1(div3, "class", "endpoint svelte-bdjvpc"); attr$1(div4, "class", "docs-wrap svelte-bdjvpc"); }, m(target, anchor) { insert$2(target, div0, anchor); mount_component$3(apibanner, div0, null); insert$2(target, t0, anchor); insert$2(target, div4, anchor); append$1(div4, div1); append$1(div4, t6); append$1(div4, div3); append$1(div3, div2); for (let i = 0; i < each_blocks_1.length; i += 1) { if (each_blocks_1[i]) { each_blocks_1[i].m(div2, null); } } append$1(div3, t7); mount_component$3(installsnippet, div3, null); append$1(div3, t8); if (if_block) if_block.m(div3, null); append$1(div3, t9); for (let i = 0; i < each_blocks.length; i += 1) { if (each_blocks[i]) { each_blocks[i].m(div3, null); } } current = true; }, p(ctx, dirty) { const apibanner_changes = {}; if (dirty & /*root*/ 1) apibanner_changes.root = /*root*/ ctx[0]; if (dirty & /*dependencies*/ 2) apibanner_changes.api_count = /*dependencies*/ ctx[1].filter(func_1).length; apibanner.$set(apibanner_changes); if (dirty & /*current_language, langs*/ 132) { each_value_1 = ensure_array_like$1(/*langs*/ ctx[7]); let i; for (i = 0; i < each_value_1.length; i += 1) { const child_ctx = get_each_context_1(ctx, each_value_1, i); if (each_blocks_1[i]) { each_blocks_1[i].p(child_ctx, dirty); } else { each_blocks_1[i] = create_each_block_1(child_ctx); each_blocks_1[i].c(); each_blocks_1[i].m(div2, null); } } for (; i < each_blocks_1.length; i += 1) { each_blocks_1[i].d(1); } each_blocks_1.length = each_value_1.length; } const installsnippet_changes = {}; if (dirty & /*current_language*/ 4) installsnippet_changes.current_language = /*current_language*/ ctx[2]; installsnippet.$set(installsnippet_changes); if (dirty & /*info*/ 32) show_if = Object.keys(/*info*/ ctx[5].named_endpoints).length; if (show_if) { if (if_block) ; else { if_block = create_if_block_3$1(); if_block.c(); if_block.m(div3, t9); } } else if (if_block) { if_block.d(1); if_block = null; } if (dirty & /*info, dependencies, js_info, is_running, current_language, root, dependency_failures*/ 127) { each_value = ensure_array_like$1(/*dependencies*/ ctx[1]); let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context$1(ctx, each_value, i); if (each_blocks[i]) { each_blocks[i].p(child_ctx, dirty); transition_in$3(each_blocks[i], 1); } else { each_blocks[i] = create_each_block$1(child_ctx); each_blocks[i].c(); transition_in$3(each_blocks[i], 1); each_blocks[i].m(div3, null); } } group_outros$2(); for (i = each_value.length; i < each_blocks.length; i += 1) { out(i); } check_outros$2(); } }, i(local) { if (current) return; transition_in$3(apibanner.$$.fragment, local); transition_in$3(installsnippet.$$.fragment, local); for (let i = 0; i < each_value.length; i += 1) { transition_in$3(each_blocks[i]); } current = true; }, o(local) { transition_out$3(apibanner.$$.fragment, local); transition_out$3(installsnippet.$$.fragment, local); each_blocks = each_blocks.filter(Boolean); for (let i = 0; i < each_blocks.length; i += 1) { transition_out$3(each_blocks[i]); } current = false; }, d(detaching) { if (detaching) { detach$2(div0); detach$2(t0); detach$2(div4); } destroy_component$3(apibanner); destroy_each(each_blocks_1, detaching); destroy_component$3(installsnippet); if (if_block) if_block.d(); destroy_each(each_blocks, detaching); } }; } // (128:5) {#each langs as [language, img]} function create_each_block_1(ctx) { let li; let img_1; let img_1_src_value; let t0; let t1_value = /*language*/ ctx[21] + ""; let t1; let t2; let li_class_value; let mounted; let dispose; function click_handler() { return /*click_handler*/ ctx[11](/*language*/ ctx[21]); } return { c() { li = element$1("li"); img_1 = element$1("img"); t0 = space$1(); t1 = text$1(t1_value); t2 = space$1(); if (!src_url_equal$1(img_1.src, img_1_src_value = /*img*/ ctx[22])) attr$1(img_1, "src", img_1_src_value); attr$1(img_1, "alt", ""); attr$1(img_1, "class", "svelte-bdjvpc"); attr$1(li, "class", li_class_value = "snippet " + (/*current_language*/ ctx[2] === /*language*/ ctx[21] ? 'current-lang' : 'inactive-lang') + " svelte-bdjvpc"); }, m(target, anchor) { insert$2(target, li, anchor); append$1(li, img_1); append$1(li, t0); append$1(li, t1); append$1(li, t2); if (!mounted) { dispose = listen$1(li, "click", click_handler); mounted = true; } }, p(new_ctx, dirty) { ctx = new_ctx; if (dirty & /*current_language*/ 4 && li_class_value !== (li_class_value = "snippet " + (/*current_language*/ ctx[2] === /*language*/ ctx[21] ? 'current-lang' : 'inactive-lang') + " svelte-bdjvpc")) { attr$1(li, "class", li_class_value); } }, d(detaching) { if (detaching) { detach$2(li); } mounted = false; dispose(); } }; } // (141:4) {#if Object.keys(info.named_endpoints).length} function create_if_block_3$1(ctx) { let h2; return { c() { h2 = element$1("h2"); h2.textContent = "Endpoints"; attr$1(h2, "class", "header svelte-bdjvpc"); }, m(target, anchor) { insert$2(target, h2, anchor); }, d(detaching) { if (detaching) { detach$2(h2); } } }; } // (146:5) {#if dependency.show_api} function create_if_block_2$1(ctx) { let div; let codesnippets; let t0; let responseobject; let t1; let current; codesnippets = new CodeSnippets({ props: { named: true, endpoint_parameters: /*info*/ ctx[5].named_endpoints["/" + /*dependency*/ ctx[18].api_name].parameters, js_parameters: /*js_info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[18].api_name].parameters, dependency: /*dependency*/ ctx[18], dependency_index: /*dependency_index*/ ctx[20], current_language: /*current_language*/ ctx[2], root: /*root*/ ctx[0], dependency_failures: /*dependency_failures*/ ctx[4] } }); responseobject = new ResponseObject({ props: { endpoint_returns: /*info*/ ctx[5].named_endpoints["/" + /*dependency*/ ctx[18].api_name].returns, js_returns: /*js_info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[18].api_name].returns, is_running: /*is_running*/ ctx[3], current_language: /*current_language*/ ctx[2] } }); return { c() { div = element$1("div"); create_component$3(codesnippets.$$.fragment); t0 = space$1(); create_component$3(responseobject.$$.fragment); t1 = space$1(); attr$1(div, "class", "endpoint-container svelte-bdjvpc"); }, m(target, anchor) { insert$2(target, div, anchor); mount_component$3(codesnippets, div, null); append$1(div, t0); mount_component$3(responseobject, div, null); append$1(div, t1); current = true; }, p(ctx, dirty) { const codesnippets_changes = {}; if (dirty & /*info, dependencies*/ 34) codesnippets_changes.endpoint_parameters = /*info*/ ctx[5].named_endpoints["/" + /*dependency*/ ctx[18].api_name].parameters; if (dirty & /*js_info, dependencies*/ 66) codesnippets_changes.js_parameters = /*js_info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[18].api_name].parameters; if (dirty & /*dependencies*/ 2) codesnippets_changes.dependency = /*dependency*/ ctx[18]; if (dirty & /*current_language*/ 4) codesnippets_changes.current_language = /*current_language*/ ctx[2]; if (dirty & /*root*/ 1) codesnippets_changes.root = /*root*/ ctx[0]; if (dirty & /*dependency_failures*/ 16) codesnippets_changes.dependency_failures = /*dependency_failures*/ ctx[4]; codesnippets.$set(codesnippets_changes); const responseobject_changes = {}; if (dirty & /*info, dependencies*/ 34) responseobject_changes.endpoint_returns = /*info*/ ctx[5].named_endpoints["/" + /*dependency*/ ctx[18].api_name].returns; if (dirty & /*js_info, dependencies*/ 66) responseobject_changes.js_returns = /*js_info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[18].api_name].returns; if (dirty & /*is_running*/ 8) responseobject_changes.is_running = /*is_running*/ ctx[3]; if (dirty & /*current_language*/ 4) responseobject_changes.current_language = /*current_language*/ ctx[2]; responseobject.$set(responseobject_changes); }, i(local) { if (current) return; transition_in$3(codesnippets.$$.fragment, local); transition_in$3(responseobject.$$.fragment, local); current = true; }, o(local) { transition_out$3(codesnippets.$$.fragment, local); transition_out$3(responseobject.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$2(div); } destroy_component$3(codesnippets); destroy_component$3(responseobject); } }; } // (145:4) {#each dependencies as dependency, dependency_index} function create_each_block$1(ctx) { let if_block_anchor; let current; let if_block = /*dependency*/ ctx[18].show_api && create_if_block_2$1(ctx); return { c() { if (if_block) if_block.c(); if_block_anchor = empty$2(); }, m(target, anchor) { if (if_block) if_block.m(target, anchor); insert$2(target, if_block_anchor, anchor); current = true; }, p(ctx, dirty) { if (/*dependency*/ ctx[18].show_api) { if (if_block) { if_block.p(ctx, dirty); if (dirty & /*dependencies*/ 2) { transition_in$3(if_block, 1); } } else { if_block = create_if_block_2$1(ctx); if_block.c(); transition_in$3(if_block, 1); if_block.m(if_block_anchor.parentNode, if_block_anchor); } } else if (if_block) { group_outros$2(); transition_out$3(if_block, 1, 1, () => { if_block = null; }); check_outros$2(); } }, i(local) { if (current) return; transition_in$3(if_block); current = true; }, o(local) { transition_out$3(if_block); current = false; }, d(detaching) { if (detaching) { detach$2(if_block_anchor); } if (if_block) if_block.d(detaching); } }; } function create_fragment$3(ctx) { let if_block_anchor; let current; let if_block = /*info*/ ctx[5] && create_if_block$2(ctx); return { c() { if (if_block) if_block.c(); if_block_anchor = empty$2(); }, m(target, anchor) { if (if_block) if_block.m(target, anchor); insert$2(target, if_block_anchor, anchor); current = true; }, p(ctx, [dirty]) { if (/*info*/ ctx[5]) { if (if_block) { if_block.p(ctx, dirty); if (dirty & /*info*/ 32) { transition_in$3(if_block, 1); } } else { if_block = create_if_block$2(ctx); if_block.c(); transition_in$3(if_block, 1); if_block.m(if_block_anchor.parentNode, if_block_anchor); } } else if (if_block) { group_outros$2(); transition_out$3(if_block, 1, 1, () => { if_block = null; }); check_outros$2(); } }, i(local) { if (current) return; transition_in$3(if_block); current = true; }, o(local) { transition_out$3(if_block); current = false; }, d(detaching) { if (detaching) { detach$2(if_block_anchor); } if (if_block) if_block.d(detaching); } }; } const func = dependency => dependency.show_api; const func_1 = dependency => dependency.show_api; function instance$3($$self, $$props, $$invalidate) { let { instance_map } = $$props; let { dependencies } = $$props; let { root } = $$props; let { app } = $$props; if (root === "") { root = location.protocol + "//" + location.host + location.pathname; } if (!root.endsWith("/")) { root += "/"; } let current_language = "python"; const langs = [["python", python], ["javascript", javascript]]; let is_running = false; dependencies.map(dependency => dependency.inputs.map(_id => { let default_data = instance_map[_id].documentation?.example_data; if (default_data === undefined) { default_data = ""; } else if (typeof default_data === "object") { default_data = JSON.stringify(default_data); } return default_data; })); dependencies.map(dependency => new Array(dependency.outputs.length)); let dependency_failures = dependencies.map(dependency => new Array(dependency.inputs.length).fill(false)); async function get_info() { let response = await fetch(root + "info"); let data = await response.json(); return data; } async function get_js_info() { let js_api_info = await app.view_api(); return js_api_info; } let info; let js_info; get_info().then(data => { $$invalidate(5, info = data); }); get_js_info().then(js_api_info => { $$invalidate(6, js_info = js_api_info); }); onMount$2(() => { document.body.style.overflow = "hidden"; if ("parentIFrame" in window) { window.parentIFrame?.scrollTo(0, 0); } return () => { document.body.style.overflow = "auto"; }; }); function close_handler(event) { bubble$1.call(this, $$self, event); } const click_handler = language => $$invalidate(2, current_language = language); function close_handler_1(event) { bubble$1.call(this, $$self, event); } $$self.$$set = $$props => { if ('instance_map' in $$props) $$invalidate(8, instance_map = $$props.instance_map); if ('dependencies' in $$props) $$invalidate(1, dependencies = $$props.dependencies); if ('root' in $$props) $$invalidate(0, root = $$props.root); if ('app' in $$props) $$invalidate(9, app = $$props.app); }; return [ root, dependencies, current_language, is_running, dependency_failures, info, js_info, langs, instance_map, app, close_handler, click_handler, close_handler_1 ]; } class ApiDocs extends SvelteComponent$3 { constructor(options) { super(); init$3(this, options, instance$3, create_fragment$3, safe_not_equal$3, { instance_map: 8, dependencies: 1, root: 0, app: 9 }); } } get_store_value($format); class Gradio { #id; #el; constructor(id, el, theme, version, root, autoscroll) { this.#id = id; this.theme = theme; this.version = version; this.#el = el; this.i18n = get_store_value($format); this.root = root; this.autoscroll = autoscroll; } dispatch(event_name, data) { const e = new CustomEvent("gradio", { bubbles: true, detail: { data, id: this.#id, event: event_name } }); this.#el.dispatchEvent(e); } } /* src/Render.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$2, add_flush_callback, assign, bind, binding_callbacks, bubble, check_outros: check_outros$1, construct_svelte_component, create_component: create_component$2, destroy_component: destroy_component$2, detach: detach$1, empty: empty$1, ensure_array_like, get_spread_object, get_spread_update, group_outros: group_outros$1, init: init$2, insert: insert$1, mount_component: mount_component$2, outro_and_destroy_block, safe_not_equal: safe_not_equal$2, transition_in: transition_in$2, transition_out: transition_out$2, update_keyed_each } = window.__gradio__svelte__internal;const { onMount: onMount$1, createEventDispatcher: createEventDispatcher$1, setContext } = window.__gradio__svelte__internal; function get_each_context(ctx, list, i) { const child_ctx = ctx.slice(); child_ctx[10] = list[i].component; child_ctx[19] = list[i].id; child_ctx[2] = list[i].props; child_ctx[20] = list[i].children; child_ctx[21] = list[i].has_modes; return child_ctx; } // (69:1) {#if children && children.length} function create_if_block$1(ctx) { let each_blocks = []; let each_1_lookup = new Map(); let each_1_anchor; let current; let each_value = ensure_array_like(/*children*/ ctx[1]); const get_key = ctx => /*each_id*/ ctx[19]; for (let i = 0; i < each_value.length; i += 1) { let child_ctx = get_each_context(ctx, each_value, i); let key = get_key(child_ctx); each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx)); } return { c() { for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].c(); } each_1_anchor = empty$1(); }, m(target, anchor) { for (let i = 0; i < each_blocks.length; i += 1) { if (each_blocks[i]) { each_blocks[i].m(target, anchor); } } insert$1(target, each_1_anchor, anchor); current = true; }, p(ctx, dirty) { if (dirty & /*children, target, root, instance_map, dynamic_ids, theme_mode*/ 235) { each_value = ensure_array_like(/*children*/ ctx[1]); group_outros$1(); each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, each_1_anchor.parentNode, outro_and_destroy_block, create_each_block, each_1_anchor, get_each_context); check_outros$1(); } }, i(local) { if (current) return; for (let i = 0; i < each_value.length; i += 1) { transition_in$2(each_blocks[i]); } current = true; }, o(local) { for (let i = 0; i < each_blocks.length; i += 1) { transition_out$2(each_blocks[i]); } current = false; }, d(detaching) { if (detaching) { detach$1(each_1_anchor); } for (let i = 0; i < each_blocks.length; i += 1) { each_blocks[i].d(detaching); } } }; } // (70:2) {#each children as { component, id: each_id, props, children: _children, has_modes } function create_each_block(key_1, ctx) { let first; let render; let current; render = new Render({ props: { component: /*component*/ ctx[10], target: /*target*/ ctx[6], id: /*each_id*/ ctx[19], props: /*props*/ ctx[2], root: /*root*/ ctx[3], instance_map: /*instance_map*/ ctx[0], children: /*_children*/ ctx[20], dynamic_ids: /*dynamic_ids*/ ctx[5], has_modes: /*has_modes*/ ctx[21], theme_mode: /*theme_mode*/ ctx[7] } }); render.$on("destroy", /*destroy_handler*/ ctx[13]); render.$on("mount", /*mount_handler*/ ctx[14]); return { key: key_1, first: null, c() { first = empty$1(); create_component$2(render.$$.fragment); this.first = first; }, m(target, anchor) { insert$1(target, first, anchor); mount_component$2(render, target, anchor); current = true; }, p(new_ctx, dirty) { ctx = new_ctx; const render_changes = {}; if (dirty & /*children*/ 2) render_changes.component = /*component*/ ctx[10]; if (dirty & /*target*/ 64) render_changes.target = /*target*/ ctx[6]; if (dirty & /*children*/ 2) render_changes.id = /*each_id*/ ctx[19]; if (dirty & /*children*/ 2) render_changes.props = /*props*/ ctx[2]; if (dirty & /*root*/ 8) render_changes.root = /*root*/ ctx[3]; if (dirty & /*instance_map*/ 1) render_changes.instance_map = /*instance_map*/ ctx[0]; if (dirty & /*children*/ 2) render_changes.children = /*_children*/ ctx[20]; if (dirty & /*dynamic_ids*/ 32) render_changes.dynamic_ids = /*dynamic_ids*/ ctx[5]; if (dirty & /*children*/ 2) render_changes.has_modes = /*has_modes*/ ctx[21]; if (dirty & /*theme_mode*/ 128) render_changes.theme_mode = /*theme_mode*/ ctx[7]; render.$set(render_changes); }, i(local) { if (current) return; transition_in$2(render.$$.fragment, local); current = true; }, o(local) { transition_out$2(render.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$1(first); } destroy_component$2(render, detaching); } }; } // (56:0) function create_default_slot(ctx) { let if_block_anchor; let current; let if_block = /*children*/ ctx[1] && /*children*/ ctx[1].length && create_if_block$1(ctx); return { c() { if (if_block) if_block.c(); if_block_anchor = empty$1(); }, m(target, anchor) { if (if_block) if_block.m(target, anchor); insert$1(target, if_block_anchor, anchor); current = true; }, p(ctx, dirty) { if (/*children*/ ctx[1] && /*children*/ ctx[1].length) { if (if_block) { if_block.p(ctx, dirty); if (dirty & /*children*/ 2) { transition_in$2(if_block, 1); } } else { if_block = create_if_block$1(ctx); if_block.c(); transition_in$2(if_block, 1); if_block.m(if_block_anchor.parentNode, if_block_anchor); } } else if (if_block) { group_outros$1(); transition_out$2(if_block, 1, 1, () => { if_block = null; }); check_outros$1(); } }, i(local) { if (current) return; transition_in$2(if_block); current = true; }, o(local) { transition_out$2(if_block); current = false; }, d(detaching) { if (detaching) { detach$1(if_block_anchor); } if (if_block) if_block.d(detaching); } }; } function create_fragment$2(ctx) { let switch_instance; let updating_value; let switch_instance_anchor; let current; const switch_instance_spread_levels = [ { elem_id: "elem_id" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_id || `component-${/*id*/ ctx[4]}` }, { elem_classes: "elem_classes" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_classes || [] }, { target: /*target*/ ctx[6] }, /*props*/ ctx[2], { theme_mode: /*theme_mode*/ ctx[7] }, { root: /*root*/ ctx[3] }, { gradio: new Gradio(/*id*/ ctx[4], /*target*/ ctx[6], /*theme_mode*/ ctx[7], /*version*/ ctx[8], /*root*/ ctx[3], /*autoscroll*/ ctx[9]) } ]; function switch_instance_value_binding(value) { /*switch_instance_value_binding*/ ctx[16](value); } var switch_value = /*component*/ ctx[10]; function switch_props(ctx, dirty) { let switch_instance_props = { $$slots: { default: [create_default_slot] }, $$scope: { ctx } }; if (dirty !== undefined && dirty & /*props, id, target, theme_mode, root, version, autoscroll*/ 988) { switch_instance_props = get_spread_update(switch_instance_spread_levels, [ dirty & /*props, id*/ 20 && { elem_id: "elem_id" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_id || `component-${/*id*/ ctx[4]}` }, dirty & /*props*/ 4 && { elem_classes: "elem_classes" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_classes || [] }, dirty & /*target*/ 64 && { target: /*target*/ ctx[6] }, dirty & /*props*/ 4 && get_spread_object(/*props*/ ctx[2]), dirty & /*theme_mode*/ 128 && { theme_mode: /*theme_mode*/ ctx[7] }, dirty & /*root*/ 8 && { root: /*root*/ ctx[3] }, dirty & /*id, target, theme_mode, version, root, autoscroll*/ 984 && { gradio: new Gradio(/*id*/ ctx[4], /*target*/ ctx[6], /*theme_mode*/ ctx[7], /*version*/ ctx[8], /*root*/ ctx[3], /*autoscroll*/ ctx[9]) } ]); } else { for (let i = 0; i < switch_instance_spread_levels.length; i += 1) { switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); } } if (/*instance_map*/ ctx[0][/*id*/ ctx[4]].props.value !== void 0) { switch_instance_props.value = /*instance_map*/ ctx[0][/*id*/ ctx[4]].props.value; } return { props: switch_instance_props }; } if (switch_value) { switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); /*switch_instance_binding*/ ctx[15](switch_instance); binding_callbacks.push(() => bind(switch_instance, 'value', switch_instance_value_binding)); switch_instance.$on("prop_change", /*handle_prop_change*/ ctx[11]); } return { c() { if (switch_instance) create_component$2(switch_instance.$$.fragment); switch_instance_anchor = empty$1(); }, m(target, anchor) { if (switch_instance) mount_component$2(switch_instance, target, anchor); insert$1(target, switch_instance_anchor, anchor); current = true; }, p(ctx, [dirty]) { if (dirty & /*component*/ 1024 && switch_value !== (switch_value = /*component*/ ctx[10])) { if (switch_instance) { group_outros$1(); const old_component = switch_instance; transition_out$2(old_component.$$.fragment, 1, 0, () => { destroy_component$2(old_component, 1); }); check_outros$1(); } if (switch_value) { switch_instance = construct_svelte_component(switch_value, switch_props(ctx, dirty)); /*switch_instance_binding*/ ctx[15](switch_instance); binding_callbacks.push(() => bind(switch_instance, 'value', switch_instance_value_binding)); switch_instance.$on("prop_change", /*handle_prop_change*/ ctx[11]); create_component$2(switch_instance.$$.fragment); transition_in$2(switch_instance.$$.fragment, 1); mount_component$2(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); } else { switch_instance = null; } } else if (switch_value) { const switch_instance_changes = (dirty & /*props, id, target, theme_mode, root, version, autoscroll*/ 988) ? get_spread_update(switch_instance_spread_levels, [ dirty & /*props, id*/ 20 && { elem_id: "elem_id" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_id || `component-${/*id*/ ctx[4]}` }, dirty & /*props*/ 4 && { elem_classes: "elem_classes" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_classes || [] }, dirty & /*target*/ 64 && { target: /*target*/ ctx[6] }, dirty & /*props*/ 4 && get_spread_object(/*props*/ ctx[2]), dirty & /*theme_mode*/ 128 && { theme_mode: /*theme_mode*/ ctx[7] }, dirty & /*root*/ 8 && { root: /*root*/ ctx[3] }, dirty & /*id, target, theme_mode, version, root, autoscroll*/ 984 && { gradio: new Gradio(/*id*/ ctx[4], /*target*/ ctx[6], /*theme_mode*/ ctx[7], /*version*/ ctx[8], /*root*/ ctx[3], /*autoscroll*/ ctx[9]) } ]) : {}; if (dirty & /*$$scope, children, target, root, instance_map, dynamic_ids, theme_mode*/ 16777451) { switch_instance_changes.$$scope = { dirty, ctx }; } if (!updating_value && dirty & /*instance_map, id*/ 17) { updating_value = true; switch_instance_changes.value = /*instance_map*/ ctx[0][/*id*/ ctx[4]].props.value; add_flush_callback(() => updating_value = false); } switch_instance.$set(switch_instance_changes); } }, i(local) { if (current) return; if (switch_instance) transition_in$2(switch_instance.$$.fragment, local); current = true; }, o(local) { if (switch_instance) transition_out$2(switch_instance.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach$1(switch_instance_anchor); } /*switch_instance_binding*/ ctx[15](null); if (switch_instance) destroy_component$2(switch_instance, detaching); } }; } function instance$2($$self, $$props, $$invalidate) { let { root } = $$props; let { component } = $$props; let { instance_map } = $$props; let { id } = $$props; let { props } = $$props; let { children } = $$props; let { dynamic_ids } = $$props; let { parent = null } = $$props; let { target } = $$props; let { theme_mode } = $$props; let { version } = $$props; let { autoscroll } = $$props; const dispatch = createEventDispatcher$1(); let filtered_children = []; onMount$1(() => { dispatch("mount", id); for (const child of filtered_children) { dispatch("mount", child.id); } return () => { dispatch("destroy", id); for (const child of filtered_children) { dispatch("mount", child.id); } }; }); setContext("BLOCK_KEY", parent); function handle_prop_change(e) { for (const k in e.detail) { $$invalidate(0, instance_map[id].props[k] = e.detail[k], instance_map); } } function destroy_handler(event) { bubble.call(this, $$self, event); } function mount_handler(event) { bubble.call(this, $$self, event); } function switch_instance_binding($$value) { binding_callbacks[$$value ? 'unshift' : 'push'](() => { instance_map[id].instance = $$value; $$invalidate(0, instance_map); }); } function switch_instance_value_binding(value) { if ($$self.$$.not_equal(instance_map[id].props.value, value)) { instance_map[id].props.value = value; $$invalidate(0, instance_map); } } $$self.$$set = $$props => { if ('root' in $$props) $$invalidate(3, root = $$props.root); if ('component' in $$props) $$invalidate(10, component = $$props.component); if ('instance_map' in $$props) $$invalidate(0, instance_map = $$props.instance_map); if ('id' in $$props) $$invalidate(4, id = $$props.id); if ('props' in $$props) $$invalidate(2, props = $$props.props); if ('children' in $$props) $$invalidate(1, children = $$props.children); if ('dynamic_ids' in $$props) $$invalidate(5, dynamic_ids = $$props.dynamic_ids); if ('parent' in $$props) $$invalidate(12, parent = $$props.parent); if ('target' in $$props) $$invalidate(6, target = $$props.target); if ('theme_mode' in $$props) $$invalidate(7, theme_mode = $$props.theme_mode); if ('version' in $$props) $$invalidate(8, version = $$props.version); if ('autoscroll' in $$props) $$invalidate(9, autoscroll = $$props.autoscroll); }; $$self.$$.update = () => { if ($$self.$$.dirty & /*children, instance_map*/ 3) { $$invalidate(1, children = children && children.filter(v => { const valid_node = instance_map[v.id].type !== "statustracker"; if (!valid_node) { filtered_children.push(v); } return valid_node; })); } if ($$self.$$.dirty & /*instance_map, id, children*/ 19) { { if (instance_map[id].type === "form") { if (children?.every(c => !c.props.visible)) { $$invalidate(2, props.visible = false, props); } else { $$invalidate(2, props.visible = true, props); } } } } }; return [ instance_map, children, props, root, id, dynamic_ids, target, theme_mode, version, autoscroll, component, handle_prop_change, parent, destroy_handler, mount_handler, switch_instance_binding, switch_instance_value_binding ]; } class Render extends SvelteComponent$2 { constructor(options) { super(); init$2(this, options, instance$2, create_fragment$2, safe_not_equal$2, { root: 3, component: 10, instance_map: 0, id: 4, props: 2, children: 1, dynamic_ids: 5, parent: 12, target: 6, theme_mode: 7, version: 8, autoscroll: 9 }); } } /* src/MountComponents.svelte generated by Svelte v4.2.2 */ const { SvelteComponent: SvelteComponent$1, create_component: create_component$1, destroy_component: destroy_component$1, init: init$1, mount_component: mount_component$1, safe_not_equal: safe_not_equal$1, transition_in: transition_in$1, transition_out: transition_out$1 } = window.__gradio__svelte__internal; const { onMount, createEventDispatcher } = window.__gradio__svelte__internal; function create_fragment$1(ctx) { let render; let current; render = new Render({ props: { component: /*rootNode*/ ctx[0].component, id: /*rootNode*/ ctx[0].id, props: /*rootNode*/ ctx[0].props, children: /*rootNode*/ ctx[0].children, dynamic_ids: /*dynamic_ids*/ ctx[1], instance_map: /*instance_map*/ ctx[2], root: /*root*/ ctx[3], target: /*target*/ ctx[4], theme_mode: /*theme_mode*/ ctx[5], version: /*version*/ ctx[6], autoscroll: /*autoscroll*/ ctx[7] } }); return { c() { create_component$1(render.$$.fragment); }, m(target, anchor) { mount_component$1(render, target, anchor); current = true; }, p(ctx, [dirty]) { const render_changes = {}; if (dirty & /*rootNode*/ 1) render_changes.component = /*rootNode*/ ctx[0].component; if (dirty & /*rootNode*/ 1) render_changes.id = /*rootNode*/ ctx[0].id; if (dirty & /*rootNode*/ 1) render_changes.props = /*rootNode*/ ctx[0].props; if (dirty & /*rootNode*/ 1) render_changes.children = /*rootNode*/ ctx[0].children; if (dirty & /*dynamic_ids*/ 2) render_changes.dynamic_ids = /*dynamic_ids*/ ctx[1]; if (dirty & /*instance_map*/ 4) render_changes.instance_map = /*instance_map*/ ctx[2]; if (dirty & /*root*/ 8) render_changes.root = /*root*/ ctx[3]; if (dirty & /*target*/ 16) render_changes.target = /*target*/ ctx[4]; if (dirty & /*theme_mode*/ 32) render_changes.theme_mode = /*theme_mode*/ ctx[5]; if (dirty & /*version*/ 64) render_changes.version = /*version*/ ctx[6]; if (dirty & /*autoscroll*/ 128) render_changes.autoscroll = /*autoscroll*/ ctx[7]; render.$set(render_changes); }, i(local) { if (current) return; transition_in$1(render.$$.fragment, local); current = true; }, o(local) { transition_out$1(render.$$.fragment, local); current = false; }, d(detaching) { destroy_component$1(render, detaching); } }; } function instance$1($$self, $$props, $$invalidate) { let { rootNode } = $$props; let { dynamic_ids } = $$props; let { instance_map } = $$props; let { root } = $$props; let { target } = $$props; let { theme_mode } = $$props; let { version } = $$props; let { autoscroll } = $$props; const dispatch = createEventDispatcher(); onMount(() => { dispatch("mount"); }); $$self.$$set = $$props => { if ('rootNode' in $$props) $$invalidate(0, rootNode = $$props.rootNode); if ('dynamic_ids' in $$props) $$invalidate(1, dynamic_ids = $$props.dynamic_ids); if ('instance_map' in $$props) $$invalidate(2, instance_map = $$props.instance_map); if ('root' in $$props) $$invalidate(3, root = $$props.root); if ('target' in $$props) $$invalidate(4, target = $$props.target); if ('theme_mode' in $$props) $$invalidate(5, theme_mode = $$props.theme_mode); if ('version' in $$props) $$invalidate(6, version = $$props.version); if ('autoscroll' in $$props) $$invalidate(7, autoscroll = $$props.autoscroll); }; return [ rootNode, dynamic_ids, instance_map, root, target, theme_mode, version, autoscroll ]; } class MountComponents extends SvelteComponent$1 { constructor(options) { super(); init$1(this, options, instance$1, create_fragment$1, safe_not_equal$1, { rootNode: 0, dynamic_ids: 1, instance_map: 2, root: 3, target: 4, theme_mode: 5, version: 6, autoscroll: 7 }); } } const logo = ""+new URL('logo-3707f936.svg', import.meta.url).href+""; const Blocks_svelte_svelte_type_style_lang = ''; /* src/Blocks.svelte generated by Svelte v4.2.2 */ const { SvelteComponent, append, attr, check_outros, component_subscribe, create_component, destroy_component, detach, element, empty, globals, group_outros, init, insert, listen, mount_component, noop, safe_not_equal, set_data, set_style, space, src_url_equal, subscribe, text, transition_in, transition_out } = window.__gradio__svelte__internal; const { document: document_1 } = globals; const { tick } = window.__gradio__svelte__internal; function create_if_block_6(ctx) { document_1.title = /*title*/ ctx[3]; return { c: noop, m: noop, d: noop }; } // (531:1) {#if analytics_enabled} function create_if_block_5(ctx) { let script0; let script0_src_value; let t0; let script1; return { c() { script0 = element("script"); script0.innerHTML = ``; t0 = space(); script1 = element("script"); script1.textContent = "window.dataLayer = window.dataLayer || [];\n\t\t\tfunction gtag() {\n\t\t\t\tdataLayer.push(arguments);\n\t\t\t}\n\t\t\tgtag(\"js\", new Date());\n\t\t\tgtag(\"config\", \"UA-156449732-1\", {\n\t\t\t\tcookie_flags: \"samesite=none;secure\"\n\t\t\t});"; script0.async = true; script0.defer = true; if (!src_url_equal(script0.src, script0_src_value = "https://www.googletagmanager.com/gtag/js?id=UA-156449732-1")) attr(script0, "src", script0_src_value); }, m(target, anchor) { insert(target, script0, anchor); insert(target, t0, anchor); insert(target, script1, anchor); }, d(detaching) { if (detaching) { detach(script0); detach(t0); detach(script1); } } }; } // (552:2) {#if ready} function create_if_block_4(ctx) { let mountcomponents; let current; mountcomponents = new MountComponents({ props: { rootNode: /*rootNode*/ ctx[15], dynamic_ids: /*dynamic_ids*/ ctx[17], instance_map: /*instance_map*/ ctx[18], root: /*root*/ ctx[1], target: /*target*/ ctx[5], theme_mode: /*theme_mode*/ ctx[11], version: /*version*/ ctx[13], autoscroll: /*autoscroll*/ ctx[6] } }); mountcomponents.$on("mount", /*handle_mount*/ ctx[23]); mountcomponents.$on("destroy", /*destroy_handler*/ ctx[31]); return { c() { create_component(mountcomponents.$$.fragment); }, m(target, anchor) { mount_component(mountcomponents, target, anchor); current = true; }, p(ctx, dirty) { const mountcomponents_changes = {}; if (dirty[0] & /*rootNode*/ 32768) mountcomponents_changes.rootNode = /*rootNode*/ ctx[15]; if (dirty[0] & /*dynamic_ids*/ 131072) mountcomponents_changes.dynamic_ids = /*dynamic_ids*/ ctx[17]; if (dirty[0] & /*instance_map*/ 262144) mountcomponents_changes.instance_map = /*instance_map*/ ctx[18]; if (dirty[0] & /*root*/ 2) mountcomponents_changes.root = /*root*/ ctx[1]; if (dirty[0] & /*target*/ 32) mountcomponents_changes.target = /*target*/ ctx[5]; if (dirty[0] & /*theme_mode*/ 2048) mountcomponents_changes.theme_mode = /*theme_mode*/ ctx[11]; if (dirty[0] & /*version*/ 8192) mountcomponents_changes.version = /*version*/ ctx[13]; if (dirty[0] & /*autoscroll*/ 64) mountcomponents_changes.autoscroll = /*autoscroll*/ ctx[6]; mountcomponents.$set(mountcomponents_changes); }, i(local) { if (current) return; transition_in(mountcomponents.$$.fragment, local); current = true; }, o(local) { transition_out(mountcomponents.$$.fragment, local); current = false; }, d(detaching) { destroy_component(mountcomponents, detaching); } }; } // (568:1) {#if show_footer} function create_if_block_2(ctx) { let footer; let t0; let a; let t1_value = /*$_*/ ctx[20]("common.built_with_gradio") + ""; let t1; let t2; let img; let img_src_value; let img_alt_value; let if_block = /*show_api*/ ctx[7] && create_if_block_3(ctx); return { c() { footer = element("footer"); if (if_block) if_block.c(); t0 = space(); a = element("a"); t1 = text(t1_value); t2 = space(); img = element("img"); if (!src_url_equal(img.src, img_src_value = logo)) attr(img, "src", img_src_value); attr(img, "alt", img_alt_value = /*$_*/ ctx[20]("common.logo")); attr(img, "class", "svelte-mpyp5e"); attr(a, "href", "https://gradio.app"); attr(a, "class", "built-with svelte-mpyp5e"); attr(a, "target", "_blank"); attr(a, "rel", "noreferrer"); attr(footer, "class", "svelte-mpyp5e"); }, m(target, anchor) { insert(target, footer, anchor); if (if_block) if_block.m(footer, null); append(footer, t0); append(footer, a); append(a, t1); append(a, t2); append(a, img); }, p(ctx, dirty) { if (/*show_api*/ ctx[7]) { if (if_block) { if_block.p(ctx, dirty); } else { if_block = create_if_block_3(ctx); if_block.c(); if_block.m(footer, t0); } } else if (if_block) { if_block.d(1); if_block = null; } if (dirty[0] & /*$_*/ 1048576 && t1_value !== (t1_value = /*$_*/ ctx[20]("common.built_with_gradio") + "")) set_data(t1, t1_value); if (dirty[0] & /*$_*/ 1048576 && img_alt_value !== (img_alt_value = /*$_*/ ctx[20]("common.logo"))) { attr(img, "alt", img_alt_value); } }, d(detaching) { if (detaching) { detach(footer); } if (if_block) if_block.d(); } }; } // (570:3) {#if show_api} function create_if_block_3(ctx) { let button; let t0_value = /*$_*/ ctx[20]("errors.use_via_api") + ""; let t0; let t1; let img; let img_src_value; let img_alt_value; let t2; let div; let mounted; let dispose; return { c() { button = element("button"); t0 = text(t0_value); t1 = space(); img = element("img"); t2 = space(); div = element("div"); div.textContent = "·"; if (!src_url_equal(img.src, img_src_value = api_logo)) attr(img, "src", img_src_value); attr(img, "alt", img_alt_value = /*$_*/ ctx[20]("common.logo")); attr(img, "class", "svelte-mpyp5e"); attr(button, "class", "show-api svelte-mpyp5e"); attr(div, "class", "svelte-mpyp5e"); }, m(target, anchor) { insert(target, button, anchor); append(button, t0); append(button, t1); append(button, img); insert(target, t2, anchor); insert(target, div, anchor); if (!mounted) { dispose = listen(button, "click", /*click_handler*/ ctx[32]); mounted = true; } }, p(ctx, dirty) { if (dirty[0] & /*$_*/ 1048576 && t0_value !== (t0_value = /*$_*/ ctx[20]("errors.use_via_api") + "")) set_data(t0, t0_value); if (dirty[0] & /*$_*/ 1048576 && img_alt_value !== (img_alt_value = /*$_*/ ctx[20]("common.logo"))) { attr(img, "alt", img_alt_value); } }, d(detaching) { if (detaching) { detach(button); detach(t2); detach(div); } mounted = false; dispose(); } }; } // (595:0) {#if api_docs_visible && ready} function create_if_block_1(ctx) { let div2; let div0; let t; let div1; let apidocs; let current; let mounted; let dispose; apidocs = new ApiDocs({ props: { instance_map: /*instance_map*/ ctx[18], dependencies: /*dependencies*/ ctx[2], root: /*root*/ ctx[1], app: /*app*/ ctx[12] } }); apidocs.$on("close", /*close_handler*/ ctx[34]); return { c() { div2 = element("div"); div0 = element("div"); t = space(); div1 = element("div"); create_component(apidocs.$$.fragment); attr(div0, "class", "backdrop svelte-mpyp5e"); attr(div1, "class", "api-docs-wrap svelte-mpyp5e"); attr(div2, "class", "api-docs svelte-mpyp5e"); }, m(target, anchor) { insert(target, div2, anchor); append(div2, div0); append(div2, t); append(div2, div1); mount_component(apidocs, div1, null); current = true; if (!mounted) { dispose = listen(div0, "click", /*click_handler_1*/ ctx[33]); mounted = true; } }, p(ctx, dirty) { const apidocs_changes = {}; if (dirty[0] & /*instance_map*/ 262144) apidocs_changes.instance_map = /*instance_map*/ ctx[18]; if (dirty[0] & /*dependencies*/ 4) apidocs_changes.dependencies = /*dependencies*/ ctx[2]; if (dirty[0] & /*root*/ 2) apidocs_changes.root = /*root*/ ctx[1]; if (dirty[0] & /*app*/ 4096) apidocs_changes.app = /*app*/ ctx[12]; apidocs.$set(apidocs_changes); }, i(local) { if (current) return; transition_in(apidocs.$$.fragment, local); current = true; }, o(local) { transition_out(apidocs.$$.fragment, local); current = false; }, d(detaching) { if (detaching) { detach(div2); } destroy_component(apidocs); mounted = false; dispose(); } }; } // (620:0) {#if messages} function create_if_block(ctx) { let toast; let current; toast = new Toast({ props: { messages: /*messages*/ ctx[19] } }); toast.$on("close", /*handle_error_close*/ ctx[22]); return { c() { create_component(toast.$$.fragment); }, m(target, anchor) { mount_component(toast, target, anchor); current = true; }, p(ctx, dirty) { const toast_changes = {}; if (dirty[0] & /*messages*/ 524288) toast_changes.messages = /*messages*/ ctx[19]; toast.$set(toast_changes); }, i(local) { if (current) return; transition_in(toast.$$.fragment, local); current = true; }, o(local) { transition_out(toast.$$.fragment, local); current = false; }, d(detaching) { destroy_component(toast, detaching); } }; } function create_fragment(ctx) { let if_block0_anchor; let if_block1_anchor; let t0; let div1; let div0; let t1; let t2; let t3; let if_block5_anchor; let current; let if_block0 = /*control_page_title*/ ctx[9] && create_if_block_6(ctx); let if_block1 = /*analytics_enabled*/ ctx[4] && create_if_block_5(); let if_block2 = /*ready*/ ctx[0] && create_if_block_4(ctx); let if_block3 = /*show_footer*/ ctx[8] && create_if_block_2(ctx); let if_block4 = /*api_docs_visible*/ ctx[16] && /*ready*/ ctx[0] && create_if_block_1(ctx); let if_block5 = /*messages*/ ctx[19] && create_if_block(ctx); return { c() { if (if_block0) if_block0.c(); if_block0_anchor = empty(); if (if_block1) if_block1.c(); if_block1_anchor = empty(); t0 = space(); div1 = element("div"); div0 = element("div"); if (if_block2) if_block2.c(); t1 = space(); if (if_block3) if_block3.c(); t2 = space(); if (if_block4) if_block4.c(); t3 = space(); if (if_block5) if_block5.c(); if_block5_anchor = empty(); attr(div0, "class", "contain"); set_style(div0, "flex-grow", /*app_mode*/ ctx[10] ? "1" : "auto"); attr(div1, "class", "wrap svelte-mpyp5e"); set_style(div1, "min-height", /*app_mode*/ ctx[10] ? "100%" : "auto"); }, m(target, anchor) { if (if_block0) if_block0.m(document_1.head, null); append(document_1.head, if_block0_anchor); if (if_block1) if_block1.m(document_1.head, null); append(document_1.head, if_block1_anchor); insert(target, t0, anchor); insert(target, div1, anchor); append(div1, div0); if (if_block2) if_block2.m(div0, null); append(div1, t1); if (if_block3) if_block3.m(div1, null); insert(target, t2, anchor); if (if_block4) if_block4.m(target, anchor); insert(target, t3, anchor); if (if_block5) if_block5.m(target, anchor); insert(target, if_block5_anchor, anchor); current = true; }, p(ctx, dirty) { if (/*control_page_title*/ ctx[9]) { if (if_block0) ; else { if_block0 = create_if_block_6(ctx); if_block0.c(); if_block0.m(if_block0_anchor.parentNode, if_block0_anchor); } } else if (if_block0) { if_block0.d(1); if_block0 = null; } if (/*analytics_enabled*/ ctx[4]) { if (if_block1) ; else { if_block1 = create_if_block_5(); if_block1.c(); if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); } } else if (if_block1) { if_block1.d(1); if_block1 = null; } if (/*ready*/ ctx[0]) { if (if_block2) { if_block2.p(ctx, dirty); if (dirty[0] & /*ready*/ 1) { transition_in(if_block2, 1); } } else { if_block2 = create_if_block_4(ctx); if_block2.c(); transition_in(if_block2, 1); if_block2.m(div0, null); } } else if (if_block2) { group_outros(); transition_out(if_block2, 1, 1, () => { if_block2 = null; }); check_outros(); } if (dirty[0] & /*app_mode*/ 1024) { set_style(div0, "flex-grow", /*app_mode*/ ctx[10] ? "1" : "auto"); } if (/*show_footer*/ ctx[8]) { if (if_block3) { if_block3.p(ctx, dirty); } else { if_block3 = create_if_block_2(ctx); if_block3.c(); if_block3.m(div1, null); } } else if (if_block3) { if_block3.d(1); if_block3 = null; } if (dirty[0] & /*app_mode*/ 1024) { set_style(div1, "min-height", /*app_mode*/ ctx[10] ? "100%" : "auto"); } if (/*api_docs_visible*/ ctx[16] && /*ready*/ ctx[0]) { if (if_block4) { if_block4.p(ctx, dirty); if (dirty[0] & /*api_docs_visible, ready*/ 65537) { transition_in(if_block4, 1); } } else { if_block4 = create_if_block_1(ctx); if_block4.c(); transition_in(if_block4, 1); if_block4.m(t3.parentNode, t3); } } else if (if_block4) { group_outros(); transition_out(if_block4, 1, 1, () => { if_block4 = null; }); check_outros(); } if (/*messages*/ ctx[19]) { if (if_block5) { if_block5.p(ctx, dirty); if (dirty[0] & /*messages*/ 524288) { transition_in(if_block5, 1); } } else { if_block5 = create_if_block(ctx); if_block5.c(); transition_in(if_block5, 1); if_block5.m(if_block5_anchor.parentNode, if_block5_anchor); } } else if (if_block5) { group_outros(); transition_out(if_block5, 1, 1, () => { if_block5 = null; }); check_outros(); } }, i(local) { if (current) return; transition_in(if_block2); transition_in(if_block4); transition_in(if_block5); current = true; }, o(local) { transition_out(if_block2); transition_out(if_block4); transition_out(if_block5); current = false; }, d(detaching) { if (detaching) { detach(t0); detach(div1); detach(t2); detach(t3); detach(if_block5_anchor); } if (if_block0) if_block0.d(detaching); detach(if_block0_anchor); if (if_block1) if_block1.d(detaching); detach(if_block1_anchor); if (if_block2) if_block2.d(); if (if_block3) if_block3.d(); if (if_block4) if_block4.d(detaching); if (if_block5) if_block5.d(detaching); } }; } const MESSAGE_QUOTE_RE = /^'([^]+)'$/; const SHOW_DUPLICATE_MESSAGE_ON_ETA = 15; const SHOW_MOBILE_QUEUE_WARNING_ON_ETA = 10; function is_dep(id, type, deps) { for (const dep of deps) { for (const dep_item of dep[type]) { if (dep_item === id) return true; } } return false; } function has_no_default_value(value) { return Array.isArray(value) && value.length === 0 || value === "" || value === 0 || !value; } function get_data(comp) { if (comp.instance.get_value) { return comp.instance.get_value(); } return comp.props.value; } function isCustomEvent(event) { return "detail" in event; } function instance($$self, $$props, $$invalidate) { let $loading_status, $$unsubscribe_loading_status = noop, $$subscribe_loading_status = () => ($$unsubscribe_loading_status(), $$unsubscribe_loading_status = subscribe(loading_status, $$value => $$invalidate(30, $loading_status = $$value)), loading_status); let $_; component_subscribe($$self, $format, $$value => $$invalidate(20, $_ = $$value)); $$self.$$.on_destroy.push(() => $$unsubscribe_loading_status()); setupi18n(); let { root } = $$props; let { components } = $$props; let { layout } = $$props; let { dependencies } = $$props; let { title = "Gradio" } = $$props; let { analytics_enabled = false } = $$props; let { target } = $$props; let { autoscroll } = $$props; let { show_api = true } = $$props; let { show_footer = true } = $$props; let { control_page_title = false } = $$props; let { app_mode } = $$props; let { theme_mode } = $$props; let { app } = $$props; let { space_id } = $$props; let { version } = $$props; let { js } = $$props; let loading_status = create_loading_status_store(); $$subscribe_loading_status(); let rootNode = { id: layout.id, type: "column", props: { interactive: false }, has_modes: false, instance: null, component: null, component_class_id: "" }; const AsyncFunction = Object.getPrototypeOf(async function () { }).constructor; dependencies.forEach(d => { if (d.js) { const wrap = d.backend_fn ? d.inputs.length === 1 : d.outputs.length === 1; try { d.frontend_fn = new AsyncFunction("__fn_args", `let result = await (${d.js})(...__fn_args); return (${wrap} && !Array.isArray(result)) ? [result] : result;`); } catch(e) { console.error("Could not parse custom js method."); console.error(e); } } }); let params = new URLSearchParams(window.location.search); let api_docs_visible = params.get("view") === "api" && show_api; function set_api_docs_visible(visible) { $$invalidate(16, api_docs_visible = visible); let params = new URLSearchParams(window.location.search); if (visible) { params.set("view", "api"); } else { params.delete("view"); } history.replaceState(null, "", "?" + params.toString()); } let dynamic_ids = new Set(); let instance_map; async function walk_layout(node, type_map, instance_map, component_map) { $$invalidate(0, ready = false); let instance = instance_map[node.id]; const _component = (await component_map.get(`${instance.type}_${type_map.get(node.id) || "false"}`)).component; instance.component = _component.default; if (node.children) { instance.children = node.children.map(v => instance_map[v.id]); await Promise.all(node.children.map(v => walk_layout(v, type_map, instance_map, component_map))); } } let { ready = false } = $$props; let { render_complete = false } = $$props; let target_map = {}; function prepare_components() { target_map = dependencies.reduce( (acc, dep, i) => { dep.targets.forEach(([id, trigger]) => { if (!acc[id]) { acc[id] = {}; } if (acc[id]?.[trigger]) { acc[id][trigger].push(i); } else { acc[id][trigger] = [i]; } }); return acc; }, {} ); $$subscribe_loading_status($$invalidate(14, loading_status = create_loading_status_store())); dependencies.forEach((v, i) => { loading_status.register(i, v.inputs, v.outputs); }); const _dynamic_ids = new Set(); for (const comp of components) { const { id, props } = comp; const is_input = is_dep(id, "inputs", dependencies); if (is_input || !is_dep(id, "outputs", dependencies) && has_no_default_value(props?.value)) { _dynamic_ids.add(id); } } $$invalidate(17, dynamic_ids = _dynamic_ids); const _rootNode = { id: layout.id, type: "column", props: { interactive: false }, has_modes: false, instance: null, component: null, component_class_id: "" }; components.push(_rootNode); const _component_set = new Set(); const __component_map = new Map(); const __type_for_id = new Map(); const _instance_map = components.reduce( (acc, next) => { acc[next.id] = next; return acc; }, {} ); components.forEach(c => { if (c.props.interactive === false) { c.props.interactive = false; } else if (c.props.interactive === true) { c.props.interactive = true; } else if (dynamic_ids.has(c.id)) { c.props.interactive = true; } else { c.props.interactive = false; } if (c.props.server_fns) { let server = {}; c.props.server_fns.forEach(fn => { server[fn] = async (...args) => { if (args.length === 1) { args = args[0]; } const result = await app.component_server(c.id, fn, args); return result; }; }); c.props.server = server; } if (target_map[c.id]) { c.props.attached_events = Object.keys(target_map[c.id]); } __type_for_id.set(c.id, c.props.interactive); if (c.type === "dataset") { const example_component_map = new Map(); c.props.components.forEach(name => { if (example_component_map.has(name)) { return; } let _c; const matching_component = components.find(c => c.type === name); if (matching_component) { _c = load_component({ api_url: root, name, id: matching_component.component_class_id, variant: "example" }); example_component_map.set(name, _c); } }); c.props.component_map = example_component_map; } // maybe load custom const _c = load_component({ api_url: root, name: c.type, id: c.component_class_id, variant: "component" }); _component_set.add(_c); __component_map.set(`${c.type}_${c.props.interactive}`, _c); }); Promise.all(Array.from(_component_set)).then(() => { walk_layout(layout, __type_for_id, _instance_map, __component_map).then(async () => { $$invalidate(0, ready = true); $$invalidate(18, instance_map = _instance_map); $$invalidate(15, rootNode = _rootNode); }).catch(e => { console.error(e); }); }); } async function handle_update(data, fn_index, outputs_set_to_non_interactive) { const outputs = dependencies[fn_index].outputs; data?.forEach((value, i) => { const output = instance_map[outputs[i]]; output.props.value_is_output = true; }); $$invalidate(15, rootNode); await tick(); data?.forEach((value, i) => { const output = instance_map[outputs[i]]; if (typeof value === "object" && value !== null && value.__type__ === "update") { for (const [update_key, update_value] of Object.entries(value)) { if (update_key === "__type__") { continue; } else { output.props[update_key] = update_value; if (update_key == "interactive" && !update_value) { outputs_set_to_non_interactive.push(outputs[i]); } } } } else { output.props.value = value; } }); $$invalidate(15, rootNode); } let submit_map = new Map(); function set_prop(obj, prop, val) { if (!obj?.props) { // @ts-ignore obj.props = {}; } obj.props[prop] = val; $$invalidate(15, rootNode); } let handled_dependencies = []; let messages = []; function new_message(message, fn_index, type) { return { message, fn_index, type, id: ++_error_id }; } let _error_id = -1; let user_left_page = false; document.addEventListener("visibilitychange", function () { if (document.visibilityState === "hidden") { user_left_page = true; } }); const DUPLICATE_MESSAGE = $_("blocks.long_requests_queue"); const MOBILE_QUEUE_WARNING = $_("blocks.connection_can_break"); const MOBILE_RECONNECT_MESSAGE = $_("blocks.lost_connection"); const is_mobile_device = (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i).test(navigator.userAgent); let showed_duplicate_message = false; let showed_mobile_warning = false; async function trigger_api_call(dep_index, trigger_id = null, event_data = null) { let dep = dependencies[dep_index]; const current_status = loading_status.get_status_for_fn(dep_index); $$invalidate(19, messages = messages.filter(({ fn_index }) => fn_index !== dep_index)); if (dep.cancels) { await Promise.all(dep.cancels.map(async fn_index => { const submission = submit_map.get(fn_index); submission?.cancel(); return submission; })); } if (current_status === "pending" || current_status === "generating") { dep.pending_request = true; } let payload = { fn_index: dep_index, data: await Promise.all(dep.inputs.map(id => get_data(instance_map[id]))), event_data: dep.collects_event_data ? event_data : null, trigger_id }; if (dep.frontend_fn) { dep.frontend_fn(payload.data.concat(await Promise.all(dep.inputs.map(id => get_data(instance_map[id]))))).then(v => { if (dep.backend_fn) { payload.data = v; make_prediction(payload); } else { handle_update(v, dep_index, []); } }); } else { if (dep.backend_fn) { if (dep.trigger_mode === "once") { if (!dep.pending_request) make_prediction(payload); } else if (dep.trigger_mode === "multiple") { make_prediction(payload); } else if (dep.trigger_mode === "always_last") { if (!dep.pending_request) { make_prediction(payload); } else { dep.final_event = payload; } } } } function make_prediction(payload) { const pending_outputs = []; let outputs_set_to_non_interactive = []; const submission = app.submit(payload.fn_index, payload.data, payload.event_data, payload.trigger_id).on("data", ({ data, fn_index }) => { if (dep.pending_request && dep.final_event) { dep.pending_request = false; make_prediction(dep.final_event); } dep.pending_request = false; handle_update(data, fn_index, outputs_set_to_non_interactive); }).on("status", ({ fn_index, ...status }) => { tick().then(() => { const outputs = dependencies[fn_index].outputs; outputs.forEach(id => { if (instance_map[id].props.interactive && status.stage === "pending" && dep.targets[0][1] !== "focus") { pending_outputs.push(id); $$invalidate(18, instance_map[id].props.interactive = false, instance_map); } else if (status.stage === "complete" && pending_outputs.includes(id) && !outputs_set_to_non_interactive.includes(id)) { $$invalidate(18, instance_map[id].props.interactive = true, instance_map); } }); //@ts-ignore loading_status.update({ ...status, status: status.stage, progress: status.progress_data, fn_index }); if (!showed_duplicate_message && space_id !== null && status.position !== undefined && status.position >= 2 && status.eta !== undefined && status.eta > SHOW_DUPLICATE_MESSAGE_ON_ETA) { showed_duplicate_message = true; $$invalidate(19, messages = [new_message(DUPLICATE_MESSAGE, fn_index, "warning"), ...messages]); } if (!showed_mobile_warning && is_mobile_device && status.eta !== undefined && status.eta > SHOW_MOBILE_QUEUE_WARNING_ON_ETA) { showed_mobile_warning = true; $$invalidate(19, messages = [new_message(MOBILE_QUEUE_WARNING, fn_index, "warning"), ...messages]); } if (status.stage === "complete") { dependencies.map(async (dep, i) => { if (dep.trigger_after === fn_index) { trigger_api_call(i, payload.trigger_id); } }); submission.destroy(); } if (status.broken && is_mobile_device && user_left_page) { window.setTimeout( () => { $$invalidate(19, messages = [ new_message(MOBILE_RECONNECT_MESSAGE, fn_index, "error"), ...messages ]); }, 0 ); trigger_api_call(dep_index, payload.trigger_id, event_data); user_left_page = false; } else if (status.stage === "error") { if (status.message) { const _message = status.message.replace(MESSAGE_QUOTE_RE, (_, b) => b); $$invalidate(19, messages = [new_message(_message, fn_index, "error"), ...messages]); } dependencies.map(async (dep, i) => { if (dep.trigger_after === fn_index && !dep.trigger_only_on_success) { trigger_api_call(i, payload.trigger_id); } }); submission.destroy(); } }); }).on("log", ({ log, fn_index, level }) => { $$invalidate(19, messages = [new_message(log, fn_index, level), ...messages]); }); submit_map.set(dep_index, submission); } } function trigger_share(title, description) { if (space_id === null) { return; } const discussion_url = new URL(`https://huggingface.co/spaces/${space_id}/discussions/new`); if (title !== undefined && title.length > 0) { discussion_url.searchParams.set("title", title); } discussion_url.searchParams.set("description", description); window.open(discussion_url.toString(), "_blank"); } function handle_error_close(e) { const _id = e.detail; $$invalidate(19, messages = messages.filter(m => m.id !== _id)); } const is_external_url = link => !!(link && new URL(link, location.href).origin !== location.origin); async function handle_mount() { if (js) { let blocks_frontend_fn = new AsyncFunction(`let result = await (${js})(); return (!Array.isArray(result)) ? [result] : result;`); blocks_frontend_fn(); } await tick(); var a = target.getElementsByTagName("a"); for (var i = 0; i < a.length; i++) { const _target = a[i].getAttribute("target"); const _link = a[i].getAttribute("href"); // only target anchor tags with external links if (is_external_url(_link) && _target !== "_blank") a[i].setAttribute("target", "_blank"); } // handle load triggers dependencies.forEach((dep, i) => { if (dep.targets[0][1] === "load") { trigger_api_call(i); } }); target.addEventListener("gradio", e => { if (!isCustomEvent(e)) throw new Error("not a custom event"); const { id, event, data } = e.detail; if (event === "share") { const { title, description } = data; trigger_share(title, description); } else if (event === "error" || event === "warning") { $$invalidate(19, messages = [new_message(data, -1, event), ...messages]); } else { const deps = target_map[id]?.[event]; deps?.forEach(dep_id => { trigger_api_call(dep_id, id, data); }); } }); $$invalidate(25, render_complete = true); } function handle_destroy(id) { handled_dependencies = handled_dependencies.map(dep => { return dep.filter(_id => _id !== id); }); } function set_status(statuses) { for (const id in statuses) { let loading_status = statuses[id]; let dependency = dependencies[loading_status.fn_index]; loading_status.scroll_to_output = dependency.scroll_to_output; loading_status.show_progress = dependency.show_progress; set_prop(instance_map[id], "loading_status", loading_status); } const inputs_to_update = loading_status.get_inputs_to_update(); for (const [id, pending_status] of inputs_to_update) { set_prop(instance_map[id], "pending", pending_status === "pending"); } } const destroy_handler = ({ detail }) => handle_destroy(detail); const click_handler = () => { set_api_docs_visible(!api_docs_visible); }; const click_handler_1 = () => { set_api_docs_visible(false); }; const close_handler = () => { set_api_docs_visible(false); }; $$self.$$set = $$props => { if ('root' in $$props) $$invalidate(1, root = $$props.root); if ('components' in $$props) $$invalidate(26, components = $$props.components); if ('layout' in $$props) $$invalidate(27, layout = $$props.layout); if ('dependencies' in $$props) $$invalidate(2, dependencies = $$props.dependencies); if ('title' in $$props) $$invalidate(3, title = $$props.title); if ('analytics_enabled' in $$props) $$invalidate(4, analytics_enabled = $$props.analytics_enabled); if ('target' in $$props) $$invalidate(5, target = $$props.target); if ('autoscroll' in $$props) $$invalidate(6, autoscroll = $$props.autoscroll); if ('show_api' in $$props) $$invalidate(7, show_api = $$props.show_api); if ('show_footer' in $$props) $$invalidate(8, show_footer = $$props.show_footer); if ('control_page_title' in $$props) $$invalidate(9, control_page_title = $$props.control_page_title); if ('app_mode' in $$props) $$invalidate(10, app_mode = $$props.app_mode); if ('theme_mode' in $$props) $$invalidate(11, theme_mode = $$props.theme_mode); if ('app' in $$props) $$invalidate(12, app = $$props.app); if ('space_id' in $$props) $$invalidate(28, space_id = $$props.space_id); if ('version' in $$props) $$invalidate(13, version = $$props.version); if ('js' in $$props) $$invalidate(29, js = $$props.js); if ('ready' in $$props) $$invalidate(0, ready = $$props.ready); if ('render_complete' in $$props) $$invalidate(25, render_complete = $$props.render_complete); }; $$self.$$.update = () => { if ($$self.$$.dirty[0] & /*components, layout*/ 201326592) { (prepare_components()); } if ($$self.$$.dirty[0] & /*$loading_status*/ 1073741824) { set_status($loading_status); } }; return [ ready, root, dependencies, title, analytics_enabled, target, autoscroll, show_api, show_footer, control_page_title, app_mode, theme_mode, app, version, loading_status, rootNode, api_docs_visible, dynamic_ids, instance_map, messages, $_, set_api_docs_visible, handle_error_close, handle_mount, handle_destroy, render_complete, components, layout, space_id, js, $loading_status, destroy_handler, click_handler, click_handler_1, close_handler ]; } class Blocks extends SvelteComponent { constructor(options) { super(); init( this, options, instance, create_fragment, safe_not_equal, { root: 1, components: 26, layout: 27, dependencies: 2, title: 3, analytics_enabled: 4, target: 5, autoscroll: 6, show_api: 7, show_footer: 8, control_page_title: 9, app_mode: 10, theme_mode: 11, app: 12, space_id: 28, version: 13, js: 29, ready: 0, render_complete: 25 }, null, [-1, -1] ); } } const Blocks$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ __proto__: null, default: Blocks }, Symbol.toStringTag, { value: 'Module' })); export { Blocks$1 as B, Toast as T }; //# sourceMappingURL=Blocks-98cbd2e4.js.map