import{S as L,i as q,s as G,c as N,a as B,B as S,m as C,f as k,D as O,k as D,E as Q,j as U,o as I,n as h,e as A,b,g as m,x as K,t as y,h as E,C as W,F as ne,aa as fe,I as Y,O as Z,L as x,P as oe,Q as ae,X as _e,R as se,T as re,U as ue,V as ce,K as T}from"./index.396f4a72.js";import{B as $}from"./BlockLabel.37da86a3.js";import{F as R}from"./File.60a988f4.js";import{U as ee}from"./Upload.5d0148e8.js";import{M as de}from"./ModifyUpload.2cfe71e4.js";import{n as be}from"./utils.27234e1d.js";const me=o=>{let e=["B","KB","MB","GB","PB"],i=0;for(;o>1024;)o/=1024,i++;let l=e[i];return o.toFixed(1)+" "+l},j=o=>{var e;return e=o.orig_name||o.name,e.length>30?`${e.substr(0,30)}...`:e},M=o=>o.data,P=o=>{var e=0;if(Array.isArray(o))for(var i of o)i.size!==void 0&&(e+=i.size);else e=o.size||0;return me(e)};function V(o,e,i){const l=o.slice();return l[3]=e[i],l}function ge(o){let e,i,l,t;return l=new R({}),{c(){e=A("div"),i=A("div"),N(l.$$.fragment),b(i,"class","h-5 dark:text-white opacity-50"),b(e,"class","h-full min-h-[15rem] flex justify-center items-center")},m(a,f){k(a,e,f),m(e,i),C(l,i,null),t=!0},p:K,i(a){t||(U(l.$$.fragment,a),t=!0)},o(a){D(l.$$.fragment,a),t=!1},d(a){a&&h(e),I(l)}}}function we(o){let e,i;function l(f,s){return s&1&&(i=null),i==null&&(i=!!Array.isArray(f[0])),i?ke:ve}let t=l(o,-1),a=t(o);return{c(){e=A("div"),a.c(),b(e,"class","file-preview overflow-y-scroll w-full max-h-60 flex flex-col justify-between mt-7 mb-7 dark:text-slate-200")},m(f,s){k(f,e,s),a.m(e,null)},p(f,s){t===(t=l(f,s))&&a?a.p(f,s):(a.d(1),a=t(f),a&&(a.c(),a.m(e,null)))},i:K,o:K,d(f){f&&h(e),a.d()}}}function ve(o){let e,i,l=j(o[0])+"",t,a,f,s=P(o[0])+"",r,u,n,_,c,d,z;return{c(){e=A("div"),i=A("div"),t=y(l),a=B(),f=A("div"),r=y(s),u=B(),n=A("div"),_=A("a"),c=y("Download"),b(i,"class","file-name w-5/12 p-2"),b(f,"class","file-size w-3/12 p-2"),b(_,"href",d=M(o[0])),b(_,"target",window.__is_colab__?"_blank":null),b(_,"download",z=window.__is_colab__?null:j(o[0])),b(_,"class","text-indigo-600 hover:underline dark:text-indigo-300"),b(n,"class","file-size w-3/12 p-2 hover:underline"),b(e,"class","flex flex-row")},m(g,p){k(g,e,p),m(e,i),m(i,t),m(e,a),m(e,f),m(f,r),m(e,u),m(e,n),m(n,_),m(_,c)},p(g,p){p&1&&l!==(l=j(g[0])+"")&&E(t,l),p&1&&s!==(s=P(g[0])+"")&&E(r,s),p&1&&d!==(d=M(g[0]))&&b(_,"href",d),p&1&&z!==(z=window.__is_colab__?null:j(g[0]))&&b(_,"download",z)},d(g){g&&h(e)}}}function ke(o){let e,i=o[0],l=[];for(let t=0;t{r[d]=null}),Q(),t=r[l],t?t.p(n,_):(t=r[l]=s[l](n),t.c()),U(t,1),t.m(a.parentNode,a))},i(n){f||(U(e.$$.fragment,n),U(t),f=!0)},o(n){D(e.$$.fragment,n),D(t),f=!1},d(n){I(e,n),n&&h(i),r[l].d(n),n&&h(a)}}}function pe(o,e,i){let{value:l}=e,{label:t}=e,{show_label:a}=e;return o.$$set=f=>{"value"in f&&i(0,l=f.value),"label"in f&&i(1,t=f.label),"show_label"in f&&i(2,a=f.show_label)},[l,t,a]}class Ae extends L{constructor(e){super(),q(this,e,pe,he,G,{value:0,label:1,show_label:2})}}function H(o,e,i){const l=o.slice();return l[15]=e[i],l}function ze(o){let e,i,l,t,a;i=new de({props:{absolute:!0}}),i.$on("clear",o[10]);function f(u,n){return n&1&&(t=null),t==null&&(t=!!Array.isArray(u[0])),t?je:Be}let s=f(o,-1),r=s(o);return{c(){e=A("div"),N(i.$$.fragment),l=B(),r.c(),b(e,"class","file-preview overflow-y-scroll w-full max-h-60 flex flex-col justify-between mt-7 mb-7 dark:text-slate-200")},m(u,n){k(u,e,n),C(i,e,null),m(e,l),r.m(e,null),a=!0},p(u,n){s===(s=f(u,n))&&r?r.p(u,n):(r.d(1),r=s(u),r&&(r.c(),r.m(e,null)))},i(u){a||(U(i.$$.fragment,u),a=!0)},o(u){D(i.$$.fragment,u),a=!1},d(u){u&&h(e),I(i),r.d()}}}function ye(o){let e,i,l;function t(f){o[13](f)}let a={filetype:o[8],file_count:o[6],$$slots:{default:[De]},$$scope:{ctx:o}};return o[7]!==void 0&&(a.dragging=o[7]),e=new ee({props:a}),Y.push(()=>Z(e,"dragging",t)),e.$on("load",o[9]),{c(){N(e.$$.fragment)},m(f,s){C(e,f,s),l=!0},p(f,s){const r={};s&256&&(r.filetype=f[8]),s&64&&(r.file_count=f[6]),s&262158&&(r.$$scope={dirty:s,ctx:f}),!i&&s&128&&(i=!0,r.dragging=f[7],x(()=>i=!1)),e.$set(r)},i(f){l||(U(e.$$.fragment,f),l=!0)},o(f){D(e.$$.fragment,f),l=!1},d(f){I(e,f)}}}function Fe(o){let e,i,l;function t(f){o[12](f)}let a={filetype:o[8],$$slots:{default:[Ue]},$$scope:{ctx:o}};return o[7]!==void 0&&(a.dragging=o[7]),e=new ee({props:a}),Y.push(()=>Z(e,"dragging",t)),e.$on("load",o[9]),{c(){N(e.$$.fragment)},m(f,s){C(e,f,s),l=!0},p(f,s){const r={};s&256&&(r.filetype=f[8]),s&262158&&(r.$$scope={dirty:s,ctx:f}),!i&&s&128&&(i=!0,r.dragging=f[7],x(()=>i=!1)),e.$set(r)},i(f){l||(U(e.$$.fragment,f),l=!0)},o(f){D(e.$$.fragment,f),l=!1},d(f){I(e,f)}}}function Be(o){let e,i,l=j(o[0])+"",t,a,f,s=P(o[0])+"",r,u,n,_,c,d,z;return{c(){e=A("div"),i=A("div"),t=y(l),a=B(),f=A("div"),r=y(s),u=B(),n=A("div"),_=A("a"),c=y("Download"),b(i,"class","file-name p-2"),b(f,"class","file-size p-2"),b(_,"href",d=M(o[0])),b(_,"download",z=j(o[0])),b(_,"class","text-indigo-600 hover:underline dark:text-indigo-300"),b(n,"class","file-size p-2 hover:underline"),b(e,"class","flex flex-row")},m(g,p){k(g,e,p),m(e,i),m(i,t),m(e,a),m(e,f),m(f,r),m(e,u),m(e,n),m(n,_),m(_,c)},p(g,p){p&1&&l!==(l=j(g[0])+"")&&E(t,l),p&1&&s!==(s=P(g[0])+"")&&E(r,s),p&1&&d!==(d=M(g[0]))&&b(_,"href",d),p&1&&z!==(z=j(g[0]))&&b(_,"download",z)},d(g){g&&h(e)}}}function je(o){let e,i=o[0],l=[];for(let t=0;t{r[d]=null}),Q(),t=r[l],t?t.p(n,_):(t=r[l]=s[l](n),t.c()),U(t,1),t.m(a.parentNode,a))},i(n){f||(U(e.$$.fragment,n),U(t),f=!0)},o(n){D(e.$$.fragment,n),D(t),f=!1},d(n){I(e,n),n&&h(i),r[l].d(n),n&&h(a)}}}function Ne(o,e,i){let{value:l}=e,{drop_text:t="Drop a file"}=e,{or_text:a="or"}=e,{upload_text:f="click to upload"}=e,{label:s=""}=e,{show_label:r}=e,{file_count:u}=e,{file_types:n=["file"]}=e;async function _({detail:w}){i(0,l=w),await fe(),d("change",l),d("upload",w)}function c({detail:w}){i(0,l=null),d("change",l),d("clear")}const d=ne();let z="";try{n.forEach(w=>i(8,z+=w+"/*, "))}catch(w){if(w instanceof TypeError)d("error","Please set file_types to a list.");else throw w}let g=!1;function p(w){g=w,i(7,g)}function F(w){g=w,i(7,g)}return o.$$set=w=>{"value"in w&&i(0,l=w.value),"drop_text"in w&&i(1,t=w.drop_text),"or_text"in w&&i(2,a=w.or_text),"upload_text"in w&&i(3,f=w.upload_text),"label"in w&&i(4,s=w.label),"show_label"in w&&i(5,r=w.show_label),"file_count"in w&&i(6,u=w.file_count),"file_types"in w&&i(11,n=w.file_types)},o.$$.update=()=>{o.$$.dirty&128&&d("drag",g)},[l,t,a,f,s,r,u,g,z,_,c,n,p,F]}class Ce extends L{constructor(e){super(),q(this,e,Ne,Ee,G,{value:0,drop_text:1,or_text:2,upload_text:3,label:4,show_label:5,file_count:6,file_types:11})}}function Ie(o){let e,i;return e=new Ae({props:{value:o[9],label:o[4],show_label:o[5]}}),{c(){N(e.$$.fragment)},m(l,t){C(e,l,t),i=!0},p(l,t){const a={};t&512&&(a.value=l[9]),t&16&&(a.label=l[4]),t&32&&(a.show_label=l[5]),e.$set(a)},i(l){i||(U(e.$$.fragment,l),i=!0)},o(l){D(e.$$.fragment,l),i=!1},d(l){I(e,l)}}}function Me(o){let e,i;return e=new Ce({props:{label:o[4],show_label:o[5],value:o[9],file_count:o[6],file_types:o[7],drop_text:o[11]("interface.drop_file"),or_text:o[11]("or"),upload_text:o[11]("interface.click_to_upload")}}),e.$on("change",o[14]),e.$on("drag",o[15]),e.$on("change",o[16]),e.$on("clear",o[17]),e.$on("upload",o[18]),{c(){N(e.$$.fragment)},m(l,t){C(e,l,t),i=!0},p(l,t){const a={};t&16&&(a.label=l[4]),t&32&&(a.show_label=l[5]),t&512&&(a.value=l[9]),t&64&&(a.file_count=l[6]),t&128&&(a.file_types=l[7]),t&2048&&(a.drop_text=l[11]("interface.drop_file")),t&2048&&(a.or_text=l[11]("or")),t&2048&&(a.upload_text=l[11]("interface.click_to_upload")),e.$set(a)},i(l){i||(U(e.$$.fragment,l),i=!0)},o(l){D(e.$$.fragment,l),i=!1},d(l){I(e,l)}}}function Pe(o){let e,i,l,t,a,f;const s=[o[8]];let r={};for(let c=0;c{n[g]=null}),Q(),t=n[l],t?t.p(c,d):(t=n[l]=u[l](c),t.c()),U(t,1),t.m(a.parentNode,a))},i(c){f||(U(e.$$.fragment,c),U(t),f=!0)},o(c){D(e.$$.fragment,c),D(t),f=!1},d(c){I(e,c),c&&h(i),n[l].d(c),c&&h(a)}}}function Se(o){let e,i;return e=new oe({props:{visible:o[2],variant:o[3]==="dynamic"&&o[0]===null?"dashed":"solid",color:o[10]?"green":"grey",padding:!1,elem_id:o[1],$$slots:{default:[Pe]},$$scope:{ctx:o}}}),{c(){N(e.$$.fragment)},m(l,t){C(e,l,t),i=!0},p(l,[t]){const a={};t&4&&(a.visible=l[2]),t&9&&(a.variant=l[3]==="dynamic"&&l[0]===null?"dashed":"solid"),t&1024&&(a.color=l[10]?"green":"grey"),t&2&&(a.elem_id=l[1]),t&528377&&(a.$$scope={dirty:t,ctx:l}),e.$set(a)},i(l){i||(U(e.$$.fragment,l),i=!0)},o(l){D(e.$$.fragment,l),i=!1},d(l){I(e,l)}}}function Te(o,e,i){let l;ae(o,_e,v=>i(11,l=v));let{elem_id:t=""}=e,{visible:a=!0}=e,{value:f=null}=e,{mode:s}=e,{root:r}=e,{label:u}=e,{show_label:n}=e,{file_count:_}=e,{file_types:c=["file"]}=e,{root_url:d}=e,{loading_status:z}=e,g,p=!1;const F=({detail:v})=>i(0,f=v),w=({detail:v})=>i(10,p=v);function le(v){T.call(this,o,v)}function te(v){T.call(this,o,v)}function ie(v){T.call(this,o,v)}return o.$$set=v=>{"elem_id"in v&&i(1,t=v.elem_id),"visible"in v&&i(2,a=v.visible),"value"in v&&i(0,f=v.value),"mode"in v&&i(3,s=v.mode),"root"in v&&i(12,r=v.root),"label"in v&&i(4,u=v.label),"show_label"in v&&i(5,n=v.show_label),"file_count"in v&&i(6,_=v.file_count),"file_types"in v&&i(7,c=v.file_types),"root_url"in v&&i(13,d=v.root_url),"loading_status"in v&&i(8,z=v.loading_status)},o.$$.update=()=>{o.$$.dirty&12289&&i(9,g=be(f,d??r))},[f,t,a,s,u,n,_,c,z,g,p,l,r,d,F,w,le,te,ie]}class Ke extends L{constructor(e){super(),q(this,e,Te,Se,G,{elem_id:1,visible:2,value:0,mode:3,root:12,label:4,show_label:5,file_count:6,file_types:7,root_url:13,loading_status:8})}}var Ve=Ke;const Xe=["static","dynamic"],He=o=>({type:"{ name: string; data: string }",description:"file name and base64 data as an object",example_data:{name:"zip.zip",data:"data:@file/octet-stream;base64,UEsFBgAAAAAAAAAAAAAAAAAAAAAAAA=="}});export{Ve as Component,He as document,Xe as modes}; //# sourceMappingURL=index.5d3ef6e5.js.map