1import { _ as __vitePreload } from './index-5550136d.js'; 2import { b as is_function, w as writable, L as Loader, d as get_store_value, $ as $format, e as setupi18n } from './Index-2cec2c56.js'; 3import { d as cubicOut, f as fade, B as Block, a as Button } from './Button-05bf7cea.js'; 4 5/** 6 * The flip function calculates the start and end position of an element and animates between them, translating the x and y values. 7 * `flip` stands for [First, Last, Invert, Play](https://aerotwist.com/blog/flip-your-animations/). 8 * 9 * https://svelte.dev/docs/svelte-animate#flip 10 * @param {Element} node 11 * @param {{ from: DOMRect; to: DOMRect }} fromTo 12 * @param {import('./public.js').FlipParams} params 13 * @returns {import('./public.js').AnimationConfig} 14 */ 15function flip(node, { from, to }, params = {}) { 16 const style = getComputedStyle(node); 17 const transform = style.transform === 'none' ? '' : style.transform; 18 const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat); 19 const dx = from.left + (from.width * ox) / to.width - (to.left + ox); 20 const dy = from.top + (from.height * oy) / to.height - (to.top + oy); 21 const { delay = 0, duration = (d) => Math.sqrt(d) * 120, easing = cubicOut } = params; 22 return { 23 delay, 24 duration: is_function(duration) ? duration(Math.sqrt(dx * dx + dy * dy)) : duration, 25 easing, 26 css: (t, u) => { 27 const x = u * dx; 28 const y = u * dy; 29 const sx = t + (u * from.width) / to.width; 30 const sy = t + (u * from.height) / to.height; 31 return `transform: ${transform} translate(${x}px, ${y}px) scale(${sx}, ${sy});`; 32 } 33 }; 34} 35 36/* home/runner/work/gradio/gradio/js/icons/src/Error.svelte generated by Svelte v4.2.2 */ 37const { 38 SvelteComponent: SvelteComponent$g, 39 append: append$d, 40 attr: attr$d, 41 detach: detach$f, 42 init: init$g, 43 insert: insert$f, 44 noop: noop$8, 45 safe_not_equal: safe_not_equal$g, 46 svg_element: svg_element$3 47} = window.__gradio__svelte__internal; 48function create_fragment$g(ctx) { 49 let svg; 50 let path; 51 52 return { 53 c() { 54 svg = svg_element$3("svg"); 55 path = svg_element$3("path"); 56 attr$d(path, "stroke-linecap", "round"); 57 attr$d(path, "stroke-linejoin", "round"); 58 attr$d(path, "d", "M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"); 59 attr$d(svg, "fill", "none"); 60 attr$d(svg, "stroke", "currentColor"); 61 attr$d(svg, "viewBox", "0 0 24 24"); 62 attr$d(svg, "width", "100%"); 63 attr$d(svg, "height", "100%"); 64 attr$d(svg, "xmlns", "http://www.w3.org/2000/svg"); 65 attr$d(svg, "aria-hidden", "true"); 66 attr$d(svg, "stroke-width", "2"); 67 attr$d(svg, "stroke-linecap", "round"); 68 attr$d(svg, "stroke-linejoin", "round"); 69 }, 70 m(target, anchor) { 71 insert$f(target, svg, anchor); 72 append$d(svg, path); 73 }, 74 p: noop$8, 75 i: noop$8, 76 o: noop$8, 77 d(detaching) { 78 if (detaching) { 79 detach$f(svg); 80 } 81 } 82 }; 83} 84 85let Error$1 = class Error extends SvelteComponent$g { 86 constructor(options) { 87 super(); 88 init$g(this, options, null, create_fragment$g, safe_not_equal$g, {}); 89 } 90}; 91 92/* home/runner/work/gradio/gradio/js/icons/src/Info.svelte generated by Svelte v4.2.2 */ 93const { 94 SvelteComponent: SvelteComponent$f,
95 append: append$c, 96 attr: attr$c, 97 detach: detach$e, 98 init: init$f, 99 insert: insert$e, 100 noop: noop$7, 101 safe_not_equal: safe_not_equal$f, 102 svg_element: svg_element$2 103} = window.__gradio__svelte__internal; 104function create_fragment$f(ctx) { 105 let svg; 106 let path; 107 108 return { 109 c() { 110 svg = svg_element$2("svg"); 111 path = svg_element$2("path"); 112 attr$c(path, "stroke-linecap", "round"); 113 attr$c(path, "stroke-linejoin", "round"); 114 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"); 115 attr$c(svg, "fill", "none"); 116 attr$c(svg, "stroke", "currentColor"); 117 attr$c(svg, "viewBox", "0 0 24 24"); 118 attr$c(svg, "width", "100%"); 119 attr$c(svg, "height", "100%"); 120 attr$c(svg, "xmlns", "http://www.w3.org/2000/svg"); 121 attr$c(svg, "aria-hidden", "true"); 122 attr$c(svg, "stroke-width", "2"); 123 attr$c(svg, "stroke-linecap", "round"); 124 attr$c(svg, "stroke-linejoin", "round"); 125 }, 126 m(target, anchor) { 127 insert$e(target, svg, anchor); 128 append$c(svg, path); 129 }, 130 p: noop$7, 131 i: noop$7, 132 o: noop$7, 133 d(detaching) { 134 if (detaching) { 135 detach$e(svg); 136 } 137 } 138 }; 139} 140 141class Info extends SvelteComponent$f { 142 constructor(options) { 143 super(); 144 init$f(this, options, null, create_fragment$f, safe_not_equal$f, {}); 145 } 146} 147 148/* home/runner/work/gradio/gradio/js/icons/src/Warning.svelte generated by Svelte v4.2.2 */ 149const { 150 SvelteComponent: SvelteComponent$e, 151 append: append$b, 152 attr: attr$b, 153 detach: detach$d, 154 init: init$e, 155 insert: insert$d, 156 noop: noop$6, 157 safe_not_equal: safe_not_equal$e, 158 svg_element: svg_element$1 159} = window.__gradio__svelte__internal; 160function create_fragment$e(ctx) { 161 let svg; 162 let path; 163 164 return { 165 c() { 166 svg = svg_element$1("svg"); 167 path = svg_element$1("path"); 168 attr$b(path, "stroke-linecap", "round"); 169 attr$b(path, "stroke-linejoin", "round"); 170 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"); 171 attr$b(svg, "fill", "none"); 172 attr$b(svg, "stroke", "currentColor"); 173 attr$b(svg, "stroke-width", "2"); 174 attr$b(svg, "viewBox", "0 0 24 24"); 175 attr$b(svg, "width", "100%"); 176 attr$b(svg, "height", "100%"); 177 attr$b(svg, "xmlns", "http://www.w3.org/2000/svg"); 178 attr$b(svg, "aria-hidden", "true"); 179 attr$b(svg, "stroke-linecap", "round"); 180 attr$b(svg, "stroke-linejoin", "round"); 181 }, 182 m(target, anchor) { 183 insert$d(target, svg, anchor); 184 append$b(svg, path); 185 }, 186 p: noop$6, 187 i: noop$6, 188 o: noop$6, 189 d(detaching) { 190 if (detaching) { 191 detach$d(svg); 192 } 193 } 194 }; 195} 196 197class Warning extends SvelteComponent$e { 198 constructor(options) { 199 super(); 200 init$e(this, options, null, create_fragment$e, safe_not_equal$e, {}); 201 } 202} 203 204/* home/runner/work/gradio/gradio/js/statustracker/static/ToastContent.svelte generated by Svelte v4.2.2 */ 205const { 206 SvelteComponent: SvelteComponent$d, 207 add_render_callback, 208 append: append$a, 209 attr: attr$a, 210 bubble: bubble$3, 211 check_outros: check_outros$7, 212 create_component: create_component$b, 213 create_in_transition, 214 create_out_transition, 215 destroy_component: destroy_component$b, 216 detach: detach$c, 217 element: element$9, 218 group_outros: group_outros$7, 219 init: init$d, 220 insert: insert$c, 221 listen: listen$4, 222 mount_component: mount_component$b, 223 run_all, 224 safe_not_equal: safe_not_equal$d, 225 set_data: set_data$7, 226 space: space$8, 227 stop_propagation, 228 text: text$8, 229 transition_in: transition_in$b, 230 transition_out: transition_out$b 231} = window.__gradio__svelte__internal;const { createEventDispatcher: createEventDispatcher$5, onMount: onMount$3 } = window.__gradio__svelte__internal; 232function create_if_block_2$4(ctx) { 233 let error; 234 let current; 235 error = new Error$1({}); 236 237 return { 238 c() { 239 create_component$b(error.$$.fragment); 240 }, 241 m(target, anchor) { 242 mount_component$b(error, target, anchor); 243 current = true; 244 }, 245 i(local) { 246 if (current) return; 247 transition_in$b(error.$$.fragment, local); 248 current = true; 249 }, 250 o(local) { 251 transition_out$b(error.$$.fragment, local); 252 current = false;
253 }, 254 d(detaching) { 255 destroy_component$b(error, detaching); 256 } 257 }; 258} 259 260// (32:28) 261function create_if_block_1$5(ctx) { 262 let info; 263 let current; 264 info = new Info({}); 265 266 return { 267 c() { 268 create_component$b(info.$$.fragment); 269 }, 270 m(target, anchor) { 271 mount_component$b(info, target, anchor); 272 current = true; 273 }, 274 i(local) { 275 if (current) return; 276 transition_in$b(info.$$.fragment, local); 277 current = true; 278 }, 279 o(local) { 280 transition_out$b(info.$$.fragment, local); 281 current = false; 282 }, 283 d(detaching) { 284 destroy_component$b(info, detaching); 285 } 286 }; 287} 288 289// (30:2) {#if type === "warning"} 290function create_if_block$8(ctx) { 291 let warning; 292 let current; 293 warning = new Warning({}); 294 295 return { 296 c() { 297 create_component$b(warning.$$.fragment); 298 }, 299 m(target, anchor) { 300 mount_component$b(warning, target, anchor); 301 current = true; 302 }, 303 i(local) { 304 if (current) return; 305 transition_in$b(warning.$$.fragment, local); 306 current = true; 307 }, 308 o(local) { 309 transition_out$b(warning.$$.fragment, local); 310 current = false; 311 }, 312 d(detaching) { 313 destroy_component$b(warning, detaching); 314 } 315 }; 316} 317 318function create_fragment$d(ctx) { 319 let div5; 320 let div0; 321 let current_block_type_index; 322 let if_block; 323 let div0_class_value; 324 let t0; 325 let div3; 326 let div1; 327 let t1; 328 let div1_class_value; 329 let t2; 330 let div2; 331 let t3; 332 let div2_class_value; 333 let div3_class_value; 334 let t4; 335 let button; 336 let span; 337 let button_class_value; 338 let t6; 339 let div4; 340 let div4_class_value; 341 let div5_class_value; 342 let div5_intro; 343 let div5_outro; 344 let current; 345 let mounted; 346 let dispose; 347 const if_block_creators = [create_if_block$8, create_if_block_1$5, create_if_block_2$4]; 348 const if_blocks = []; 349 350 function select_block_type(ctx, dirty) { 351 if (/*type*/ ctx[1] === "warning") return 0; 352 if (/*type*/ ctx[1] === "info") return 1; 353 if (/*type*/ ctx[1] === "error") return 2; 354 return -1; 355 } 356 357 if (~(current_block_type_index = select_block_type(ctx))) { 358 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 359 } 360 361 return { 362 c() { 363 div5 = element$9("div"); 364 div0 = element$9("div"); 365 if (if_block) if_block.c(); 366 t0 = space$8(); 367 div3 = element$9("div"); 368 div1 = element$9("div"); 369 t1 = text$8(/*type*/ ctx[1]); 370 t2 = space$8(); 371 div2 = element$9("div"); 372 t3 = text$8(/*message*/ ctx[0]); 373 t4 = space$8(); 374 button = element$9("button"); 375 span = element$9("span"); 376 span.textContent = "Ã"; 377 t6 = space$8(); 378 div4 = element$9("div"); 379 attr$a(div0, "class", div0_class_value = "toast-icon " + /*type*/ ctx[1] + " svelte-z3l7qj"); 380 attr$a(div1, "class", div1_class_value = "toast-title " + /*type*/ ctx[1] + " svelte-z3l7qj"); 381 attr$a(div2, "class", div2_class_value = "toast-text " + /*type*/ ctx[1] + " svelte-z3l7qj"); 382 attr$a(div3, "class", div3_class_value = "toast-details " + /*type*/ ctx[1] + " svelte-z3l7qj"); 383 attr$a(span, "aria-hidden", "true"); 384 attr$a(button, "class", button_class_value = "toast-close " + /*type*/ ctx[1] + " svelte-z3l7qj"); 385 attr$a(button, "type", "button"); 386 attr$a(button, "aria-label", "Close"); 387 attr$a(button, "data-testid", "toast-close"); 388 attr$a(div4, "class", div4_class_value = "timer " + /*type*/ ctx[1] + " svelte-z3l7qj"); 389 attr$a(div5, "class", div5_class_value = "toast-body " + /*type*/ ctx[1] + " svelte-z3l7qj"); 390 attr$a(div5, "role", "alert"); 391 attr$a(div5, "data-testid", "toast-body"); 392 }, 393 m(target, anchor) { 394 insert$c(target, div5, anchor); 395 append$a(div5, div0); 396 397 if (~current_block_type_index) { 398 if_blocks[current_block_type_index].m(div0, null); 399 } 400 401 append$a(div5, t0); 402 append$a(div5, div3); 403 append$a(div3, div1); 404 append$a(div1, t1); 405 append$a(div3, t2); 406 append$a(div3, div2); 407 append$a(div2, t3); 408 append$a(div5, t4); 409 append$a(div5, button); 410 append$a(button, span); 411 append$a(div5, t6); 412 append$a(div5, div4); 413 current = true; 414 415 if (!mounted) { 416 dispose = [ 417 listen$4(button, "click", /*close_message*/ ctx[2]), 418 listen$4(div5, "click", stop_propagation(/*click_handler*/ ctx[4])), 419 listen$4(div5, "keydown", stop_propagation(/*keydown_handler*/ ctx[5])) 420 ]; 421 422 mounted = true; 423 } 424 }, 425 p(ctx, [dirty]) { 426 let previous_block_index = current_block_type_index; 427 current_block_type_index = select_block_type(ctx); 428 429 if (current_block_type_index !== previous_block_index) { 430 if (if_block) { 431 group_outros$7(); 432 433 transition_out$b(if_blocks[previous_block_index], 1, 1, () => { 434 if_blocks[previous_block_index] = null; 435 }); 436 437 check_outros$7(); 438 } 439 440 if (~current_block_type_index) { 441 if_block = if_blocks[current_block_type_index]; 442 443 if (!if_block) { 444 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 445 if_block.c(); 446 } 447 448 transition_in$b(if_block, 1); 449 if_block.m(div0, null); 450 } else { 451 if_block = null; 452 } 453 } 454 455 if (!current || dirty & /*type*/ 2 && div0_class_value !== (div0_class_value = "toast-icon " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 456 attr$a(div0, "class", div0_class_value); 457 } 458 459 if (!current || dirty & /*type*/ 2) set_data$7(t1, /*type*/ ctx[1]); 460 461 if (!current || dirty & /*type*/ 2 && div1_class_value !== (div1_class_value = "toast-title " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 462 attr$a(div1, "class", div1_class_value); 463 } 464 465 if (!current || dirty & /*message*/ 1) set_data$7(t3, /*message*/ ctx[0]); 466 467 if (!current || dirty & /*type*/ 2 && div2_class_value !== (div2_class_value = "toast-text " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 468 attr$a(div2, "class", div2_class_value); 469 } 470 471 if (!current || dirty & /*type*/ 2 && div3_class_value !== (div3_class_value = "toast-details " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 472 attr$a(div3, "class", div3_class_value); 473 } 474 475 if (!current || dirty & /*type*/ 2 && button_class_value !== (button_class_value = "toast-close " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 476 attr$a(button, "class", button_class_value); 477 } 478 479 if (!current || dirty & /*type*/ 2 && div4_class_value !== (div4_class_value = "timer " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 480 attr$a(div4, "class", div4_class_value); 481 } 482 483 if (!current || dirty & /*type*/ 2 && div5_class_value !== (div5_class_value = "toast-body " + /*type*/ ctx[1] + " svelte-z3l7qj")) { 484 attr$a(div5, "class", div5_class_value); 485 } 486 }, 487 i(local) { 488 if (current) return; 489 transition_in$b(if_block); 490 491 if (local) { 492 add_render_callback(() => { 493 if (!current) return; 494 if (div5_outro) div5_outro.end(1);
495 div5_intro = create_in_transition(div5, fade, { duration: 200, delay: 100 }); 496 div5_intro.start(); 497 }); 498 } 499 500 current = true; 501 }, 502 o(local) { 503 transition_out$b(if_block); 504 if (div5_intro) div5_intro.invalidate(); 505 506 if (local) { 507 div5_outro = create_out_transition(div5, fade, { duration: 200 }); 508 } 509 510 current = false; 511 }, 512 d(detaching) { 513 if (detaching) { 514 detach$c(div5); 515 } 516 517 if (~current_block_type_index) { 518 if_blocks[current_block_type_index].d(); 519 } 520 521 if (detaching && div5_outro) div5_outro.end(); 522 mounted = false; 523 run_all(dispose); 524 } 525 }; 526} 527 528function instance$c($$self, $$props, $$invalidate) { 529 let { message = "" } = $$props; 530 let { type } = $$props; 531 let { id } = $$props; 532 const dispatch = createEventDispatcher$5(); 533 534 function close_message() { 535 dispatch("close", id); 536 } 537 538 onMount$3(() => { 539 setTimeout( 540 () => { 541 close_message(); 542 }, 543 10000 544 ); 545 }); 546 547 function click_handler(event) { 548 bubble$3.call(this, $$self, event); 549 } 550 551 function keydown_handler(event) { 552 bubble$3.call(this, $$self, event); 553 } 554 555 $$self.$$set = $$props => {
556 if ('message' in $$props) $$invalidate(0, message = $$props.message); 557 if ('type' in $$props) $$invalidate(1, type = $$props.type); 558 if ('id' in $$props) $$invalidate(3, id = $$props.id); 559 }; 560 561 return [message, type, close_message, id, click_handler, keydown_handler]; 562} 563 564class ToastContent extends SvelteComponent$d { 565 constructor(options) { 566 super(); 567 init$d(this, options, instance$c, create_fragment$d, safe_not_equal$d, { message: 0, type: 1, id: 3 }); 568 } 569} 570 571/* home/runner/work/gradio/gradio/js/statustracker/static/Toast.svelte generated by Svelte v4.2.2 */ 572const { 573 SvelteComponent: SvelteComponent$c, 574 append: append$9, 575 attr: attr$9, 576 bubble: bubble$2, 577 check_outros: check_outros$6, 578 create_animation, 579 create_component: create_component$a, 580 destroy_component: destroy_component$a, 581 detach: detach$b, 582 element: element$8, 583 ensure_array_like: ensure_array_like$4, 584 fix_and_outro_and_destroy_block, 585 fix_position, 586 group_outros: group_outros$6, 587 init: init$c, 588 insert: insert$b, 589 mount_component: mount_component$a, 590 noop: noop$5, 591 safe_not_equal: safe_not_equal$c, 592 set_style: set_style$2, 593 space: space$7, 594 transition_in: transition_in$a, 595 transition_out: transition_out$a, 596 update_keyed_each: update_keyed_each$1 597} = window.__gradio__svelte__internal; 598function get_each_context$4(ctx, list, i) { 599 const child_ctx = ctx.slice(); 600 child_ctx[2] = list[i].type; 601 child_ctx[3] = list[i].message; 602 child_ctx[4] = list[i].id; 603 return child_ctx; 604} 605 606// (15:1) {#each messages as { type, message, id } 607function create_each_block$4(key_1, ctx) { 608 let div; 609 let toastcontent; 610 let t; 611 let rect; 612 let stop_animation = noop$5; 613 let current; 614 615 toastcontent = new ToastContent({ 616 props: { 617 type: /*type*/ ctx[2], 618 message: /*message*/ ctx[3], 619 id: /*id*/ ctx[4] 620 } 621 }); 622 623 toastcontent.$on("close", /*close_handler*/ ctx[1]); 624 625 return { 626 key: key_1, 627 first: null, 628 c() { 629 div = element$8("div"); 630 create_component$a(toastcontent.$$.fragment); 631 t = space$7(); 632 set_style$2(div, "width", `100%`); 633 this.first = div; 634 }, 635 m(target, anchor) { 636 insert$b(target, div, anchor); 637 mount_component$a(toastcontent, div, null); 638 append$9(div, t); 639 current = true; 640 }, 641 p(new_ctx, dirty) { 642 ctx = new_ctx; 643 const toastcontent_changes = {}; 644 if (dirty & /*messages*/ 1) toastcontent_changes.type = /*type*/ ctx[2]; 645 if (dirty & /*messages*/ 1) toastcontent_changes.message = /*message*/ ctx[3]; 646 if (dirty & /*messages*/ 1) toastcontent_changes.id = /*id*/ ctx[4]; 647 toastcontent.$set(toastcontent_changes); 648 }, 649 r() { 650 rect = div.getBoundingClientRect(); 651 }, 652 f() { 653 fix_position(div); 654 stop_animation(); 655 }, 656 a() { 657 stop_animation(); 658 stop_animation = create_animation(div, rect, flip, { duration: 300 }); 659 }, 660 i(local) { 661 if (current) return; 662 transition_in$a(toastcontent.$$.fragment, local); 663 current = true; 664 }, 665 o(local) { 666 transition_out$a(toastcontent.$$.fragment, local); 667 current = false; 668 }, 669 d(detaching) { 670 if (detaching) { 671 detach$b(div); 672 } 673 674 destroy_component$a(toastcontent); 675 } 676 }; 677} 678 679function create_fragment$c(ctx) { 680 let div; 681 let each_blocks = []; 682 let each_1_lookup = new Map(); 683 let current; 684 let each_value = ensure_array_like$4(/*messages*/ ctx[0]); 685 const get_key = ctx => /*id*/ ctx[4]; 686 687 for (let i = 0; i < each_value.length; i += 1) { 688 let child_ctx = get_each_context$4(ctx, each_value, i); 689 let key = get_key(child_ctx); 690 each_1_lookup.set(key, each_blocks[i] = create_each_block$4(key, child_ctx)); 691 } 692 693 return { 694 c() { 695 div = element$8("div"); 696 697 for (let i = 0; i < each_blocks.length; i += 1) { 698 each_blocks[i].c(); 699 } 700 701 attr$9(div, "class", "toast-wrap svelte-pu0yf1"); 702 }, 703 m(target, anchor) { 704 insert$b(target, div, anchor); 705 706 for (let i = 0; i < each_blocks.length; i += 1) { 707 if (each_blocks[i]) { 708 each_blocks[i].m(div, null); 709 } 710 } 711 712 current = true; 713 }, 714 p(ctx, [dirty]) { 715 if (dirty & /*messages*/ 1) { 716 each_value = ensure_array_like$4(/*messages*/ ctx[0]); 717 group_outros$6(); 718 for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].r(); 719 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); 720 for (let i = 0; i < each_blocks.length; i += 1) each_blocks[i].a(); 721 check_outros$6(); 722 } 723 }, 724 i(local) { 725 if (current) return; 726 727 for (let i = 0; i < each_value.length; i += 1) { 728 transition_in$a(each_blocks[i]); 729 } 730 731 current = true; 732 }, 733 o(local) { 734 for (let i = 0; i < each_blocks.length; i += 1) { 735 transition_out$a(each_blocks[i]); 736 } 737 738 current = false;
739 }, 740 d(detaching) { 741 if (detaching) { 742 detach$b(div); 743 } 744 745 for (let i = 0; i < each_blocks.length; i += 1) { 746 each_blocks[i].d(); 747 } 748 } 749 }; 750} 751 752function scroll_to_top(_messages) { 753 if (_messages.length > 0) { 754 if ("parentIFrame" in window) { 755 window.parentIFrame?.scrollTo(0, 0); 756 } 757 } 758} 759 760function instance$b($$self, $$props, $$invalidate) { 761 let { messages = [] } = $$props; 762 763 function close_handler(event) { 764 bubble$2.call(this, $$self, event); 765 } 766 767 $$self.$$set = $$props => { 768 if ('messages' in $$props) $$invalidate(0, messages = $$props.messages); 769 }; 770 771 $$self.$$.update = () => { 772 if ($$self.$$.dirty & /*messages*/ 1) { 773 scroll_to_top(messages); 774 } 775 }; 776 777 return [messages, close_handler]; 778} 779 780class Toast extends SvelteComponent$c { 781 constructor(options) { 782 super(); 783 init$c(this, options, instance$b, create_fragment$c, safe_not_equal$c, { messages: 0 }); 784 } 785} 786 787const component_map = { 788 "accordion": { 789 790 component: () => __vitePreload(() => import('./Index-c4cc8bd2.js'),true?["./Index-c4cc8bd2.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./Index-24a33ce1.js","./Index-2abed479.css","./Index-a90cda25.css"]:void 0,import.meta.url) 791 }, 792"annotatedimage": { 793 794 component: () => __vitePreload(() => import('./Index-5c5cdadd.js'),true?["./Index-5c5cdadd.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./BlockLabel-09bb0248.js","./Empty-2eeff83e.js","./Image-6cbf81d1.js","./Index-1454732f.css"]:void 0,import.meta.url) 795 }, 796"audio": { 797 example: () => __vitePreload(() => import('./Example-01f23d62.js'),true?["./Example-01f23d62.js","./Example-55d94c71.css"]:void 0,import.meta.url), 798 799 component: () => __vitePreload(() => import('./index-457eb9c1.js'),true?["./index-457eb9c1.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./utils-8f25e669.js","./BlockLabel-09bb0248.js","./IconButton-fb69b8dd.js","./Empty-2eeff83e.js","./ShareButton-b044e1b5.js","./Download-ea83bae3.js","./SelectSource-a1604b96.js","./Upload-8f4bfd80.js","./Undo-6c110254.js","./file-url-1a9970c0.js","./Upload-02e4db12.js","./ModifyUpload-968871a9.css","./ModifyUpload-772201f4.js","./Clear-9760deed.js","./UploadText-7206a31c.js","./Example-01f23d62.js","./Example-55d94c71.css","./index-fbf5c7f3.css"]:void 0,import.meta.url) 800 }, 801"box": { 802 803 component: () => __vitePreload(() => import('./Index-efc88203.js'),true?["./Index-efc88203.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css"]:void 0,import.meta.url) 804 }, 805"button": { 806 807 component: () => __vitePreload(() => import('./Index-3dc54f9d.js'),true?["./Index-3dc54f9d.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css"]:void 0,import.meta.url) 808 }, 809"chatbot": { 810 811 component: () => __vitePreload(() => import('./Index-33b978ea.js'),true?["./Index-33b978ea.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./utils-8f25e669.js","./index-21d69e4c.js","./ShareButton-b044e1b5.js","./IconButton-fb69b8dd.js","./Index.svelte_svelte_type_style_lang-09b631ef.js","./Example.
811svelte_svelte_type_style_lang-b83dcc5a.js","./Example-351db138.css","./Index-0fcf0130.css","./Check-1d114215.js","./Copy-ea46e0bf.js","./BlockLabel-09bb0248.js","./Index-d6d1d13b.css"]:void 0,import.meta.url) 812 }, 813"checkbox": { 814 example: () => __vitePreload(() => import('./Example-c3dd8bb4.js'),true?["./Example-c3dd8bb4.js","./Example-55d94c71.css"]:void 0,import.meta.url), 815 816 component: () => __vitePreload(() => import('./Index-85874b00.js'),true?["./Index-85874b00.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./Info-8a698008.js","./Index-6224b77c.css"]:void 0,import.meta.url) 817 }, 818"checkboxgroup": { 819 example: () => __vitePreload(() => import('./Example-5a888e08.js'),true?["./Example-5a888e08.js","./Example-55d94c71.css"]:void 0,import.meta.url), 820 821 component: () => __vitePreload(() => import('./Index-6c32ffde.js'),true?["./Index-6c32ffde.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./BlockTitle-2fcd9935.js","./Info-8a698008.js","./Index-5676d3d3.css"]:void 0,import.meta.url) 822 }, 823"code": { 824 example: () => __vitePreload(() => import('./Example-ef3222e9.js'),true?["./Example-ef3222e9.js","./Example-c56e7331.css"]:void 0,import.meta.url), 825 826 component: () => __vitePreload(() => import('./Index-ad7d100a.js').then(n => n.F),true?["./Index-ad7d100a.js","./index-5550136d.js","./index-449ec8c6.css","./Button-05bf7cea.js","./Index-2cec2c56.js","./Index-0d30506b.css","./Button-ccc75ad8.css","./Check-1d114215.js","./Copy-ea46e0bf.js","./Download-ea83bae3.js","./BlockLabel-09bb0248.js","./Empty-2eeff83e.js","./Example-ef3222e9.js","./Example-c56e7331.css","./Index-d7b06ad3.css"]:void 0,import.meta.url) 827 }, 828"colorpicker": { 829 example: () => __vitePreload(() => import('./Example-510d9c7e.js'),true?["./Example-510d9c7e.js","./Example-5be72496.css"]:void 0,import.meta.url), 830 831 component: () => __vitePreload(() => import('./Index-a0baf52f.js'),true?["./Index-a0baf52f.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./BlockTitle-2fcd9935.js","./Info-8a698008.js","./Example-510d9c7e.js","./Example-5be72496.css","./Index-497c6364.css"]:void 0,import.meta.url) 832 }, 833"column": { 834 835 component: () => __vitePreload(() => import('./Index-24a33ce1.js'),true?["./Index-24a33ce1.js","./Index-2abed479.css"]:void 0,import.meta.url) 836 }, 837"dataframe": { 838 example: () => __vitePreload(() => import('./Example-7d6bb9b6.js'),true?["./Example-7d6bb9b6.js","./dsv-a37bb3db.js","./Example-aca1592e.css"]:void 0,import.meta.url), 839 840 component: () => __vitePreload(() => import('./Index-42ed4a43.js'),true?["./Index-42ed4a43.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./index-21d69e4c.js","./utils-8f25e669.js","./Upload-02e4db12.js","./ModifyUpload-968871a9.css","./Index.svelte_svelte_type_style_lang-09b631ef.js","./Example.
840svelte_svelte_type_style_lang-b83dcc5a.js","./Example-351db138.css","./Index-0fcf0130.css","./dsv-a37bb3db.js","./Example-7d6bb9b6.js","./Example-aca1592e.css","./Index-2584e216.css"]:void 0,import.meta.url) 841 }, 842"dataset": { 843 844 component: () => __vitePreload(() => import('./Index-77f31a29.js'),true?["./Index-77f31a29.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./Index-52db28fc.css"]:void 0,import.meta.url) 845 }, 846"dropdown": { 847 example: () => __vitePreload(() => import('./Example-7b848c75.js'),true?["./Example-7b848c75.js","./Example-55d94c71.css"]:void 0,import.meta.url), 848 849 component: () => __vitePreload(() => import('./Index-de029fc6.js'),true?["./Index-de029fc6.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-05bf7cea.js","./Button-ccc75ad8.css","./BlockTitle-2fcd9935.js","./Info-8a698008.js","./DropdownArrow-ebaf45e0.js","./Example-7b848c75.js","./Example-55d94c71.css","./Index-4b58196f.css"]:void 0,import.meta.url) 850 }, 851"file": { 852 example: () => __vitePreload(() => import('./Example-d9b38e6f.js'),true?["./Example-d9b38e6f.js","./Example-4f56d95a.css"]:void 0,import.meta.url), 853 854 component: () => __vitePreload(() => import('./Index-4544da7f.js'),true?["./Index-4544da7f.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./BlockLabel-09bb0248.js","./Empty-2eeff83e.js","./File-e96cd7d6.js","./Upload-02e4db12.js","./ModifyUpload-968871a9.css","./ModifyUpload-772201f4.js","./IconButton-fb69b8dd.js","./Clear-9760deed.js","./Undo-6c110254.js","./UploadText-7206a31c.js","./Upload-8f4bfd80.js","./Example-d9b38e6f.js","./Example-4f56d95a.css","./Index-d2395de3.css"]:void 0,import.meta.url) 855 }, 856"fileexplorer": { 857 example: () => __vitePreload(() => import('./Example-3e057617.js'),true?["./Example-3e057617.js","./Example-7cc47009.css"]:void 0,import.meta.url), 858 859 component: () => __vitePreload(() => import('./Index-aac54ffe.js'),true?["./Index-aac54ffe.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./File-e96cd7d6.js","./Button-05bf7cea.js","./Button-ccc75ad8.css","./BlockLabel-09bb0248.js","./index-f38d9616.js","./Empty-2eeff83e.js","./Index-e18b14d2.css"]:void 0,import.meta.url) 860 }, 861"form": { 862 863 component: () => __vitePreload(() => import('./Index-0d7ad3de.js'),true?["./Index-0d7ad3de.js","./Index-7ab72019.css"]:void 0,import.meta.url) 864 }, 865"gallery": { 866 867 component: () => __vitePreload(() => import('./Index-4a602a74.js'),true?["./Index-4a602a74.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./BlockLabel-09bb0248.js","./IconButton-fb69b8dd.js","./Empty-2eeff83e.js","./ShareButton-b044e1b5.js","./utils-8f25e669.js","./Download-ea83bae3.js","./Image-6cbf81d1.js","./ModifyUpload-772201f4.js","./Clear-9760deed.js","./Undo-6c110254.js","./ModifyUpload-968871a9.css","./index-f38d9616.js","./Index-840399f3.css"]:void 0,import.meta.url) 868 }, 869"group": { 870 871 component: () => __vitePreload(() => import('./Index-a3ffbeb0.js'),true?["./Index-a3ffbeb0.js","./Index-e45a2b11.css"]:void 0,import.meta.url) 872 }, 873"highlightedtext": { 874 875 component: () => __vitePreload(() => import('./Index-5efeb121.js'),true?["./Index-5efeb121.js","./color-20ad9c0d.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./BlockLabel-09bb0248.js","./Empty-2eeff83e.js","./Index-a4c50cbd.css"]:void 0,import.meta.url) 876 }, 877"html": { 878 example: () => __vitePreload(() => import('./Example-39f519bd.js'),true?["./Example-39f519bd.js","./Example-eac655f5.css"]:void 0,import.meta.url), 879 880 component: () => __vitePreload(() => import('./Index-0c641f7b.js'),true?["./Index-0c641f7b.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-0
8805bf7cea.js","./Button-ccc75ad8.css","./Index-5538a1d8.css"]:void 0,import.meta.url) 881 }, 882"image": { 883 example: () => __vitePreload(() => import('./Example-9f38ca23.js'),true?["./Example-9f38ca23.js","./Example.svelte_svelte_type_style_lang-6aeed26b.js","./file-url-1a9970c0.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Example-813cc650.css"]:void 0,import.meta.url), 884 885 component: () => __vitePreload(() => import('./Index-20b6ac80.js'),true?["./Index-20b6ac80.js","./ImageUploader-0e8da2b3.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./utils-8f25e669.js","./BlockLabel-09bb0248.js","./IconButton-fb69b8dd.js","./Empty-2eeff83e.js","./ShareButton-b044e1b5.js","./Download-ea83bae3.js","./Image-6cbf81d1.js","./Upload-8f4bfd80.js","./DropdownArrow-ebaf45e0.js","./Upload-02e4db12.js","./ModifyUpload-968871a9.css","./Clear-9760deed.js","./ImageUploader-8d3aeb94.css","./UploadText-7206a31c.js","./Example.
885svelte_svelte_type_style_lang-6aeed26b.js","./file-url-1a9970c0.js","./Example-813cc650.css","./Example-9f38ca23.js"]:void 0,import.meta.url) 886 }, 887"imageeditor": { 888 example: () => __vitePreload(() => import('./Example-d50c0bdb.js'),true?["./Example-d50c0bdb.js","./ImageUploader-0e8da2b3.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./utils-8f25e669.js","./BlockLabel-09bb0248.js","./IconButton-fb69b8dd.js","./Empty-2eeff83e.js","./ShareButton-b044e1b5.js","./Download-ea83bae3.js","./Image-6cbf81d1.js","./Upload-8f4bfd80.js","./DropdownArrow-ebaf45e0.js","./Upload-02e4db12.js","./ModifyUpload-968871a9.css","./Clear-9760deed.js","./ImageUploader-8d3aeb94.css","./Example.svelte_svelte_type_style_lang-6aeed26b.js","./file-url-1a9970c0.js","./Example-813cc650.css","./Example-15141602.css"]:void 0,import.meta.url), 889 890 component: () => __vitePreload(() => import('./Index-e309a630.js'),true?["./Index-e309a630.js","./ImageUploader-0e8da2b3.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./utils-8f25e669.js","./BlockLabel-09bb0248.js","./IconButton-fb69b8dd.js","./Empty-2eeff83e.js","./ShareButton-b044e1b5.js","./Download-ea83bae3.js","./Image-6cbf81d1.js","./Upload-8f4bfd80.js","./DropdownArrow-ebaf45e0.js","./Upload-02e4db12.js","./ModifyUpload-968871a9.css","./Clear-9760deed.js","./ImageUploader-8d3aeb94.css","./Example.
890svelte_svelte_type_style_lang-6aeed26b.js","./file-url-1a9970c0.js","./Example-813cc650.css","./__vite-browser-external-cb19bde2.js","./Check-1d114215.js","./Undo-6c110254.js","./Index-b13e6273.css"]:void 0,import.meta.url) 891 }, 892"json": { 893 894 component: () => __vitePreload(() => import('./Index-f6c46d05.js'),true?["./Index-f6c46d05.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./Check-1d114215.js","./Copy-ea46e0bf.js","./Empty-2eeff83e.js","./BlockLabel-09bb0248.js","./Index-8659c753.css"]:void 0,import.meta.url) 895 }, 896"label": { 897 898 component: () => __vitePreload(() => import('./Index-c25f57ca.js'),true?["./Index-c25f57ca.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-05bf7cea.js","./Button-ccc75ad8.css","./BlockLabel-09bb0248.js","./Empty-2eeff83e.js","./Index-d2e7a806.css"]:void 0,import.meta.url) 899 }, 900"markdown": { 901 example: () => __vitePreload(() => import('./Example-05a677e3.js'),true?["./Example-05a677e3.js","./Example.
901svelte_svelte_type_style_lang-b83dcc5a.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Example-351db138.css"]:void 0,import.meta.url), 902 903 component: () => __vitePreload(() => import('./Index-d01ef640.js'),true?["./Index-d01ef640.js","./Index.svelte_svelte_type_style_lang-09b631ef.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./utils-8f25e669.js","./Example.svelte_svelte_type_style_lang-b83dcc5a.js","./Example-351db138.css","./Index-0fcf0130.css","./Example-05a677e3.js"]:void 0,import.meta.url) 904 }, 905"model3d": { 906 example: () => __vitePreload(() => import('./Example-b5441cb7.js'),true?["./Example-b5441cb7.js","./Example-55d94c71.css"]:void 0,import.meta.url), 907 908 component: () => __vitePreload(() => import('./Index-97a7b395.js'),true?["./Index-97a7b395.js","./index-5550136d.js","./index-449ec8c6.css","./Button-05bf7cea.js","./Index-2cec2c56.js","./Index-0d30506b.css","./Button-ccc75ad8.css","./BlockLabel-09bb0248.js","./IconButton-fb69b8dd.js","./Download-ea83bae3.js","./File-e96cd7d6.js","./Undo-6c110254.js","./Upload-02e4db12.js","./ModifyUpload-968871a9.css","./ModifyUpload-772201f4.js","./Clear-9760deed.js","./Empty-2eeff83e.js","./UploadText-7206a31c.js","./Upload-8f4bfd80.js","./Example-b5441cb7.js","./Example-55d94c71.css","./Index-6795bfc7.css"]:void 0,import.meta.url) 909 }, 910"number": { 911 example: () => __vitePreload(() => import('./Example-8d59e00b.js'),true?["./Example-8d59e00b.js","./Example-55d94c71.css"]:void 0,import.meta.url), 912 913 component: () => __vitePreload(() => import('./Index-72221c78.js'),true?["./Index-72221c78.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./BlockTitle-2fcd9935.js","./Info-8a698008.js","./Index-8bd4bdf3.css"]:void 0,import.meta.url) 914 }, 915"plot": { 916 917 component: () => __vitePreload(() => import('./Index-c6e4b94b.js'),true?["./Index-c6e4b94b.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-05bf7cea.js","./Button-ccc75ad8.css","./color-20ad9c0d.js","./dsv-a37bb3db.js","./Empty-2eeff83e.js","./BlockLabel-09bb0248.js","./Index-31740b2a.css"]:void 0,import.meta.url) 918 }, 919"radio": { 920 example: () => __vitePreload(() => import('./Example-0b753ad4.js'),true?["./Example-0b753ad4.js","./Example-55d94c71.css"]:void 0,import.meta.url), 921 922 component: () => __vitePreload(() => import('./Index-1755a1b5.js'),true?["./Index-1755a1b5.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./BlockTitle-2fcd9935.js","./Info-8a698008.js","./Example-0b753ad4.js","./Example-55d94c71.css","./Index-f43ff834.css"]:void 0,import.meta.url) 923 }, 924"row": { 925 926 component: () => __vitePreload(() => import('./Index-7cbc3ec9.js'),true?["./Index-7cbc3ec9.js","./Index-815f98ca.css"]:void 0,import.meta.url) 927 }, 928"slider": { 929 example: () => __vitePreload(() => import('./Example-94402048.js'),true?["./Example-94402048.js","./Example-55d94c71.css"]:void 0,import.meta.url), 930 931 component: () => __vitePreload(() => import('./Index-359b67db.js'),true?["./Index-359b67db.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./BlockTitle-2fcd9935.js","./Info-8a698008.js","./Index-61d7d897.css"]:void 0,import.meta.url) 932 }, 933"state": { 934 935 component: () => __vitePreload(() => import('./Index-b2efa79d.js'),true?[]:void 0,import.meta.url) 936 }, 937"statustracker": { 938 939 component: () => __vitePreload(() => import('./index-31bc0cb9.js'),true?["./index-31bc0cb9.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-05bf7cea.js","./Button-ccc75ad8.css"]:void 0,import.meta.url) 940 }, 941"tabitem": { 942 943 component: () => __vitePreload(() => import('./Index-83f3dcd3.js'),true?["./Index-83f3dcd3.js","./Tabs-71f34096.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Tabs-fd1bbe79.css","./Index-24a33ce1.js","./Index-2abed479.css","./Index-f5395e19.css"]:void 0,import.meta.url) 944 }, 945"tabs": { 946 947 component: () => __vitePreload(() => import('./Index-5c0aced9.js'),true?["./Index-5c0aced9.js","./Tabs-71f34096.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Tabs-fd1bbe79.css"]:void 0,import.meta.url) 948 }, 949"textbox": { 950 example: () => __vitePreload(() =>
950 import('./Example-abcadb77.js'),true?["./Example-abcadb77.js","./Example-e8628e88.css"]:void 0,import.meta.url), 951 952 component: () => __vitePreload(() => import('./Index-7a29ee84.js'),true?["./Index-7a29ee84.js","./Textbox-0f39cfc0.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./BlockTitle-2fcd9935.js","./Info-8a698008.js","./Check-1d114215.js","./Copy-ea46e0bf.js","./Textbox-4c6022f4.css","./Example-abcadb77.js","./Example-e8628e88.css"]:void 0,import.meta.url) 953 }, 954"uploadbutton": { 955 956 component: () => __vitePreload(() => import('./Index-11fede97.js'),true?["./Index-11fede97.js","./Button-05bf7cea.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Button-ccc75ad8.css","./Index-1c5a1b9e.css"]:void 0,import.meta.url) 957 }, 958"video": { 959 example: () => __vitePreload(() => import('./Example-25a38da7.js').then(n => n.c),true?["./Example-25a38da7.js","./file-url-1a9970c0.js","./Index-2cec2c56.js","./index-5550136d.js","./index-449ec8c6.css","./Index-0d30506b.css","./Example-0f87229c.css"]:void 0,import.meta.url), 960 961 component: () => __vitePreload(() => import('./index-31b8cb92.js'),true?["./index-31b8cb92.js","./Upload-02e4db12.js","./index-5550136d.js","./index-449ec8c6.css","./Index-2cec2c56.js","./Index-0d30506b.css","./ModifyUpload-968871a9.css","./ModifyUpload-772201f4.js","./Button-05bf7cea.js","./Button-ccc75ad8.css","./IconButton-fb69b8dd.js","./Clear-9760deed.js","./Undo-6c110254.js","./BlockLabel-09bb0248.js","./SelectSource-a1604b96.js","./Upload-8f4bfd80.js","./ImageUploader-0e8da2b3.js","./utils-8f25e669.js","./Empty-2eeff83e.js","./ShareButton-b044e1b5.js","./Download-ea83bae3.js","./Image-6cbf81d1.js","./DropdownArrow-ebaf45e0.js","./ImageUploader-8d3aeb94.css","./Example.
961svelte_svelte_type_style_lang-6aeed26b.js","./file-url-1a9970c0.js","./Example-813cc650.css","./Example-25a38da7.js","./Example-0f87229c.css","./UploadText-7206a31c.js","./index-51c33bea.css"]:void 0,import.meta.url) 962 }, 963 964}; 965 966 967// @ts-nocheck 968 969async function load_component({ api_url, name, id, variant }) { 970 const comps = window.__GRADIO__CC__; 971 972 const _component_map = { 973 // eslint-disable-next-line no-undef 974 ...component_map, 975 ...(!comps ? {} : comps) 976 }; 977 978 try { 979 const c = await ( 980 _component_map?.[id]?.[variant] || // for dev mode custom components 981 _component_map?.[name]?.[variant] 982 )(); 983 return { 984 name, 985 component: c 986 }; 987 } catch (e) { 988 console.error(e); 989 try { 990 await load_css(`${api_url}/custom_component/${id}/${variant}/style.css`); 991 const c = await __vitePreload(() => import( 992 /* @vite-ignore */ `${api_url}/custom_component/${id}/${variant}/index.js` 993 ),true?[]:void 0,import.meta.url); 994 return { 995 name, 996 component: c 997 }; 998 } catch (e) { 999 if (variant === "example") { 1000 return { 1001 name, 1002 component: await __vitePreload(() => import('./Example-b742dabd.js'),true?["./Example-b742dabd.js","./Example-55d94c71.css"]:void 0,import.meta.url) 1003 }; 1004 } 1005 console.error(`failed to load: ${name}`); 1006 console.error(e); 1007 throw e; 1008 } 1009 } 1010} 1011 1012function load_css(url) { 1013 return new Promise((resolve, reject) => { 1014 const link = document.createElement("link"); 1015 link.rel = "stylesheet"; 1016 link.href = url; 1017 document.head.appendChild(link); 1018 link.onload = () => resolve(); 1019 link.onerror = () => reject(); 1020 }); 1021} 1022 1023function create_loading_status_store() { 1024 const store = writable({}); 1025 const fn_inputs = []; 1026 const fn_outputs = []; 1027 const pending_outputs = /* @__PURE__ */ new Map(); 1028 const pending_inputs = /* @__PURE__ */ new Map(); 1029 const inputs_to_update = /* @__PURE__ */ new Map(); 1030 const fn_status = []; 1031 function update({ 1032 fn_index, 1033 status, 1034 queue = true, 1035 size, 1036 position = null, 1037 eta = null, 1038 message = null, 1039 progress 1040 }) { 1041 const outputs = fn_outputs[fn_index]; 1042 const inputs = fn_inputs[fn_index]; 1043 const last_status = fn_status[fn_index]; 1044 const outputs_to_update = outputs.map((id) => { 1045 let new_status; 1046 const pending_count = pending_outputs.get(id) || 0; 1047 if (last_status === "pending" && status !== "pending") { 1048 let new_count = pending_count - 1; 1049 pending_outputs.set(id, new_count < 0 ? 0 : new_count); 1050 new_status = new_count > 0 ? "pending" : status; 1051 } else if (last_status === "pending" && status === "pending") { 1052 new_status = "pending"; 1053 } else if (last_status !== "pending" && status === "pending") { 1054 new_status = "pending"; 1055 pending_outputs.set(id, pending_count + 1); 1056 } else { 1057 new_status = status; 1058 } 1059 return { 1060 id, 1061 queue_position: position, 1062 queue_size: size, 1063 eta, 1064 status: new_status, 1065 message, 1066 progress 1067 }; 1068 }); 1069 inputs.forEach((id) => { 1070 const pending_count = pending_inputs.get(id) || 0; 1071 if (last_status === "pending" && status !== "pending") { 1072 let new_count = pending_count - 1; 1073 pending_inputs.set(id, new_count < 0 ? 0 : new_count); 1074 inputs_to_update.set(id, status); 1075 } else if (last_status !== "pending" && status === "pending") { 1076 pending_inputs.set(id, pending_count + 1); 1077 inputs_to_update.set(id, status); 1078 } else { 1079 inputs_to_update.delete(id); 1080 } 1081 }); 1082 store.update((outputs2) => { 1083 outputs_to_update.forEach( 1084 ({ 1085 id, 1086 queue_position, 1087 queue_size, 1088 eta: eta2, 1089 status: status2, 1090 message: message2, 1091 progress: progress2 1092 }) => { 1093 outputs2[id] = { 1094 queue, 1095 queue_size, 1096 queue_position, 1097 eta: eta2, 1098 message: message2, 1099 progress: progress2, 1100 status: status2, 1101 fn_index 1102 }; 1103 } 1104 ); 1105 return outputs2; 1106 }); 1107 fn_status[fn_index] = status; 1108 } 1109 function register(index, inputs, outputs) {
1110 fn_inputs[index] = inputs; 1111 fn_outputs[index] = outputs; 1112 } 1113 return { 1114 update, 1115 register, 1116 subscribe: store.subscribe, 1117 get_status_for_fn(i) { 1118 return fn_status[i]; 1119 }, 1120 get_inputs_to_update() { 1121 return inputs_to_update; 1122 } 1123 }; 1124} 1125 1126/* src/api_docs/img/clear.svelte generated by Svelte v4.2.2 */ 1127const { 1128 SvelteComponent: SvelteComponent$b, 1129 append: append$8, 1130 attr: attr$8, 1131 detach: detach$a, 1132 init: init$b, 1133 insert: insert$a, 1134 noop: noop$4, 1135 safe_not_equal: safe_not_equal$b, 1136 set_style: set_style$1, 1137 svg_element 1138} = window.__gradio__svelte__internal; 1139function create_fragment$b(ctx) { 1140 let svg; 1141 let g; 1142 let path0; 1143 let path1; 1144 1145 return { 1146 c() { 1147 svg = svg_element("svg"); 1148 g = svg_element("g"); 1149 path0 = svg_element("path"); 1150 path1 = svg_element("path"); 1151 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"); 1152 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"); 1153 attr$8(svg, "width", "100%"); 1154 attr$8(svg, "height", "100%"); 1155 attr$8(svg, "viewBox", "0 0 5 5"); 1156 attr$8(svg, "version", "1.1"); 1157 attr$8(svg, "xmlns", "http://www.w3.org/2000/svg"); 1158 attr$8(svg, "xmlns:xlink", "http://www.w3.org/1999/xlink"); 1159 attr$8(svg, "xml:space", "preserve"); 1160 set_style$1(svg, "fill", "currentColor"); 1161 set_style$1(svg, "fill-rule", "evenodd"); 1162 set_style$1(svg, "clip-rule", "evenodd"); 1163 set_style$1(svg, "stroke-linejoin", "round"); 1164 set_style$1(svg, "stroke-miterlimit", "2"); 1165 }, 1166 m(target, anchor) { 1167 insert$a(target, svg, anchor); 1168 append$8(svg, g); 1169 append$8(g, path0); 1170 append$8(g, path1); 1171 }, 1172 p: noop$4, 1173 i: noop$4, 1174 o: noop$4, 1175 d(detaching) { 1176 if (detaching) { 1177 detach$a(svg); 1178 } 1179 } 1180 }; 1181} 1182 1183class Clear extends SvelteComponent$b { 1184 constructor(options) { 1185 super(); 1186 init$b(this, options, null, create_fragment$b, safe_not_equal$b, {}); 1187 } 1188} 1189 1190const NoApi_svelte_svelte_type_style_lang = ''; 1191 1192/* src/api_docs/NoApi.svelte generated by Svelte v4.2.2 */ 1193const { 1194 SvelteComponent: SvelteComponent$a, 1195 append: append$7, 1196 attr: attr$7, 1197 create_component: create_component$9, 1198 destroy_component: destroy_component$9, 1199 detach: detach$9, 1200 element: element$7, 1201 init: init$a, 1202 insert: insert$9, 1203 listen: listen$3, 1204 mount_component: mount_component$9, 1205 safe_not_equal: safe_not_equal$a, 1206 set_data: set_data$6, 1207 space: space$6, 1208 text: text$7, 1209 transition_in: transition_in$9, 1210 transition_out: transition_out$9 1211} = window.__gradio__svelte__internal; 1212const { createEventDispatcher: createEventDispatcher$4 } = window.__gradio__svelte__internal; 1213function create_fragment$a(ctx) { 1214 let div; 1215 let h1; 1216 let t1; 1217 let p0; 1218 let t2; 1219 let code0; 1220 let t3; 1221 let t4; 1222 let p1; 1223 let t15; 1224 let button; 1225 let clear; 1226 let current; 1227 let mounted; 1228 let dispose; 1229 clear = new Clear({}); 1230 1231 return { 1232 c() { 1233 div = element$7("div"); 1234 h1 = element$7("h1"); 1235 h1.textContent = "API Docs"; 1236 t1 = space$6(); 1237 p0 = element$7("p"); 1238 t2 = text$7("No API Routes found for\n\t\t"); 1239 code0 = element$7("code"); 1240 t3 = text$7(/*root*/ ctx[0]); 1241 t4 = space$6(); 1242 p1 = element$7("p"); 1243 1244 p1.innerHTML = `To expose an API endpoint of your app in this page, set the <code>api_name</code> 1245 parameter of the event listener. 1246 <br/> 1247 For more information, visit the 1248 <a href="https://gradio.app/sharing_your_app/#api-page" target="_blank">API Page guide</a> 1249 . To hide the API documentation button and this page, set 1250 <code>show_api=False</code> 1251 in the 1252 <code>Blocks.launch()</code> 1253 method.`; 1254 1255 t15 = space$6(); 1256 button = element$7("button"); 1257 create_component$9(clear.$$.fragment); 1258 attr$7(code0, "class", "svelte-e1ha0f"); 1259 attr$7(p0, "class", "attention svelte-e1ha0f"); 1260 attr$7(div, "class", "wrap prose svelte-e1ha0f"); 1261 attr$7(button, "class", "svelte-e1ha0f"); 1262 }, 1263 m(target, anchor) { 1264 insert$9(target, div, anchor); 1265 append$7(div, h1); 1266 append$7(div, t1); 1267 append$7(div, p0); 1268 append$7(p0, t2); 1269 append$7(p0, code0); 1270 append$7(code0, t3); 1271 append$7(div, t4); 1272 append$7(div, p1); 1273 insert$9(target, t15, anchor); 1274 insert$9(target, button, anchor);
1275 mount_component$9(clear, button, null); 1276 current = true; 1277 1278 if (!mounted) { 1279 dispose = listen$3(button, "click", /*click_handler*/ ctx[2]); 1280 mounted = true; 1281 } 1282 }, 1283 p(ctx, [dirty]) { 1284 if (!current || dirty & /*root*/ 1) set_data$6(t3, /*root*/ ctx[0]); 1285 }, 1286 i(local) { 1287 if (current) return; 1288 transition_in$9(clear.$$.fragment, local); 1289 current = true; 1290 }, 1291 o(local) { 1292 transition_out$9(clear.$$.fragment, local); 1293 current = false; 1294 }, 1295 d(detaching) { 1296 if (detaching) { 1297 detach$9(div); 1298 detach$9(t15); 1299 detach$9(button); 1300 } 1301 1302 destroy_component$9(clear); 1303 mounted = false; 1304 dispose(); 1305 } 1306 }; 1307} 1308 1309function instance$a($$self, $$props, $$invalidate) { 1310 const dispatch = createEventDispatcher$4(); 1311 let { root } = $$props; 1312 const click_handler = () => dispatch("close"); 1313 1314 $$self.$$set = $$props => { 1315 if ('root' in $$props) $$invalidate(0, root = $$props.root); 1316 }; 1317 1318 return [root, dispatch, click_handler]; 1319} 1320 1321class NoApi extends SvelteComponent$a { 1322 constructor(options) { 1323 super(); 1324 init$a(this, options, instance$a, create_fragment$a, safe_not_equal$a, { root: 0 }); 1325 } 1326} 1327 1328function represent_value(value, type, lang = null) { 1329 if (type === void 0) { 1330 return lang === "py" ? "None" : null; 1331 } 1332 if (type === "string" || type === "str") { 1333 return lang === null ? value : '"' + value + '"'; 1334 } else if (type === "number") { 1335 return lang === null ? parseFloat(value) : value; 1336 } else if (type === "boolean" || type == "bool") { 1337 if (lang === "py") { 1338 value = String(value); 1339 return value === "true" ? "True" : "False"; 1340 } else if (lang === "js") { 1341 return value; 1342 } 1343 return value === "true"; 1344 } else if (type === "List[str]") { 1345 value = JSON.stringify(value); 1346 return value; 1347 } 1348 if (lang === null) { 1349 return value === "" ? null : JSON.parse(value); 1350 } else if (typeof value === "string") { 1351 if (value === "") { 1352 return lang === "py" ? "None" : "null"; 1353 } 1354 return value; 1355 } 1356 return JSON.stringify(value); 1357} 1358 1359const api_logo = ""+new URL('api-logo-5346f193.svg', import.meta.url).href+""; 1360 1361const ApiBanner_svelte_svelte_type_style_lang = ''; 1362 1363/* src/api_docs/ApiBanner.svelte generated by Svelte v4.2.2 */ 1364const { 1365 SvelteComponent: SvelteComponent$9, 1366 append: append$6, 1367 attr: attr$6, 1368 create_component: create_component$8, 1369 destroy_component: destroy_component$8, 1370 detach: detach$8, 1371 element: element$6, 1372 init: init$9, 1373 insert: insert$8, 1374 listen: listen$2, 1375 mount_component: mount_component$8, 1376 safe_not_equal: safe_not_equal$9, 1377 set_data: set_data$5, 1378 space: space$5, 1379 src_url_equal: src_url_equal$2, 1380 text: text$6, 1381 transition_in: transition_in$8, 1382 transition_out: transition_out$8 1383} = window.__gradio__svelte__internal; 1384const { createEventDispatcher: createEventDispatcher$3 } = window.__gradio__svelte__internal; 1385function create_if_block$7(ctx) { 1386 let t; 1387 1388 return { 1389 c() { 1390 t = text$6("s"); 1391 }, 1392 m(target, anchor) { 1393 insert$8(target, t, anchor); 1394 }, 1395 d(detaching) { 1396 if (detaching) { 1397 detach$8(t); 1398 } 1399 } 1400 }; 1401} 1402 1403function create_fragment$9(ctx) { 1404 let h2; 1405 let img; 1406 let img_src_value; 1407 let t0; 1408 let div1; 1409 let t1; 1410 let div0; 1411 let t2; 1412 let t3; 1413 let span1; 1414 let span0; 1415 let t4; 1416 let t5; 1417 let t6; 1418 let button; 1419 let clear; 1420 let current; 1421 let mounted; 1422 let dispose; 1423 let if_block = /*api_count*/ ctx[1] > 1 && create_if_block$7(); 1424 clear = new Clear({}); 1425 1426 return { 1427 c() { 1428 h2 = element$6("h2"); 1429 img = element$6("img"); 1430 t0 = space$5(); 1431 div1 = element$6("div"); 1432 t1 = text$6("API documentation\n\t\t"); 1433 div0 = element$6("div"); 1434 t2 = text$6(/*root*/ ctx[0]); 1435 t3 = space$5(); 1436 span1 = element$6("span"); 1437 span0 = element$6("span"); 1438 t4 = text$6(/*api_count*/ ctx[1]); 1439 t5 = text$6(" API endpoint"); 1440 if (if_block) if_block.c(); 1441 t6 = space$5(); 1442 button = element$6("button"); 1443 create_component$8(clear.$$.fragment); 1444 if (!src_url_equal$2(img.src, img_src_value = api_logo)) attr$6(img, "src", img_src_value); 1445 attr$6(img, "alt", ""); 1446 attr$6(img, "class", "svelte-3n2nxs"); 1447 attr$6(div0, "class", "url svelte-3n2nxs"); 1448 attr$6(span0, "class", "url svelte-3n2nxs"); 1449 attr$6(span1, "class", "counts svelte-3n2nxs"); 1450 attr$6(h2, "class", "svelte-3n2nxs"); 1451 attr$6(button, "class", "svelte-3n2nxs"); 1452 }, 1453 m(target, anchor) { 1454 insert$8(target, h2, anchor); 1455 append$6(h2, img); 1456 append$6(h2, t0); 1457 append$6(h2, div1); 1458 append$6(div1, t1); 1459 append$6(div1, div0); 1460 append$6(div0, t2); 1461 append$6(h2, t3); 1462 append$6(h2, span1); 1463 append$6(span1, span0); 1464 append$6(span0, t4); 1465 append$6(span1, t5); 1466 if (if_block) if_block.m(span1, null); 1467 insert$8(target, t6, anchor); 1468 insert$8(target, button, anchor);
1469 mount_component$8(clear, button, null); 1470 current = true; 1471 1472 if (!mounted) { 1473 dispose = listen$2(button, "click", /*click_handler*/ ctx[3]); 1474 mounted = true; 1475 } 1476 }, 1477 p(ctx, [dirty]) { 1478 if (!current || dirty & /*root*/ 1) set_data$5(t2, /*root*/ ctx[0]); 1479 if (!current || dirty & /*api_count*/ 2) set_data$5(t4, /*api_count*/ ctx[1]); 1480 1481 if (/*api_count*/ ctx[1] > 1) { 1482 if (if_block) ; else { 1483 if_block = create_if_block$7(); 1484 if_block.c(); 1485 if_block.m(span1, null); 1486 } 1487 } else if (if_block) { 1488 if_block.d(1); 1489 if_block = null; 1490 } 1491 }, 1492 i(local) { 1493 if (current) return; 1494 transition_in$8(clear.$$.fragment, local); 1495 current = true; 1496 }, 1497 o(local) { 1498 transition_out$8(clear.$$.fragment, local); 1499 current = false; 1500 }, 1501 d(detaching) { 1502 if (detaching) { 1503 detach$8(h2); 1504 detach$8(t6); 1505 detach$8(button); 1506 } 1507 1508 if (if_block) if_block.d(); 1509 destroy_component$8(clear); 1510 mounted = false; 1511 dispose(); 1512 } 1513 }; 1514} 1515 1516function instance$9($$self, $$props, $$invalidate) { 1517 let { root } = $$props; 1518 let { api_count } = $$props; 1519 const dispatch = createEventDispatcher$3(); 1520 const click_handler = () => dispatch("close"); 1521 1522 $$self.$$set = $$props => {
1523 if ('root' in $$props) $$invalidate(0, root = $$props.root); 1524 if ('api_count' in $$props) $$invalidate(1, api_count = $$props.api_count); 1525 }; 1526 1527 return [root, api_count, dispatch, click_handler]; 1528} 1529 1530class ApiBanner extends SvelteComponent$9 { 1531 constructor(options) { 1532 super(); 1533 init$9(this, options, instance$9, create_fragment$9, safe_not_equal$9, { root: 0, api_count: 1 }); 1534 } 1535} 1536 1537const ResponseObject_svelte_svelte_type_style_lang = ''; 1538 1539/* src/api_docs/ResponseObject.svelte generated by Svelte v4.2.2 */ 1540const { 1541 SvelteComponent: SvelteComponent$8, 1542 append: append$5, 1543 attr: attr$5, 1544 check_outros: check_outros$5, 1545 create_component: create_component$7, 1546 destroy_component: destroy_component$7, 1547 destroy_each: destroy_each$2, 1548 detach: detach$7, 1549 element: element$5, 1550 empty: empty$5, 1551 ensure_array_like: ensure_array_like$3, 1552 group_outros: group_outros$5, 1553 init: init$8, 1554 insert: insert$7, 1555 mount_component: mount_component$7, 1556 safe_not_equal: safe_not_equal$8, 1557 set_data: set_data$4, 1558 space: space$4, 1559 text: text$5, 1560 toggle_class, 1561 transition_in: transition_in$7, 1562 transition_out: transition_out$7 1563} = window.__gradio__svelte__internal; 1564function get_each_context$3(ctx, list, i) { 1565 const child_ctx = ctx.slice(); 1566 child_ctx[4] = list[i].label; 1567 child_ctx[5] = list[i].type; 1568 child_ctx[6] = list[i].python_type; 1569 child_ctx[7] = list[i].component; 1570 child_ctx[8] = list[i].serializer; 1571 child_ctx[10] = i; 1572 return child_ctx; 1573} 1574 1575// (18:3) {#if endpoint_returns.length > 1} 1576function create_if_block_6$2(ctx) { 1577 let t; 1578 1579 return { 1580 c() { 1581 t = text$5("("); 1582 }, 1583 m(target, anchor) { 1584 insert$7(target, t, anchor); 1585 }, 1586 d(detaching) { 1587 if (detaching) { 1588 detach$7(t); 1589 } 1590 } 1591 }; 1592} 1593 1594// (23:132) {:else} 1595function create_else_block$3(ctx) { 1596 let t_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].type + ""; 1597 let t; 1598 let if_block_anchor; 1599 let if_block = /*js_returns*/ ctx[2][/*i*/ ctx[10]].description && create_if_block_5$3(ctx); 1600 1601 return { 1602 c() { 1603 t = text$5(t_value); 1604 if (if_block) if_block.c(); 1605 if_block_anchor = empty$5(); 1606 }, 1607 m(target, anchor) { 1608 insert$7(target, t, anchor); 1609 if (if_block) if_block.m(target, anchor); 1610 insert$7(target, if_block_anchor, anchor); 1611 }, 1612 p(ctx, dirty) { 1613 if (dirty & /*js_returns*/ 4 && t_value !== (t_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].type + "")) set_data$4(t, t_value); 1614 1615 if (/*js_returns*/ ctx[2][/*i*/ ctx[10]].description) { 1616 if (if_block) { 1617 if_block.p(ctx, dirty); 1618 } else { 1619 if_block = create_if_block_5$3(ctx); 1620 if_block.c(); 1621 if_block.m(if_block_anchor.parentNode, if_block_anchor); 1622 } 1623 } else if (if_block) { 1624 if_block.d(1); 1625 if_block = null; 1626 } 1627 }, 1628 d(detaching) { 1629 if (detaching) { 1630 detach$7(t); 1631 detach$7(if_block_anchor); 1632 } 1633 1634 if (if_block) if_block.d(detaching); 1635 } 1636 }; 1637} 1638 1639// (23:11) {#if current_language === "python"} 1640function create_if_block_3$3(ctx) { 1641 let t_value = /*python_type*/ ctx[6].type + ""; 1642 let t; 1643 let if_block_anchor; 1644 let if_block = /*python_type*/ ctx[6]?.description && create_if_block_4$3(ctx); 1645 1646 return { 1647 c() { 1648 t = text$5(t_value); 1649 if (if_block) if_block.c(); 1650 if_block_anchor = empty$5(); 1651 }, 1652 m(target, anchor) { 1653 insert$7(target, t, anchor); 1654 if (if_block) if_block.m(target, anchor); 1655 insert$7(target, if_block_anchor, anchor); 1656 }, 1657 p(ctx, dirty) { 1658 if (dirty & /*endpoint_returns*/ 2 && t_value !== (t_value = /*python_type*/ ctx[6].type + "")) set_data$4(t, t_value); 1659 1660 if (/*python_type*/ ctx[6]?.description) { 1661 if (if_block) { 1662 if_block.p(ctx, dirty); 1663 } else { 1664 if_block = create_if_block_4$3(ctx); 1665 if_block.c(); 1666 if_block.m(if_block_anchor.parentNode, if_block_anchor); 1667 } 1668 } else if (if_block) { 1669 if_block.d(1); 1670 if_block = null; 1671 } 1672 }, 1673 d(detaching) { 1674 if (detaching) { 1675 detach$7(t); 1676 detach$7(if_block_anchor); 1677 } 1678 1679 if (if_block) if_block.d(detaching); 1680 } 1681 }; 1682} 1683 1684// (25:14) {#if js_returns[i].description} 1685function create_if_block_5$3(ctx) { 1686 let t0; 1687 let t1_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].description + ""; 1688 let t1; 1689 let t2; 1690 1691 return { 1692 c() { 1693 t0 = text$5("Â ("); 1694 t1 = text$5(t1_value); 1695 t2 = text$5(")"); 1696 }, 1697 m(target, anchor) { 1698 insert$7(target, t0, anchor); 1699 insert$7(target, t1, anchor); 1700 insert$7(target, t2, anchor); 1701 }, 1702 p(ctx, dirty) {
1703 if (dirty & /*js_returns*/ 4 && t1_value !== (t1_value = /*js_returns*/ ctx[2][/*i*/ ctx[10]].description + "")) set_data$4(t1, t1_value); 1704 }, 1705 d(detaching) { 1706 if (detaching) { 1707 detach$7(t0); 1708 detach$7(t1); 1709 detach$7(t2); 1710 } 1711 } 1712 }; 1713} 1714 1715// (23:64) {#if python_type?.description} 1716function create_if_block_4$3(ctx) { 1717 let t0; 1718 let t1_value = /*python_type*/ ctx[6].description + ""; 1719 let t1; 1720 let t2; 1721 1722 return { 1723 c() { 1724 t0 = text$5("Â ("); 1725 t1 = text$5(t1_value); 1726 t2 = text$5(")"); 1727 }, 1728 m(target, anchor) { 1729 insert$7(target, t0, anchor); 1730 insert$7(target, t1, anchor); 1731 insert$7(target, t2, anchor); 1732 }, 1733 p(ctx, dirty) { 1734 if (dirty & /*endpoint_returns*/ 2 && t1_value !== (t1_value = /*python_type*/ ctx[6].description + "")) set_data$4(t1, t1_value); 1735 }, 1736 d(detaching) { 1737 if (detaching) { 1738 detach$7(t0); 1739 detach$7(t1); 1740 detach$7(t2); 1741 } 1742 } 1743 }; 1744} 1745 1746// (32:6) {#if endpoint_returns.length > 1} 1747function create_if_block_2$3(ctx) { 1748 let t; 1749 1750 return { 1751 c() { 1752 t = text$5(","); 1753 }, 1754 m(target, anchor) { 1755 insert$7(target, t, anchor); 1756 }, 1757 d(detaching) { 1758 if (detaching) { 1759 detach$7(t); 1760 } 1761 } 1762 }; 1763} 1764 1765// (19:3) {#each endpoint_returns as { label, type, python_type, component, serializer } 1766function create_each_block$3(ctx) { 1767 let div; 1768 let span; 1769 let t0; 1770 let t1; 1771 let t2_value = /*label*/ ctx[4] + ""; 1772 let t2; 1773 let t3; 1774 let t4_value = /*component*/ ctx[7] + ""; 1775 let t4; 1776 let t5; 1777 1778 function select_block_type(ctx, dirty) { 1779 if (/*current_language*/ ctx[3] === "python") return create_if_block_3$3; 1780 return create_else_block$3; 1781 } 1782 1783 let current_block_type = select_block_type(ctx); 1784 let if_block0 = current_block_type(ctx); 1785 let if_block1 = /*endpoint_returns*/ ctx[1].length > 1 && create_if_block_2$3(); 1786 1787 return { 1788 c() { 1789 div = element$5("div"); 1790 span = element$5("span"); 1791 t0 = text$5("# "); 1792 if_block0.c(); 1793 t1 = text$5("\n\t\t\t\t\t\trepresenting output in '"); 1794 t2 = text$5(t2_value); 1795 t3 = text$5("' "); 1796 t4 = text$5(t4_value); 1797 t5 = text$5("\n\t\t\t\t\t\tcomponent"); 1798 if (if_block1) if_block1.c(); 1799 attr$5(span, "class", "desc svelte-1c7hj3i"); 1800 attr$5(div, "class", "svelte-1c7hj3i"); 1801 toggle_class(div, "second-level", /*endpoint_returns*/ ctx[1].length > 1); 1802 }, 1803 m(target, anchor) { 1804 insert$7(target, div, anchor); 1805 append$5(div, span); 1806 append$5(span, t0); 1807 if_block0.m(span, null); 1808 append$5(span, t1); 1809 append$5(span, t2); 1810 append$5(span, t3); 1811 append$5(span, t4); 1812 append$5(span, t5); 1813 if (if_block1) if_block1.m(div, null); 1814 }, 1815 p(ctx, dirty) { 1816 if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block0) { 1817 if_block0.p(ctx, dirty); 1818 } else { 1819 if_block0.d(1); 1820 if_block0 = current_block_type(ctx); 1821 1822 if (if_block0) { 1823 if_block0.c(); 1824 if_block0.m(span, t1); 1825 } 1826 } 1827 1828 if (dirty & /*endpoint_returns*/ 2 && t2_value !== (t2_value = /*label*/ ctx[4] + "")) set_data$4(t2, t2_value); 1829 if (dirty & /*endpoint_returns*/ 2 && t4_value !== (t4_value = /*component*/ ctx[7] + "")) set_data$4(t4, t4_value); 1830 1831 if (/*endpoint_returns*/ ctx[1].length > 1) { 1832 if (if_block1) ; else { 1833 if_block1 = create_if_block_2$3(); 1834 if_block1.c(); 1835 if_block1.m(div, null); 1836 } 1837 } else if (if_block1) { 1838 if_block1.d(1); 1839 if_block1 = null; 1840 } 1841 1842 if (dirty & /*endpoint_returns*/ 2) { 1843 toggle_class(div, "second-level", /*endpoint_returns*/ ctx[1].length > 1); 1844 } 1845 }, 1846 d(detaching) { 1847 if (detaching) { 1848 detach$7(div); 1849 } 1850 1851 if_block0.d(); 1852 if (if_block1) if_block1.d(); 1853 } 1854 }; 1855} 1856 1857// (35:3) {#if endpoint_returns.length > 1} 1858function create_if_block_1$4(ctx) { 1859 let t; 1860 1861 return { 1862 c() { 1863 t = text$5(")"); 1864 }, 1865 m(target, anchor) { 1866 insert$7(target, t, anchor); 1867 }, 1868 d(detaching) { 1869 if (detaching) { 1870 detach$7(t); 1871 } 1872 } 1873 }; 1874} 1875 1876// (37:2) {#if is_running} 1877function create_if_block$6(ctx) { 1878 let div; 1879 let loader; 1880 let current; 1881 loader = new Loader({ props: { margin: false } }); 1882 1883 return { 1884 c() { 1885 div = element$5("div"); 1886 create_component$7(loader.$$.fragment); 1887 attr$5(div, "class", "load-wrap svelte-1c7hj3i"); 1888 }, 1889 m(target, anchor) { 1890 insert$7(target, div, anchor);
1891 mount_component$7(loader, div, null); 1892 current = true; 1893 }, 1894 i(local) { 1895 if (current) return; 1896 transition_in$7(loader.$$.fragment, local); 1897 current = true; 1898 }, 1899 o(local) { 1900 transition_out$7(loader.$$.fragment, local); 1901 current = false; 1902 }, 1903 d(detaching) { 1904 if (detaching) { 1905 detach$7(div); 1906 } 1907 1908 destroy_component$7(loader); 1909 } 1910 }; 1911} 1912 1913// (15:0) <Block> 1914function create_default_slot$4(ctx) { 1915 let div1; 1916 let div0; 1917 let t0; 1918 let t1; 1919 let t2; 1920 let current; 1921 let if_block0 = /*endpoint_returns*/ ctx[1].length > 1 && create_if_block_6$2(); 1922 let each_value = ensure_array_like$3(/*endpoint_returns*/ ctx[1]); 1923 let each_blocks = []; 1924 1925 for (let i = 0; i < each_value.length; i += 1) { 1926 each_blocks[i] = create_each_block$3(get_each_context$3(ctx, each_value, i)); 1927 } 1928 1929 let if_block1 = /*endpoint_returns*/ ctx[1].length > 1 && create_if_block_1$4(); 1930 let if_block2 = /*is_running*/ ctx[0] && create_if_block$6(); 1931 1932 return { 1933 c() { 1934 div1 = element$5("div"); 1935 div0 = element$5("div"); 1936 if (if_block0) if_block0.c(); 1937 t0 = space$4(); 1938 1939 for (let i = 0; i < each_blocks.length; i += 1) { 1940 each_blocks[i].c(); 1941 } 1942 1943 t1 = space$4(); 1944 if (if_block1) if_block1.c(); 1945 t2 = space$4(); 1946 if (if_block2) if_block2.c(); 1947 attr$5(div0, "class", "svelte-1c7hj3i"); 1948 toggle_class(div0, "hide", /*is_running*/ ctx[0]); 1949 attr$5(div1, "class", "response-wrap svelte-1c7hj3i"); 1950 }, 1951 m(target, anchor) { 1952 insert$7(target, div1, anchor); 1953 append$5(div1, div0); 1954 if (if_block0) if_block0.m(div0, null); 1955 append$5(div0, t0); 1956 1957 for (let i = 0; i < each_blocks.length; i += 1) { 1958 if (each_blocks[i]) { 1959 each_blocks[i].m(div0, null); 1960 } 1961 } 1962 1963 append$5(div0, t1); 1964 if (if_block1) if_block1.m(div0, null); 1965 append$5(div1, t2); 1966 if (if_block2) if_block2.m(div1, null); 1967 current = true; 1968 }, 1969 p(ctx, dirty) { 1970 if (/*endpoint_returns*/ ctx[1].length > 1) { 1971 if (if_block0) ; else { 1972 if_block0 = create_if_block_6$2(); 1973 if_block0.c(); 1974 if_block0.m(div0, t0); 1975 } 1976 } else if (if_block0) { 1977 if_block0.d(1); 1978 if_block0 = null; 1979 } 1980 1981 if (dirty & /*endpoint_returns, current_language, js_returns*/ 14) { 1982 each_value = ensure_array_like$3(/*endpoint_returns*/ ctx[1]); 1983 let i; 1984 1985 for (i = 0; i < each_value.length; i += 1) { 1986 const child_ctx = get_each_context$3(ctx, each_value, i); 1987 1988 if (each_blocks[i]) { 1989 each_blocks[i].p(child_ctx, dirty); 1990 } else { 1991 each_blocks[i] = create_each_block$3(child_ctx); 1992 each_blocks[i].c(); 1993 each_blocks[i].m(div0, t1); 1994 } 1995 } 1996 1997 for (; i < each_blocks.length; i += 1) { 1998 each_blocks[i].d(1); 1999 } 2000 2001 each_blocks.length = each_value.length; 2002 } 2003 2004 if (/*endpoint_returns*/ ctx[1].length > 1) { 2005 if (if_block1) ; else { 2006 if_block1 = create_if_block_1$4(); 2007 if_block1.c(); 2008 if_block1.m(div0, null); 2009 } 2010 } else if (if_block1) { 2011 if_block1.d(1); 2012 if_block1 = null; 2013 } 2014 2015 if (!current || dirty & /*is_running*/ 1) { 2016 toggle_class(div0, "hide", /*is_running*/ ctx[0]); 2017 } 2018 2019 if (/*is_running*/ ctx[0]) { 2020 if (if_block2) { 2021 if (dirty & /*is_running*/ 1) { 2022 transition_in$7(if_block2, 1); 2023 } 2024 } else { 2025 if_block2 = create_if_block$6(); 2026 if_block2.c(); 2027 transition_in$7(if_block2, 1); 2028 if_block2.m(div1, null); 2029 } 2030 } else if (if_block2) { 2031 group_outros$5(); 2032 2033 transition_out$7(if_block2, 1, 1, () => { 2034 if_block2 = null; 2035 }); 2036 2037 check_outros$5(); 2038 } 2039 }, 2040 i(local) { 2041 if (current) return; 2042 transition_in$7(if_block2); 2043 current = true; 2044 }, 2045 o(local) { 2046 transition_out$7(if_block2); 2047 current = false; 2048 }, 2049 d(detaching) { 2050 if (detaching) { 2051 detach$7(div1); 2052 } 2053 2054 if (if_block0) if_block0.d(); 2055 destroy_each$2(each_blocks, detaching); 2056 if (if_block1) if_block1.d(); 2057 if (if_block2) if_block2.d(); 2058 } 2059 }; 2060} 2061 2062function create_fragment$8(ctx) { 2063 let h4; 2064 let t1; 2065 let block; 2066 let current; 2067 2068 block = new Block({ 2069 props: { 2070 $$slots: { default: [create_default_slot$4] }, 2071 $$scope: { ctx } 2072 } 2073 }); 2074 2075 return { 2076 c() { 2077 h4 = element$5("h4"); 2078 2079 h4.innerHTML = `<div class="toggle-icon svelte-1c7hj3i"><div class="toggle-dot svelte-1c7hj3i"></div></div> 2080 Return Type(s)`; 2081 2082 t1 = space$4(); 2083 create_component$7(block.$$.fragment); 2084 attr$5(h4, "class", "svelte-1c7hj3i"); 2085 }, 2086 m(target, anchor) {
2087 insert$7(target, h4, anchor); 2088 insert$7(target, t1, anchor); 2089 mount_component$7(block, target, anchor); 2090 current = true; 2091 }, 2092 p(ctx, [dirty]) { 2093 const block_changes = {}; 2094 2095 if (dirty & /*$$scope, is_running, endpoint_returns, current_language, js_returns*/ 2063) { 2096 block_changes.$$scope = { dirty, ctx }; 2097 } 2098 2099 block.$set(block_changes); 2100 }, 2101 i(local) { 2102 if (current) return; 2103 transition_in$7(block.$$.fragment, local); 2104 current = true; 2105 }, 2106 o(local) { 2107 transition_out$7(block.$$.fragment, local); 2108 current = false; 2109 }, 2110 d(detaching) { 2111 if (detaching) { 2112 detach$7(h4); 2113 detach$7(t1); 2114 } 2115 2116 destroy_component$7(block, detaching); 2117 } 2118 }; 2119} 2120 2121function instance$8($$self, $$props, $$invalidate) { 2122 let { is_running } = $$props; 2123 let { endpoint_returns } = $$props; 2124 let { js_returns } = $$props; 2125 let { current_language } = $$props; 2126 2127 $$self.$$set = $$props => { 2128 if ('is_running' in $$props) $$invalidate(0, is_running = $$props.is_running); 2129 if ('endpoint_returns' in $$props) $$invalidate(1, endpoint_returns = $$props.endpoint_returns);
2130 if ('js_returns' in $$props) $$invalidate(2, js_returns = $$props.js_returns); 2131 if ('current_language' in $$props) $$invalidate(3, current_language = $$props.current_language); 2132 }; 2133 2134 return [is_running, endpoint_returns, js_returns, current_language]; 2135} 2136 2137class ResponseObject extends SvelteComponent$8 { 2138 constructor(options) { 2139 super(); 2140 2141 init$8(this, options, instance$8, create_fragment$8, safe_not_equal$8, { 2142 is_running: 0, 2143 endpoint_returns: 1, 2144 js_returns: 2, 2145 current_language: 3 2146 }); 2147 } 2148} 2149 2150/* src/api_docs/CopyButton.svelte generated by Svelte v4.2.2 */ 2151const { 2152 SvelteComponent: SvelteComponent$7, 2153 create_component: create_component$6, 2154 destroy_component: destroy_component$6, 2155 detach: detach$6, 2156 init: init$7, 2157 insert: insert$6, 2158 mount_component: mount_component$6, 2159 safe_not_equal: safe_not_equal$7, 2160 set_data: set_data$3, 2161 text: text$4, 2162 transition_in: transition_in$6, 2163 transition_out: transition_out$6 2164} = window.__gradio__svelte__internal; 2165function create_default_slot$3(ctx) { 2166 let t; 2167 2168 return { 2169 c() { 2170 t = text$4(/*copy_text*/ ctx[0]); 2171 }, 2172 m(target, anchor) { 2173 insert$6(target, t, anchor); 2174 }, 2175 p(ctx, dirty) { 2176 if (dirty & /*copy_text*/ 1) set_data$3(t, /*copy_text*/ ctx[0]); 2177 }, 2178 d(detaching) { 2179 if (detaching) { 2180 detach$6(t); 2181 } 2182 } 2183 }; 2184} 2185 2186function create_fragment$7(ctx) { 2187 let basebutton; 2188 let current; 2189 2190 basebutton = new Button({ 2191 props: { 2192 size: "sm", 2193 $$slots: { default: [create_default_slot$3] }, 2194 $$scope: { ctx } 2195 } 2196 }); 2197 2198 basebutton.$on("click", /*copy*/ ctx[1]); 2199 2200 return { 2201 c() { 2202 create_component$6(basebutton.$$.fragment); 2203 }, 2204 m(target, anchor) { 2205 mount_component$6(basebutton, target, anchor); 2206 current = true; 2207 }, 2208 p(ctx, [dirty]) { 2209 const basebutton_changes = {}; 2210 2211 if (dirty & /*$$scope, copy_text*/ 9) { 2212 basebutton_changes.$$scope = { dirty, ctx }; 2213 } 2214 2215 basebutton.$set(basebutton_changes); 2216 }, 2217 i(local) { 2218 if (current) return; 2219 transition_in$6(basebutton.$$.fragment, local); 2220 current = true; 2221 }, 2222 o(local) { 2223 transition_out$6(basebutton.$$.fragment, local); 2224 current = false; 2225 }, 2226 d(detaching) { 2227 destroy_component$6(basebutton, detaching); 2228 } 2229 }; 2230} 2231 2232function instance$7($$self, $$props, $$invalidate) { 2233 let { code } = $$props; 2234 let copy_text = "copy"; 2235 2236 function copy() { 2237 navigator.clipboard.writeText(code); 2238 $$invalidate(0, copy_text = "copied!"); 2239 2240 setTimeout( 2241 () => { 2242 $$invalidate(0, copy_text = "copy"); 2243 }, 2244 1500 2245 ); 2246 } 2247 2248 $$self.$$set = $$props => {
2249 if ('code' in $$props) $$invalidate(2, code = $$props.code); 2250 }; 2251 2252 return [copy_text, copy, code]; 2253} 2254 2255class CopyButton extends SvelteComponent$7 { 2256 constructor(options) { 2257 super(); 2258 init$7(this, options, instance$7, create_fragment$7, safe_not_equal$7, { code: 2 }); 2259 } 2260} 2261 2262const InstallSnippet_svelte_svelte_type_style_lang = ''; 2263 2264/* src/api_docs/InstallSnippet.svelte generated by Svelte v4.2.2 */ 2265const { 2266 SvelteComponent: SvelteComponent$6, 2267 append: append$4, 2268 attr: attr$4, 2269 check_outros: check_outros$4, 2270 create_component: create_component$5, 2271 destroy_component: destroy_component$5, 2272 detach: detach$5, 2273 element: element$4, 2274 group_outros: group_outros$4, 2275 init: init$6, 2276 insert: insert$5, 2277 mount_component: mount_component$5, 2278 noop: noop$3, 2279 safe_not_equal: safe_not_equal$6, 2280 space: space$3, 2281 transition_in: transition_in$5, 2282 transition_out: transition_out$5 2283} = window.__gradio__svelte__internal; 2284function create_if_block_1$3(ctx) { 2285 let div0; 2286 let copybutton; 2287 let t0; 2288 let div1; 2289 let pre; 2290 let current; 2291 copybutton = new CopyButton({ props: { code: js_install } }); 2292 2293 return { 2294 c() { 2295 div0 = element$4("div"); 2296 create_component$5(copybutton.$$.fragment); 2297 t0 = space$3(); 2298 div1 = element$4("div"); 2299 pre = element$4("pre"); 2300 pre.textContent = `\$ ${js_install}`; 2301 attr$4(div0, "class", "copy svelte-hq8ezf"); 2302 attr$4(pre, "class", "svelte-hq8ezf"); 2303 }, 2304 m(target, anchor) { 2305 insert$5(target, div0, anchor); 2306 mount_component$5(copybutton, div0, null); 2307 insert$5(target, t0, anchor); 2308 insert$5(target, div1, anchor); 2309 append$4(div1, pre); 2310 current = true; 2311 }, 2312 p: noop$3, 2313 i(local) { 2314 if (current) return; 2315 transition_in$5(copybutton.$$.fragment, local); 2316 current = true; 2317 }, 2318 o(local) { 2319 transition_out$5(copybutton.$$.fragment, local); 2320 current = false; 2321 }, 2322 d(detaching) { 2323 if (detaching) { 2324 detach$5(div0); 2325 detach$5(t0); 2326 detach$5(div1); 2327 } 2328 2329 destroy_component$5(copybutton); 2330 } 2331 }; 2332} 2333 2334// (10:2) {#if current_language === "python"} 2335function create_if_block$5(ctx) { 2336 let div0; 2337 let copybutton; 2338 let t0; 2339 let div1; 2340 let pre; 2341 let current; 2342 copybutton = new CopyButton({ props: { code: py_install } }); 2343 2344 return { 2345 c() { 2346 div0 = element$4("div"); 2347 create_component$5(copybutton.$$.fragment); 2348 t0 = space$3(); 2349 div1 = element$4("div"); 2350 pre = element$4("pre"); 2351 pre.textContent = `\$ ${py_install}`; 2352 attr$4(div0, "class", "copy svelte-hq8ezf"); 2353 attr$4(pre, "class", "svelte-hq8ezf"); 2354 }, 2355 m(target, anchor) { 2356 insert$5(target, div0, anchor); 2357 mount_component$5(copybutton, div0, null); 2358 insert$5(target, t0, anchor); 2359 insert$5(target, div1, anchor); 2360 append$4(div1, pre); 2361 current = true; 2362 }, 2363 p: noop$3, 2364 i(local) { 2365 if (current) return; 2366 transition_in$5(copybutton.$$.fragment, local); 2367 current = true; 2368 }, 2369 o(local) { 2370 transition_out$5(copybutton.$$.fragment, local); 2371 current = false; 2372 }, 2373 d(detaching) { 2374 if (detaching) { 2375 detach$5(div0); 2376 detach$5(t0); 2377 detach$5(div1); 2378 } 2379 2380 destroy_component$5(copybutton); 2381 } 2382 }; 2383} 2384 2385// (8:0) <Block> 2386function create_default_slot$2(ctx) { 2387 let code; 2388 let current_block_type_index; 2389 let if_block; 2390 let current; 2391 const if_block_creators = [create_if_block$5, create_if_block_1$3]; 2392 const if_blocks = []; 2393 2394 function select_block_type(ctx, dirty) { 2395 if (/*current_language*/ ctx[0] === "python") return 0; 2396 if (/*current_language*/ ctx[0] === "javascript") return 1; 2397 return -1; 2398 } 2399 2400 if (~(current_block_type_index = select_block_type(ctx))) { 2401 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2402 } 2403 2404 return { 2405 c() { 2406 code = element$4("code"); 2407 if (if_block) if_block.c(); 2408 attr$4(code, "class", "svelte-hq8ezf"); 2409 }, 2410 m(target, anchor) { 2411 insert$5(target, code, anchor); 2412 2413 if (~current_block_type_index) { 2414 if_blocks[current_block_type_index].m(code, null); 2415 } 2416 2417 current = true; 2418 }, 2419 p(ctx, dirty) { 2420 let previous_block_index = current_block_type_index; 2421 current_block_type_index = select_block_type(ctx); 2422 2423 if (current_block_type_index === previous_block_index) { 2424 if (~current_block_type_index) { 2425 if_blocks[current_block_type_index].p(ctx, dirty); 2426 } 2427 } else { 2428 if (if_block) { 2429 group_outros$4(); 2430 2431 transition_out$5(if_blocks[previous_block_index], 1, 1, () => { 2432 if_blocks[previous_block_index] = null; 2433 }); 2434 2435 check_outros$4(); 2436 } 2437 2438 if (~current_block_type_index) { 2439 if_block = if_blocks[current_block_type_index]; 2440 2441 if (!if_block) { 2442 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2443 if_block.c(); 2444 } else { 2445 if_block.p(ctx, dirty); 2446 } 2447 2448 transition_in$5(if_block, 1); 2449 if_block.m(code, null); 2450 } else { 2451 if_block = null; 2452 } 2453 } 2454 }, 2455 i(local) { 2456 if (current) return; 2457 transition_in$5(if_block); 2458 current = true; 2459 }, 2460 o(local) { 2461 transition_out$5(if_block); 2462 current = false;
2463 }, 2464 d(detaching) { 2465 if (detaching) { 2466 detach$5(code); 2467 } 2468 2469 if (~current_block_type_index) { 2470 if_blocks[current_block_type_index].d(); 2471 } 2472 } 2473 }; 2474} 2475 2476function create_fragment$6(ctx) { 2477 let block; 2478 let current; 2479 2480 block = new Block({ 2481 props: { 2482 $$slots: { default: [create_default_slot$2] }, 2483 $$scope: { ctx } 2484 } 2485 }); 2486 2487 return { 2488 c() { 2489 create_component$5(block.$$.fragment); 2490 }, 2491 m(target, anchor) { 2492 mount_component$5(block, target, anchor); 2493 current = true; 2494 }, 2495 p(ctx, [dirty]) { 2496 const block_changes = {}; 2497 2498 if (dirty & /*$$scope, current_language*/ 3) { 2499 block_changes.$$scope = { dirty, ctx }; 2500 } 2501 2502 block.$set(block_changes); 2503 }, 2504 i(local) { 2505 if (current) return; 2506 transition_in$5(block.$$.fragment, local); 2507 current = true; 2508 }, 2509 o(local) { 2510 transition_out$5(block.$$.fragment, local); 2511 current = false; 2512 }, 2513 d(detaching) { 2514 destroy_component$5(block, detaching); 2515 } 2516 }; 2517} 2518 2519let py_install = "pip install gradio_client"; 2520let js_install = "npm i -D @gradio/client"; 2521 2522function instance$6($$self, $$props, $$invalidate) { 2523 let { current_language } = $$props; 2524 2525 $$self.$$set = $$props => {
2526 if ('current_language' in $$props) $$invalidate(0, current_language = $$props.current_language); 2527 }; 2528 2529 return [current_language]; 2530} 2531 2532class InstallSnippet extends SvelteComponent$6 { 2533 constructor(options) { 2534 super(); 2535 init$6(this, options, instance$6, create_fragment$6, safe_not_equal$6, { current_language: 0 }); 2536 } 2537} 2538 2539const EndpointDetail_svelte_svelte_type_style_lang = ''; 2540 2541/* src/api_docs/EndpointDetail.svelte generated by Svelte v4.2.2 */ 2542const { 2543 SvelteComponent: SvelteComponent$5, 2544 append: append$3, 2545 attr: attr$3, 2546 detach: detach$4, 2547 element: element$3, 2548 empty: empty$4, 2549 init: init$5, 2550 insert: insert$4, 2551 noop: noop$2, 2552 safe_not_equal: safe_not_equal$5, 2553 set_data: set_data$2, 2554 text: text$3 2555} = window.__gradio__svelte__internal; 2556function create_else_block$2(ctx) { 2557 let h3; 2558 let t0; 2559 let span; 2560 let t1; 2561 2562 return { 2563 c() { 2564 h3 = element$3("h3"); 2565 t0 = text$3("fn_index:\n\t\t"); 2566 span = element$3("span"); 2567 t1 = text$3(/*fn_index*/ ctx[1]); 2568 attr$3(span, "class", "post svelte-41kcm6"); 2569 attr$3(h3, "class", "svelte-41kcm6"); 2570 }, 2571 m(target, anchor) { 2572 insert$4(target, h3, anchor); 2573 append$3(h3, t0); 2574 append$3(h3, span); 2575 append$3(span, t1); 2576 }, 2577 p(ctx, dirty) { 2578 if (dirty & /*fn_index*/ 2) set_data$2(t1, /*fn_index*/ ctx[1]); 2579 }, 2580 d(detaching) { 2581 if (detaching) { 2582 detach$4(h3); 2583 } 2584 } 2585 }; 2586} 2587 2588// (6:0) {#if named} 2589function create_if_block$4(ctx) { 2590 let h3; 2591 let t0; 2592 let span; 2593 let t1_value = "/" + /*api_name*/ ctx[0] + ""; 2594 let t1; 2595 2596 return { 2597 c() { 2598 h3 = element$3("h3"); 2599 t0 = text$3("api_name:\n\t\t"); 2600 span = element$3("span"); 2601 t1 = text$3(t1_value); 2602 attr$3(span, "class", "post svelte-41kcm6"); 2603 attr$3(h3, "class", "svelte-41kcm6"); 2604 }, 2605 m(target, anchor) { 2606 insert$4(target, h3, anchor); 2607 append$3(h3, t0); 2608 append$3(h3, span); 2609 append$3(span, t1); 2610 }, 2611 p(ctx, dirty) { 2612 if (dirty & /*api_name*/ 1 && t1_value !== (t1_value = "/" + /*api_name*/ ctx[0] + "")) set_data$2(t1, t1_value); 2613 }, 2614 d(detaching) { 2615 if (detaching) { 2616 detach$4(h3); 2617 } 2618 } 2619 }; 2620} 2621 2622function create_fragment$5(ctx) { 2623 let if_block_anchor; 2624 2625 function select_block_type(ctx, dirty) { 2626 if (/*named*/ ctx[2]) return create_if_block$4; 2627 return create_else_block$2; 2628 } 2629 2630 let current_block_type = select_block_type(ctx); 2631 let if_block = current_block_type(ctx); 2632 2633 return { 2634 c() { 2635 if_block.c(); 2636 if_block_anchor = empty$4(); 2637 }, 2638 m(target, anchor) { 2639 if_block.m(target, anchor); 2640 insert$4(target, if_block_anchor, anchor); 2641 }, 2642 p(ctx, [dirty]) { 2643 if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { 2644 if_block.p(ctx, dirty); 2645 } else { 2646 if_block.d(1); 2647 if_block = current_block_type(ctx); 2648 2649 if (if_block) { 2650 if_block.c(); 2651 if_block.m(if_block_anchor.parentNode, if_block_anchor); 2652 } 2653 } 2654 }, 2655 i: noop$2, 2656 o: noop$2, 2657 d(detaching) { 2658 if (detaching) { 2659 detach$4(if_block_anchor); 2660 } 2661 2662 if_block.d(detaching); 2663 } 2664 }; 2665} 2666 2667function instance$5($$self, $$props, $$invalidate) { 2668 let { api_name = null } = $$props; 2669 let { fn_index = null } = $$props; 2670 let { named } = $$props; 2671 2672 $$self.$$set = $$props => {
2673 if ('api_name' in $$props) $$invalidate(0, api_name = $$props.api_name); 2674 if ('fn_index' in $$props) $$invalidate(1, fn_index = $$props.fn_index); 2675 if ('named' in $$props) $$invalidate(2, named = $$props.named); 2676 }; 2677 2678 return [api_name, fn_index, named]; 2679} 2680 2681class EndpointDetail extends SvelteComponent$5 { 2682 constructor(options) { 2683 super(); 2684 init$5(this, options, instance$5, create_fragment$5, safe_not_equal$5, { api_name: 0, fn_index: 1, named: 2 }); 2685 } 2686} 2687 2688const CodeSnippets_svelte_svelte_type_style_lang = ''; 2689 2690/* src/api_docs/CodeSnippets.svelte generated by Svelte v4.2.2 */ 2691const { 2692 SvelteComponent: SvelteComponent$4, 2693 append: append$2, 2694 attr: attr$2, 2695 binding_callbacks: binding_callbacks$1, 2696 check_outros: check_outros$3, 2697 create_component: create_component$4, 2698 destroy_component: destroy_component$4, 2699 destroy_each: destroy_each$1, 2700 detach: detach$3, 2701 element: element$2, 2702 empty: empty$3, 2703 ensure_array_like: ensure_array_like$2, 2704 group_outros: group_outros$3, 2705 init: init$4, 2706 insert: insert$3, 2707 mount_component: mount_component$4, 2708 noop: noop$1, 2709 safe_not_equal: safe_not_equal$4, 2710 set_data: set_data$1, 2711 space: space$2, 2712 text: text$2, 2713 transition_in: transition_in$4, 2714 transition_out: transition_out$4 2715} = window.__gradio__svelte__internal; 2716function get_each_context_1$1(ctx, list, i) { 2717 const child_ctx = ctx.slice(); 2718 child_ctx[14] = list[i].label; 2719 child_ctx[15] = list[i].type; 2720 child_ctx[16] = list[i].python_type; 2721 child_ctx[17] = list[i].component; 2722 child_ctx[18] = list[i].example_input; 2723 child_ctx[19] = list[i].serializer; 2724 child_ctx[21] = i; 2725 return child_ctx; 2726} 2727 2728function get_each_context_2$1(ctx, list, i) { 2729 const child_ctx = ctx.slice(); 2730 child_ctx[14] = list[i].label; 2731 child_ctx[15] = list[i].type; 2732 child_ctx[16] = list[i].python_type; 2733 child_ctx[17] = list[i].component; 2734 child_ctx[18] = list[i].example_input; 2735 child_ctx[19] = list[i].serializer; 2736 child_ctx[21] = i; 2737 return child_ctx; 2738} 2739 2740function get_each_context$2(ctx, list, i) { 2741 const child_ctx = ctx.slice(); 2742 child_ctx[14] = list[i].label; 2743 child_ctx[15] = list[i].type; 2744 child_ctx[16] = list[i].python_type; 2745 child_ctx[17] = list[i].component; 2746 child_ctx[18] = list[i].example_input; 2747 child_ctx[19] = list[i].serializer; 2748 child_ctx[21] = i; 2749 return child_ctx; 2750} 2751 2752// (22:1) {:else} 2753function create_else_block_3(ctx) { 2754 let endpointdetail; 2755 let current; 2756 2757 endpointdetail = new EndpointDetail({ 2758 props: { 2759 named: /*named*/ ctx[6], 2760 fn_index: /*dependency_index*/ ctx[1] 2761 } 2762 }); 2763 2764 return { 2765 c() { 2766 create_component$4(endpointdetail.$$.fragment); 2767 }, 2768 m(target, anchor) { 2769 mount_component$4(endpointdetail, target, anchor); 2770 current = true; 2771 }, 2772 p(ctx, dirty) { 2773 const endpointdetail_changes = {}; 2774 if (dirty & /*named*/ 64) endpointdetail_changes.named = /*named*/ ctx[6]; 2775 if (dirty & /*dependency_index*/ 2) endpointdetail_changes.fn_index = /*dependency_index*/ ctx[1]; 2776 endpointdetail.$set(endpointdetail_changes); 2777 }, 2778 i(local) { 2779 if (current) return; 2780 transition_in$4(endpointdetail.$$.fragment, local); 2781 current = true; 2782 }, 2783 o(local) { 2784 transition_out$4(endpointdetail.$$.fragment, local); 2785 current = false; 2786 }, 2787 d(detaching) { 2788 destroy_component$4(endpointdetail, detaching); 2789 } 2790 }; 2791} 2792 2793// (20:1) {#if named} 2794function create_if_block_8(ctx) { 2795 let endpointdetail; 2796 let current; 2797 2798 endpointdetail = new EndpointDetail({ 2799 props: { 2800 named: /*named*/ ctx[6], 2801 api_name: /*dependency*/ ctx[0].api_name 2802 } 2803 }); 2804 2805 return { 2806 c() { 2807 create_component$4(endpointdetail.$$.fragment); 2808 }, 2809 m(target, anchor) { 2810 mount_component$4(endpointdetail, target, anchor); 2811 current = true; 2812 }, 2813 p(ctx, dirty) { 2814 const endpointdetail_changes = {}; 2815 if (dirty & /*named*/ 64) endpointdetail_changes.named = /*named*/ ctx[6]; 2816 if (dirty & /*dependency*/ 1) endpointdetail_changes.api_name = /*dependency*/ ctx[0].api_name; 2817 endpointdetail.$set(endpointdetail_changes); 2818 }, 2819 i(local) { 2820 if (current) return; 2821 transition_in$4(endpointdetail.$$.fragment, local); 2822 current = true; 2823 }, 2824 o(local) { 2825 transition_out$4(endpointdetail.$$.fragment, local); 2826 current = false;
2827 }, 2828 d(detaching) { 2829 destroy_component$4(endpointdetail, detaching); 2830 } 2831 }; 2832} 2833 2834// (63:47) 2835function create_if_block_4$2(ctx) { 2836 let div0; 2837 let copybutton; 2838 let t0; 2839 let div1; 2840 let pre; 2841 let t1; 2842 let t2; 2843 let span; 2844 let t3; 2845 let t4; 2846 let t5; 2847 let t6; 2848 let t7; 2849 let t8; 2850 let current; 2851 2852 copybutton = new CopyButton({ 2853 props: { code: /*js_code*/ ctx[9]?.innerText } 2854 }); 2855 2856 let each_value_2 = ensure_array_like$2(/*blob_examples*/ ctx[11]); 2857 let each_blocks_1 = []; 2858 2859 for (let i = 0; i < each_value_2.length; i += 1) { 2860 each_blocks_1[i] = create_each_block_2$1(get_each_context_2$1(ctx, each_value_2, i)); 2861 } 2862 2863 function select_block_type_3(ctx, dirty) { 2864 if (/*named*/ ctx[6]) return create_if_block_7; 2865 return create_else_block_2; 2866 } 2867 2868 let current_block_type = select_block_type_3(ctx); 2869 let if_block = current_block_type(ctx); 2870 let each_value_1 = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); 2871 let each_blocks = []; 2872 2873 for (let i = 0; i < each_value_1.length; i += 1) { 2874 each_blocks[i] = create_each_block_1$1(get_each_context_1$1(ctx, each_value_1, i)); 2875 } 2876 2877 return { 2878 c() { 2879 div0 = element$2("div"); 2880 create_component$4(copybutton.$$.fragment); 2881 t0 = space$2(); 2882 div1 = element$2("div"); 2883 pre = element$2("pre"); 2884 t1 = text$2("import { client } from \"@gradio/client\";\n"); 2885 2886 for (let i = 0; i < each_blocks_1.length; i += 1) { 2887 each_blocks_1[i].c(); 2888 } 2889 2890 t2 = text$2("\nconst app = await client("); 2891 span = element$2("span"); 2892 t3 = text$2("\""); 2893 t4 = text$2(/*root*/ ctx[2]); 2894 t5 = text$2("\""); 2895 t6 = text$2(");\nconst result = await app.predict("); 2896 if_block.c(); 2897 t7 = text$2(", ["); 2898 2899 for (let i = 0; i < each_blocks.length; i += 1) { 2900 each_blocks[i].c(); 2901 } 2902 2903 t8 = text$2("\n\t]);\n\nconsole.log(result.data);\n"); 2904 attr$2(div0, "class", "copy svelte-1d98qmk"); 2905 attr$2(span, "class", "token string svelte-1d98qmk"); 2906 attr$2(pre, "class", "svelte-1d98qmk"); 2907 }, 2908 m(target, anchor) { 2909 insert$3(target, div0, anchor); 2910 mount_component$4(copybutton, div0, null); 2911 insert$3(target, t0, anchor); 2912 insert$3(target, div1, anchor); 2913 append$2(div1, pre); 2914 append$2(pre, t1); 2915 2916 for (let i = 0; i < each_blocks_1.length; i += 1) { 2917 if (each_blocks_1[i]) { 2918 each_blocks_1[i].m(pre, null); 2919 } 2920 } 2921 2922 append$2(pre, t2); 2923 append$2(pre, span); 2924 append$2(span, t3); 2925 append$2(span, t4); 2926 append$2(span, t5); 2927 append$2(pre, t6); 2928 if_block.m(pre, null); 2929 append$2(pre, t7); 2930 2931 for (let i = 0; i < each_blocks.length; i += 1) { 2932 if (each_blocks[i]) { 2933 each_blocks[i].m(pre, null); 2934 } 2935 } 2936 2937 append$2(pre, t8); 2938 /*div1_binding_1*/ ctx[13](div1); 2939 current = true; 2940 }, 2941 p(ctx, dirty) { 2942 const copybutton_changes = {}; 2943 if (dirty & /*js_code*/ 512) copybutton_changes.code = /*js_code*/ ctx[9]?.innerText; 2944 copybutton.$set(copybutton_changes); 2945 2946 if (dirty & /*blob_examples*/ 2048) { 2947 each_value_2 = ensure_array_like$2(/*blob_examples*/ ctx[11]); 2948 let i; 2949 2950 for (i = 0; i < each_value_2.length; i += 1) { 2951 const child_ctx = get_each_context_2$1(ctx, each_value_2, i); 2952 2953 if (each_blocks_1[i]) { 2954 each_blocks_1[i].p(child_ctx, dirty); 2955 } else { 2956 each_blocks_1[i] = create_each_block_2$1(child_ctx); 2957 each_blocks_1[i].c(); 2958 each_blocks_1[i].m(pre, t2); 2959 } 2960 } 2961 2962 for (; i < each_blocks_1.length; i += 1) { 2963 each_blocks_1[i].d(1); 2964 } 2965 2966 each_blocks_1.length = each_value_2.length; 2967 } 2968 2969 if (!current || dirty & /*root*/ 4) set_data$1(t4, /*root*/ ctx[2]); 2970 2971 if (current_block_type === (current_block_type = select_block_type_3(ctx)) && if_block) { 2972 if_block.p(ctx, dirty); 2973 } else { 2974 if_block.d(1); 2975 if_block = current_block_type(ctx); 2976 2977 if (if_block) { 2978 if_block.c(); 2979 if_block.m(pre, t7); 2980 } 2981 } 2982 2983 if (dirty & /*endpoint_parameters, blob_components, js_parameters*/ 1072) { 2984 each_value_1 = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); 2985 let i; 2986 2987 for (i = 0; i < each_value_1.length; i += 1) { 2988 const child_ctx = get_each_context_1$1(ctx, each_value_1, i); 2989 2990 if (each_blocks[i]) { 2991 each_blocks[i].p(child_ctx, dirty); 2992 } else { 2993 each_blocks[i] = create_each_block_1$1(child_ctx); 2994 each_blocks[i].c(); 2995 each_blocks[i].m(pre, t8); 2996 } 2997 } 2998 2999 for (; i < each_blocks.length; i += 1) { 3000 each_blocks[i].d(1); 3001 } 3002 3003 each_blocks.length = each_value_1.length; 3004 } 3005 }, 3006 i(local) { 3007 if (current) return; 3008 transition_in$4(copybutton.$$.fragment, local); 3009 current = true; 3010 }, 3011 o(local) { 3012 transition_out$4(copybutton.$$.fragment, local); 3013 current = false;
3014 }, 3015 d(detaching) { 3016 if (detaching) { 3017 detach$3(div0); 3018 detach$3(t0); 3019 detach$3(div1); 3020 } 3021 3022 destroy_component$4(copybutton); 3023 destroy_each$1(each_blocks_1, detaching); 3024 if_block.d(); 3025 destroy_each$1(each_blocks, detaching); 3026 /*div1_binding_1*/ ctx[13](null); 3027 } 3028 }; 3029} 3030 3031// (27:3) {#if current_language === "python"} 3032function create_if_block$3(ctx) { 3033 let div0; 3034 let copybutton; 3035 let t0; 3036 let div1; 3037 let pre; 3038 let t1; 3039 let span; 3040 let t2; 3041 let t3; 3042 let t4; 3043 let t5; 3044 let each_1_anchor; 3045 let t6; 3046 let current; 3047 3048 copybutton = new CopyButton({ 3049 props: { code: /*python_code*/ ctx[8]?.innerText } 3050 }); 3051 3052 let each_value = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); 3053 let each_blocks = []; 3054 3055 for (let i = 0; i < each_value.length; i += 1) { 3056 each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i)); 3057 } 3058 3059 function select_block_type_2(ctx, dirty) { 3060 if (/*named*/ ctx[6]) return create_if_block_1$2; 3061 return create_else_block$1; 3062 } 3063 3064 let current_block_type = select_block_type_2(ctx); 3065 let if_block = current_block_type(ctx); 3066 3067 return { 3068 c() { 3069 div0 = element$2("div"); 3070 create_component$4(copybutton.$$.fragment); 3071 t0 = space$2(); 3072 div1 = element$2("div"); 3073 pre = element$2("pre"); 3074 t1 = text$2("from gradio_client import Client\n\nclient = Client("); 3075 span = element$2("span"); 3076 t2 = text$2("\""); 3077 t3 = text$2(/*root*/ ctx[2]); 3078 t4 = text$2("\""); 3079 t5 = text$2(")\nresult = client.predict("); 3080 3081 for (let i = 0; i < each_blocks.length; i += 1) { 3082 each_blocks[i].c(); 3083 } 3084 3085 each_1_anchor = empty$3(); 3086 if_block.c(); 3087 t6 = text$2("\n)\nprint(result)"); 3088 attr$2(div0, "class", "copy svelte-1d98qmk"); 3089 attr$2(span, "class", "token string svelte-1d98qmk"); 3090 attr$2(pre, "class", "svelte-1d98qmk"); 3091 }, 3092 m(target, anchor) { 3093 insert$3(target, div0, anchor); 3094 mount_component$4(copybutton, div0, null); 3095 insert$3(target, t0, anchor); 3096 insert$3(target, div1, anchor); 3097 append$2(div1, pre); 3098 append$2(pre, t1); 3099 append$2(pre, span); 3100 append$2(span, t2); 3101 append$2(span, t3); 3102 append$2(span, t4); 3103 append$2(pre, t5); 3104 3105 for (let i = 0; i < each_blocks.length; i += 1) { 3106 if (each_blocks[i]) { 3107 each_blocks[i].m(pre, null); 3108 } 3109 } 3110 3111 append$2(pre, each_1_anchor); 3112 if_block.m(pre, null); 3113 append$2(pre, t6); 3114 /*div1_binding*/ ctx[12](div1); 3115 current = true; 3116 }, 3117 p(ctx, dirty) { 3118 const copybutton_changes = {}; 3119 if (dirty & /*python_code*/ 256) copybutton_changes.code = /*python_code*/ ctx[8]?.innerText; 3120 copybutton.$set(copybutton_changes); 3121 if (!current || dirty & /*root*/ 4) set_data$1(t3, /*root*/ ctx[2]); 3122 3123 if (dirty & /*endpoint_parameters, dependency_failures, dependency_index*/ 26) { 3124 each_value = ensure_array_like$2(/*endpoint_parameters*/ ctx[4]); 3125 let i; 3126 3127 for (i = 0; i < each_value.length; i += 1) { 3128 const child_ctx = get_each_context$2(ctx, each_value, i); 3129 3130 if (each_blocks[i]) { 3131 each_blocks[i].p(child_ctx, dirty); 3132 } else { 3133 each_blocks[i] = create_each_block$2(child_ctx); 3134 each_blocks[i].c(); 3135 each_blocks[i].m(pre, each_1_anchor); 3136 } 3137 } 3138 3139 for (; i < each_blocks.length; i += 1) { 3140 each_blocks[i].d(1); 3141 } 3142 3143 each_blocks.length = each_value.length; 3144 } 3145 3146 if (current_block_type === (current_block_type = select_block_type_2(ctx)) && if_block) { 3147 if_block.p(ctx, dirty); 3148 } else { 3149 if_block.d(1); 3150 if_block = current_block_type(ctx); 3151 3152 if (if_block) { 3153 if_block.c(); 3154 if_block.m(pre, t6); 3155 } 3156 } 3157 }, 3158 i(local) { 3159 if (current) return; 3160 transition_in$4(copybutton.$$.fragment, local); 3161 current = true; 3162 }, 3163 o(local) { 3164 transition_out$4(copybutton.$$.fragment, local); 3165 current = false; 3166 }, 3167 d(detaching) { 3168 if (detaching) { 3169 detach$3(div0);
3170 detach$3(t0); 3171 detach$3(div1); 3172 } 3173 3174 destroy_component$4(copybutton); 3175 destroy_each$1(each_blocks, detaching); 3176 if_block.d(); 3177 /*div1_binding*/ ctx[12](null); 3178 } 3179 }; 3180} 3181 3182// (69:0) {#each blob_examples as { label, type, python_type, component, example_input, serializer } 3183function create_each_block_2$1(ctx) { 3184 let t0; 3185 let t1; 3186 let t2; 3187 let t3_value = /*example_input*/ ctx[18] + ""; 3188 let t3; 3189 let t4; 3190 let t5_value = /*component*/ ctx[17] + ""; 3191 let t5; 3192 let t6; 3193 let t7; 3194 let t8; 3195 3196 return { 3197 c() { 3198 t0 = text$2("\nconst response_"); 3199 t1 = text$2(/*i*/ ctx[21]); 3200 t2 = text$2(" = await fetch(\""); 3201 t3 = text$2(t3_value); 3202 t4 = text$2("\");\nconst example"); 3203 t5 = text$2(t5_value); 3204 t6 = text$2(" = await response_"); 3205 t7 = text$2(/*i*/ ctx[21]); 3206 t8 = text$2(".blob();\n\t\t\t\t\t\t"); 3207 }, 3208 m(target, anchor) { 3209 insert$3(target, t0, anchor); 3210 insert$3(target, t1, anchor); 3211 insert$3(target, t2, anchor); 3212 insert$3(target, t3, anchor); 3213 insert$3(target, t4, anchor); 3214 insert$3(target, t5, anchor); 3215 insert$3(target, t6, anchor); 3216 insert$3(target, t7, anchor); 3217 insert$3(target, t8, anchor); 3218 }, 3219 p: noop$1, 3220 d(detaching) { 3221 if (detaching) {
3222 detach$3(t0); 3223 detach$3(t1); 3224 detach$3(t2); 3225 detach$3(t3); 3226 detach$3(t4); 3227 detach$3(t5); 3228 detach$3(t6); 3229 detach$3(t7); 3230 detach$3(t8); 3231 } 3232 } 3233 }; 3234} 3235 3236// (76:68) {:else} 3237function create_else_block_2(ctx) { 3238 let t; 3239 3240 return { 3241 c() { 3242 t = text$2(/*dependency_index*/ ctx[1]); 3243 }, 3244 m(target, anchor) { 3245 insert$3(target, t, anchor); 3246 }, 3247 p(ctx, dirty) { 3248 if (dirty & /*dependency_index*/ 2) set_data$1(t, /*dependency_index*/ ctx[1]); 3249 }, 3250 d(detaching) { 3251 if (detaching) { 3252 detach$3(t); 3253 } 3254 } 3255 }; 3256} 3257 3258// (76:33) {#if named} 3259function create_if_block_7(ctx) { 3260 let t0; 3261 let t1_value = /*dependency*/ ctx[0].api_name + ""; 3262 let t1; 3263 let t2; 3264 3265 return { 3266 c() { 3267 t0 = text$2("\"/"); 3268 t1 = text$2(t1_value); 3269 t2 = text$2("\""); 3270 }, 3271 m(target, anchor) { 3272 insert$3(target, t0, anchor); 3273 insert$3(target, t1, anchor); 3274 insert$3(target, t2, anchor); 3275 }, 3276 p(ctx, dirty) { 3277 if (dirty & /*dependency*/ 1 && t1_value !== (t1_value = /*dependency*/ ctx[0].api_name + "")) set_data$1(t1, t1_value); 3278 }, 3279 d(detaching) { 3280 if (detaching) {
3281 detach$3(t0); 3282 detach$3(t1); 3283 detach$3(t2); 3284 } 3285 } 3286 }; 3287} 3288 3289// (90:5) {:else} 3290function create_else_block_1(ctx) { 3291 let t0; 3292 let span0; 3293 let t1_value = represent_value(/*example_input*/ ctx[18], /*python_type*/ ctx[16].type, "js") + ""; 3294 let t1; 3295 let t2; 3296 let span1; 3297 let t3; 3298 let t4_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].type + ""; 3299 let t4; 3300 let t5; 3301 let t6; 3302 let t7_value = /*label*/ ctx[14] + ""; 3303 let t7; 3304 let t8; 3305 let t9_value = /*component*/ ctx[17] + ""; 3306 let t9; 3307 let t10; 3308 let if_block = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].description && create_if_block_6$1(ctx); 3309 3310 return { 3311 c() { 3312 t0 = text$2("\t\t\n\t\t\t\t"); 3313 span0 = element$2("span"); 3314 t1 = text$2(t1_value); 3315 t2 = text$2(", "); 3316 span1 = element$2("span"); 3317 t3 = text$2("// "); 3318 t4 = text$2(t4_value); 3319 t5 = text$2(" "); 3320 if (if_block) if_block.c(); 3321 t6 = text$2(" in '"); 3322 t7 = text$2(t7_value); 3323 t8 = text$2("' "); 3324 t9 = text$2(t9_value); 3325 t10 = text$2(" component"); 3326 attr$2(span0, "class", "example-inputs svelte-1d98qmk"); 3327 attr$2(span1, "class", "desc svelte-1d98qmk"); 3328 }, 3329 m(target, anchor) { 3330 insert$3(target, t0, anchor); 3331 insert$3(target, span0, anchor); 3332 append$2(span0, t1); 3333 insert$3(target, t2, anchor); 3334 insert$3(target, span1, anchor); 3335 append$2(span1, t3); 3336 append$2(span1, t4); 3337 append$2(span1, t5); 3338 if (if_block) if_block.m(span1, null); 3339 append$2(span1, t6); 3340 append$2(span1, t7); 3341 append$2(span1, t8); 3342 append$2(span1, t9); 3343 append$2(span1, t10); 3344 }, 3345 p(ctx, dirty) { 3346 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); 3347 if (dirty & /*js_parameters*/ 32 && t4_value !== (t4_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].type + "")) set_data$1(t4, t4_value); 3348 3349 if (/*js_parameters*/ ctx[5][/*i*/ ctx[21]].description) { 3350 if (if_block) { 3351 if_block.p(ctx, dirty); 3352 } else { 3353 if_block = create_if_block_6$1(ctx); 3354 if_block.c(); 3355 if_block.m(span1, t6); 3356 } 3357 } else if (if_block) { 3358 if_block.d(1); 3359 if_block = null; 3360 } 3361 3362 if (dirty & /*endpoint_parameters*/ 16 && t7_value !== (t7_value = /*label*/ ctx[14] + "")) set_data$1(t7, t7_value); 3363 if (dirty & /*endpoint_parameters*/ 16 && t9_value !== (t9_value = /*component*/ ctx[17] + "")) set_data$1(t9, t9_value); 3364 }, 3365 d(detaching) { 3366 if (detaching) {
3367 detach$3(t0); 3368 detach$3(span0); 3369 detach$3(t2); 3370 detach$3(span1); 3371 } 3372 3373 if (if_block) if_block.d(); 3374 } 3375 }; 3376} 3377 3378// (78:5) {#if blob_components.includes(component)} 3379function create_if_block_5$2(ctx) { 3380 let t0; 3381 let span0; 3382 let t1; 3383 let t2_value = /*component*/ ctx[17] + ""; 3384 let t2; 3385 let t3; 3386 let span1; 3387 let t4; 3388 let t5_value = /*label*/ ctx[14] + ""; 3389 let t5; 3390 let t6; 3391 let t7_value = /*component*/ ctx[17] + ""; 3392 let t7; 3393 let t8; 3394 3395 return { 3396 c() { 3397 t0 = text$2("\n\t\t\t\t"); 3398 span0 = element$2("span"); 3399 t1 = text$2("example"); 3400 t2 = text$2(t2_value); 3401 t3 = text$2(", "); 3402 span1 = element$2("span"); 3403 t4 = text$2("\t// blob in '"); 3404 t5 = text$2(t5_value); 3405 t6 = text$2("' "); 3406 t7 = text$2(t7_value); 3407 t8 = text$2(" component"); 3408 attr$2(span0, "class", "example-inputs svelte-1d98qmk"); 3409 attr$2(span1, "class", "desc svelte-1d98qmk"); 3410 }, 3411 m(target, anchor) { 3412 insert$3(target, t0, anchor); 3413 insert$3(target, span0, anchor); 3414 append$2(span0, t1); 3415 append$2(span0, t2); 3416 insert$3(target, t3, anchor); 3417 insert$3(target, span1, anchor); 3418 append$2(span1, t4); 3419 append$2(span1, t5); 3420 append$2(span1, t6); 3421 append$2(span1, t7); 3422 append$2(span1, t8); 3423 }, 3424 p(ctx, dirty) { 3425 if (dirty & /*endpoint_parameters*/ 16 && t2_value !== (t2_value = /*component*/ ctx[17] + "")) set_data$1(t2, t2_value); 3426 if (dirty & /*endpoint_parameters*/ 16 && t5_value !== (t5_value = /*label*/ ctx[14] + "")) set_data$1(t5, t5_value); 3427 if (dirty & /*endpoint_parameters*/ 16 && t7_value !== (t7_value = /*component*/ ctx[17] + "")) set_data$1(t7, t7_value); 3428 }, 3429 d(detaching) { 3430 if (detaching) {
3431 detach$3(t0); 3432 detach$3(span0); 3433 detach$3(t3); 3434 detach$3(span1); 3435 } 3436 } 3437 }; 3438} 3439 3440// (102:17) {#if js_parameters[i].description} 3441function create_if_block_6$1(ctx) { 3442 let t0; 3443 let t1_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].description + ""; 3444 let t1; 3445 let t2; 3446 3447 return { 3448 c() { 3449 t0 = text$2("("); 3450 t1 = text$2(t1_value); 3451 t2 = text$2(")"); 3452 }, 3453 m(target, anchor) { 3454 insert$3(target, t0, anchor); 3455 insert$3(target, t1, anchor); 3456 insert$3(target, t2, anchor); 3457 }, 3458 p(ctx, dirty) { 3459 if (dirty & /*js_parameters*/ 32 && t1_value !== (t1_value = /*js_parameters*/ ctx[5][/*i*/ ctx[21]].description + "")) set_data$1(t1, t1_value); 3460 }, 3461 d(detaching) { 3462 if (detaching) { 3463 detach$3(t0); 3464 detach$3(t1); 3465 detach$3(t2); 3466 } 3467 } 3468 }; 3469} 3470 3471// (77:3) {#each endpoint_parameters as { label, type, python_type, component, example_input, serializer } 3472function create_each_block_1$1(ctx) { 3473 let show_if; 3474 let if_block_anchor; 3475 3476 function select_block_type_4(ctx, dirty) { 3477 if (dirty & /*endpoint_parameters*/ 16) show_if = null; 3478 if (show_if == null) show_if = !!/*blob_components*/ ctx[10].includes(/*component*/ ctx[17]); 3479 if (show_if) return create_if_block_5$2; 3480 return create_else_block_1; 3481 } 3482 3483 let current_block_type = select_block_type_4(ctx, -1); 3484 let if_block = current_block_type(ctx); 3485 3486 return { 3487 c() { 3488 if_block.c(); 3489 if_block_anchor = empty$3(); 3490 }, 3491 m(target, anchor) { 3492 if_block.m(target, anchor); 3493 insert$3(target, if_block_anchor, anchor); 3494 }, 3495 p(ctx, dirty) { 3496 if (current_block_type === (current_block_type = select_block_type_4(ctx, dirty)) && if_block) { 3497 if_block.p(ctx, dirty); 3498 } else { 3499 if_block.d(1); 3500 if_block = current_block_type(ctx); 3501 3502 if (if_block) { 3503 if_block.c(); 3504 if_block.m(if_block_anchor.parentNode, if_block_anchor); 3505 } 3506 } 3507 }, 3508 d(detaching) { 3509 if (detaching) { 3510 detach$3(if_block_anchor); 3511 } 3512 3513 if_block.d(detaching); 3514 } 3515 }; 3516} 3517 3518// (42:6) {#if dependency_failures[dependency_index][i]} 3519function create_if_block_3$2(ctx) { 3520 let span; 3521 3522 return { 3523 c() { 3524 span = element$2("span"); 3525 span.textContent = "ERROR"; 3526 attr$2(span, "class", "error svelte-1d98qmk"); 3527 }, 3528 m(target, anchor) { 3529 insert$3(target, span, anchor); 3530 }, 3531 d(detaching) { 3532 if (detaching) { 3533 detach$3(span); 3534 } 3535 } 3536 }; 3537} 3538 3539// (49:28) {#if python_type.description} 3540function create_if_block_2$2(ctx) { 3541 let t0; 3542 let t1_value = /*python_type*/ ctx[16].description + ""; 3543 let t1; 3544 let t2; 3545 3546 return { 3547 c() { 3548 t0 = text$2("("); 3549 t1 = text$2(t1_value); 3550 t2 = text$2(")"); 3551 }, 3552 m(target, anchor) { 3553 insert$3(target, t0, anchor); 3554 insert$3(target, t1, anchor); 3555 insert$3(target, t2, anchor); 3556 }, 3557 p(ctx, dirty) { 3558 if (dirty & /*endpoint_parameters*/ 16 && t1_value !== (t1_value = /*python_type*/ ctx[16].description + "")) set_data$1(t1, t1_value); 3559 }, 3560 d(detaching) { 3561 if (detaching) {
3562 detach$3(t0); 3563 detach$3(t1); 3564 detach$3(t2); 3565 } 3566 } 3567 }; 3568} 3569 3570// (36:3) {#each endpoint_parameters as { label, type, python_type, component, example_input, serializer } 3571function create_each_block$2(ctx) { 3572 let t0; 3573 let span0; 3574 let t1_value = represent_value(/*example_input*/ ctx[18], /*python_type*/ ctx[16].type, "py") + ""; 3575 let t1; 3576 let t2; 3577 let span1; 3578 let t3; 3579 let t4_value = /*python_type*/ ctx[16].type + ""; 3580 let t4; 3581 let t5; 3582 let t6; 3583 let t7_value = /*label*/ ctx[14] + ""; 3584 let t7; 3585 let t8; 3586 let t9_value = /*component*/ ctx[17] + ""; 3587 let t9; 3588 let t10; 3589 let if_block0 = /*dependency_failures*/ ctx[3][/*dependency_index*/ ctx[1]][/*i*/ ctx[21]] && create_if_block_3$2(); 3590 let if_block1 = /*python_type*/ ctx[16].description && create_if_block_2$2(ctx); 3591 3592 return { 3593 c() { 3594 t0 = text$2("\n\t\t"); 3595 span0 = element$2("span"); 3596 t1 = text$2(t1_value); 3597 t2 = text$2(","); 3598 if (if_block0) if_block0.c(); 3599 span1 = element$2("span"); 3600 t3 = text$2("\t# "); 3601 t4 = text$2(t4_value); 3602 t5 = text$2(" "); 3603 if (if_block1) if_block1.c(); 3604 t6 = text$2(" in '"); 3605 t7 = text$2(t7_value); 3606 t8 = text$2("' "); 3607 t9 = text$2(t9_value); 3608 t10 = text$2(" component"); 3609 attr$2(span0, "class", "example-inputs svelte-1d98qmk"); 3610 attr$2(span1, "class", "desc svelte-1d98qmk"); 3611 }, 3612 m(target, anchor) { 3613 insert$3(target, t0, anchor); 3614 insert$3(target, span0, anchor); 3615 append$2(span0, t1); 3616 insert$3(target, t2, anchor); 3617 if (if_block0) if_block0.m(target, anchor); 3618 insert$3(target, span1, anchor); 3619 append$2(span1, t3); 3620 append$2(span1, t4); 3621 append$2(span1, t5); 3622 if (if_block1) if_block1.m(span1, null); 3623 append$2(span1, t6); 3624 append$2(span1, t7); 3625 append$2(span1, t8); 3626 append$2(span1, t9); 3627 append$2(span1, t10); 3628 }, 3629 p(ctx, dirty) { 3630 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); 3631 3632 if (/*dependency_failures*/ ctx[3][/*dependency_index*/ ctx[1]][/*i*/ ctx[21]]) { 3633 if (if_block0) ; else { 3634 if_block0 = create_if_block_3$2(); 3635 if_block0.c(); 3636 if_block0.m(span1.parentNode, span1); 3637 } 3638 } else if (if_block0) { 3639 if_block0.d(1); 3640 if_block0 = null; 3641 } 3642 3643 if (dirty & /*endpoint_parameters*/ 16 && t4_value !== (t4_value = /*python_type*/ ctx[16].type + "")) set_data$1(t4, t4_value); 3644 3645 if (/*python_type*/ ctx[16].description) { 3646 if (if_block1) { 3647 if_block1.p(ctx, dirty); 3648 } else { 3649 if_block1 = create_if_block_2$2(ctx); 3650 if_block1.c(); 3651 if_block1.m(span1, t6); 3652 } 3653 } else if (if_block1) { 3654 if_block1.d(1); 3655 if_block1 = null; 3656 } 3657 3658 if (dirty & /*endpoint_parameters*/ 16 && t7_value !== (t7_value = /*label*/ ctx[14] + "")) set_data$1(t7, t7_value); 3659 if (dirty & /*endpoint_parameters*/ 16 && t9_value !== (t9_value = /*component*/ ctx[17] + "")) set_data$1(t9, t9_value); 3660 }, 3661 d(detaching) { 3662 if (detaching) {
3663 detach$3(t0); 3664 detach$3(span0); 3665 detach$3(t2); 3666 detach$3(span1); 3667 } 3668 3669 if (if_block0) if_block0.d(detaching); 3670 if (if_block1) if_block1.d(); 3671 } 3672 }; 3673} 3674 3675// (57:5) {:else} 3676function create_else_block$1(ctx) { 3677 let t0; 3678 let t1; 3679 3680 return { 3681 c() { 3682 t0 = text$2("\n\t\t\t\t\t\t\tfn_index="); 3683 t1 = text$2(/*dependency_index*/ ctx[1]); 3684 }, 3685 m(target, anchor) { 3686 insert$3(target, t0, anchor); 3687 insert$3(target, t1, anchor); 3688 }, 3689 p(ctx, dirty) { 3690 if (dirty & /*dependency_index*/ 2) set_data$1(t1, /*dependency_index*/ ctx[1]); 3691 }, 3692 d(detaching) { 3693 if (detaching) { 3694 detach$3(t0); 3695 detach$3(t1); 3696 } 3697 } 3698 }; 3699} 3700 3701// (55:5) {#if named} 3702function create_if_block_1$2(ctx) { 3703 let t0; 3704 let t1_value = /*dependency*/ ctx[0].api_name + ""; 3705 let t1; 3706 let t2; 3707 3708 return { 3709 c() { 3710 t0 = text$2("\n\t\t\t\t\t\t\tapi_name=\"/"); 3711 t1 = text$2(t1_value); 3712 t2 = text$2("\""); 3713 }, 3714 m(target, anchor) { 3715 insert$3(target, t0, anchor); 3716 insert$3(target, t1, anchor); 3717 insert$3(target, t2, anchor); 3718 }, 3719 p(ctx, dirty) { 3720 if (dirty & /*dependency*/ 1 && t1_value !== (t1_value = /*dependency*/ ctx[0].api_name + "")) set_data$1(t1, t1_value); 3721 }, 3722 d(detaching) { 3723 if (detaching) {
3724 detach$3(t0); 3725 detach$3(t1); 3726 detach$3(t2); 3727 } 3728 } 3729 }; 3730} 3731 3732// (25:1) <Block> 3733function create_default_slot$1(ctx) { 3734 let code; 3735 let current_block_type_index; 3736 let if_block; 3737 let current; 3738 const if_block_creators = [create_if_block$3, create_if_block_4$2]; 3739 const if_blocks = []; 3740 3741 function select_block_type_1(ctx, dirty) { 3742 if (/*current_language*/ ctx[7] === "python") return 0; 3743 if (/*current_language*/ ctx[7] === "javascript") return 1; 3744 return -1; 3745 } 3746 3747 if (~(current_block_type_index = select_block_type_1(ctx))) { 3748 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3749 } 3750 3751 return { 3752 c() { 3753 code = element$2("code"); 3754 if (if_block) if_block.c(); 3755 attr$2(code, "class", "svelte-1d98qmk"); 3756 }, 3757 m(target, anchor) { 3758 insert$3(target, code, anchor); 3759 3760 if (~current_block_type_index) { 3761 if_blocks[current_block_type_index].m(code, null); 3762 } 3763 3764 current = true; 3765 }, 3766 p(ctx, dirty) { 3767 let previous_block_index = current_block_type_index; 3768 current_block_type_index = select_block_type_1(ctx); 3769 3770 if (current_block_type_index === previous_block_index) { 3771 if (~current_block_type_index) { 3772 if_blocks[current_block_type_index].p(ctx, dirty); 3773 } 3774 } else { 3775 if (if_block) { 3776 group_outros$3(); 3777 3778 transition_out$4(if_blocks[previous_block_index], 1, 1, () => { 3779 if_blocks[previous_block_index] = null; 3780 }); 3781 3782 check_outros$3(); 3783 } 3784 3785 if (~current_block_type_index) { 3786 if_block = if_blocks[current_block_type_index]; 3787 3788 if (!if_block) { 3789 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3790 if_block.c(); 3791 } else { 3792 if_block.p(ctx, dirty); 3793 } 3794 3795 transition_in$4(if_block, 1); 3796 if_block.m(code, null); 3797 } else { 3798 if_block = null; 3799 } 3800 } 3801 }, 3802 i(local) { 3803 if (current) return; 3804 transition_in$4(if_block); 3805 current = true; 3806 }, 3807 o(local) { 3808 transition_out$4(if_block); 3809 current = false; 3810 }, 3811 d(detaching) { 3812 if (detaching) { 3813 detach$3(code); 3814 } 3815 3816 if (~current_block_type_index) { 3817 if_blocks[current_block_type_index].d(); 3818 } 3819 } 3820 }; 3821} 3822 3823function create_fragment$4(ctx) { 3824 let div; 3825 let current_block_type_index; 3826 let if_block; 3827 let t; 3828 let block; 3829 let current; 3830 const if_block_creators = [create_if_block_8, create_else_block_3]; 3831 const if_blocks = []; 3832 3833 function select_block_type(ctx, dirty) { 3834 if (/*named*/ ctx[6]) return 0; 3835 return 1; 3836 } 3837 3838 current_block_type_index = select_block_type(ctx); 3839 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3840 3841 block = new Block({ 3842 props: { 3843 $$slots: { default: [create_default_slot$1] }, 3844 $$scope: { ctx } 3845 } 3846 }); 3847 3848 return { 3849 c() { 3850 div = element$2("div"); 3851 if_block.c(); 3852 t = space$2(); 3853 create_component$4(block.$$.fragment); 3854 attr$2(div, "class", "container svelte-1d98qmk"); 3855 }, 3856 m(target, anchor) { 3857 insert$3(target, div, anchor); 3858 if_blocks[current_block_type_index].m(div, null); 3859 append$2(div, t); 3860 mount_component$4(block, div, null); 3861 current = true; 3862 }, 3863 p(ctx, [dirty]) { 3864 let previous_block_index = current_block_type_index; 3865 current_block_type_index = select_block_type(ctx); 3866 3867 if (current_block_type_index === previous_block_index) { 3868 if_blocks[current_block_type_index].p(ctx, dirty); 3869 } else { 3870 group_outros$3(); 3871 3872 transition_out$4(if_blocks[previous_block_index], 1, 1, () => { 3873 if_blocks[previous_block_index] = null; 3874 }); 3875 3876 check_outros$3(); 3877 if_block = if_blocks[current_block_type_index]; 3878 3879 if (!if_block) { 3880 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3881 if_block.c(); 3882 } else { 3883 if_block.p(ctx, dirty); 3884 } 3885 3886 transition_in$4(if_block, 1); 3887 if_block.m(div, t); 3888 } 3889 3890 const block_changes = {}; 3891 3892 if (dirty & /*$$scope, python_code, dependency, named, dependency_index, endpoint_parameters, dependency_failures, root, current_language, js_code, js_parameters*/ 16778239) { 3893 block_changes.$$scope = { dirty, ctx }; 3894 } 3895 3896 block.$set(block_changes); 3897 }, 3898 i(local) { 3899 if (current) return; 3900 transition_in$4(if_block); 3901 transition_in$4(block.$$.fragment, local); 3902 current = true; 3903 }, 3904 o(local) { 3905 transition_out$4(if_block); 3906 transition_out$4(block.$$.fragment, local); 3907 current = false;
3908 }, 3909 d(detaching) { 3910 if (detaching) { 3911 detach$3(div); 3912 } 3913 3914 if_blocks[current_block_type_index].d(); 3915 destroy_component$4(block); 3916 } 3917 }; 3918} 3919 3920function instance$4($$self, $$props, $$invalidate) { 3921 let { dependency } = $$props; 3922 let { dependency_index } = $$props; 3923 let { root } = $$props; 3924 let { dependency_failures } = $$props; 3925 let { endpoint_parameters } = $$props; 3926 let { js_parameters } = $$props; 3927 let { named } = $$props; 3928 let { current_language } = $$props; 3929 let python_code; 3930 let js_code; 3931 let blob_components = ["Audio", "File", "Image", "Video"]; 3932 let blob_examples = endpoint_parameters.filter(param => blob_components.includes(param.component)); 3933 3934 function div1_binding($$value) { 3935 binding_callbacks$1[$$value ? 'unshift' : 'push'](() => { 3936 python_code = $$value; 3937 $$invalidate(8, python_code); 3938 }); 3939 } 3940 3941 function div1_binding_1($$value) { 3942 binding_callbacks$1[$$value ? 'unshift' : 'push'](() => { 3943 js_code = $$value; 3944 $$invalidate(9, js_code); 3945 }); 3946 } 3947 3948 $$self.$$set = $$props => { 3949 if ('dependency' in $$props) $$invali
3949date(0, dependency = $$props.dependency); 3950 if ('dependency_index' in $$props) $$invalidate(1, dependency_index = $$props.dependency_index); 3951 if ('root' in $$props) $$invalidate(2, root = $$props.root); 3952 if ('dependency_failures' in $$props) $$invalidate(3, dependency_failures = $$props.dependency_failures); 3953 if ('endpoint_parameters' in $$props) $$invalidate(4, endpoint_parameters = $$props.endpoint_parameters); 3954 if ('js_parameters' in $$props) $$invalidate(5, js_parameters = $$props.js_parameters); 3955 if ('named' in $$props) $$invalidate(6, named = $$props.named); 3956 if ('current_language' in $$props) $$invalidate(7, current_language = $$props.current_language); 3957 }; 3958 3959 return [ 3960 dependency, 3961 dependency_index, 3962 root, 3963 dependency_failures, 3964 endpoint_parameters, 3965 js_parameters, 3966 named, 3967 current_language, 3968 python_code, 3969 js_code, 3970 blob_components, 3971 blob_examples, 3972 div1_binding, 3973 div1_binding_1 3974 ]; 3975} 3976 3977class CodeSnippets extends SvelteComponent$4 { 3978 constructor(options) { 3979 super(); 3980 3981 init$4(this, options, instance$4, create_fragment$4, safe_not_equal$4, { 3982 dependency: 0, 3983 dependency_index: 1, 3984 root: 2, 3985 dependency_failures: 3, 3986 endpoint_parameters: 4, 3987 js_parameters: 5, 3988 named: 6, 3989 current_language: 7 3990 }); 3991 } 3992} 3993 3994const python = ""+new URL('python-20e39c92.svg', import.meta.url).href+""; 3995 3996const javascript = ""+new URL('javascript-850cf94b.svg', import.meta.url).href+""; 3997 3998const ApiDocs_svelte_svelte_type_style_lang = ''; 3999 4000/* src/api_docs/ApiDocs.svelte generated by Svelte v4.2.2 */ 4001const { 4002 SvelteComponent: SvelteComponent$3, 4003 append: append$1, 4004 attr: attr$1, 4005 bubble: bubble$1, 4006 check_outros: check_outros$2, 4007 create_component: create_component$3, 4008 destroy_component: destroy_component$3, 4009 destroy_each, 4010 detach: detach$2, 4011 element: element$1, 4012 empty: empty$2, 4013 ensure_array_like: ensure_array_like$1, 4014 group_outros: group_outros$2, 4015 init: init$3, 4016 insert: insert$2, 4017 listen: listen$1, 4018 mount_component: mount_component$3, 4019 safe_not_equal: safe_not_equal$3, 4020 space: space$1, 4021 src_url_equal: src_url_equal$1, 4022 text: text$1, 4023 transition_in: transition_in$3, 4024 transition_out: transition_out$3 4025} = window.__gradio__svelte__internal; 4026const { onMount: onMount$2, createEventDispatcher: createEventDispatcher$2 } = window.__gradio__svelte__internal; 4027function get_each_context$1(ctx, list, i) { 4028 const child_ctx = ctx.slice(); 4029 child_ctx[18] = list[i]; 4030 child_ctx[20] = i; 4031 return child_ctx; 4032} 4033 4034function get_each_context_1(ctx, list, i) { 4035 const child_ctx = ctx.slice(); 4036 child_ctx[18] = list[i]; 4037 child_ctx[20] = i; 4038 return child_ctx; 4039} 4040 4041function get_each_context_2(ctx, list, i) { 4042 const child_ctx = ctx.slice(); 4043 child_ctx[22] = list[i][0]; 4044 child_ctx[23] = list[i][1]; 4045 return child_ctx; 4046} 4047 4048// (99:0) {#if info} 4049function create_if_block$2(ctx) { 4050 let show_if; 4051 let current_block_type_index; 4052 let if_block; 4053 let if_block_anchor; 4054 let current; 4055 const if_block_creators = [create_if_block_1$1, create_else_block]; 4056 const if_blocks = []; 4057 4058 function select_block_type(ctx, dirty) { 4059 if (dirty & /*info*/ 32) show_if = null; 4060 if (show_if == null) show_if = !!(Object.keys(/*info*/ ctx[5].named_endpoints).length + Object.keys(/*info*/ ctx[5].unnamed_endpoints).length); 4061 if (show_if) return 0; 4062 return 1; 4063 } 4064 4065 current_block_type_index = select_block_type(ctx, -1); 4066 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 4067 4068 return { 4069 c() { 4070 if_block.c(); 4071 if_block_anchor = empty$2(); 4072 }, 4073 m(target, anchor) { 4074 if_blocks[current_block_type_index].m(target, anchor); 4075 insert$2(target, if_block_anchor, anchor); 4076 current = true; 4077 }, 4078 p(ctx, dirty) { 4079 let previous_block_index = current_block_type_index; 4080 current_block_type_index = select_block_type(ctx, dirty); 4081 4082 if (current_block_type_index === previous_block_index) { 4083 if_blocks[current_block_type_index].p(ctx, dirty); 4084 } else { 4085 group_outros$2(); 4086 4087 transition_out$3(if_blocks[previous_block_index], 1, 1, () => { 4088 if_blocks[previous_block_index] = null; 4089 }); 4090 4091 check_outros$2(); 4092 if_block = if_blocks[current_block_type_index]; 4093 4094 if (!if_block) { 4095 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 4096 if_block.c(); 4097 } else { 4098 if_block.p(ctx, dirty); 4099 } 4100 4101 transition_in$3(if_block, 1); 4102 if_block.m(if_block_anchor.parentNode, if_block_anchor); 4103 } 4104 }, 4105 i(local) { 4106 if (current) return; 4107 transition_in$3(if_block); 4108 current = true; 4109 }, 4110 o(local) { 4111 transition_out$3(if_block); 4112 current = false;
4113 }, 4114 d(detaching) { 4115 if (detaching) { 4116 detach$2(if_block_anchor); 4117 } 4118 4119 if_blocks[current_block_type_index].d(detaching); 4120 } 4121 }; 4122} 4123 4124// (210:1) {:else} 4125function create_else_block(ctx) { 4126 let noapi; 4127 let current; 4128 noapi = new NoApi({ props: { root: /*root*/ ctx[0] } }); 4129 noapi.$on("close", /*close_handler_1*/ ctx[12]); 4130 4131 return { 4132 c() { 4133 create_component$3(noapi.$$.fragment); 4134 }, 4135 m(target, anchor) { 4136 mount_component$3(noapi, target, anchor); 4137 current = true; 4138 }, 4139 p(ctx, dirty) { 4140 const noapi_changes = {}; 4141 if (dirty & /*root*/ 1) noapi_changes.root = /*root*/ ctx[0]; 4142 noapi.$set(noapi_changes); 4143 }, 4144 i(local) { 4145 if (current) return; 4146 transition_in$3(noapi.$$.fragment, local); 4147 current = true; 4148 }, 4149 o(local) { 4150 transition_out$3(noapi.$$.fragment, local); 4151 current = false; 4152 }, 4153 d(detaching) { 4154 destroy_component$3(noapi, detaching); 4155 } 4156 }; 4157} 4158 4159// (100:1) {#if Object.keys(info.named_endpoints).length + Object.keys(info.unnamed_endpoints).length} 4160function create_if_block_1$1(ctx) { 4161 let div0; 4162 let apibanner; 4163 let t0; 4164 let div4; 4165 let div1; 4166 let t6; 4167 let div3; 4168 let div2; 4169 let t7; 4170 let installsnippet; 4171 let t8; 4172 let show_if_1 = Object.keys(/*info*/ ctx[5].named_endpoints).length; 4173 let t9; 4174 let t10; 4175 let show_if = Object.keys(/*info*/ ctx[5].unnamed_endpoints).length; 4176 let t11; 4177 let current; 4178 4179 apibanner = new ApiBanner({ 4180 props: { 4181 root: /*root*/ ctx[0], 4182 api_count: Object.keys(/*info*/ ctx[5].named_endpoints).length + Object.keys(/*info*/ ctx[5].unnamed_endpoints).length 4183 } 4184 }); 4185 4186 apibanner.$on("close", /*close_handler*/ ctx[10]); 4187 let each_value_2 = ensure_array_like$1(/*langs*/ ctx[7]); 4188 let each_blocks_2 = []; 4189 4190 for (let i = 0; i < each_value_2.length; i += 1) { 4191 each_blocks_2[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i)); 4192 } 4193 4194 installsnippet = new InstallSnippet({ 4195 props: { 4196 current_language: /*current_language*/ ctx[2] 4197 } 4198 }); 4199 4200 let if_block0 = show_if_1 && create_if_block_5$1(); 4201 let each_value_1 = ensure_array_like$1(/*dependencies*/ ctx[1]); 4202 let each_blocks_1 = []; 4203 4204 for (let i = 0; i < each_value_1.length; i += 1) { 4205 each_blocks_1[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); 4206 } 4207 4208 const out = i => transition_out$3(each_blocks_1[i], 1, 1, () => { 4209 each_blocks_1[i] = null; 4210 }); 4211 4212 let if_block1 = show_if && create_if_block_3$1(); 4213 let each_value = ensure_array_like$1(/*dependencies*/ ctx[1]); 4214 let each_blocks = []; 4215 4216 for (let i = 0; i < each_value.length; i += 1) { 4217 each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i)); 4218 } 4219 4220 const out_1 = i => transition_out$3(each_blocks[i], 1, 1, () => { 4221 each_blocks[i] = null; 4222 }); 4223 4224 return { 4225 c() { 4226 div0 = element$1("div"); 4227 create_component$3(apibanner.$$.fragment); 4228 t0 = space$1(); 4229 div4 = element$1("div"); 4230 div1 = element$1("div"); 4231 4232 div1.innerHTML = `<p>Use the <a href="https://gradio.app/docs/#python-client" target="_blank"><code class="library svelte-bdjvpc">gradio_client</code></a> 4233 Python library or the 4234 <a href="https://gradio.app/docs/#javascript-client" target="_blank"><code class="library svelte-bdjvpc">@gradio/client</code></a> Javascript package to query the demo via API.</p>`; 4235 4236 t6 = space$1(); 4237 div3 = element$1("div"); 4238 div2 = element$1("div"); 4239 4240 for (let i = 0; i < each_blocks_2.length; i += 1) { 4241 each_blocks_2[i].c(); 4242 } 4243 4244 t7 = space$1(); 4245 create_component$3(installsnippet.$$.fragment); 4246 t8 = space$1(); 4247 if (if_block0) if_block0.c(); 4248 t9 = space$1(); 4249 4250 for (let i = 0; i < each_blocks_1.length; i += 1) { 4251 each_blocks_1[i].c(); 4252 } 4253 4254 t10 = space$1(); 4255 if (if_block1) if_block1.c(); 4256 t11 = space$1(); 4257 4258 for (let i = 0; i < each_blocks.length; i += 1) { 4259 each_blocks[i].c(); 4260 } 4261 4262 attr$1(div0, "class", "banner-wrap svelte-bdjvpc"); 4263 attr$1(div1, "class", "client-doc svelte-bdjvpc"); 4264 attr$1(div2, "class", "snippets svelte-bdjvpc"); 4265 attr$1(div3, "class", "endpoint svelte-bdjvpc"); 4266 attr$1(div4, "class", "docs-wrap svelte-bdjvpc"); 4267 }, 4268 m(target, anchor) { 4269 insert$2(target, div0, anchor);
4270 mount_component$3(apibanner, div0, null); 4271 insert$2(target, t0, anchor); 4272 insert$2(target, div4, anchor); 4273 append$1(div4, div1); 4274 append$1(div4, t6); 4275 append$1(div4, div3); 4276 append$1(div3, div2); 4277 4278 for (let i = 0; i < each_blocks_2.length; i += 1) { 4279 if (each_blocks_2[i]) { 4280 each_blocks_2[i].m(div2, null); 4281 } 4282 } 4283 4284 append$1(div3, t7); 4285 mount_component$3(installsnippet, div3, null); 4286 append$1(div3, t8); 4287 if (if_block0) if_block0.m(div3, null); 4288 append$1(div3, t9); 4289 4290 for (let i = 0; i < each_blocks_1.length; i += 1) { 4291 if (each_blocks_1[i]) { 4292 each_blocks_1[i].m(div3, null); 4293 } 4294 } 4295 4296 append$1(div3, t10); 4297 if (if_block1) if_block1.m(div3, null); 4298 append$1(div3, t11); 4299 4300 for (let i = 0; i < each_blocks.length; i += 1) { 4301 if (each_blocks[i]) { 4302 each_blocks[i].m(div3, null); 4303 } 4304 } 4305 4306 current = true; 4307 }, 4308 p(ctx, dirty) { 4309 const apibanner_changes = {}; 4310 if (dirty & /*root*/ 1) apibanner_changes.root = /*root*/ ctx[0]; 4311 if (dirty & /*info*/ 32) apibanner_changes.api_count = Object.keys(/*info*/ ctx[5].named_endpoints).length + Object.keys(/*info*/ ctx[5].unnamed_endpoints).length; 4312 apibanner.$set(apibanner_changes); 4313 4314 if (dirty & /*current_language, langs*/ 132) { 4315 each_value_2 = ensure_array_like$1(/*langs*/ ctx[7]); 4316 let i; 4317 4318 for (i = 0; i < each_value_2.length; i += 1) { 4319 const child_ctx = get_each_context_2(ctx, each_value_2, i); 4320 4321 if (each_blocks_2[i]) { 4322 each_blocks_2[i].p(child_ctx, dirty); 4323 } else { 4324 each_blocks_2[i] = create_each_block_2(child_ctx); 4325 each_blocks_2[i].c(); 4326 each_blocks_2[i].m(div2, null); 4327 } 4328 } 4329 4330 for (; i < each_blocks_2.length; i += 1) { 4331 each_blocks_2[i].d(1); 4332 } 4333 4334 each_blocks_2.length = each_value_2.length; 4335 } 4336 4337 const installsnippet_changes = {}; 4338 if (dirty & /*current_language*/ 4) installsnippet_changes.current_language = /*current_language*/ ctx[2]; 4339 installsnippet.$set(installsnippet_changes); 4340 if (dirty & /*info*/ 32) show_if_1 = Object.keys(/*info*/ ctx[5].named_endpoints).length; 4341 4342 if (show_if_1) { 4343 if (if_block0) ; else { 4344 if_block0 = create_if_block_5$1(); 4345 if_block0.c(); 4346 if_block0.m(div3, t9); 4347 } 4348 } else if (if_block0) { 4349 if_block0.d(1); 4350 if_block0 = null; 4351 } 4352 4353 if (dirty & /*info, dependencies, js_info, is_running, current_language, root, dependency_failures*/ 127) { 4354 each_value_1 = ensure_array_like$1(/*dependencies*/ ctx[1]); 4355 let i; 4356 4357 for (i = 0; i < each_value_1.length; i += 1) { 4358 const child_ctx = get_each_context_1(ctx, each_value_1, i); 4359 4360 if (each_blocks_1[i]) { 4361 each_blocks_1[i].p(child_ctx, dirty); 4362 transition_in$3(each_blocks_1[i], 1); 4363 } else { 4364 each_blocks_1[i] = create_each_block_1(child_ctx); 4365 each_blocks_1[i].c(); 4366 transition_in$3(each_blocks_1[i], 1); 4367 each_blocks_1[i].m(div3, t10); 4368 } 4369 } 4370 4371 group_outros$2(); 4372 4373 for (i = each_value_1.length; i < each_blocks_1.length; i += 1) { 4374 out(i); 4375 } 4376 4377 check_outros$2(); 4378 } 4379 4380 if (dirty & /*info*/ 32) show_if = Object.keys(/*info*/ ctx[5].unnamed_endpoints).length; 4381 4382 if (show_if) { 4383 if (if_block1) ; else { 4384 if_block1 = create_if_block_3$1(); 4385 if_block1.c(); 4386 if_block1.m(div3, t11); 4387 } 4388 } else if (if_block1) { 4389 if_block1.d(1); 4390 if_block1 = null; 4391 } 4392 4393 if (dirty & /*info, js_info, is_running, current_language, dependencies, root, dependency_failures*/ 127) { 4394 each_value = ensure_array_like$1(/*dependencies*/ ctx[1]); 4395 let i; 4396 4397 for (i = 0; i < each_value.length; i += 1) { 4398 const child_ctx = get_each_context$1(ctx, each_value, i); 4399 4400 if (each_blocks[i]) { 4401 each_blocks[i].p(child_ctx, dirty); 4402 transition_in$3(each_blocks[i], 1); 4403 } else { 4404 each_blocks[i] = create_each_block$1(child_ctx); 4405 each_blocks[i].c(); 4406 transition_in$3(each_blocks[i], 1); 4407 each_blocks[i].m(div3, null); 4408 } 4409 } 4410 4411 group_outros$2(); 4412 4413 for (i = each_value.length; i < each_blocks.length; i += 1) { 4414 out_1(i); 4415 } 4416 4417 check_outros$2(); 4418 } 4419 }, 4420 i(local) { 4421 if (current) return; 4422 transition_in$3(apibanner.$$.fragment, local); 4423 transition_in$3(installsnippet.$$.fragment, local); 4424 4425 for (let i = 0; i < each_value_1.length; i += 1) { 4426 transition_in$3(each_blocks_1[i]); 4427 } 4428 4429 for (let i = 0; i < each_value.length; i += 1) { 4430 transition_in$3(each_blocks[i]); 4431 } 4432 4433 current = true; 4434 }, 4435 o(local) { 4436 transition_out$3(apibanner.$$.fragment, local); 4437 transition_out$3(installsnippet.$$.fragment, local);
4438 each_blocks_1 = each_blocks_1.filter(Boolean); 4439 4440 for (let i = 0; i < each_blocks_1.length; i += 1) { 4441 transition_out$3(each_blocks_1[i]); 4442 } 4443 4444 each_blocks = each_blocks.filter(Boolean); 4445 4446 for (let i = 0; i < each_blocks.length; i += 1) { 4447 transition_out$3(each_blocks[i]); 4448 } 4449 4450 current = false; 4451 }, 4452 d(detaching) { 4453 if (detaching) { 4454 detach$2(div0); 4455 detach$2(t0); 4456 detach$2(div4); 4457 } 4458 4459 destroy_component$3(apibanner); 4460 destroy_each(each_blocks_2, detaching); 4461 destroy_component$3(installsnippet); 4462 if (if_block0) if_block0.d(); 4463 destroy_each(each_blocks_1, detaching); 4464 if (if_block1) if_block1.d(); 4465 destroy_each(each_blocks, detaching); 4466 } 4467 }; 4468} 4469 4470// (124:5) {#each langs as [language, img]} 4471function create_each_block_2(ctx) { 4472 let li; 4473 let img_1; 4474 let img_1_src_value; 4475 let t0; 4476 let t1_value = /*language*/ ctx[22] + ""; 4477 let t1; 4478 let t2; 4479 let li_class_value; 4480 let mounted; 4481 let dispose; 4482 4483 function click_handler() { 4484 return /*click_handler*/ ctx[11](/*language*/ ctx[22]); 4485 } 4486 4487 return { 4488 c() { 4489 li = element$1("li"); 4490 img_1 = element$1("img"); 4491 t0 = space$1(); 4492 t1 = text$1(t1_value); 4493 t2 = space$1(); 4494 if (!src_url_equal$1(img_1.src, img_1_src_value = /*img*/ ctx[23])) attr$1(img_1, "src", img_1_src_value); 4495 attr$1(img_1, "alt", ""); 4496 attr$1(img_1, "class", "svelte-bdjvpc"); 4497 4498 attr$1(li, "class", li_class_value = "snippet " + (/*current_language*/ ctx[2] === /*language*/ ctx[22] 4499 ? 'current-lang' 4500 : 'inactive-lang') + " svelte-bdjvpc"); 4501 }, 4502 m(target, anchor) { 4503 insert$2(target, li, anchor); 4504 append$1(li, img_1); 4505 append$1(li, t0); 4506 append$1(li, t1); 4507 append$1(li, t2); 4508 4509 if (!mounted) { 4510 dispose = listen$1(li, "click", click_handler); 4511 mounted = true; 4512 } 4513 }, 4514 p(new_ctx, dirty) { 4515 ctx = new_ctx; 4516 4517 if (dirty & /*current_language*/ 4 && li_class_value !== (li_class_value = "snippet " + (/*current_language*/ ctx[2] === /*language*/ ctx[22] 4518 ? 'current-lang' 4519 : 'inactive-lang') + " svelte-bdjvpc")) { 4520 attr$1(li, "class", li_class_value); 4521 } 4522 }, 4523 d(detaching) { 4524 if (detaching) { 4525 detach$2(li); 4526 } 4527 4528 mounted = false; 4529 dispose(); 4530 } 4531 }; 4532} 4533 4534// (137:4) {#if Object.keys(info.named_endpoints).length} 4535function create_if_block_5$1(ctx) { 4536 let h2; 4537 4538 return { 4539 c() { 4540 h2 = element$1("h2"); 4541 h2.textContent = "Named Endpoints"; 4542 attr$1(h2, "class", "header svelte-bdjvpc"); 4543 }, 4544 m(target, anchor) { 4545 insert$2(target, h2, anchor); 4546 }, 4547 d(detaching) { 4548 if (detaching) { 4549 detach$2(h2); 4550 } 4551 } 4552 }; 4553} 4554 4555// (142:5) {#if dependency.api_name} 4556function create_if_block_4$1(ctx) { 4557 let div; 4558 let codesnippets; 4559 let t; 4560 let responseobject; 4561 let current; 4562 4563 codesnippets = new CodeSnippets({ 4564 props: { 4565 named: true, 4566 endpoint_parameters: /*info*/ ctx[5].named_endpoints["/" + /*dependency*/ ctx[18].api_name].parameters, 4567 js_parameters: /*js_info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[18].api_name].parameters, 4568 dependency: /*dependency*/ ctx[18], 4569 dependency_index: /*dependency_index*/ ctx[20], 4570 current_language: /*current_language*/ ctx[2], 4571 root: /*root*/ ctx[0], 4572 dependency_failures: /*dependency_failures*/ ctx[4] 4573 } 4574 }); 4575 4576 responseobject = new ResponseObject({ 4577 props: { 4578 endpoint_returns: /*info*/ ctx[5].named_endpoints["/" + /*dependency*/ ctx[18].api_name].returns, 4579 js_returns: /*js_info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[18].api_name].returns, 4580 is_running: /*is_running*/ ctx[3], 4581 current_language: /*current_language*/ ctx[2] 4582 } 4583 }); 4584 4585 return { 4586 c() { 4587 div = element$1("div"); 4588 create_component$3(codesnippets.$$.fragment); 4589 t = space$1(); 4590 create_component$3(responseobject.$$.fragment); 4591 attr$1(div, "class", "endpoint-container svelte-bdjvpc"); 4592 }, 4593 m(target, anchor) { 4594 insert$2(target, div, anchor); 4595 mount_component$3(codesnippets, div, null); 4596 append$1(div, t); 4597 mount_component$3(responseobject, div, null); 4598 current = true; 4599 }, 4600 p(ctx, dirty) { 4601 const codesnippets_changes = {}; 4602 if (dirty & /*info, dependencies*/ 34) codesnippets_changes.endpoint_parameters = /*info*/ ctx[5].named_endpoints["/" + /*dependency*/ ctx[18].api_name].parameters;
4603 if (dirty & /*js_info, dependencies*/ 66) codesnippets_changes.js_parameters = /*js_info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[18].api_name].parameters; 4604 if (dirty & /*dependencies*/ 2) codesnippets_changes.dependency = /*dependency*/ ctx[18]; 4605 if (dirty & /*current_language*/ 4) codesnippets_changes.current_language = /*current_language*/ ctx[2]; 4606 if (dirty & /*root*/ 1) codesnippets_changes.root = /*root*/ ctx[0]; 4607 if (dirty & /*dependency_failures*/ 16) codesnippets_changes.dependency_failures = /*dependency_failures*/ ctx[4]; 4608 codesnippets.$set(codesnippets_changes); 4609 const responseobject_changes = {}; 4610 if (dirty & /*info, dependencies*/ 34) responseobject_changes.endpoint_returns = /*info*/ ctx[5].named_endpoints["/" + /*dependency*/ ctx[18].api_name].returns; 4611 if (dirty & /*js_info, dependencies*/ 66) responseobject_changes.js_returns = /*js_info*/ ctx[6].named_endpoints["/" + /*dependency*/ ctx[18].api_name].returns; 4612 if (dirty & /*is_running*/ 8) responseobject_changes.is_running = /*is_running*/ ctx[3]; 4613 if (dirty & /*current_language*/ 4) responseobject_changes.current_language = /*current_language*/ ctx[2]; 4614 responseobject.$set(responseobject_changes); 4615 }, 4616 i(local) { 4617 if (current) return; 4618 transition_in$3(codesnippets.$$.fragment, local); 4619 transition_in$3(responseobject.$$.fragment, local); 4620 current = true; 4621 }, 4622 o(local) { 4623 transition_out$3(codesnippets.$$.fragment, local); 4624 transition_out$3(responseobject.$$.fragment, local); 4625 current = false; 4626 }, 4627 d(detaching) { 4628 if (detaching) { 4629 detach$2(div); 4630 } 4631 4632 destroy_component$3(codesnippets); 4633 destroy_component$3(responseobject); 4634 } 4635 }; 4636} 4637 4638// (141:4) {#each dependencies as dependency, dependency_index} 4639function create_each_block_1(ctx) { 4640 let if_block_anchor; 4641 let current; 4642 let if_block = /*dependency*/ ctx[18].api_name && create_if_block_4$1(ctx); 4643 4644 return { 4645 c() { 4646 if (if_block) if_block.c(); 4647 if_block_anchor = empty$2(); 4648 }, 4649 m(target, anchor) { 4650 if (if_block) if_block.m(target, anchor); 4651 insert$2(target, if_block_anchor, anchor); 4652 current = true; 4653 }, 4654 p(ctx, dirty) { 4655 if (/*dependency*/ ctx[18].api_name) { 4656 if (if_block) { 4657 if_block.p(ctx, dirty); 4658 4659 if (dirty & /*dependencies*/ 2) { 4660 transition_in$3(if_block, 1); 4661 } 4662 } else { 4663 if_block = create_if_block_4$1(ctx); 4664 if_block.c(); 4665 transition_in$3(if_block, 1); 4666 if_block.m(if_block_anchor.parentNode, if_block_anchor); 4667 } 4668 } else if (if_block) { 4669 group_outros$2(); 4670 4671 transition_out$3(if_block, 1, 1, () => { 4672 if_block = null; 4673 }); 4674 4675 check_outros$2(); 4676 } 4677 }, 4678 i(local) { 4679 if (current) return; 4680 transition_in$3(if_block); 4681 current = true; 4682 }, 4683 o(local) { 4684 transition_out$3(if_block); 4685 current = false; 4686 }, 4687 d(detaching) { 4688 if (detaching) { 4689 detach$2(if_block_anchor); 4690 } 4691 4692 if (if_block) if_block.d(detaching); 4693 } 4694 }; 4695} 4696 4697// (178:4) {#if Object.keys(info.unnamed_endpoints).length} 4698function create_if_block_3$1(ctx) { 4699 let h2; 4700 4701 return { 4702 c() { 4703 h2 = element$1("h2"); 4704 h2.textContent = "Unnamed Endpoints"; 4705 attr$1(h2, "class", "header svelte-bdjvpc"); 4706 }, 4707 m(target, anchor) { 4708 insert$2(target, h2, anchor); 4709 }, 4710 d(detaching) { 4711 if (detaching) { 4712 detach$2(h2); 4713 } 4714 } 4715 }; 4716} 4717 4718// (183:5) {#if info.unnamed_endpoints[dependency_index]} 4719function create_if_block_2$1(ctx) { 4720 let div; 4721 let codesnippets; 4722 let t0; 4723 let responseobject; 4724 let t1; 4725 let current; 4726 4727 codesnippets = new CodeSnippets({ 4728 props: { 4729 named: false, 4730 endpoint_parameters: /*info*/ ctx[5].unnamed_endpoints[/*dependency_index*/ ctx[20]].parameters, 4731 js_parameters: /*js_info*/ ctx[6].unnamed_endpoints[/*dependency_index*/ ctx[20]].parameters, 4732 dependency: /*dependency*/ ctx[18], 4733 dependency_index: /*dependency_index*/ ctx[20], 4734 current_language: /*current_language*/ ctx[2], 4735 root: /*root*/ ctx[0], 4736 dependency_failures: /*dependency_failures*/ ctx[4] 4737 } 4738 }); 4739 4740 responseobject = new ResponseObject({ 4741 props: { 4742 endpoint_returns: /*info*/ ctx[5].unnamed_endpoints[/*dependency_index*/ ctx[20]].returns, 4743 js_returns: /*js_info*/ ctx[6].unnamed_endpoints[/*dependency_index*/ ctx[20]].returns, 4744 is_running: /*is_running*/ ctx[3], 4745 current_language: /*current_language*/ ctx[2] 4746 } 4747 }); 4748 4749 return { 4750 c() { 4751 div = element$1("div"); 4752 create_component$3(codesnippets.$$.fragment); 4753 t0 = space$1(); 4754 create_component$3(responseobject.$$.fragment); 4755 t1 = space$1(); 4756 attr$1(div, "class", "endpoint-container svelte-bdjvpc"); 4757 }, 4758 m(target, anchor) { 4759 insert$2(target, div, anchor);
4760 mount_component$3(codesnippets, div, null); 4761 append$1(div, t0); 4762 mount_component$3(responseobject, div, null); 4763 append$1(div, t1); 4764 current = true; 4765 }, 4766 p(ctx, dirty) { 4767 const codesnippets_changes = {}; 4768 if (dirty & /*info*/ 32) codesnippets_changes.endpoint_parameters = /*info*/ ctx[5].unnamed_endpoints[/*dependency_index*/ ctx[20]].parameters; 4769 if (dirty & /*js_info*/ 64) codesnippets_changes.js_parameters = /*js_info*/ ctx[6].unnamed_endpoints[/*dependency_index*/ ctx[20]].parameters; 4770 if (dirty & /*dependencies*/ 2) codesnippets_changes.dependency = /*dependency*/ ctx[18]; 4771 if (dirty & /*current_language*/ 4) codesnippets_changes.current_language = /*current_language*/ ctx[2]; 4772 if (dirty & /*root*/ 1) codesnippets_changes.root = /*root*/ ctx[0]; 4773 if (dirty & /*dependency_failures*/ 16) codesnippets_changes.dependency_failures = /*dependency_failures*/ ctx[4]; 4774 codesnippets.$set(codesnippets_changes); 4775 const responseobject_changes = {}; 4776 if (dirty & /*info*/ 32) responseobject_changes.endpoint_returns = /*info*/ ctx[5].unnamed_endpoints[/*dependency_index*/ ctx[20]].returns; 4777 if (dirty & /*js_info*/ 64) responseobject_changes.js_returns = /*js_info*/ ctx[6].unnamed_endpoints[/*dependency_index*/ ctx[20]].returns; 4778 if (dirty & /*is_running*/ 8) responseobject_changes.is_running = /*is_running*/ ctx[3]; 4779 if (dirty & /*current_language*/ 4) responseobject_changes.current_language = /*current_language*/ ctx[2]; 4780 responseobject.$set(responseobject_changes); 4781 }, 4782 i(local) { 4783 if (current) return; 4784 transition_in$3(codesnippets.$$.fragment, local); 4785 transition_in$3(responseobject.$$.fragment, local); 4786 current = true; 4787 }, 4788 o(local) { 4789 transition_out$3(codesnippets.$$.fragment, local); 4790 transition_out$3(responseobject.$$.fragment, local); 4791 current = false; 4792 }, 4793 d(detaching) { 4794 if (detaching) { 4795 detach$2(div); 4796 } 4797 4798 destroy_component$3(codesnippets); 4799 destroy_component$3(responseobject); 4800 } 4801 }; 4802} 4803 4804// (182:4) {#each dependencies as dependency, dependency_index} 4805function create_each_block$1(ctx) { 4806 let if_block_anchor; 4807 let current; 4808 let if_block = /*info*/ ctx[5].unnamed_endpoints[/*dependency_index*/ ctx[20]] && create_if_block_2$1(ctx); 4809 4810 return { 4811 c() { 4812 if (if_block) if_block.c(); 4813 if_block_anchor = empty$2(); 4814 }, 4815 m(target, anchor) { 4816 if (if_block) if_block.m(target, anchor); 4817 insert$2(target, if_block_anchor, anchor); 4818 current = true; 4819 }, 4820 p(ctx, dirty) { 4821 if (/*info*/ ctx[5].unnamed_endpoints[/*dependency_index*/ ctx[20]]) { 4822 if (if_block) { 4823 if_block.p(ctx, dirty); 4824 4825 if (dirty & /*info*/ 32) { 4826 transition_in$3(if_block, 1); 4827 } 4828 } else { 4829 if_block = create_if_block_2$1(ctx); 4830 if_block.c(); 4831 transition_in$3(if_block, 1); 4832 if_block.m(if_block_anchor.parentNode, if_block_anchor); 4833 } 4834 } else if (if_block) { 4835 group_outros$2(); 4836 4837 transition_out$3(if_block, 1, 1, () => { 4838 if_block = null; 4839 }); 4840 4841 check_outros$2(); 4842 } 4843 }, 4844 i(local) { 4845 if (current) return; 4846 transition_in$3(if_block); 4847 current = true; 4848 }, 4849 o(local) { 4850 transition_out$3(if_block); 4851 current = false; 4852 }, 4853 d(detaching) { 4854 if (detaching) { 4855 detach$2(if_block_anchor); 4856 } 4857 4858 if (if_block) if_block.d(detaching); 4859 } 4860 }; 4861} 4862 4863function create_fragment$3(ctx) { 4864 let if_block_anchor; 4865 let current; 4866 let if_block = /*info*/ ctx[5] && create_if_block$2(ctx); 4867 4868 return { 4869 c() { 4870 if (if_block) if_block.c(); 4871 if_block_anchor = empty$2(); 4872 }, 4873 m(target, anchor) { 4874 if (if_block) if_block.m(target, anchor); 4875 insert$2(target, if_block_anchor, anchor); 4876 current = true; 4877 }, 4878 p(ctx, [dirty]) { 4879 if (/*info*/ ctx[5]) { 4880 if (if_block) { 4881 if_block.p(ctx, dirty); 4882 4883 if (dirty & /*info*/ 32) { 4884 transition_in$3(if_block, 1); 4885 } 4886 } else { 4887 if_block = create_if_block$2(ctx); 4888 if_block.c(); 4889 transition_in$3(if_block, 1); 4890 if_block.m(if_block_anchor.parentNode, if_block_anchor); 4891 } 4892 } else if (if_block) { 4893 group_outros$2(); 4894 4895 transition_out$3(if_block, 1, 1, () => { 4896 if_block = null; 4897 }); 4898 4899 check_outros$2(); 4900 } 4901 }, 4902 i(local) { 4903 if (current) return; 4904 transition_in$3(if_block); 4905 current = true; 4906 }, 4907 o(local) { 4908 transition_out$3(if_block); 4909 current = false;
4910 }, 4911 d(detaching) { 4912 if (detaching) { 4913 detach$2(if_block_anchor); 4914 } 4915 4916 if (if_block) if_block.d(detaching); 4917 } 4918 }; 4919} 4920 4921function instance$3($$self, $$props, $$invalidate) { 4922 let { instance_map } = $$props; 4923 let { dependencies } = $$props; 4924 let { root } = $$props; 4925 let { app } = $$props; 4926 4927 if (root === "") { 4928 root = location.protocol + "//" + location.host + location.pathname; 4929 } 4930 4931 if (!root.endsWith("/")) { 4932 root += "/"; 4933 } 4934 4935 let current_language = "python"; 4936 const langs = [["python", python], ["javascript", javascript]]; 4937 let is_running = false; 4938 4939 dependencies.map(dependency => dependency.inputs.map(_id => { 4940 let default_data = instance_map[_id].documentation?.example_data; 4941 4942 if (default_data === undefined) { 4943 default_data = ""; 4944 } else if (typeof default_data === "object") { 4945 default_data = JSON.stringify(default_data); 4946 } 4947 4948 return default_data; 4949 })); 4950 4951 dependencies.map(dependency => new Array(dependency.outputs.length)); 4952 let dependency_failures = dependencies.map(dependency => new Array(dependency.inputs.length).fill(false)); 4953 4954 async function get_info() { 4955 let response = await fetch(root + "info"); 4956 let data = await response.json(); 4957 return data; 4958 } 4959 4960 async function get_js_info() { 4961 let js_api_info = await app.view_api(); 4962 return js_api_info; 4963 } 4964 4965 let info; 4966 let js_info; 4967 get_info().then(data =>
4967 $$invalidate(5, info = data)); 4968 get_js_info().then(js_api_info => $$invalidate(6, js_info = js_api_info)); 4969 4970 onMount$2(() => { 4971 document.body.style.overflow = "hidden"; 4972 4973 if ("parentIFrame" in window) { 4974 window.parentIFrame?.scrollTo(0, 0); 4975 } 4976 4977 return () => { 4978 document.body.style.overflow = "auto"; 4979 }; 4980 }); 4981 4982 function close_handler(event) { 4983 bubble$1.call(this, $$self, event); 4984 } 4985 4986 const click_handler = language => $$invalidate(2, current_language = language); 4987 4988 function close_handler_1(event) { 4989 bubble$1.call(this, $$self, event); 4990 } 4991 4992 $$self.$$set = $$props => { 4993 if ('instance_map' in $$props) $$invalidate(8, instance_map = $$props.instance_map); 4994 if ('dependencies' in $$props) $$invalidate(1, dependencies = $$props.dependencies); 4995 if ('root' in $$props) $$invalidate(0, root = $$props.root); 4996 if ('app' in $$props) $$invalidate(9, app = $$props.app); 4997 }; 4998 4999 return [ 5000 root, 5001 dependencies, 5002 current_language, 5003 is_running, 5004 dependency_failures, 5005 info, 5006 js_info, 5007 langs, 5008 instance_map, 5009 app, 5010 close_handler, 5011 click_handler, 5012 close_handler_1 5013 ]; 5014} 5015 5016class ApiDocs extends SvelteComponent$3 { 5017 constructor(options) { 5018 super(); 5019 5020 init$3(this, options, instance$3, create_fragment$3, safe_not_equal$3, { 5021 instance_map: 8, 5022 dependencies: 1, 5023 root: 0, 5024 app: 9 5025 }); 5026 } 5027} 5028 5029get_store_value($format); 5030class Gradio { 5031 #id; 5032 #el; 5033 constructor(id, el, theme, version, root, autoscroll) { 5034 this.#id = id; 5035 this.theme = theme; 5036 this.version = version; 5037 this.#el = el; 5038 this.i18n = get_store_value($format); 5039 this.root = root; 5040 this.autoscroll = autoscroll; 5041 } 5042 dispatch(event_name, data) { 5043 const e = new CustomEvent("gradio", { 5044 bubbles: true, 5045 detail: { data, id: this.#id, event: event_name } 5046 }); 5047 this.#el.dispatchEvent(e); 5048 } 5049} 5050 5051/* src/Render.svelte generated by Svelte v4.2.2 */ 5052const { 5053 SvelteComponent: SvelteComponent$2, 5054 add_flush_callback, 5055 assign, 5056 bind, 5057 binding_callbacks, 5058 bubble, 5059 check_outros: check_outros$1, 5060 construct_svelte_component, 5061 create_component: create_component$2, 5062 destroy_component: destroy_component$2, 5063 detach: detach$1, 5064 empty: empty$1, 5065 ensure_array_like, 5066 get_spread_object, 5067 get_spread_update, 5068 group_outros: group_outros$1, 5069 init: init$2, 5070 insert: insert$1, 5071 mount_component: mount_component$2, 5072 outro_and_destroy_block, 5073 safe_not_equal: safe_not_equal$2, 5074 transition_in: transition_in$2, 5075 transition_out: transition_out$2, 5076 update_keyed_each 5077} = window.__gradio__svelte__internal;const { onMount: onMount$1, createEventDispatcher: createEventDispatcher$1, setContext } = window.__gradio__svelte__internal; 5078function get_each_context(ctx, list, i) { 5079 const child_ctx = ctx.slice(); 5080 child_ctx[10] = list[i].component; 5081 child_ctx[19] = list[i].id; 5082 child_ctx[2] = list[i].props; 5083 child_ctx[20] = list[i].children; 5084 child_ctx[21] = list[i].has_modes; 5085 return child_ctx; 5086} 5087 5088// (69:1) {#if children && children.length} 5089function create_if_block$1(ctx) { 5090 let each_blocks = []; 5091 let each_1_lookup = new Map(); 5092 let each_1_anchor; 5093 let current; 5094 let each_value = ensure_array_like(/*children*/ ctx[1]); 5095 const get_key = ctx => /*each_id*/ ctx[19]; 5096 5097 for (let i = 0; i < each_value.length; i += 1) { 5098 let child_ctx = get_each_context(ctx, each_value, i); 5099 let key = get_key(child_ctx); 5100 each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx)); 5101 } 5102 5103 return { 5104 c() { 5105 for (let i = 0; i < each_blocks.length; i += 1) { 5106 each_blocks[i].c(); 5107 } 5108 5109 each_1_anchor = empty$1(); 5110 }, 5111 m(target, anchor) { 5112 for (let i = 0; i < each_blocks.length; i += 1) { 5113 if (each_blocks[i]) { 5114 each_blocks[i].m(target, anchor); 5115 } 5116 } 5117 5118 insert$1(target, each_1_anchor, anchor); 5119 current = true; 5120 }, 5121 p(ctx, dirty) { 5122 if (dirty & /*children, target, root, instance_map, dynamic_ids, theme_mode*/ 235) { 5123 each_value = ensure_array_like(/*children*/ ctx[1]); 5124 group_outros$1(); 5125 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); 5126 check_outros$1(); 5127 } 5128 }, 5129 i(local) { 5130 if (current) return; 5131 5132 for (let i = 0; i < each_value.length; i += 1) { 5133 transition_in$2(each_blocks[i]); 5134 } 5135 5136 current = true; 5137 }, 5138 o(local) { 5139 for (let i = 0; i < each_blocks.length; i += 1) { 5140 transition_out$2(each_blocks[i]); 5141 } 5142 5143 current = false;
5144 }, 5145 d(detaching) { 5146 if (detaching) { 5147 detach$1(each_1_anchor); 5148 } 5149 5150 for (let i = 0; i < each_blocks.length; i += 1) { 5151 each_blocks[i].d(detaching); 5152 } 5153 } 5154 }; 5155} 5156 5157// (70:2) {#each children as { component, id: each_id, props, children: _children, has_modes } 5158function create_each_block(key_1, ctx) { 5159 let first; 5160 let render; 5161 let current; 5162 5163 render = new Render({ 5164 props: { 5165 component: /*component*/ ctx[10], 5166 target: /*target*/ ctx[6], 5167 id: /*each_id*/ ctx[19], 5168 props: /*props*/ ctx[2], 5169 root: /*root*/ ctx[3], 5170 instance_map: /*instance_map*/ ctx[0], 5171 children: /*_children*/ ctx[20], 5172 dynamic_ids: /*dynamic_ids*/ ctx[5], 5173 has_modes: /*has_modes*/ ctx[21], 5174 theme_mode: /*theme_mode*/ ctx[7] 5175 } 5176 }); 5177 5178 render.$on("destroy", /*destroy_handler*/ ctx[13]); 5179 render.$on("mount", /*mount_handler*/ ctx[14]); 5180 5181 return { 5182 key: key_1, 5183 first: null, 5184 c() { 5185 first = empty$1(); 5186 create_component$2(render.$$.fragment); 5187 this.first = first; 5188 }, 5189 m(target, anchor) { 5190 insert$1(target, first, anchor); 5191 mount_component$2(render, target, anchor); 5192 current = true; 5193 }, 5194 p(new_ctx, dirty) { 5195 ctx = new_ctx; 5196 const render_changes = {}; 5197 if (dirty & /*children*/ 2) render_changes.component = /*component*/ ctx[10]; 5198 if (dirty & /*target*/ 64) render_changes.target = /*target*/ ctx[6]; 5199 if (dirty & /*children*/ 2) render_changes.id = /*each_id*/ ctx[19]; 5200 if (dirty & /*children*/ 2) render_changes.props = /*props*/ ctx[2]; 5201 if (dirty & /*root*/ 8) render_changes.root = /*root*/ ctx[3]; 5202 if (dirty & /*instance_map*/ 1) render_changes.instance_map = /*instance_map*/ ctx[0]; 5203 if (dirty & /*children*/ 2) render_changes.children = /*_children*/ ctx[20]; 5204 if (dirty & /*dynamic_ids*/ 32) render_changes.dynamic_ids = /*dynamic_ids*/ ctx[5]; 5205 if (dirty & /*children*/ 2) render_changes.has_modes = /*has_modes*/ ctx[21]; 5206 if (dirty & /*theme_mode*/ 128) render_changes.theme_mode = /*theme_mode*/ ctx[7]; 5207 render.$set(render_changes); 5208 }, 5209 i(local) { 5210 if (current) return; 5211 transition_in$2(render.$$.fragment, local); 5212 current = true; 5213 }, 5214 o(local) { 5215 transition_out$2(render.$$.fragment, local); 5216 current = false; 5217 }, 5218 d(detaching) { 5219 if (detaching) { 5220 detach$1(first); 5221 } 5222 5223 destroy_component$2(render, detaching); 5224 } 5225 }; 5226} 5227 5228// (56:0) <svelte:component this={component} bind:this={instance_map[id].instance} bind:value={instance_map[id].props.value} elem_id={("elem_id" in props && props.elem_id) || `component-${id}`} elem_classes={("elem_classes" in props && props.elem_classes) || []} on:prop_change={handle_prop_change} {target} {...props} {theme_mode} {root} gradio={new Gradio(id, target, theme_mode, version, root, autoscroll)} > 5229function create_default_slot(ctx) { 5230 let if_block_anchor; 5231 let current; 5232 let if_block = /*children*/ ctx[1] && /*children*/ ctx[1].length && create_if_block$1(ctx); 5233 5234 return { 5235 c() { 5236 if (if_block) if_block.c(); 5237 if_block_anchor = empty$1(); 5238 }, 5239 m(target, anchor) { 5240 if (if_block) if_block.m(target, anchor); 5241 insert$1(target, if_block_anchor, anchor); 5242 current = true; 5243 }, 5244 p(ctx, dirty) { 5245 if (/*children*/ ctx[1] && /*children*/ ctx[1].length) { 5246 if (if_block) { 5247 if_block.p(ctx, dirty); 5248 5249 if (dirty & /*children*/ 2) { 5250 transition_in$2(if_block, 1); 5251 } 5252 } else { 5253 if_block = create_if_block$1(ctx); 5254 if_block.c(); 5255 transition_in$2(if_block, 1); 5256 if_block.m(if_block_anchor.parentNode, if_block_anchor); 5257 } 5258 } else if (if_block) { 5259 group_outros$1(); 5260 5261 transition_out$2(if_block, 1, 1, () => { 5262 if_block = null; 5263 }); 5264 5265 check_outros$1(); 5266 } 5267 }, 5268 i(local) { 5269 if (current) return; 5270 transition_in$2(if_block); 5271 current = true; 5272 }, 5273 o(local) { 5274 transition_out$2(if_block); 5275 current = false; 5276 }, 5277 d(detaching) { 5278 if (detaching) { 5279 detach$1(if_block_anchor); 5280 } 5281 5282 if (if_block) if_block.d(detaching); 5283 } 5284 }; 5285} 5286 5287function create_fragment$2(ctx) { 5288 let switch_instance; 5289 let updating_value; 5290 let switch_instance_anchor; 5291 let current; 5292 5293 const switch_instance_spread_levels = [ 5294 { 5295 elem_id: "elem_id" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_id || `component-${/*id
5295*/ ctx[4]}` 5296 }, 5297 { 5298 elem_classes: "elem_classes" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_classes || [] 5299 }, 5300 { target: /*target*/ ctx[6] }, 5301 /*props*/ ctx[2], 5302 { theme_mode: /*theme_mode*/ ctx[7] }, 5303 { root: /*root*/ ctx[3] }, 5304 { 5305 gradio: new Gradio(/*id*/ ctx[4], /*target*/ ctx[6], /*theme_mode*/ ctx[7], /*version*/ ctx[8], /*root*/ ctx[3], /*autoscroll*/ ctx[9]) 5306 } 5307 ]; 5308 5309 function switch_instance_value_binding(value) { 5310 /*switch_instance_value_binding*/ ctx[16](value); 5311 } 5312 5313 var switch_value = /*component*/ ctx[10]; 5314 5315 function switch_props(ctx, dirty) { 5316 let switch_instance_props = { 5317 $$slots: { default: [create_default_slot] }, 5318 $$scope: { ctx } 5319 }; 5320 5321 if (dirty !== undefined && dirty & /*props, id, target, theme_mode, root, version, autoscroll*/ 988) { 5322 switch_instance_props = get_spread_update(switch_instance_spread_levels, [ 5323 dirty & /*props, id*/ 20 && { 5324 elem_id: "elem_id" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_id || `component-${/*id*/ ctx[4]}` 5325 }, 5326 dirty & /*props*/ 4 && { 5327 elem_classes: "elem_classes" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_classes || [] 5328 }, 5329 dirty & /*target*/ 64 && { target: /*target*/ ctx[6] }, 5330 dirty & /*props*/ 4 && get_spread_object(/*props*/ ctx[2]), 5331 dirty & /*theme_mode*/ 128 && { theme_mode: /*theme_mode*/ ctx[7] }, 5332 dirty & /*root*/ 8 && { root: /*root*/ ctx[3] }, 5333 dirty & /*id, target, theme_mode, version, root, autoscroll*/ 984 && { 5334 gradio: new Gradio(/*id*/ ctx[4], /*target*/ ctx[6], /*theme_mode*/ ctx[7], /*version*/ ctx[8], /*root*/ ctx[3], /*autoscroll*/ ctx[9]) 5335 } 5336 ]); 5337 } else { 5338 for (let i = 0; i < switch_instance_spread_levels.length; i += 1) { 5339 switch_instance_props = assign(switch_instance_props, switch_instance_spread_levels[i]); 5340 } 5341 } 5342 5343 if (/*instance_map*/ ctx[0][/*id*/ ctx[4]].props.value !== void 0) { 5344 switch_instance_props.value = /*instance_map*/ ctx[0][/*id*/ ctx[4]].props.value; 5345 } 5346 5347 return { props: switch_instance_props }; 5348 } 5349 5350 if (switch_value) { 5351 switch_instance = construct_svelte_component(switch_value, switch_props(ctx)); 5352 /*switch_instance_binding*/ ctx[15](switch_instance); 5353 binding_callbacks.push(() => bind(switch_instance, 'value', switch_instance_value_binding)); 5354 switch_instance.$on("prop_change", /*handle_prop_change*/ ctx[11]); 5355 } 5356 5357 return { 5358 c() { 5359 if (switch_instance) create_component$2(switch_instance.$$.fragment); 5360 switch_instance_anchor = empty$1(); 5361 }, 5362 m(target, anchor) { 5363 if (switch_instance) mount_component$2(switch_instance, target, anchor); 5364 insert$1(target, switch_instance_anchor, anchor); 5365 current = true; 5366 }, 5367 p(ctx, [dirty]) { 5368 if (dirty & /*component*/ 1024 && switch_value !== (switch_value = /*component*/ ctx[10])) { 5369 if (switch_instance) { 5370 group_outros$1(); 5371 const old_component = switch_instance; 5372 5373 transition_out$2(old_component.$$.fragment, 1, 0, () => { 5374 destroy_component$2(old_component, 1); 5375 }); 5376 5377 check_outros$1(); 5378 } 5379 5380 if (switch_value) { 5381 switch_instance = construct_svelte_component(switch_value, switch_props(ctx, dirty)); 5382 /*switch_instance_binding*/ ctx[15](switch_instance); 5383 binding_callbacks.push(() => bind(switch_instance, 'value', switch_instance_value_binding)); 5384 switch_instance.$on("prop_change", /*handle_prop_change*/ ctx[11]); 5385 create_component$2(switch_instance.$$.fragment); 5386 transition_in$2(switch_instance.$$.fragment, 1); 5387 mount_component$2(switch_instance, switch_instance_anchor.parentNode, switch_instance_anchor); 5388 } else { 5389 switch_instance = null; 5390 } 5391 } else if (switch_value) { 5392 const switch_instance_changes = (dirty & /*props, id, target, theme_mode, root, version, autoscroll*/ 988) 5393 ? get_spread_update(switch_instance_spread_levels, [ 5394 dirty & /*props, id*/ 20 && { 5395 elem_id: "elem_id" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_id || `component-${/*id*/ ctx[4]}` 5396 }, 5397 dirty & /*props*/ 4 && { 5398 elem_classes: "elem_classes" in /*props*/ ctx[2] && /*props*/ ctx[2].elem_classes || [] 5399 }, 5400 dirty & /*target*/ 64 && { target: /*target*/ ctx[6] }, 5401 dirty & /*props*/ 4 && get_spread_object(/*props*/ ctx[2]), 5402 dirty & /*theme_mode*/ 128 && { theme_mode: /*theme_mode*/ ctx[7] }, 5403 dirty & /*root*/ 8 && { root: /*root*/ ctx[3] }, 5404 dirty & /*id, target, theme_mode, version, root, autoscroll*/ 984 && { 5405 gradio: new Gradio(/*id*/ ctx[4], /*target*/ ctx[6], /*theme_mode*/ ctx[7], /*version*/ ctx[8], /*root*/ ctx[3], /*autoscroll*/ ctx[9]) 5406 } 5407 ]) 5408 : {}; 5409
5410 if (dirty & /*$$scope, children, target, root, instance_map, dynamic_ids, theme_mode*/ 16777451) { 5411 switch_instance_changes.$$scope = { dirty, ctx }; 5412 } 5413 5414 if (!updating_value && dirty & /*instance_map, id*/ 17) { 5415 updating_value = true; 5416 switch_instance_changes.value = /*instance_map*/ ctx[0][/*id*/ ctx[4]].props.value; 5417 add_flush_callback(() => updating_value = false); 5418 } 5419 5420 switch_instance.$set(switch_instance_changes); 5421 } 5422 }, 5423 i(local) { 5424 if (current) return; 5425 if (switch_instance) transition_in$2(switch_instance.$$.fragment, local); 5426 current = true; 5427 }, 5428 o(local) { 5429 if (switch_instance) transition_out$2(switch_instance.$$.fragment, local); 5430 current = false; 5431 }, 5432 d(detaching) { 5433 if (detaching) { 5434 detach$1(switch_instance_anchor); 5435 } 5436 5437 /*switch_instance_binding*/ ctx[15](null); 5438 if (switch_instance) destroy_component$2(switch_instance, detaching); 5439 } 5440 }; 5441} 5442 5443function instance$2($$self, $$props, $$invalidate) { 5444 let { root } = $$props; 5445 let { component } = $$props; 5446 let { instance_map } = $$props; 5447 let { id } = $$props; 5448 let { props } = $$props; 5449 let { children } = $$props; 5450 let { dynamic_ids } = $$props; 5451 let { parent = null } = $$props; 5452 let { target } = $$props; 5453 let { theme_mode } = $$props; 5454 let { version } = $$props; 5455 let { autoscroll } = $$props; 5456 const dispatch = createEventDispatcher$1(); 5457 let filtered_children = []; 5458 5459 onMount$1(() => { 5460 dispatch("mount", id); 5461 5462 for (const child of filtered_children) { 5463 dispatch("mount", child.id); 5464 } 5465 5466 return () => { 5467 dispatch("destroy", id); 5468 5469 for (const child of filtered_children) { 5470 dispatch("mount", child.id); 5471 } 5472 }; 5473 }); 5474 5475 setContext("BLOCK_KEY", parent); 5476 5477 function handle_prop_change(e) { 5478 for (const k in e.detail) { 5479 $$invalidate(0, instance_map[id].props[k] = e.detail[k], instance_map); 5480 } 5481 } 5482 5483 function destroy_handler(event) { 5484 bubble.call(this, $$self, event); 5485 } 5486 5487 function mount_handler(event) { 5488 bubble.call(this, $$self, event); 5489 } 5490 5491 function switch_instance_binding($$value) { 5492 binding_callbacks[$$value ? 'unshift' : 'push'](() => { 5493 instance_map[id].instance = $$value; 5494 $$invalidate(0, instance_map); 5495 }); 5496 } 5497 5498 function switch_instance_value_binding(value) { 5499 if ($$self.$$.not_equal(instance_map[id].props.value, value)) { 5500 instance_map[id].props.value = value; 5501 $$invalidate(0, instance_map); 5502 } 5503 } 5504 5505 $$self.$$set = $$props => {
5506 if ('root' in $$props) $$invalidate(3, root = $$props.root); 5507 if ('component' in $$props) $$invalidate(10, component = $$props.component); 5508 if ('instance_map' in $$props) $$invalidate(0, instance_map = $$props.instance_map); 5509 if ('id' in $$props) $$invalidate(4, id = $$props.id); 5510 if ('props' in $$props) $$invalidate(2, props = $$props.props); 5511 if ('children' in $$props) $$invalidate(1, children = $$props.children); 5512 if ('dynamic_ids' in $$props) $$invalidate(5, dynamic_ids = $$props.dynamic_ids); 5513 if ('parent' in $$props) $$invalidate(12, parent = $$props.parent); 5514 if ('target' in $$props) $$invalidate(6, target = $$props.target); 5515 if ('theme_mode' in $$props) $$invalidate(7, theme_mode = $$props.theme_mode); 5516 if ('version' in $$props) $$invalidate(8, version = $$props.version); 5517 if ('autoscroll' in $$props) $$invalidate(9, autoscroll = $$props.autoscroll); 5518 }; 5519 5520 $$self.$$.update = () => { 5521 if ($$self.$$.dirty & /*children, instance_map*/ 3) { 5522 $$invalidate(1, children = children && children.filter(v => { 5523 const valid_node = instance_map[v.id].type !== "statustracker"; 5524 5525 if (!valid_node) { 5526 filtered_children.push(v); 5527 } 5528 5529 return valid_node; 5530 })); 5531 } 5532 5533 if ($$self.$$.dirty & /*instance_map, id, children*/ 19) { 5534 { 5535 if (instance_map[id].type === "form") { 5536 if (children?.every(c => !c.props.visible)) { 5537 $$invalidate(2, props.visible = false, props); 5538 } else { 5539 $$invalidate(2, props.visible = true, props); 5540 } 5541 } 5542 } 5543 } 5544 }; 5545 5546 return [ 5547 instance_map, 5548 children, 5549 props, 5550 root, 5551 id, 5552 dynamic_ids, 5553 target, 5554 theme_mode, 5555 version, 5556 autoscroll, 5557 component, 5558 handle_prop_change, 5559 parent, 5560 destroy_handler, 5561 mount_handler, 5562 switch_instance_binding, 5563 switch_instance_value_binding 5564 ]; 5565} 5566 5567class Render extends SvelteComponent$2 { 5568 constructor(options) { 5569 super(); 5570 5571 init$2(this, options, instance$2, create_fragment$2, safe_not_equal$2, { 5572 root: 3, 5573 component: 10, 5574 instance_map: 0, 5575 id: 4, 5576 props: 2, 5577 children: 1, 5578 dynamic_ids: 5, 5579 parent: 12, 5580 target: 6, 5581 theme_mode: 7, 5582 version: 8, 5583 autoscroll: 9 5584 }); 5585 } 5586} 5587 5588/* src/MountComponents.svelte generated by Svelte v4.2.2 */ 5589const { 5590 SvelteComponent: SvelteComponent$1, 5591 create_component: create_component$1, 5592 destroy_component: destroy_component$1, 5593 init: init$1, 5594 mount_component: mount_component$1, 5595 safe_not_equal: safe_not_equal$1, 5596 transition_in: transition_in$1, 5597 transition_out: transition_out$1 5598} = window.__gradio__svelte__internal; 5599const { onMount, createEventDispatcher } = window.__gradio__svelte__internal; 5600function create_fragment$1(ctx) { 5601 let render; 5602 let current; 5603 5604 render = new Render({ 5605 props: { 5606 component: /*rootNode*/ ctx[0].component, 5607 id: /*rootNode*/ ctx[0].id, 5608 props: /*rootNode*/ ctx[0].props, 5609 children: /*rootNode*/ ctx[0].children, 5610 dynamic_ids: /*dynamic_ids*/ ctx[1], 5611 instance_map: /*instance_map*/ ctx[2], 5612 root: /*root*/ ctx[3], 5613 target: /*target*/ ctx[4], 5614 theme_mode: /*theme_mode*/ ctx[5], 5615 version: /*version*/ ctx[6], 5616 autoscroll: /*autoscroll*/ ctx[7] 5617 } 5618 }); 5619 5620 return { 5621 c() { 5622 create_component$1(render.$$.fragment); 5623 }, 5624 m(target, anchor) { 5625 mount_component$1(render, target, anchor); 5626 current = true; 5627 }, 5628 p(ctx, [dirty]) { 5629 const render_changes = {}; 5630 if (dirty & /*rootNode*/ 1) render_changes.component = /*rootNode*/ ctx[0].component; 5631 if (dirty & /*rootNode*/ 1) render_changes.id = /*rootNode*/ ctx[0].id; 5632 if (dirty & /*rootNode*/ 1) render_changes.props = /*rootNode*/ ctx[0].props; 5633 if (dirty & /*rootNode*/ 1) render_changes.children = /*rootNode*/ ctx[0].children; 5634 if (dirty & /*dynamic_ids*/ 2) render_changes.dynamic_ids = /*dynamic_ids*/ ctx[1]; 5635 if (dirty & /*instance_map*/ 4) render_changes.instance_map = /*instance_map*/ ctx[2]; 5636 if (dirty & /*root*/ 8) render_changes.root = /*root*/ ctx[3]; 5637 if (dirty & /*target*/ 16) render_changes.target = /*target*/ ctx[4]; 5638 if (dirty & /*theme_mode*/ 32) render_changes.theme_mode = /*theme_mode*/ ctx[5]; 5639 if (dirty & /*version*/ 64) render_changes.version = /*version*/ ctx[6];
5640 if (dirty & /*autoscroll*/ 128) render_changes.autoscroll = /*autoscroll*/ ctx[7]; 5641 render.$set(render_changes); 5642 }, 5643 i(local) { 5644 if (current) return; 5645 transition_in$1(render.$$.fragment, local); 5646 current = true; 5647 }, 5648 o(local) { 5649 transition_out$1(render.$$.fragment, local); 5650 current = false; 5651 }, 5652 d(detaching) { 5653 destroy_component$1(render, detaching); 5654 } 5655 }; 5656} 5657 5658function instance$1($$self, $$props, $$invalidate) { 5659 let { rootNode } = $$props; 5660 let { dynamic_ids } = $$props; 5661 let { instance_map } = $$props; 5662 let { root } = $$props; 5663 let { target } = $$props; 5664 let { theme_mode } = $$props; 5665 let { version } = $$props; 5666 let { autoscroll } = $$props; 5667 const dispatch = createEventDispatcher(); 5668 5669 onMount(() => { 5670 dispatch("mount"); 5671 }); 5672 5673 $$self.$$set = $$props => { 5674 if ('rootNode' in $$props) $$invalidate(0, rootNode = $$props.rootNode); 5675 if ('dynamic_ids' in $$props) $$invalidate(1, dynamic_ids = $$props.dynamic_ids); 5676 if ('instance_map' in $$props) $$invalidate(2, instance_map = $$props.instance_map);
5677 if ('root' in $$props) $$invalidate(3, root = $$props.root); 5678 if ('target' in $$props) $$invalidate(4, target = $$props.target); 5679 if ('theme_mode' in $$props) $$invalidate(5, theme_mode = $$props.theme_mode); 5680 if ('version' in $$props) $$invalidate(6, version = $$props.version); 5681 if ('autoscroll' in $$props) $$invalidate(7, autoscroll = $$props.autoscroll); 5682 }; 5683 5684 return [ 5685 rootNode, 5686 dynamic_ids, 5687 instance_map, 5688 root, 5689 target, 5690 theme_mode, 5691 version, 5692 autoscroll 5693 ]; 5694} 5695 5696class MountComponents extends SvelteComponent$1 { 5697 constructor(options) { 5698 super(); 5699 5700 init$1(this, options, instance$1, create_fragment$1, safe_not_equal$1, { 5701 rootNode: 0, 5702 dynamic_ids: 1, 5703 instance_map: 2, 5704 root: 3, 5705 target: 4, 5706 theme_mode: 5, 5707 version: 6, 5708 autoscroll: 7 5709 }); 5710 } 5711} 5712 5713const logo = ""+new URL('logo-3707f936.svg', import.meta.url).href+""; 5714 5715const Blocks_svelte_svelte_type_style_lang = ''; 5716 5717/* src/Blocks.svelte generated by Svelte v4.2.2 */ 5718const { 5719 SvelteComponent, 5720 append, 5721 attr, 5722 check_outros, 5723 component_subscribe, 5724 create_component, 5725 destroy_component, 5726 detach, 5727 element, 5728 empty, 5729 globals, 5730 group_outros, 5731 init, 5732 insert, 5733 listen, 5734 mount_component, 5735 noop, 5736 safe_not_equal, 5737 set_data, 5738 set_style, 5739 space, 5740 src_url_equal, 5741 subscribe, 5742 text, 5743 transition_in, 5744 transition_out 5745} = window.__gradio__svelte__internal; 5746const { document: document_1 } = globals; 5747const { tick } = window.__gradio__svelte__internal; 5748function create_if_block_6(ctx) { 5749 document_1.title = /*title*/ ctx[3]; 5750 return { c: noop, m: noop, d: noop }; 5751} 5752 5753// (532:1) {#if analytics_enabled} 5754function create_if_block_5(ctx) { 5755 let script0; 5756 let script0_src_value; 5757 let t0; 5758 let script1; 5759 5760 return { 5761 c() { 5762 script0 = element("script"); 5763 script0.innerHTML = ``; 5764 t0 = space(); 5765 script1 = element("script"); 5766 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});"; 5767 script0.async = true; 5768 script0.defer = true; 5769 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); 5770 }, 5771 m(target, anchor) { 5772 insert(target, script0, anchor); 5773 insert(target, t0, anchor); 5774 insert(target, script1, anchor); 5775 }, 5776 d(detaching) { 5777 if (detaching) { 5778 detach(script0); 5779 detach(t0); 5780 detach(script1); 5781 } 5782 } 5783 }; 5784} 5785 5786// (553:2) {#if ready} 5787function create_if_block_4(ctx) { 5788 let mountcomponents; 5789 let current; 5790 5791 mountcomponents = new MountComponents({ 5792 props: { 5793 rootNode: /*rootNode*/ ctx[15], 5794 dynamic_ids: /*dynamic_ids*/ ctx[17], 5795 instance_map: /*instance_map*/ ctx[18], 5796 root: /*root*/ ctx[1], 5797 target: /*target*/ ctx[5], 5798 theme_mode: /*theme_mode*/ ctx[11], 5799 version: /*version*/ ctx[13], 5800 autoscroll: /*autoscroll*/ ctx[6] 5801 } 5802 }); 5803 5804 mountcomponents.$on("mount", /*handle_mount*/ ctx[23]); 5805 mountcomponents.$on("destroy", /*destroy_handler*/ ctx[32]); 5806 5807 return { 5808 c() { 5809 create_component(mountcomponents.$$.fragment); 5810 }, 5811 m(target, anchor) { 5812 mount_component(mountcomponents, target, anchor); 5813 current = true; 5814 }, 5815 p(ctx, dirty) { 5816 const mountcomponents_changes = {}; 5817 if (dirty[0] & /*rootNode*/ 32768) mountcomponents_changes.rootNode = /*rootNode*/ ctx[15]; 5818 if (dirty[0] & /*dynamic_ids*/ 131072) mountcomponents_changes.dynamic_ids = /*dynamic_ids*/ ctx[17]; 5819 if (dirty[0] & /*instance_map*/ 262144) mountcomponents_changes.instance_map = /*instance_map*/ ctx[18]; 5820 if (dirty[0] & /*root*/ 2) mountcomponents_changes.root = /*root*/ ctx[1]; 5821 if (dirty[0] & /*target*/ 32) mountcomponents_changes.target = /*target*/ ctx[5]; 5822 if (dirty[0] & /*theme_mode*/ 2048) mountcomponents_changes.theme_mode = /*theme_mode*/ ctx[11]; 5823 if (dirty[0] & /*version*/ 8192) mountcomponents_changes.version = /*version*/ ctx[13]; 5824 if (dirty[0] & /*autoscroll*/ 64) mountcomponents_changes.autoscroll = /*autoscroll*/ ctx[6];
5825 mountcomponents.$set(mountcomponents_changes); 5826 }, 5827 i(local) { 5828 if (current) return; 5829 transition_in(mountcomponents.$$.fragment, local); 5830 current = true; 5831 }, 5832 o(local) { 5833 transition_out(mountcomponents.$$.fragment, local); 5834 current = false; 5835 }, 5836 d(detaching) { 5837 destroy_component(mountcomponents, detaching); 5838 } 5839 }; 5840} 5841 5842// (569:1) {#if show_footer} 5843function create_if_block_2(ctx) { 5844 let footer; 5845 let t0; 5846 let a; 5847 let t1_value = /*$_*/ ctx[20]("common.built_with_gradio") + ""; 5848 let t1; 5849 let t2; 5850 let img; 5851 let img_src_value; 5852 let img_alt_value; 5853 let if_block = /*show_api*/ ctx[7] && create_if_block_3(ctx); 5854 5855 return { 5856 c() { 5857 footer = element("footer"); 5858 if (if_block) if_block.c(); 5859 t0 = space(); 5860 a = element("a"); 5861 t1 = text(t1_value); 5862 t2 = space(); 5863 img = element("img"); 5864 if (!src_url_equal(img.src, img_src_value = logo)) attr(img, "src", img_src_value); 5865 attr(img, "alt", img_alt_value = /*$_*/ ctx[20]("common.logo")); 5866 attr(img, "class", "svelte-mpyp5e"); 5867 attr(a, "href", "https://gradio.app");
5868 attr(a, "class", "built-with svelte-mpyp5e"); 5869 attr(a, "target", "_blank"); 5870 attr(a, "rel", "noreferrer"); 5871 attr(footer, "class", "svelte-mpyp5e"); 5872 }, 5873 m(target, anchor) { 5874 insert(target, footer, anchor); 5875 if (if_block) if_block.m(footer, null); 5876 append(footer, t0); 5877 append(footer, a); 5878 append(a, t1); 5879 append(a, t2); 5880 append(a, img); 5881 }, 5882 p(ctx, dirty) { 5883 if (/*show_api*/ ctx[7]) { 5884 if (if_block) { 5885 if_block.p(ctx, dirty); 5886 } else { 5887 if_block = create_if_block_3(ctx); 5888 if_block.c(); 5889 if_block.m(footer, t0); 5890 } 5891 } else if (if_block) { 5892 if_block.d(1); 5893 if_block = null; 5894 } 5895 5896 if (dirty[0] & /*$_*/ 1048576 && t1_value !== (t1_value = /*$_*/ ctx[20]("common.built_with_gradio") + "")) set_data(t1, t1_value); 5897 5898 if (dirty[0] & /*$_*/ 1048576 && img_alt_value !== (img_alt_value = /*$_*/ ctx[20]("common.logo"))) { 5899 attr(img, "alt", img_alt_value); 5900 } 5901 }, 5902 d(detaching) { 5903 if (detaching) { 5904 detach(footer); 5905 } 5906 5907 if (if_block) if_block.d(); 5908 } 5909 }; 5910} 5911 5912// (571:3) {#if show_api} 5913function create_if_block_3(ctx) { 5914 let button; 5915 let t0_value = /*$_*/ ctx[20]("errors.use_via_api") + ""; 5916 let t0; 5917 let t1; 5918 let img; 5919 let img_src_value; 5920 let img_alt_value; 5921 let t2; 5922 let div; 5923 let mounted; 5924 let dispose; 5925 5926 return { 5927 c() { 5928 button = element("button"); 5929 t0 = text(t0_value); 5930 t1 = space(); 5931 img = element("img"); 5932 t2 = space(); 5933 div = element("div"); 5934 div.textContent = "·"; 5935 if (!src_url_equal(img.src, img_src_value = api_logo)) attr(img, "src", img_src_value); 5936 attr(img, "alt", img_alt_value = /*$_*/ ctx[20]("common.logo")); 5937 attr(img, "class", "svelte-mpyp5e"); 5938 attr(button, "class", "show-api svelte-mpyp5e"); 5939 attr(div, "class", "svelte-mpyp5e"); 5940 }, 5941 m(target, anchor) { 5942 insert(target, button, anchor); 5943 append(button, t0); 5944 append(button, t1); 5945 append(button, img); 5946 insert(target, t2, anchor); 5947 insert(target, div, anchor); 5948 5949 if (!mounted) { 5950 dispose = listen(button, "click", /*click_handler*/ ctx[33]); 5951 mounted = true; 5952 } 5953 }, 5954 p(ctx, dirty) { 5955 if (dirty[0] & /*$_*/ 1048576 && t0_value !== (t0_value = /*$_*/ ctx[20]("errors.use_via_api") + "")) set_data(t0, t0_value); 5956 5957 if (dirty[0] & /*$_*/ 1048576 && img_alt_value !== (img_alt_value = /*$_*/ ctx[20]("common.logo"))) { 5958 attr(img, "alt", img_alt_value); 5959 } 5960 }, 5961 d(detaching) { 5962 if (detaching) { 5963 detach(button); 5964 detach(t2); 5965 detach(div); 5966 } 5967 5968 mounted = false; 5969 dispose(); 5970 } 5971 }; 5972} 5973 5974// (596:0) {#if api_docs_visible && ready} 5975function create_if_block_1(ctx) { 5976 let div2; 5977 let div0; 5978 let t; 5979 let div1; 5980 let apidocs; 5981 let current; 5982 let mounted; 5983 let dispose; 5984 5985 apidocs = new ApiDocs({ 5986 props: { 5987 instance_map: /*instance_map*/ ctx[18], 5988 dependencies: /*dependencies*/ ctx[2], 5989 root: /*root*/ ctx[1], 5990 app: /*app*/ ctx[12] 5991 } 5992 }); 5993 5994 apidocs.$on("close", /*close_handler*/ ctx[35]); 5995 5996 return { 5997 c() { 5998 div2 = element("div"); 5999 div0 = element("div"); 6000 t = space(); 6001 div1 = element("div"); 6002 create_component(apidocs.$$.fragment); 6003 attr(div0, "class", "backdrop svelte-mpyp5e"); 6004 attr(div1, "class", "api-docs-wrap svelte-mpyp5e"); 6005 attr(div2, "class", "api-docs svelte-mpyp5e"); 6006 }, 6007 m(target, anchor) { 6008 insert(target, div2, anchor); 6009 append(div2, div0); 6010 append(div2, t); 6011 append(div2, div1); 6012 mount_component(apidocs, div1, null); 6013 current = true; 6014 6015 if (!mounted) { 6016 dispose = listen(div0, "click", /*click_handler_1*/ ctx[34]); 6017 mounted = true; 6018 } 6019 }, 6020 p(ctx, dirty) { 6021 const apidocs_changes = {}; 6022 if (dirty[0] & /*instance_map*/ 262144) apidocs_changes.instance_map = /*instance_map*/ ctx[18]; 6023 if (dirty[0] & /*dependencies*/ 4) apidocs_changes.dependencies = /*dependencies*/ ctx[2]; 6024 if (dirty[0] & /*root*/ 2) apidocs_changes.root = /*root*/ ctx[1]; 6025 if (dirty[0] & /*app*/ 4096) apidocs_changes.app = /*app*/ ctx[12]; 6026 apidocs.$set(apidocs_changes); 6027 }, 6028 i(local) { 6029 if (current) return; 6030 transition_in(apidocs.$$.fragment, local); 6031 current = true; 6032 }, 6033 o(local) { 6034 transition_out(apidocs.$$.fragment, local); 6035 current = false;
6036 }, 6037 d(detaching) { 6038 if (detaching) { 6039 detach(div2); 6040 } 6041 6042 destroy_component(apidocs); 6043 mounted = false; 6044 dispose(); 6045 } 6046 }; 6047} 6048 6049// (621:0) {#if messages} 6050function create_if_block(ctx) { 6051 let toast; 6052 let current; 6053 6054 toast = new Toast({ 6055 props: { messages: /*messages*/ ctx[19] } 6056 }); 6057 6058 toast.$on("close", /*handle_error_close*/ ctx[22]); 6059 6060 return { 6061 c() { 6062 create_component(toast.$$.fragment); 6063 }, 6064 m(target, anchor) { 6065 mount_component(toast, target, anchor); 6066 current = true; 6067 }, 6068 p(ctx, dirty) { 6069 const toast_changes = {}; 6070 if (dirty[0] & /*messages*/ 524288) toast_changes.messages = /*messages*/ ctx[19]; 6071 toast.$set(toast_changes); 6072 }, 6073 i(local) { 6074 if (current) return; 6075 transition_in(toast.$$.fragment, local); 6076 current = true; 6077 }, 6078 o(local) { 6079 transition_out(toast.$$.fragment, local); 6080 current = false; 6081 }, 6082 d(detaching) { 6083 destroy_component(toast, detaching); 6084 } 6085 }; 6086} 6087 6088function create_fragment(ctx) { 6089 let if_block0_anchor; 6090 let if_block1_anchor; 6091 let t0; 6092 let div1; 6093 let div0; 6094 let t1; 6095 let t2; 6096 let t3; 6097 let if_block5_anchor; 6098 let current; 6099 let if_block0 = /*control_page_title*/ ctx[9] && create_if_block_6(ctx); 6100 let if_block1 = /*analytics_enabled*/ ctx[4] && create_if_block_5(); 6101 let if_block2 = /*ready*/ ctx[0] && create_if_block_4(ctx); 6102 let if_block3 = /*show_footer*/ ctx[8] && create_if_block_2(ctx); 6103 let if_block4 = /*api_docs_visible*/ ctx[16] && /*ready*/ ctx[0] && create_if_block_1(ctx); 6104 let if_block5 = /*messages*/ ctx[19] && create_if_block(ctx); 6105 6106 return { 6107 c() { 6108 if (if_block0) if_block0.c(); 6109 if_block0_anchor = empty(); 6110 if (if_block1) if_block1.c(); 6111 if_block1_anchor = empty(); 6112 t0 = space(); 6113 div1 = element("div"); 6114 div0 = element("div"); 6115 if (if_block2) if_block2.c(); 6116 t1 = space(); 6117 if (if_block3) if_block3.c(); 6118 t2 = space(); 6119 if (if_block4) if_block4.c(); 6120 t3 = space(); 6121 if (if_block5) if_block5.c(); 6122 if_block5_anchor = empty(); 6123 attr(div0, "class", "contain"); 6124 set_style(div0, "flex-grow", /*app_mode*/ ctx[10] ? "1" : "auto"); 6125 attr(div1, "class", "wrap svelte-mpyp5e"); 6126 set_style(div1, "min-height", /*app_mode*/ ctx[10] ? "100%" : "auto"); 6127 }, 6128 m(target, anchor) { 6129 if (if_block0) if_block0.m(document_1.head, null); 6130 append(document_1.head, if_block0_anchor); 6131 if (if_block1) if_block1.m(document_1.head, null); 6132 append(document_1.head, if_block1_anchor); 6133 insert(target, t0, anchor); 6134 insert(target, div1, anchor); 6135 append(div1, div0); 6136 if (if_block2) if_block2.m(div0, null); 6137 append(div1, t1); 6138 if (if_block3) if_block3.m(div1, null); 6139 insert(target, t2, anchor); 6140 if (if_block4) if_block4.m(target, anchor); 6141 insert(target, t3, anchor); 6142 if (if_block5) if_block5.m(target, anchor); 6143 insert(target, if_block5_anchor, anchor); 6144 current = true; 6145 }, 6146 p(ctx, dirty) { 6147 if (/*control_page_title*/ ctx[9]) { 6148 if (if_block0) ; else { 6149 if_block0 = create_if_block_6(ctx); 6150 if_block0.c(); 6151 if_block0.m(if_block0_anchor.parentNode, if_block0_anchor); 6152 } 6153 } else if (if_block0) { 6154 if_block0.d(1); 6155 if_block0 = null; 6156 } 6157 6158 if (/*analytics_enabled*/ ctx[4]) { 6159 if (if_block1) ; else { 6160 if_block1 = create_if_block_5(); 6161 if_block1.c(); 6162 if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); 6163 } 6164 } else if (if_block1) { 6165 if_block1.d(1); 6166 if_block1 = null; 6167 } 6168 6169 if (/*ready*/ ctx[0]) { 6170 if (if_block2) { 6171 if_block2.p(ctx, dirty); 6172 6173 if (dirty[0] & /*ready*/ 1) { 6174 transition_in(if_block2, 1); 6175 } 6176 } else { 6177 if_block2 = create_if_block_4(ctx); 6178 if_block2.c(); 6179 transition_in(if_block2, 1); 6180 if_block2.m(div0, null); 6181 } 6182 } else if (if_block2) { 6183 group_outros(); 6184 6185 transition_out(if_block2, 1, 1, () => { 6186 if_block2 = null; 6187 }); 6188 6189 check_outros(); 6190 } 6191 6192 if (dirty[0] & /*app_mode*/ 1024) { 6193 set_style(div0, "flex-grow", /*app_mode*/ ctx[10] ? "1" : "auto"); 6194 } 6195 6196 if (/*show_footer*/ ctx[8]) { 6197 if (if_block3) { 6198 if_block3.p(ctx, dirty); 6199 } else { 6200 if_block3 = create_if_block_2(ctx); 6201 if_block3.c(); 6202 if_block3.m(div1, null); 6203 } 6204 } else if (if_block3) { 6205 if_block3.d(1); 6206 if_block3 = null; 6207 } 6208
6209 if (dirty[0] & /*app_mode*/ 1024) { 6210 set_style(div1, "min-height", /*app_mode*/ ctx[10] ? "100%" : "auto"); 6211 } 6212 6213 if (/*api_docs_visible*/ ctx[16] && /*ready*/ ctx[0]) { 6214 if (if_block4) { 6215 if_block4.p(ctx, dirty); 6216 6217 if (dirty[0] & /*api_docs_visible, ready*/ 65537) { 6218 transition_in(if_block4, 1); 6219 } 6220 } else { 6221 if_block4 = create_if_block_1(ctx); 6222 if_block4.c(); 6223 transition_in(if_block4, 1); 6224 if_block4.m(t3.parentNode, t3); 6225 } 6226 } else if (if_block4) { 6227 group_outros(); 6228 6229 transition_out(if_block4, 1, 1, () => { 6230 if_block4 = null; 6231 }); 6232 6233 check_outros(); 6234 } 6235 6236 if (/*messages*/ ctx[19]) { 6237 if (if_block5) { 6238 if_block5.p(ctx, dirty); 6239 6240 if (dirty[0] & /*messages*/ 524288) { 6241 transition_in(if_block5, 1); 6242 } 6243 } else { 6244 if_block5 = create_if_block(ctx); 6245 if_block5.c(); 6246 transition_in(if_block5, 1); 6247 if_block5.m(if_block5_anchor.parentNode, if_block5_anchor); 6248 } 6249 } else if (if_block5) { 6250 group_outros(); 6251 6252 transition_out(if_block5, 1, 1, () => { 6253 if_block5 = null; 6254 }); 6255 6256 check_outros(); 6257 } 6258 }, 6259 i(local) { 6260 if (current) return; 6261 transition_in(if_block2); 6262 transition_in(if_block4); 6263 transition_in(if_block5); 6264 current = true; 6265 }, 6266 o(local) { 6267 transition_out(if_block2); 6268 transition_out(if_block4); 6269 transition_out(if_block5); 6270 current = false; 6271 }, 6272 d(detaching) { 6273 if (detaching) { 6274 detach(t0); 6275 detach(div1); 6276 detach(t2); 6277 detach(t3); 6278 detach(if_block5_anchor); 6279 } 6280 6281 if (if_block0) if_block0.d(detaching); 6282 detach(if_block0_anchor); 6283 if (if_block1) if_block1.d(detaching); 6284 detach(if_block1_anchor); 6285 if (if_block2) if_block2.d(); 6286 if (if_block3) if_block3.d(); 6287 if (if_block4) if_block4.d(detaching); 6288 if (if_block5) if_block5.d(detaching); 6289 } 6290 }; 6291} 6292 6293const MESSAGE_QUOTE_RE = /^'([^]+)'$/; 6294const SHOW_DUPLICATE_MESSAGE_ON_ETA = 15; 6295const SHOW_MOBILE_QUEUE_WARNING_ON_ETA = 10; 6296 6297function is_dep(id, type, deps) { 6298 for (const dep of deps) { 6299 for (const dep_item of dep[type]) { 6300 if (dep_item === id) return true; 6301 } 6302 } 6303 6304 return false; 6305} 6306 6307function has_no_default_value(value) { 6308 return Array.isArray(value) && value.length === 0 || value === "" || value === 0 || !value; 6309} 6310 6311function get_data(comp) { 6312 if (comp.instance.get_value) { 6313 return comp.instance.get_value(); 6314 } 6315 6316 return comp.props.value; 6317} 6318 6319function isCustomEvent(event) { 6320 return "detail" in event; 6321} 6322 6323function instance($$self, $$props, $$invalidate) { 6324 let $loading_status, 6325 $$unsubscribe_loading_status = noop,
6326 $$subscribe_loading_status = () => ($$unsubscribe_loading_status(), $$unsubscribe_loading_status = subscribe(loading_status, $$value => $$invalidate(31, $loading_status = $$value)), loading_status); 6327 6328 let $_; 6329 component_subscribe($$self, $format, $$value => $$invalidate(20, $_ = $$value)); 6330 $$self.$$.on_destroy.push(() => $$unsubscribe_loading_status()); 6331 setupi18n(); 6332 let { root } = $$props; 6333 let { components } = $$props; 6334 let { layout } = $$props; 6335 let { dependencies } = $$props; 6336 let { title = "Gradio" } = $$props; 6337 let { analytics_enabled = false } = $$props; 6338 let { target } = $$props; 6339 let { autoscroll } = $$props; 6340 let { show_api = true } = $$props; 6341 let { show_footer = true } = $$props; 6342 let { control_page_title = false } = $$props; 6343 let { app_mode } = $$props; 6344 let { theme_mode } = $$props; 6345 let { app } = $$props; 6346 let { space_id } = $$props; 6347 let { version } = $$props; 6348 let { api_url } = $$props; 6349 let { js } = $$props; 6350 let loading_status = create_loading_status_store(); 6351 $$subscribe_loading_status(); 6352 6353 let rootNode = { 6354 id: layout.id, 6355 type: "column", 6356 props: { interactive: false }, 6357 has_modes: false, 6358 instance: null, 6359 component: null, 6360 component_class_id: "" 6361 }; 6362 6363 const AsyncFunction = Object.getPrototypeOf(async function () { 6364 6365 }).constructor; 6366 6367 dependencies.forEach(d => { 6368 if (d.js) { 6369 const wrap = d.backend_fn 6370 ? d.inputs.length === 1 6371 : d.outputs.length === 1; 6372 6373 try { 6374 d.frontend_fn = new AsyncFunction("__fn_args", 6375 `let result = await (${d.js})(...__fn_args); 6376 return (${wrap} && !Array.isArray(result)) ? [result] : result;`); 6377 } catch(e) { 6378 console.error("Could not parse custom js method."); 6379 console.error(e); 6380 } 6381 } 6382 }); 6383 6384 let params = new URLSearchParams(window.location.search); 6385 let api_docs_visible = params.get("view") === "api" && show_api; 6386 6387 function set_api_docs_visible(visible) { 6388 $$invalidate(16, api_docs_visible = visible); 6389 let params = new URLSearchParams(window.location.search); 6390 6391 if (visible) { 6392 params.set("view", "api"); 6393 } else { 6394 params.delete("view"); 6395 } 6396 6397 history.replaceState(null, "", "?" + params.toString()); 6398 } 6399 6400 let dynamic_ids = new Set(); 6401 let instance_map; 6402 6403 async function walk_layout(node, type_map, instance_map, component_map) { 6404 $$invalidate(0, ready = false); 6405 let instance = instance_map[node.id]; 6406 const _component = (await component_map.get(`${instance.type}_${type_map.get(node.id) || "false"}`)).component; 6407 instance.component = _component.default; 6408 6409 if (node.children) { 6410 instance.children = node.children.map(v => instance_map[v.id]); 6411 await Promise.all(node.children.map(v => walk_layout(v, type_map, instance_map, component_map))); 6412 } 6413 } 6414 6415 let { ready = false } = $$props; 6416 let { render_complete = false } = $$props; 6417 let target_map = {}; 6418 6419 function prepare_components() { 6420 target_map = dependencies.reduce( 6421 (acc, dep, i) => { 6422 dep.targets.forEach(([id, trigger]) => { 6423 if (!acc[id]) { 6424 acc[id] = {}; 6425 } 6426 6427 if (acc[id]?.[trigger]) { 6428 acc[id][trigger].push(i); 6429 } else { 6430 acc[id][trigger] = [i]; 6431 } 6432 }); 6433 6434 return acc; 6435 }, 6436 {} 6437 ); 6438 6439 $$subscribe_loading_status($$invalidate(14, loading_status = create_loading_status_store())); 6440 6441 dependencies.forEach((v, i) => { 6442 loading_status.register(i, v.inputs, v.outputs); 6443 }); 6444 6445 const _dynamic_ids = new Set(); 6446 6447 for (const comp of components) { 6448 const { id, props } = comp; 6449 const is_input = is_dep(id, "inputs", dependencies); 6450 6451 if (is_input || !is_dep(id, "outputs", dependencies) && has_no_default_value(props?.value)) { 6452 _dynamic_ids.add(id); 6453 } 6454 } 6455 6456 $$invalidate(17, dynamic_ids = _dynamic_ids); 6457 6458 const _rootNode = { 6459 id: layout.id, 6460 type: "column", 6461 props: { interactive: false }, 6462 has_modes: false, 6463 instance: null, 6464 component: null, 6465 component_class_id: "" 6466 }; 6467 6468 components.push(_rootNode); 6469 const _component_set = new Set(); 6470 const __component_map = new Map(); 6471 const __type_for_id = new Map(); 6472 6473 const _instance_map = components.reduce( 6474 (acc, next) => { 6475 acc[next.id] = next; 6476 return acc; 6477 }, 6478 {} 6479 ); 6480
6481 components.forEach(c => { 6482 if (c.props.interactive === false) { 6483 c.props.interactive = false; 6484 } else if (c.props.interactive === true) { 6485 c.props.interactive = true; 6486 } else if (dynamic_ids.has(c.id)) { 6487 c.props.interactive = true; 6488 } else { 6489 c.props.interactive = false; 6490 } 6491 6492 if (c.props.server_fns) { 6493 let server = {}; 6494 6495 c.props.server_fns.forEach(fn => { 6496 server[fn] = async (...args) => { 6497 if (args.length === 1) { 6498 args = args[0]; 6499 } 6500 6501 const result = await app.component_server(c.id, fn, args); 6502 return result; 6503 }; 6504 }); 6505 6506 c.props.server = server; 6507 } 6508 6509 if (target_map[c.id]) { 6510 c.props.attached_events = Object.keys(target_map[c.id]); 6511 } 6512 6513 __type_for_id.set(c.id, c.props.interactive); 6514 6515 if (c.type === "dataset") { 6516 const example_component_map = new Map(); 6517 6518 c.props.components.forEach(name => { 6519 if (example_component_map.has(name)) { 6520 return; 6521 } 6522 6523 let _c; 6524 const matching_component = components.find(c => c.type === name); 6525 6526 if (matching_component) { 6527 _c = load_component({ 6528 api_url, 6529 name, 6530 id: matching_component.component_class_id, 6531 variant: "example" 6532 }); 6533 6534 example_component_map.set(name, _c); 6535 } 6536 }); 6537 6538 c.props.component_map = example_component_map; 6539 } 6540 6541 // maybe load custom 6542 const _c = load_component({ 6543 api_url, 6544 name: c.type, 6545 id: c.component_class_id, 6546 variant: "component" 6547 }); 6548 6549 _component_set.add(_c); 6550 __component_map.set(`${c.type}_${c.props.interactive}`, _c); 6551 }); 6552 6553 Promise.all(Array.from(_component_set)).then(() => { 6554 walk_layout(layout, __type_for_id, _instance_map, __component_map).then(async () => { 6555 $$invalidate(0, ready = true); 6556 $$invalidate(18, instance_map = _instance_map); 6557 $$invalidate(15, rootNode = _rootNode); 6558 }).catch(e => { 6559 console.error(e); 6560 }); 6561 }); 6562 } 6563 6564 async function handle_update(data, fn_index, outputs_set_to_non_interactive) { 6565 const outputs = dependencies[fn_index].outputs; 6566 6567 data?.forEach((value, i) => { 6568 const output = instance_map[outputs[i]]; 6569 output.props.value_is_output = true; 6570 }); 6571 6572 $$invalidate(15, rootNode); 6573 await tick(); 6574 6575 data?.forEach((value, i) => { 6576 const output = instance_map[outputs[i]]; 6577 6578 if (typeof value === "object" && value !== null && value.__type__ === "update") { 6579 for (const [update_key, update_value] of Object.entries(value)) { 6580 if (update_key === "__type__") { 6581 continue; 6582 } else { 6583 output.props[update_key] = update_value; 6584 6585 if (update_key == "interactive" && !update_value) { 6586 outputs_set_to_non_interactive.push(outputs[i]); 6587 } 6588 } 6589 } 6590 } else { 6591 output.props.value = value; 6592 } 6593 }); 6594 6595 $$invalidate(15, rootNode); 6596 } 6597 6598 let submit_map = new Map(); 6599 6600 function set_prop(obj, prop, val) { 6601 if (!obj?.props) { 6602 // @ts-ignore 6603 obj.props = {}; 6604 } 6605 6606 obj.props[prop] = val; 6607 $$invalidate(15, rootNode); 6608 } 6609 6610 let handled_dependencies = []; 6611 let messages = []; 6612 6613 function new_message(message, fn_index, type) { 6614 return { message, fn_index, type, id: ++_error_id }; 6615 } 6616 6617 let _error_id = -1; 6618 let user_left_page = false; 6619 6620 document.addEventListener("visibilitychange", function () { 6621 if (document.visibilityState === "hidden") { 6622 user_left_page = true; 6623 } 6624 }); 6625 6626 const DUPLICATE_MESSAGE = $_("blocks.long_requests_queue"); 6627 const MOBILE_QUEUE_WARNING = $_("blocks.connection_can_break"); 6628 const MOBILE_RECONNECT_MESSAGE = $_("blocks.lost_connection"); 6629 const is_mobile_device = (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i).test(navigator.userAgent); 6630 let showed_duplicate_message = false; 6631 let showed_mobile_warning = false; 6632 6633 async function trigger_api_call(dep_index, trigger_id = null, event_data = null) { 6634 let dep = dependencies[dep_index]; 6635 const current_status = loading_status.get_status_for_fn(dep_index); 6636 $$invalidate(19, messages = messages.filter(({ fn_index }) => fn_index !== dep_index)); 6637 6638 if (dep.cancels) { 6639 await Promise.all(dep.cancels.map(async fn_index => { 6640 const submission = submit_map.get(fn_index); 6641 submission?.cancel(); 6642 return submission; 6643 })); 6644 } 6645 6646 if (current_status === "pending" || current_status === "generating") { 6647 dep.pending_request = true; 6648 } 6649 6650 let payload = { 6651 fn_index: dep_index, 6652 data: await Promise.all(dep.inputs.map(id => get_data(instance_map[id]))), 6653 event_data: dep.collects_event_data ? event_data : null, 6654 trigger_id 6655 }; 6656 6657 if (dep.frontend_fn) { 6658 dep.frontend_fn(payload.data.concat(await Promise.all(dep.inputs.map(id => get_data(instance_map[id]))))).then(v => { 6659 if (dep.backend_fn) { 6660 payload.data = v; 6661 make_prediction(payload); 6662 } else { 6663 handle_update(v, dep_index, []); 6664 } 6665 }); 6666 } else { 6667 if (dep.backend_fn) { 6668 if (dep.trigger_mode === "once") { 6669 if (!dep.pending_request) make_prediction(payload); 6670 } else if (dep.trigger_mode === "multiple") { 6671 make_prediction(payload); 6672 } else if (dep.trigger_mode === "always_last") { 6673 if (!dep.pending_request) { 6674 make_prediction(payload); 6675 } else { 6676 dep.final_event = payload; 6677 } 6678 } 6679 } 6680 } 6681 6682 function make_prediction(payload) { 6683 const pending_outputs = []; 6684 let outputs_set_to_non_interactive = []; 6685 6686 const submission = app.submit(payload.fn_index, payload.data, payload.event_data, payload.trigger_id).on("data", ({ data, fn_index }) => { 6687 if (dep.pending_request && dep.final_event) { 6688 dep.pending_request = false;
6689 make_prediction(dep.final_event); 6690 } 6691 6692 dep.pending_request = false; 6693 handle_update(data, fn_index, outputs_set_to_non_interactive); 6694 }).on("status", ({ fn_index, ...status }) => { 6695 tick().then(() => { 6696 const outputs = dependencies[fn_index].outputs; 6697 6698 outputs.forEach(id => { 6699 if (instance_map[id].props.interactive && status.stage === "pending" && dep.targets[0][1] !== "focus") { 6700 pending_outputs.push(id); 6701 $$invalidate(18, instance_map[id].props.interactive = false, instance_map); 6702 } else if (status.stage === "complete" && pending_outputs.includes(id) && !outputs_set_to_non_interactive.includes(id)) { 6703 $$invalidate(18, instance_map[id].props.interactive = true, instance_map); 6704 } 6705 }); 6706 6707 //@ts-ignore 6708 loading_status.update({ 6709 ...status, 6710 status: status.stage, 6711 progress: status.progress_data, 6712 fn_index 6713 }); 6714 6715 if (!showed_duplicate_message && space_id !== null && status.position !== undefined && status.position >= 2 && status.eta !== undefined && status.eta > SHOW_DUPLICATE_MESSAGE_ON_ETA) { 6716 showed_duplicate_message = true; 6717 $$invalidate(19, messages = [new_message(DUPLICATE_MESSAGE, fn_index, "warning"), ...messages]); 6718 } 6719 6720 if (!showed_mobile_warning && is_mobile_device && status.eta !== undefined && status.eta > SHOW_MOBILE_QUEUE_WARNING_ON_ETA) { 6721 showed_mobile_warning = true; 6722 $$invalidate(19, messages = [new_message(MOBILE_QUEUE_WARNING, fn_index, "warning"), ...messages]); 6723 } 6724 6725 if (status.stage === "complete") { 6726 dependencies.map(async (dep, i) => { 6727 if (dep.trigger_after === fn_index) { 6728 trigger_api_call(i, payload.trigger_id); 6729 } 6730 }); 6731 6732 submission.destroy(); 6733 } 6734 6735 if (status.broken && is_mobile_device && user_left_page) { 6736 window.setTimeout( 6737 () => { 6738 $$invalidate(19, messages = [ 6739 new_message(MOBILE_RECONNECT_MESSAGE, fn_index, "error"), 6740 ...messages 6741 ]); 6742 }, 6743 0 6744 ); 6745 6746 trigger_api_call(dep_index, payload.trigger_id, event_data); 6747 user_left_page = false; 6748 } else if (status.stage === "error") { 6749 if (status.message) { 6750 const _message = status.message.replace(MESSAGE_QUOTE_RE, (_, b) => b); 6751 $$invalidate(19, messages = [new_message(_message, fn_index, "error"), ...messages]); 6752 } 6753 6754 dependencies.map(async (dep, i) => { 6755 if (dep.trigger_after === fn_index && !dep.trigger_only_on_success) { 6756 trigger_api_call(i, payload.trigger_id); 6757 } 6758 }); 6759 6760 submission.destroy(); 6761 } 6762 }); 6763 }).on("log", ({ log, fn_index, level }) => { 6764 $$invalidate(19, messages = [new_message(log, fn_index, level), ...messages]); 6765 }); 6766 6767 submit_map.set(dep_index, submission); 6768 } 6769 } 6770 6771 function trigger_share(title, description) { 6772 if (space_id === null) { 6773 return; 6774 } 6775 6776 const discussion_url = new URL(`https://huggingface.co/spaces/${space_id}/discussions/new`); 6777 6778 if (title !== undefined && title.length > 0) { 6779 discussion_url.searchParams.set("title", title); 6780 } 6781 6782 discussion_url.searchParams.set("description", description); 6783 window.open(discussion_url.toString(), "_blank"); 6784 } 6785 6786 function handle_error_close(e) { 6787 const _id = e.detail; 6788 $$invalidate(19, messages = messages.filter(m => m.id !== _id)); 6789 } 6790 6791 const is_external_url = link => !!(link && new URL(link, location.href).origin !== location.origin); 6792 6793 async function handle_mount() { 6794 if (js) { 6795 let blocks_frontend_fn = new AsyncFunction(`let result = await (${js})(); 6796 return (!Array.isArray(result)) ? [result] : result;`); 6797 6798 blocks_frontend_fn(); 6799 } 6800 6801 await tick(); 6802 var a = target.getElementsByTagName("a"); 6803 6804 for (var i = 0; i < a.length; i++) { 6805 const _target = a[i].getAttribute("target"); 6806 const _link = a[i].getAttribute("href"); 6807 6808 // only target anchor tags with external links 6809 if (is_external_url(_link) && _target !== "_blank") a[i].setAttribute("target", "_blank"); 6810 } 6811 6812 // handle load triggers 6813 dependencies.forEach((dep, i) => { 6814 if (dep.targets[0][1] === "load") { 6815 trigger_api_call(i); 6816 } 6817 }); 6818 6819 target.addEventListener("gradio", e => { 6820 if (!isCustomEvent(e)) throw new Error("not a custom event"); 6821 const { id, event, data } = e.detail; 6822 6823 if (event === "share") { 6824 const { title, description } = data; 6825 trigger_share(title, description); 6826 } else if (event === "error" || event === "warning") {
6827 $$invalidate(19, messages = [new_message(data, -1, event), ...messages]); 6828 } else { 6829 const deps = target_map[id]?.[event]; 6830 6831 deps?.forEach(dep_id => { 6832 trigger_api_call(dep_id, id, data); 6833 }); 6834 } 6835 }); 6836 6837 $$invalidate(25, render_complete = true); 6838 } 6839 6840 function handle_destroy(id) { 6841 handled_dependencies = handled_dependencies.map(dep => { 6842 return dep.filter(_id => _id !== id); 6843 }); 6844 } 6845 6846 function set_status(statuses) { 6847 for (const id in statuses) { 6848 let loading_status = statuses[id]; 6849 let dependency = dependencies[loading_status.fn_index]; 6850 loading_status.scroll_to_output = dependency.scroll_to_output; 6851 loading_status.show_progress = dependency.show_progress; 6852 set_prop(instance_map[id], "loading_status", loading_status); 6853 } 6854 6855 const inputs_to_update = loading_status.get_inputs_to_update(); 6856 6857 for (const [id, pending_status] of inputs_to_update) { 6858 set_prop(instance_map[id], "pending", pending_status === "pending"); 6859 } 6860 } 6861 6862 const destroy_handler = ({ detail }) => handle_destroy(detail); 6863 6864 const click_handler = () => { 6865 set_api_docs_visible(!api_docs_visible); 6866 }; 6867 6868 const click_handler_1 = () => { 6869 set_api_docs_visible(false); 6870 }; 6871 6872 const close_handler = () => { 6873 set_api_docs_visible(false); 6874 }; 6875 6876 $$self.$$set = $$props => {
6877 if ('root' in $$props) $$invalidate(1, root = $$props.root); 6878 if ('components' in $$props) $$invalidate(26, components = $$props.components); 6879 if ('layout' in $$props) $$invalidate(27, layout = $$props.layout); 6880 if ('dependencies' in $$props) $$invalidate(2, dependencies = $$props.dependencies); 6881 if ('title' in $$props) $$invalidate(3, title = $$props.title); 6882 if ('analytics_enabled' in $$props) $$invalidate(4, analytics_enabled = $$props.analytics_enabled); 6883 if ('target' in $$props) $$invalidate(5, target = $$props.target); 6884 if ('autoscroll' in $$props) $$invalidate(6, autoscroll = $$props.autoscroll); 6885 if ('show_api' in $$props) $$invalidate(7, show_api = $$props.show_api); 6886 if ('show_footer' in $$props) $$invalidate(8, show_footer = $$props.show_footer); 6887 if ('control_page_title' in $$props) $$invalidate(9, control_page_title = $$props.control_page_title); 6888 if ('app_mode' in $$props) $$invalidate(10, app_mode = $$props.app_mode); 6889 if ('theme_mode' in $$props) $$invalidate(11, theme_mode = $$props.theme_mode);
6890 if ('app' in $$props) $$invalidate(12, app = $$props.app); 6891 if ('space_id' in $$props) $$invalidate(28, space_id = $$props.space_id); 6892 if ('version' in $$props) $$invalidate(13, version = $$props.version); 6893 if ('api_url' in $$props) $$invalidate(29, api_url = $$props.api_url); 6894 if ('js' in $$props) $$invalidate(30, js = $$props.js); 6895 if ('ready' in $$props) $$invalidate(0, ready = $$props.ready); 6896 if ('render_complete' in $$props) $$invalidate(25, render_complete = $$props.render_complete); 6897 }; 6898 6899 $$self.$$.update = () => { 6900 if ($$self.$$.dirty[0] & /*components, layout*/ 201326592) { 6901 (prepare_components()); 6902 } 6903 6904 if ($$self.$$.dirty[1] & /*$loading_status*/ 1) { 6905 set_status($loading_status); 6906 } 6907 }; 6908 6909 return [ 6910 ready, 6911 root, 6912 dependencies, 6913 title, 6914 analytics_enabled, 6915 target, 6916 autoscroll, 6917 show_api, 6918 show_footer, 6919 control_page_title, 6920 app_mode, 6921 theme_mode, 6922 app, 6923 version, 6924 loading_status, 6925 rootNode, 6926 api_docs_visible, 6927 dynamic_ids, 6928 instance_map, 6929 messages, 6930 $_, 6931 set_api_docs_visible, 6932 handle_error_close, 6933 handle_mount, 6934 handle_destroy, 6935 render_complete, 6936 components, 6937 layout, 6938 space_id, 6939 api_url, 6940 js, 6941 $loading_status, 6942 destroy_handler, 6943 click_handler, 6944 click_handler_1, 6945 close_handler 6946 ]; 6947} 6948 6949class Blocks extends SvelteComponent { 6950 constructor(options) { 6951 super(); 6952 6953 init( 6954 this, 6955 options, 6956 instance, 6957 create_fragment, 6958 safe_not_equal, 6959 { 6960 root: 1, 6961 components: 26, 6962 layout: 27, 6963 dependencies: 2, 6964 title: 3, 6965 analytics_enabled: 4, 6966 target: 5, 6967 autoscroll: 6, 6968 show_api: 7, 6969 show_footer: 8, 6970 control_page_title: 9, 6971 app_mode: 10, 6972 theme_mode: 11, 6973 app: 12, 6974 space_id: 28, 6975 version: 13, 6976 api_url: 29, 6977 js: 30, 6978 ready: 0, 6979 render_complete: 25 6980 }, 6981 null, 6982 [-1, -1] 6983 ); 6984 } 6985} 6986 6987const Blocks$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 6988 __proto__: null, 6989 default: Blocks 6990}, Symbol.toStringTag, { value: 'Module' })); 6991 6992export { Blocks$1 as B, Toast as T }; 6993//# sourceMappingURL=Blocks-e1d87929.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.