@marimo-team/frontend 0.22.1-dev28 → 0.22.1-dev30

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.
Files changed (91) hide show
  1. package/dist/assets/{CellStatus-BGwiRnWs.js → CellStatus-DbnxfYhY.js} +1 -1
  2. package/dist/assets/{ConnectedDataExplorerComponent-BKHN9OcM.js → ConnectedDataExplorerComponent-BUc9LHJJ.js} +1 -1
  3. package/dist/assets/{JsonOutput-CZWDOcEq.js → JsonOutput-LeC5h8MP.js} +1 -1
  4. package/dist/assets/{MarimoErrorOutput-CRiWaftE.js → MarimoErrorOutput-Dq9zeSH2.js} +1 -1
  5. package/dist/assets/{RenderHTML-DDQfFfKb.js → RenderHTML-C11kWI2X.js} +1 -1
  6. package/dist/assets/{add-cell-with-ai-Cs0x393c.js → add-cell-with-ai-Dmm_0EEi.js} +1 -1
  7. package/dist/assets/{add-connection-dialog-DaW4MgUH.js → add-connection-dialog-CMjIBIY8.js} +1 -1
  8. package/dist/assets/agent-panel-COS8BLy0.js +287 -0
  9. package/dist/assets/{ai-model-dropdown-qHy-qNhU.js → ai-model-dropdown-DXmwokmr.js} +4 -4
  10. package/dist/assets/{app-config-button-DA9C4E8a.js → app-config-button-CbHcdSN-.js} +1 -1
  11. package/dist/assets/{cell-editor-CHRa0gCL.js → cell-editor-B3xy42eO.js} +1 -1
  12. package/dist/assets/{cell-link-B1eV0G-A.js → cell-link-CVq1Spik.js} +1 -1
  13. package/dist/assets/{cells-DInU2DWF.js → cells-CgztvghI.js} +2 -2
  14. package/dist/assets/{chat-display-BDL9CljU.js → chat-display-DsnXg_ta.js} +1 -1
  15. package/dist/assets/{chat-panel-Du-uAJin.js → chat-panel-B3DihEiS.js} +1 -1
  16. package/dist/assets/{chat-ui-Bp_UmHcl.js → chat-ui-CJ8BkLf3.js} +1 -1
  17. package/dist/assets/{column-preview-DhJUmSOC.js → column-preview-DHqtWPTK.js} +1 -1
  18. package/dist/assets/{command-palette-Bf-iEqbG.js → command-palette-DIRRfZJn.js} +1 -1
  19. package/dist/assets/{common-BqHy8L_A.js → common-C4jQ7Qmf.js} +1 -1
  20. package/dist/assets/{components-EsZEXFgX.js → components-8pybQwj3.js} +1 -1
  21. package/dist/assets/{components-CVd6tsA3.js → components-Cm0Z0WS0.js} +1 -1
  22. package/dist/assets/{config-CWnjHRUp.js → config-CgKiz3_o.js} +1 -1
  23. package/dist/assets/{datasource-BnB1YCgS.js → datasource-BkclstbB.js} +1 -1
  24. package/dist/assets/{dependency-graph-panel-qWHHSaIt.js → dependency-graph-panel-Dcuc_z1H.js} +1 -1
  25. package/dist/assets/{documentation-panel-CfIHwb0z.js → documentation-panel-ClcJVCf2.js} +1 -1
  26. package/dist/assets/{download-GjiUccBq.js → download-t5dlf0C8.js} +1 -1
  27. package/dist/assets/{edit-page-KcjT9CAX.js → edit-page-TFKoKf0h.js} +3 -3
  28. package/dist/assets/{error-panel-CxmkPoke.js → error-panel-BpZDYT0j.js} +1 -1
  29. package/dist/assets/file-explorer-panel-BIxcHuNY.js +26 -0
  30. package/dist/assets/{file-icons-D-wFBwoi.js → file-icons-CH6PLlAQ.js} +1 -1
  31. package/dist/assets/{floating-outline-ZB0d3Gkj.js → floating-outline-C_iFBT1S.js} +1 -1
  32. package/dist/assets/{focus-njOEW9Ho.js → focus-CM-zeepg.js} +1 -1
  33. package/dist/assets/{form-CJ8bXC6w.js → form-BdN-gGnj.js} +1 -1
  34. package/dist/assets/{glide-data-editor-D0XSPCFg.js → glide-data-editor-CoyImave.js} +1 -1
  35. package/dist/assets/{globals-b9yMQzmS.js → globals-DAddhPz5.js} +1 -1
  36. package/dist/assets/{home-page-PcyGT_E-.js → home-page-DBGKQtzB.js} +1 -1
  37. package/dist/assets/{hooks-DVPKK7Uw.js → hooks-BjBV2Ya4.js} +1 -1
  38. package/dist/assets/{html-to-image-CmZyKmue.js → html-to-image-PhtipB5F.js} +1 -1
  39. package/dist/assets/index-BaQAJwyb.css +2 -0
  40. package/dist/assets/{index-D0fMpfEH.js → index-CdVQcrze.js} +6 -6
  41. package/dist/assets/{kiosk-mode-D8VxzEYi.js → kiosk-mode-BIsGB2bz.js} +1 -1
  42. package/dist/assets/{layout-DwUH_Q8_.js → layout-B_WyZpcV.js} +1 -1
  43. package/dist/assets/{logs-panel-BcEljlhw.js → logs-panel-UQ4ATgUR.js} +1 -1
  44. package/dist/assets/{markdown-renderer-BJENzE4w.js → markdown-renderer-CsSEt6xr.js} +1 -1
  45. package/dist/assets/{mermaid-C8G2WDUL.js → mermaid-BQRzyqkQ.js} +1 -1
  46. package/dist/assets/{name-cell-input-Dvwg2j6A.js → name-cell-input-CjhljYZD.js} +1 -1
  47. package/dist/assets/{outline-panel-Vn-LjfXF.js → outline-panel-CeVBezl7.js} +1 -1
  48. package/dist/assets/{packages-panel-1a-wyDvS.js → packages-panel-BIK8BiI8.js} +1 -1
  49. package/dist/assets/{panels-k1Z3DuU0.js → panels-y7fSeKKx.js} +1 -1
  50. package/dist/assets/{process-output-C93ipXYe.js → process-output-CMn_Dy8B.js} +1 -1
  51. package/dist/assets/{readonly-python-code-C0e-zRnF.js → readonly-python-code-CpnBFG08.js} +1 -1
  52. package/dist/assets/{renderShortcut-CsngZZjr.js → renderShortcut-Bjt8kSBs.js} +1 -1
  53. package/dist/assets/{run-page-BXvlyupc.js → run-page-RH8OBSIP.js} +1 -1
  54. package/dist/assets/{scratchpad-panel-D2GRFoGl.js → scratchpad-panel-DpCnByeb.js} +1 -1
  55. package/dist/assets/{session-panel-CgcD2sMA.js → session-panel-CXp7JlL_.js} +1 -1
  56. package/dist/assets/{snippets-panel-DgM0mYlW.js → snippets-panel-BuIAXUdn.js} +1 -1
  57. package/dist/assets/{state-C9NKSTSC.js → state-B8b64ALg.js} +1 -1
  58. package/dist/assets/{state-DZ4kOIAb.js → state-CSzwfw0V.js} +1 -1
  59. package/dist/assets/{switch-CoFOagHR.js → switch-Cojab6Bg.js} +1 -1
  60. package/dist/assets/{terminal-BXtB7lDO.js → terminal-D1Yvu9pO.js} +1 -1
  61. package/dist/assets/{textarea-Bakqk66U.js → textarea-CYczeAo_.js} +1 -1
  62. package/dist/assets/{tracing-CGwuOfDl.js → tracing-B1JBBMQ6.js} +1 -1
  63. package/dist/assets/{tracing-panel-BLeGB-vc.js → tracing-panel-C9D2pbpI.js} +2 -2
  64. package/dist/assets/{useAddCell-CIOpLf6K.js → useAddCell-Dx949Nwo.js} +1 -1
  65. package/dist/assets/{useBoolean-CQRQ8Pqg.js → useBoolean-CLYY2hZr.js} +1 -1
  66. package/dist/assets/{useCellActionButton-DQx9diIX.js → useCellActionButton-Dwv-mN2S.js} +1 -1
  67. package/dist/assets/{useDeleteCell-D1d8RakP.js → useDeleteCell-D77nfE58.js} +1 -1
  68. package/dist/assets/{useDependencyPanelTab-AEOk4Wvo.js → useDependencyPanelTab-CrdJd5fp.js} +1 -1
  69. package/dist/assets/{useHotkey-RegmpKhM.js → useHotkey-C05CMwqk.js} +1 -1
  70. package/dist/assets/{useNotebookActions-DFMHpjN5.js → useNotebookActions-DXMC1QdX.js} +1 -1
  71. package/dist/assets/{useRunCells-CZJZbVK2.js → useRunCells-ClEcKsmt.js} +1 -1
  72. package/dist/assets/{useSplitCell-D63ZxQyE.js → useSplitCell-DMwGtAvj.js} +1 -1
  73. package/dist/assets/{useTheme-CwnJ29E3.js → useTheme-wMq5x3Hi.js} +1 -1
  74. package/dist/assets/utils-DKaC_ndw.js +1 -0
  75. package/dist/assets/{vega-component-DwLjYppo.js → vega-component-BOzdRfM3.js} +1 -1
  76. package/dist/index.html +30 -30
  77. package/package.json +1 -1
  78. package/src/components/ai/ai-provider-icon.tsx +2 -0
  79. package/src/components/app-config/user-config-form.tsx +0 -27
  80. package/src/components/chat/acp/agent-docs.tsx +3 -3
  81. package/src/components/chat/acp/agent-panel.tsx +69 -22
  82. package/src/components/chat/acp/agent-selector.tsx +2 -11
  83. package/src/components/chat/acp/state.ts +14 -2
  84. package/src/components/editor/chrome/panels/file-explorer-panel.tsx +0 -10
  85. package/src/core/config/__tests__/config-schema.test.ts +2 -6
  86. package/src/core/config/config-schema.ts +0 -1
  87. package/src/core/config/feature-flag.tsx +0 -2
  88. package/dist/assets/agent-panel-BZM20s5o.js +0 -287
  89. package/dist/assets/file-explorer-panel-BYhCkFqE.js +0 -26
  90. package/dist/assets/index-DawClVBD.css +0 -2
  91. package/dist/assets/utils-pVkZab2h.js +0 -1
@@ -1,26 +0,0 @@
1
- var $t=Object.defineProperty;var Tt=(t,e,n)=>e in t?$t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var L=(t,e,n)=>Tt(t,typeof e!="symbol"?e+"":e,n);import{s as Ae}from"./chunk-LvLJmgfZ.js";import{i as Rt,l as he,n as B,p as Ee,u as se}from"./useEvent-D91BmmQi.js";import{t as At}from"./react-Bj1aDYRI.js";import{E as Et,Sn as It,Tn as Ie,cr as Bt,li as Be,oi as Lt}from"./cells-DInU2DWF.js";import"./react-dom-CSu739Rf.js";import{t as ae}from"./compiler-runtime-B3qBwwSJ.js";import{_ as ye,v as Vt}from"./useEventListener-DGjKht0c.js";import{t as Ht}from"./invariant-CkiqGLcK.js";import{p as Ut,u as Le}from"./utils-pVkZab2h.js";import{S as me}from"./config-CWnjHRUp.js";import{t as W}from"./cn-DYvqRARy.js";import{t as qt}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-k58KVlT-.js";import{n as Wt}from"./multi-map-MSuUqmbC.js";import{o as Kt}from"./alert-dialog-CXspBRlP.js";import"./popover-AtoFZ7i4.js";import{a as O,c as ne,p as Ve,r as He,t as Ue}from"./dropdown-menu-DrHAuMTb.js";import{a as Gt,gt as je,i as qe,o as pe}from"./JsonOutput-CZWDOcEq.js";import{c as Jt,i as be,r as fe}from"./download-GjiUccBq.js";import{t as R}from"./tooltip-DmqhBBs6.js";import{n as Yt,t as $}from"./button-BKVLeSTX.js";import{St as Zt}from"./dist-VwkX7yeV.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{n as Qt,r as ve}from"./requests-9-v2bhoi.js";import{t as H}from"./createLucideIcon-w-Qo9n0R.js";import{a as We,c as Ke,i as Ge,n as xe,o as we,r as Xt,t as ea}from"./state-CaAUTHAF.js";import{n as ta}from"./LazyAnyLanguageCodeMirror-BEdv0N9X.js";import{t as aa}from"./x-Bv2rCglF.js";import{n as Ne}from"./maps-B4xARV9R.js";import{n as ke}from"./markdown-renderer-BJENzE4w.js";import{u as na}from"./toDate-BGIVWsZ9.js";import{t as Ce}from"./copy-DFMsQ6MJ.js";import{t as sa}from"./eye-off-DgRJ-xBZ.js";import{a as ra,i as Je,n as Ye,r as ia,t as la}from"./file-icons-D-wFBwoi.js";import{t as Ze}from"./file-plus-corner-BjSB-E2p.js";import{t as Qe}from"./file-DaJ4JeZH.js";import{i as Xe,r as oa,t as et}from"./add-connection-dialog-DaW4MgUH.js";import{n as Fe,t as ca}from"./spinner-AR54Ic3-.js";import{t as tt}from"./plus-DWrQrVLZ.js";import{t as at}from"./refresh-cw-CoFbRtMK.js";import{t as da}from"./save-wC4lpIMd.js";import{t as ha}from"./trash-2-CwDX6_Ac.js";import{t as ma}from"./triangle-alert-0kCM6b2I.js";import{i as pa,n as fa,t as xa}from"./es-BWPeXVU-.js";import"./dist-IM-Yi8zQ.js";import"./dist-C68iXRWB.js";import"./dist-BY7nTlwr.js";import"./dist-1CqkOLet.js";import"./dist-Bna8Uthk.js";import{t as A}from"./use-toast-T0_cQDma.js";import{t as Se}from"./paths-Dfii2bN8.js";import"./session-DDorezMU.js";import"./purify.es-D5ZyGDwc.js";import"./dates-CU9x8xLB.js";import{t as nt}from"./context-DaFZ_AD8.js";import{n as st}from"./ImperativeModal-BZqqSMUY.js";import{r as ua}from"./errors-DVkmLSXX.js";import{n as ga,t as rt}from"./blob-CpeNXBj-.js";import"./utils-COwZ1qVI.js";import"./vega-loader.browser-CRZ52CKf.js";import"./defaultLocale-D_rSvXvJ.js";import"./defaultLocale-C92Rrpmf.js";import{n as re}from"./copy-C8iWa1qI.js";import{t as ya}from"./copy-icon-CG2ao3lW.js";import{a as ja,i as ba,n as _e,r as va,t as wa}from"./tree-OplkS9Sp.js";import{n as Na,t as ka}from"./alert-DrrhKX67.js";import{n as it}from"./error-banner-B3Vr5jH0.js";import{n as Pe}from"./useAsyncData-BPlezez1.js";import{a as Ca,o as lt,t as Fa,u as Sa}from"./command-D-mHCwqq.js";import"./chunk-5FQGJX7Z-OcP0iC1i.js";import"./html-to-image-CmZyKmue.js";import{o as _a}from"./focus-njOEW9Ho.js";import"./react-resizable-panels.browser.esm-D0qmuH5W.js";import{a as Pa}from"./renderShortcut-CsngZZjr.js";import{t as Da}from"./bundle.esm-BnMsvtfp.js";import{t as ot}from"./useAddCell-CIOpLf6K.js";import{a as za,c as De,d as ze,l as ct,u as dt}from"./components-CVd6tsA3.js";import{t as Ma}from"./empty-state-CzKMYdaQ.js";import{t as Me}from"./formatting-Dw1UOYgm.js";import{a as Oa,i as $a,n as ht,r as mt,t as pt}from"./components-EsZEXFgX.js";import{n as ft,t as Ta}from"./marimo-icons-B8ry-L5y.js";import{t as Ra}from"./links-wWTxfdQn.js";var Aa=H("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"}]]),Ea=H("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"}]]),Ia=H("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"}]]),xt=H("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"}]]),ut=H("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"}]]),Ba=H("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),La=H("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"}]]),gt=H("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"}]]),z=Ae(At(),1),Va=ae(),a=Ae(qt(),1);const yt=t=>{let e=(0,Va.c)(17),{filename:n,filenameIcon:i,onBack:r,onRefresh:s,onDownload:c,actions:o}=t,h;e[0]===r?h=e[1]:(h=r&&(0,a.jsx)(R,{content:"Back to file list",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:r,children:(0,a.jsx)(Ke,{className:"h-4 w-4"})})}),e[0]=r,e[1]=h);let l;e[2]!==n||e[3]!==i?(l=n?(0,a.jsxs)("span",{className:"flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate",children:[i,n]}):(0,a.jsx)("span",{className:"flex-1"}),e[2]=n,e[3]=i,e[4]=l):l=e[4];let f;e[5]===s?f=e[6]:(f=s&&(0,a.jsx)(R,{content:"Refresh",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:s,children:(0,a.jsx)(at,{className:"h-3.5 w-3.5"})})}),e[5]=s,e[6]=f);let x;e[7]===c?x=e[8]:(x=c&&(0,a.jsx)(R,{content:"Download",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:c,children:(0,a.jsx)(je,{className:"h-3.5 w-3.5"})})}),e[7]=c,e[8]=x);let j;e[9]!==o||e[10]!==f||e[11]!==x?(j=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[f,o,x]}),e[9]=o,e[10]=f,e[11]=x,e[12]=j):j=e[12];let g;return e[13]!==h||e[14]!==l||e[15]!==j?(g=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[h,l,j]}),e[13]=h,e[14]=l,e[15]=j,e[16]=g):g=e[16],g};var Ha=new Set(["http","file","in-memory"]);function Oe(t){return JSON.stringify(t).slice(1,-1)}const jt=[{id:"read-file",label:"Insert read snippet",icon:Aa,getCode:t=>{if(t.entry.kind==="directory")return null;let e=Oe(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:Ia,getCode:t=>{if(t.entry.kind==="directory")return null;let e=Oe(t.entry.path);if(t.backendType==="obstore")return Ha.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 n=Oe(t.entry.path.split("/").pop()||"download");return`${t.variableName}.get("${e}", "${n}")`}}];var Ua=100*1024*1024;function qa(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}const Wa=({entry:t,namespace:e,protocol:n,backendType:i,onBack:r})=>{let{locale:s}=nt(),c=ot(),o=qa(t.path),h=t.mimeType||"text/plain",l=pe(h),f=l&&t.size>Ua&&t.size>0,{data:x,isPending:j,error:g,refetch:m}=Pe(async()=>{if(f)return null;let y=await we.request({namespace:e,path:t.path,preview:!l});if(y.error)throw Error(y.error);if(!y.url)throw Error("No URL returned");if(l)return{type:"media",url:y.url};let w=await fetch(y.url);if(!w.ok)throw Error(`Failed to fetch preview: ${w.statusText}`);return{type:"text",content:await w.text()}},[e,t.path,l,f]),N=(0,z.useCallback)(async()=>{try{let y=await we.request({namespace:e,path:t.path});if(y.error){A({title:"Download failed",description:y.error,variant:"danger"});return}y.url&&be(y.url,y.filename??o)}catch(y){ye.error("Failed to download storage entry",y),A({title:"Download failed",description:String(y),variant:"danger"})}},[e,t.path,o]),v=jt.map(y=>{let w=y.getCode({variableName:e,protocol:n,entry:t,backendType:i});if(w===null)return null;let u=y.icon;return(0,a.jsx)(R,{content:y.label,children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:()=>c(w),"aria-label":y.label,children:(0,a.jsx)(u,{className:"h-3.5 w-3.5"})})},y.id)}),p=(0,a.jsx)(yt,{filename:o,filenameIcon:Je(o),onBack:r,onDownload:N,actions:v}),b=({includeMime:y=!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)(ya,{value:t.path,className:"h-3 w-3"})]}),y&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),y&&(0,a.jsx)("span",{children:h}),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:Me(t.size,s)})]}),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 f?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,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 (",Me(t.size,s),")."]})]}):j?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,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)(Fe,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):g?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,b({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",g.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)($,{variant:"secondary",size:"xs",onClick:m,children:[(0,a.jsx)(at,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):x?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[p,b({}),(0,a.jsx)(qe,{mimeType:h,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:[p,b({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(Qe,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var $e=ae(),Ka=16;function U(t){return{paddingLeft:t*Ka}}function Ga(t,e){return new Date(t*1e3).toLocaleDateString(e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function bt(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}function Te(t,e,n,i){let r=n.toLowerCase();if(bt(t.path).toLowerCase().includes(r))return!0;if(t.kind==="directory"){let s=i.get(We(e,t.path));if(s)return s.some(c=>Te(c,e,n,i))}return!1}function vt(t,e,n,i){return n.trim()?t.filter(r=>Te(r,e,n,i)):t}var Ja=t=>{let e=(0,$e.c)(36),{namespace:n,protocol:i,rootPath:r,backendType:s,prefix:c,depth:o,locale:h,searchValue:l,onOpenFile:f}=t,{entriesByPath:x}=xe(),{entries:j,isPending:g,error:m}=Ge(n,c);if(g){let p;e[0]===o?p=e[1]:(p=U(o),e[0]=o,e[1]=p);let b;e[2]===Symbol.for("react.memo_cache_sentinel")?(b=(0,a.jsx)(Fe,{className:"h-3 w-3 animate-spin"}),e[2]=b):b=e[2];let y;return e[3]===p?y=e[4]:(y=(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:p,children:[b,"Loading..."]}),e[3]=p,e[4]=y),y}if(m){let p;e[5]===o?p=e[6]:(p=U(o),e[5]=o,e[6]=p);let b;return e[7]!==m.message||e[8]!==p?(b=(0,a.jsxs)("div",{className:"py-1 text-xs text-destructive",style:p,children:["Failed to load: ",m.message]}),e[7]=m.message,e[8]=p,e[9]=b):b=e[9],b}if(j.length===0){let p;e[10]===o?p=e[11]:(p=U(o),e[10]=o,e[11]=p);let b;return e[12]===p?b=e[13]:(b=(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:p,children:"Empty"}),e[12]=p,e[13]=b),b}let N;if(e[14]!==s||e[15]!==j||e[16]!==o||e[17]!==x||e[18]!==h||e[19]!==n||e[20]!==f||e[21]!==i||e[22]!==r||e[23]!==l){let p=vt(j,n,l,x),b;e[25]!==s||e[26]!==o||e[27]!==h||e[28]!==n||e[29]!==f||e[30]!==i||e[31]!==r||e[32]!==l?(b=y=>(0,a.jsx)(wt,{entry:y,namespace:n,protocol:i,rootPath:r,backendType:s,depth:o,locale:h,searchValue:l,onOpenFile:f},y.path),e[25]=s,e[26]=o,e[27]=h,e[28]=n,e[29]=f,e[30]=i,e[31]=r,e[32]=l,e[33]=b):b=e[33],N=p.map(b),e[14]=s,e[15]=j,e[16]=o,e[17]=x,e[18]=h,e[19]=n,e[20]=f,e[21]=i,e[22]=r,e[23]=l,e[24]=N}else N=e[24];let v;return e[34]===N?v=e[35]:(v=(0,a.jsx)(a.Fragment,{children:N}),e[34]=N,e[35]=v),v},wt=({entry:t,namespace:e,protocol:n,rootPath:i,backendType:r,depth:s,locale:c,searchValue:o,onOpenFile:h})=>{var w;let[l,f]=(0,z.useState)(!1),{entriesByPath:x}=xe(),j=ot(),g=t.kind==="directory",m=bt(t.path),N=!!o.trim(),v=g&&N&&m.toLowerCase().includes(o.trim().toLowerCase()),p=g&&N&&!!((w=x.get(We(e,t.path)))!=null&&w.some(u=>Te(u,e,o,x))),b=l||p,y=(0,z.useCallback)(async()=>{try{let u=await we.request({namespace:e,path:t.path});if(u.error){A({title:"Download failed",description:u.error,variant:"danger"});return}u.url&&be(u.url,u.filename??"download")}catch(u){ye.error("Failed to download storage entry",u),A({title:"Download failed",description:String(u),variant:"danger"})}},[e,t.path]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(lt,{className:W("text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5",g&&"font-medium"),style:U(s),value:`${e}:${t.path}`,onSelect:()=>{g?f(!b):h({entry:t,namespace:e,protocol:n,backendType:r})},children:[g?(0,a.jsx)(ze,{isExpanded:b,className:"h-3 w-3"}):(0,a.jsx)("span",{className:"w-3 shrink-0"}),g?(0,a.jsx)(ra,{className:W("h-3.5 w-3.5 shrink-0",Ye.directory)}):Je(m),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:m}),(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:Me(t.size,c)}),t.lastModified!=null&&(0,a.jsx)(R,{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:Ga(t.lastModified,c)})}),(0,a.jsxs)(Ue,{children:[(0,a.jsx)(Ve,{asChild:!0,children:(0,a.jsx)(ct,{iconClassName:"h-3 w-3",onClick:u=>u.stopPropagation()})}),(0,a.jsxs)(He,{align:"end",onClick:u=>u.stopPropagation(),onCloseAutoFocus:u=>u.preventDefault(),children:[!g&&(0,a.jsxs)(O,{onSelect:()=>h({entry:t,namespace:e,protocol:n,backendType:r}),children:[(0,a.jsx)(gt,{className:"h-3.5 w-3.5 mr-2"}),"View"]}),(0,a.jsxs)(O,{onSelect:async()=>{await re(t.path),A({title:"Copied to clipboard"})},children:[(0,a.jsx)(Ce,{className:De}),"Copy path"]}),!g&&(0,a.jsxs)(O,{onSelect:()=>y(),children:[(0,a.jsx)(je,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ne,{}),jt.map(u=>{let d=u.getCode({variableName:e,protocol:n,entry:t,backendType:r});if(d===null)return null;let k=u.icon;return(0,a.jsxs)(O,{onSelect:()=>j(d),children:[(0,a.jsx)(k,{className:De}),u.label]},u.id)})]})]})]})]}),g&&b&&(0,a.jsx)(Ja,{namespace:e,protocol:n,rootPath:i,backendType:r,prefix:t.path,depth:s+1,locale:c,searchValue:v?"":o,onOpenFile:h})]})},Ya=t=>{let e=(0,$e.c)(43),{namespace:n,locale:i,searchValue:r,onOpenFile:s}=t,[c,o]=(0,z.useState)(!0),{entriesByPath:h}=xe(),{clearNamespaceCache:l}=Xt(),f=n.name??n.displayName,{entries:x,isPending:j,error:g,refetch:m}=Ge(f),N;e[0]!==l||e[1]!==f||e[2]!==m?(N=y=>{y.stopPropagation(),l(f),m()},e[0]=l,e[1]=f,e[2]=m,e[3]=N):N=e[3];let v=N,p=j?n.storageEntries:x,b;if(e[4]!==p||e[5]!==h||e[6]!==g||e[7]!==v||e[8]!==c||e[9]!==j||e[10]!==i||e[11]!==n.backendType||e[12]!==n.displayName||e[13]!==n.name||e[14]!==n.protocol||e[15]!==n.rootPath||e[16]!==f||e[17]!==s||e[18]!==r){let y=vt(p,f,r,h),w;e[20]===c?w=e[21]:(w=()=>o(!c),e[20]=c,e[21]=w);let u;e[22]===c?u=e[23]:(u=(0,a.jsx)(ze,{isExpanded:c,className:"h-3 w-3"}),e[22]=c,e[23]=u);let d;e[24]===n.protocol?d=e[25]:(d=(0,a.jsx)(oa,{protocol:n.protocol}),e[24]=n.protocol,e[25]=d);let k;e[26]===n.displayName?k=e[27]:(k=(0,a.jsx)("span",{children:n.displayName}),e[26]=n.displayName,e[27]=k);let _;e[28]===n.name?_=e[29]:(_=n.name&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground font-normal",children:["(",(0,a.jsx)(Oa,{variableName:n.name}),")"]}),e[28]=n.name,e[29]=_);let F;e[30]===v?F=e[31]:(F=(0,a.jsx)(dt,{onClick:v,tooltip:"Refresh storage connection",className:"p-0",iconClassName:"h-3 w-3"}),e[30]=v,e[31]=F);let P=n.rootPath||"(root)",S;e[32]===P?S=e[33]:(S=(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-normal tabular-nums ml-auto",children:P}),e[32]=P,e[33]=S);let D;e[34]!==n.name||e[35]!==S||e[36]!==w||e[37]!==u||e[38]!==d||e[39]!==k||e[40]!==_||e[41]!==F?(D=(0,a.jsxs)(lt,{value:n.name,onSelect:w,className:"flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none",children:[u,d,k,_,F,S]}),e[34]=n.name,e[35]=S,e[36]=w,e[37]=u,e[38]=d,e[39]=k,e[40]=_,e[41]=F,e[42]=D):D=e[42],b=(0,a.jsxs)(a.Fragment,{children:[D,c&&(0,a.jsxs)(a.Fragment,{children:[j&&p.length===0&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:U(1),children:[(0,a.jsx)(Fe,{className:"h-3 w-3 animate-spin"}),"Loading..."]}),g&&p.length===0&&(0,a.jsx)(za,{error:g,style:U(1),className:"py-1 text-xs h-auto overflow-auto max-h-32 items-start",showIcon:!1}),!j&&p.length===0&&!g&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:U(1),children:"No entries"}),r&&y.length===0&&p.length>0&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:U(1),children:"No matches"}),y.map(I=>(0,a.jsx)(wt,{entry:I,namespace:f,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:i,searchValue:r,onOpenFile:s},I.path))]})]}),e[4]=p,e[5]=h,e[6]=g,e[7]=v,e[8]=c,e[9]=j,e[10]=i,e[11]=n.backendType,e[12]=n.displayName,e[13]=n.name,e[14]=n.protocol,e[15]=n.rootPath,e[16]=f,e[17]=s,e[18]=r,e[19]=b}else b=e[19];return b};const Za=()=>{let t=(0,$e.c)(31),{namespaces:e}=xe(),{locale:n}=nt(),[i,r]=(0,z.useState)(""),[s,c]=(0,z.useState)(null),o=!!i.trim();if(e.length===0){let w;t[0]===Symbol.for("react.memo_cache_sentinel")?(w=(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"}),"."]}),t[0]=w):w=t[0];let u;return t[1]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(Ma,{title:"No storage connected",description:w,action:(0,a.jsx)(et,{defaultTab:"storage",children:(0,a.jsxs)($,{variant:"outline",size:"sm",children:["Add remote storage",(0,a.jsx)(tt,{className:"h-4 w-4 ml-2"})]})}),icon:(0,a.jsx)(Xe,{className:"h-8 w-8"})}),t[1]=u):u=t[1],u}let h;t[2]===s?h=t[3]:(h=s&&(0,a.jsx)(Wa,{entry:s.entry,namespace:s.namespace,protocol:s.protocol,backendType:s.backendType,onBack:()=>c(null)}),t[2]=s,t[3]=h);let l=s&&"hidden",f;t[4]===l?f=t[5]:(f=W("border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin",l),t[4]=l,t[5]=f);let x;t[6]===i?x=t[7]:(x=(0,a.jsx)(Ca,{placeholder:"Search entries...",className:"h-6 m-1",value:i,onValueChange:r,rootClassName:"flex-1 border-b-0"}),t[6]=i,t[7]=x);let j;t[8]===o?j=t[9]:(j=o&&(0,a.jsx)($,{variant:"text",size:"xs",className:"float-right border-none px-2 m-0 h-full",onClick:()=>r(""),children:(0,a.jsx)(aa,{className:"h-4 w-4"})}),t[8]=o,t[9]=j);let g;t[10]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(R,{content:"Filters loaded entries only. Expand directories to include their contents in the search.",delayDuration:200,children:(0,a.jsx)(na,{className:"h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2"})}),t[10]=g):g=t[10];let m;t[11]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(et,{defaultTab:"storage",children:(0,a.jsx)($,{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)(tt,{className:"h-4 w-4"})})}),t[11]=m):m=t[11];let N;t[12]!==x||t[13]!==j?(N=(0,a.jsxs)("div",{className:"flex items-center w-full border-b",children:[x,j,g,m]}),t[12]=x,t[13]=j,t[14]=N):N=t[14];let v;if(t[15]!==n||t[16]!==e||t[17]!==i){let w;t[19]!==n||t[20]!==i?(w=u=>(0,a.jsx)(Ya,{namespace:u,locale:n,searchValue:i,onOpenFile:c},u.name??u.displayName),t[19]=n,t[20]=i,t[21]=w):w=t[21],v=e.map(w),t[15]=n,t[16]=e,t[17]=i,t[18]=v}else v=t[18];let p;t[22]===v?p=t[23]:(p=(0,a.jsx)(Sa,{className:"flex flex-col",children:v}),t[22]=v,t[23]=p);let b;t[24]!==f||t[25]!==N||t[26]!==p?(b=(0,a.jsxs)(Fa,{className:f,shouldFilter:!1,children:[N,p]}),t[24]=f,t[25]=N,t[26]=p,t[27]=b):b=t[27];let y;return t[28]!==h||t[29]!==b?(y=(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[h,b]}),t[28]=h,t[29]=b,t[30]=y):y=t[30],y};var Nt=ae(),kt=(0,z.createContext)(null);function Qa(){return(0,z.useContext)(kt)??void 0}var Xa=t=>{let e=(0,Nt.c)(3),{children:n}=t,i=ba(),r;return e[0]!==n||e[1]!==i?(r=(0,a.jsx)(kt.Provider,{value:i,children:n}),e[0]=n,e[1]=i,e[2]=r):r=e[2],r};const en=t=>{let e=(0,Nt.c)(5),{children:n}=t,[i,r]=(0,z.useState)(null),s;e[0]!==n||e[1]!==i?(s=i&&(0,a.jsx)(ja,{backend:va,options:{rootElement:i},children:(0,a.jsx)(Xa,{children:n})}),e[0]=n,e[1]=i,e[2]=s):s=e[2];let c;return e[3]===s?c=e[4]:(c=(0,a.jsx)("div",{ref:r,className:"contents",children:s}),e[3]=s,e[4]=c),c};var Re=new Map;const tn=({file:t,onOpenNotebook:e})=>{let{sendFileDetails:n,sendUpdateFile:i}=ve(),r=se(Ut),s=se(Le),c=se(Lt),[o,h]=(0,z.useState)(""),{data:l,isPending:f,error:x,setData:j,refetch:g}=Pe(async()=>{let d=await n({path:t.path}),k=d.contents||"";return h(Re.get(t.path)||k),d},[t.path]),m=async()=>{o!==(l==null?void 0:l.contents)&&await i({path:t.path,contents:o}).then(d=>{d.success&&(j(k=>({...k,contents:o})),h(o))})},N=(0,z.useRef)(o);if(N.current=o,(0,z.useEffect)(()=>()=>{if(!(l!=null&&l.contents))return;let d=N.current;d===l.contents?Re.delete(t.path):Re.set(t.path,d)},[t.path,l==null?void 0:l.contents]),x)return(0,a.jsx)(it,{error:x});if(f||!l)return null;let v=l.mimeType||"text/plain",p=v in Gt,b=c&&l.file.isMarimoFile&&(t.path===c||t.path.endsWith(`/${c}`));if(!l.contents&&!p)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:l.file.name}),(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Type"}),(0,a.jsx)("div",{children:v})]});let y=(0,a.jsx)(yt,{filename:l.file.name,onRefresh:g,onDownload:s?void 0:()=>{if(l.isBase64&&l.contents){pe(v)?be(ke(l.contents,v),l.file.name):fe(rt(ke(l.contents,l.mimeType||"application/octet-stream")),l.file.name);return}fe(new Blob([l.contents||o],{type:v}),l.file.name)},actions:(0,a.jsxs)(a.Fragment,{children:[t.isMarimoFile&&!me()&&(0,a.jsx)(R,{content:"Open notebook",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:d=>e(d),children:(0,a.jsx)(Ne,{className:"h-3.5 w-3.5"})})}),!pe(v)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(R,{content:"Copy contents to clipboard",children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:async()=>{await re(o)},children:(0,a.jsx)(Ce,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(R,{content:Pa("global.save"),children:(0,a.jsx)($,{variant:"text",size:"xs",onClick:m,disabled:o===l.contents,children:(0,a.jsx)(da,{className:"h-3.5 w-3.5"})})})]})]})}),w=pe(v),u=!w&&v!=="text/csv";return(0,a.jsxs)(a.Fragment,{children:[y,u&&b&&(0,a.jsxs)(ka,{variant:"warning",className:"rounded-none",children:[(0,a.jsx)(ma,{className:"h-4 w-4"}),(0,a.jsx)(Na,{children:"Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution."})]}),(0,a.jsx)(qe,{mimeType:v,contents:w?void 0:u?o:l.contents??void 0,mediaSource:w?{base64:l.contents,mime:v}:void 0,readOnly:!u,onChange:h,extensions:[Zt.of([{key:r.getHotkey("global.save").key,stopPropagation:!0,run:()=>o===l.contents?!1:(m(),!0)}])]})]})};var an=class{constructor(t){L(this,"delegate",new _e([]));L(this,"rootPath","");L(this,"onChange",Vt.NOOP);L(this,"path",new Se("/"));L(this,"initialize",async t=>{if(this.onChange=t,this.delegate.data.length===0)try{let e=await this.callbacks.listFiles({path:this.rootPath});this.delegate=new _e(e.files),this.rootPath=e.root,this.path=Se.guessDeliminator(e.root)}catch(e){A({title:"Failed",description:ua(e)})}this.onChange(this.delegate.data)});L(this,"refreshAll",async t=>{let e=[this.rootPath,...t.map(i=>{var r;return(r=this.delegate.find(i))==null?void 0:r.data.path})].filter(Boolean),n=await Promise.all(e.map(i=>this.callbacks.listFiles({path:i}).catch(()=>({files:[]}))));for(let[i,r]of e.entries()){let s=n[i];r===this.rootPath?this.delegate=new _e(s.files):this.delegate.update({id:r,changes:{children:s.files}})}this.onChange(this.delegate.data)});L(this,"relativeFromRoot",t=>{let e=this.rootPath.endsWith(this.path.deliminator)?this.rootPath:`${this.rootPath}${this.path.deliminator}`;return t.startsWith(e)?t.slice(e.length):t});L(this,"handleResponse",t=>t.success?t:(A({title:"Failed",description:t.message}),null));this.callbacks=t}async expand(t){let e=this.delegate.find(t);if(!e||!e.data.isDirectory)return!1;if(e.children&&e.children.length>0)return!0;let n=await this.callbacks.listFiles({path:e.data.path});return this.delegate.update({id:t,changes:{children:n.files}}),this.onChange(this.delegate.data),!0}async rename(t,e){let n=this.delegate.find(t);if(!n)return;let i=n.data.path,r=this.path.join(this.path.dirname(i),e);await this.callbacks.renameFileOrFolder({path:i,newPath:r}).then(this.handleResponse),this.delegate.update({id:t,changes:{name:e,path:r}}),this.onChange(this.delegate.data),await this.refreshAll([r])}async move(t,e){var i;let n=e?((i=this.delegate.find(e))==null?void 0:i.data.path)??e:this.rootPath;await Promise.all(t.map(r=>{this.delegate.move({id:r,parentId:e,index:0});let s=this.delegate.find(r);if(!s)return Promise.resolve();let c=this.path.join(n,this.path.basename(s.data.path));return this.delegate.update({id:r,changes:{path:c}}),this.callbacks.renameFileOrFolder({path:s.data.path,newPath:c}).then(this.handleResponse)})),this.onChange(this.delegate.data),await this.refreshAll([n])}async createFile(t,e,n="file"){var s;let i=e?((s=this.delegate.find(e))==null?void 0:s.data.path)??e:this.rootPath,r=await this.callbacks.createFileOrFolder({path:i,type:n,name:t}).then(this.handleResponse);r!=null&&r.info&&(this.delegate.create({parentId:e,index:0,data:r.info}),this.onChange(this.delegate.data),await this.refreshAll([i]))}async createFolder(t,e){var r;let n=e?((r=this.delegate.find(e))==null?void 0:r.data.path)??e:this.rootPath,i=await this.callbacks.createFileOrFolder({path:n,type:"directory",name:t}).then(this.handleResponse);i!=null&&i.info&&(this.delegate.create({parentId:e,index:0,data:i.info}),this.onChange(this.delegate.data),await this.refreshAll([n]))}async delete(t){let e=this.delegate.find(t);e&&(await this.callbacks.deleteFileOrFolder({path:e.data.path}).then(this.handleResponse),this.delegate.drop({id:t}),this.onChange(this.delegate.data))}};const Ct=Ee(t=>{let e=t(Qt);return Ht(e,"no requestClientAtom set"),new an({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),nn=Ee({});async function sn(){await Rt.get(Ct).refreshAll([])}var q=" ";const Ft={directory:t=>`os.listdir("${t}")`,python:t=>`with open("${t}", "r") as _f:
11
- ${q}...
12
- `,json:t=>`with open("${t}", "r") as _f:
13
- ${q}_data = json.load(_f)
14
- `,code:t=>`with open("${t}", "r") as _f:
15
- ${q}...
16
- `,text:t=>`with open("${t}", "r") as _f:
17
- ${q}...
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
- ${q}...
20
- `,zip:t=>`with open("${t}", "rb") as _f:
21
- ${q}...
22
- `,data:t=>`with open("${t}", "r") as _f:
23
- ${q}...
24
- `,unknown:t=>`with open("${t}", "r") as _f:
25
- ${q}...
26
- `};var rn=ae(),ln=1024*1024*100;function St(t){let e=(0,rn.c)(7),n;e[0]===t?n=e[1]:(n=t===void 0?{}:t,e[0]=t,e[1]=n);let i=n,{sendCreateFileOrFolder:r}=ve(),s;e[2]===r?s=e[3]:(s=async o=>{if(o.length===0)return;let h=o.length===1;await Jt(h?"Uploading file...":"Uploading files...",async l=>{l.addTotal(o.length);for(let f of o){let x=pn(mn(f)),j="";x&&(j=Se.guessDeliminator(x).dirname(x));let g=(await ga(f)).split(",")[1];await r({path:j,type:"file",name:f.name,contents:g}),l.increment(1)}await sn()},{title:h?"File uploaded":`${o.length} files uploaded`})},e[2]=r,e[3]=s);let c;return e[4]!==i||e[5]!==s?(c={multiple:!0,maxSize:ln,onError:hn,onDropRejected:on,onDrop:s,...i},e[4]=i,e[5]=s,e[6]=c):c=e[6],xa(c)}function on(t){A({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(cn)}),variant:"danger"})}function cn(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(dn).join(", "),")"]},t.file.name)}function dn(t){return t.message}function hn(t){ye.error(t),A({title:"File upload failed",description:t.message,variant:"danger"})}function mn(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 pn(t){if(t)return t.replace(/^\/+/,"")}var ie=ae(),fn=Be("marimo:showHiddenFiles",!0,Ie,{getOnInit:!0}),_t=z.createContext(null);const xn=t=>{let e=(0,ie.c)(72),{height:n}=t,i=(0,z.useRef)(null),r=Qa(),[s]=he(Ct),c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=[],e[0]=c):c=e[0];let[o,h]=(0,z.useState)(c),[l,f]=(0,z.useState)(null),[x,j]=he(fn),{openPrompt:g}=st(),[m,N]=he(nn),v;e[1]===s?v=e[2]:(v=()=>s.initialize(h),e[1]=s,e[2]=v);let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[3]=p):p=e[3];let{isPending:b,error:y}=Pe(v,p),w;e[4]!==m||e[5]!==s?(w=()=>s.refreshAll(Object.keys(m).filter(C=>m[C])),e[4]=m,e[5]=s,e[6]=w):w=e[6];let u=B(w),d;e[7]!==j||e[8]!==x?(d=()=>{j(!x)},e[7]=j,e[8]=x,e[9]=d):d=e[9];let k=B(d),_;e[10]!==g||e[11]!==s?(_=async()=>{g({title:"Folder name",onConfirm:async C=>{s.createFolder(C,null)}})},e[10]=g,e[11]=s,e[12]=_):_=e[12];let F=B(_),P;e[13]!==g||e[14]!==s?(P=async()=>{g({title:"File name",onConfirm:async C=>{s.createFile(C,null)}})},e[13]=g,e[14]=s,e[15]=P):P=e[15];let S=B(P),D;e[16]!==g||e[17]!==s?(D=async()=>{g({title:"Notebook name",onConfirm:async C=>{s.createFile(C,null,"notebook")}})},e[16]=g,e[17]=s,e[18]=D):D=e[18];let I=B(D),M;e[19]===N?M=e[20]:(M=()=>{var C;(C=i.current)==null||C.closeAll(),N({})},e[19]=N,e[20]=M);let V=B(M),le;e[21]!==o||e[22]!==x?(le=Dt(o,x),e[21]=o,e[22]=x,e[23]=le):le=e[23];let ue=le;if(b){let C;return e[24]===Symbol.for("react.memo_cache_sentinel")?(C=(0,a.jsx)(ca,{size:"medium",centered:!0}),e[24]=C):C=e[24],C}if(y){let C;return e[25]===y?C=e[26]:(C=(0,a.jsx)(it,{error:y}),e[25]=y,e[26]=C),C}if(l){let C;e[27]===Symbol.for("react.memo_cache_sentinel")?(C=()=>f(null),e[27]=C):C=e[27];let T;e[28]===Symbol.for("react.memo_cache_sentinel")?(T=(0,a.jsx)($,{onClick:C,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(Ke,{size:16})}),e[28]=T):T=e[28];let E;e[29]===l.name?E=e[30]:(E=(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:l.name})]}),e[29]=l.name,e[30]=E);let ee;e[31]!==l.path||e[32]!==s?(ee=Ot=>Pt(Ot,s.relativeFromRoot(l.path)),e[31]=l.path,e[32]=s,e[33]=ee):ee=e[33];let te;e[34]!==l||e[35]!==ee?(te=(0,a.jsx)(z.Suspense,{children:(0,a.jsx)(tn,{onOpenNotebook:ee,file:l})}),e[34]=l,e[35]=ee,e[36]=te):te=e[36];let de;return e[37]!==E||e[38]!==te?(de=(0,a.jsxs)(a.Fragment,{children:[E,te]}),e[37]=E,e[38]=te,e[39]=de):de=e[39],de}let K;e[40]!==V||e[41]!==S||e[42]!==F||e[43]!==I||e[44]!==k||e[45]!==u||e[46]!==s?(K=(0,a.jsx)(gn,{onRefresh:u,onHidden:k,onCreateFile:S,onCreateNotebook:I,onCreateFolder:F,onCollapseAll:V,tree:s}),e[40]=V,e[41]=S,e[42]=F,e[43]=I,e[44]=k,e[45]=u,e[46]=s,e[47]=K):K=e[47];let ge=n-33,G,J,Y;e[48]===s?(G=e[49],J=e[50],Y=e[51]):(G=async C=>{let{ids:T}=C;for(let E of T)await s.delete(E)},J=async C=>{let{id:T,name:E}=C;await s.rename(T,E)},Y=async C=>{let{dragIds:T,parentId:E}=C;await s.move(T,E)},e[48]=s,e[49]=G,e[50]=J,e[51]=Y);let oe;e[52]===Symbol.for("react.memo_cache_sentinel")?(oe=C=>{let T=C[0];T&&(T.data.isDirectory||f(T.data))},e[52]=oe):oe=e[52];let Z;e[53]!==m||e[54]!==N||e[55]!==s?(Z=async C=>{if(await s.expand(C)){let T=m[C]??!1;N({...m,[C]:!T})}},e[53]=m,e[54]=N,e[55]=s,e[56]=Z):Z=e[56];let Q;e[57]!==r||e[58]!==m||e[59]!==ge||e[60]!==G||e[61]!==J||e[62]!==Y||e[63]!==Z||e[64]!==ue?(Q=(0,a.jsx)(wa,{width:"100%",ref:i,height:ge,className:"h-full",data:ue,initialOpenState:m,openByDefault:!1,dndManager:r,renderCursor:Nn,disableDrop:kn,onDelete:G,onRename:J,onMove:Y,onSelect:oe,onToggle:Z,padding:15,rowHeight:30,indent:un,overscanCount:1e3,disableMultiSelection:!0,children:bn}),e[57]=r,e[58]=m,e[59]=ge,e[60]=G,e[61]=J,e[62]=Y,e[63]=Z,e[64]=ue,e[65]=Q):Q=e[65];let X;e[66]!==Q||e[67]!==s?(X=(0,a.jsx)(_t,{value:s,children:Q}),e[66]=Q,e[67]=s,e[68]=X):X=e[68];let ce;return e[69]!==K||e[70]!==X?(ce=(0,a.jsxs)(a.Fragment,{children:[K,X]}),e[69]=K,e[70]=X,e[71]=ce):ce=e[71],ce};var un=15,gn=t=>{let e=(0,ie.c)(37),{onRefresh:n,onHidden:i,onCreateFile:r,onCreateNotebook:s,onCreateFolder:c,onCollapseAll:o}=t,h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={noDrag:!0,noDragEventsBubbling:!0},e[0]=h):h=e[0];let{getRootProps:l,getInputProps:f}=St(h),x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=(0,a.jsx)(ft,{size:16}),e[1]=x):x=e[1];let j;e[2]===s?j=e[3]:(j=(0,a.jsx)(R,{content:"Add notebook",children:(0,a.jsx)($,{"data-testid":"file-explorer-add-notebook-button",onClick:s,variant:"text",size:"xs",children:x})}),e[2]=s,e[3]=j);let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(Ze,{size:16}),e[4]=g):g=e[4];let m;e[5]===r?m=e[6]:(m=(0,a.jsx)(R,{content:"Add file",children:(0,a.jsx)($,{"data-testid":"file-explorer-add-file-button",onClick:r,variant:"text",size:"xs",children:g})}),e[5]=r,e[6]=m);let N;e[7]===Symbol.for("react.memo_cache_sentinel")?(N=(0,a.jsx)(xt,{size:16}),e[7]=N):N=e[7];let v;e[8]===c?v=e[9]:(v=(0,a.jsx)(R,{content:"Add folder",children:(0,a.jsx)($,{"data-testid":"file-explorer-add-folder-button",onClick:c,variant:"text",size:"xs",children:N})}),e[8]=c,e[9]=v);let p;e[10]===l?p=e[11]:(p=l({}),e[10]=l,e[11]=p);let b,y;e[12]===Symbol.for("react.memo_cache_sentinel")?(y=Yt({variant:"text",size:"xs"}),b=(0,a.jsx)(pa,{size:16}),e[12]=b,e[13]=y):(b=e[12],y=e[13]);let w;e[14]===p?w=e[15]:(w=(0,a.jsx)(R,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...p,className:y,children:b})}),e[14]=p,e[15]=w);let u;e[16]===f?u=e[17]:(u=f({}),e[16]=f,e[17]=u);let d;e[18]===u?d=e[19]:(d=(0,a.jsx)("input",{...u,type:"file"}),e[18]=u,e[19]=d);let k;e[20]===n?k=e[21]:(k=(0,a.jsx)(dt,{"data-testid":"file-explorer-refresh-button",onClick:n}),e[20]=n,e[21]=k);let _;e[22]===Symbol.for("react.memo_cache_sentinel")?(_=(0,a.jsx)(sa,{size:16}),e[22]=_):_=e[22];let F;e[23]===i?F=e[24]:(F=(0,a.jsx)(R,{content:"Toggle hidden files",children:(0,a.jsx)($,{"data-testid":"file-explorer-hidden-files-button",onClick:i,variant:"text",size:"xs",children:_})}),e[23]=i,e[24]=F);let P;e[25]===Symbol.for("react.memo_cache_sentinel")?(P=(0,a.jsx)(Ea,{size:16}),e[25]=P):P=e[25];let S;e[26]===o?S=e[27]:(S=(0,a.jsx)(R,{content:"Collapse all folders",children:(0,a.jsx)($,{"data-testid":"file-explorer-collapse-button",onClick:o,variant:"text",size:"xs",children:P})}),e[26]=o,e[27]=S);let D;return e[28]!==w||e[29]!==d||e[30]!==k||e[31]!==F||e[32]!==S||e[33]!==j||e[34]!==m||e[35]!==v?(D=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[j,m,v,w,d,k,F,S]}),e[28]=w,e[29]=d,e[30]=k,e[31]=F,e[32]=S,e[33]=j,e[34]=m,e[35]=v,e[36]=D):D=e[36],D},yn=t=>{let e=(0,ie.c)(9),{node:n,onOpenMarimoFile:i}=t,r;e[0]===n?r=e[1]:(r=o=>{n.data.isDirectory||(o.stopPropagation(),n.select())},e[0]=n,e[1]=r);let s;e[2]!==n.data.isMarimoFile||e[3]!==i?(s=n.data.isMarimoFile&&!me()&&(0,a.jsxs)("span",{className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:i,children:["open ",(0,a.jsx)(Ne,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=i,e[4]=s):s=e[4];let c;return e[5]!==n.data.name||e[6]!==r||e[7]!==s?(c=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:r,children:[n.data.name,s]}),e[5]=n.data.name,e[6]=r,e[7]=s,e[8]=c):c=e[8],c},jn=t=>{let e=(0,ie.c)(10),{node:n}=t,i=(0,z.useRef)(null),r,s;e[0]===n.data.name?(r=e[1],s=e[2]):(r=()=>{var l,f;(l=i.current)==null||l.focus(),(f=i.current)==null||f.setSelectionRange(0,n.data.name.lastIndexOf("."))},s=[n.data.name],e[0]=n.data.name,e[1]=r,e[2]=s),(0,z.useEffect)(r,s);let c,o;e[3]===n?(c=e[4],o=e[5]):(c=()=>n.reset(),o=l=>{l.key==="Escape"&&n.reset(),l.key==="Enter"&&n.submit(l.currentTarget.value)},e[3]=n,e[4]=c,e[5]=o);let h;return e[6]!==n.data.name||e[7]!==c||e[8]!==o?(h=(0,a.jsx)("input",{ref:i,className:"flex-1 bg-transparent border border-border text-muted-foreground",defaultValue:n.data.name,onClick:Cn,onBlur:c,onKeyDown:o}),e[6]=n.data.name,e[7]=c,e[8]=o,e[9]=h):h=e[9],h},bn=({node:t,style:e,dragHandle:n})=>{let{openFile:i,sendCreateFileOrFolder:r,sendFileDetails:s}=ve(),c=se(Le),o=t.data.isDirectory?"directory":ia(t.data.name),h=la[o],{openConfirm:l,openPrompt:f}=st(),{createNewCell:x}=Et(),j=_a(),g=d=>{x({code:d,before:!1,cellId:j??"__end__"})},m=(0,z.use)(_t),N=async d=>{Pt(d,m?m.relativeFromRoot(t.data.path):t.data.path)},v=async d=>{d.stopPropagation(),d.preventDefault(),l({title:"Delete file",description:`Are you sure you want to delete ${t.data.name}?`,confirmAction:(0,a.jsx)(Kt,{onClick:async()=>{await t.tree.delete(t.id)},"aria-label":"Confirm",children:"Delete"})})},p=B(async()=>{t.open(),f({title:"Folder name",onConfirm:async d=>{m==null||m.createFolder(d,t.id)}})}),b=B(async()=>{t.open(),f({title:"File name",onConfirm:async d=>{m==null||m.createFile(d,t.id)}})}),y=B(async()=>{t.open(),f({title:"Notebook name",onConfirm:async d=>{m==null||m.createFile(d,t.id,"notebook")}})}),w=B(async()=>{var F;if(!m||t.data.isDirectory)return;let[d,k]=fa(t.data.name),_=`${d}_copy${k}`;try{let P=await s({path:t.data.path}),S=((F=t.parent)==null?void 0:F.data.path)||"";await r({path:S,type:"file",name:_,contents:P.contents?btoa(P.contents):void 0}),await m.refreshAll([S])}catch{A({title:"Failed to duplicate file",description:"Unable to create a duplicate of the file",variant:"danger"})}}),u=()=>{let d=De;return(0,a.jsxs)(He,{align:"end",className:"print:hidden w-[220px]",onClick:k=>k.stopPropagation(),onCloseAutoFocus:k=>k.preventDefault(),children:[!t.data.isDirectory&&(0,a.jsxs)(O,{onSelect:()=>t.select(),children:[(0,a.jsx)(gt,{className:d}),"Open file"]}),!t.data.isDirectory&&!me()&&(0,a.jsxs)(O,{onSelect:()=>{i({path:t.data.path})},children:[(0,a.jsx)(Ne,{className:d}),"Open file in external editor"]}),t.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(O,{onSelect:()=>y(),children:[(0,a.jsx)(ft,{className:d}),"Create notebook"]}),(0,a.jsxs)(O,{onSelect:()=>b(),children:[(0,a.jsx)(Ze,{className:d}),"Create file"]}),(0,a.jsxs)(O,{onSelect:()=>p(),children:[(0,a.jsx)(xt,{className:d}),"Create folder"]}),(0,a.jsx)(ne,{})]}),(0,a.jsxs)(O,{onSelect:()=>t.edit(),children:[(0,a.jsx)(Ba,{className:d}),"Rename"]}),!t.data.isDirectory&&(0,a.jsxs)(O,{onSelect:w,children:[(0,a.jsx)(Ce,{className:d}),"Duplicate"]}),(0,a.jsxs)(O,{onSelect:async()=>{await re(t.data.path),A({title:"Copied to clipboard"})},children:[(0,a.jsx)(ut,{className:d}),"Copy path"]}),m&&(0,a.jsxs)(O,{onSelect:async()=>{await re(m.relativeFromRoot(t.data.path)),A({title:"Copied to clipboard"})},children:[(0,a.jsx)(ut,{className:d}),"Copy relative path"]}),(0,a.jsx)(ne,{}),(0,a.jsxs)(O,{onSelect:()=>{let{path:k}=t.data;g(Ft[o](k))},children:[(0,a.jsx)(ta,{className:d}),"Insert snippet for reading file"]}),(0,a.jsxs)(O,{onSelect:async()=>{A({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:k}=t.data;await re(Ft[o](k))},children:[(0,a.jsx)(Bt,{className:d}),"Copy snippet for reading file"]}),t.data.isMarimoFile&&!me()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ne,{}),(0,a.jsxs)(O,{onSelect:N,children:[(0,a.jsx)(La,{className:d}),"Open notebook"]})]}),(0,a.jsx)(ne,{}),!t.data.isDirectory&&!c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(O,{onSelect:async()=>{let k=await s({path:t.data.path});k.isBase64&&k.contents?fe(rt(ke(k.contents,k.mimeType||"application/octet-stream")),t.data.name):fe(new Blob([k.contents||""]),t.data.name)},children:[(0,a.jsx)(je,{className:d}),"Download"]}),(0,a.jsx)(ne,{})]}),(0,a.jsxs)(O,{onSelect:v,variant:"danger",children:[(0,a.jsx)(ha,{className:d}),"Delete"]})]})};return(0,a.jsxs)("div",{style:e,ref:n,className:W("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),draggable:!0,onClick:d=>{d.stopPropagation(),t.data.isDirectory&&t.toggle()},children:[(0,a.jsx)(vn,{node:t}),(0,a.jsxs)("span",{className:W("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",t.willReceiveDrop&&t.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground"),children:[t.data.isMarimoFile?(0,a.jsx)(Ta,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}):(0,a.jsx)(h,{className:W("w-5 h-5 shrink-0 mr-2",Ye[o]),strokeWidth:1.5}),t.isEditing?(0,a.jsx)(jn,{node:t}):(0,a.jsx)(yn,{node:t,onOpenMarimoFile:N}),(0,a.jsxs)(Ue,{modal:!1,children:[(0,a.jsx)(Ve,{asChild:!0,tabIndex:-1,onClick:d=>d.stopPropagation(),children:(0,a.jsx)(ct,{"data-testid":"file-explorer-more-button",iconClassName:"w-5 h-5"})}),u()]})]})]})},vn=t=>{let e=(0,ie.c)(3),{node:n}=t;if(!n.data.isDirectory){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)("span",{className:"w-4 h-4 shrink-0"}),e[0]=r):r=e[0],r}let i;return e[1]===n.isOpen?i=e[2]:(i=(0,a.jsx)(ze,{isExpanded:n.isOpen,className:"w-4 h-4"}),e[1]=n.isOpen,e[2]=i),i};function Pt(t,e){t.stopPropagation(),t.preventDefault(),Ra(e)}function Dt(t,e){if(e)return t;let n=[];for(let i of t){if(wn(i.name))continue;let r=i;if(i.children){let s=Dt(i.children,e);s!==i.children&&(r={...i,children:s})}n.push(r)}return n}function wn(t){return!!t.startsWith(".")}function Nn(){return null}function kn(t){let{parentNode:e}=t;return!e.data.isDirectory}function Cn(t){return t.stopPropagation()}var zt=ae(),Fn=Be("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},Ie),Mt=t=>{let e=(0,zt.c)(20),{height:n}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noClick:!0,noKeyboard:!0},e[0]=i):i=e[0];let{getRootProps:r,getInputProps:s,isDragActive:c}=St(i),o;e[1]===r?o=e[2]:(o=r(),e[1]=r,e[2]=o);let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=W("flex flex-col overflow-hidden relative"),e[3]=h):h=e[3];let l;e[4]===n?l=e[5]:(l={height:n},e[4]=n,e[5]=l);let f;e[6]===s?f=e[7]:(f=s(),e[6]=s,e[7]=f);let x;e[8]===f?x=e[9]:(x=(0,a.jsx)("input",{...f}),e[8]=f,e[9]=x);let j;e[10]===c?j=e[11]:(j=c&&(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]=c,e[11]=j);let g;e[12]===n?g=e[13]:(g=(0,a.jsx)(xn,{height:n}),e[12]=n,e[13]=g);let m;return e[14]!==o||e[15]!==l||e[16]!==x||e[17]!==j||e[18]!==g?(m=(0,a.jsx)(en,{children:(0,a.jsxs)("div",{...o,className:h,style:l,children:[x,j,g]})}),e[14]=o,e[15]=l,e[16]=x,e[17]=j,e[18]=g,e[19]=m):m=e[19],m},Sn=33,_n=()=>{let t=(0,zt.c)(41),{ref:e,height:n}=Da(),i=n===void 0?500:n,[r,s]=he(Fn),c=se(ea).length,o;e:{if(!r.hasUserInteracted&&c>0){if(r.openSections.includes("remote-storage")){o=r.openSections;break e}let M;t[0]===r.openSections?M=t[1]:(M=[...r.openSections,"remote-storage"],t[0]=r.openSections,t[1]=M),o=M;break e}o=r.openSections}let h=o,l;t[2]===s?l=t[3]:(l=M=>{s({openSections:M,hasUserInteracted:!0})},t[2]=s,t[3]=l);let f=l,x=i-Sn*2,j;t[4]===h?j=t[5]:(j=h.includes("remote-storage"),t[4]=h,t[5]=j);let g=j,m;t[6]!==h||t[7]!==g?(m=g&&h.includes("files"),t[6]=h,t[7]=g,t[8]=m):m=t[8];let N=m,v;t[9]!==x||t[10]!==N?(v=N?Math.round(x*.4):x,t[9]=x,t[10]=N,t[11]=v):v=t[11];let p=v,b=Math.max(200,N?x-p:x);if(!It("storage_inspector")){let M;t[12]===i?M=t[13]:(M=(0,a.jsx)(Mt,{height:i}),t[12]=i,t[13]=M);let V;return t[14]!==e||t[15]!==M?(V=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:M}),t[14]=e,t[15]=M,t[16]=V):V=t[16],V}let y;t[17]===Symbol.for("react.memo_cache_sentinel")?(y=(0,a.jsx)(Xe,{className:"w-4 h-4"}),t[17]=y):y=t[17];let w;t[18]===c?w=t[19]:(w=c>0&&(0,a.jsx)($a,{children:c}),t[18]=c,t[19]=w);let u;t[20]===w?u=t[21]:(u=(0,a.jsxs)(mt,{children:[y," Remote storage",w]}),t[20]=w,t[21]=u);let d;t[22]===p?d=t[23]:(d={maxHeight:p},t[22]=p,t[23]=d);let k;t[24]===Symbol.for("react.memo_cache_sentinel")?(k=(0,a.jsx)(Za,{}),t[24]=k):k=t[24];let _;t[25]===d?_=t[26]:(_=(0,a.jsx)(pt,{className:"overflow-auto",style:d,children:k}),t[25]=d,t[26]=_);let F;t[27]!==_||t[28]!==u?(F=(0,a.jsxs)(ht,{value:"remote-storage",children:[u,_]}),t[27]=_,t[28]=u,t[29]=F):F=t[29];let P;t[30]===Symbol.for("react.memo_cache_sentinel")?(P=(0,a.jsxs)(mt,{children:[(0,a.jsx)(Qe,{className:"w-4 h-4"}),"Files"]}),t[30]=P):P=t[30];let S;t[31]===b?S=t[32]:(S=(0,a.jsxs)(ht,{value:"files",children:[P,(0,a.jsx)(pt,{children:(0,a.jsx)(Mt,{height:b})})]}),t[31]=b,t[32]=S);let D;t[33]!==f||t[34]!==h||t[35]!==F||t[36]!==S?(D=(0,a.jsxs)(Wt,{type:"multiple",value:h,onValueChange:f,children:[F,S]}),t[33]=f,t[34]=h,t[35]=F,t[36]=S,t[37]=D):D=t[37];let I;return t[38]!==e||t[39]!==D?(I=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:D}),t[38]=e,t[39]=D,t[40]=I):I=t[40],I};export{_n as default};