import { f as fallback, e as escape_html } from './async-Mo2Ia14K.js';
import { b as spread_props, c as bind_props, f as attr_class, e as ensure_array_like, a as attr } from './index-D1Ptw7Az.js';
import { g, c as G, a as U, e as y } from './2-B89dC7Mi.js';
import { i } from './File-BPgKwfYm.js';
import { c as createEventDispatcher } from './spring-DE8vsW2o.js';
import { k } from './BlockLabel-qrJKniS-.js';
import './index5-BoOEKc6P.js';
import './dev-fallback-Bc5Ork7Y.js';
import 'path';
import 'url';
import 'fs';

function D(r){r.push('<svg width="100%" height="100%" viewBox="0 0 14 17" version="1.1" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"><g transform="matrix(1,0,0,1,-10.6667,-7.73588)"><path d="M12.7,24.033C12.256,24.322 11.806,24.339 11.351,24.084C10.896,23.829 10.668,23.434 10.667,22.9L10.667,9.1C10.667,8.567 10.895,8.172 11.351,7.916C11.807,7.66 12.256,7.677 12.7,7.967L23.567,14.867C23.967,15.133 24.167,15.511 24.167,16C24.167,16.489 23.967,16.867 23.567,17.133L12.7,24.033Z" style="fill:currentColor;fill-rule:nonzero;"></path></g></svg>');}function E(r,s$1){r.component(t=>{let o=s$1.value,p=s$1.disabled;t.push(`<input${attr("checked",o,true)} type="checkbox"${attr("disabled",p,true)}${attr_class("svelte-3g0mcl",void 0,{disabled:p&&!o})}/>`),bind_props(s$1,{value:o,disabled:p});});}const T="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='32'%20height='32'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='%23888888'%20d='M6%202c-1.1%200-1.99.9-1.99%202L4%2020c0%201.1.89%202%201.99%202H18c1.1%200%202-.9%202-2V8l-6-6H6zm7%207V3.5L18.5%209H13z'/%3e%3c/svg%3e",H="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3csvg%20viewBox='0%200%2032%2032'%20version='1.1'%20id='svg7'%20sodipodi:docname='light-folder-new.svg'%20inkscape:version='1.3.2%20(091e20e,%202023-11-25)'%20xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape'%20xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:svg='http://www.w3.org/2000/svg'%3e%3csodipodi:namedview%20id='namedview7'%20pagecolor='%23ffffff'%20bordercolor='%23000000'%20borderopacity='0.25'%20inkscape:showpageshadow='2'%20inkscape:pageopacity='0.0'%20inkscape:pagecheckerboard='0'%20inkscape:deskcolor='%23d1d1d1'%20inkscape:zoom='7.375'%20inkscape:cx='15.932203'%20inkscape:cy='16'%20inkscape:window-width='1312'%20inkscape:window-height='529'%20inkscape:window-x='0'%20inkscape:window-y='38'%20inkscape:window-maximized='0'%20inkscape:current-layer='svg7'%20/%3e%3cdefs%20id='defs6'%3e%3cclipPath%20id='clipPath1'%3e%3cpath%20d='m69.63%2012.145h-.052c-22.727-.292-46.47%204.077-46.709%204.122-2.424.451-4.946%202.974-5.397%205.397-.044.237-4.414%2023.983-4.122%2046.71-.292%2022.777%204.078%2046.523%204.122%2046.761.451%202.423%202.974%204.945%205.398%205.398.237.044%2023.982%204.413%2046.709%204.121%2022.779.292%2046.524-4.077%2046.761-4.121%202.423-.452%204.946-2.976%205.398-5.399.044-.236%204.413-23.981%204.121-46.709.292-22.777-4.077-46.523-4.121-46.761-.453-2.423-2.976-4.946-5.398-5.397-.238-.045-23.984-4.414-46.71-4.122'%20id='path1'%20/%3e%3c/clipPath%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20y2='352.98'%20x2='-601.15'%20y1='663.95'%20x1='-591.02'%20id='2'%3e%3cstop%20stop-color='%23a0a0a0'%20id='stop1'%20/%3e%3cstop%20offset='1'%20stop-color='%23aaa'%20id='stop2'%20/%3e%3c/linearGradient%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20y2='354.29'%20x2='-704.05'%20y1='647.77'%20x1='-701.19'%20id='1'%3e%3cstop%20stop-color='%23acabab'%20id='stop3'%20/%3e%3cstop%20offset='1'%20stop-color='%23d4d4d4'%20id='stop4'%20/%3e%3c/linearGradient%3e%3clinearGradient%20id='0'%20x1='59.12'%20y1='-19.888'%20x2='59.15'%20y2='-37.783'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(4.17478%200%200%204.16765-1069.7%20447.73)'%3e%3cstop%20stop-color='%23a0a0a0'%20id='stop5'%20/%3e%3cstop%20offset='1'%20stop-color='%23bdbdbd'%20id='stop6'%20/%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20transform='matrix(.07089%200%200%20.07017%2023.295-40.67)'%20fill='%2360aae5'%20id='g7'%20style='fill:%23888888;fill-opacity:1'%3e%3cpath%20transform='matrix(.7872%200%200%20.79524%20415.34%20430.11)'%20d='m-884.1%20294.78c-4.626%200-8.349%203.718-8.349%208.335v161.41l468.19%201v-121.2c0-4.618-3.724-8.335-8.35-8.335h-272.65c-8.51.751-9.607-.377-13.812-5.981-5.964-7.968-14.969-21.443-20.84-29.21-4.712-6.805-5.477-6.02-13.292-6.02z'%20fill='url(%230)'%20color='%23000'%20id='path6'%20style='fill:%23888888;fill-opacity:1'%20/%3e%3crect%20transform='matrix(.7872%200%200%20.79524%20415.34%20430.11)'%20y='356.85'%20x='-890.28'%20height='295.13'%20width='463.85'%20fill='url(%231)'%20stroke='url(%231)'%20stroke-width='2.378'%20rx='9.63'%20id='rect6'%20style='fill:%23888888;fill-opacity:1'%20/%3e%3crect%20width='463.85'%20height='295.13'%20x='-890.28'%20y='356.85'%20transform='matrix(.7872%200%200%20.79524%20415.34%20430.11)'%20fill='none'%20stroke='url(%232)'%20stroke-linejoin='round'%20stroke-linecap='round'%20stroke-width='5.376'%20rx='9.63'%20id='rect7'%20style='fill:%23888888;fill-opacity:1'%20/%3e%3c/g%3e%3c/svg%3e";function B(r,s$1){r.component(t=>{let o=fallback(s$1.path,()=>[],true),p=fallback(s$1.index_path,()=>[],true),h=fallback(s$1.selected_files,()=>[],true),e=fallback(s$1.selected_folders,()=>[],true),d=fallback(s$1.is_selected_entirely,false),n=s$1.interactive,f=fallback(s$1.selectable,false),g=s$1.ls_fn,i=fallback(s$1.file_count,"multiple"),m=s$1.valid_for_selection,_=[],b=[];(async()=>(_=await g(o),m&&(_=[{name:".",type:"file"},..._]),b=_.map((a,w)=>a.type==="folder"&&(d||h.some(v=>v[0]===a.name))?w:null).filter(a=>a!==null)))();const C=createEventDispatcher();d&&_.forEach(a=>{C("check",{path:[...o,a.name],checked:true,type:a.type});}),t.push(`<ul${attr_class("svelte-6im0c4",void 0,{"no-checkboxes":!n,root:o.length===0})}><!--[-->`);const x=ensure_array_like(_);for(let a=0,w=x.length;a<w;a++){let{type:v,name:u,valid:G}=x[a];const y=(v==="file"?h:e).some(c=>c[0]===u&&c.length===1);t.push(`<li class="svelte-6im0c4"><span${attr_class("wrap svelte-6im0c4",void 0,{selected:!n&&y,selectable:f})}${attr("role",f?"button":void 0)}${attr("tabindex",f?0:void 0)}>`),n?(t.push("<!--[-->"),v==="folder"&&i==="single"?(t.push("<!--[-->"),t.push('<span class="no-checkbox svelte-6im0c4" aria-hidden="true"></span>')):(t.push("<!--[!-->"),E(t,{disabled:false,value:y})),t.push("<!--]-->")):t.push("<!--[!-->"),t.push("<!--]--> "),v==="folder"?(t.push("<!--[-->"),t.push(`<span${attr_class("icon svelte-6im0c4",void 0,{hidden:!b.includes(a)})} role="button" aria-label="expand directory" tabindex="0">`),D(t),t.push("<!----></span>")):(t.push("<!--[!-->"),t.push(`<span class="file-icon svelte-6im0c4"><img${attr("src",u==="."?H:T)} alt="file icon" class="svelte-6im0c4"/></span>`)),t.push(`<!--]--> <span class="item-name svelte-6im0c4">${escape_html(u)}</span></span> `),v==="folder"&&b.includes(a)?(t.push("<!--[-->"),B(t,{path:[...o,u],index_path:[...p,a],selected_files:h.filter(c=>c[0]===u).map(c=>c.slice(1)),selected_folders:e.filter(c=>c[0]===u).map(c=>c.slice(1)),is_selected_entirely:e.some(c=>c[0]===u&&c.length===1),interactive:n,selectable:f,ls_fn:g,file_count:i,valid_for_selection:G}),t.push("<!---->")):t.push("<!--[!-->"),t.push("<!--]--></li>");}t.push("<!--]--></ul>"),bind_props(s$1,{path:o,index_path:p,selected_files:h,selected_folders:e,is_selected_entirely:d,interactive:n,selectable:f,ls_fn:g,file_count:i,valid_for_selection:m});});}function O(r,s$1){r.component(t=>{let o=s$1.interactive,p=fallback(s$1.file_count,"multiple"),h=fallback(s$1.value,()=>[],true),e=fallback(s$1.selectable,false),d=s$1.ls_fn,n=[];t.push('<div class="file-wrap svelte-1gs1iku">'),B(t,{path:[],selected_files:h,selected_folders:n,interactive:o,selectable:e,ls_fn:d,file_count:p,valid_for_selection:false}),t.push("<!----></div>"),bind_props(s$1,{interactive:o,file_count:p,value:h,selectable:e,ls_fn:d});});}function Y(r,s$1){r.component(t=>{const{$$slots:o,$$events:p,...h}=s$1,e=new g(h);e.props.value,e.props.root_dir,e.props.glob,e.props.ignore_glob;let d=true,n;function f(g){G(g,{visible:e.shared.visible,variant:e.props.value===null?"dashed":"solid",border_mode:"base",padding:false,elem_id:e.shared.elem_id,elem_classes:e.shared.elem_classes,container:e.shared.container,scale:e.shared.scale,min_width:e.shared.min_width,allow_overflow:true,overflow_behavior:"auto",height:e.props.height,max_height:e.props.max_height,min_height:e.props.min_height,children:i$1=>{U(i$1,spread_props([e.shared.loading_status,{autoscroll:e.shared.autoscroll,i18n:e.i18n,on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}])),i$1.push("<!----> "),e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0?(i$1.push("<!--[-->"),y(i$1,{buttons:e.props.buttons,on_custom_button_click:m=>{e.dispatch("custom_button_click",{id:m});}})):i$1.push("<!--[!-->"),i$1.push("<!--]--> "),k(i$1,{show_label:e.shared.show_label,Icon:i,label:e.shared.label||"FileExplorer",float:false}),i$1.push("<!----> <!---->"),O(i$1,{file_count:e.props.file_count,interactive:e.shared.interactive,selectable:e.props._selectable,ls_fn:e.shared.server.ls,get value(){return e.props.value},set value(m){e.props.value=m,d=false;}}),i$1.push("<!---->");},$$slots:{default:true}});}do d=true,n=t.copy(),f(n);while(!d);t.subsume(n);});}

export { Y as default };
//# sourceMappingURL=Index63-Dwm7l6sb.js.map
