import"./svelte/svelte_internal_flags_async.js";import*as t from"./svelte/svelte_internal_client.js";import"./i18n-CeTBXmsd.js";import{G as S,c as g}from"./utils.svelte-D2llzkGs.js";import k from"./HTML-C3Rdofge.js";import{S as j}from"./StreamingBar-m3Ywvutz.js";import{B as E,e as I,d as L,h as G}from"./ScrollFade-B34EcSMi.js";import"./svelte/svelte_internal_flags_legacy.js";import"./svelte/svelte_svelte.js";import{p as H}from"./index-xGeN4i2A.js";import{default as ie}from"./Example-DaRf_1sj.js";import"./svelte/svelte_store.js";import"./svelte/svelte_motion.js";import"./MarkdownCode-CEyGWpPm.js";import"./prism-python-BSSAvU0Z.js";import"./svelte/svelte_transition.js";import"./svelte/svelte_animate.js";import"./svelte/svelte_attachments.js";import"./svelte/svelte_easing.js";import"./svelte/svelte_internal_flags_tracing.js";import"./svelte/svelte_internal_server.js";import"./svelte/svelte_legacy.js";import"./svelte/svelte_reactivity.js";import"./svelte/svelte_reactivity_window.js";import"./svelte/svelte_server.js";import"./svelte/svelte_events.js";var J=t.from_html("<!> <!> <!> <div><!></div>",1);function ae(f,o){t.push(o,!0);let v=t.rest_props(o,["$$slots","$$events","$$legacy"]),b=o.children;const e=new S(v);let y=t.derived(()=>({value:e.props.value||"",label:e.shared.label,visible:e.shared.visible,...e.props.props})),p=t.state(t.proxy(e.props.value));t.user_effect(()=>{JSON.stringify(t.get(p))!==JSON.stringify(e.props.value)&&(t.set(p,e.props.value,!0),e.dispatch("change"))});async function w(i){try{const s=await H([i]),a=await e.shared.client.upload(s,e.shared.root,void 0,e.shared.max_file_size??void 0);if(a&&a[0])return{path:a[0].path,url:a[0].url};throw new Error("Upload failed")}catch(s){throw e.dispatch("error",s instanceof Error?s.message:String(s)),s}}{let i=t.derived(()=>e.props.padding!==!1);E(f,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get padding(){return t.get(i)},overflow_behavior:"visible",children:(s,a)=>{var n=J(),d=t.first_child(n);{var $=r=>{I(r,{get buttons(){return e.props.buttons},on_custom_button_click:c=>{e.dispatch("custom_button_click",{id:c})}})};t.if(d,r=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&r($)})}var u=t.sibling(d,2);{var x=r=>{L(r,{get Icon(){return G},get show_label(){return e.shared.show_label},get label(){return e.shared.label},float:!0})};t.if(u,r=>{e.shared.show_label&&r(x)})}var h=t.sibling(u,2);j(h,t.spread_props({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{variant:"center",on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var l=t.sibling(h,2);let _,m;var B=t.child(l);k(B,{get props(){return t.get(y)},get html_template(){return e.props.html_template},get css_template(){return e.props.css_template},get js_on_load(){return e.props.js_on_load},get elem_classes(){return e.shared.elem_classes},get visible(){return e.shared.visible},get autoscroll(){return e.shared.autoscroll},get apply_default_css(){return e.props.apply_default_css},get component_class_name(){return e.props.component_class_name},upload:w,get server(){return e.shared.server},$$events:{event:r=>{e.dispatch(r.detail.type,r.detail.data)},update_value:r=>{r.detail.property==="value"?e.props.value=r.detail.data:r.detail.property==="label"?e.shared.label=r.detail.data:r.detail.property==="visible"&&(e.shared.visible=r.detail.data)}},children:(r,c)=>{b?.(r)},$$slots:{default:!0}}),t.reset(l),t.template_effect(r=>{_=t.set_class(l,1,"html-container svelte-1jts93g",null,_,{pending:e.shared.loading_status?.status==="pending"&&e.shared.loading_status?.show_progress!=="hidden","label-padding":e.shared.show_label??void 0}),m=t.set_style(l,"",m,r)},[()=>({"min-height":e.props.min_height&&e.shared.loading_status?.status!=="pending"?g(e.props.min_height):void 0,"max-height":e.props.max_height?g(e.props.max_height):void 0,"overflow-y":e.props.max_height?"auto":void 0})]),t.append(s,n)},$$slots:{default:!0}})}t.pop()}export{ie as BaseExample,k as BaseHTML,ae as default};
