1import { V as Video } from './Video-be3c9ccf.js'; 2import './index-dc71b4a2.js'; 3import './file-url-905a9712.js'; 4import './Index-e8ffd830.js'; 5import './svelte/svelte.js'; 6 7const Example_svelte_svelte_type_style_lang = ''; 8 9/* home/runner/work/gradio/gradio/js/video/Example.svelte generated by Svelte v4.2.2 */ 10const { 11 SvelteComponent, 12 add_flush_callback, 13 append, 14 attr, 15 bind, 16 binding_callbacks, 17 check_outros, 18 create_component, 19 destroy_component, 20 detach, 21 element, 22 empty, 23 group_outros, 24 init: init_1, 25 insert, 26 is_function, 27 mount_component, 28 noop, 29 safe_not_equal, 30 set_data, 31 text, 32 toggle_class, 33 transition_in, 34 transition_out 35} = window.__gradio__svelte__internal; 36function create_if_block(ctx) { 37 let current_block_type_index; 38 let if_block; 39 let if_block_anchor; 40 let current; 41 const if_block_creators = [create_if_block_1, create_else_block]; 42 const if_blocks = []; 43 44 function select_block_type(ctx, dirty) { 45 return 0; 46 } 47 48 current_block_type_index = select_block_type(); 49 if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx); 50 51 return { 52 c() { 53 if_block.c(); 54 if_block_anchor = empty(); 55 }, 56 m(target, anchor) { 57 if_blocks[current_block_type_index].m(target, anchor); 58 insert(target, if_block_anchor, anchor); 59 current = true; 60 }, 61 p(ctx, dirty) { 62 if_block.p(ctx, dirty); 63 }, 64 i(local) { 65 if (current) return; 66 transition_in(if_block); 67 current = true; 68 }, 69 o(local) { 70 transition_out(if_block); 71 current = false; 72 }, 73 d(detaching) { 74 if (detaching) { 75 detach(if_block_anchor); 76 } 77 78 if_blocks[current_block_type_index].d(detaching); 79 } 80 }; 81} 82 83// (36:1) {:else} 84function create_else_block(ctx) { 85 let div; 86 let t; 87 88 return { 89 c() { 90 div = element("div"); 91 t = text(/*value*/ ctx[2]); 92 }, 93 m(target, anchor) { 94 insert(target, div, anchor); 95 append(div, t); 96 }, 97 p(ctx, dirty) { 98 if (dirty & /*value*/ 4) set_data(t, /*value*/ ctx[2]); 99 }, 100 i: noop, 101 o: noop, 102 d(detaching) { 103 if (detaching) { 104 detach(div); 105 } 106 } 107 }; 108} 109 110// (19:1) {#if playable()} 111function create_if_block_1(ctx) { 112 let div; 113 let video_1; 114 let updating_node; 115 let current; 116 117 function video_1_node_binding(value) { 118 /*video_1_node_binding*/ ctx[5](value); 119 } 120 121 let video_1_props = { 122 muted: true, 123 playsinline: true, 124 src: /*value*/ ctx[2]?.video.url 125 }; 126 127 if (/*video*/ ctx[3] !== void 0) { 128 video_1_props.node = /*video*/ ctx[3]; 129 } 130 131 video_1 = new Video({ props: video_1_props }); 132 binding_callbacks.push(() => bind(video_1, 'node', video_1_node_binding)); 133 video_1.$on("loadeddata", /*init*/ ctx[4]); 134 135 video_1.$on("mouseover", function () { 136 if (is_function(/*video*/ ctx[3].play.bind(/*video*/ ctx[3]))) /*video*/ ctx[3].play.bind(/*video*/ ctx[3]).apply(this, arguments); 137 }); 138 139 video_1.$on("mouseout", function () { 140 if (is_function(/*video*/ ctx[3].pause.bind(/*video*/ ctx[3]))) /*video*/ ctx[3].pause.bind(/*video*/ ctx[3]).apply(this, arguments); 141 }); 142 143 return { 144 c() { 145 div = element("div"); 146 create_component(video_1.$$.fragment); 147 attr(div, "class", "container svelte-1de9zxs"); 148 toggle_class(div, "table", /*type*/ ctx[0] === "table"); 149 toggle_class(div, "gallery", /*type*/ ctx[0] === "gallery"); 150 toggle_class(div, "selected", /*selected*/ ctx[1]); 151 }, 152 m(target, anchor) { 153 insert(target, div, anchor); 154 mount_component(video_1, div, null); 155 current = true; 156 }, 157 p(new_ctx, dirty) { 158 ctx = new_ctx; 159 const video_1_changes = {}; 160 if (dirty & /*value*/ 4) video_1_changes.src = /*value*/ ctx[2]?.video.url; 161 162 if (!updating_node && dirty & /*video*/ 8) { 163 updating_node = true; 164 video_1_changes.node = /*video*/ ctx[3]; 165 add_flush_callback(() => updating_node = false); 166 } 167 168 video_1.$set(video_1_changes); 169 170 if (!current || dirty & /*type*/ 1) { 171 toggle_class(div, "table", /*type*/ ctx[0] === "table"); 172 } 173 174 if (!current || dirty & /*type*/ 1) { 175 toggle_class(div, "gallery", /*type*/ ctx[0] === "gallery"); 176 } 177 178 if (!current || dirty & /*selected*/ 2) { 179 toggle_class(div, "selected", /*selected*/ ctx[1]); 180 } 181 }, 182 i(local) { 183 if (current) return; 184 transition_in(video_1.$$.fragment, local); 185 current = true; 186 }, 187 o(local) { 188 transition_out(video_1.$$.fragment, local); 189 current = false;
190 }, 191 d(detaching) { 192 if (detaching) { 193 detach(div); 194 } 195 196 destroy_component(video_1); 197 } 198 }; 199} 200 201function create_fragment(ctx) { 202 let if_block_anchor; 203 let current; 204 let if_block = /*value*/ ctx[2] && create_if_block(ctx); 205 206 return { 207 c() { 208 if (if_block) if_block.c(); 209 if_block_anchor = empty(); 210 }, 211 m(target, anchor) { 212 if (if_block) if_block.m(target, anchor); 213 insert(target, if_block_anchor, anchor); 214 current = true; 215 }, 216 p(ctx, [dirty]) { 217 if (/*value*/ ctx[2]) { 218 if (if_block) { 219 if_block.p(ctx, dirty); 220 221 if (dirty & /*value*/ 4) { 222 transition_in(if_block, 1); 223 } 224 } else { 225 if_block = create_if_block(ctx); 226 if_block.c(); 227 transition_in(if_block, 1); 228 if_block.m(if_block_anchor.parentNode, if_block_anchor); 229 } 230 } else if (if_block) { 231 group_outros(); 232 233 transition_out(if_block, 1, 1, () => { 234 if_block = null; 235 }); 236 237 check_outros(); 238 } 239 }, 240 i(local) { 241 if (current) return; 242 transition_in(if_block); 243 current = true; 244 }, 245 o(local) { 246 transition_out(if_block); 247 current = false; 248 }, 249 d(detaching) { 250 if (detaching) { 251 detach(if_block_anchor); 252 } 253 254 if (if_block) if_block.d(detaching); 255 } 256 }; 257} 258 259function instance($$self, $$props, $$invalidate) { 260 let { type } = $$props; 261 let { selected = false } = $$props; 262 let { value } = $$props; 263 let video; 264 265 async function init() { 266 $$invalidate(3, video.muted = true, video); 267 $$invalidate(3, video.playsInline = true, video); 268 $$invalidate(3, video.controls = false, video); 269 video.setAttribute("muted", ""); 270 await video.play(); 271 video.pause(); 272 } 273 274 function video_1_node_binding(value) { 275 video = value; 276 $$invalidate(3, video); 277 } 278 279 $$self.$$set = $$props => {
280 if ('type' in $$props) $$invalidate(0, type = $$props.type); 281 if ('selected' in $$props) $$invalidate(1, selected = $$props.selected); 282 if ('value' in $$props) $$invalidate(2, value = $$props.value); 283 }; 284 285 return [type, selected, value, video, init, video_1_node_binding]; 286} 287 288class Example extends SvelteComponent { 289 constructor(options) { 290 super(); 291 init_1(this, options, instance, create_fragment, safe_not_equal, { type: 0, selected: 1, value: 2 }); 292 } 293} 294 295export { Example as default }; 296//# sourceMappingURL=Example-48d88ec5.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.