1import { i as if_block, g as spread_props, b as set_class, f as set_style, r as rest_props } from './i18n-dpAHICcw.js'; 2import { R as push, u as state, v as proxy, y as user_effect, w as get, x as set, S as first_child, t as template_effect, a as append, X as sibling, V as child, T as pop, a5 as user_derived, av as prepare_files, W as from_html, Y as reset } from './index-CDZuCcOm.js'; 3import { G as Gradio, c as css_units } from './utils.svelte-CyWLYi-B.js'; 4import HTML from './HTML-B2dUNNxJ.js'; 5import { S as Static } from './index-DyDpuTN9.js'; 6import './StreamingBar.svelte_svelte_type_style_lang-BxBb9ZZb.js'; 7import { B as Block } from './Block-DntE23uJ.js'; 8import './MarkdownCode.svelte_svelte_type_style_lang-GeNUGzep.js'; 9import './ScrollFade.svelte_svelte_type_style_lang-DUvCSfRk.js'; 10import { B as BlockLabel } from './BlockLabel-D4yjUUAn.js'; 11import { C as Code } from './Code-DG4-IzG8.js'; 12import { I as IconButtonWrapper } from './IconButtonWrapper-KjCt2Pl8.js'; 13export { default as BaseExample } from './Example-wUwiRzAM.js'; 14import './clone-dZfS06Ds.js'; 15import './snippet-DVkMfmSq.js'; 16import './Clear-tvJMRS4J.js'; 17import './html-h_YSgefI.js'; 18import './prism-python-C_fanlsZ.js'; 19 20var root_1 = from_html(`<!> <!> <!> <div><!></div>`, 1); 21 22function Index($$anchor, $$props) { 23 push($$props, true); 24 25 let props = rest_props($$props, ['$$slots', '$$events', '$$legacy']); 26 let children = $$props.children; 27 const gradio = new Gradio(props); 28 29 let _props = user_derived(() => ({ 30 value: gradio.props.value ?? "", 31 label: gradio.shared.label, 32 visible: gradio.shared.visible, 33 ...gradio.props.props 34 })); 35 36 let old_value = state(proxy(gradio.props.value)); 37 38 user_effect(() => { 39 if (JSON.stringify(get(old_value)) !== JSON.stringify(gradio.props.value)) { 40 set(old_value, gradio.props.value, true); 41 gradio.dispatch("change"); 42 } 43 }); 44 45 let watch_entries = []; 46 47 function watch(propOrProps, callback) { 48 const prop_list = Array.isArray(propOrProps) ? propOrProps : [propOrProps]; 49 50 watch_entries.push({ props: prop_list, callback }); 51 } 52 53 function fire_watchers(changed_keys) { 54 const seen = new Set(); 55 56 for (const entry of watch_entries) { 57 if (entry.props.some((k) => changed_keys.includes(k))) { 58 seen.add(entry); 59 } 60 } 61 62 for (const entry of seen) { 63 try { 64 entry.callback(); 65 } catch(e) { 66 console.error("Error in watch callback:", e); 67 } 68 } 69 } 70 71 async function upload(file) { 72 try { 73 const file_data = await prepare_files([file]); 74 const result = await gradio.shared.client.upload(file_data, gradio.shared.root, undefined, gradio.shared.max_file_size ?? undefined); 75 76 if (result && result[0]) { 77 return { path: result[0].path, url: result[0].url }; 78 } 79 80 throw new Error("Upload failed"); 81 } catch(e) { 82 gradio.dispatch("error", e instanceof Error ? e.message : String(e)); 83 84 throw e; 85 } 86 } 87 88 { 89 let $0 = user_derived(() => gradio.props.padding !== false); 90 91 Block($$anchor, { 92 get visible() { 93 return gradio.shared.visible; 94 }, 95 96 get elem_id() { 97 return gradio.shared.elem_id; 98 }, 99 100 get elem_classes() { 101 return gradio.shared.elem_classes; 102 }, 103 104 get container() { 105 return gradio.shared.container; 106 }, 107 108 get padding() { 109 return get($0); 110 }, 111 overflow_behavior: 'visible', 112 children: ($$anchor, $$slotProps) => { 113 var fragment_1 = root_1(); 114 var node = first_child(fragment_1); 115 116 { 117 var consequent = ($$anchor) => { 118 IconButtonWrapper($$anchor, { 119 get buttons() { 120 return gradio.props.buttons; 121 }, 122 123 on_custom_button_click: (id) => { 124 gradio.dispatch("custom_button_click", { id }); 125 } 126 }); 127 }; 128 129 if_block(node, ($$render) => { 130 if (gradio.shared.show_label && gradio.props.buttons && gradio.props.buttons.length > 0) $$render(consequent); 131 }); 132 } 133
134 var node_1 = sibling(node, 2); 135 136 { 137 var consequent_1 = ($$anchor) => { 138 BlockLabel($$anchor, { 139 get Icon() { 140 return Code; 141 }, 142 143 get show_label() { 144 return gradio.shared.show_label; 145 }, 146 147 get label() { 148 return gradio.shared.label; 149 }, 150 float: true 151 }); 152 }; 153 154 if_block(node_1, ($$render) => { 155 if (gradio.shared.show_label) $$render(consequent_1); 156 }); 157 } 158 159 var node_2 = sibling(node_1, 2); 160 161 Static(node_2, spread_props( 162 { 163 get autoscroll() { 164 return gradio.shared.autoscroll; 165 }, 166 167 get i18n() { 168 return gradio.i18n; 169 } 170 }, 171 () => gradio.shared.loading_status, 172 { 173 variant: 'center', 174 on_clear_status: () => gradio.dispatch("clear_status", gradio.shared.loading_status) 175 } 176 )); 177 178 var div = sibling(node_2, 2); 179 let classes; 180 let styles; 181 var node_3 = child(div); 182 183 HTML(node_3, { 184 get props() { 185 return get(_props); 186 }, 187 188 get html_template() { 189 return gradio.props.html_template; 190 }, 191 192 get css_template() { 193 return gradio.props.css_template; 194 }, 195 196 get js_on_load() { 197 return gradio.props.js_on_load; 198 }, 199 200 get elem_classes() { 201 return gradio.shared.elem_classes; 202 }, 203 204 get visible() { 205 return gradio.shared.visible; 206 }, 207 208 get autoscroll() { 209 return gradio.shared.autoscroll; 210 }, 211 212 get apply_default_css() { 213 return gradio.props.apply_default_css; 214 }, 215 216 get head() { 217 return gradio.props.head; 218 }, 219 220 get component_class_name() { 221 return gradio.props.component_class_name; 222 }, 223 upload, 224 get server() { 225 return gradio.shared.server; 226 }, 227 watch_fn: watch, 228 fire_watchers, 229 $$events: { 230 event: (e) => { 231 gradio.dispatch(e.detail.type, e.detail.data); 232 }, 233 234 update_value: (e) => { 235 if (e.detail.property === "value") { 236 gradio.props.value = e.detail.data; 237 } else if (e.detail.property === "label") { 238 gradio.shared.label = e.detail.data; 239 } else if (e.detail.property === "visible") { 240 gradio.shared.visible = e.detail.data; 241 } 242 } 243 }, 244 245 children: ($$anchor, $$slotProps) => { 246 children?.($$anchor); 247 }, 248 $$slots: { default: true } 249 }); 250 251 reset(div); 252 253 template_effect( 254 ($0) => { 255 classes = set_class(div, 1, 'html-container svelte-1jts93g', null, classes, { 256 pending: gradio.shared.loading_status?.status === "pending" && gradio.shared.loading_status?.show_progress !== "hidden", 257 'label-padding': gradio.shared.show_label ?? undefined 258 }); 259 260 styles = set_style(div, '', styles, $0); 261 }, 262 [ 263 () => ({ 264 'min-height': gradio.props.min_height && gradio.shared.loading_status?.status !== "pending" ? css_units(gradio.props.min_height) : undefined, 265 'max-height': gradio.props.max_height ? css_units(gradio.props.max_height) : undefined, 266 'overflow-y': gradio.props.max_height ? "auto" : undefined 267 }) 268 ] 269 ); 270 271 append($$anchor, fragment_1); 272 }, 273 $$slots: { default: true } 274 }); 275 } 276 277 pop(); 278} 279 280export { HTML as BaseHTML, Index as default }; 281//# sourceMappingURL=Index-VLiznTwX.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.