1import { I as ImageUploader, S as StaticImage } from './ImageUploader-794965b4.js'; 2export { W as Webcam } from './ImageUploader-794965b4.js'; 3import { B as Block } from './Button-515ad287.js'; 4import { E as Empty } from './Empty-b82e3792.js'; 5import { S as Static } from './Index-a19f568c.js'; 6import { I as Image } from './Image-6cbf81d1.js'; 7import { U as UploadText } from './UploadText-5118a6cd.js'; 8export { I as BaseImage } from './Image-f2cd351b.js'; 9export { default as BaseExample } from './Example-6974dad0.js'; 10import './utils-013c0d40.js'; 11import './BlockLabel-59adcbbb.js'; 12import './IconButton-8c191862.js'; 13import './ShareButton-4a821dc3.js'; 14import './DownloadLink-f05b00bb.js'; 15import './file-url-8dc1c09f.js'; 16import './index-7905665e.js'; 17import './svelte/svelte.js'; 18import './SelectSource-7173a592.js'; 19import './Upload-96564545.js'; 20import './DropdownArrow-79cdb392.js'; 21import './ModifyUpload.svelte_svelte_type_style_lang-9c565bcf.js'; 22/* empty css */ 23/* home/runner/work/gradio/gradio/js/image/Index.svelte generated by Svelte v4.2.2 */ 24const { 25 SvelteComponent, 26 add_flush_callback, 27 assign, 28 bind, 29 binding_callbacks, 30 check_outros, 31 create_component, 32 destroy_component, 33 detach, 34 empty, 35 flush, 36 get_spread_object, 37 get_spread_update, 38 group_outros, 39 init, 40 insert, 41 mount_component, 42 safe_not_equal, 43 space, 44 transition_in, 45 transition_out 46} = window.__gradio__svelte__internal; 47function create_else_block(ctx) { 48 let block; 49 let current; 50 51 block = new Block({ 52 props: { 53 visible: /*visible*/ ctx[4], 54 variant: /*value*/ ctx[0] === null ? "dashed" : "solid", 55 border_mode: /*dragging*/ ctx[22] ? "focus" : "base", 56 padding: false, 57 elem_id: /*elem_id*/ ctx[2], 58 elem_classes: /*elem_classes*/ ctx[3], 59 height: /*height*/ ctx[9] || undefined, 60 width: /*width*/ ctx[10], 61 allow_overflow: false, 62 container: /*container*/ ctx[12], 63 scale: /*scale*/ ctx[13], 64 min_width: /*min_width*/ ctx[14], 65 $$slots: { default: [create_default_slot_1] }, 66 $$scope: { ctx } 67 } 68 }); 69 70 return { 71 c() { 72 create_component(block.$$.fragment); 73 }, 74 m(target, anchor) { 75 mount_component(block, target, anchor); 76 current = true; 77 }, 78 p(ctx, dirty) { 79 const block_changes = {}; 80 if (dirty[0] & /*visible*/ 16) block_changes.visible = /*visible*/ ctx[4]; 81 if (dirty[0] & /*value*/ 1) block_changes.variant = /*value*/ ctx[0] === null ? "dashed" : "solid"; 82 if (dirty[0] & /*dragging*/ 4194304) block_changes.border_mode = /*dragging*/ ctx[22] ? "focus" : "base"; 83 if (dirty[0] & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2]; 84 if (dirty[0] & /*elem_classes*/ 8) block_changes.elem_classes = /*elem_classes*/ ctx[3]; 85 if (dirty[0] & /*height*/ 512) block_changes.height = /*height*/ ctx[9] || undefined; 86 if (dirty[0] & /*width*/ 1024) block_changes.width = /*width*/ ctx[10]; 87 if (dirty[0] & /*container*/ 4096) block_changes.container = /*container*/ ctx[12]; 88 if (dirty[0] & /*scale*/ 8192) block_changes.scale = /*scale*/ ctx[13]; 89 if (dirty[0] & /*min_width*/ 16384) block_changes.min_width = /*min_width*/ ctx[14]; 90 91 if (dirty[0] & /*_selectable, root, sources, label, show_label, pending, streaming, mirror_webcam, gradio, active_source, value, dragging, loading_status*/ 16583011 | dirty[1] & /*$$scope*/ 128) { 92 block_changes.$$scope = { dirty, ctx }; 93 } 94 95 block.$set(block_changes); 96 }, 97 i(local) { 98 if (current) return; 99 transition_in(block.$$.fragment, local); 100 current = true; 101 }, 102 o(local) { 103 transition_out(block.$$.fragment, local); 104 current = false; 105 }, 106 d(detaching) { 107 destroy_component(block, detaching); 108 } 109 }; 110} 111 112// (52:0) {#if !interactive} 113function create_if_block(ctx) { 114 let block; 115 let current; 116 117 block = new Block({ 118 props: { 119 visible: /*visible*/ ctx[4], 120 variant: "solid", 121 border_mode: /*dragging*/ ctx[22] ? "focus" : "base", 122 padding: false, 123 elem_id: /*elem_id*/ ctx[2], 124 elem_classes: /*elem_classes*/ ctx[3], 125 height: /*height*/ ctx[9] || undefined, 126 width: /*width*/ ctx[10], 127 allow_overflow: false, 128 container: /*container*/ ctx[12], 129 scale: /*scale*/ ctx[13], 130 min_width: /*min_width*/ ctx[14], 131 $$slots: { default: [create_default_slot] }, 132 $$scope: { ctx } 133 } 134 }); 135 136 return { 137 c() { 138 create_component(block.$$.fragment); 139 }, 140 m(target, anchor) { 141 mount_component(block, target, anchor); 142 current = true; 143 }, 144 p(ctx, dirty) { 145 const block_changes = {};
146 if (dirty[0] & /*visible*/ 16) block_changes.visible = /*visible*/ ctx[4]; 147 if (dirty[0] & /*dragging*/ 4194304) block_changes.border_mode = /*dragging*/ ctx[22] ? "focus" : "base"; 148 if (dirty[0] & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2]; 149 if (dirty[0] & /*elem_classes*/ 8) block_changes.elem_classes = /*elem_classes*/ ctx[3]; 150 if (dirty[0] & /*height*/ 512) block_changes.height = /*height*/ ctx[9] || undefined; 151 if (dirty[0] & /*width*/ 1024) block_changes.width = /*width*/ ctx[10]; 152 if (dirty[0] & /*container*/ 4096) block_changes.container = /*container*/ ctx[12]; 153 if (dirty[0] & /*scale*/ 8192) block_changes.scale = /*scale*/ ctx[13]; 154 if (dirty[0] & /*min_width*/ 16384) block_changes.min_width = /*min_width*/ ctx[14]; 155 156 if (dirty[0] & /*value, label, show_label, show_download_button, _selectable, show_share_button, gradio, loading_status*/ 2132195 | dirty[1] & /*$$scope*/ 128) { 157 block_changes.$$scope = { dirty, ctx }; 158 } 159 160 block.$set(block_changes); 161 }, 162 i(local) { 163 if (current) return; 164 transition_in(block.$$.fragment, local); 165 current = true; 166 }, 167 o(local) { 168 transition_out(block.$$.fragment, local); 169 current = false; 170 }, 171 d(detaching) { 172 destroy_component(block, detaching); 173 } 174 }; 175} 176 177// (137:3) {:else} 178function create_else_block_1(ctx) { 179 let empty_1; 180 let current; 181 182 empty_1 = new Empty({ 183 props: { 184 unpadded_box: true, 185 size: "large", 186 $$slots: { default: [create_default_slot_3] }, 187 $$scope: { ctx } 188 } 189 }); 190 191 return { 192 c() { 193 create_component(empty_1.$$.fragment); 194 }, 195 m(target, anchor) { 196 mount_component(empty_1, target, anchor); 197 current = true; 198 }, 199 p(ctx, dirty) { 200 const empty_1_changes = {}; 201 202 if (dirty[1] & /*$$scope*/ 128) { 203 empty_1_changes.$$scope = { dirty, ctx }; 204 } 205 206 empty_1.$set(empty_1_changes); 207 }, 208 i(local) { 209 if (current) return; 210 transition_in(empty_1.$$.fragment, local); 211 current = true; 212 }, 213 o(local) { 214 transition_out(empty_1.$$.fragment, local); 215 current = false; 216 }, 217 d(detaching) { 218 destroy_component(empty_1, detaching); 219 } 220 }; 221} 222 223// (135:43) 224function create_if_block_2(ctx) { 225 let uploadtext; 226 let current; 227 228 uploadtext = new UploadText({ 229 props: { 230 i18n: /*gradio*/ ctx[21].i18n, 231 type: "clipboard", 232 mode: "short" 233 } 234 }); 235 236 return { 237 c() { 238 create_component(uploadtext.$$.fragment); 239 }, 240 m(target, anchor) { 241 mount_component(uploadtext, target, anchor); 242 current = true; 243 }, 244 p(ctx, dirty) { 245 const uploadtext_changes = {}; 246 if (dirty[0] & /*gradio*/ 2097152) uploadtext_changes.i18n = /*gradio*/ ctx[21].i18n; 247 uploadtext.$set(uploadtext_changes); 248 }, 249 i(local) { 250 if (current) return; 251 transition_in(uploadtext.$$.fragment, local); 252 current = true; 253 }, 254 o(local) { 255 transition_out(uploadtext.$$.fragment, local); 256 current = false; 257 }, 258 d(detaching) { 259 destroy_component(uploadtext, detaching); 260 } 261 }; 262} 263 264// (133:3) {#if active_source === "upload" || !active_source} 265function create_if_block_1(ctx) { 266 let uploadtext; 267 let current; 268 269 uploadtext = new UploadText({ 270 props: { 271 i18n: /*gradio*/ ctx[21].i18n, 272 type: "image" 273 } 274 }); 275 276 return { 277 c() { 278 create_component(uploadtext.$$.fragment); 279 }, 280 m(target, anchor) { 281 mount_component(uploadtext, target, anchor); 282 current = true; 283 }, 284 p(ctx, dirty) { 285 const uploadtext_changes = {}; 286 if (dirty[0] & /*gradio*/ 2097152) uploadtext_changes.i18n = /*gradio*/ ctx[21].i18n; 287 uploadtext.$set(uploadtext_changes); 288 }, 289 i(local) { 290 if (current) return; 291 transition_in(uploadtext.$$.fragment, local); 292 current = true; 293 }, 294 o(local) { 295 transition_out(uploadtext.$$.fragment, local); 296 current = false; 297 }, 298 d(detaching) { 299 destroy_component(uploadtext, detaching); 300 } 301 }; 302} 303 304// (138:4) <Empty unpadded_box={true} size="large"> 305function create_default_slot_3(ctx) { 306 let image; 307 let current; 308 image = new Image({}); 309 310 return { 311 c() { 312 create_component(image.$$.fragment); 313 }, 314 m(target, anchor) { 315 mount_component(image, target, anchor); 316 current = true; 317 }, 318 i(local) { 319 if (current) return; 320 transition_in(image.$$.fragment, local); 321 current = true; 322 }, 323 o(local) { 324 transition_out(image.$$.fragment, local); 325 current = false;
326 }, 327 d(detaching) { 328 destroy_component(image, detaching); 329 } 330 }; 331} 332 333// (106:2) <ImageUploader bind:active_source bind:value selectable={_selectable} {root} {sources} on:edit={() => gradio.dispatch("edit")} on:clear={() => { gradio.dispatch("clear"); }} on:stream={() => gradio.dispatch("stream")} on:drag={({ detail }) => (dragging = detail)} on:upload={() => gradio.dispatch("upload")} on:select={({ detail }) => gradio.dispatch("select", detail)} on:share={({ detail }) => gradio.dispatch("share", detail)} on:error={({ detail }) => { loading_status = loading_status || {}; loading_status.status = "error"; gradio.dispatch("error", detail); }} {label} {show_label} {pending} {streaming} {mirror_webcam} i18n={gradio.i18n} > 334function create_default_slot_2(ctx) { 335 let current_block_type_index; 336 let if_block; 337 let if_block_anchor; 338 let current; 339 const if_block_creators = [create_if_block_1, create_if_block_2, create_else_block_1]; 340 const if_blocks = []; 341 342 function select_block_type_1(ctx, dirty) { 343 if (/*active_source*/ ctx[23] === "upload" || !/*active_source*/ ctx[23]) return 0; 344 if (/*active_source*/ ctx[23] === "clipboard") return 1; 345 return 2; 346 } 347 348 current_block_type_index = select_block_type_1(ctx); 349 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 350 351 return { 352 c() { 353 if_block.c(); 354 if_block_anchor = empty(); 355 }, 356 m(target, anchor) { 357 if_blocks[current_block_type_index].m(target, anchor); 358 insert(target, if_block_anchor, anchor); 359 current = true; 360 }, 361 p(ctx, dirty) { 362 let previous_block_index = current_block_type_index; 363 current_block_type_index = select_block_type_1(ctx); 364 365 if (current_block_type_index === previous_block_index) { 366 if_blocks[current_block_type_index].p(ctx, dirty); 367 } else { 368 group_outros(); 369 370 transition_out(if_blocks[previous_block_index], 1, 1, () => { 371 if_blocks[previous_block_index] = null; 372 }); 373 374 check_outros(); 375 if_block = if_blocks[current_block_type_index]; 376 377 if (!if_block) { 378 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 379 if_block.c(); 380 } else { 381 if_block.p(ctx, dirty); 382 } 383 384 transition_in(if_block, 1); 385 if_block.m(if_block_anchor.parentNode, if_block_anchor); 386 } 387 }, 388 i(local) { 389 if (current) return; 390 transition_in(if_block); 391 current = true; 392 }, 393 o(local) { 394 transition_out(if_block); 395 current = false; 396 }, 397 d(detaching) { 398 if (detaching) { 399 detach(if_block_anchor); 400 } 401 402 if_blocks[current_block_type_index].d(detaching); 403 } 404 }; 405} 406 407// (86:1) <Block {visible} variant={value === null ? "dashed" : "solid"} border_mode={dragging ? "focus" : "base"} padding={false} {elem_id} {elem_classes} height={height || undefined} {width} allow_overflow={false} {container} {scale} {min_width} > 408function create_default_slot_1(ctx) { 409 let statustracker; 410 let t; 411 let imageuploader; 412 let updating_active_source; 413 let updating_value; 414 let current; 415 416 const statustracker_spread_levels = [ 417 { 418 autoscroll: /*gradio*/ ctx[21].autoscroll 419 }, 420 { i18n: /*gradio*/ ctx[21].i18n }, 421 /*loading_status*/ ctx[1] 422 ]; 423 424 let statustracker_props = {}; 425 426 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 427 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 428 } 429 430 statustracker = new Static({ props: statustracker_props }); 431 432 function imageuploader_active_source_binding(value) { 433 /*imageuploader_active_source_binding*/ ctx[28](value); 434 } 435 436 function imageuploader_value_binding(value) { 437 /*imageuploader_value_binding*/ ctx[29](value); 438 } 439 440 let imageuploader_props = { 441 selectable: /*_selectable*/ ctx[11], 442 root: /*root*/ ctx[8], 443 sources: /*sources*/ ctx[16], 444 label: /*label*/ ctx[5], 445 show_label: /*show_label*/ ctx[6], 446 pending: /*pending*/ ctx[19], 447 streaming: /*streaming*/ ctx[18], 448 mirror_webcam: /*mirror_webcam*/ ctx[20], 449 i18n: /*gradio*/ ctx[21].i18n, 450 $$slots: { default: [create_default_slot_2] }, 451 $$scope: { ctx } 452 }; 453 454 if (/*active_source*/ ctx[23] !== void 0) { 455 imageuploader_props.active_source = /*active_source*/ ctx[23]; 456 } 457 458 if (/*value*/ ctx[0] !== void 0) { 459 imageuploader_props.value = /*value*/ ctx[0]; 460 } 461 462 imageuploader = new ImageUploader({ props: imageuploader_props }); 463 binding_callbacks.push(() => bind(imageuploader, 'active_source', imageuploader_active_source_binding)); 464 binding_callbacks.push(() => bind(imageuploader, 'value', imageuploader_value_binding)); 465 imageuploader.$on("edit", /*edit_handler*/ ctx[30]); 466 imageuploader.$on("clear", /*clear_handler*/ ctx[31]); 467 imageuploader.$on("stream", /*stream_handler*/ ctx[32]); 468 imageuploader.$on("drag", /*drag_handler*/ ctx[33]); 469 imageuploader.$on("upload", /*upload_handler*/ ctx[34]); 470 imageuploader.$on("select", /*select_handler_1*/ ctx[35]); 471 imageuploader.$on("share", /*share_handler_1*/ ctx[36]); 472 imageuploader.$on("error", /*error_handler_1*/ ctx[37]); 473 474 return { 475 c() { 476 create_component(statustracker.$$.fragment); 477 t = space(); 478 create_component(imageuploader.$$.fragment); 479 }, 480 m(target, anchor) { 481 mount_component(statustracker, target, anchor); 482 insert(target, t, anchor);
483 mount_component(imageuploader, target, anchor); 484 current = true; 485 }, 486 p(ctx, dirty) { 487 const statustracker_changes = (dirty[0] & /*gradio, loading_status*/ 2097154) 488 ? get_spread_update(statustracker_spread_levels, [ 489 dirty[0] & /*gradio*/ 2097152 && { 490 autoscroll: /*gradio*/ ctx[21].autoscroll 491 }, 492 dirty[0] & /*gradio*/ 2097152 && { i18n: /*gradio*/ ctx[21].i18n }, 493 dirty[0] & /*loading_status*/ 2 && get_spread_object(/*loading_status*/ ctx[1]) 494 ]) 495 : {}; 496 497 statustracker.$set(statustracker_changes); 498 const imageuploader_changes = {}; 499 if (dirty[0] & /*_selectable*/ 2048) imageuploader_changes.selectable = /*_selectable*/ ctx[11]; 500 if (dirty[0] & /*root*/ 256) imageuploader_changes.root = /*root*/ ctx[8]; 501 if (dirty[0] & /*sources*/ 65536) imageuploader_changes.sources = /*sources*/ ctx[16]; 502 if (dirty[0] & /*label*/ 32) imageuploader_changes.label = /*label*/ ctx[5]; 503 if (dirty[0] & /*show_label*/ 64) imageuploader_changes.show_label = /*show_label*/ ctx[6]; 504 if (dirty[0] & /*pending*/ 524288) imageuploader_changes.pending = /*pending*/ ctx[19]; 505 if (dirty[0] & /*streaming*/ 262144) imageuploader_changes.streaming = /*streaming*/ ctx[18]; 506 if (dirty[0] & /*mirror_webcam*/ 1048576) imageuploader_changes.mirror_webcam = /*mirror_webcam*/ ctx[20]; 507 if (dirty[0] & /*gradio*/ 2097152) imageuploader_changes.i18n = /*gradio*/ ctx[21].i18n; 508 509 if (dirty[0] & /*gradio, active_source*/ 10485760 | dirty[1] & /*$$scope*/ 128) { 510 imageuploader_changes.$$scope = { dirty, ctx }; 511 } 512 513 if (!updating_active_source && dirty[0] & /*active_source*/ 8388608) { 514 updating_active_source = true; 515 imageuploader_changes.active_source = /*active_source*/ ctx[23]; 516 add_flush_callback(() => updating_active_source = false); 517 } 518 519 if (!updating_value && dirty[0] & /*value*/ 1) { 520 updating_value = true; 521 imageuploader_changes.value = /*value*/ ctx[0]; 522 add_flush_callback(() => updating_value = false); 523 } 524 525 imageuploader.$set(imageuploader_changes); 526 }, 527 i(local) { 528 if (current) return; 529 transition_in(statustracker.$$.fragment, local); 530 transition_in(imageuploader.$$.fragment, local); 531 current = true; 532 }, 533 o(local) { 534 transition_out(statustracker.$$.fragment, local); 535 transition_out(imageuploader.$$.fragment, local); 536 current = false; 537 }, 538 d(detaching) { 539 if (detaching) { 540 detach(t); 541 } 542 543 destroy_component(statustracker, detaching); 544 destroy_component(imageuploader, detaching); 545 } 546 }; 547} 548 549// (53:1) <Block {visible} variant={"solid"} border_mode={dragging ? "focus" : "base"} padding={false} {elem_id} {elem_classes} height={height || undefined} {width} allow_overflow={false} {container} {scale} {min_width} > 550function create_default_slot(ctx) { 551 let statustracker; 552 let t; 553 let staticimage; 554 let current; 555 556 const statustracker_spread_levels = [ 557 { 558 autoscroll: /*gradio*/ ctx[21].autoscroll 559 }, 560 { i18n: /*gradio*/ ctx[21].i18n }, 561 /*loading_status*/ ctx[1] 562 ]; 563 564 let statustracker_props = {}; 565 566 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 567 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 568 } 569 570 statustracker = new Static({ props: statustracker_props }); 571 572 staticimage = new StaticImage({ 573 props: { 574 value: /*value*/ ctx[0], 575 label: /*label*/ ctx[5], 576 show_label: /*show_label*/ ctx[6], 577 show_download_button: /*show_download_button*/ ctx[7], 578 selectable: /*_selectable*/ ctx[11], 579 show_share_button: /*show_share_button*/ ctx[15], 580 i18n: /*gradio*/ ctx[21].i18n 581 } 582 }); 583 584 staticimage.$on("select", /*select_handler*/ ctx[25]); 585 staticimage.$on("share", /*share_handler*/ ctx[26]); 586 staticimage.$on("error", /*error_handler*/ ctx[27]); 587 588 return { 589 c() { 590 create_component(statustracker.$$.fragment); 591 t = space(); 592 create_component(staticimage.$$.fragment); 593 }, 594 m(target, anchor) { 595 mount_component(statustracker, target, anchor); 596 insert(target, t, anchor); 597 mount_component(staticimage, target, anchor); 598 current = true; 599 }, 600 p(ctx, dirty) { 601 const statustracker_changes = (dirty[0] & /*gradio, loading_status*/ 2097154) 602 ? get_spread_update(statustracker_spread_levels, [ 603 dirty[0] & /*gradio*/ 2097152 && { 604 autoscroll: /*gradio*/ ctx[21].autoscroll 605 }, 606 dirty[0] & /*gradio*/ 2097152 && { i18n: /*gradio*/ ctx[21].i18n }, 607 dirty[0] & /*loading_status*/ 2 && get_spread_object(/*loading_status*/ ctx[1]) 608 ]) 609 : {}; 610 611 statustracker.$set(statustracker_changes); 612 const staticimage_changes = {};
613 if (dirty[0] & /*value*/ 1) staticimage_changes.value = /*value*/ ctx[0]; 614 if (dirty[0] & /*label*/ 32) staticimage_changes.label = /*label*/ ctx[5]; 615 if (dirty[0] & /*show_label*/ 64) staticimage_changes.show_label = /*show_label*/ ctx[6]; 616 if (dirty[0] & /*show_download_button*/ 128) staticimage_changes.show_download_button = /*show_download_button*/ ctx[7]; 617 if (dirty[0] & /*_selectable*/ 2048) staticimage_changes.selectable = /*_selectable*/ ctx[11]; 618 if (dirty[0] & /*show_share_button*/ 32768) staticimage_changes.show_share_button = /*show_share_button*/ ctx[15]; 619 if (dirty[0] & /*gradio*/ 2097152) staticimage_changes.i18n = /*gradio*/ ctx[21].i18n; 620 staticimage.$set(staticimage_changes); 621 }, 622 i(local) { 623 if (current) return; 624 transition_in(statustracker.$$.fragment, local); 625 transition_in(staticimage.$$.fragment, local); 626 current = true; 627 }, 628 o(local) { 629 transition_out(statustracker.$$.fragment, local); 630 transition_out(staticimage.$$.fragment, local); 631 current = false; 632 }, 633 d(detaching) { 634 if (detaching) { 635 detach(t); 636 } 637 638 destroy_component(statustracker, detaching); 639 destroy_component(staticimage, detaching); 640 } 641 }; 642} 643 644function create_fragment(ctx) { 645 let current_block_type_index; 646 let if_block; 647 let if_block_anchor; 648 let current; 649 const if_block_creators = [create_if_block, create_else_block]; 650 const if_blocks = []; 651 652 function select_block_type(ctx, dirty) { 653 if (!/*interactive*/ ctx[17]) return 0; 654 return 1; 655 } 656 657 current_block_type_index = select_block_type(ctx); 658 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 659 660 return { 661 c() { 662 if_block.c(); 663 if_block_anchor = empty(); 664 }, 665 m(target, anchor) { 666 if_blocks[current_block_type_index].m(target, anchor); 667 insert(target, if_block_anchor, anchor); 668 current = true; 669 }, 670 p(ctx, dirty) { 671 let previous_block_index = current_block_type_index; 672 current_block_type_index = select_block_type(ctx); 673 674 if (current_block_type_index === previous_block_index) { 675 if_blocks[current_block_type_index].p(ctx, dirty); 676 } else { 677 group_outros(); 678 679 transition_out(if_blocks[previous_block_index], 1, 1, () => { 680 if_blocks[previous_block_index] = null; 681 }); 682 683 check_outros(); 684 if_block = if_blocks[current_block_type_index]; 685 686 if (!if_block) { 687 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 688 if_block.c(); 689 } else { 690 if_block.p(ctx, dirty); 691 } 692 693 transition_in(if_block, 1); 694 if_block.m(if_block_anchor.parentNode, if_block_anchor); 695 } 696 }, 697 i(local) { 698 if (current) return; 699 transition_in(if_block); 700 current = true; 701 }, 702 o(local) { 703 transition_out(if_block); 704 current = false; 705 }, 706 d(detaching) { 707 if (detaching) { 708 detach(if_block_anchor); 709 } 710 711 if_blocks[current_block_type_index].d(detaching); 712 } 713 }; 714} 715 716function instance($$self, $$props, $$invalidate) { 717 let { elem_id = "" } = $$props; 718 let { elem_classes = [] } = $$props; 719 let { visible = true } = $$props; 720 let { value = null } = $$props; 721 let old_value = null; 722 let { label } = $$props; 723 let { show_label } = $$props; 724 let { show_download_button } = $$props; 725 let { root } = $$props; 726 let { height } = $$props; 727 let { width } = $$props; 728 let { _selectable = false } = $$props; 729 let { container = true } = $$props; 730 let { scale = null } = $$props; 731 let { min_width = undefined } = $$props; 732 let { loading_status } = $$props; 733 let { show_share_button = false } = $$props; 734 let { sources = ["upload", "clipboard", "webcam"] } = $$props; 735 let { interactive } = $$props; 736 let { streaming } = $$props; 737 let { pending } = $$props; 738 let { mirror_webcam } = $$props; 739 let { gradio } = $$props; 740 let dragging; 741 let active_source = null; 742 const select_handler = ({ detail }) => gradio.dispatch("select", detail); 743 const share_handler = ({ detail }) => gradio.dispatch("share", detail); 744 const error_handler = ({ detail }) => gradio.dispatch("error", detail); 745 746 function imageuploader_active_source_binding(value) { 747 active_source = value;
748 $$invalidate(23, active_source); 749 } 750 751 function imageuploader_value_binding(value$1) { 752 value = value$1; 753 $$invalidate(0, value); 754 } 755 756 const edit_handler = () => gradio.dispatch("edit"); 757 758 const clear_handler = () => { 759 gradio.dispatch("clear"); 760 }; 761 762 const stream_handler = () => gradio.dispatch("stream"); 763 const drag_handler = ({ detail }) => $$invalidate(22, dragging = detail); 764 const upload_handler = () => gradio.dispatch("upload"); 765 const select_handler_1 = ({ detail }) => gradio.dispatch("select", detail); 766 const share_handler_1 = ({ detail }) => gradio.dispatch("share", detail); 767 768 const error_handler_1 = ({ detail }) => { 769 $$invalidate(1, loading_status = loading_status || {}); 770 $$invalidate(1, loading_status.status = "error", loading_status); 771 gradio.dispatch("error", detail); 772 }; 773 774 $$self.$$set = $$props => { 775 if ('elem_id' in $$props) $$invalidate(2, elem_id = $$props.elem_id); 776 if ('elem_classes' in $$props) $$invalidate(3, elem_classes = $$props.elem_classes); 777 if ('visible' in $$props) $$invalidate(4, visible = $$props.visible);
778 if ('value' in $$props) $$invalidate(0, value = $$props.value); 779 if ('label' in $$props) $$invalidate(5, label = $$props.label); 780 if ('show_label' in $$props) $$invalidate(6, show_label = $$props.show_label); 781 if ('show_download_button' in $$props) $$invalidate(7, show_download_button = $$props.show_download_button); 782 if ('root' in $$props) $$invalidate(8, root = $$props.root); 783 if ('height' in $$props) $$invalidate(9, height = $$props.height); 784 if ('width' in $$props) $$invalidate(10, width = $$props.width); 785 if ('_selectable' in $$props) $$invalidate(11, _selectable = $$props._selectable); 786 if ('container' in $$props) $$invalidate(12, container = $$props.container); 787 if ('scale' in $$props) $$invalidate(13, scale = $$props.scale); 788 if ('min_width' in $$props) $$invalidate(14, min_width = $$props.min_width); 789 if ('loading_status' in $$props) $$invalidate(1, loading_status = $$props.loading_status); 790 if ('show_share_button' in $$props) $$invalidate(15, show_share_button = $$props.show_share_button);
791 if ('sources' in $$props) $$invalidate(16, sources = $$props.sources); 792 if ('interactive' in $$props) $$invalidate(17, interactive = $$props.interactive); 793 if ('streaming' in $$props) $$invalidate(18, streaming = $$props.streaming); 794 if ('pending' in $$props) $$invalidate(19, pending = $$props.pending); 795 if ('mirror_webcam' in $$props) $$invalidate(20, mirror_webcam = $$props.mirror_webcam); 796 if ('gradio' in $$props) $$invalidate(21, gradio = $$props.gradio); 797 }; 798 799 $$self.$$.update = () => { 800 if ($$self.$$.dirty[0] & /*value, old_value, gradio*/ 18874369) { 801 { 802 if (JSON.stringify(value) !== JSON.stringify(old_value)) { 803 $$invalidate(24, old_value = value); 804 gradio.dispatch("change"); 805 } 806 } 807 } 808 }; 809 810 return [ 811 value, 812 loading_status, 813 elem_id, 814 elem_classes, 815 visible, 816 label, 817 show_label, 818 show_download_button, 819 root, 820 height, 821 width, 822 _selectable, 823 container, 824 scale, 825 min_width, 826 show_share_button, 827 sources, 828 interactive, 829 streaming, 830 pending, 831 mirror_webcam, 832 gradio, 833 dragging, 834 active_source, 835 old_value, 836 select_handler, 837 share_handler, 838 error_handler, 839 imageuploader_active_source_binding, 840 imageuploader_value_binding, 841 edit_handler, 842 clear_handler, 843 stream_handler, 844 drag_handler, 845 upload_handler, 846 select_handler_1, 847 share_handler_1, 848 error_handler_1 849 ]; 850} 851 852class Index extends SvelteComponent { 853 constructor(options) { 854 super(); 855 856 init( 857 this, 858 options, 859 instance, 860 create_fragment, 861 safe_not_equal, 862 { 863 elem_id: 2, 864 elem_classes: 3, 865 visible: 4, 866 value: 0, 867 label: 5, 868 show_label: 6, 869 show_download_button: 7, 870 root: 8, 871 height: 9, 872 width: 10, 873 _selectable: 11, 874 container: 12, 875 scale: 13, 876 min_width: 14, 877 loading_status: 1, 878 show_share_button: 15, 879 sources: 16, 880 interactive: 17, 881 streaming: 18, 882 pending: 19, 883 mirror_webcam: 20, 884 gradio: 21 885 }, 886 null, 887 [-1, -1] 888 ); 889 } 890 891 get elem_id() { 892 return this.$$.ctx[2]; 893 } 894 895 set elem_id(elem_id) { 896 this.$$set({ elem_id }); 897 flush(); 898 } 899 900 get elem_classes() { 901 return this.$$.ctx[3]; 902 } 903 904 set elem_classes(elem_classes) { 905 this.$$set({ elem_classes }); 906 flush(); 907 } 908 909 get visible() { 910 return this.$$.ctx[4]; 911 } 912 913 set visible(visible) { 914 this.$$set({ visible }); 915 flush(); 916 } 917 918 get value() { 919 return this.$$.ctx[0]; 920 } 921 922 set value(value) { 923 this.$$set({ value }); 924 flush(); 925 } 926 927 get label() { 928 return this.$$.ctx[5]; 929 } 930 931 set label(label) { 932 this.$$set({ label }); 933 flush(); 934 } 935 936 get show_label() { 937 return this.$$.ctx[6]; 938 } 939 940 set show_label(show_label) { 941 this.$$set({ show_label }); 942 flush(); 943 } 944 945 get show_download_button() { 946 return this.$$.ctx[7]; 947 } 948 949 set show_download_button(show_download_button) { 950 this.$$set({ show_download_button }); 951 flush(); 952 } 953 954 get root() { 955 return this.$$.ctx[8]; 956 } 957 958 set root(root) { 959 this.$$set({ root }); 960 flush(); 961 } 962 963 get height() { 964 return this.$$.ctx[9]; 965 } 966 967 set height(height) { 968 this.$$set({ height }); 969 flush(); 970 } 971 972 get width() { 973 return this.$$.ctx[10]; 974 } 975 976 set width(width) { 977 this.$$set({ width }); 978 flush(); 979 } 980 981 get _selectable() { 982 return this.$$.ctx[11]; 983 } 984 985 set _selectable(_selectable) { 986 this.$$set({ _selectable }); 987 flush(); 988 } 989 990 get container() { 991 return this.$$.ctx[12]; 992 } 993 994 set container(container) { 995 this.$$set({ container }); 996 flush(); 997 } 998 999 get scale() { 1000 return this.$$.ctx[13]; 1001 } 1002 1003 set scale(scale) { 1004 this.$$set({ scale }); 1005 flush(); 1006 } 1007 1008 get min_width() { 1009 return this.$$.ctx[14]; 1010 } 1011 1012 set min_width(min_width) { 1013 this.$$set({ min_width }); 1014 flush(); 1015 } 1016 1017 get loading_status() { 1018 return this.$$.ctx[1]; 1019 } 1020 1021 set loading_status(loading_status) { 1022 this.$$set({ loading_status }); 1023 flush(); 1024 } 1025 1026 get show_share_button() { 1027 return this.$$.ctx[15]; 1028 } 1029 1030 set show_share_button(show_share_button) { 1031 this.$$set({ show_share_button }); 1032 flush(); 1033 } 1034 1035 get sources() { 1036 return this.$$.ctx[16]; 1037 } 1038 1039 set sources(sources) { 1040 this.$$set({ sources }); 1041 flush(); 1042 } 1043 1044 get interactive() { 1045 return this.$$.ctx[17]; 1046 } 1047 1048 set interactive(interactive) { 1049 this.$$set({ interactive }); 1050 flush(); 1051 } 1052 1053 get streaming() { 1054 return this.$$.ctx[18]; 1055 } 1056 1057 set streaming(streaming) { 1058 this.$$set({ streaming }); 1059 flush(); 1060 } 1061 1062 get pending() { 1063 return this.$$.ctx[19]; 1064 } 1065 1066 set pending(pending) { 1067 this.$$set({ pending }); 1068 flush(); 1069 } 1070 1071 get mirror_webcam() { 1072 return this.$$.ctx[20]; 1073 } 1074 1075 set mirror_webcam(mirror_webcam) { 1076 this.$$set({ mirror_webcam }); 1077 flush(); 1078 } 1079 1080 get gradio() { 1081 return this.$$.ctx[21]; 1082 } 1083 1084 set gradio(gradio) { 1085 this.$$set({ gradio }); 1086 flush(); 1087 } 1088} 1089 1090export { ImageUploader as BaseImageUploader, StaticImage as BaseStaticImage, Index as default }; 1091//# sourceMappingURL=Index-51b49198.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.