1import { p as prop, i as if_block, a as set_attribute, r as rest_props } from './i18n-dpAHICcw.js'; 2import { R as push, S as first_child, a as append, T as pop, X as sibling, W as from_html, t as template_effect, a6 as comment, a7 as text, w as get, a5 as user_derived, a0 as set_text, a8 as next } from './index-CDZuCcOm.js'; 3import { G as Gradio } from './utils.svelte-CyWLYi-B.js'; 4import { s as snippet } from './snippet-DVkMfmSq.js'; 5import { B as Button } from './Button-DxE-syeF.js'; 6import './clone-dZfS06Ds.js'; 7import './Image-CJziNDBt.js'; 8import './misc-C2MjMwBX.js'; 9/* empty css */ 10import './ScrollFade.svelte_svelte_type_style_lang-DUvCSfRk.js'; 11import './MarkdownCode.svelte_svelte_type_style_lang-GeNUGzep.js'; 12import './prism-python-C_fanlsZ.js'; 13/* empty css */ 14 15var root_2 = from_html(`<img class="button-icon svelte-4ac0fl"/>`); 16var root_1 = from_html(`<!> <!>`, 1); 17 18function DownloadButton($$anchor, $$props) { 19 push($$props, true); 20 21 let elem_id = prop($$props, 'elem_id', 3, ""), 22 elem_classes = prop($$props, 'elem_classes', 19, () => []), 23 visible = prop($$props, 'visible', 3, true), 24 variant = prop($$props, 'variant', 3, "secondary"), 25 size = prop($$props, 'size', 3, "lg"), 26 disabled = prop($$props, 'disabled', 3, false), 27 scale = prop($$props, 'scale', 3, null), 28 min_width = prop($$props, 'min_width', 3, undefined); 29 30 function download_file() { 31 $$props.on_click?.(); 32 33 if (!$$props.value?.url) { 34 return; 35 } 36 37 let file_name; 38 39 if (!$$props.value.orig_name && $$props.value.url) { 40 const parts = $$props.value.url.split("/"); 41 42 file_name = parts[parts.length - 1]; 43 file_name = file_name.split("?")[0].split("#")[0]; 44 } else { 45 file_name = $$props.value.orig_name; 46 } 47 48 const a = document.createElement("a"); 49 50 a.href = $$props.value.url; 51 a.download = file_name || "file"; 52 document.body.appendChild(a); 53 a.click(); 54 document.body.removeChild(a); 55 } 56 57 Button($$anchor, { 58 get size() { 59 return size(); 60 }, 61 62 get variant() { 63 return variant(); 64 }, 65 66 get elem_id() { 67 return elem_id(); 68 }, 69 70 get elem_classes() { 71 return elem_classes(); 72 }, 73 74 get visible() { 75 return visible(); 76 }, 77 onclick: download_file, 78 get scale() { 79 return scale(); 80 }, 81 82 get min_width() { 83 return min_width(); 84 }, 85 86 get disabled() { 87 return disabled(); 88 }, 89 90 children: ($$anchor, $$slotProps) => { 91 var fragment_1 = root_1(); 92 var node = first_child(fragment_1); 93 94 { 95 var consequent = ($$anchor) => { 96 var img = root_2(); 97 98 template_effect(() => { 99 set_attribute(img, 'src', $$props.icon.url); 100 set_attribute(img, 'alt', `${$$props.value} icon`); 101 }); 102 103 append($$anchor, img); 104 }; 105 106 if_block(node, ($$render) => { 107 if ($$props.icon) $$render(consequent); 108 }); 109 } 110 111 var node_1 = sibling(node, 2); 112 113 { 114 var consequent_1 = ($$anchor) => { 115 var fragment_2 = comment(); 116 var node_2 = first_child(fragment_2); 117 118 snippet(node_2, () => $$props.children); 119 append($$anchor, fragment_2); 120 }; 121 122 if_block(node_1, ($$render) => { 123 if ($$props.children) $$render(consequent_1); 124 }); 125 } 126 127 append($$anchor, fragment_1); 128 }, 129 $$slots: { default: true } 130 }); 131 132 pop(); 133} 134 135function Index($$anchor, $$props) { 136 push($$props, true); 137 138 const props = rest_props($$props, ['$$slots', '$$events', '$$legacy']); 139 const gradio = new Gradio(props); 140 141 { 142 let $0 = user_derived(() => !gradio.shared.interactive); 143 144 DownloadButton($$anchor, { 145 get value() { 146 return gradio.props.value; 147 }, 148 149 get variant() { 150 return gradio.props.variant; 151 }, 152 153 get elem_id() { 154 return gradio.shared.elem_id; 155 }, 156 157 get elem_classes() { 158 return gradio.shared.elem_classes; 159 }, 160 161 get size() { 162 return gradio.props.size; 163 }, 164 165 get scale() { 166 return gradio.shared.scale; 167 }, 168 169 get icon() { 170 return gradio.props.icon; 171 }, 172 173 get min_width() { 174 return gradio.shared.min_width; 175 }, 176 177 get visible() { 178 return gradio.shared.visible; 179 }, 180 181 get disabled() { 182 return get($0); 183 }, 184 on_click: () => gradio.dispatch("click"), 185 children: ($$anchor, $$slotProps) => { 186 next(); 187 188 var text$1 = text(); 189 190 template_effect(() => set_text(text$1, gradio.shared.label ?? "")); 191 append($$anchor, text$1); 192 }, 193 $$slots: { default: true } 194 }); 195 } 196 197 pop(); 198} 199 200export { DownloadButton as BaseButton, Index as default }; 201//# sourceMappingURL=Index-6kS528vb.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.