1import { i as if_block, r as rest_props, g as spread_props } from './i18n-CMo5lpzy.js'; 2import { R as push, u as state, v as proxy, y as user_effect, S as first_child, w as get, a as append, X as sibling, a5 as user_derived, T as pop, x as set, M as tick, W as from_html } from './index-BvBk1Iap.js'; 3import { s as snapshot } from './clone-DaB-S2nH.js'; 4import { T as Textbox } from './Textbox-v-cNeNHQ.js'; 5import { S as Static } from './index-Lz7fsHFt.js'; 6import './StreamingBar.svelte_svelte_type_style_lang-CdFIGsJa.js'; 7import { B as Block } from './Block-Bx3BikCN.js'; 8import './ScrollFade.svelte_svelte_type_style_lang-Xm-PLg9E.js'; 9import { G as Gradio } from './utils.svelte-CYLB_jIA.js'; 10export { default as BaseExample } from './Example-a64hbcxE.js'; 11import './actions-Cit_UA5S.js'; 12import './input-C317uaXR.js'; 13import './BlockTitle-7XQ-8ENg.js'; 14import './Info-BrkJhX6_.js'; 15import './html-CdUEtR5E.js'; 16import './Check-BlnBgjLT.js'; 17import './Copy-DFFray7x.js'; 18import './Send-Ee555fP_.js'; 19import './Square-B6INQV79.js'; 20import './IconButtonWrapper-Ba0GidgU.js'; 21import './snippet-Bl5YVoCg.js'; 22import './Clear-Dgs5UhTO.js'; 23import './index-C7e-J7CF.js'; 24import './size-Cu4PabCL.js'; 25/* empty css */ 26 27var root_1 = from_html(`<!> <!>`, 1); 28 29function Index($$anchor, $$props) { 30 push($$props, true); 31 32 let _props = rest_props($$props, ['$$slots', '$$events', '$$legacy']); 33 const gradio = new Gradio(_props); 34 let label = user_derived(() => gradio.shared.label || "Textbox"); 35 36 // Need to set the value to "" otherwise a change event gets 37 // dispatched when the child sets it to "" 38 gradio.props.value = gradio.props.value ?? ""; 39 40 let old_value = state(proxy(gradio.props.value)); 41 42 async function dispatch_change() { 43 if (get(old_value) !== gradio.props.value) { 44 set(old_value, gradio.props.value, true); 45 await tick(); 46 gradio.dispatch("change", snapshot(gradio.props.value)); 47 } 48 } 49 50 async function handle_input(value) { 51 if (!gradio.shared || !gradio.props) return; 52 53 gradio.props.validation_error = null; 54 gradio.props.value = value; 55 await tick(); 56 gradio.dispatch("input"); 57 } 58 59 user_effect(() => { 60 dispatch_change(); 61 }); 62 63 function handle_change(value) { 64 if (!gradio.shared || !gradio.props) return; 65 66 gradio.props.validation_error = null; 67 gradio.props.value = value; 68 } 69 70 Block($$anchor, { 71 get visible() { 72 return gradio.shared.visible; 73 }, 74 75 get elem_id() { 76 return gradio.shared.elem_id; 77 }, 78 79 get elem_classes() { 80 return gradio.shared.elem_classes; 81 }, 82 83 get scale() { 84 return gradio.shared.scale; 85 }, 86 87 get min_width() { 88 return gradio.shared.min_width; 89 }, 90 allow_overflow: false, 91 get padding() { 92 return gradio.shared.container; 93 }, 94 95 get rtl() { 96 return gradio.props.rtl; 97 }, 98 99 children: ($$anchor, $$slotProps) => { 100 var fragment_1 = root_1(); 101 var node = first_child(fragment_1); 102 103 { 104 var consequent = ($$anchor) => { 105 Static($$anchor, spread_props( 106 { 107 get autoscroll() { 108 return gradio.shared.autoscroll; 109 }, 110 111 get i18n() { 112 return gradio.i18n; 113 } 114 }, 115 () => gradio.shared.loading_status, 116 { 117 show_validation_error: false, 118 on_clear_status: () => gradio.dispatch("clear_status", gradio.shared.loading_status) 119 } 120 )); 121 }; 122 123 if_block(node, ($$render) => { 124 if (gradio.shared.loading_status) $$render(consequent); 125 }); 126 } 127 128 var node_1 = sibling(node, 2); 129 130 { 131 let $0 = user_derived(() => gradio.shared?.loading_status?.validation_error || gradio.shared?.validation_error); 132 let $1 = user_derived(() => !gradio.shared.interactive); 133 134 Textbox(node_1, { 135 get label() { 136 return get(label); 137 }, 138 139 get info() { 140 return gradio.props.info; 141 }, 142 143 get show_label() { 144 return gradio.shared.show_label; 145 }, 146 147 get lines() { 148 return gradio.props.lines; 149 }, 150 151 get type() { 152 return gradio.props.type; 153 }, 154 155 get rtl() { 156 return gradio.props.rtl; 157 }, 158 159 get text_align() { 160 return gradio.props.text_align; 161 }, 162 163 get max_lines() { 164 return gradio.props.max_lines; 165 }, 166 167 get placeholder() { 168 return gradio.props.placeholder; 169 }, 170 171 get submit_btn() { 172 return gradio.props.submit_btn; 173 }, 174 175 get stop_btn() { 176 return gradio.props.stop_btn; 177 }, 178 179 get buttons() { 180 return gradio.props.buttons; 181 }, 182 183 get autofocus() { 184 return gradio.props.autofocus; 185 }, 186 187 get container() { 188 return gradio.shared.container; 189 }, 190 191 get autoscroll() { 192 return gradio.shared.autoscroll; 193 }, 194 195 get max_length() { 196 return gradio.props.max_length; 197 }, 198 199 get html_attributes() { 200 return gradio.props.html_attributes; 201 }, 202 203 get validation_error() { 204 return get($0); 205 }, 206 onchange: handle_change, 207 oninput: handle_input, 208 onsubmit: () => { 209 gradio.shared.validation_error = null; 210 gradio.dispatch("submit"); 211 }, 212 onblur: () => gradio.dispatch("blur"), 213 onselect: (data) => gradio.dispatch("select", data), 214 onfocus: () => gradio.dispatch("focus"), 215 onstop: () => gradio.dispatch("stop"), 216 oncopy: (data) => gradio.dispatch("copy", data), 217 oncustombuttonclick: (id) => { 218 gradio.dispatch("custom_button_click", { id }); 219 }, 220 221 get disabled() { 222 return get($1); 223 }, 224 225 get value() { 226 return gradio.props.value; 227 }, 228 229 set value($$value) { 230 gradio.props.value = $$value; 231 } 232 }); 233 } 234 235 append($$anchor, fragment_1); 236 }, 237 $$slots: { default: true } 238 }); 239 240 pop(); 241} 242 243export { Textbox as BaseTextbox, Index as default }; 244//# sourceMappingURL=Index-m_Bbn_W3.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.