@marimo-team/frontend 0.23.10-dev56 → 0.23.10-dev57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{edit-page-p8VsTwE3.js → edit-page-CVBh4l1i.js} +3 -3
- package/dist/assets/file-explorer-panel-BCB8cwDd.js +26 -0
- package/dist/assets/{index-CdnLLLYn.js → index-D2v5nOjW.js} +2 -2
- package/dist/assets/{panels-CBe83v0S.js → panels-DYPu5IGJ.js} +1 -1
- package/dist/assets/{run-page-BdSzJWEw.js → run-page-DrqPHnz9.js} +1 -1
- package/dist/assets/state-DyKcYt57.js +1 -0
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/storage/__tests__/storage-inspector.test.ts +129 -2
- package/src/components/storage/storage-inspector.tsx +412 -39
- package/dist/assets/file-explorer-panel-GJ_Lqi4C.js +0 -26
- package/dist/assets/state-BkLoQLHX.js +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{s as Xe}from"./chunk-LvLJmgfZ.js";import{i as Rt,l as _e,n as ae,p as Ze,u as je}from"./useEvent-D91BmmQi.js";import{t as At}from"./react-Bj1aDYRI.js";import{D as Ht,In as Qe,Ti as qt,Tr as Kt,ki as et}from"./cells-CoFnpuSu.js";import"./react-dom-CSu739Rf.js";import{t as fe}from"./compiler-runtime-B3qBwwSJ.js";import{_ as Te}from"./useEventListener-DvoEXWke.js";import{t as Ut}from"./invariant-BUdrueMv.js";import{f as tt,h as Wt}from"./utils-CvI-39U6.js";import{T as Fe}from"./config-ClMcu_sV.js";import{t as le}from"./cn-DCUzRj2J.js";import{t as Gt}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-DFky0PAA.js";import{n as Jt}from"./multi-map-C4OANz8X.js";import{o as Yt}from"./alert-dialog-5BGIfskO.js";import"./popover-CNCYAwbC.js";import{a as X,c as ue,p as Xt,r as Zt,t as Qt}from"./dropdown-menu-CZ4XbE-c.js";import{Nt as ze,a as ea,i as at,m as ta,o as Me}from"./JsonOutput-DOmfCaR3.js";import{c as aa,i as $e,r as Pe}from"./download-B10yQcVE.js";import{r as rt}from"./radio-group-RRco4zNE.js";import{t as Z}from"./tooltip-B_PkSKN3.js";import{n as ra,t as K}from"./button-BbCh-29a.js";import{wt as na}from"./dist-D0HyMpgV.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{n as sa,r as Oe}from"./requests-DIwGYs0l.js";import{t as se}from"./createLucideIcon-D5guW7EU.js";import{a as oa,i as nt,l as st,n as De,o as ye,r as la,s as Le,t as ia}from"./state-DyKcYt57.js";import{n as ca}from"./LazyAnyLanguageCodeMirror-C7ALwTI_.js";import{t as da}from"./x-C-6liIBr.js";import{a as ma,i as Be,n as pa,r as ot,t as ge}from"./tree-actions-wXUHKee-.js";import{n as Ee}from"./markdown-renderer-DC51vSBA.js";import{u as ha}from"./toDate-B5A0DFEz.js";import{t as lt}from"./copy-BwrPA9zQ.js";import{t as Ie}from"./external-link-BTNxSavU.js";import{a as xa,i as it,n as ct,r as fa,t as ua}from"./file-icons-CtmUbkxd.js";import{t as dt}from"./file-BrdxGLRX.js";import{i as mt,r as ya,t as pt}from"./add-connection-dialog-wzfYao2B.js";import{n as be,t as ja}from"./spinner-Bhir8k53.js";import{a as ga,c as ba,d as va,f as wa,i as Na,l as ka,n as Ca,r as Sa,t as _a,u as Fa}from"./file-name-input-CHQhxLcF.js";import{t as ht}from"./plus-BgB18UzY.js";import{t as xt}from"./refresh-cw-DHwG4Mac.js";import{t as Ma}from"./save-Clg5dMoP.js";import{t as Pa}from"./triangle-alert-D2p96PEF.js";import{n as Da,t as Ta}from"./es-By9LYOsD.js";import"./dist-HyCgERnW.js";import"./dist-BwnT-_gD.js";import"./dist-rBRbke5D.js";import"./dist-RMRSa-Mj.js";import"./dist-BURue7-e.js";import{t as re}from"./use-toast-CJ1Tj2eC.js";import{t as za}from"./paths-D5zczhUD.js";import"./session-0B5NBztP.js";import"./purify.es-B9KxLTTS.js";import"./dates-CTxr0EqQ.js";import{n as ve}from"./copy-LK56fFow.js";import{t as $a}from"./copy-icon-BuRdHNPA.js";import{t as ft}from"./context-QkTujrKn.js";import{n as ut}from"./ImperativeModal-BW1dmntO.js";import{t as yt}from"./blob-Bgnx1kuY.js";import"./utils-DCL4n9wx.js";import"./vega-loader.browser-C8wT63Va.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{n as Oa,t as La}from"./alert-yTS3WpF4.js";import{n as jt}from"./error-banner-D0xvrLog.js";import"./chunk-5FQGJX7Z-D91x7QHS.js";import"./html-to-image-DkJzNEld.js";import{o as Ba}from"./focus-CjgVplbV.js";import{n as Ve}from"./useAsyncData-bgszE9F0.js";import"./react-resizable-panels.browser.esm-CV8-hvjx.js";import{a as Ea,f as Ia,o as gt,t as Va}from"./command-BmOGG6-2.js";import{a as Ra}from"./renderShortcut--ku7VECI.js";import{t as Aa}from"./bundle.esm-DjhGJy4I.js";import{n as Ha}from"./pathUtils-DPJ-EgtH.js";import{n as qa}from"./semaphore-qUGKVeAE.js";import{t as Ka}from"./empty-state-vCWg-_A9.js";import{t as Re}from"./formatting-DuH2AQgo.js";import{a as Ua,i as Wa,n as bt,r as vt,t as wt}from"./components--CWsNwF4.js";import{n as Nt,t as Ga}from"./marimo-icons-CLbC-oB3.js";import{t as Ja}from"./links-DoPgJNku.js";var Ya=se("book-plus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]),Xa=se("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),kt=se("file-plus-corner",[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]]),Za=se("file-symlink",[["path",{d:"M4 11V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"huwfnr"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m10 18 3-3-3-3",key:"18f6ys"}]]),Ct=se("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]),St=se("list-tree",[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]]),Qa=se("square-play",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}]]),_t=se("view",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]),L=Xe(At(),1),er=fe(),a=Xe(Gt(),1);const Ft=t=>{let e=(0,er.c)(17),{filename:r,filenameIcon:c,onBack:l,onRefresh:n,onDownload:m,actions:o}=t,p;e[0]===l?p=e[1]:(p=l&&(0,a.jsx)(Z,{content:"Back to file list",children:(0,a.jsx)(K,{variant:"text",size:"xs",onClick:l,children:(0,a.jsx)(st,{className:"h-4 w-4"})})}),e[0]=l,e[1]=p);let s;e[2]!==r||e[3]!==c?(s=r?(0,a.jsxs)("span",{className:"flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate",children:[c,r]}):(0,a.jsx)("span",{className:"flex-1"}),e[2]=r,e[3]=c,e[4]=s):s=e[4];let u;e[5]===n?u=e[6]:(u=n&&(0,a.jsx)(Z,{content:"Refresh",children:(0,a.jsx)(K,{variant:"text",size:"xs",onClick:n,children:(0,a.jsx)(xt,{className:"h-3.5 w-3.5"})})}),e[5]=n,e[6]=u);let x;e[7]===m?x=e[8]:(x=m&&(0,a.jsx)(Z,{content:"Download",children:(0,a.jsx)(K,{variant:"text",size:"xs",onClick:m,children:(0,a.jsx)(ze,{className:"h-3.5 w-3.5"})})}),e[7]=m,e[8]=x);let h;e[9]!==o||e[10]!==u||e[11]!==x?(h=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[u,o,x]}),e[9]=o,e[10]=u,e[11]=x,e[12]=h):h=e[12];let y;return e[13]!==p||e[14]!==s||e[15]!==h?(y=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[p,s,h]}),e[13]=p,e[14]=s,e[15]=h,e[16]=y):y=e[16],y};var tr=new Set(["http","file","in-memory"]);function Ae(t){return JSON.stringify(t).slice(1,-1)}const Mt=[{id:"read-file",label:"Insert read snippet",icon:Ya,getCode:t=>{if(t.entry.kind==="directory")return null;let e=Ae(t.entry.path);return t.backendType==="obstore"?`_data = ${t.variableName}.get("${e}").bytes()
|
|
2
|
+
_data`:`_data = ${t.variableName}.cat_file("${e}")
|
|
3
|
+
_data`}},{id:"download-file",label:"Insert download snippet",icon:Za,getCode:t=>{if(t.entry.kind==="directory")return null;let e=Ae(t.entry.path);if(t.backendType==="obstore")return tr.has(t.protocol)?null:`from datetime import timedelta
|
|
4
|
+
from obstore import sign
|
|
5
|
+
|
|
6
|
+
signed_url = sign(
|
|
7
|
+
${t.variableName}, "GET", "${e}",
|
|
8
|
+
expires_in=timedelta(hours=1),
|
|
9
|
+
)
|
|
10
|
+
signed_url`;let r=Ae(t.entry.path.split("/").pop()||"download");return`${t.variableName}.get("${e}", "${r}")`}}];var ar=100*1024*1024;function rr(t){let e=t.endsWith("/")?t.slice(0,-1):t,r=e.split("/");return r[r.length-1]||e}const nr=({entry:t,namespace:e,protocol:r,backendType:c,onBack:l})=>{let{locale:n}=ft(),m=rt(),o=rr(t.path),p=t.mimeType||"text/plain",s=Me(p),u=s&&t.size>ar&&t.size>0,{data:x,isPending:h,error:y,refetch:j}=Ve(async()=>{if(u)return null;let d=await Le.request({namespace:e,path:t.path,preview:!s});if(d.error)throw Error(d.error);if(!d.url)throw Error("No URL returned");if(s)return{type:"media",url:d.url};let g=await fetch(d.url);if(!g.ok)throw Error(`Failed to fetch preview: ${g.statusText}`);return{type:"text",content:await g.text()}},[e,t.path,s,u]),k=(0,L.useCallback)(async()=>{try{let d=await Le.request({namespace:e,path:t.path});if(d.error){re({title:"Download failed",description:d.error,variant:"danger"});return}d.url&&$e(d.url,d.filename??o)}catch(d){Te.error("Failed to download storage entry",d),re({title:"Download failed",description:String(d),variant:"danger"})}},[e,t.path,o]),C=Mt.map(d=>{let g=d.getCode({variableName:e,protocol:r,entry:t,backendType:c});if(g===null)return null;let _=d.icon;return(0,a.jsx)(Z,{content:d.label,children:(0,a.jsx)(K,{variant:"text",size:"xs",onClick:()=>m(g),"aria-label":d.label,children:(0,a.jsx)(_,{className:"h-3.5 w-3.5"})})},d.id)}),f=(0,a.jsx)(Ft,{filename:o,filenameIcon:it(o),onBack:l,onDownload:k,actions:C}),b=({includeMime:d=!1})=>(0,a.jsxs)("div",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs",children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Path"}),(0,a.jsxs)("div",{className:"truncate flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"font-mono text-[11px]",children:t.path}),(0,a.jsx)($a,{value:t.path,className:"h-3 w-3"})]}),d&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),d&&(0,a.jsx)("span",{children:p}),t.size>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Size"}),(0,a.jsx)("span",{children:Re(t.size,n)})]}),t.lastModified!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Modified"}),(0,a.jsx)("span",{children:new Date(t.lastModified*1e3).toLocaleString()})]})]});return u?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[f,b({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-muted-foreground italic",children:["File is too large to preview (",Re(t.size,n),")."]})]}):h?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[f,b({}),(0,a.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24",children:[(0,a.jsx)(be,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):y?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[f,b({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",y.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)(K,{variant:"secondary",size:"xs",onClick:j,children:[(0,a.jsx)(xt,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):x?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[f,b({}),(0,a.jsx)(at,{mimeType:p,contents:x.type==="text"?x.content:void 0,mediaSource:x.type==="media"?{url:x.url}:void 0})]}):(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[f,b({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(dt,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var He=fe(),sr=16;function ie(t){return{paddingLeft:t*sr}}function or(t,e){return new Date(t*1e3).toLocaleDateString(e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function qe(t){let e=t.endsWith("/")?t.slice(0,-1):t,r=e.split("/");return r[r.length-1]||e}function Ke(t){return t.endsWith("/")?t:`${t}/`}function Ue(t,e){var c;let r=(c=t.metadata)==null?void 0:c.id;return typeof r=="string"&&r.length>0?r:`${t.path}::${e}`}function We(t,{namespace:e,searchValue:r,entriesByPath:c}){let l=r.trim().toLowerCase(),n=t.path.toLowerCase();if(qe(t.path).toLowerCase().includes(l)||n.includes(l))return!0;if(t.kind==="directory"){let m=c.get(ye(e,Ke(t.path)));if(m)return m.some(o=>We(o,{namespace:e,searchValue:r,entriesByPath:c}))}return!1}function we(t,e){return e.searchValue.trim()?t.filter(r=>We(r,e)):t}var lr=5;function ir(t){return{query:t,status:"idle"}}function Pt(t){return t.status==="idle"||t.status==="error"||t.status==="capped"}function cr({hasSearch:t,hasLoadedMatches:e,isPending:r,remoteSearch:c,searchKey:l,entriesByPath:n,pageMetadataByPath:m}){var o;return!t||e||r||!Pt(c)?!1:n.get(l)===void 0||((o=m.get(l))==null?void 0:o.nextPageToken)!=null}function Ge(t){let e=t.trim(),r=e.lastIndexOf("/");return r===-1?"":e.slice(0,r+1)}function dr(t,e){let r=e.trim().toLowerCase();return r?t.path.toLowerCase().includes(r)||qe(t.path).toLowerCase().includes(r):!0}var Dt=t=>{let e=(0,He.c)(15),{depth:r,isLoading:c,error:l,onLoadMore:n}=t,m;e[0]===r?m=e[1]:(m=ie(r),e[0]=r,e[1]=m);let o;e[2]===c?o=e[3]:(o=c&&(0,a.jsx)(be,{className:"h-3 w-3 mr-1 animate-spin"}),e[2]=c,e[3]=o);let p=c?"Loading...":"Load more",s;e[4]!==c||e[5]!==n||e[6]!==o||e[7]!==p?(s=(0,a.jsxs)(K,{variant:"text",size:"xs",className:"h-6 px-0 hover:text-blue-600",disabled:c,onClick:n,children:[o,p]}),e[4]=c,e[5]=n,e[6]=o,e[7]=p,e[8]=s):s=e[8];let u;e[9]===l?u=e[10]:(u=l&&(0,a.jsxs)("span",{className:"ml-2 text-destructive",children:["Failed to load: ",l.message]}),e[9]=l,e[10]=u);let x;return e[11]!==m||e[12]!==s||e[13]!==u?(x=(0,a.jsxs)("div",{className:"py-px text-xs",style:m,children:[s,u]}),e[11]=m,e[12]=s,e[13]=u,e[14]=x):x=e[14],x},mr=t=>{let e=(0,He.c)(44),{namespace:r,protocol:c,rootPath:l,backendType:n,prefix:m,depth:o,locale:p,searchValue:s,onOpenFile:u}=t,{entriesByPath:x}=De(),{entries:h,isPending:y,error:j,hasMore:k,loadMore:C,isLoadingMore:f,loadMoreError:b}=nt(r,m);if(y){let i;e[0]===o?i=e[1]:(i=ie(o),e[0]=o,e[1]=i);let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=(0,a.jsx)(be,{className:"h-3 w-3 animate-spin"}),e[2]=v):v=e[2];let S;return e[3]===i?S=e[4]:(S=(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:i,children:[v,"Loading..."]}),e[3]=i,e[4]=S),S}if(j){let i;e[5]===o?i=e[6]:(i=ie(o),e[5]=o,e[6]=i);let v;return e[7]!==j.message||e[8]!==i?(v=(0,a.jsxs)("div",{className:"py-1 text-xs text-destructive",style:i,children:["Failed to load: ",j.message]}),e[7]=j.message,e[8]=i,e[9]=v):v=e[9],v}if(h.length===0){let i;e[10]===o?i=e[11]:(i=ie(o),e[10]=o,e[11]=i);let v;return e[12]===i?v=e[13]:(v=(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:i,children:"Empty"}),e[12]=i,e[13]=v),v}let d;if(e[14]!==n||e[15]!==h||e[16]!==o||e[17]!==x||e[18]!==p||e[19]!==r||e[20]!==u||e[21]!==c||e[22]!==l||e[23]!==s){let i=we(h,{namespace:r,searchValue:s,entriesByPath:x}),v;e[25]!==n||e[26]!==h||e[27]!==o||e[28]!==p||e[29]!==r||e[30]!==u||e[31]!==c||e[32]!==l||e[33]!==s?(v=S=>{let F=Ue(S,h.indexOf(S));return(0,a.jsx)(Je,{rowKey:F,entry:S,namespace:r,protocol:c,rootPath:l,backendType:n,depth:o,locale:p,searchValue:s,onOpenFile:u},F)},e[25]=n,e[26]=h,e[27]=o,e[28]=p,e[29]=r,e[30]=u,e[31]=c,e[32]=l,e[33]=s,e[34]=v):v=e[34],d=i.map(v),e[14]=n,e[15]=h,e[16]=o,e[17]=x,e[18]=p,e[19]=r,e[20]=u,e[21]=c,e[22]=l,e[23]=s,e[24]=d}else d=e[24];let g;e[35]!==o||e[36]!==k||e[37]!==f||e[38]!==C||e[39]!==b?(g=k&&(0,a.jsx)(Dt,{depth:o,isLoading:f,error:b,onLoadMore:C}),e[35]=o,e[36]=k,e[37]=f,e[38]=C,e[39]=b,e[40]=g):g=e[40];let _;return e[41]!==d||e[42]!==g?(_=(0,a.jsxs)(a.Fragment,{children:[d,g]}),e[41]=d,e[42]=g,e[43]=_):_=e[43],_},Je=({entry:t,rowKey:e,namespace:r,protocol:c,rootPath:l,backendType:n,depth:m,locale:o,searchValue:p,onOpenFile:s})=>{var _;let[u,x]=(0,L.useState)(!1),{entriesByPath:h}=De(),y=rt(),j=t.kind==="directory",k=qe(t.path),C=!!p.trim(),f=j&&C&&k.toLowerCase().includes(p.trim().toLowerCase()),b=j&&C&&!!((_=h.get(ye(r,Ke(t.path))))!=null&&_.some(i=>We(i,{namespace:r,searchValue:p,entriesByPath:h}))),d=u||b,g=(0,L.useCallback)(async()=>{try{let i=await Le.request({namespace:r,path:t.path});if(i.error){re({title:"Download failed",description:i.error,variant:"danger"});return}i.url&&$e(i.url,i.filename??"download")}catch(i){Te.error("Failed to download storage entry",i),re({title:"Download failed",description:String(i),variant:"danger"})}},[r,t.path]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(gt,{className:le("text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5",j&&"font-medium"),style:ie(m),value:`${r}:${e}`,onSelect:()=>{j?x(!d):s({entry:t,namespace:r,protocol:c,backendType:n})},children:[j?(0,a.jsx)(Be,{isExpanded:d,className:"h-3 w-3"}):(0,a.jsx)("span",{className:"w-3 shrink-0"}),j?(0,a.jsx)(xa,{className:le("h-3.5 w-3.5 shrink-0",ct.directory)}):it(k),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:k}),(0,a.jsxs)("div",{className:"flex items-center",children:[t.size>0&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums",children:Re(t.size,o)}),t.lastModified!=null&&(0,a.jsx)(Z,{content:`Last modified: ${new Date(t.lastModified*1e3).toLocaleString()}`,children:(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap",children:or(t.lastModified,o)})}),(0,a.jsxs)(Qt,{children:[(0,a.jsx)(Xt,{asChild:!0,children:(0,a.jsx)(pa,{iconClassName:"h-3 w-3",onClick:i=>i.stopPropagation()})}),(0,a.jsxs)(Zt,{align:"end",onClick:i=>i.stopPropagation(),onCloseAutoFocus:i=>i.preventDefault(),children:[!j&&(0,a.jsxs)(X,{onSelect:()=>s({entry:t,namespace:r,protocol:c,backendType:n}),children:[(0,a.jsx)(_t,{className:"h-3.5 w-3.5 mr-2"}),"View"]}),(0,a.jsxs)(X,{onSelect:async()=>{await ve(t.path),re({title:"Copied to clipboard"})},children:[(0,a.jsx)(lt,{className:ge}),"Copy path"]}),!j&&(0,a.jsxs)(X,{onSelect:()=>g(),children:[(0,a.jsx)(ze,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{}),Mt.map(i=>{let v=i.getCode({variableName:r,protocol:c,entry:t,backendType:n});if(v===null)return null;let S=i.icon;return(0,a.jsxs)(X,{onSelect:()=>y(v),children:[(0,a.jsx)(S,{className:ge}),i.label]},i.id)})]})]})]})]}),j&&d&&(0,a.jsx)(mr,{namespace:r,protocol:c,rootPath:l,backendType:n,prefix:Ke(t.path),depth:m+1,locale:o,searchValue:f?"":p,onOpenFile:s})]})},pr=t=>{let e=(0,He.c)(64),{namespace:r,locale:c,searchValue:l,remoteSearch:n,onContinueRemoteSearch:m,onOpenFile:o}=t,[p,s]=(0,L.useState)(!0),{entriesByPath:u,pageMetadataByPath:x}=De(),{clearNamespaceCache:h}=la(),y=r.name??r.displayName,{entries:j,isPending:k,error:C,hasMore:f,loadMore:b,isLoadingMore:d,loadMoreError:g,refetch:_}=nt(y),i;e[0]!==h||e[1]!==y||e[2]!==_?(i=D=>{D.stopPropagation(),h(y),_()},e[0]=h,e[1]=y,e[2]=_,e[3]=i):i=e[3];let v=i,S=k?r.storageEntries:j,F;if(e[4]!==S||e[5]!==u||e[6]!==C||e[7]!==v||e[8]!==f||e[9]!==p||e[10]!==d||e[11]!==k||e[12]!==b||e[13]!==g||e[14]!==c||e[15]!==r.backendType||e[16]!==r.displayName||e[17]!==r.name||e[18]!==r.protocol||e[19]!==r.rootPath||e[20]!==y||e[21]!==m||e[22]!==o||e[23]!==x||e[24]!==n||e[25]!==l){let D=we(S,{namespace:y,searchValue:l,entriesByPath:u}),M=Ge(l),z=ye(y,M),I=M===""?[]:u.get(z)??[],$=I.length>0?we(I,{namespace:y,searchValue:l,entriesByPath:u}):I,G=!!l.trim(),J=D.length>0||$.length>0,te=M!==""&&cr({hasSearch:G,hasLoadedMatches:J,isPending:k,remoteSearch:n,searchKey:z,entriesByPath:u,pageMetadataByPath:x}),Y=G&&D.length===0,B;e:{if(k&&S.length===0){let w;e[27]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(be,{className:"h-3 w-3 animate-spin"}),"Loading..."]}),e[27]=w):w=e[27],B=w;break e}if(n.status==="searching"){let w;e[28]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(be,{className:"h-3 w-3 animate-spin"}),"Searching more entries..."]}),e[28]=w):w=e[28],B=w;break e}if(n.status==="error"){let w;e[29]===n.error.message?w=e[30]:(w=(0,a.jsxs)("span",{className:"text-destructive",children:["Search failed: ",n.error.message]}),e[29]=n.error.message,e[30]=w),B=w;break e}if(n.status==="capped"){let w;e[31]===m?w=e[32]:(w=(0,a.jsx)(K,{variant:"text",size:"xs",className:"h-5 px-0 text-xs hover:text-blue-600",onClick:m,children:"Continue searching"}),e[31]=m,e[32]=w);let P;e[33]===Symbol.for("react.memo_cache_sentinel")?(P=(0,a.jsx)("span",{className:"text-[10px]",children:"(or press Enter)"}),e[33]=P):P=e[33];let E;e[34]===w?E=e[35]:(E=(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:["Searched more entries.",w,P]}),e[34]=w,e[35]=E),B=E;break e}if(n.status==="exhausted"&&!J){B="No matches";break e}if(!G&&!k&&S.length===0&&!C){B="No entries";break e}if(te){let w;e[36]===m?w=e[37]:(w=(0,a.jsx)(K,{variant:"text",size:"xs",className:"h-5 px-0 text-xs hover:text-blue-600",onClick:m,children:"Search more entries"}),e[36]=m,e[37]=w);let P;e[38]===Symbol.for("react.memo_cache_sentinel")?(P=(0,a.jsx)("span",{className:"text-[10px]",children:"(or press Enter)"}),e[38]=P):P=e[38];let E;e[39]===w?E=e[40]:(E=(0,a.jsxs)("span",{className:"flex items-center gap-1.5",children:["No loaded matches.",w,P]}),e[39]=w,e[40]=E),B=E;break e}if(G&&!J&&S.length>0){B="No matches";break e}B=null}let W=B,V;e[41]===p?V=e[42]:(V=()=>s(!p),e[41]=p,e[42]=V);let R;e[43]===p?R=e[44]:(R=(0,a.jsx)(Be,{isExpanded:p,className:"h-3 w-3"}),e[43]=p,e[44]=R);let U;e[45]===r.protocol?U=e[46]:(U=(0,a.jsx)(ya,{protocol:r.protocol}),e[45]=r.protocol,e[46]=U);let A;e[47]===r.displayName?A=e[48]:(A=(0,a.jsx)("span",{children:r.displayName}),e[47]=r.displayName,e[48]=A);let H;e[49]===r.name?H=e[50]:(H=r.name&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground font-normal",children:["(",(0,a.jsx)(Ua,{variableName:r.name}),")"]}),e[49]=r.name,e[50]=H);let q;e[51]===v?q=e[52]:(q=(0,a.jsx)(ot,{onClick:v,tooltip:"Refresh storage connection",className:"p-0",iconClassName:"h-3 w-3"}),e[51]=v,e[52]=q);let Q=r.rootPath||"(root)",N;e[53]===Q?N=e[54]:(N=(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-normal tabular-nums ml-auto",children:Q}),e[53]=Q,e[54]=N);let T;e[55]!==r.name||e[56]!==N||e[57]!==V||e[58]!==R||e[59]!==U||e[60]!==A||e[61]!==H||e[62]!==q?(T=(0,a.jsxs)(gt,{value:r.name,onSelect:V,className:"flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none",children:[R,U,A,H,q,N]}),e[55]=r.name,e[56]=N,e[57]=V,e[58]=R,e[59]=U,e[60]=A,e[61]=H,e[62]=q,e[63]=T):T=e[63],F=(0,a.jsxs)(a.Fragment,{children:[T,p&&(0,a.jsxs)(a.Fragment,{children:[C&&S.length===0&&(0,a.jsx)(ta,{error:C,style:ie(1),className:"py-1 text-xs h-auto overflow-auto max-h-32 items-start",showIcon:!1}),!C&&W&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:ie(1),children:W}),D.map(w=>{let P=Ue(w,S.indexOf(w));return(0,a.jsx)(Je,{rowKey:P,entry:w,namespace:y,protocol:r.protocol,rootPath:r.rootPath,backendType:r.backendType,depth:1,locale:c,searchValue:l,onOpenFile:o},P)}),Y&&$.map(w=>{let P=Ue(w,I.indexOf(w));return(0,a.jsx)(Je,{rowKey:`remote-search:${P}`,entry:w,namespace:y,protocol:r.protocol,rootPath:r.rootPath,backendType:r.backendType,depth:1,locale:c,searchValue:l,onOpenFile:o},`remote-search:${P}`)}),f&&!te&&(0,a.jsx)(Dt,{depth:1,isLoading:d,error:g,onLoadMore:b})]})]}),e[4]=S,e[5]=u,e[6]=C,e[7]=v,e[8]=f,e[9]=p,e[10]=d,e[11]=k,e[12]=b,e[13]=g,e[14]=c,e[15]=r.backendType,e[16]=r.displayName,e[17]=r.name,e[18]=r.protocol,e[19]=r.rootPath,e[20]=y,e[21]=m,e[22]=o,e[23]=x,e[24]=n,e[25]=l,e[26]=F}else F=e[26];return F};const hr=()=>{let{namespaces:t,entriesByPath:e,pageMetadataByPath:r}=De(),{locale:c}=ft(),[l,n]=(0,L.useState)(""),[m,o]=(0,L.useState)({}),[p,s]=(0,L.useState)(null),u=oa(),x=!!l.trim(),h=l.trim(),y=(0,L.useCallback)(b=>{let d=m[b];return(d==null?void 0:d.query)===h?d:ir(h)},[h,m]),j=(0,L.useCallback)((b,d)=>{o(g=>({...g,[b]:d}))},[]),k=(0,L.useCallback)(b=>{var i;if(!h)return!1;let d=b.name??b.displayName,g=Ge(h);if(g===""||!Pt(y(d))||we(e.get(ye(d,""))??b.storageEntries,{namespace:d,searchValue:h,entriesByPath:e}).length>0)return!1;let _=ye(d,g);return we(e.get(_)??[],{namespace:d,searchValue:h,entriesByPath:e}).length>0?!1:e.get(_)===void 0||((i=r.get(_))==null?void 0:i.nextPageToken)!=null},[h,e,r,y]),C=(0,L.useCallback)(async b=>{var D;if(!k(b))return;let d=h,g=b.name??b.displayName,_=Ge(d),i=ye(g,_),v=e.get(i),S=((D=r.get(i))==null?void 0:D.nextPageToken)??null,F=v!==void 0;j(g,{query:d,status:"searching"});try{for(let M=0;M<lr;M++){let z=!F||S!==null,I=[];if(z){let $=await u({namespace:g,prefix:_,pageToken:S,append:F});I=$.entries,S=$.next_page_token??null,F=!0}if((z?I:v??[]).some($=>dr($,d))){j(g,{query:d,status:"found"});return}if(S===null){j(g,{query:d,status:"exhausted"});return}}j(g,{query:d,status:"capped"})}catch(M){j(g,{query:d,status:"error",error:M instanceof Error?M:Error(String(M))})}},[k,h,e,u,r,j]),f=(0,L.useCallback)(()=>{let b=t.filter(k);for(let d of b)C(d)},[k,C,t]);return t.length===0?(0,a.jsx)(Ka,{title:"No storage connected",description:(0,a.jsxs)("span",{children:["Create an obstore or fsspec connection in your notebook. See the"," ",(0,a.jsx)("a",{className:"text-link",href:"https://docs.marimo.io/guides/working_with_data/remote_storage/#quick-start",target:"_blank",rel:"noopener noreferrer",children:"docs"}),"."]}),action:(0,a.jsx)(pt,{defaultTab:"storage",children:(0,a.jsxs)(K,{variant:"outline",size:"sm",children:["Add remote storage",(0,a.jsx)(ht,{className:"h-4 w-4 ml-2"})]})}),icon:(0,a.jsx)(mt,{className:"h-8 w-8"})}):(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[p&&(0,a.jsx)(nr,{entry:p.entry,namespace:p.namespace,protocol:p.protocol,backendType:p.backendType,onBack:()=>s(null)}),(0,a.jsxs)(Va,{className:le("border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin",p&&"hidden"),shouldFilter:!1,children:[(0,a.jsxs)("div",{className:"flex items-center w-full border-b",children:[(0,a.jsx)(Ea,{placeholder:"Search entries...",className:"h-6 m-1",value:l,onValueChange:n,onKeyDown:b=>{b.key==="Enter"&&t.some(k)&&(b.preventDefault(),f())},rootClassName:"flex-1 border-b-0"}),x&&(0,a.jsx)(K,{variant:"text",size:"xs",className:"float-right border-none px-2 m-0 h-full",onClick:()=>n(""),children:(0,a.jsx)(da,{className:"h-4 w-4"})}),(0,a.jsx)(Z,{content:"Filters loaded entries only. Expand directories or press Enter to search more entries from the backend.",delayDuration:200,children:(0,a.jsx)(ha,{className:"h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2"})}),(0,a.jsx)(pt,{defaultTab:"storage",children:(0,a.jsx)(K,{variant:"ghost",size:"sm",className:"px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0",children:(0,a.jsx)(ht,{className:"h-4 w-4"})})})]}),(0,a.jsx)(Ia,{className:"flex flex-col",children:t.map(b=>{let d=b.name??b.displayName;return(0,a.jsx)(pr,{namespace:b,locale:c,searchValue:l,remoteSearch:y(d),onContinueRemoteSearch:()=>{C(b)},onOpenFile:s},d)})})]})]})};var Tt=fe(),zt=(0,L.createContext)(null);function xr(){return(0,L.useContext)(zt)??void 0}var fr=t=>{let e=(0,Tt.c)(3),{children:r}=t,c=va(),l;return e[0]!==r||e[1]!==c?(l=(0,a.jsx)(zt.Provider,{value:c,children:r}),e[0]=r,e[1]=c,e[2]=l):l=e[2],l};const ur=t=>{let e=(0,Tt.c)(5),{children:r}=t,[c,l]=(0,L.useState)(null),n;e[0]!==r||e[1]!==c?(n=c&&(0,a.jsx)(wa,{backend:Fa,options:{rootElement:c},children:(0,a.jsx)(fr,{children:r})}),e[0]=r,e[1]=c,e[2]=n):n=e[2];let m;return e[3]===n?m=e[4]:(m=(0,a.jsx)("div",{ref:l,className:"contents",children:n}),e[3]=n,e[4]=m),m};var Ye=new Map;const yr=({file:t,onOpenNotebook:e})=>{let{sendFileDetails:r,sendUpdateFile:c}=Oe(),l=je(Wt),n=je(tt),m=je(qt),[o,p]=(0,L.useState)(""),{data:s,isPending:u,error:x,setData:h,refetch:y}=Ve(async()=>{let i=await r({path:t.path}),v=i.contents||"";return p(Ye.get(t.path)||v),i},[t.path]),j=async()=>{o!==(s==null?void 0:s.contents)&&await c({path:t.path,contents:o}).then(i=>{i.success&&(h(v=>({...v,contents:o})),p(o))})},k=(0,L.useRef)(o);if(k.current=o,(0,L.useEffect)(()=>()=>{if(!(s!=null&&s.contents))return;let i=k.current;i===s.contents?Ye.delete(t.path):Ye.set(t.path,i)},[t.path,s==null?void 0:s.contents]),x)return(0,a.jsx)(jt,{error:x});if(u||!s)return null;let C=s.mimeType||"text/plain",f=C in ea,b=m&&s.file.isMarimoFile&&(t.path===m||t.path.endsWith(`/${m}`));if(!s.contents&&!f)return(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 p-6",children:[(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Name"}),(0,a.jsx)("div",{children:s.file.name}),(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Type"}),(0,a.jsx)("div",{children:C})]});let d=(0,a.jsx)(Ft,{filename:s.file.name,onRefresh:y,onDownload:n?void 0:()=>{if(s.isBase64&&s.contents){Me(C)?$e(Ee(s.contents,C),s.file.name):Pe(yt(Ee(s.contents,s.mimeType||"application/octet-stream")),s.file.name);return}Pe(new Blob([s.contents||o],{type:C}),s.file.name)},actions:(0,a.jsxs)(a.Fragment,{children:[t.isMarimoFile&&!Fe()&&(0,a.jsx)(Z,{content:"Open notebook",children:(0,a.jsx)(K,{variant:"text",size:"xs",onClick:i=>e(i),children:(0,a.jsx)(Ie,{className:"h-3.5 w-3.5"})})}),!Me(C)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Z,{content:"Copy contents to clipboard",children:(0,a.jsx)(K,{variant:"text",size:"xs",onClick:async()=>{await ve(o)},children:(0,a.jsx)(lt,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(Z,{content:Ra("global.save"),children:(0,a.jsx)(K,{variant:"text",size:"xs",onClick:j,disabled:o===s.contents,children:(0,a.jsx)(Ma,{className:"h-3.5 w-3.5"})})})]})]})}),g=Me(C),_=!g&&C!=="text/csv";return(0,a.jsxs)(a.Fragment,{children:[d,_&&b&&(0,a.jsxs)(La,{variant:"warning",className:"rounded-none",children:[(0,a.jsx)(Pa,{className:"h-4 w-4"}),(0,a.jsx)(Oa,{children:"Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution."})]}),(0,a.jsx)(at,{mimeType:C,contents:g?void 0:_?o:s.contents??void 0,mediaSource:g?{base64:s.contents,mime:C}:void 0,readOnly:!_,onChange:p,extensions:[na.of([{key:l.getHotkey("global.save").key,stopPropagation:!0,run:()=>o===s.contents?!1:(j(),!0)}])]})]})},$t=Ze(t=>{let e=t(sa);return Ut(e,"no requestClientAtom set"),new ba({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,copyFileOrFolder:e.sendCopyFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),jr=Ze({});async function gr(){await Rt.get($t).refreshAll([])}var oe=" ";const Ot={directory:t=>`os.listdir("${t}")`,python:t=>`with open("${t}", "r") as _f:
|
|
11
|
+
${oe}...
|
|
12
|
+
`,json:t=>`with open("${t}", "r") as _f:
|
|
13
|
+
${oe}_data = json.load(_f)
|
|
14
|
+
`,code:t=>`with open("${t}", "r") as _f:
|
|
15
|
+
${oe}...
|
|
16
|
+
`,text:t=>`with open("${t}", "r") as _f:
|
|
17
|
+
${oe}...
|
|
18
|
+
`,image:t=>`mo.image("${t}")`,audio:t=>`mo.audio("${t}")`,video:t=>`mo.video("${t}")`,pdf:t=>`with open("${t}", "rb") as _f:
|
|
19
|
+
${oe}...
|
|
20
|
+
`,zip:t=>`with open("${t}", "rb") as _f:
|
|
21
|
+
${oe}...
|
|
22
|
+
`,data:t=>`with open("${t}", "r") as _f:
|
|
23
|
+
${oe}...
|
|
24
|
+
`,unknown:t=>`with open("${t}", "r") as _f:
|
|
25
|
+
${oe}...
|
|
26
|
+
`};var br=fe(),vr=1024*1024*100,wr=5;function Lt(t){let e=(0,br.c)(7),r;e[0]===t?r=e[1]:(r=t===void 0?{}:t,e[0]=t,e[1]=r);let c=r,{sendCreateFileOrFolder:l}=Oe(),n;e[2]===l?n=e[3]:(n=async o=>{if(o.length===0)return;let p=o.length===1;await aa(p?"Uploading file...":"Uploading files...",async s=>{s.addTotal(o.length),await qa(o,wr,async u=>{let x=Fr(_r(u)),h="";x&&(h=za.guessDeliminator(x).dirname(x)),await l({path:h,type:"file",name:u.name,file:u}),s.increment(1)}),await gr()},{title:p?"File uploaded":`${o.length} files uploaded`})},e[2]=l,e[3]=n);let m;return e[4]!==c||e[5]!==n?(m={multiple:!0,maxSize:vr,onError:Sr,onDropRejected:Nr,onDrop:n,...c},e[4]=c,e[5]=n,e[6]=m):m=e[6],Ta(m)}function Nr(t){re({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(kr)}),variant:"danger"})}function kr(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(Cr).join(", "),")"]},t.file.name)}function Cr(t){return t.message}function Sr(t){Te.error(t),re({title:"File upload failed",description:t.message,variant:"danger"})}function _r(t){if(t.webkitRelativePath)return t.webkitRelativePath;if("path"in t&&typeof t.path=="string")return t.path;if("relativePath"in t&&typeof t.relativePath=="string")return t.relativePath}function Fr(t){if(t)return t.replace(/^\/+/,"")}var Ne=fe(),Mr=et("marimo:showHiddenFiles",!0,Qe,{getOnInit:!0}),Bt=L.createContext(null);const Pr=t=>{let e=(0,Ne.c)(73),{height:r}=t,c=(0,L.useRef)(null),l=xr(),[n]=_e($t),m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[0]=m):m=e[0];let[o,p]=(0,L.useState)(m),[s,u]=(0,L.useState)(null),[x,h]=_e(Mr),{openPrompt:y}=ut(),[j,k]=_e(jr),C;e[1]===n?C=e[2]:(C=()=>n.initialize(p),e[1]=n,e[2]=C);let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[3]=f):f=e[3];let{isPending:b,error:d}=Ve(C,f),g;e[4]!==j||e[5]!==n?(g=()=>n.refreshAll(Object.keys(j).filter(N=>j[N])),e[4]=j,e[5]=n,e[6]=g):g=e[6];let _=ae(g),i;e[7]!==h||e[8]!==x?(i=()=>{h(!x)},e[7]=h,e[8]=x,e[9]=i):i=e[9];let v=ae(i),S;e[10]!==y||e[11]!==n?(S=async()=>{y({title:"Folder name",onConfirm:async N=>{n.createFolder(N,null)}})},e[10]=y,e[11]=n,e[12]=S):S=e[12];let F=ae(S),D;e[13]!==y||e[14]!==n?(D=async()=>{y({title:"File name",onConfirm:async N=>{n.createFile({name:N,parentId:null})}})},e[13]=y,e[14]=n,e[15]=D):D=e[15];let M=ae(D),z;e[16]!==y||e[17]!==n?(z=async()=>{y({title:"Notebook name",onConfirm:async N=>{n.createFile({name:N,parentId:null,type:"notebook"})}})},e[16]=y,e[17]=n,e[18]=z):z=e[18];let I=ae(z),$;e[19]===k?$=e[20]:($=()=>{var N;(N=c.current)==null||N.closeAll(),k({})},e[19]=k,e[20]=$);let G=ae($),J;e[21]!==o||e[22]!==x?(J=It(o,x),e[21]=o,e[22]=x,e[23]=J):J=e[23];let te=J;if(b){let N;return e[24]===Symbol.for("react.memo_cache_sentinel")?(N=(0,a.jsx)(ja,{size:"medium",centered:!0}),e[24]=N):N=e[24],N}if(d){let N;return e[25]===d?N=e[26]:(N=(0,a.jsx)(jt,{error:d}),e[25]=d,e[26]=N),N}if(s){let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=()=>u(null),e[27]=N):N=e[27];let T;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=(0,a.jsx)(K,{onClick:N,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(st,{size:16})}),e[28]=T):T=e[28];let w;e[29]===s.name?w=e[30]:(w=(0,a.jsxs)("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[T,(0,a.jsx)("span",{className:"font-bold",children:s.name})]}),e[29]=s.name,e[30]=w);let P;e[31]!==s.path||e[32]!==n?(P=ne=>Et(ne,n.relativeFromRoot(s.path)),e[31]=s.path,e[32]=n,e[33]=P):P=e[33];let E;e[34]!==s||e[35]!==P?(E=(0,a.jsx)(L.Suspense,{children:(0,a.jsx)(yr,{onOpenNotebook:P,file:s})}),e[34]=s,e[35]=P,e[36]=E):E=e[36];let ee;return e[37]!==w||e[38]!==E?(ee=(0,a.jsxs)(a.Fragment,{children:[w,E]}),e[37]=w,e[38]=E,e[39]=ee):ee=e[39],ee}let Y;e[40]!==G||e[41]!==M||e[42]!==F||e[43]!==I||e[44]!==v||e[45]!==_||e[46]!==x||e[47]!==n?(Y=(0,a.jsx)(Tr,{onRefresh:_,onHidden:v,showHiddenFiles:x,onCreateFile:M,onCreateNotebook:I,onCreateFolder:F,onCollapseAll:G,tree:n}),e[40]=G,e[41]=M,e[42]=F,e[43]=I,e[44]=v,e[45]=_,e[46]=x,e[47]=n,e[48]=Y):Y=e[48];let B=r-33,W,V,R;e[49]===n?(W=e[50],V=e[51],R=e[52]):(W=async N=>{let{ids:T}=N;for(let w of T)await n.delete(w)},V=async N=>{let{id:T,name:w}=N;await n.rename(T,w)},R=async N=>{let{dragIds:T,parentId:w}=N;await n.move(T,w)},e[49]=n,e[50]=W,e[51]=V,e[52]=R);let U;e[53]===Symbol.for("react.memo_cache_sentinel")?(U=N=>{let T=N[0];T&&(T.data.isDirectory||u(T.data))},e[53]=U):U=e[53];let A;e[54]!==j||e[55]!==k||e[56]!==n?(A=async N=>{if(await n.expand(N)){let T=j[N]??!1;k({...j,[N]:!T})}},e[54]=j,e[55]=k,e[56]=n,e[57]=A):A=e[57];let H;e[58]!==l||e[59]!==j||e[60]!==B||e[61]!==W||e[62]!==V||e[63]!==R||e[64]!==A||e[65]!==te?(H=(0,a.jsx)(ka,{width:"100%",ref:c,height:B,className:"h-full",data:te,initialOpenState:j,openByDefault:!1,dndManager:l,renderCursor:Br,disableDrop:Er,onDelete:W,onRename:V,onMove:R,onSelect:U,onToggle:A,padding:15,rowHeight:30,indent:Dr,overscanCount:1e3,disableMultiSelection:!0,children:$r}),e[58]=l,e[59]=j,e[60]=B,e[61]=W,e[62]=V,e[63]=R,e[64]=A,e[65]=te,e[66]=H):H=e[66];let q;e[67]!==H||e[68]!==n?(q=(0,a.jsx)(Bt,{value:n,children:H}),e[67]=H,e[68]=n,e[69]=q):q=e[69];let Q;return e[70]!==Y||e[71]!==q?(Q=(0,a.jsxs)(a.Fragment,{children:[Y,q]}),e[70]=Y,e[71]=q,e[72]=Q):Q=e[72],Q};var Dr=15,Tr=t=>{let e=(0,Ne.c)(37),{onRefresh:r,onHidden:c,showHiddenFiles:l,onCreateFile:n,onCreateNotebook:m,onCreateFolder:o,onCollapseAll:p}=t,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={noDrag:!0,noDragEventsBubbling:!0},e[0]=s):s=e[0];let{getRootProps:u,getInputProps:x}=Lt(s),h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsx)(Nt,{size:16}),e[1]=h):h=e[1];let y;e[2]===m?y=e[3]:(y=(0,a.jsx)(Z,{content:"Add notebook",children:(0,a.jsx)(K,{"data-testid":"file-explorer-add-notebook-button",onClick:m,variant:"text",size:"xs",children:h})}),e[2]=m,e[3]=y);let j;e[4]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsx)(kt,{size:16}),e[4]=j):j=e[4];let k;e[5]===n?k=e[6]:(k=(0,a.jsx)(Z,{content:"Add file",children:(0,a.jsx)(K,{"data-testid":"file-explorer-add-file-button",onClick:n,variant:"text",size:"xs",children:j})}),e[5]=n,e[6]=k);let C;e[7]===Symbol.for("react.memo_cache_sentinel")?(C=(0,a.jsx)(Ct,{size:16}),e[7]=C):C=e[7];let f;e[8]===o?f=e[9]:(f=(0,a.jsx)(Z,{content:"Add folder",children:(0,a.jsx)(K,{"data-testid":"file-explorer-add-folder-button",onClick:o,variant:"text",size:"xs",children:C})}),e[8]=o,e[9]=f);let b;e[10]===u?b=e[11]:(b=u({}),e[10]=u,e[11]=b);let d,g;e[12]===Symbol.for("react.memo_cache_sentinel")?(g=ra({variant:"text",size:"xs"}),d=(0,a.jsx)(Da,{size:16}),e[12]=d,e[13]=g):(d=e[12],g=e[13]);let _;e[14]===b?_=e[15]:(_=(0,a.jsx)(Z,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...b,className:g,children:d})}),e[14]=b,e[15]=_);let i;e[16]===x?i=e[17]:(i=x({}),e[16]=x,e[17]=i);let v;e[18]===i?v=e[19]:(v=(0,a.jsx)("input",{...i,type:"file"}),e[18]=i,e[19]=v);let S;e[20]===r?S=e[21]:(S=(0,a.jsx)(ot,{"data-testid":"file-explorer-refresh-button",onClick:r}),e[20]=r,e[21]=S);let F;e[22]!==c||e[23]!==l?(F=(0,a.jsx)(ma,{"data-testid":"file-explorer-hidden-files-button",isVisible:l,onToggle:c,showTooltip:"Show hidden files",hideTooltip:"Hide hidden files"}),e[22]=c,e[23]=l,e[24]=F):F=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=(0,a.jsx)(Xa,{size:16}),e[25]=D):D=e[25];let M;e[26]===p?M=e[27]:(M=(0,a.jsx)(Z,{content:"Collapse all folders",children:(0,a.jsx)(K,{"data-testid":"file-explorer-collapse-button",onClick:p,variant:"text",size:"xs",children:D})}),e[26]=p,e[27]=M);let z;return e[28]!==_||e[29]!==v||e[30]!==S||e[31]!==F||e[32]!==M||e[33]!==y||e[34]!==k||e[35]!==f?(z=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[y,k,f,_,v,S,F,M]}),e[28]=_,e[29]=v,e[30]=S,e[31]=F,e[32]=M,e[33]=y,e[34]=k,e[35]=f,e[36]=z):z=e[36],z},zr=t=>{let e=(0,Ne.c)(9),{node:r,onOpenMarimoFile:c}=t,l;e[0]===r?l=e[1]:(l=o=>{r.data.isDirectory||(o.stopPropagation(),r.select())},e[0]=r,e[1]=l);let n;e[2]!==r.data.isMarimoFile||e[3]!==c?(n=r.data.isMarimoFile&&!Fe()&&(0,a.jsxs)("span",{"data-testid":"file-explorer-open-marimo-button",className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:c,children:["open ",(0,a.jsx)(Ie,{className:"inline ml-1",size:12})]}),e[2]=r.data.isMarimoFile,e[3]=c,e[4]=n):n=e[4];let m;return e[5]!==r.data.name||e[6]!==l||e[7]!==n?(m=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:l,children:[r.data.name,n]}),e[5]=r.data.name,e[6]=l,e[7]=n,e[8]=m):m=e[8],m},$r=t=>{let e=(0,Ne.c)(116),{node:r,style:c,dragHandle:l}=t,{openFile:n,sendFileDetails:m}=Oe(),o=je(tt),p;e[0]!==r.data.isDirectory||e[1]!==r.data.name?(p=r.data.isDirectory?"directory":fa(r.data.name),e[0]=r.data.isDirectory,e[1]=r.data.name,e[2]=p):p=e[2];let s=p,u=ua[s],{openConfirm:x,openPrompt:h}=ut(),{createNewCell:y}=Ht(),j=Ba(),k;e[3]!==y||e[4]!==j?(k=O=>{y({code:O,before:!1,cellId:j??"__end__"})},e[3]=y,e[4]=j,e[5]=k):k=e[5];let C=k,f=(0,L.use)(Bt),b;e[6]!==r.data.path||e[7]!==f?(b=async O=>{Et(O,f?f.relativeFromRoot(r.data.path):r.data.path)},e[6]=r.data.path,e[7]=f,e[8]=b):b=e[8];let d=b,g;e[9]!==r.data.name||e[10]!==r.id||e[11]!==r.tree||e[12]!==x?(g=async O=>{O.stopPropagation(),O.preventDefault(),x({title:"Delete file",description:`Are you sure you want to delete ${r.data.name}?`,confirmAction:(0,a.jsx)(Yt,{onClick:async()=>{await r.tree.delete(r.id)},"aria-label":"Confirm",children:"Delete"})})},e[9]=r.data.name,e[10]=r.id,e[11]=r.tree,e[12]=x,e[13]=g):g=e[13];let _=g,i;e[14]!==r||e[15]!==h||e[16]!==f?(i=async()=>{r.open(),h({title:"Folder name",onConfirm:async O=>{f==null||f.createFolder(O,r.id)}})},e[14]=r,e[15]=h,e[16]=f,e[17]=i):i=e[17];let v=ae(i),S;e[18]!==r||e[19]!==h||e[20]!==f?(S=async()=>{r.open(),h({title:"File name",onConfirm:async O=>{f==null||f.createFile({name:O,parentId:r.id})}})},e[18]=r,e[19]=h,e[20]=f,e[21]=S):S=e[21];let F=ae(S),D;e[22]!==r||e[23]!==h||e[24]!==f?(D=async()=>{r.open(),h({title:"Notebook name",onConfirm:async O=>{f==null||f.createFile({name:O,parentId:r.id,type:"notebook"})}})},e[22]=r,e[23]=h,e[24]=f,e[25]=D):D=e[25];let M=ae(D),z;e[26]!==r.data.name||e[27]!==r.id||e[28]!==f?(z=async()=>{f&&await f.copy(r.id,Ha(r.data.name))},e[26]=r.data.name,e[27]=r.id,e[28]=f,e[29]=z):z=e[29];let I=ae(z),$;e[30]===Symbol.for("react.memo_cache_sentinel")?($=le("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[30]=$):$=e[30];let G,J;e[31]===r?(G=e[32],J=e[33]):(G=O=>{O.stopPropagation(),r.data.isDirectory&&r.toggle()},J=(0,a.jsx)(Or,{node:r}),e[31]=r,e[32]=G,e[33]=J);let te=r.willReceiveDrop&&r.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground",Y;e[34]===te?Y=e[35]:(Y=le("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",te),e[34]=te,e[35]=Y);let B;e[36]!==u||e[37]!==s||e[38]!==r.data.isMarimoFile?(B=r.data.isMarimoFile?(0,a.jsx)(Ga,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}):(0,a.jsx)(u,{className:le("w-5 h-5 shrink-0 mr-2",ct[s]),strokeWidth:1.5}),e[36]=u,e[37]=s,e[38]=r.data.isMarimoFile,e[39]=B):B=e[39];let W;e[40]!==d||e[41]!==r?(W=r.isEditing?(0,a.jsx)(_a,{node:r}):(0,a.jsx)(zr,{node:r,onOpenMarimoFile:d}),e[40]=d,e[41]=r,e[42]=W):W=e[42];let V;e[43]===r?V=e[44]:(V=!r.data.isDirectory&&(0,a.jsxs)(X,{onSelect:()=>r.select(),"data-testid":"file-explorer-open-file-menu-item",children:[(0,a.jsx)(_t,{className:"h-3.5 w-3.5 mr-2"}),"Open file"]}),e[43]=r,e[44]=V);let R;e[45]!==r.data.isDirectory||e[46]!==r.data.path||e[47]!==n?(R=!r.data.isDirectory&&!Fe()&&(0,a.jsxs)(X,{onSelect:()=>{n({path:r.data.path})},"data-testid":"file-explorer-open-external-menu-item",children:[(0,a.jsx)(Ie,{className:"h-3.5 w-3.5 mr-2"}),"Open file in external editor"]}),e[45]=r.data.isDirectory,e[46]=r.data.path,e[47]=n,e[48]=R):R=e[48];let U;e[49]!==F||e[50]!==v||e[51]!==M||e[52]!==r.data.isDirectory?(U=r.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(X,{onSelect:()=>M(),"data-testid":"file-explorer-create-notebook-menu-item",children:[(0,a.jsx)(Nt,{className:"h-3.5 w-3.5 mr-2"}),"Create notebook"]}),(0,a.jsxs)(X,{onSelect:()=>F(),"data-testid":"file-explorer-create-file-menu-item",children:[(0,a.jsx)(kt,{className:"h-3.5 w-3.5 mr-2"}),"Create file"]}),(0,a.jsxs)(X,{onSelect:()=>v(),"data-testid":"file-explorer-create-folder-menu-item",children:[(0,a.jsx)(Ct,{className:"h-3.5 w-3.5 mr-2"}),"Create folder"]}),(0,a.jsx)(ue,{})]}),e[49]=F,e[50]=v,e[51]=M,e[52]=r.data.isDirectory,e[53]=U):U=e[53];let A;e[54]===r?A=e[55]:(A=(0,a.jsx)(ga,{onSelect:()=>r.edit(),testId:"file-explorer-rename-menu-item"}),e[54]=r,e[55]=A);let H;e[56]===I?H=e[57]:(H=(0,a.jsx)(Sa,{onSelect:I,testId:"file-explorer-duplicate-menu-item"}),e[56]=I,e[57]=H);let q;e[58]===r.data.path?q=e[59]:(q=async()=>{await ve(r.data.path),re({title:"Copied to clipboard"})},e[58]=r.data.path,e[59]=q);let Q;e[60]===Symbol.for("react.memo_cache_sentinel")?(Q=(0,a.jsx)(St,{className:ge}),e[60]=Q):Q=e[60];let N;e[61]===q?N=e[62]:(N=(0,a.jsxs)(X,{onSelect:q,"data-testid":"file-explorer-copy-path-menu-item",children:[Q,"Copy path"]}),e[61]=q,e[62]=N);let T;e[63]!==r.data.path||e[64]!==f?(T=f&&(0,a.jsxs)(X,{onSelect:async()=>{await ve(f.relativeFromRoot(r.data.path)),re({title:"Copied to clipboard"})},"data-testid":"file-explorer-copy-relative-path-menu-item",children:[(0,a.jsx)(St,{className:"h-3.5 w-3.5 mr-2"}),"Copy relative path"]}),e[63]=r.data.path,e[64]=f,e[65]=T):T=e[65];let w;e[66]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsx)(ue,{}),e[66]=w):w=e[66];let P;e[67]!==s||e[68]!==C||e[69]!==r.data?(P=()=>{let{path:O}=r.data;C(Ot[s](O))},e[67]=s,e[68]=C,e[69]=r.data,e[70]=P):P=e[70];let E;e[71]===Symbol.for("react.memo_cache_sentinel")?(E=(0,a.jsx)(ca,{className:ge}),e[71]=E):E=e[71];let ee;e[72]===P?ee=e[73]:(ee=(0,a.jsxs)(X,{onSelect:P,"data-testid":"file-explorer-insert-snippet-menu-item",children:[E,"Insert snippet for reading file"]}),e[72]=P,e[73]=ee);let ne;e[74]!==s||e[75]!==r.data?(ne=async()=>{re({title:"Copied to clipboard",description:"Code to open the file has been copied to your clipboard. You can also drag and drop this file into the editor"});let{path:O}=r.data;await ve(Ot[s](O))},e[74]=s,e[75]=r.data,e[76]=ne):ne=e[76];let ke;e[77]===Symbol.for("react.memo_cache_sentinel")?(ke=(0,a.jsx)(Kt,{className:ge}),e[77]=ke):ke=e[77];let ce;e[78]===ne?ce=e[79]:(ce=(0,a.jsxs)(X,{onSelect:ne,"data-testid":"file-explorer-copy-snippet-menu-item",children:[ke,"Copy snippet for reading file"]}),e[78]=ne,e[79]=ce);let de;e[80]!==d||e[81]!==r.data.isMarimoFile?(de=r.data.isMarimoFile&&!Fe()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ue,{}),(0,a.jsxs)(X,{onSelect:d,"data-testid":"file-explorer-open-notebook-menu-item",children:[(0,a.jsx)(Qa,{className:"h-3.5 w-3.5 mr-2"}),"Open notebook"]})]}),e[80]=d,e[81]=r.data.isMarimoFile,e[82]=de):de=e[82];let Ce;e[83]===Symbol.for("react.memo_cache_sentinel")?(Ce=(0,a.jsx)(ue,{}),e[83]=Ce):Ce=e[83];let me;e[84]!==o||e[85]!==r.data.isDirectory||e[86]!==r.data.name||e[87]!==r.data.path||e[88]!==m?(me=!r.data.isDirectory&&!o&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(X,{onSelect:async()=>{let O=await m({path:r.data.path});O.isBase64&&O.contents?Pe(yt(Ee(O.contents,O.mimeType||"application/octet-stream")),r.data.name):Pe(new Blob([O.contents||""]),r.data.name)},"data-testid":"file-explorer-download-menu-item",children:[(0,a.jsx)(ze,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{})]}),e[84]=o,e[85]=r.data.isDirectory,e[86]=r.data.name,e[87]=r.data.path,e[88]=m,e[89]=me):me=e[89];let pe;e[90]===_?pe=e[91]:(pe=(0,a.jsx)(Ca,{onSelect:_,testId:"file-explorer-delete-menu-item"}),e[90]=_,e[91]=pe);let he;e[92]!==V||e[93]!==R||e[94]!==U||e[95]!==A||e[96]!==H||e[97]!==N||e[98]!==T||e[99]!==ee||e[100]!==ce||e[101]!==de||e[102]!==me||e[103]!==pe?(he=(0,a.jsxs)(Na,{testId:"file-explorer-more-button",iconClassName:"w-5 h-5",children:[V,R,U,A,H,N,T,w,ee,ce,de,Ce,me,pe]}),e[92]=V,e[93]=R,e[94]=U,e[95]=A,e[96]=H,e[97]=N,e[98]=T,e[99]=ee,e[100]=ce,e[101]=de,e[102]=me,e[103]=pe,e[104]=he):he=e[104];let xe;e[105]!==Y||e[106]!==B||e[107]!==W||e[108]!==he?(xe=(0,a.jsxs)("span",{className:Y,children:[B,W,he]}),e[105]=Y,e[106]=B,e[107]=W,e[108]=he,e[109]=xe):xe=e[109];let Se;return e[110]!==l||e[111]!==c||e[112]!==G||e[113]!==J||e[114]!==xe?(Se=(0,a.jsxs)("div",{style:c,ref:l,className:$,draggable:!0,onClick:G,children:[J,xe]}),e[110]=l,e[111]=c,e[112]=G,e[113]=J,e[114]=xe,e[115]=Se):Se=e[115],Se},Or=t=>{let e=(0,Ne.c)(3),{node:r}=t;if(!r.data.isDirectory){let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)("span",{className:"w-4 h-4 shrink-0"}),e[0]=l):l=e[0],l}let c;return e[1]===r.isOpen?c=e[2]:(c=(0,a.jsx)(Be,{isExpanded:r.isOpen,className:"w-4 h-4"}),e[1]=r.isOpen,e[2]=c),c};function Et(t,e){t.stopPropagation(),t.preventDefault(),Ja(e)}function It(t,e){if(e)return t;let r=[];for(let c of t){if(Lr(c.name))continue;let l=c;if(c.children){let n=It(c.children,e);n!==c.children&&(l={...c,children:n})}r.push(l)}return r}function Lr(t){return!!t.startsWith(".")}function Br(){return null}function Er(t){let{parentNode:e}=t;return!e.data.isDirectory}var Vt=fe(),Ir=et("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},Qe),Vr=t=>{let e=(0,Vt.c)(20),{height:r}=t,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={noClick:!0,noKeyboard:!0},e[0]=c):c=e[0];let{getRootProps:l,getInputProps:n,isDragActive:m}=Lt(c),o;e[1]===l?o=e[2]:(o=l(),e[1]=l,e[2]=o);let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=le("flex flex-col overflow-hidden relative"),e[3]=p):p=e[3];let s;e[4]===r?s=e[5]:(s={height:r},e[4]=r,e[5]=s);let u;e[6]===n?u=e[7]:(u=n(),e[6]=n,e[7]=u);let x;e[8]===u?x=e[9]:(x=(0,a.jsx)("input",{...u}),e[8]=u,e[9]=x);let h;e[10]===m?h=e[11]:(h=m&&(0,a.jsx)("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),e[10]=m,e[11]=h);let y;e[12]===r?y=e[13]:(y=(0,a.jsx)(Pr,{height:r}),e[12]=r,e[13]=y);let j;return e[14]!==o||e[15]!==s||e[16]!==x||e[17]!==h||e[18]!==y?(j=(0,a.jsx)(ur,{children:(0,a.jsxs)("div",{...o,className:p,style:s,children:[x,h,y]})}),e[14]=o,e[15]=s,e[16]=x,e[17]=h,e[18]=y,e[19]=j):j=e[19],j},Rr=33,Ar=()=>{let t=(0,Vt.c)(36),{ref:e,height:r}=Aa(),c=r===void 0?500:r,[l,n]=_e(Ir),m=je(ia).length,o;e:{if(!l.hasUserInteracted&&m>0){if(l.openSections.includes("remote-storage")){o=l.openSections;break e}let $;t[0]===l.openSections?$=t[1]:($=[...l.openSections,"remote-storage"],t[0]=l.openSections,t[1]=$),o=$;break e}o=l.openSections}let p=o,s;t[2]===n?s=t[3]:(s=$=>{n({openSections:$,hasUserInteracted:!0})},t[2]=n,t[3]=s);let u=s,x=c-Rr*2,h;t[4]===p?h=t[5]:(h=p.includes("remote-storage"),t[4]=p,t[5]=h);let y=h,j;t[6]!==p||t[7]!==y?(j=y&&p.includes("files"),t[6]=p,t[7]=y,t[8]=j):j=t[8];let k=j,C;t[9]!==x||t[10]!==k?(C=k?Math.round(x*.4):x,t[9]=x,t[10]=k,t[11]=C):C=t[11];let f=C,b=Math.max(200,k?x-f:x),d;t[12]===Symbol.for("react.memo_cache_sentinel")?(d=(0,a.jsx)(mt,{className:"w-4 h-4"}),t[12]=d):d=t[12];let g;t[13]===m?g=t[14]:(g=m>0&&(0,a.jsx)(Wa,{children:m}),t[13]=m,t[14]=g);let _;t[15]===g?_=t[16]:(_=(0,a.jsxs)(vt,{children:[d," Remote storage",g]}),t[15]=g,t[16]=_);let i;t[17]===f?i=t[18]:(i={maxHeight:f},t[17]=f,t[18]=i);let v;t[19]===Symbol.for("react.memo_cache_sentinel")?(v=(0,a.jsx)(hr,{}),t[19]=v):v=t[19];let S;t[20]===i?S=t[21]:(S=(0,a.jsx)(wt,{className:"overflow-auto",style:i,children:v}),t[20]=i,t[21]=S);let F;t[22]!==S||t[23]!==_?(F=(0,a.jsxs)(bt,{value:"remote-storage",children:[_,S]}),t[22]=S,t[23]=_,t[24]=F):F=t[24];let D;t[25]===Symbol.for("react.memo_cache_sentinel")?(D=(0,a.jsxs)(vt,{children:[(0,a.jsx)(dt,{className:"w-4 h-4"}),"Files"]}),t[25]=D):D=t[25];let M;t[26]===b?M=t[27]:(M=(0,a.jsxs)(bt,{value:"files",children:[D,(0,a.jsx)(wt,{children:(0,a.jsx)(Vr,{height:b})})]}),t[26]=b,t[27]=M);let z;t[28]!==u||t[29]!==p||t[30]!==F||t[31]!==M?(z=(0,a.jsxs)(Jt,{type:"multiple",value:p,onValueChange:u,children:[F,M]}),t[28]=u,t[29]=p,t[30]=F,t[31]=M,t[32]=z):z=t[32];let I;return t[33]!==e||t[34]!==z?(I=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:z}),t[33]=e,t[34]=z,t[35]=I):I=t[35],I};export{Ar as default};
|