import{p as x,i as y,g as A,r as T}from"./i18n-Dnhn5Rxr.js";import{R as B,S as I,w as s,a as P,T as U,X as k,a5 as u,W as z,u as v,v as W,y as L,x as w,M}from"./index-DWyDLubb.js";import{s as R}from"./clone-BkeCM4Nl.js";import{G as X}from"./utils.svelte-CCyS_0CY.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{B as j}from"./BlockLabel-CZd21Hkw.js";import{E as q}from"./Empty-BIB2W5at.js";import{F}from"./File-BHHIF0P7.js";import{I as C}from"./IconButtonWrapper-D0s9l4wW.js";import{F as D,a as H}from"./FileUpload-yTZ4bq_L.js";import{B as J}from"./Block-J4oodUWp.js";import{U as K}from"./UploadText-oRnvaG4b.js";import{S as N}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import{default as xe}from"./Example-m_TAV22D.js";import"./snippet-BWgYNF9D.js";import"./Upload-HitvyI7k.js";import"./actions-CLThs9VH.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./DownloadLink-TGTaev7f.js";import"./index-B_pwUImq.js";/* empty css                                              */var O=z("<!> <!> <!>",1);function Q(m,t){B(t,!0);let d=x(t,"buttons",3,null),i=x(t,"on_custom_button_click",3,null);var c=O(),_=I(c);{var e=a=>{C(a,{get buttons(){return d()},get on_custom_button_click(){return i()}})};y(_,a=>{t.show_label&&d()&&d().length>0&&a(e)})}var p=k(_,2);{let a=u(()=>t.value===null),l=u(()=>t.label||"File");j(p,{get show_label(){return t.show_label},get float(){return s(a)},get Icon(){return F},get label(){return s(l)}})}var g=k(p,2);{var h=a=>{D(a,{get i18n(){return t.i18n},get selectable(){return t.selectable},get value(){return t.value},get height(){return t.height},$$events:{select(...l){t.on_select?.apply(this,l)},download(...l){t.on_download?.apply(this,l)}}})},f=a=>{q(a,{unpadded_box:!0,size:"large",children:(l,b)=>{F(l)},$$slots:{default:!0}})};y(g,a=>{t.value&&(!Array.isArray(t.value)||t.value.length>0)?a(h):a(f,!1)})}P(m,c),U()}var V=z("<!> <!>",1);function we(m,t){B(t,!0);const d=T(t,["$$slots","$$events","$$legacy"]);let i=v(null),c=v(!1);class _ extends X{async get_data(){return s(i)&&(await s(i),await M()),await super.get_data()}}const e=new _(d);let p=v(W(e.props.value));L(()=>{s(p)!==e.props.value&&(w(p,e.props.value,!0),e.dispatch("change",R(e.props.value)))});{let g=u(()=>e.props.value?"solid":"dashed"),h=u(()=>s(c)?"focus":"base");J(m,{get visible(){return e.shared.visible},get variant(){return s(g)},get border_mode(){return s(h)},padding:!1,get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},allow_overflow:!1,children:(f,a)=>{var l=V(),b=I(l);{let o=u(()=>e.shared.loading_status?.status||"complete");N(b,A({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{get status(){return s(o)},on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}))}var E=k(b,2);{var G=o=>{Q(o,{on_select:({detail:n})=>e.dispatch("select",n),on_download:({detail:n})=>e.dispatch("download",n),get selectable(){return e.props._selectable},get value(){return e.props.value},get label(){return e.shared.label},get show_label(){return e.shared.show_label},get height(){return e.props.height},get i18n(){return e.i18n},get buttons(){return e.props.buttons},on_custom_button_click:n=>{e.dispatch("custom_button_click",{id:n})}})},S=o=>{{let n=u(()=>e.props.height??void 0);H(o,{upload:(...r)=>e.shared.client.upload(...r),stream_handler:(...r)=>e.shared.client.stream(...r),get label(){return e.shared.label},get show_label(){return e.shared.show_label},get value(){return e.props.value},get file_count(){return e.props.file_count},get file_types(){return e.props.file_types},get selectable(){return e.props._selectable},get height(){return s(n)},get root(){return e.shared.root},get allow_reordering(){return e.props.allow_reordering},get max_file_size(){return e.shared.max_file_size},get buttons(){return e.props.buttons},on_custom_button_click:r=>{e.dispatch("custom_button_click",{id:r})},onchange:r=>{e.props.value=r},ondrag:r=>w(c,r,!0),onclear:()=>e.dispatch("clear"),onselect:r=>e.dispatch("select",r),onupload:()=>e.dispatch("upload"),onerror:r=>{e.shared.loading_status=e.shared.loading_status||{},e.shared.loading_status.status="error",e.dispatch("error",r)},ondelete:r=>{e.dispatch("delete",r)},get i18n(){return e.i18n},get upload_promise(){return s(i)},set upload_promise(r){w(i,r,!0)},children:(r,Y)=>{K(r,{get i18n(){return e.i18n},type:"file"})},$$slots:{default:!0}})}};y(E,o=>{e.shared.interactive?o(S,!1):o(G)})}P(f,l)},$$slots:{default:!0}})}U()}export{xe as BaseExample,Q as BaseFile,H as BaseFileUpload,D as FilePreview,we as default};
