1import { U as Upload } from './Upload-dd644e1d.js'; 2import { M as ModifyUpload } from './ModifyUpload-21a3ee9d.js'; 3import { B as Block } from './Button-20c14f3f.js'; 4import { B as BlockLabel } from './BlockLabel-01d2e4bc.js'; 5import { S as Static } from './Index-34f70ab5.js'; 6import { S as SelectSource } from './SelectSource-dae165df.js'; 7import { W as Webcam } from './ImageUploader-c0805dd2.js'; 8import { p as prepare_files, u as upload, n as normalise_file } from './index-6d9f7a14.js'; 9import './Image-81c44f01.js'; 10/* empty css */import { l as loadFfmpeg, t as trimVideo, V as Video$2, p as prettyBytes, a as playable } from './Video-227d44f6.js'; 11export { b as loaded } from './Video-227d44f6.js'; 12import { T as Trim, P as Pause, a as Play } from './Trim-7bd312df.js'; 13import { U as Undo } from './Undo-6c110254.js'; 14import { I as IconButton } from './IconButton-7a2ae610.js'; 15import { E as Empty } from './Empty-513247fb.js'; 16import { S as ShareButton } from './ShareButton-4c59f811.js'; 17import { D as Download } from './Download-ea83bae3.js'; 18import { u as uploadToHuggingFace } from './utils-8f25e669.js'; 19import { D as DownloadLink } from './DownloadLink-9c980133.js'; 20export { default as BaseExample } from './Example-4295692b.js'; 21import { U as UploadText } from './UploadText-1c7f46b2.js'; 22/* empty css */import './Clear-9760deed.js'; 23import './Upload-c5c1b405.js'; 24import './Image-6cbf81d1.js'; 25import './DropdownArrow-1cc8aef9.js'; 26import './svelte/svelte.js'; 27import './file-url-9a71ec36.js'; 28 29/* home/runner/work/gradio/gradio/js/icons/src/Maximise.svelte generated by Svelte v4.2.2 */ 30const { 31 SvelteComponent: SvelteComponent$7, 32 append: append$6, 33 attr: attr$6, 34 detach: detach$7, 35 init: init$7, 36 insert: insert$7, 37 noop: noop$5, 38 safe_not_equal: safe_not_equal$7, 39 svg_element: svg_element$1 40} = window.__gradio__svelte__internal; 41function create_fragment$7(ctx) { 42 let svg; 43 let path; 44 45 return { 46 c() { 47 svg = svg_element$1("svg"); 48 path = svg_element$1("path"); 49 attr$6(path, "d", "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"); 50 attr$6(svg, "xmlns", "http://www.w3.org/2000/svg"); 51 attr$6(svg, "width", "100%"); 52 attr$6(svg, "height", "100%"); 53 attr$6(svg, "viewBox", "0 0 24 24"); 54 attr$6(svg, "fill", "none"); 55 attr$6(svg, "stroke", "currentColor"); 56 attr$6(svg, "stroke-width", "1.5"); 57 attr$6(svg, "stroke-linecap", "round"); 58 attr$6(svg, "stroke-linejoin", "round"); 59 }, 60 m(target, anchor) { 61 insert$7(target, svg, anchor); 62 append$6(svg, path); 63 }, 64 p: noop$5, 65 i: noop$5, 66 o: noop$5, 67 d(detaching) { 68 if (detaching) { 69 detach$7(svg); 70 } 71 } 72 }; 73} 74 75class Maximise extends SvelteComponent$7 { 76 constructor(options) { 77 super(); 78 init$7(this, options, null, create_fragment$7, safe_not_equal$7, {}); 79 } 80} 81 82/* home/runner/work/gradio/gradio/js/icons/src/Video.svelte generated by Svelte v4.2.2 */ 83const { 84 SvelteComponent: SvelteComponent$6, 85 append: append$5, 86 attr: attr$5, 87 detach: detach$6, 88 init: init$6, 89 insert: insert$6, 90 noop: noop$4, 91 safe_not_equal: safe_not_equal$6, 92 svg_element 93} = window.__gradio__svelte__internal; 94function create_fragment$6(ctx) { 95 let svg; 96 let polygon; 97 let rect; 98 99 return { 100 c() { 101 svg = svg_element("svg"); 102 polygon = svg_element("polygon"); 103 rect = svg_element("rect"); 104 attr$5(polygon, "points", "23 7 16 12 23 17 23 7"); 105 attr$5(rect, "x", "1"); 106 attr$5(rect, "y", "5"); 107 attr$5(rect, "width", "15"); 108 attr$5(rect, "height", "14"); 109 attr$5(rect, "rx", "2"); 110 attr$5(rect, "ry", "2"); 111 attr$5(svg, "xmlns", "http://www.w3.org/2000/svg"); 112 attr$5(svg, "width", "100%"); 113 attr$5(svg, "height", "100%"); 114 attr$5(svg, "viewBox", "0 0 24 24"); 115 attr$5(svg, "fill", "none"); 116 attr$5(svg, "stroke", "currentColor"); 117 attr$5(svg, "stroke-width", "1.5"); 118 attr$5(svg, "stroke-linecap", "round"); 119 attr$5(svg, "stroke-linejoin", "round"); 120 attr$5(svg, "class", "feather feather-video"); 121 }, 122 m(target, anchor) { 123 insert$6(target, svg, anchor); 124 append$5(svg, polygon); 125 append$5(svg, rect); 126 }, 127 p: noop$4, 128 i: noop$4, 129 o: noop$4, 130 d(detaching) { 131 if (detaching) { 132 detach$6(svg); 133 } 134 } 135 }; 136} 137 138let Video$1 = class Video extends SvelteComponent$6 { 139 constructor(options) { 140 super(); 141 init$6(this, options, null, create_fragment$6, safe_not_equal$6, {}); 142 } 143}; 144 145const VideoTimeline_svelte_svelte_type_style_lang = ''; 146
147/* home/runner/work/gradio/gradio/js/video/shared/VideoTimeline.svelte generated by Svelte v4.2.2 */ 148const { 149 SvelteComponent: SvelteComponent$5, 150 append: append$4, 151 attr: attr$4, 152 destroy_block, 153 detach: detach$5, 154 element: element$4, 155 ensure_array_like, 156 init: init$5, 157 insert: insert$5, 158 listen: listen$2, 159 noop: noop$3, 160 run_all: run_all$2, 161 safe_not_equal: safe_not_equal$5, 162 set_style, 163 space: space$5, 164 src_url_equal: src_url_equal$1, 165 update_keyed_each 166} = window.__gradio__svelte__internal; 167const { onMount: onMount$1, onDestroy } = window.__gradio__svelte__internal; 168function get_each_context(ctx, list, i) { 169 const child_ctx = ctx.slice(); 170 child_ctx[20] = list[i]; 171 child_ctx[22] = i; 172 return child_ctx; 173} 174 175// (128:1) {:else} 176function create_else_block$5(ctx) { 177 let div1; 178 let button0; 179 let t0; 180 let div0; 181 let t1; 182 let each_blocks = []; 183 let each_1_lookup = new Map(); 184 let t2; 185 let button1; 186 let mounted; 187 let dispose; 188 let each_value = ensure_array_like(/*thumbnails*/ ctx[1]); 189 const get_key = ctx => /*i*/ ctx[22]; 190 191 for (let i = 0; i < each_value.length; i += 1) { 192 let child_ctx = get_each_context(ctx, each_value, i); 193 let key = get_key(child_ctx); 194 each_1_lookup.set(key, each_blocks[i] = create_each_block(key, child_ctx)); 195 } 196 197 return { 198 c() { 199 div1 = element$4("div"); 200 button0 = element$4("button"); 201 t0 = space$5(); 202 div0 = element$4("div"); 203 t1 = space$5(); 204 205 for (let i = 0; i < each_blocks.length; i += 1) { 206 each_blocks[i].c(); 207 } 208 209 t2 = space$5(); 210 button1 = element$4("button"); 211 attr$4(button0, "aria-label", "start drag handle for trimming video"); 212 attr$4(button0, "class", "handle left svelte-10c4beq"); 213 set_style(button0, "left", /*leftHandlePosition*/ ctx[2] + "%"); 214 attr$4(div0, "class", "opaque-layer svelte-10c4beq"); 215 set_style(div0, "left", /*leftHandlePosition*/ ctx[2] + "%"); 216 set_style(div0, "right", 100 - /*rightHandlePosition*/ ctx[3] + "%"); 217 attr$4(button1, "aria-label", "end drag handle for trimming video"); 218 attr$4(button1, "class", "handle right svelte-10c4beq"); 219 set_style(button1, "left", /*rightHandlePosition*/ ctx[3] + "%"); 220 attr$4(div1, "id", "timeline"); 221 attr$4(div1, "class", "thumbnail-wrapper svelte-10c4beq"); 222 }, 223 m(target, anchor) { 224 insert$5(target, div1, anchor); 225 append$4(div1, button0); 226 append$4(div1, t0); 227 append$4(div1, div0); 228 append$4(div1, t1); 229 230 for (let i = 0; i < each_blocks.length; i += 1) { 231 if (each_blocks[i]) { 232 each_blocks[i].m(div1, null); 233 } 234 } 235 236 append$4(div1, t2); 237 append$4(div1, button1); 238 239 if (!mounted) { 240 dispose = [ 241 listen$2(button0, "mousedown", /*mousedown_handler*/ ctx[10]), 242 listen$2(button0, "blur", /*stopDragging*/ ctx[5]), 243 listen$2(button0, "keydown", /*keydown_handler*/ ctx[11]), 244 listen$2(button1, "mousedown", /*mousedown_handler_1*/ ctx[12]), 245 listen$2(button1, "blur", /*stopDragging*/ ctx[5]), 246 listen$2(button1, "keydown", /*keydown_handler_1*/ ctx[13]) 247 ]; 248 249 mounted = true; 250 } 251 }, 252 p(ctx, dirty) { 253 if (dirty & /*leftHandlePosition*/ 4) { 254 set_style(button0, "left", /*leftHandlePosition*/ ctx[2] + "%"); 255 } 256 257 if (dirty & /*leftHandlePosition*/ 4) { 258 set_style(div0, "left", /*leftHandlePosition*/ ctx[2] + "%"); 259 } 260 261 if (dirty & /*rightHandlePosition*/ 8) { 262 set_style(div0, "right", 100 - /*rightHandlePosition*/ ctx[3] + "%"); 263 } 264 265 if (dirty & /*thumbnails*/ 2) { 266 each_value = ensure_array_like(/*thumbnails*/ ctx[1]); 267 each_blocks = update_keyed_each(each_blocks, dirty, get_key, 1, ctx, each_value, each_1_lookup, div1, destroy_block, create_each_block, t2, get_each_context); 268 } 269 270 if (dirty & /*rightHandlePosition*/ 8) { 271 set_style(button1, "left", /*rightHandlePosition*/ ctx[3] + "%"); 272 } 273 }, 274 d(detaching) { 275 if (detaching) { 276 detach$5(div1); 277 } 278 279 for (let i = 0; i < each_blocks.length; i += 1) { 280 each_blocks[i].d(); 281 } 282 283 mounted = false; 284 run_all$2(dispose); 285 } 286 }; 287} 288 289// (124:1) {#if loadingTimeline} 290function create_if_block$5(ctx) { 291 let div; 292 293 return { 294 c() { 295 div = element$4("div"); 296 div.innerHTML = `<span aria-label="loading timeline" class="loader svelte-10c4beq"></span>`;
297 attr$4(div, "class", "load-wrap svelte-10c4beq"); 298 }, 299 m(target, anchor) { 300 insert$5(target, div, anchor); 301 }, 302 p: noop$3, 303 d(detaching) { 304 if (detaching) { 305 detach$5(div); 306 } 307 } 308 }; 309} 310 311// (148:3) {#each thumbnails as thumbnail, i (i)} 312function create_each_block(key_1, ctx) { 313 let img; 314 let img_src_value; 315 let img_alt_value; 316 317 return { 318 key: key_1, 319 first: null, 320 c() { 321 img = element$4("img"); 322 if (!src_url_equal$1(img.src, img_src_value = /*thumbnail*/ ctx[20])) attr$4(img, "src", img_src_value); 323 attr$4(img, "alt", img_alt_value = `frame-${/*i*/ ctx[22]}`); 324 attr$4(img, "draggable", "false"); 325 attr$4(img, "class", "svelte-10c4beq"); 326 this.first = img; 327 }, 328 m(target, anchor) { 329 insert$5(target, img, anchor); 330 }, 331 p(new_ctx, dirty) { 332 ctx = new_ctx; 333 334 if (dirty & /*thumbnails*/ 2 && !src_url_equal$1(img.src, img_src_value = /*thumbnail*/ ctx[20])) { 335 attr$4(img, "src", img_src_value); 336 } 337 338 if (dirty & /*thumbnails*/ 2 && img_alt_value !== (img_alt_value = `frame-${/*i*/ ctx[22]}`)) { 339 attr$4(img, "alt", img_alt_value); 340 } 341 }, 342 d(detaching) { 343 if (detaching) { 344 detach$5(img); 345 } 346 } 347 }; 348} 349 350function create_fragment$5(ctx) { 351 let div; 352 353 function select_block_type(ctx, dirty) { 354 if (/*loadingTimeline*/ ctx[0]) return create_if_block$5; 355 return create_else_block$5; 356 } 357 358 let current_block_type = select_block_type(ctx); 359 let if_block = current_block_type(ctx); 360 361 return { 362 c() { 363 div = element$4("div"); 364 if_block.c(); 365 attr$4(div, "class", "container svelte-10c4beq"); 366 }, 367 m(target, anchor) { 368 insert$5(target, div, anchor); 369 if_block.m(div, null); 370 }, 371 p(ctx, [dirty]) { 372 if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block) { 373 if_block.p(ctx, dirty); 374 } else { 375 if_block.d(1); 376 if_block = current_block_type(ctx); 377 378 if (if_block) { 379 if_block.c(); 380 if_block.m(div, null); 381 } 382 } 383 }, 384 i: noop$3, 385 o: noop$3, 386 d(detaching) { 387 if (detaching) { 388 detach$5(div); 389 } 390 391 if_block.d(); 392 } 393 }; 394} 395 396let numberOfThumbnails = 10; 397 398function instance$5($$self, $$props, $$invalidate) { 399 let { videoElement } = $$props; 400 let { trimmedDuration } = $$props; 401 let { dragStart } = $$props; 402 let { dragEnd } = $$props; 403 let { loadingTimeline } = $$props; 404 let thumbnails = []; 405 let videoDuration; 406 let leftHandlePosition = 0; 407 let rightHandlePosition = 100; 408 let dragging = null; 409 410 const startDragging = side => { 411 dragging = side; 412 }; 413 414 const stopDragging = () => { 415 dragging = null; 416 }; 417 418 const drag = (event, distance) => { 419 if (dragging) { 420 const timeline = document.getElementById("timeline"); 421 if (!timeline) return; 422 const rect = timeline.getBoundingClientRect(); 423 let newPercentage = (event.clientX - rect.left) / rect.width * 100; 424 425 if (distance) { 426 // Move handle based on arrow key press 427 newPercentage = dragging === "left" 428 ? leftHandlePosition + distance 429 : rightHandlePosition + distance; 430 } else { 431 // Move handle based on mouse drag 432 newPercentage = (event.clientX - rect.left) / rect.width * 100; 433 } 434 435 newPercentage = Math.max(0, Math.min(newPercentage, 100)); // Keep within 0 and 100 436 437 if (dragging === "left") { 438 $$invalidate(2, leftHandlePosition = Math.min(newPercentage, rightHandlePosition)); 439 440 // Calculate the new time and set it for the videoElement 441 const newTimeLeft = leftHandlePosition / 100 * videoDuration; 442 443 $$invalidate(6, videoElement.currentTime = newTimeLeft, videoElement); 444 $$invalidate(8, dragStart = newTimeLeft); 445 } else if (dragging === "right") { 446 $$invalidate(3, rightHandlePosition = Math.max(newPercentage, leftHandlePosition)); 447 const newTimeRight = rightHandlePosition / 100 * videoDuration; 448 $$invalidate(6, videoElement.currentTime = newTimeRight, videoElement); 449 $$invalidate(9, dragEnd = newTimeRight); 450 } 451 452 const startTime = leftHandlePosition / 100 * videoDuration; 453 const endTime = rightHandlePosition / 100 * videoDuration; 454 $$invalidate(7, trimmedDuration = endTime - startTime); 455 $$invalidate(2, leftHandlePosition);
456 $$invalidate(3, rightHandlePosition); 457 } 458 }; 459 460 const moveHandle = e => { 461 if (dragging) { 462 // Calculate the movement distance as a percentage of the video duration 463 const distance = 1 / videoDuration * 100; 464 465 if (e.key === "ArrowLeft") { 466 drag({ clientX: 0 }, -distance); 467 } else if (e.key === "ArrowRight") { 468 drag({ clientX: 0 }, distance); 469 } 470 } 471 }; 472 473 const generateThumbnail = () => { 474 const canvas = document.createElement("canvas"); 475 const ctx = canvas.getContext("2d"); 476 if (!ctx) return; 477 canvas.width = videoElement.videoWidth; 478 canvas.height = videoElement.videoHeight; 479 ctx.drawImage(videoElement, 0, 0, canvas.width, canvas.height); 480 const thumbnail = canvas.toDataURL("image/jpeg", 0.7); 481 $$invalidate(1, thumbnails = [...thumbnails, thumbnail]); 482 }; 483 484 onMount$1(() => { 485 const loadMetadata = () => { 486 videoDuration = videoElement.duration; 487 const interval = videoDuration / numberOfThumbnails; 488 let captures = 0; 489 490 const onSeeked = () => { 491 generateThumbnail(); 492 captures++; 493 494 if (captures < numberOfThumbnails) { 495 $$invalidate(6, videoElement.currentTime += interval, videoElement); 496 } else { 497 videoElement.removeEventListener("seeked", onSeeked); 498 } 499 }; 500 501 videoElement.addEventListener("seeked", onSeeked); 502 $$invalidate(6, videoElement.currentTime = 0, videoElement); 503 }; 504 505 if (videoElement.readyState >= 1) { 506 loadMetadata(); 507 } else { 508 videoElement.addEventListener("loadedmetadata", loadMetadata); 509 } 510 }); 511 512 onDestroy(() => { 513 window.removeEventListener("mousemove", drag); 514 window.removeEventListener("mouseup", stopDragging); 515 window.removeEventListener("keydown", moveHandle); 516 }); 517 518 onMount$1(() => { 519 window.addEventListener("mousemove", drag); 520 window.addEventListener("mouseup", stopDragging); 521 window.addEventListener("keydown", moveHandle); 522 }); 523 524 const mousedown_handler = () => startDragging("left"); 525 526 const keydown_handler = e => { 527 if (e.key === "ArrowLeft" || e.key == "ArrowRight") { 528 startDragging("left"); 529 } 530 }; 531 532 const mousedown_handler_1 = () => startDragging("right"); 533 534 const keydown_handler_1 = e => { 535 if (e.key === "ArrowLeft" || e.key == "ArrowRight") { 536 startDragging("right"); 537 } 538 }; 539 540 $$self.$$set = $$props => {
541 if ('videoElement' in $$props) $$invalidate(6, videoElement = $$props.videoElement); 542 if ('trimmedDuration' in $$props) $$invalidate(7, trimmedDuration = $$props.trimmedDuration); 543 if ('dragStart' in $$props) $$invalidate(8, dragStart = $$props.dragStart); 544 if ('dragEnd' in $$props) $$invalidate(9, dragEnd = $$props.dragEnd); 545 if ('loadingTimeline' in $$props) $$invalidate(0, loadingTimeline = $$props.loadingTimeline); 546 }; 547 548 $$self.$$.update = () => { 549 if ($$self.$$.dirty & /*thumbnails*/ 2) { 550 $$invalidate(0, loadingTimeline = thumbnails.length !== numberOfThumbnails); 551 } 552 }; 553 554 return [ 555 loadingTimeline, 556 thumbnails, 557 leftHandlePosition, 558 rightHandlePosition, 559 startDragging, 560 stopDragging, 561 videoElement, 562 trimmedDuration, 563 dragStart, 564 dragEnd, 565 mousedown_handler, 566 keydown_handler, 567 mousedown_handler_1, 568 keydown_handler_1 569 ]; 570} 571 572class VideoTimeline extends SvelteComponent$5 { 573 constructor(options) { 574 super(); 575 576 init$5(this, options, instance$5, create_fragment$5, safe_not_equal$5, { 577 videoElement: 6, 578 trimmedDuration: 7, 579 dragStart: 8, 580 dragEnd: 9, 581 loadingTimeline: 0 582 }); 583 } 584} 585 586const VideoControls_svelte_svelte_type_style_lang = ''; 587 588/* home/runner/work/gradio/gradio/js/video/shared/VideoControls.svelte generated by Svelte v4.2.2 */ 589const { 590 SvelteComponent: SvelteComponent$4, 591 add_flush_callback: add_flush_callback$2, 592 append: append$3, 593 attr: attr$3, 594 bind: bind$2, 595 binding_callbacks: binding_callbacks$2, 596 check_outros: check_outros$4, 597 create_component: create_component$4, 598 destroy_component: destroy_component$4, 599 detach: detach$4, 600 element: element$3, 601 empty: empty$4, 602 group_outros: group_outros$4, 603 init: init$4, 604 insert: insert$4, 605 listen: listen$1, 606 mount_component: mount_component$4, 607 noop: noop$2, 608 run_all: run_all$1, 609 safe_not_equal: safe_not_equal$4, 610 set_data: set_data$2, 611 space: space$4, 612 text: text$2, 613 toggle_class: toggle_class$1, 614 transition_in: transition_in$4, 615 transition_out: transition_out$4 616} = window.__gradio__svelte__internal;const { onMount } = window.__gradio__svelte__internal; 617function create_if_block_4$1(ctx) { 618 let div; 619 let videotimeline; 620 let updating_dragStart; 621 let updating_dragEnd; 622 let updating_trimmedDuration; 623 let updating_loadingTimeline; 624 let current; 625 626 function videotimeline_dragStart_binding(value) { 627 /*videotimeline_dragStart_binding*/ ctx[14](value); 628 } 629 630 function videotimeline_dragEnd_binding(value) { 631 /*videotimeline_dragEnd_binding*/ ctx[15](value); 632 } 633 634 function videotimeline_trimmedDuration_binding(value) { 635 /*videotimeline_trimmedDuration_binding*/ ctx[16](value); 636 } 637 638 function videotimeline_loadingTimeline_binding(value) { 639 /*videotimeline_loadingTimeline_binding*/ ctx[17](value); 640 } 641 642 let videotimeline_props = { videoElement: /*videoElement*/ ctx[2] }; 643 644 if (/*dragStart*/ ctx[9] !== void 0) { 645 videotimeline_props.dragStart = /*dragStart*/ ctx[9]; 646 } 647 648 if (/*dragEnd*/ ctx[10] !== void 0) { 649 videotimeline_props.dragEnd = /*dragEnd*/ ctx[10]; 650 } 651 652 if (/*trimmedDuration*/ ctx[7] !== void 0) { 653 videotimeline_props.trimmedDuration = /*trimmedDuration*/ ctx[7]; 654 } 655 656 if (/*loadingTimeline*/ ctx[11] !== void 0) { 657 videotimeline_props.loadingTimeline = /*loadingTimeline*/ ctx[11]; 658 } 659 660 videotimeline = new VideoTimeline({ props: videotimeline_props }); 661 binding_callbacks$2.push(() => bind$2(videotimeline, 'dragStart', videotimeline_dragStart_binding)); 662 binding_callbacks$2.push(() => bind$2(videotimeline, 'dragEnd', videotimeline_dragEnd_binding)); 663 binding_callbacks$2.push(() => bind$2(videotimeline, 'trimmedDuration', videotimeline_trimmedDuration_binding)); 664 binding_callbacks$2.push(() => bind$2(videotimeline, 'loadingTimeline', videotimeline_loadingTimeline_binding)); 665 666 return { 667 c() { 668 div = element$3("div"); 669 create_component$4(videotimeline.$$.fragment); 670 attr$3(div, "class", "timeline-wrapper svelte-sxyn79"); 671 }, 672 m(target, anchor) { 673 insert$4(target, div, anchor); 674 mount_component$4(videotimeline, div, null); 675 current = true; 676 }, 677 p(ctx, dirty) { 678 const videotimeline_changes = {}; 679 if (dirty & /*videoElement*/ 4) videotimeline_changes.videoElement = /*videoElement*/ ctx[2]; 680 681 if (!updating_dragStart && dirty & /*dragStart*/ 512) { 682 updating_dragStart = true; 683 videotimeline_changes.dragStart = /*dragStart*/ ctx[9]; 684 add_flush_callback$2(() => updating_dragStart = false); 685 } 686
687 if (!updating_dragEnd && dirty & /*dragEnd*/ 1024) { 688 updating_dragEnd = true; 689 videotimeline_changes.dragEnd = /*dragEnd*/ ctx[10]; 690 add_flush_callback$2(() => updating_dragEnd = false); 691 } 692 693 if (!updating_trimmedDuration && dirty & /*trimmedDuration*/ 128) { 694 updating_trimmedDuration = true; 695 videotimeline_changes.trimmedDuration = /*trimmedDuration*/ ctx[7]; 696 add_flush_callback$2(() => updating_trimmedDuration = false); 697 } 698 699 if (!updating_loadingTimeline && dirty & /*loadingTimeline*/ 2048) { 700 updating_loadingTimeline = true; 701 videotimeline_changes.loadingTimeline = /*loadingTimeline*/ ctx[11]; 702 add_flush_callback$2(() => updating_loadingTimeline = false); 703 } 704 705 videotimeline.$set(videotimeline_changes); 706 }, 707 i(local) { 708 if (current) return; 709 transition_in$4(videotimeline.$$.fragment, local); 710 current = true; 711 }, 712 o(local) { 713 transition_out$4(videotimeline.$$.fragment, local); 714 current = false; 715 }, 716 d(detaching) { 717 if (detaching) { 718 detach$4(div); 719 } 720 721 destroy_component$4(videotimeline); 722 } 723 }; 724} 725 726// (63:2) {:else} 727function create_else_block_1(ctx) { 728 let div; 729 730 return { 731 c() { 732 div = element$3("div"); 733 attr$3(div, "class", "svelte-sxyn79"); 734 }, 735 m(target, anchor) { 736 insert$4(target, div, anchor); 737 }, 738 p: noop$2, 739 d(detaching) { 740 if (detaching) { 741 detach$4(div); 742 } 743 } 744 }; 745} 746 747// (58:2) {#if mode === "edit" && trimmedDuration !== null} 748function create_if_block_3$1(ctx) { 749 let time; 750 let t_value = /*formatTime*/ ctx[12](/*trimmedDuration*/ ctx[7]) + ""; 751 let t; 752 753 return { 754 c() { 755 time = element$3("time"); 756 t = text$2(t_value); 757 attr$3(time, "aria-label", "duration of selected region in seconds"); 758 attr$3(time, "class", "svelte-sxyn79"); 759 toggle_class$1(time, "hidden", /*loadingTimeline*/ ctx[11]); 760 }, 761 m(target, anchor) { 762 insert$4(target, time, anchor); 763 append$3(time, t); 764 }, 765 p(ctx, dirty) { 766 if (dirty & /*trimmedDuration*/ 128 && t_value !== (t_value = /*formatTime*/ ctx[12](/*trimmedDuration*/ ctx[7]) + "")) set_data$2(t, t_value); 767 768 if (dirty & /*loadingTimeline*/ 2048) { 769 toggle_class$1(time, "hidden", /*loadingTimeline*/ ctx[11]); 770 } 771 }, 772 d(detaching) { 773 if (detaching) { 774 detach$4(time); 775 } 776 } 777 }; 778} 779 780// (68:3) {#if showRedo && mode === ""} 781function create_if_block_2$3(ctx) { 782 let button; 783 let undo; 784 let current; 785 let mounted; 786 let dispose; 787 undo = new Undo({}); 788 789 return { 790 c() { 791 button = element$3("button"); 792 create_component$4(undo.$$.fragment); 793 attr$3(button, "class", "action icon svelte-sxyn79"); 794 button.disabled = /*processingVideo*/ ctx[1]; 795 attr$3(button, "aria-label", "Reset video to initial value"); 796 }, 797 m(target, anchor) { 798 insert$4(target, button, anchor); 799 mount_component$4(undo, button, null); 800 current = true; 801 802 if (!mounted) { 803 dispose = listen$1(button, "click", /*click_handler*/ ctx[18]); 804 mounted = true; 805 } 806 }, 807 p(ctx, dirty) { 808 if (!current || dirty & /*processingVideo*/ 2) { 809 button.disabled = /*processingVideo*/ ctx[1]; 810 } 811 }, 812 i(local) { 813 if (current) return; 814 transition_in$4(undo.$$.fragment, local); 815 current = true; 816 }, 817 o(local) { 818 transition_out$4(undo.$$.fragment, local); 819 current = false; 820 }, 821 d(detaching) { 822 if (detaching) { 823 detach$4(button); 824 } 825 826 destroy_component$4(undo); 827 mounted = false; 828 dispose(); 829 } 830 }; 831} 832 833// (82:3) {#if interactive} 834function create_if_block$4(ctx) { 835 let current_block_type_index; 836 let if_block; 837 let if_block_anchor; 838 let current; 839 const if_block_creators = [create_if_block_1$3, create_else_block$4]; 840 const if_blocks = []; 841 842 function select_block_type_1(ctx, dirty) { 843 if (/*mode*/ ctx[0] === "") return 0; 844 return 1; 845 } 846 847 current_block_type_index = select_block_type_1(ctx); 848 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 849 850 return { 851 c() { 852 if_block.c(); 853 if_block_anchor = empty$4(); 854 }, 855 m(target, anchor) { 856 if_blocks[current_block_type_index].m(target, anchor); 857 insert$4(target, if_block_anchor, anchor); 858 current = true; 859 }, 860 p(ctx, dirty) { 861 let previous_block_index = current_block_type_index; 862 current_block_type_index = select_block_type_1(ctx); 863 864 if (current_block_type_index === previous_block_index) { 865 if_blocks[current_block_type_index].p(ctx, dirty); 866 } else { 867 group_outros$4(); 868 869 transition_out$4(if_blocks[previous_block_index], 1, 1, () => { 870 if_blocks[previous_block_index] = null; 871 }); 872 873 check_outros$4(); 874 if_block = if_blocks[current_block_type_index]; 875 876 if (!if_block) { 877 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 878 if_block.c(); 879 } else { 880 if_block.p(ctx, dirty); 881 } 882 883 transition_in$4(if_block, 1); 884 if_block.m(if_block_anchor.parentNode, if_block_anchor); 885 } 886 }, 887 i(local) { 888 if (current) return; 889 transition_in$4(if_block); 890 current = true; 891 }, 892 o(local) { 893 transition_out$4(if_block); 894 current = false;
895 }, 896 d(detaching) { 897 if (detaching) { 898 detach$4(if_block_anchor); 899 } 900 901 if_blocks[current_block_type_index].d(detaching); 902 } 903 }; 904} 905 906// (92:4) {:else} 907function create_else_block$4(ctx) { 908 let button0; 909 let t1; 910 let button1; 911 let mounted; 912 let dispose; 913 914 return { 915 c() { 916 button0 = element$3("button"); 917 button0.textContent = "Trim"; 918 t1 = space$4(); 919 button1 = element$3("button"); 920 button1.textContent = "Cancel"; 921 attr$3(button0, "class", "text-button svelte-sxyn79"); 922 toggle_class$1(button0, "hidden", /*loadingTimeline*/ ctx[11]); 923 attr$3(button1, "class", "text-button svelte-sxyn79"); 924 toggle_class$1(button1, "hidden", /*loadingTimeline*/ ctx[11]); 925 }, 926 m(target, anchor) { 927 insert$4(target, button0, anchor); 928 insert$4(target, t1, anchor); 929 insert$4(target, button1, anchor); 930 931 if (!mounted) { 932 dispose = [ 933 listen$1(button0, "click", /*click_handler_1*/ ctx[19]), 934 listen$1(button1, "click", /*toggleTrimmingMode*/ ctx[13]) 935 ]; 936 937 mounted = true; 938 } 939 }, 940 p(ctx, dirty) { 941 if (dirty & /*loadingTimeline*/ 2048) { 942 toggle_class$1(button0, "hidden", /*loadingTimeline*/ ctx[11]); 943 } 944 945 if (dirty & /*loadingTimeline*/ 2048) { 946 toggle_class$1(button1, "hidden", /*loadingTimeline*/ ctx[11]); 947 } 948 }, 949 i: noop$2, 950 o: noop$2, 951 d(detaching) { 952 if (detaching) { 953 detach$4(button0); 954 detach$4(t1); 955 detach$4(button1); 956 } 957 958 mounted = false; 959 run_all$1(dispose); 960 } 961 }; 962} 963 964// (83:4) {#if mode === ""} 965function create_if_block_1$3(ctx) { 966 let button; 967 let trim; 968 let current; 969 let mounted; 970 let dispose; 971 trim = new Trim({}); 972 973 return { 974 c() { 975 button = element$3("button"); 976 create_component$4(trim.$$.fragment); 977 button.disabled = /*processingVideo*/ ctx[1]; 978 attr$3(button, "class", "action icon svelte-sxyn79"); 979 attr$3(button, "aria-label", "Trim video to selection"); 980 }, 981 m(target, anchor) { 982 insert$4(target, button, anchor); 983 mount_component$4(trim, button, null); 984 current = true; 985 986 if (!mounted) { 987 dispose = listen$1(button, "click", /*toggleTrimmingMode*/ ctx[13]); 988 mounted = true; 989 } 990 }, 991 p(ctx, dirty) { 992 if (!current || dirty & /*processingVideo*/ 2) { 993 button.disabled = /*processingVideo*/ ctx[1]; 994 } 995 }, 996 i(local) { 997 if (current) return; 998 transition_in$4(trim.$$.fragment, local); 999 current = true; 1000 }, 1001 o(local) { 1002 transition_out$4(trim.$$.fragment, local); 1003 current = false; 1004 }, 1005 d(detaching) { 1006 if (detaching) { 1007 detach$4(button); 1008 } 1009 1010 destroy_component$4(trim); 1011 mounted = false; 1012 dispose(); 1013 } 1014 }; 1015} 1016 1017function create_fragment$4(ctx) { 1018 let div2; 1019 let t0; 1020 let div1; 1021 let t1; 1022 let div0; 1023 let t2; 1024 let current; 1025 let if_block0 = /*mode*/ ctx[0] === "edit" && create_if_block_4$1(ctx); 1026 1027 function select_block_type(ctx, dirty) { 1028 if (/*mode*/ ctx[0] === "edit" && /*trimmedDuration*/ ctx[7] !== null) return create_if_block_3$1; 1029 return create_else_block_1; 1030 } 1031 1032 let current_block_type = select_block_type(ctx); 1033 let if_block1 = current_block_type(ctx); 1034 let if_block2 = /*showRedo*/ ctx[3] && /*mode*/ ctx[0] === "" && create_if_block_2$3(ctx); 1035 let if_block3 = /*interactive*/ ctx[4] && create_if_block$4(ctx); 1036 1037 return { 1038 c() { 1039 div2 = element$3("div"); 1040 if (if_block0) if_block0.c(); 1041 t0 = space$4(); 1042 div1 = element$3("div"); 1043 if_block1.c(); 1044 t1 = space$4(); 1045 div0 = element$3("div"); 1046 if (if_block2) if_block2.c(); 1047 t2 = space$4(); 1048 if (if_block3) if_block3.c(); 1049 attr$3(div0, "class", "settings-wrapper svelte-sxyn79"); 1050 attr$3(div1, "class", "controls svelte-sxyn79"); 1051 attr$3(div1, "data-testid", "waveform-controls"); 1052 attr$3(div2, "class", "container svelte-sxyn79"); 1053 }, 1054 m(target, anchor) { 1055 insert$4(target, div2, anchor); 1056 if (if_block0) if_block0.m(div2, null); 1057 append$3(div2, t0); 1058 append$3(div2, div1); 1059 if_block1.m(div1, null); 1060 append$3(div1, t1); 1061 append$3(div1, div0); 1062 if (if_block2) if_block2.m(div0, null); 1063 append$3(div0, t2); 1064 if (if_block3) if_block3.m(div0, null); 1065 current = true; 1066 }, 1067 p(ctx, [dirty]) { 1068 if (/*mode*/ ctx[0] === "edit") { 1069 if (if_block0) { 1070 if_block0.p(ctx, dirty); 1071
1072 if (dirty & /*mode*/ 1) { 1073 transition_in$4(if_block0, 1); 1074 } 1075 } else { 1076 if_block0 = create_if_block_4$1(ctx); 1077 if_block0.c(); 1078 transition_in$4(if_block0, 1); 1079 if_block0.m(div2, t0); 1080 } 1081 } else if (if_block0) { 1082 group_outros$4(); 1083 1084 transition_out$4(if_block0, 1, 1, () => { 1085 if_block0 = null; 1086 }); 1087 1088 check_outros$4(); 1089 } 1090 1091 if (current_block_type === (current_block_type = select_block_type(ctx)) && if_block1) { 1092 if_block1.p(ctx, dirty); 1093 } else { 1094 if_block1.d(1); 1095 if_block1 = current_block_type(ctx); 1096 1097 if (if_block1) { 1098 if_block1.c(); 1099 if_block1.m(div1, t1); 1100 } 1101 } 1102 1103 if (/*showRedo*/ ctx[3] && /*mode*/ ctx[0] === "") { 1104 if (if_block2) { 1105 if_block2.p(ctx, dirty); 1106 1107 if (dirty & /*showRedo, mode*/ 9) { 1108 transition_in$4(if_block2, 1); 1109 } 1110 } else { 1111 if_block2 = create_if_block_2$3(ctx); 1112 if_block2.c(); 1113 transition_in$4(if_block2, 1); 1114 if_block2.m(div0, t2); 1115 } 1116 } else if (if_block2) { 1117 group_outros$4(); 1118 1119 transition_out$4(if_block2, 1, 1, () => { 1120 if_block2 = null; 1121 }); 1122 1123 check_outros$4(); 1124 } 1125 1126 if (/*interactive*/ ctx[4]) { 1127 if (if_block3) { 1128 if_block3.p(ctx, dirty); 1129 1130 if (dirty & /*interactive*/ 16) { 1131 transition_in$4(if_block3, 1); 1132 } 1133 } else { 1134 if_block3 = create_if_block$4(ctx); 1135 if_block3.c(); 1136 transition_in$4(if_block3, 1); 1137 if_block3.m(div0, null); 1138 } 1139 } else if (if_block3) { 1140 group_outros$4(); 1141 1142 transition_out$4(if_block3, 1, 1, () => { 1143 if_block3 = null; 1144 }); 1145 1146 check_outros$4(); 1147 } 1148 }, 1149 i(local) { 1150 if (current) return; 1151 transition_in$4(if_block0); 1152 transition_in$4(if_block2); 1153 transition_in$4(if_block3); 1154 current = true; 1155 }, 1156 o(local) { 1157 transition_out$4(if_block0); 1158 transition_out$4(if_block2); 1159 transition_out$4(if_block3); 1160 current = false; 1161 }, 1162 d(detaching) { 1163 if (detaching) { 1164 detach$4(div2); 1165 } 1166 1167 if (if_block0) if_block0.d(); 1168 if_block1.d(); 1169 if (if_block2) if_block2.d(); 1170 if (if_block3) if_block3.d(); 1171 } 1172 }; 1173} 1174 1175function instance$4($$self, $$props, $$invalidate) { 1176 let { videoElement } = $$props; 1177 let { showRedo = false } = $$props; 1178 let { interactive = true } = $$props; 1179 let { mode = "" } = $$props; 1180 let { handle_reset_value } = $$props; 1181 let { handle_trim_video } = $$props; 1182 let { processingVideo = false } = $$props; 1183 let ffmpeg; 1184 1185 onMount(async () => { 1186 $$invalidate(8, ffmpeg = await loadFfmpeg()); 1187 }); 1188 1189 const formatTime = seconds => { 1190 const minutes = Math.floor(seconds / 60); 1191 const secondsRemainder = Math.round(seconds) % 60; 1192 const paddedSeconds = `0${secondsRemainder}`.slice(-2); 1193 1194 if (Number.isNaN(minutes) || Number.isNaN(secondsRemainder)) { 1195 return "00:00"; 1196 } 1197 1198 return `${minutes}:${paddedSeconds}`; 1199 }; 1200 1201 let trimmedDuration = null; 1202 let dragStart = 0; 1203 let dragEnd = 0; 1204 let loadingTimeline = false; 1205 1206 const toggleTrimmingMode = () => { 1207 if (mode === "edit") { 1208 $$invalidate(0, mode = ""); 1209 $$invalidate(7, trimmedDuration = videoElement.duration); 1210 } else { 1211 $$invalidate(0, mode = "edit"); 1212 } 1213 }; 1214 1215 function videotimeline_dragStart_binding(value) { 1216 dragStart = value; 1217 $$invalidate(9, dragStart); 1218 } 1219 1220 function videotimeline_dragEnd_binding(value) { 1221 dragEnd = value; 1222 $$invalidate(10, dragEnd); 1223 } 1224 1225 function videotimeline_trimmedDuration_binding(value) { 1226 trimmedDuration = value; 1227 (($$invalidate(7, trimmedDuration), $$invalidate(0, mode)), $$invalidate(2, videoElement)); 1228 } 1229 1230 function videotimeline_loadingTimeline_binding(value) { 1231 loadingTimeline = value; 1232 $$invalidate(11, loadingTimeline); 1233 } 1234 1235 const click_handler = () => { 1236 handle_reset_value(); 1237 $$invalidate(0, mode = ""); 1238 }; 1239 1240 const click_handler_1 = () => { 1241 $$invalidate(0, mode = ""); 1242 $$invalidate(1, processingVideo = true); 1243 1244 trimVideo(ffmpeg, dragStart, dragEnd, videoElement).then(videoBlob => { 1245 handle_trim_video(videoBlob); 1246 }).then(() => { 1247 $$invalidate(1, processingVideo = false); 1248 }); 1249 }; 1250 1251 $$self.$$set = $$props => {
1252 if ('videoElement' in $$props) $$invalidate(2, videoElement = $$props.videoElement); 1253 if ('showRedo' in $$props) $$invalidate(3, showRedo = $$props.showRedo); 1254 if ('interactive' in $$props) $$invalidate(4, interactive = $$props.interactive); 1255 if ('mode' in $$props) $$invalidate(0, mode = $$props.mode); 1256 if ('handle_reset_value' in $$props) $$invalidate(5, handle_reset_value = $$props.handle_reset_value); 1257 if ('handle_trim_video' in $$props) $$invalidate(6, handle_trim_video = $$props.handle_trim_video); 1258 if ('processingVideo' in $$props) $$invalidate(1, processingVideo = $$props.processingVideo); 1259 }; 1260 1261 $$self.$$.update = () => { 1262 if ($$self.$$.dirty & /*mode, trimmedDuration, videoElement*/ 133) { 1263 if (mode === "edit" && trimmedDuration === null && videoElement) $$invalidate(7, trimmedDuration = videoElement.duration); 1264 } 1265 }; 1266 1267 return [ 1268 mode, 1269 processingVideo, 1270 videoElement, 1271 showRedo, 1272 interactive, 1273 handle_reset_value, 1274 handle_trim_video, 1275 trimmedDuration, 1276 ffmpeg, 1277 dragStart, 1278 dragEnd, 1279 loadingTimeline, 1280 formatTime, 1281 toggleTrimmingMode, 1282 videotimeline_dragStart_binding, 1283 videotimeline_dragEnd_binding, 1284 videotimeline_trimmedDuration_binding, 1285 videotimeline_loadingTimeline_binding, 1286 click_handler, 1287 click_handler_1 1288 ]; 1289} 1290 1291class VideoControls extends SvelteComponent$4 { 1292 constructor(options) { 1293 super(); 1294 1295 init$4(this, options, instance$4, create_fragment$4, safe_not_equal$4, { 1296 videoElement: 2, 1297 showRedo: 3, 1298 interactive: 4, 1299 mode: 0, 1300 handle_reset_value: 5, 1301 handle_trim_video: 6, 1302 processingVideo: 1 1303 }); 1304 } 1305} 1306 1307const Player_svelte_svelte_type_style_lang = ''; 1308 1309/* home/runner/work/gradio/gradio/js/video/shared/Player.svelte generated by Svelte v4.2.2 */ 1310const { 1311 SvelteComponent: SvelteComponent$3, 1312 add_flush_callback: add_flush_callback$1, 1313 append: append$2, 1314 attr: attr$2, 1315 bind: bind$1, 1316 binding_callbacks: binding_callbacks$1, 1317 bubble: bubble$2, 1318 check_outros: check_outros$3, 1319 create_component: create_component$3, 1320 destroy_component: destroy_component$3, 1321 detach: detach$3, 1322 element: element$2, 1323 empty: empty$3, 1324 group_outros: group_outros$3, 1325 init: init$3, 1326 insert: insert$3, 1327 listen, 1328 mount_component: mount_component$3, 1329 prevent_default, 1330 run_all, 1331 safe_not_equal: safe_not_equal$3, 1332 set_data: set_data$1, 1333 space: space$3, 1334 src_url_equal, 1335 stop_propagation, 1336 text: text$1, 1337 toggle_class, 1338 transition_in: transition_in$3, 1339 transition_out: transition_out$3 1340} = window.__gradio__svelte__internal; 1341const { createEventDispatcher: createEventDispatcher$2 } = window.__gradio__svelte__internal; 1342function create_default_slot$3(ctx) { 1343 let track; 1344 let track_src_value; 1345 1346 return { 1347 c() { 1348 track = element$2("track"); 1349 attr$2(track, "kind", "captions"); 1350 if (!src_url_equal(track.src, track_src_value = /*subtitle*/ ctx[1])) attr$2(track, "src", track_src_value); 1351 track.default = true; 1352 }, 1353 m(target, anchor) { 1354 insert$3(target, track, anchor); 1355 }, 1356 p(ctx, dirty) { 1357 if (dirty & /*subtitle*/ 2 && !src_url_equal(track.src, track_src_value = /*subtitle*/ ctx[1])) { 1358 attr$2(track, "src", track_src_value); 1359 } 1360 }, 1361 d(detaching) { 1362 if (detaching) { 1363 detach$3(track); 1364 } 1365 } 1366 }; 1367} 1368 1369// (112:4) {:else} 1370function create_else_block$3(ctx) { 1371 let pause; 1372 let current; 1373 pause = new Pause({}); 1374 1375 return { 1376 c() { 1377 create_component$3(pause.$$.fragment); 1378 }, 1379 m(target, anchor) { 1380 mount_component$3(pause, target, anchor); 1381 current = true; 1382 }, 1383 i(local) { 1384 if (current) return; 1385 transition_in$3(pause.$$.fragment, local); 1386 current = true; 1387 }, 1388 o(local) { 1389 transition_out$3(pause.$$.fragment, local); 1390 current = false; 1391 }, 1392 d(detaching) { 1393 destroy_component$3(pause, detaching); 1394 } 1395 }; 1396} 1397 1398// (110:21) 1399function create_if_block_2$2(ctx) { 1400 let play; 1401 let current; 1402 play = new Play({}); 1403 1404 return { 1405 c() { 1406 create_component$3(play.$$.fragment); 1407 }, 1408 m(target, anchor) { 1409 mount_component$3(play, target, anchor); 1410 current = true; 1411 }, 1412 i(local) { 1413 if (current) return; 1414 transition_in$3(play.$$.fragment, local); 1415 current = true; 1416 }, 1417 o(local) { 1418 transition_out$3(play.$$.fragment, local); 1419 current = false;
1420 }, 1421 d(detaching) { 1422 destroy_component$3(play, detaching); 1423 } 1424 }; 1425} 1426 1427// (108:4) {#if time === duration} 1428function create_if_block_1$2(ctx) { 1429 let undo; 1430 let current; 1431 undo = new Undo({}); 1432 1433 return { 1434 c() { 1435 create_component$3(undo.$$.fragment); 1436 }, 1437 m(target, anchor) { 1438 mount_component$3(undo, target, anchor); 1439 current = true; 1440 }, 1441 i(local) { 1442 if (current) return; 1443 transition_in$3(undo.$$.fragment, local); 1444 current = true; 1445 }, 1446 o(local) { 1447 transition_out$3(undo.$$.fragment, local); 1448 current = false; 1449 }, 1450 d(detaching) { 1451 destroy_component$3(undo, detaching); 1452 } 1453 }; 1454} 1455 1456// (142:0) {#if interactive} 1457function create_if_block$3(ctx) { 1458 let videocontrols; 1459 let updating_processingVideo; 1460 let current; 1461 1462 function videocontrols_processingVideo_binding(value) { 1463 /*videocontrols_processingVideo_binding*/ ctx[26](value); 1464 } 1465 1466 let videocontrols_props = { 1467 videoElement: /*video*/ ctx[10], 1468 showRedo: true, 1469 handle_trim_video: /*handle_trim_video*/ ctx[16], 1470 handle_reset_value: /*handle_reset_value*/ ctx[6] 1471 }; 1472 1473 if (/*processingVideo*/ ctx[11] !== void 0) { 1474 videocontrols_props.processingVideo = /*processingVideo*/ ctx[11]; 1475 } 1476 1477 videocontrols = new VideoControls({ props: videocontrols_props }); 1478 binding_callbacks$1.push(() => bind$1(videocontrols, 'processingVideo', videocontrols_processingVideo_binding)); 1479 1480 return { 1481 c() { 1482 create_component$3(videocontrols.$$.fragment); 1483 }, 1484 m(target, anchor) { 1485 mount_component$3(videocontrols, target, anchor); 1486 current = true; 1487 }, 1488 p(ctx, dirty) { 1489 const videocontrols_changes = {}; 1490 if (dirty & /*video*/ 1024) videocontrols_changes.videoElement = /*video*/ ctx[10]; 1491 if (dirty & /*handle_reset_value*/ 64) videocontrols_changes.handle_reset_value = /*handle_reset_value*/ ctx[6]; 1492 1493 if (!updating_processingVideo && dirty & /*processingVideo*/ 2048) { 1494 updating_processingVideo = true; 1495 videocontrols_changes.processingVideo = /*processingVideo*/ ctx[11]; 1496 add_flush_callback$1(() => updating_processingVideo = false); 1497 } 1498 1499 videocontrols.$set(videocontrols_changes); 1500 }, 1501 i(local) { 1502 if (current) return; 1503 transition_in$3(videocontrols.$$.fragment, local); 1504 current = true; 1505 }, 1506 o(local) { 1507 transition_out$3(videocontrols.$$.fragment, local); 1508 current = false; 1509 }, 1510 d(detaching) { 1511 destroy_component$3(videocontrols, detaching); 1512 } 1513 }; 1514} 1515 1516function create_fragment$3(ctx) { 1517 let div4; 1518 let div0; 1519 let video_1; 1520 let updating_currentTime; 1521 let updating_duration; 1522 let updating_paused; 1523 let updating_node; 1524 let t0; 1525 let div3; 1526 let div2; 1527 let span0; 1528 let current_block_type_index; 1529 let if_block0; 1530 let t1; 1531 let span1; 1532 let t2_value = format(/*time*/ ctx[7]) + ""; 1533 let t2; 1534 let t3; 1535 let t4_value = format(/*duration*/ ctx[8]) + ""; 1536 let t4; 1537 let t5; 1538 let progress; 1539 let progress_value_value; 1540 let t6; 1541 let div1; 1542 let maximise; 1543 let t7; 1544 let if_block1_anchor; 1545 let current; 1546 let mounted; 1547 let dispose; 1548 1549 function video_1_currentTime_binding(value) { 1550 /*video_1_currentTime_binding*/ ctx[20](value); 1551 } 1552 1553 function video_1_duration_binding(value) { 1554 /*video_1_duration_binding*/ ctx[21](value); 1555 } 1556 1557 function video_1_paused_binding(value) { 1558 /*video_1_paused_binding*/ ctx[22](value); 1559 } 1560 1561 function video_1_node_binding(value) { 1562 /*video_1_node_binding*/ ctx[23](value); 1563 } 1564 1565 let video_1_props = { 1566 src: /*src*/ ctx[0], 1567 preload: "auto", 1568 autoplay: /*autoplay*/ ctx[3], 1569 "data-testid": `${/*label*/ ctx[4]}-player`, 1570 processingVideo: /*processingVideo*/ ctx[11], 1571 $$slots: { default: [create_default_slot$3] }, 1572 $$scope: { ctx } 1573 }; 1574 1575 if (/*time*/ ctx[7] !== void 0) { 1576 video_1_props.currentTime = /*time*/ ctx[7]; 1577 } 1578 1579 if (/*duration*/ ctx[8] !== void 0) { 1580 video_1_props.duration = /*duration*/ ctx[8]; 1581 } 1582 1583 if (/*paused*/ ctx[9] !== void 0) { 1584 video_1_props.paused = /*paused*/ ctx[9]; 1585 } 1586 1587 if (/*video*/ ctx[10] !== void 0) { 1588 video_1_props.node = /*video*/ ctx[10]; 1589 } 1590 1591 video_1 = new Video$2({ props: video_1_props }); 1592 binding_callbacks$1.push(() => bind$1(video_1, 'currentTime', video_1_currentTime_binding)); 1593 binding_callbacks$1.push(() => bind$1(video_1, 'duration', video_1_duration_binding)); 1594 binding_callbacks$1.push(() => bind$1(video_1, 'paused', video_1_paused_binding)); 1595 binding_callbacks$1.push(() => bind$1(video_1, 'node', video_1_node_binding)); 1596 video_1.$on("click", /*play_pause*/ ctx[13]); 1597 video_1.$on("play", /*play_handler*/ ctx[24]); 1598 video_1.$on("pause", /*pause_handler*/ ctx[25]); 1599 video_1.$on("ended", /*handle_end*/ ctx[15]); 1600 const if_block_creators = [create_if_block_1$2, create_if_block_2$2, create_else_block$3]; 1601 const if_blocks = []; 1602 1603 function select_block_type(ctx, dirty) { 1604 if (/*time*/ ctx[7] === /*duration*/ ctx[8]) return 0; 1605 if (/*paused*/ ctx[9]) return 1; 1606 return 2; 1607 } 1608 1609 current_block_type_index = select_block_type(ctx); 1610 if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 1611 maximise = new Maximise({}); 1612 let if_block1 = /*interactive*/ ctx[5] && create_if_block$3(ctx); 1613 1614 return { 1615 c() { 1616 div4 = element$2("div"); 1617 div0 = element$2("div"); 1618 create_component$3(video_1.$$.fragment); 1619 t0 = space$3(); 1620 div3 = element$2("div"); 1621 div2 = element$2("div"); 1622 span0 = element$2("span"); 1623 if_block0.c(); 1624 t1 = space$3(); 1625 span1 = element$2("span"); 1626 t2 = text$1(t2_value); 1627 t3 = text$1(" / "); 1628 t4 = text$1(t4_value); 1629 t5 = space$3(); 1630 progress = element$2("progress"); 1631 t6 = space$3(); 1632 div1 = element$2("div"); 1633 create_component$3(maximise.$$.fragment); 1634 t7 = space$3(); 1635 if (if_block1) if_block1.c(); 1636 if_block1_anchor = empty$3(); 1637 attr$2(div0, "class", "mirror-wrap svelte-euo1cw"); 1638 toggle_class(div0, "mirror", /*mirror*/ ctx[2]); 1639 attr$2(span0, "role", "button"); 1640 attr$2(span0, "tabindex", "0"); 1641 attr$2(span0, "class", "icon svelte-euo1cw"); 1642 attr$2(span0, "aria-label", "play-pause-replay-button"); 1643 attr$2(span1, "class", "time svelte-euo1cw"); 1644 progress.value = progress_value_value = /*time*/ ctx[7] / /*duration*/ ctx[8] || 0; 1645 attr$2(progress, "class", "svelte-euo1cw"); 1646 attr$2(div1, "role", "button"); 1647 attr$2(div1, "tabindex", "0"); 1648 attr$2(div1, "class", "icon svelte-euo1cw"); 1649 attr$2(div1, "aria-label", "full-screen"); 1650 attr$2(div2, "class", "inner svelte-euo1cw"); 1651 attr$2(div3, "class", "controls svelte-euo1cw"); 1652 attr$2(div4, "class", "wrap svelte-euo1cw"); 1653 }, 1654 m(target, anchor) { 1655 insert$3(target, div4, anchor); 1656 append$2(div4, div0);
1657 mount_component$3(video_1, div0, null); 1658 append$2(div4, t0); 1659 append$2(div4, div3); 1660 append$2(div3, div2); 1661 append$2(div2, span0); 1662 if_blocks[current_block_type_index].m(span0, null); 1663 append$2(div2, t1); 1664 append$2(div2, span1); 1665 append$2(span1, t2); 1666 append$2(span1, t3); 1667 append$2(span1, t4); 1668 append$2(div2, t5); 1669 append$2(div2, progress); 1670 append$2(div2, t6); 1671 append$2(div2, div1); 1672 mount_component$3(maximise, div1, null); 1673 insert$3(target, t7, anchor); 1674 if (if_block1) if_block1.m(target, anchor); 1675 insert$3(target, if_block1_anchor, anchor); 1676 current = true; 1677 1678 if (!mounted) { 1679 dispose = [ 1680 listen(span0, "click", /*play_pause*/ ctx[13]), 1681 listen(span0, "keydown", /*play_pause*/ ctx[13]), 1682 listen(progress, "mousemove", /*handleMove*/ ctx[12]), 1683 listen(progress, "touchmove", prevent_default(/*handleMove*/ ctx[12])), 1684 listen(progress, "click", stop_propagation(prevent_default(/*handle_click*/ ctx[14]))), 1685 listen(div1, "click", /*open_full_screen*/ ctx[17]), 1686 listen(div1, "keypress", /*open_full_screen*/ ctx[17]) 1687 ]; 1688 1689 mounted = true; 1690 } 1691 }, 1692 p(ctx, [dirty]) { 1693 const video_1_changes = {}; 1694 if (dirty & /*src*/ 1) video_1_changes.src = /*src*/ ctx[0]; 1695 if (dirty & /*autoplay*/ 8) video_1_changes.autoplay = /*autoplay*/ ctx[3]; 1696 if (dirty & /*label*/ 16) video_1_changes["data-testid"] = `${/*label*/ ctx[4]}-player`; 1697 if (dirty & /*processingVideo*/ 2048) video_1_changes.processingVideo = /*processingVideo*/ ctx[11]; 1698 1699 if (dirty & /*$$scope, subtitle*/ 268435458) { 1700 video_1_changes.$$scope = { dirty, ctx }; 1701 } 1702 1703 if (!updating_currentTime && dirty & /*time*/ 128) { 1704 updating_currentTime = true; 1705 video_1_changes.currentTime = /*time*/ ctx[7]; 1706 add_flush_callback$1(() => updating_currentTime = false); 1707 } 1708 1709 if (!updating_duration && dirty & /*duration*/ 256) { 1710 updating_duration = true; 1711 video_1_changes.duration = /*duration*/ ctx[8]; 1712 add_flush_callback$1(() => updating_duration = false); 1713 } 1714 1715 if (!updating_paused && dirty & /*paused*/ 512) { 1716 updating_paused = true; 1717 video_1_changes.paused = /*paused*/ ctx[9]; 1718 add_flush_callback$1(() => updating_paused = false); 1719 } 1720 1721 if (!updating_node && dirty & /*video*/ 1024) { 1722 updating_node = true; 1723 video_1_changes.node = /*video*/ ctx[10]; 1724 add_flush_callback$1(() => updating_node = false); 1725 } 1726 1727 video_1.$set(video_1_changes); 1728 1729 if (!current || dirty & /*mirror*/ 4) { 1730 toggle_class(div0, "mirror", /*mirror*/ ctx[2]); 1731 } 1732 1733 let previous_block_index = current_block_type_index; 1734 current_block_type_index = select_block_type(ctx); 1735 1736 if (current_block_type_index !== previous_block_index) { 1737 group_outros$3(); 1738 1739 transition_out$3(if_blocks[previous_block_index], 1, 1, () => { 1740 if_blocks[previous_block_index] = null; 1741 }); 1742 1743 check_outros$3(); 1744 if_block0 = if_blocks[current_block_type_index]; 1745 1746 if (!if_block0) { 1747 if_block0 = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 1748 if_block0.c(); 1749 } 1750 1751 transition_in$3(if_block0, 1); 1752 if_block0.m(span0, null); 1753 } 1754 1755 if ((!current || dirty & /*time*/ 128) && t2_value !== (t2_value = format(/*time*/ ctx[7]) + "")) set_data$1(t2, t2_value); 1756 if ((!current || dirty & /*duration*/ 256) && t4_value !== (t4_value = format(/*duration*/ ctx[8]) + "")) set_data$1(t4, t4_value); 1757 1758 if (!current || dirty & /*time, duration*/ 384 && progress_value_value !== (progress_value_value = /*time*/ ctx[7] / /*duration*/ ctx[8] || 0)) { 1759 progress.value = progress_value_value; 1760 } 1761 1762 if (/*interactive*/ ctx[5]) { 1763 if (if_block1) { 1764 if_block1.p(ctx, dirty); 1765 1766 if (dirty & /*interactive*/ 32) { 1767 transition_in$3(if_block1, 1); 1768 } 1769 } else { 1770 if_block1 = create_if_block$3(ctx); 1771 if_block1.c(); 1772 transition_in$3(if_block1, 1); 1773 if_block1.m(if_block1_anchor.parentNode, if_block1_anchor); 1774 } 1775 } else if (if_block1) { 1776 group_outros$3(); 1777 1778 transition_out$3(if_block1, 1, 1, () => { 1779 if_block1 = null; 1780 }); 1781 1782 check_outros$3(); 1783 } 1784 }, 1785 i(local) { 1786 if (current) return; 1787 transition_in$3(video_1.$$.fragment, local); 1788 transition_in$3(if_block0); 1789 transition_in$3(maximise.$$.fragment, local); 1790 transition_in$3(if_block1); 1791 current = true; 1792 }, 1793 o(local) { 1794 transition_out$3(video_1.$$.fragment, local); 1795 transition_out$3(if_block0); 1796 transition_out$3(maximise.$$.fragment, local); 1797 transition_out$3(if_block1); 1798 current = false;
1799 }, 1800 d(detaching) { 1801 if (detaching) { 1802 detach$3(div4); 1803 detach$3(t7); 1804 detach$3(if_block1_anchor); 1805 } 1806 1807 destroy_component$3(video_1); 1808 if_blocks[current_block_type_index].d(); 1809 destroy_component$3(maximise); 1810 if (if_block1) if_block1.d(detaching); 1811 mounted = false; 1812 run_all(dispose); 1813 } 1814 }; 1815} 1816 1817function format(seconds) { 1818 if (isNaN(seconds) || !isFinite(seconds)) return "..."; 1819 const minutes = Math.floor(seconds / 60); 1820 let _seconds = Math.floor(seconds % 60); 1821 if (_seconds < 10) _seconds = `0${_seconds}`; 1822 return `${minutes}:${_seconds}`; 1823} 1824 1825function instance$3($$self, $$props, $$invalidate) { 1826 let { root = "" } = $$props; 1827 let { src } = $$props; 1828 let { subtitle = null } = $$props; 1829 let { mirror } = $$props; 1830 let { autoplay } = $$props; 1831 let { label = "test" } = $$props; 1832 let { interactive = false } = $$props; 1833 1834 let { handle_change = () => { 1835 1836 } } = $$props; 1837 1838 let { handle_reset_value = () => { 1839 1840 } } = $$props; 1841 1842 const dispatch = createEventDispatcher$2(); 1843 let time = 0; 1844 let duration; 1845 let paused = true; 1846 let video; 1847 let processingVideo = false; 1848 1849 function handleMove(e) { 1850 if (!duration) return; 1851 1852 if (e.type === "click") { 1853 handle_click(e); 1854 return; 1855 } 1856 1857 if (e.type !== "touchmove" && !(e.buttons & 1)) return; 1858 1859 const clientX = e.type === "touchmove" 1860 ? e.touches[0].clientX 1861 : e.clientX; 1862 1863 const { left, right } = e.currentTarget.getBoundingClientRect(); 1864 $$invalidate(7, time = duration * (clientX - left) / (right - left)); 1865 } 1866 1867 async function play_pause() { 1868 if (document.fullscreenElement != video) { 1869 const isPlaying = video.currentTime > 0 && !video.paused && !video.ended && video.readyState > video.HAVE_CURRENT_DATA; 1870 1871 if (!isPlaying) { 1872 await video.play(); 1873 } else video.pause(); 1874 } 1875 } 1876 1877 function handle_click(e) { 1878 const { left, right } = e.currentTarget.getBoundingClientRect(); 1879 $$invalidate(7, time = duration * (e.clientX - left) / (right - left)); 1880 } 1881 1882 function handle_end() { 1883 dispatch("stop"); 1884 dispatch("end"); 1885 } 1886 1887 const handle_trim_video = async videoBlob => { 1888 let _video_blob = new File([videoBlob], "video.mp4"); 1889 const val = await prepare_files([_video_blob]); 1890 let value = (await upload(val, root))?.filter(Boolean)[0]; 1891 handle_change(value); 1892 }; 1893 1894 function open_full_screen() { 1895 video.requestFullscreen(); 1896 } 1897 1898 function video_1_currentTime_binding(value) { 1899 time = value; 1900 $$invalidate(7, time); 1901 } 1902 1903 function video_1_duration_binding(value) { 1904 duration = value; 1905 $$invalidate(8, duration); 1906 } 1907 1908 function video_1_paused_binding(value) { 1909 paused = value; 1910 $$invalidate(9, paused); 1911 } 1912 1913 function video_1_node_binding(value) { 1914 video = value; 1915 $$invalidate(10, video); 1916 } 1917 1918 function play_handler(event) { 1919 bubble$2.call(this, $$self, event); 1920 } 1921 1922 function pause_handler(event) { 1923 bubble$2.call(this, $$self, event); 1924 } 1925 1926 function videocontrols_processingVideo_binding(value) { 1927 processingVideo = value; 1928 $$invalidate(11, processingVideo); 1929 } 1930 1931 $$self.$$set = $$props => {
1932 if ('root' in $$props) $$invalidate(18, root = $$props.root); 1933 if ('src' in $$props) $$invalidate(0, src = $$props.src); 1934 if ('subtitle' in $$props) $$invalidate(1, subtitle = $$props.subtitle); 1935 if ('mirror' in $$props) $$invalidate(2, mirror = $$props.mirror); 1936 if ('autoplay' in $$props) $$invalidate(3, autoplay = $$props.autoplay); 1937 if ('label' in $$props) $$invalidate(4, label = $$props.label); 1938 if ('interactive' in $$props) $$invalidate(5, interactive = $$props.interactive); 1939 if ('handle_change' in $$props) $$invalidate(19, handle_change = $$props.handle_change); 1940 if ('handle_reset_value' in $$props) $$invalidate(6, handle_reset_value = $$props.handle_reset_value); 1941 }; 1942 1943 return [ 1944 src, 1945 subtitle, 1946 mirror, 1947 autoplay, 1948 label, 1949 interactive, 1950 handle_reset_value, 1951 time, 1952 duration, 1953 paused, 1954 video, 1955 processingVideo, 1956 handleMove, 1957 play_pause, 1958 handle_click, 1959 handle_end, 1960 handle_trim_video, 1961 open_full_screen, 1962 root, 1963 handle_change, 1964 video_1_currentTime_binding, 1965 video_1_duration_binding, 1966 video_1_paused_binding, 1967 video_1_node_binding, 1968 play_handler, 1969 pause_handler, 1970 videocontrols_processingVideo_binding 1971 ]; 1972} 1973 1974class Player extends SvelteComponent$3 { 1975 constructor(options) { 1976 super(); 1977 1978 init$3(this, options, instance$3, create_fragment$3, safe_not_equal$3, { 1979 root: 18, 1980 src: 0, 1981 subtitle: 1, 1982 mirror: 2, 1983 autoplay: 3, 1984 label: 4, 1985 interactive: 5, 1986 handle_change: 19, 1987 handle_reset_value: 6 1988 }); 1989 } 1990} 1991 1992const Player$1 = Player; 1993 1994const InteractiveVideo_svelte_svelte_type_style_lang = ''; 1995 1996/* home/runner/work/gradio/gradio/js/video/shared/InteractiveVideo.svelte generated by Svelte v4.2.2 */ 1997const { 1998 SvelteComponent: SvelteComponent$2, 1999 add_flush_callback, 2000 append: append$1, 2001 attr: attr$1, 2002 bind, 2003 binding_callbacks, 2004 bubble: bubble$1, 2005 check_outros: check_outros$2, 2006 create_component: create_component$2, 2007 create_slot, 2008 destroy_component: destroy_component$2, 2009 detach: detach$2, 2010 element: element$1, 2011 empty: empty$2, 2012 get_all_dirty_from_scope, 2013 get_slot_changes, 2014 group_outros: group_outros$2, 2015 init: init$2, 2016 insert: insert$2, 2017 mount_component: mount_component$2, 2018 noop: noop$1, 2019 safe_not_equal: safe_not_equal$2, 2020 set_data, 2021 space: space$2, 2022 text, 2023 transition_in: transition_in$2, 2024 transition_out: transition_out$2, 2025 update_slot_base 2026} = window.__gradio__svelte__internal; 2027const { createEventDispatcher: createEventDispatcher$1 } = window.__gradio__svelte__internal; 2028function create_else_block$2(ctx) { 2029 let modifyupload; 2030 let t; 2031 let show_if; 2032 let current_block_type_index; 2033 let if_block; 2034 let if_block_anchor; 2035 let current; 2036 modifyupload = new ModifyUpload({ props: { i18n: /*i18n*/ ctx[10] } }); 2037 modifyupload.$on("clear", /*handle_clear*/ ctx[15]); 2038 const if_block_creators = [create_if_block_3, create_if_block_4]; 2039 const if_blocks = []; 2040 2041 function select_block_type_2(ctx, dirty) { 2042 if (show_if == null) show_if = !!playable(); 2043 if (show_if) return 0; 2044 if (/*value*/ ctx[0].size) return 1; 2045 return -1; 2046 } 2047 2048 if (~(current_block_type_index = select_block_type_2(ctx))) { 2049 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2050 } 2051 2052 return { 2053 c() { 2054 create_component$2(modifyupload.$$.fragment); 2055 t = space$2(); 2056 if (if_block) if_block.c(); 2057 if_block_anchor = empty$2(); 2058 }, 2059 m(target, anchor) { 2060 mount_component$2(modifyupload, target, anchor); 2061 insert$2(target, t, anchor); 2062 2063 if (~current_block_type_index) { 2064 if_blocks[current_block_type_index].m(target, anchor); 2065 } 2066 2067 insert$2(target, if_block_anchor, anchor); 2068 current = true; 2069 }, 2070 p(ctx, dirty) { 2071 const modifyupload_changes = {}; 2072 if (dirty & /*i18n*/ 1024) modifyupload_changes.i18n = /*i18n*/ ctx[10]; 2073 modifyupload.$set(modifyupload_changes); 2074 let previous_block_index = current_block_type_index; 2075 current_block_type_index = select_block_type_2(ctx); 2076 2077 if (current_block_type_index === previous_block_index) { 2078 if (~current_block_type_index) { 2079 if_blocks[current_block_type_index].p(ctx, dirty); 2080 } 2081 } else { 2082 if (if_block) { 2083 group_outros$2(); 2084 2085 transition_out$2(if_blocks[previous_block_index], 1, 1, () => { 2086 if_blocks[previous_block_index] = null; 2087 }); 2088 2089 check_outros$2(); 2090 } 2091 2092 if (~current_block_type_index) { 2093 if_block = if_blocks[current_block_type_index]; 2094 2095 if (!if_block) { 2096 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2097 if_block.c(); 2098 } else { 2099 if_block.p(ctx, dirty); 2100 } 2101 2102 transition_in$2(if_block, 1); 2103 if_block.m(if_block_anchor.parentNode, if_block_anchor); 2104 } else { 2105 if_block = null; 2106 } 2107 } 2108 }, 2109 i(local) { 2110 if (current) return; 2111 transition_in$2(modifyupload.$$.fragment, local); 2112 transition_in$2(if_block); 2113 current = true; 2114 }, 2115 o(local) { 2116 transition_out$2(modifyupload.$$.fragment, local); 2117 transition_out$2(if_block); 2118 current = false;
2119 }, 2120 d(detaching) { 2121 if (detaching) { 2122 detach$2(t); 2123 detach$2(if_block_anchor); 2124 } 2125 2126 destroy_component$2(modifyupload, detaching); 2127 2128 if (~current_block_type_index) { 2129 if_blocks[current_block_type_index].d(detaching); 2130 } 2131 } 2132 }; 2133} 2134 2135// (41:1) {#if value === null || value.url === undefined} 2136function create_if_block$2(ctx) { 2137 let div; 2138 let current_block_type_index; 2139 let if_block; 2140 let current; 2141 const if_block_creators = [create_if_block_1$1, create_if_block_2$1]; 2142 const if_blocks = []; 2143 2144 function select_block_type_1(ctx, dirty) { 2145 if (/*active_source*/ ctx[1] === "upload") return 0; 2146 if (/*active_source*/ ctx[1] === "webcam") return 1; 2147 return -1; 2148 } 2149 2150 if (~(current_block_type_index = select_block_type_1(ctx))) { 2151 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2152 } 2153 2154 return { 2155 c() { 2156 div = element$1("div"); 2157 if (if_block) if_block.c(); 2158 attr$1(div, "class", "upload-container svelte-1cs6pot"); 2159 }, 2160 m(target, anchor) { 2161 insert$2(target, div, anchor); 2162 2163 if (~current_block_type_index) { 2164 if_blocks[current_block_type_index].m(div, null); 2165 } 2166 2167 current = true; 2168 }, 2169 p(ctx, dirty) { 2170 let previous_block_index = current_block_type_index; 2171 current_block_type_index = select_block_type_1(ctx); 2172 2173 if (current_block_type_index === previous_block_index) { 2174 if (~current_block_type_index) { 2175 if_blocks[current_block_type_index].p(ctx, dirty); 2176 } 2177 } else { 2178 if (if_block) { 2179 group_outros$2(); 2180 2181 transition_out$2(if_blocks[previous_block_index], 1, 1, () => { 2182 if_blocks[previous_block_index] = null; 2183 }); 2184 2185 check_outros$2(); 2186 } 2187 2188 if (~current_block_type_index) { 2189 if_block = if_blocks[current_block_type_index]; 2190 2191 if (!if_block) { 2192 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2193 if_block.c(); 2194 } else { 2195 if_block.p(ctx, dirty); 2196 } 2197 2198 transition_in$2(if_block, 1); 2199 if_block.m(div, null); 2200 } else { 2201 if_block = null; 2202 } 2203 } 2204 }, 2205 i(local) { 2206 if (current) return; 2207 transition_in$2(if_block); 2208 current = true; 2209 }, 2210 o(local) { 2211 transition_out$2(if_block); 2212 current = false; 2213 }, 2214 d(detaching) { 2215 if (detaching) { 2216 detach$2(div); 2217 } 2218 2219 if (~current_block_type_index) { 2220 if_blocks[current_block_type_index].d(); 2221 } 2222 } 2223 }; 2224} 2225 2226// (86:23) 2227function create_if_block_4(ctx) { 2228 let div0; 2229 let t0_value = (/*value*/ ctx[0].orig_name || /*value*/ ctx[0].url) + ""; 2230 let t0; 2231 let t1; 2232 let div1; 2233 let t2_value = prettyBytes(/*value*/ ctx[0].size) + ""; 2234 let t2; 2235 2236 return { 2237 c() { 2238 div0 = element$1("div"); 2239 t0 = text(t0_value); 2240 t1 = space$2(); 2241 div1 = element$1("div"); 2242 t2 = text(t2_value); 2243 attr$1(div0, "class", "file-name svelte-1cs6pot"); 2244 attr$1(div1, "class", "file-size svelte-1cs6pot"); 2245 }, 2246 m(target, anchor) { 2247 insert$2(target, div0, anchor); 2248 append$1(div0, t0); 2249 insert$2(target, t1, anchor); 2250 insert$2(target, div1, anchor); 2251 append$1(div1, t2); 2252 }, 2253 p(ctx, dirty) { 2254 if (dirty & /*value*/ 1 && t0_value !== (t0_value = (/*value*/ ctx[0].orig_name || /*value*/ ctx[0].url) + "")) set_data(t0, t0_value); 2255 if (dirty & /*value*/ 1 && t2_value !== (t2_value = prettyBytes(/*value*/ ctx[0].size) + "")) set_data(t2, t2_value); 2256 }, 2257 i: noop$1, 2258 o: noop$1, 2259 d(detaching) { 2260 if (detaching) { 2261 detach$2(div0); 2262 detach$2(t1); 2263 detach$2(div1); 2264 } 2265 } 2266 }; 2267} 2268 2269// (68:2) {#if playable()} 2270function create_if_block_3(ctx) { 2271 let previous_key = /*value*/ ctx[0]?.url; 2272 let key_block_anchor; 2273 let current; 2274 let key_block = create_key_block$1(ctx); 2275 2276 return { 2277 c() { 2278 key_block.c(); 2279 key_block_anchor = empty$2(); 2280 }, 2281 m(target, anchor) { 2282 key_block.m(target, anchor); 2283 insert$2(target, key_block_anchor, anchor); 2284 current = true; 2285 }, 2286 p(ctx, dirty) { 2287 if (dirty & /*value*/ 1 && safe_not_equal$2(previous_key, previous_key = /*value*/ ctx[0]?.url)) { 2288 group_outros$2(); 2289 transition_out$2(key_block, 1, 1, noop$1); 2290 check_outros$2(); 2291 key_block = create_key_block$1(ctx); 2292 key_block.c(); 2293 transition_in$2(key_block, 1); 2294 key_block.m(key_block_anchor.parentNode, key_block_anchor); 2295 } else { 2296 key_block.p(ctx, dirty); 2297 } 2298 }, 2299 i(local) { 2300 if (current) return; 2301 transition_in$2(key_block); 2302 current = true; 2303 }, 2304 o(local) { 2305 transition_out$2(key_block); 2306 current = false;
2307 }, 2308 d(detaching) { 2309 if (detaching) { 2310 detach$2(key_block_anchor); 2311 } 2312 2313 key_block.d(detaching); 2314 } 2315 }; 2316} 2317 2318// (69:3) {#key value?.url} 2319function create_key_block$1(ctx) { 2320 let player; 2321 let current; 2322 2323 player = new Player$1({ 2324 props: { 2325 root: /*root*/ ctx[9], 2326 interactive: true, 2327 autoplay: /*autoplay*/ ctx[8], 2328 src: /*value*/ ctx[0].url, 2329 subtitle: /*subtitle*/ ctx[2]?.url, 2330 mirror: /*mirror_webcam*/ ctx[6] && /*active_source*/ ctx[1] === "webcam", 2331 label: /*label*/ ctx[4], 2332 handle_change: /*handle_change*/ ctx[16], 2333 handle_reset_value: /*handle_reset_value*/ ctx[11] 2334 } 2335 }); 2336 2337 player.$on("play", /*play_handler*/ ctx[24]); 2338 player.$on("pause", /*pause_handler*/ ctx[25]); 2339 player.$on("stop", /*stop_handler*/ ctx[26]); 2340 player.$on("end", /*end_handler*/ ctx[27]); 2341 2342 return { 2343 c() { 2344 create_component$2(player.$$.fragment); 2345 }, 2346 m(target, anchor) { 2347 mount_component$2(player, target, anchor); 2348 current = true; 2349 }, 2350 p(ctx, dirty) { 2351 const player_changes = {}; 2352 if (dirty & /*root*/ 512) player_changes.root = /*root*/ ctx[9]; 2353 if (dirty & /*autoplay*/ 256) player_changes.autoplay = /*autoplay*/ ctx[8]; 2354 if (dirty & /*value*/ 1) player_changes.src = /*value*/ ctx[0].url; 2355 if (dirty & /*subtitle*/ 4) player_changes.subtitle = /*subtitle*/ ctx[2]?.url; 2356 if (dirty & /*mirror_webcam, active_source*/ 66) player_changes.mirror = /*mirror_webcam*/ ctx[6] && /*active_source*/ ctx[1] === "webcam"; 2357 if (dirty & /*label*/ 16) player_changes.label = /*label*/ ctx[4]; 2358 if (dirty & /*handle_reset_value*/ 2048) player_changes.handle_reset_value = /*handle_reset_value*/ ctx[11]; 2359 player.$set(player_changes); 2360 }, 2361 i(local) { 2362 if (current) return; 2363 transition_in$2(player.$$.fragment, local); 2364 current = true; 2365 }, 2366 o(local) { 2367 transition_out$2(player.$$.fragment, local); 2368 current = false; 2369 }, 2370 d(detaching) { 2371 destroy_component$2(player, detaching); 2372 } 2373 }; 2374} 2375 2376// (53:40) 2377function create_if_block_2$1(ctx) { 2378 let webcam; 2379 let current; 2380 2381 webcam = new Webcam({ 2382 props: { 2383 mirror_webcam: /*mirror_webcam*/ ctx[6], 2384 include_audio: /*include_audio*/ ctx[7], 2385 mode: "video", 2386 i18n: /*i18n*/ ctx[10] 2387 } 2388 }); 2389 2390 webcam.$on("error", /*error_handler*/ ctx[20]); 2391 webcam.$on("capture", /*capture_handler*/ ctx[21]); 2392 webcam.$on("start_recording", /*start_recording_handler*/ ctx[22]); 2393 webcam.$on("stop_recording", /*stop_recording_handler*/ ctx[23]); 2394 2395 return { 2396 c() { 2397 create_component$2(webcam.$$.fragment); 2398 }, 2399 m(target, anchor) { 2400 mount_component$2(webcam, target, anchor); 2401 current = true; 2402 }, 2403 p(ctx, dirty) { 2404 const webcam_changes = {}; 2405 if (dirty & /*mirror_webcam*/ 64) webcam_changes.mirror_webcam = /*mirror_webcam*/ ctx[6]; 2406 if (dirty & /*include_audio*/ 128) webcam_changes.include_audio = /*include_audio*/ ctx[7]; 2407 if (dirty & /*i18n*/ 1024) webcam_changes.i18n = /*i18n*/ ctx[10]; 2408 webcam.$set(webcam_changes); 2409 }, 2410 i(local) { 2411 if (current) return; 2412 transition_in$2(webcam.$$.fragment, local); 2413 current = true; 2414 }, 2415 o(local) { 2416 transition_out$2(webcam.$$.fragment, local); 2417 current = false; 2418 }, 2419 d(detaching) { 2420 destroy_component$2(webcam, detaching); 2421 } 2422 }; 2423} 2424 2425// (43:3) {#if active_source === "upload"} 2426function create_if_block_1$1(ctx) { 2427 let upload; 2428 let updating_dragging; 2429 let current; 2430 2431 function upload_dragging_binding(value) { 2432 /*upload_dragging_binding*/ ctx[18](value); 2433 } 2434 2435 let upload_props = { 2436 filetype: "video/x-m4v,video/*", 2437 root: /*root*/ ctx[9], 2438 $$slots: { default: [create_default_slot$2] }, 2439 $$scope: { ctx } 2440 }; 2441 2442 if (/*dragging*/ ctx[12] !== void 0) { 2443 upload_props.dragging = /*dragging*/ ctx[12]; 2444 } 2445 2446 upload = new Upload({ props: upload_props }); 2447 binding_callbacks.push(() => bind(upload, 'dragging', upload_dragging_binding)); 2448 upload.$on("load", /*handle_load*/ ctx[14]); 2449 upload.$on("error", /*error_handler_1*/ ctx[19]); 2450 2451 return { 2452 c() { 2453 create_component$2(upload.$$.fragment); 2454 }, 2455 m(target, anchor) { 2456 mount_component$2(upload, target, anchor); 2457 current = true; 2458 }, 2459 p(ctx, dirty) { 2460 const upload_changes = {};
2461 if (dirty & /*root*/ 512) upload_changes.root = /*root*/ ctx[9]; 2462 2463 if (dirty & /*$$scope*/ 536870912) { 2464 upload_changes.$$scope = { dirty, ctx }; 2465 } 2466 2467 if (!updating_dragging && dirty & /*dragging*/ 4096) { 2468 updating_dragging = true; 2469 upload_changes.dragging = /*dragging*/ ctx[12]; 2470 add_flush_callback(() => updating_dragging = false); 2471 } 2472 2473 upload.$set(upload_changes); 2474 }, 2475 i(local) { 2476 if (current) return; 2477 transition_in$2(upload.$$.fragment, local); 2478 current = true; 2479 }, 2480 o(local) { 2481 transition_out$2(upload.$$.fragment, local); 2482 current = false; 2483 }, 2484 d(detaching) { 2485 destroy_component$2(upload, detaching); 2486 } 2487 }; 2488} 2489 2490// (44:4) <Upload bind:dragging filetype="video/x-m4v,video/*" on:load={handle_load} on:error={({ detail }) => dispatch("error", detail)} {root} > 2491function create_default_slot$2(ctx) { 2492 let current; 2493 const default_slot_template = /*#slots*/ ctx[17].default; 2494 const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[29], null); 2495 2496 return { 2497 c() { 2498 if (default_slot) default_slot.c(); 2499 }, 2500 m(target, anchor) { 2501 if (default_slot) { 2502 default_slot.m(target, anchor); 2503 } 2504 2505 current = true; 2506 }, 2507 p(ctx, dirty) { 2508 if (default_slot) { 2509 if (default_slot.p && (!current || dirty & /*$$scope*/ 536870912)) { 2510 update_slot_base( 2511 default_slot, 2512 default_slot_template, 2513 ctx, 2514 /*$$scope*/ ctx[29], 2515 !current 2516 ? get_all_dirty_from_scope(/*$$scope*/ ctx[29]) 2517 : get_slot_changes(default_slot_template, /*$$scope*/ ctx[29], dirty, null), 2518 null 2519 ); 2520 } 2521 } 2522 }, 2523 i(local) { 2524 if (current) return; 2525 transition_in$2(default_slot, local); 2526 current = true; 2527 }, 2528 o(local) { 2529 transition_out$2(default_slot, local); 2530 current = false; 2531 }, 2532 d(detaching) { 2533 if (default_slot) default_slot.d(detaching); 2534 } 2535 }; 2536} 2537 2538function create_fragment$2(ctx) { 2539 let blocklabel; 2540 let t0; 2541 let div; 2542 let current_block_type_index; 2543 let if_block; 2544 let t1; 2545 let selectsource; 2546 let updating_active_source; 2547 let current; 2548 2549 blocklabel = new BlockLabel({ 2550 props: { 2551 show_label: /*show_label*/ ctx[5], 2552 Icon: Video$1, 2553 label: /*label*/ ctx[4] || "Video" 2554 } 2555 }); 2556 2557 const if_block_creators = [create_if_block$2, create_else_block$2]; 2558 const if_blocks = []; 2559 2560 function select_block_type(ctx, dirty) { 2561 if (/*value*/ ctx[0] === null || /*value*/ ctx[0].url === undefined) return 0; 2562 return 1; 2563 } 2564 2565 current_block_type_index = select_block_type(ctx); 2566 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2567 2568 function selectsource_active_source_binding(value) { 2569 /*selectsource_active_source_binding*/ ctx[28](value); 2570 } 2571 2572 let selectsource_props = { 2573 sources: /*sources*/ ctx[3], 2574 handle_clear: /*handle_clear*/ ctx[15] 2575 }; 2576 2577 if (/*active_source*/ ctx[1] !== void 0) { 2578 selectsource_props.active_source = /*active_source*/ ctx[1]; 2579 } 2580 2581 selectsource = new SelectSource({ props: selectsource_props }); 2582 binding_callbacks.push(() => bind(selectsource, 'active_source', selectsource_active_source_binding)); 2583 2584 return { 2585 c() { 2586 create_component$2(blocklabel.$$.fragment); 2587 t0 = space$2(); 2588 div = element$1("div"); 2589 if_block.c(); 2590 t1 = space$2(); 2591 create_component$2(selectsource.$$.fragment); 2592 attr$1(div, "data-testid", "video"); 2593 attr$1(div, "class", "video-container svelte-1cs6pot"); 2594 }, 2595 m(target, anchor) { 2596 mount_component$2(blocklabel, target, anchor); 2597 insert$2(target, t0, anchor); 2598 insert$2(target, div, anchor); 2599 if_blocks[current_block_type_index].m(div, null); 2600 append$1(div, t1);
2601 mount_component$2(selectsource, div, null); 2602 current = true; 2603 }, 2604 p(ctx, [dirty]) { 2605 const blocklabel_changes = {}; 2606 if (dirty & /*show_label*/ 32) blocklabel_changes.show_label = /*show_label*/ ctx[5]; 2607 if (dirty & /*label*/ 16) blocklabel_changes.label = /*label*/ ctx[4] || "Video"; 2608 blocklabel.$set(blocklabel_changes); 2609 let previous_block_index = current_block_type_index; 2610 current_block_type_index = select_block_type(ctx); 2611 2612 if (current_block_type_index === previous_block_index) { 2613 if_blocks[current_block_type_index].p(ctx, dirty); 2614 } else { 2615 group_outros$2(); 2616 2617 transition_out$2(if_blocks[previous_block_index], 1, 1, () => { 2618 if_blocks[previous_block_index] = null; 2619 }); 2620 2621 check_outros$2(); 2622 if_block = if_blocks[current_block_type_index]; 2623 2624 if (!if_block) { 2625 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 2626 if_block.c(); 2627 } else { 2628 if_block.p(ctx, dirty); 2629 } 2630 2631 transition_in$2(if_block, 1); 2632 if_block.m(div, t1); 2633 } 2634 2635 const selectsource_changes = {}; 2636 if (dirty & /*sources*/ 8) selectsource_changes.sources = /*sources*/ ctx[3]; 2637 2638 if (!updating_active_source && dirty & /*active_source*/ 2) { 2639 updating_active_source = true; 2640 selectsource_changes.active_source = /*active_source*/ ctx[1]; 2641 add_flush_callback(() => updating_active_source = false); 2642 } 2643 2644 selectsource.$set(selectsource_changes); 2645 }, 2646 i(local) { 2647 if (current) return; 2648 transition_in$2(blocklabel.$$.fragment, local); 2649 transition_in$2(if_block); 2650 transition_in$2(selectsource.$$.fragment, local); 2651 current = true; 2652 }, 2653 o(local) { 2654 transition_out$2(blocklabel.$$.fragment, local); 2655 transition_out$2(if_block); 2656 transition_out$2(selectsource.$$.fragment, local); 2657 current = false; 2658 }, 2659 d(detaching) { 2660 if (detaching) { 2661 detach$2(t0); 2662 detach$2(div); 2663 } 2664 2665 destroy_component$2(blocklabel, detaching); 2666 if_blocks[current_block_type_index].d(); 2667 destroy_component$2(selectsource); 2668 } 2669 }; 2670} 2671 2672function instance$2($$self, $$props, $$invalidate) { 2673 let { $$slots: slots = {}, $$scope } = $$props; 2674 let { value = null } = $$props; 2675 let { subtitle = null } = $$props; 2676 let { sources = ["webcam", "upload"] } = $$props; 2677 let { label = undefined } = $$props; 2678 let { show_label = true } = $$props; 2679 let { mirror_webcam = false } = $$props; 2680 let { include_audio } = $$props; 2681 let { autoplay } = $$props; 2682 let { root } = $$props; 2683 let { i18n } = $$props; 2684 let { active_source = "webcam" } = $$props; 2685 2686 let { handle_reset_value = () => { 2687 2688 } } = $$props; 2689 2690 const dispatch = createEventDispatcher$1(); 2691 2692 function handle_load({ detail }) { 2693 $$invalidate(0, value = detail); 2694 dispatch("change", detail); 2695 dispatch("upload", detail); 2696 } 2697 2698 function handle_clear() { 2699 $$invalidate(0, value = null); 2700 dispatch("change", null); 2701 dispatch("clear"); 2702 } 2703 2704 function handle_change(video) { 2705 dispatch("change", video); 2706 } 2707 2708 let dragging = false; 2709 2710 function upload_dragging_binding(value) { 2711 dragging = value; 2712 $$invalidate(12, dragging); 2713 } 2714 2715 const error_handler_1 = ({ detail }) => dispatch("error", detail); 2716 2717 function error_handler(event) { 2718 bubble$1.call(this, $$self, event); 2719 } 2720 2721 const capture_handler = () => dispatch("change"); 2722 2723 function start_recording_handler(event) { 2724 bubble$1.call(this, $$self, event); 2725 } 2726 2727 function stop_recording_handler(event) { 2728 bubble$1.call(this, $$self, event); 2729 } 2730 2731 function play_handler(event) { 2732 bubble$1.call(this, $$self, event); 2733 } 2734 2735 function pause_handler(event) { 2736 bubble$1.call(this, $$self, event); 2737 } 2738 2739 function stop_handler(event) { 2740 bubble$1.call(this, $$self, event); 2741 } 2742 2743 function end_handler(event) { 2744 bubble$1.call(this, $$self, event); 2745 } 2746 2747 function selectsource_active_source_binding(value) { 2748 active_source = value; 2749 $$invalidate(1, active_source); 2750 } 2751 2752 $$self.$$set = $$props => {
2753 if ('value' in $$props) $$invalidate(0, value = $$props.value); 2754 if ('subtitle' in $$props) $$invalidate(2, subtitle = $$props.subtitle); 2755 if ('sources' in $$props) $$invalidate(3, sources = $$props.sources); 2756 if ('label' in $$props) $$invalidate(4, label = $$props.label); 2757 if ('show_label' in $$props) $$invalidate(5, show_label = $$props.show_label); 2758 if ('mirror_webcam' in $$props) $$invalidate(6, mirror_webcam = $$props.mirror_webcam); 2759 if ('include_audio' in $$props) $$invalidate(7, include_audio = $$props.include_audio); 2760 if ('autoplay' in $$props) $$invalidate(8, autoplay = $$props.autoplay); 2761 if ('root' in $$props) $$invalidate(9, root = $$props.root); 2762 if ('i18n' in $$props) $$invalidate(10, i18n = $$props.i18n); 2763 if ('active_source' in $$props) $$invalidate(1, active_source = $$props.active_source); 2764 if ('handle_reset_value' in $$props) $$invalidate(11, handle_reset_value = $$props.handle_reset_value); 2765 if ('$$scope' in $$props) $$invalidate(29, $$scope = $$props.$$scope); 2766 }; 2767 2768 $$self.$$.update = () => { 2769 if ($$self.$$.dirty & /*dragging*/ 4096) { 2770 dispatch("drag", dragging); 2771 } 2772 }; 2773 2774 return [ 2775 value, 2776 active_source, 2777 subtitle, 2778 sources, 2779 label, 2780 show_label, 2781 mirror_webcam, 2782 include_audio, 2783 autoplay, 2784 root, 2785 i18n, 2786 handle_reset_value, 2787 dragging, 2788 dispatch, 2789 handle_load, 2790 handle_clear, 2791 handle_change, 2792 slots, 2793 upload_dragging_binding, 2794 error_handler_1, 2795 error_handler, 2796 capture_handler, 2797 start_recording_handler, 2798 stop_recording_handler, 2799 play_handler, 2800 pause_handler, 2801 stop_handler, 2802 end_handler, 2803 selectsource_active_source_binding, 2804 $$scope 2805 ]; 2806} 2807 2808class InteractiveVideo extends SvelteComponent$2 { 2809 constructor(options) { 2810 super(); 2811 2812 init$2(this, options, instance$2, create_fragment$2, safe_not_equal$2, { 2813 value: 0, 2814 subtitle: 2, 2815 sources: 3, 2816 label: 4, 2817 show_label: 5, 2818 mirror_webcam: 6, 2819 include_audio: 7, 2820 autoplay: 8, 2821 root: 9, 2822 i18n: 10, 2823 active_source: 1, 2824 handle_reset_value: 11 2825 }); 2826 } 2827} 2828 2829const Video = InteractiveVideo; 2830 2831const VideoPreview_svelte_svelte_type_style_lang = ''; 2832 2833/* home/runner/work/gradio/gradio/js/video/shared/VideoPreview.svelte generated by Svelte v4.2.2 */ 2834const { 2835 SvelteComponent: SvelteComponent$1, 2836 append, 2837 attr, 2838 bubble, 2839 check_outros: check_outros$1, 2840 create_component: create_component$1, 2841 destroy_component: destroy_component$1, 2842 detach: detach$1, 2843 element, 2844 empty: empty$1, 2845 group_outros: group_outros$1, 2846 init: init$1, 2847 insert: insert$1, 2848 mount_component: mount_component$1, 2849 noop, 2850 safe_not_equal: safe_not_equal$1, 2851 space: space$1, 2852 transition_in: transition_in$1, 2853 transition_out: transition_out$1 2854} = window.__gradio__svelte__internal; 2855const { createEventDispatcher, afterUpdate, tick } = window.__gradio__svelte__internal; 2856function create_else_block$1(ctx) { 2857 let previous_key = /*value*/ ctx[0].url; 2858 let t0; 2859 let div; 2860 let t1; 2861 let current; 2862 let key_block = create_key_block(ctx); 2863 let if_block0 = /*show_download_button*/ ctx[6] && create_if_block_2(ctx); 2864 let if_block1 = /*show_share_button*/ ctx[5] && create_if_block_1(ctx); 2865 2866 return { 2867 c() { 2868 key_block.c(); 2869 t0 = space$1(); 2870 div = element("div"); 2871 if (if_block0) if_block0.c(); 2872 t1 = space$1(); 2873 if (if_block1) if_block1.c(); 2874 attr(div, "class", "icon-buttons svelte-rvdo70"); 2875 attr(div, "data-testid", "download-div"); 2876 }, 2877 m(target, anchor) { 2878 key_block.m(target, anchor); 2879 insert$1(target, t0, anchor); 2880 insert$1(target, div, anchor); 2881 if (if_block0) if_block0.m(div, null); 2882 append(div, t1); 2883 if (if_block1) if_block1.m(div, null); 2884 current = true; 2885 }, 2886 p(ctx, dirty) { 2887 if (dirty & /*value*/ 1 && safe_not_equal$1(previous_key, previous_key = /*value*/ ctx[0].url)) { 2888 group_outros$1(); 2889 transition_out$1(key_block, 1, 1, noop); 2890 check_outros$1(); 2891 key_block = create_key_block(ctx); 2892 key_block.c(); 2893 transition_in$1(key_block, 1); 2894 key_block.m(t0.parentNode, t0); 2895 } else { 2896 key_block.p(ctx, dirty); 2897 } 2898 2899 if (/*show_download_button*/ ctx[6]) { 2900 if (if_block0) { 2901 if_block0.p(ctx, dirty); 2902
2903 if (dirty & /*show_download_button*/ 64) { 2904 transition_in$1(if_block0, 1); 2905 } 2906 } else { 2907 if_block0 = create_if_block_2(ctx); 2908 if_block0.c(); 2909 transition_in$1(if_block0, 1); 2910 if_block0.m(div, t1); 2911 } 2912 } else if (if_block0) { 2913 group_outros$1(); 2914 2915 transition_out$1(if_block0, 1, 1, () => { 2916 if_block0 = null; 2917 }); 2918 2919 check_outros$1(); 2920 } 2921 2922 if (/*show_share_button*/ ctx[5]) { 2923 if (if_block1) { 2924 if_block1.p(ctx, dirty); 2925 2926 if (dirty & /*show_share_button*/ 32) { 2927 transition_in$1(if_block1, 1); 2928 } 2929 } else { 2930 if_block1 = create_if_block_1(ctx); 2931 if_block1.c(); 2932 transition_in$1(if_block1, 1); 2933 if_block1.m(div, null); 2934 } 2935 } else if (if_block1) { 2936 group_outros$1(); 2937 2938 transition_out$1(if_block1, 1, 1, () => { 2939 if_block1 = null; 2940 }); 2941 2942 check_outros$1(); 2943 } 2944 }, 2945 i(local) { 2946 if (current) return; 2947 transition_in$1(key_block); 2948 transition_in$1(if_block0); 2949 transition_in$1(if_block1); 2950 current = true; 2951 }, 2952 o(local) { 2953 transition_out$1(key_block); 2954 transition_out$1(if_block0); 2955 transition_out$1(if_block1); 2956 current = false; 2957 }, 2958 d(detaching) { 2959 if (detaching) { 2960 detach$1(t0); 2961 detach$1(div); 2962 } 2963 2964 key_block.d(detaching); 2965 if (if_block0) if_block0.d(); 2966 if (if_block1) if_block1.d(); 2967 } 2968 }; 2969} 2970 2971// (35:0) {#if value === null || value.url === undefined} 2972function create_if_block$1(ctx) { 2973 let empty_1; 2974 let current; 2975 2976 empty_1 = new Empty({ 2977 props: { 2978 unpadded_box: true, 2979 size: "large", 2980 $$slots: { default: [create_default_slot$1] }, 2981 $$scope: { ctx } 2982 } 2983 }); 2984 2985 return { 2986 c() { 2987 create_component$1(empty_1.$$.fragment); 2988 }, 2989 m(target, anchor) { 2990 mount_component$1(empty_1, target, anchor); 2991 current = true; 2992 }, 2993 p(ctx, dirty) { 2994 const empty_1_changes = {}; 2995 2996 if (dirty & /*$$scope*/ 262144) { 2997 empty_1_changes.$$scope = { dirty, ctx }; 2998 } 2999 3000 empty_1.$set(empty_1_changes); 3001 }, 3002 i(local) { 3003 if (current) return; 3004 transition_in$1(empty_1.$$.fragment, local); 3005 current = true; 3006 }, 3007 o(local) { 3008 transition_out$1(empty_1.$$.fragment, local); 3009 current = false; 3010 }, 3011 d(detaching) { 3012 destroy_component$1(empty_1, detaching); 3013 } 3014 }; 3015} 3016 3017// (38:1) {#key value.url} 3018function create_key_block(ctx) { 3019 let player; 3020 let current; 3021 3022 player = new Player$1({ 3023 props: { 3024 src: /*value*/ ctx[0].url, 3025 subtitle: /*subtitle*/ ctx[1]?.url, 3026 autoplay: /*autoplay*/ ctx[4], 3027 mirror: false, 3028 label: /*label*/ ctx[2], 3029 interactive: false 3030 } 3031 }); 3032 3033 player.$on("play", /*play_handler*/ ctx[8]); 3034 player.$on("pause", /*pause_handler*/ ctx[9]); 3035 player.$on("stop", /*stop_handler*/ ctx[10]); 3036 player.$on("end", /*end_handler*/ ctx[11]); 3037 3038 return { 3039 c() { 3040 create_component$1(player.$$.fragment); 3041 }, 3042 m(target, anchor) { 3043 mount_component$1(player, target, anchor); 3044 current = true; 3045 }, 3046 p(ctx, dirty) { 3047 const player_changes = {}; 3048 if (dirty & /*value*/ 1) player_changes.src = /*value*/ ctx[0].url; 3049 if (dirty & /*subtitle*/ 2) player_changes.subtitle = /*subtitle*/ ctx[1]?.url; 3050 if (dirty & /*autoplay*/ 16) player_changes.autoplay = /*autoplay*/ ctx[4]; 3051 if (dirty & /*label*/ 4) player_changes.label = /*label*/ ctx[2]; 3052 player.$set(player_changes); 3053 }, 3054 i(local) { 3055 if (current) return; 3056 transition_in$1(player.$$.fragment, local); 3057 current = true; 3058 }, 3059 o(local) { 3060 transition_out$1(player.$$.fragment, local); 3061 current = false; 3062 }, 3063 d(detaching) { 3064 destroy_component$1(player, detaching); 3065 } 3066 }; 3067} 3068 3069// (53:2) {#if show_download_button} 3070function create_if_block_2(ctx) { 3071 let downloadlink; 3072 let current; 3073 3074 downloadlink = new DownloadLink({ 3075 props: { 3076 href: /*value*/ ctx[0].url, 3077 download: /*value*/ ctx[0].orig_name || /*value*/ ctx[0].path, 3078 $$slots: { default: [create_default_slot_1$1] }, 3079 $$scope: { ctx } 3080 } 3081 }); 3082 3083 return { 3084 c() { 3085 create_component$1(downloadlink.$$.fragment); 3086 }, 3087 m(target, anchor) { 3088 mount_component$1(downloadlink, target, anchor); 3089 current = true; 3090 }, 3091 p(ctx, dirty) { 3092 const downloadlink_changes = {};
3093 if (dirty & /*value*/ 1) downloadlink_changes.href = /*value*/ ctx[0].url; 3094 if (dirty & /*value*/ 1) downloadlink_changes.download = /*value*/ ctx[0].orig_name || /*value*/ ctx[0].path; 3095 3096 if (dirty & /*$$scope*/ 262144) { 3097 downloadlink_changes.$$scope = { dirty, ctx }; 3098 } 3099 3100 downloadlink.$set(downloadlink_changes); 3101 }, 3102 i(local) { 3103 if (current) return; 3104 transition_in$1(downloadlink.$$.fragment, local); 3105 current = true; 3106 }, 3107 o(local) { 3108 transition_out$1(downloadlink.$$.fragment, local); 3109 current = false; 3110 }, 3111 d(detaching) { 3112 destroy_component$1(downloadlink, detaching); 3113 } 3114 }; 3115} 3116 3117// (54:3) <DownloadLink href={value.url} download={value.orig_name || value.path}> 3118function create_default_slot_1$1(ctx) { 3119 let iconbutton; 3120 let current; 3121 3122 iconbutton = new IconButton({ 3123 props: { Icon: Download, label: "Download" } 3124 }); 3125 3126 return { 3127 c() { 3128 create_component$1(iconbutton.$$.fragment); 3129 }, 3130 m(target, anchor) { 3131 mount_component$1(iconbutton, target, anchor); 3132 current = true; 3133 }, 3134 p: noop, 3135 i(local) { 3136 if (current) return; 3137 transition_in$1(iconbutton.$$.fragment, local); 3138 current = true; 3139 }, 3140 o(local) { 3141 transition_out$1(iconbutton.$$.fragment, local); 3142 current = false; 3143 }, 3144 d(detaching) { 3145 destroy_component$1(iconbutton, detaching); 3146 } 3147 }; 3148} 3149 3150// (58:2) {#if show_share_button} 3151function create_if_block_1(ctx) { 3152 let sharebutton; 3153 let current; 3154 3155 sharebutton = new ShareButton({ 3156 props: { 3157 i18n: /*i18n*/ ctx[7], 3158 value: /*value*/ ctx[0], 3159 formatter: /*func*/ ctx[12] 3160 } 3161 }); 3162 3163 sharebutton.$on("error", /*error_handler*/ ctx[13]); 3164 sharebutton.$on("share", /*share_handler*/ ctx[14]); 3165 3166 return { 3167 c() { 3168 create_component$1(sharebutton.$$.fragment); 3169 }, 3170 m(target, anchor) { 3171 mount_component$1(sharebutton, target, anchor); 3172 current = true; 3173 }, 3174 p(ctx, dirty) { 3175 const sharebutton_changes = {}; 3176 if (dirty & /*i18n*/ 128) sharebutton_changes.i18n = /*i18n*/ ctx[7]; 3177 if (dirty & /*value*/ 1) sharebutton_changes.value = /*value*/ ctx[0]; 3178 sharebutton.$set(sharebutton_changes); 3179 }, 3180 i(local) { 3181 if (current) return; 3182 transition_in$1(sharebutton.$$.fragment, local); 3183 current = true; 3184 }, 3185 o(local) { 3186 transition_out$1(sharebutton.$$.fragment, local); 3187 current = false; 3188 }, 3189 d(detaching) { 3190 destroy_component$1(sharebutton, detaching); 3191 } 3192 }; 3193} 3194 3195// (36:1) <Empty unpadded_box={true} size="large"> 3196function create_default_slot$1(ctx) { 3197 let video; 3198 let current; 3199 video = new Video$1({}); 3200 3201 return { 3202 c() { 3203 create_component$1(video.$$.fragment); 3204 }, 3205 m(target, anchor) { 3206 mount_component$1(video, target, anchor); 3207 current = true; 3208 }, 3209 i(local) { 3210 if (current) return; 3211 transition_in$1(video.$$.fragment, local); 3212 current = true; 3213 }, 3214 o(local) { 3215 transition_out$1(video.$$.fragment, local); 3216 current = false; 3217 }, 3218 d(detaching) { 3219 destroy_component$1(video, detaching); 3220 } 3221 }; 3222} 3223 3224function create_fragment$1(ctx) { 3225 let blocklabel; 3226 let t; 3227 let current_block_type_index; 3228 let if_block; 3229 let if_block_anchor; 3230 let current; 3231 3232 blocklabel = new BlockLabel({ 3233 props: { 3234 show_label: /*show_label*/ ctx[3], 3235 Icon: Video$1, 3236 label: /*label*/ ctx[2] || "Video" 3237 } 3238 }); 3239 3240 const if_block_creators = [create_if_block$1, create_else_block$1]; 3241 const if_blocks = []; 3242 3243 function select_block_type(ctx, dirty) { 3244 if (/*value*/ ctx[0] === null || /*value*/ ctx[0].url === undefined) return 0; 3245 return 1; 3246 } 3247 3248 current_block_type_index = select_block_type(ctx); 3249 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3250 3251 return { 3252 c() { 3253 create_component$1(blocklabel.$$.fragment); 3254 t = space$1(); 3255 if_block.c(); 3256 if_block_anchor = empty$1(); 3257 }, 3258 m(target, anchor) { 3259 mount_component$1(blocklabel, target, anchor); 3260 insert$1(target, t, anchor); 3261 if_blocks[current_block_type_index].m(target, anchor); 3262 insert$1(target, if_block_anchor, anchor); 3263 current = true; 3264 }, 3265 p(ctx, [dirty]) { 3266 const blocklabel_changes = {}; 3267 if (dirty & /*show_label*/ 8) blocklabel_changes.show_label = /*show_label*/ ctx[3];
3268 if (dirty & /*label*/ 4) blocklabel_changes.label = /*label*/ ctx[2] || "Video"; 3269 blocklabel.$set(blocklabel_changes); 3270 let previous_block_index = current_block_type_index; 3271 current_block_type_index = select_block_type(ctx); 3272 3273 if (current_block_type_index === previous_block_index) { 3274 if_blocks[current_block_type_index].p(ctx, dirty); 3275 } else { 3276 group_outros$1(); 3277 3278 transition_out$1(if_blocks[previous_block_index], 1, 1, () => { 3279 if_blocks[previous_block_index] = null; 3280 }); 3281 3282 check_outros$1(); 3283 if_block = if_blocks[current_block_type_index]; 3284 3285 if (!if_block) { 3286 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3287 if_block.c(); 3288 } else { 3289 if_block.p(ctx, dirty); 3290 } 3291 3292 transition_in$1(if_block, 1); 3293 if_block.m(if_block_anchor.parentNode, if_block_anchor); 3294 } 3295 }, 3296 i(local) { 3297 if (current) return; 3298 transition_in$1(blocklabel.$$.fragment, local); 3299 transition_in$1(if_block); 3300 current = true; 3301 }, 3302 o(local) { 3303 transition_out$1(blocklabel.$$.fragment, local); 3304 transition_out$1(if_block); 3305 current = false; 3306 }, 3307 d(detaching) { 3308 if (detaching) { 3309 detach$1(t); 3310 detach$1(if_block_anchor); 3311 } 3312 3313 destroy_component$1(blocklabel, detaching); 3314 if_blocks[current_block_type_index].d(detaching); 3315 } 3316 }; 3317} 3318 3319function instance$1($$self, $$props, $$invalidate) { 3320 let { value = null } = $$props; 3321 let { subtitle = null } = $$props; 3322 let { label = undefined } = $$props; 3323 let { show_label = true } = $$props; 3324 let { autoplay } = $$props; 3325 let { show_share_button = true } = $$props; 3326 let { show_download_button = true } = $$props; 3327 let { i18n } = $$props; 3328 let old_value = null; 3329 let old_subtitle = null; 3330 const dispatch = createEventDispatcher(); 3331 3332 afterUpdate(async () => { 3333 // needed to bust subtitle caching issues on Chrome 3334 if (value !== old_value && subtitle !== old_subtitle && old_subtitle !== null) { 3335 old_value = value; 3336 $$invalidate(0, value = null); 3337 await tick(); 3338 $$invalidate(0, value = old_value); 3339 } 3340 3341 old_value = value; 3342 old_subtitle = subtitle; 3343 }); 3344 3345 function play_handler(event) { 3346 bubble.call(this, $$self, event); 3347 } 3348 3349 function pause_handler(event) { 3350 bubble.call(this, $$self, event); 3351 } 3352 3353 function stop_handler(event) { 3354 bubble.call(this, $$self, event); 3355 } 3356 3357 function end_handler(event) { 3358 bubble.call(this, $$self, event); 3359 } 3360 3361 const func = async value => { 3362 if (!value) return ""; 3363 let url = await uploadToHuggingFace(value.data, "url"); 3364 return url; 3365 }; 3366 3367 function error_handler(event) { 3368 bubble.call(this, $$self, event); 3369 } 3370 3371 function share_handler(event) { 3372 bubble.call(this, $$self, event); 3373 } 3374 3375 $$self.$$set = $$props => {
3376 if ('value' in $$props) $$invalidate(0, value = $$props.value); 3377 if ('subtitle' in $$props) $$invalidate(1, subtitle = $$props.subtitle); 3378 if ('label' in $$props) $$invalidate(2, label = $$props.label); 3379 if ('show_label' in $$props) $$invalidate(3, show_label = $$props.show_label); 3380 if ('autoplay' in $$props) $$invalidate(4, autoplay = $$props.autoplay); 3381 if ('show_share_button' in $$props) $$invalidate(5, show_share_button = $$props.show_share_button); 3382 if ('show_download_button' in $$props) $$invalidate(6, show_download_button = $$props.show_download_button); 3383 if ('i18n' in $$props) $$invalidate(7, i18n = $$props.i18n); 3384 }; 3385 3386 $$self.$$.update = () => { 3387 if ($$self.$$.dirty & /*value*/ 1) { 3388 value && dispatch("change", value); 3389 } 3390 }; 3391 3392 return [ 3393 value, 3394 subtitle, 3395 label, 3396 show_label, 3397 autoplay, 3398 show_share_button, 3399 show_download_button, 3400 i18n, 3401 play_handler, 3402 pause_handler, 3403 stop_handler, 3404 end_handler, 3405 func, 3406 error_handler, 3407 share_handler 3408 ]; 3409} 3410 3411class VideoPreview extends SvelteComponent$1 { 3412 constructor(options) { 3413 super(); 3414 3415 init$1(this, options, instance$1, create_fragment$1, safe_not_equal$1, { 3416 value: 0, 3417 subtitle: 1, 3418 label: 2, 3419 show_label: 3, 3420 autoplay: 4, 3421 show_share_button: 5, 3422 show_download_button: 6, 3423 i18n: 7 3424 }); 3425 } 3426} 3427 3428const StaticVideo = VideoPreview; 3429 3430/* home/runner/work/gradio/gradio/js/video/Index.svelte generated by Svelte v4.2.2 */ 3431const { 3432 SvelteComponent, 3433 assign, 3434 check_outros, 3435 create_component, 3436 destroy_component, 3437 detach, 3438 empty, 3439 flush, 3440 get_spread_object, 3441 get_spread_update, 3442 group_outros, 3443 init, 3444 insert, 3445 mount_component, 3446 safe_not_equal, 3447 space, 3448 transition_in, 3449 transition_out 3450} = window.__gradio__svelte__internal; 3451function create_else_block(ctx) { 3452 let block; 3453 let current; 3454 3455 block = new Block({ 3456 props: { 3457 visible: /*visible*/ ctx[4], 3458 variant: /*value*/ ctx[0] === null && /*active_source*/ ctx[20] === "upload" 3459 ? "dashed" 3460 : "solid", 3461 border_mode: /*dragging*/ ctx[23] ? "focus" : "base", 3462 padding: false, 3463 elem_id: /*elem_id*/ ctx[2], 3464 elem_classes: /*elem_classes*/ ctx[3], 3465 height: /*height*/ ctx[9], 3466 width: /*width*/ ctx[10], 3467 container: /*container*/ ctx[11], 3468 scale: /*scale*/ ctx[12], 3469 min_width: /*min_width*/ ctx[13], 3470 allow_overflow: false, 3471 $$slots: { default: [create_default_slot_1] }, 3472 $$scope: { ctx } 3473 } 3474 }); 3475 3476 return { 3477 c() { 3478 create_component(block.$$.fragment); 3479 }, 3480 m(target, anchor) { 3481 mount_component(block, target, anchor); 3482 current = true; 3483 }, 3484 p(ctx, dirty) { 3485 const block_changes = {}; 3486 if (dirty[0] & /*visible*/ 16) block_changes.visible = /*visible*/ ctx[4]; 3487 3488 if (dirty[0] & /*value, active_source*/ 1048577) block_changes.variant = /*value*/ ctx[0] === null && /*active_source*/ ctx[20] === "upload" 3489 ? "dashed" 3490 : "solid"; 3491 3492 if (dirty[0] & /*dragging*/ 8388608) block_changes.border_mode = /*dragging*/ ctx[23] ? "focus" : "base"; 3493 if (dirty[0] & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2]; 3494 if (dirty[0] & /*elem_classes*/ 8) block_changes.elem_classes = /*elem_classes*/ ctx[3]; 3495 if (dirty[0] & /*height*/ 512) block_changes.height = /*height*/ ctx[9]; 3496 if (dirty[0] & /*width*/ 1024) block_changes.width = /*width*/ ctx[10]; 3497 if (dirty[0] & /*container*/ 2048) block_changes.container = /*container*/ ctx[11]; 3498 if (dirty[0] & /*scale*/ 4096) block_changes.scale = /*scale*/ ctx[12]; 3499 if (dirty[0] & /*min_width*/ 8192) block_changes.min_width = /*min_width*/ ctx[13]; 3500 3501 if (dirty[0] & /*_video, _subtitle, label, show_label, sources, active_source, mirror_webcam, include_audio, autoplay, root, gradio, dragging, loading_status*/ 16597474 | dirty[1] & /*$$scope*/ 16384) { 3502 block_changes.$$scope = { dirty, ctx }; 3503 } 3504 3505 block.$set(block_changes); 3506 }, 3507 i(local) { 3508 if (current) return; 3509 transition_in(block.$$.fragment, local); 3510 current = true; 3511 }, 3512 o(local) { 3513 transition_out(block.$$.fragment, local); 3514 current = false; 3515 }, 3516 d(detaching) { 3517 destroy_component(block, detaching); 3518 } 3519 }; 3520} 3521 3522// (82:0) {#if !interactive} 3523function create_if_block(ctx) { 3524 let block; 3525 let current; 3526 3527 block = new Block({ 3528 props: { 3529 visible: /*visible*/ ctx[4], 3530 variant: /*value*/ ctx[0] === null && /*active_source*/ ctx[20] === "upload" 3531 ? "dashed" 3532 : "solid", 3533 border_mode: /*dragging*/ ctx[23] ? "focus" : "base", 3534 padding: false, 3535 elem_id: /*elem_id*/ ctx[2], 3536 elem_classes: /*elem_classes*/ ctx[3], 3537 height: /*height*/ ctx[9], 3538 width: /*width*/ ctx[10], 3539 container: /*container*/ ctx[11], 3540 scale: /*scale*/ ctx[12], 3541 min_width: /*min_width*/ ctx[13], 3542 allow_overflow: false, 3543 $$slots: { default: [create_default_slot] }, 3544 $$scope: { ctx } 3545 } 3546 }); 3547 3548 return { 3549 c() { 3550 create_component(block.$$.fragment); 3551 }, 3552 m(target, anchor) { 3553 mount_component(block, target, anchor); 3554 current = true; 3555 }, 3556 p(ctx, dirty) { 3557 const block_changes = {};
3558 if (dirty[0] & /*visible*/ 16) block_changes.visible = /*visible*/ ctx[4]; 3559 3560 if (dirty[0] & /*value, active_source*/ 1048577) block_changes.variant = /*value*/ ctx[0] === null && /*active_source*/ ctx[20] === "upload" 3561 ? "dashed" 3562 : "solid"; 3563 3564 if (dirty[0] & /*dragging*/ 8388608) block_changes.border_mode = /*dragging*/ ctx[23] ? "focus" : "base"; 3565 if (dirty[0] & /*elem_id*/ 4) block_changes.elem_id = /*elem_id*/ ctx[2]; 3566 if (dirty[0] & /*elem_classes*/ 8) block_changes.elem_classes = /*elem_classes*/ ctx[3]; 3567 if (dirty[0] & /*height*/ 512) block_changes.height = /*height*/ ctx[9]; 3568 if (dirty[0] & /*width*/ 1024) block_changes.width = /*width*/ ctx[10]; 3569 if (dirty[0] & /*container*/ 2048) block_changes.container = /*container*/ ctx[11]; 3570 if (dirty[0] & /*scale*/ 4096) block_changes.scale = /*scale*/ ctx[12]; 3571 if (dirty[0] & /*min_width*/ 8192) block_changes.min_width = /*min_width*/ ctx[13]; 3572 3573 if (dirty[0] & /*_video, _subtitle, label, show_label, autoplay, show_share_button, gradio, loading_status*/ 6406434 | dirty[1] & /*$$scope*/ 16384) { 3574 block_changes.$$scope = { dirty, ctx }; 3575 } 3576 3577 block.$set(block_changes); 3578 }, 3579 i(local) { 3580 if (current) return; 3581 transition_in(block.$$.fragment, local); 3582 current = true; 3583 }, 3584 o(local) { 3585 transition_out(block.$$.fragment, local); 3586 current = false; 3587 }, 3588 d(detaching) { 3589 destroy_component(block, detaching); 3590 } 3591 }; 3592} 3593 3594// (141:2) <Video value={_video} subtitle={_subtitle} on:change={handle_change} on:drag={({ detail }) => (dragging = detail)} on:error={handle_error} {label} {show_label} {sources} {active_source} {mirror_webcam} {include_audio} {autoplay} {root} {handle_reset_value} on:clear={() => gradio.dispatch("clear")} on:play={() => gradio.dispatch("play")} on:pause={() => gradio.dispatch("pause")} on:upload={() => gradio.dispatch("upload")} on:stop={() => gradio.dispatch("stop")} on:end={() => gradio.dispatch("end")} on:start_recording={() => gradio.dispatch("start_recording")} on:stop_recording={() => gradio.dispatch("stop_recording")} i18n={gradio.i18n} > 3595function create_default_slot_2(ctx) { 3596 let uploadtext; 3597 let current; 3598 3599 uploadtext = new UploadText({ 3600 props: { 3601 i18n: /*gradio*/ ctx[16].i18n, 3602 type: "video" 3603 } 3604 }); 3605 3606 return { 3607 c() { 3608 create_component(uploadtext.$$.fragment); 3609 }, 3610 m(target, anchor) { 3611 mount_component(uploadtext, target, anchor); 3612 current = true; 3613 }, 3614 p(ctx, dirty) { 3615 const uploadtext_changes = {}; 3616 if (dirty[0] & /*gradio*/ 65536) uploadtext_changes.i18n = /*gradio*/ ctx[16].i18n; 3617 uploadtext.$set(uploadtext_changes); 3618 }, 3619 i(local) { 3620 if (current) return; 3621 transition_in(uploadtext.$$.fragment, local); 3622 current = true; 3623 }, 3624 o(local) { 3625 transition_out(uploadtext.$$.fragment, local); 3626 current = false; 3627 }, 3628 d(detaching) { 3629 destroy_component(uploadtext, detaching); 3630 } 3631 }; 3632} 3633 3634// (121:1) <Block {visible} variant={value === null && active_source === "upload" ? "dashed" : "solid"} border_mode={dragging ? "focus" : "base"} padding={false} {elem_id} {elem_classes} {height} {width} {container} {scale} {min_width} allow_overflow={false} > 3635function create_default_slot_1(ctx) { 3636 let statustracker; 3637 let t; 3638 let video; 3639 let current; 3640 3641 const statustracker_spread_levels = [ 3642 { 3643 autoscroll: /*gradio*/ ctx[16].autoscroll 3644 }, 3645 { i18n: /*gradio*/ ctx[16].i18n }, 3646 /*loading_status*/ ctx[1] 3647 ]; 3648 3649 let statustracker_props = {}; 3650 3651 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 3652 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 3653 } 3654 3655 statustracker = new Static({ props: statustracker_props }); 3656 3657 video = new Video({ 3658 props: { 3659 value: /*_video*/ ctx[21], 3660 subtitle: /*_subtitle*/ ctx[22], 3661 label: /*label*/ ctx[5], 3662 show_label: /*show_label*/ ctx[8], 3663 sources: /*sources*/ ctx[6], 3664 active_source: /*active_source*/ ctx[20], 3665 mirror_webcam: /*mirror_webcam*/ ctx[18], 3666 include_audio: /*include_audio*/ ctx[19], 3667 autoplay: /*autoplay*/ ctx[14], 3668 root: /*root*/ ctx[7], 3669 handle_reset_value: /*handle_reset_value*/ ctx[24], 3670 i18n: /*gradio*/ ctx[16].i18n, 3671 $$slots: { default: [create_default_slot_2] }, 3672 $$scope: { ctx } 3673 } 3674 }); 3675 3676 video.$on("change", /*handle_change*/ ctx[25]); 3677 video.$on("drag", /*drag_handler*/ ctx[36]); 3678 video.$on("error", /*handle_error*/ ctx[26]); 3679 video.$on("clear", /*clear_handler*/ ctx[37]); 3680 video.$on("play", /*play_handler_1*/ ctx[38]); 3681 video.$on("pause", /*pause_handler_1*/ ctx[39]); 3682 video.$on("upload", /*upload_handler*/ ctx[40]); 3683 video.$on("stop", /*stop_handler_1*/ ctx[41]); 3684 video.$on("end", /*end_handler_1*/ ctx[42]); 3685 video.$on("start_recording", /*start_recording_handler*/ ctx[43]); 3686 video.$on("stop_recording", /*stop_recording_handler*/ ctx[44]); 3687 3688 return { 3689 c() { 3690 create_component(statustracker.$$.fragment); 3691 t = space(); 3692 create_component(video.$$.fragment); 3693 }, 3694 m(target, anchor) { 3695 mount_component(statustracker, target, anchor); 3696 insert(target, t, anchor);
3697 mount_component(video, target, anchor); 3698 current = true; 3699 }, 3700 p(ctx, dirty) { 3701 const statustracker_changes = (dirty[0] & /*gradio, loading_status*/ 65538) 3702 ? get_spread_update(statustracker_spread_levels, [ 3703 dirty[0] & /*gradio*/ 65536 && { 3704 autoscroll: /*gradio*/ ctx[16].autoscroll 3705 }, 3706 dirty[0] & /*gradio*/ 65536 && { i18n: /*gradio*/ ctx[16].i18n }, 3707 dirty[0] & /*loading_status*/ 2 && get_spread_object(/*loading_status*/ ctx[1]) 3708 ]) 3709 : {}; 3710 3711 statustracker.$set(statustracker_changes); 3712 const video_changes = {}; 3713 if (dirty[0] & /*_video*/ 2097152) video_changes.value = /*_video*/ ctx[21]; 3714 if (dirty[0] & /*_subtitle*/ 4194304) video_changes.subtitle = /*_subtitle*/ ctx[22]; 3715 if (dirty[0] & /*label*/ 32) video_changes.label = /*label*/ ctx[5]; 3716 if (dirty[0] & /*show_label*/ 256) video_changes.show_label = /*show_label*/ ctx[8]; 3717 if (dirty[0] & /*sources*/ 64) video_changes.sources = /*sources*/ ctx[6]; 3718 if (dirty[0] & /*active_source*/ 1048576) video_changes.active_source = /*active_source*/ ctx[20]; 3719 if (dirty[0] & /*mirror_webcam*/ 262144) video_changes.mirror_webcam = /*mirror_webcam*/ ctx[18]; 3720 if (dirty[0] & /*include_audio*/ 524288) video_changes.include_audio = /*include_audio*/ ctx[19]; 3721 if (dirty[0] & /*autoplay*/ 16384) video_changes.autoplay = /*autoplay*/ ctx[14]; 3722 if (dirty[0] & /*root*/ 128) video_changes.root = /*root*/ ctx[7]; 3723 if (dirty[0] & /*gradio*/ 65536) video_changes.i18n = /*gradio*/ ctx[16].i18n; 3724 3725 if (dirty[0] & /*gradio*/ 65536 | dirty[1] & /*$$scope*/ 16384) { 3726 video_changes.$$scope = { dirty, ctx }; 3727 } 3728 3729 video.$set(video_changes); 3730 }, 3731 i(local) { 3732 if (current) return; 3733 transition_in(statustracker.$$.fragment, local); 3734 transition_in(video.$$.fragment, local); 3735 current = true; 3736 }, 3737 o(local) { 3738 transition_out(statustracker.$$.fragment, local); 3739 transition_out(video.$$.fragment, local); 3740 current = false; 3741 }, 3742 d(detaching) { 3743 if (detaching) { 3744 detach(t); 3745 } 3746 3747 destroy_component(statustracker, detaching); 3748 destroy_component(video, detaching); 3749 } 3750 }; 3751} 3752 3753// (83:1) <Block {visible} variant={value === null && active_source === "upload" ? "dashed" : "solid"} border_mode={dragging ? "focus" : "base"} padding={false} {elem_id} {elem_classes} {height} {width} {container} {scale} {min_width} allow_overflow={false} > 3754function create_default_slot(ctx) { 3755 let statustracker; 3756 let t; 3757 let staticvideo; 3758 let current; 3759 3760 const statustracker_spread_levels = [ 3761 { 3762 autoscroll: /*gradio*/ ctx[16].autoscroll 3763 }, 3764 { i18n: /*gradio*/ ctx[16].i18n }, 3765 /*loading_status*/ ctx[1] 3766 ]; 3767 3768 let statustracker_props = {}; 3769 3770 for (let i = 0; i < statustracker_spread_levels.length; i += 1) { 3771 statustracker_props = assign(statustracker_props, statustracker_spread_levels[i]); 3772 } 3773 3774 statustracker = new Static({ props: statustracker_props }); 3775 3776 staticvideo = new StaticVideo({ 3777 props: { 3778 value: /*_video*/ ctx[21], 3779 subtitle: /*_subtitle*/ ctx[22], 3780 label: /*label*/ ctx[5], 3781 show_label: /*show_label*/ ctx[8], 3782 autoplay: /*autoplay*/ ctx[14], 3783 show_share_button: /*show_share_button*/ ctx[15], 3784 show_download_button: true, 3785 i18n: /*gradio*/ ctx[16].i18n 3786 } 3787 }); 3788 3789 staticvideo.$on("play", /*play_handler*/ ctx[30]); 3790 staticvideo.$on("pause", /*pause_handler*/ ctx[31]); 3791 staticvideo.$on("stop", /*stop_handler*/ ctx[32]); 3792 staticvideo.$on("end", /*end_handler*/ ctx[33]); 3793 staticvideo.$on("share", /*share_handler*/ ctx[34]); 3794 staticvideo.$on("error", /*error_handler*/ ctx[35]); 3795 3796 return { 3797 c() { 3798 create_component(statustracker.$$.fragment); 3799 t = space(); 3800 create_component(staticvideo.$$.fragment); 3801 }, 3802 m(target, anchor) { 3803 mount_component(statustracker, target, anchor); 3804 insert(target, t, anchor); 3805 mount_component(staticvideo, target, anchor); 3806 current = true; 3807 }, 3808 p(ctx, dirty) { 3809 const statustracker_changes = (dirty[0] & /*gradio, loading_status*/ 65538) 3810 ? get_spread_update(statustracker_spread_levels, [ 3811 dirty[0] & /*gradio*/ 65536 && { 3812 autoscroll: /*gradio*/ ctx[16].autoscroll 3813 }, 3814 dirty[0] & /*gradio*/ 65536 && { i18n: /*gradio*/ ctx[16].i18n }, 3815 dirty[0] & /*loading_status*/ 2 && get_spread_object(/*loading_status*/ ctx[1]) 3816 ]) 3817 : {}; 3818 3819 statustracker.$set(statustracker_changes); 3820 const staticvideo_changes = {};
3821 if (dirty[0] & /*_video*/ 2097152) staticvideo_changes.value = /*_video*/ ctx[21]; 3822 if (dirty[0] & /*_subtitle*/ 4194304) staticvideo_changes.subtitle = /*_subtitle*/ ctx[22]; 3823 if (dirty[0] & /*label*/ 32) staticvideo_changes.label = /*label*/ ctx[5]; 3824 if (dirty[0] & /*show_label*/ 256) staticvideo_changes.show_label = /*show_label*/ ctx[8]; 3825 if (dirty[0] & /*autoplay*/ 16384) staticvideo_changes.autoplay = /*autoplay*/ ctx[14]; 3826 if (dirty[0] & /*show_share_button*/ 32768) staticvideo_changes.show_share_button = /*show_share_button*/ ctx[15]; 3827 if (dirty[0] & /*gradio*/ 65536) staticvideo_changes.i18n = /*gradio*/ ctx[16].i18n; 3828 staticvideo.$set(staticvideo_changes); 3829 }, 3830 i(local) { 3831 if (current) return; 3832 transition_in(statustracker.$$.fragment, local); 3833 transition_in(staticvideo.$$.fragment, local); 3834 current = true; 3835 }, 3836 o(local) { 3837 transition_out(statustracker.$$.fragment, local); 3838 transition_out(staticvideo.$$.fragment, local); 3839 current = false; 3840 }, 3841 d(detaching) { 3842 if (detaching) { 3843 detach(t); 3844 } 3845 3846 destroy_component(statustracker, detaching); 3847 destroy_component(staticvideo, detaching); 3848 } 3849 }; 3850} 3851 3852function create_fragment(ctx) { 3853 let current_block_type_index; 3854 let if_block; 3855 let if_block_anchor; 3856 let current; 3857 const if_block_creators = [create_if_block, create_else_block]; 3858 const if_blocks = []; 3859 3860 function select_block_type(ctx, dirty) { 3861 if (!/*interactive*/ ctx[17]) return 0; 3862 return 1; 3863 } 3864 3865 current_block_type_index = select_block_type(ctx); 3866 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3867 3868 return { 3869 c() { 3870 if_block.c(); 3871 if_block_anchor = empty(); 3872 }, 3873 m(target, anchor) { 3874 if_blocks[current_block_type_index].m(target, anchor); 3875 insert(target, if_block_anchor, anchor); 3876 current = true; 3877 }, 3878 p(ctx, dirty) { 3879 let previous_block_index = current_block_type_index; 3880 current_block_type_index = select_block_type(ctx); 3881 3882 if (current_block_type_index === previous_block_index) { 3883 if_blocks[current_block_type_index].p(ctx, dirty); 3884 } else { 3885 group_outros(); 3886 3887 transition_out(if_blocks[previous_block_index], 1, 1, () => { 3888 if_blocks[previous_block_index] = null; 3889 }); 3890 3891 check_outros(); 3892 if_block = if_blocks[current_block_type_index]; 3893 3894 if (!if_block) { 3895 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 3896 if_block.c(); 3897 } else { 3898 if_block.p(ctx, dirty); 3899 } 3900 3901 transition_in(if_block, 1); 3902 if_block.m(if_block_anchor.parentNode, if_block_anchor); 3903 } 3904 }, 3905 i(local) { 3906 if (current) return; 3907 transition_in(if_block); 3908 current = true; 3909 }, 3910 o(local) { 3911 transition_out(if_block); 3912 current = false; 3913 }, 3914 d(detaching) { 3915 if (detaching) { 3916 detach(if_block_anchor); 3917 } 3918 3919 if_blocks[current_block_type_index].d(detaching); 3920 } 3921 }; 3922} 3923 3924function instance($$self, $$props, $$invalidate) { 3925 let { elem_id = "" } = $$props; 3926 let { elem_classes = [] } = $$props; 3927 let { visible = true } = $$props; 3928 let { value = null } = $$props; 3929 let old_value = null; 3930 let { label } = $$props; 3931 let { sources } = $$props; 3932 let { root } = $$props; 3933 let { proxy_url } = $$props; 3934 let { show_label } = $$props; 3935 let { loading_status } = $$props; 3936 let { height } = $$props; 3937 let { width } = $$props; 3938 let { container = false } = $$props; 3939 let { scale = null } = $$props; 3940 let { min_width = undefined } = $$props; 3941 let { autoplay = false } = $$props; 3942 let { show_share_button = true } = $$props; 3943 let { gradio } = $$props; 3944 let { interactive } = $$props; 3945 let { mirror_webcam } = $$props; 3946 let { include_audio } = $$props; 3947 let _video = null; 3948 let _subtitle = null; 3949 let active_source; 3950 let initial_value = value; 3951 3952 const handle_reset_value = () => { 3953 if (initial_value === null || value === initial_value) { 3954 return; 3955 } 3956 3957 $$invalidate(0, value = initial_value); 3958 }; 3959 3960 let dragging = false; 3961 3962 function handle_change({ detail }) { 3963 if (detail != null) { 3964 $$invalidate(0, value = { video: detail, subtitles: null }); 3965 } else { 3966 $$invalidate(0, value = null); 3967 } 3968 } 3969 3970 function handle_error({ detail }) { 3971 const [level, status] = detail.includes("Invalid file type") 3972 ? ["warning", "complete"] 3973 : ["error", "error"]; 3974
3975 $$invalidate(1, loading_status = loading_status || {}); 3976 $$invalidate(1, loading_status.status = status, loading_status); 3977 $$invalidate(1, loading_status.message = detail, loading_status); 3978 gradio.dispatch(level, detail); 3979 } 3980 3981 const play_handler = () => gradio.dispatch("play"); 3982 const pause_handler = () => gradio.dispatch("pause"); 3983 const stop_handler = () => gradio.dispatch("stop"); 3984 const end_handler = () => gradio.dispatch("end"); 3985 const share_handler = ({ detail }) => gradio.dispatch("share", detail); 3986 const error_handler = ({ detail }) => gradio.dispatch("error", detail); 3987 const drag_handler = ({ detail }) => $$invalidate(23, dragging = detail); 3988 const clear_handler = () => gradio.dispatch("clear"); 3989 const play_handler_1 = () => gradio.dispatch("play"); 3990 const pause_handler_1 = () => gradio.dispatch("pause"); 3991 const upload_handler = () => gradio.dispatch("upload"); 3992 const stop_handler_1 = () => gradio.dispatch("stop"); 3993 const end_handler_1 = () => gradio.dispatch("end"); 3994 const start_recording_handler = () => gradio.dispatch("start_recording"); 3995 const stop_recording_handler = () => gradio.dispatch("stop_recording"); 3996 3997 $$self.$$set = $$props => {
3998 if ('elem_id' in $$props) $$invalidate(2, elem_id = $$props.elem_id); 3999 if ('elem_classes' in $$props) $$invalidate(3, elem_classes = $$props.elem_classes); 4000 if ('visible' in $$props) $$invalidate(4, visible = $$props.visible); 4001 if ('value' in $$props) $$invalidate(0, value = $$props.value); 4002 if ('label' in $$props) $$invalidate(5, label = $$props.label); 4003 if ('sources' in $$props) $$invalidate(6, sources = $$props.sources); 4004 if ('root' in $$props) $$invalidate(7, root = $$props.root); 4005 if ('proxy_url' in $$props) $$invalidate(27, proxy_url = $$props.proxy_url); 4006 if ('show_label' in $$props) $$invalidate(8, show_label = $$props.show_label); 4007 if ('loading_status' in $$props) $$invalidate(1, loading_status = $$props.loading_status); 4008 if ('height' in $$props) $$invalidate(9, height = $$props.height); 4009 if ('width' in $$props) $$invalidate(10, width = $$props.width); 4010 if ('container' in $$props) $$invalidate(11, container = $$props.container); 4011 if ('scale' in $$props) $$invalidate(12, scale = $$props.scale);
4012 if ('min_width' in $$props) $$invalidate(13, min_width = $$props.min_width); 4013 if ('autoplay' in $$props) $$invalidate(14, autoplay = $$props.autoplay); 4014 if ('show_share_button' in $$props) $$invalidate(15, show_share_button = $$props.show_share_button); 4015 if ('gradio' in $$props) $$invalidate(16, gradio = $$props.gradio); 4016 if ('interactive' in $$props) $$invalidate(17, interactive = $$props.interactive); 4017 if ('mirror_webcam' in $$props) $$invalidate(18, mirror_webcam = $$props.mirror_webcam); 4018 if ('include_audio' in $$props) $$invalidate(19, include_audio = $$props.include_audio); 4019 }; 4020 4021 $$self.$$.update = () => { 4022 if ($$self.$$.dirty[0] & /*value, initial_value*/ 536870913) { 4023 if (value && initial_value === null) { 4024 $$invalidate(29, initial_value = value); 4025 } 4026 } 4027 4028 if ($$self.$$.dirty[0] & /*sources, active_source*/ 1048640) { 4029 if (sources && !active_source) { 4030 $$invalidate(20, active_source = sources[0]); 4031 } 4032 } 4033 4034 if ($$self.$$.dirty[0] & /*value, root, proxy_url*/ 134217857) { 4035 { 4036 if (value != null) { 4037 $$invalidate(21, _video = normalise_file(value.video, root, proxy_url)); 4038 $$invalidate(22, _subtitle = normalise_file(value.subtitles, root, proxy_url)); 4039 } else { 4040 $$invalidate(21, _video = null); 4041 $$invalidate(22, _subtitle = null); 4042 } 4043 } 4044 } 4045 4046 if ($$self.$$.dirty[0] & /*value, old_value, gradio*/ 268500993) { 4047 { 4048 if (JSON.stringify(value) !== JSON.stringify(old_value)) { 4049 $$invalidate(28, old_value = value); 4050 gradio.dispatch("change"); 4051 } 4052 } 4053 } 4054 }; 4055 4056 return [ 4057 value, 4058 loading_status, 4059 elem_id, 4060 elem_classes, 4061 visible, 4062 label, 4063 sources, 4064 root, 4065 show_label, 4066 height, 4067 width, 4068 container, 4069 scale, 4070 min_width, 4071 autoplay, 4072 show_share_button, 4073 gradio, 4074 interactive, 4075 mirror_webcam, 4076 include_audio, 4077 active_source, 4078 _video, 4079 _subtitle, 4080 dragging, 4081 handle_reset_value, 4082 handle_change, 4083 handle_error, 4084 proxy_url, 4085 old_value, 4086 initial_value, 4087 play_handler, 4088 pause_handler, 4089 stop_handler, 4090 end_handler, 4091 share_handler, 4092 error_handler, 4093 drag_handler, 4094 clear_handler, 4095 play_handler_1, 4096 pause_handler_1, 4097 upload_handler, 4098 stop_handler_1, 4099 end_handler_1, 4100 start_recording_handler, 4101 stop_recording_handler 4102 ]; 4103} 4104 4105class Index extends SvelteComponent { 4106 constructor(options) { 4107 super(); 4108 4109 init( 4110 this, 4111 options, 4112 instance, 4113 create_fragment, 4114 safe_not_equal, 4115 { 4116 elem_id: 2, 4117 elem_classes: 3, 4118 visible: 4, 4119 value: 0, 4120 label: 5, 4121 sources: 6, 4122 root: 7, 4123 proxy_url: 27, 4124 show_label: 8, 4125 loading_status: 1, 4126 height: 9, 4127 width: 10, 4128 container: 11, 4129 scale: 12, 4130 min_width: 13, 4131 autoplay: 14, 4132 show_share_button: 15, 4133 gradio: 16, 4134 interactive: 17, 4135 mirror_webcam: 18, 4136 include_audio: 19 4137 }, 4138 null, 4139 [-1, -1] 4140 ); 4141 } 4142 4143 get elem_id() { 4144 return this.$$.ctx[2]; 4145 } 4146 4147 set elem_id(elem_id) { 4148 this.$$set({ elem_id }); 4149 flush(); 4150 } 4151 4152 get elem_classes() { 4153 return this.$$.ctx[3]; 4154 } 4155 4156 set elem_classes(elem_classes) { 4157 this.$$set({ elem_classes }); 4158 flush(); 4159 } 4160 4161 get visible() { 4162 return this.$$.ctx[4]; 4163 } 4164 4165 set visible(visible) { 4166 this.$$set({ visible }); 4167 flush(); 4168 } 4169 4170 get value() { 4171 return this.$$.ctx[0]; 4172 } 4173 4174 set value(value) { 4175 this.$$set({ value }); 4176 flush(); 4177 } 4178 4179 get label() { 4180 return this.$$.ctx[5]; 4181 } 4182 4183 set label(label) { 4184 this.$$set({ label }); 4185 flush(); 4186 } 4187 4188 get sources() { 4189 return this.$$.ctx[6]; 4190 } 4191 4192 set sources(sources) { 4193 this.$$set({ sources }); 4194 flush(); 4195 } 4196 4197 get root() { 4198 return this.$$.ctx[7]; 4199 } 4200 4201 set root(root) { 4202 this.$$set({ root }); 4203 flush(); 4204 } 4205 4206 get proxy_url() { 4207 return this.$$.ctx[27]; 4208 } 4209 4210 set proxy_url(proxy_url) { 4211 this.$$set({ proxy_url }); 4212 flush(); 4213 } 4214 4215 get show_label() { 4216 return this.$$.ctx[8]; 4217 } 4218 4219 set show_label(show_label) { 4220 this.$$set({ show_label }); 4221 flush(); 4222 } 4223 4224 get loading_status() { 4225 return this.$$.ctx[1]; 4226 } 4227 4228 set loading_status(loading_status) { 4229 this.$$set({ loading_status }); 4230 flush(); 4231 } 4232 4233 get height() { 4234 return this.$$.ctx[9]; 4235 } 4236 4237 set height(height) { 4238 this.$$set({ height }); 4239 flush(); 4240 } 4241 4242 get width() { 4243 return this.$$.ctx[10]; 4244 } 4245 4246 set width(width) { 4247 this.$$set({ width }); 4248 flush(); 4249 } 4250 4251 get container() { 4252 return this.$$.ctx[11]; 4253 } 4254 4255 set container(container) { 4256 this.$$set({ container }); 4257 flush(); 4258 } 4259 4260 get scale() { 4261 return this.$$.ctx[12]; 4262 } 4263 4264 set scale(scale) { 4265 this.$$set({ scale }); 4266 flush(); 4267 } 4268 4269 get min_width() { 4270 return this.$$.ctx[13]; 4271 } 4272 4273 set min_width(min_width) { 4274 this.$$set({ min_width }); 4275 flush(); 4276 } 4277 4278 get autoplay() { 4279 return this.$$.ctx[14]; 4280 } 4281 4282 set autoplay(autoplay) { 4283 this.$$set({ autoplay }); 4284 flush(); 4285 } 4286 4287 get show_share_button() { 4288 return this.$$.ctx[15]; 4289 } 4290 4291 set show_share_button(show_share_button) { 4292 this.$$set({ show_share_button }); 4293 flush(); 4294 } 4295 4296 get gradio() { 4297 return this.$$.ctx[16]; 4298 } 4299 4300 set gradio(gradio) { 4301 this.$$set({ gradio }); 4302 flush(); 4303 } 4304 4305 get interactive() { 4306 return this.$$.ctx[17]; 4307 } 4308 4309 set interactive(interactive) { 4310 this.$$set({ interactive }); 4311 flush(); 4312 } 4313 4314 get mirror_webcam() { 4315 return this.$$.ctx[18]; 4316 } 4317 4318 set mirror_webcam(mirror_webcam) { 4319 this.$$set({ mirror_webcam }); 4320 flush(); 4321 } 4322 4323 get include_audio() { 4324 return this.$$.ctx[19]; 4325 } 4326 4327 set include_audio(include_audio) { 4328 this.$$set({ include_audio }); 4329 flush(); 4330 } 4331} 4332 4333const Index$1 = Index; 4334 4335export { Video as BaseInteractiveVideo, Player$1 as BasePlayer, StaticVideo as BaseStaticVideo, Index$1 as default, playable, prettyBytes }; 4336//# sourceMappingURL=index-d0b4b2ba.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.