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