import{i as v,g as T,b as A,f as C,r as G}from"./i18n-eTakDDhg.js";import{R as H,u as J,v as M,y as N,w as n,x as W,S as z,t as R,a as U,X as p,V,T as X,a5 as b,au as Y,W as q,Y as D}from"./index-BkylzejB.js";import{G as F,c as w}from"./utils.svelte-DZ62NrTu.js";import K from"./HTML-BOqaom7o.js";import{S as O}from"./index-C-r_2iGV.js";import"./StreamingBar.svelte_svelte_type_style_lang-CFNH9sqm.js";import{B as P}from"./Block-Bl_3z_UU.js";import"./ScrollFade.svelte_svelte_type_style_lang-De9nUaYy.js";import{B as Q}from"./BlockLabel-Da0UC1oT.js";import{C as Z}from"./Code-DfJdpJtn.js";import{I as ee}from"./IconButtonWrapper-33oacT7w.js";import{default as ye}from"./Example-CuRLsz5x.js";import"./clone-IGppQJ7B.js";import"./snippet-CC9u6I34.js";import"./Clear-Daql2pLY.js";import"./html-DvOIMrhY.js";import"./index-B_pwUImq.js";var te=q("<!> <!> <!> <div><!></div>",1);function ve(y,i){H(i,!0);let $=G(i,["$$slots","$$events","$$legacy"]),x=i.children;const e=new F($);let k=b(()=>({value:e.props.value??"",label:e.shared.label,visible:e.shared.visible,...e.props.props})),d=J(M(e.props.value));N(()=>{JSON.stringify(n(d))!==JSON.stringify(e.props.value)&&(W(d,e.props.value,!0),e.dispatch("change"))});let u=[];function B(a,s){const r=Array.isArray(a)?a:[a];u.push({props:r,callback:s})}function S(a){const s=new Set;for(const r of u)r.props.some(o=>a.includes(o))&&s.add(r);for(const r of s)try{r.callback()}catch(o){console.error("Error in watch callback:",o)}}async function E(a){try{const s=await Y([a]),r=await e.shared.client.upload(s,e.shared.root,void 0,e.shared.max_file_size??void 0);if(r&&r[0])return{path:r[0].path,url:r[0].url};throw new Error("Upload failed")}catch(s){throw e.dispatch("error",s instanceof Error?s.message:String(s)),s}}{let a=b(()=>e.props.padding!==!1);P(y,{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 n(a)},overflow_behavior:"visible",children:(s,r)=>{var o=te(),c=z(o);{var I=t=>{ee(t,{get buttons(){return e.props.buttons},on_custom_button_click:g=>{e.dispatch("custom_button_click",{id:g})}})};v(c,t=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&t(I)})}var h=p(c,2);{var j=t=>{Q(t,{get Icon(){return Z},get show_label(){return e.shared.show_label},get label(){return e.shared.label},float:!0})};v(h,t=>{e.shared.show_label&&t(j)})}var _=p(h,2);O(_,T({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=p(_,2);let f,m;var L=V(l);K(L,{get props(){return n(k)},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 head(){return e.props.head},get component_class_name(){return e.props.component_class_name},upload:E,get server(){return e.shared.server},watch_fn:B,fire_watchers:S,$$events:{event:t=>{e.dispatch(t.detail.type,t.detail.data)},update_value:t=>{t.detail.property==="value"?e.props.value=t.detail.data:t.detail.property==="label"?e.shared.label=t.detail.data:t.detail.property==="visible"&&(e.shared.visible=t.detail.data)}},children:(t,g)=>{x?.(t)},$$slots:{default:!0}}),D(l),R(t=>{f=A(l,1,"html-container svelte-1jts93g",null,f,{pending:e.shared.loading_status?.status==="pending"&&e.shared.loading_status?.show_progress!=="hidden","label-padding":e.shared.show_label??void 0}),m=C(l,"",m,t)},[()=>({"min-height":e.props.min_height&&e.shared.loading_status?.status!=="pending"?w(e.props.min_height):void 0,"max-height":e.props.max_height?w(e.props.max_height):void 0,"overflow-y":e.props.max_height?"auto":void 0})]),U(s,o)},$$slots:{default:!0}})}X()}export{ye as BaseExample,K as BaseHTML,ve as default};
