@marimo-team/frontend 0.24.1-dev87 → 0.24.1-dev90

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 (77) hide show
  1. package/dist/assets/{CellStatus-D40JXMpi.js → CellStatus-BAfpiaJr.js} +1 -1
  2. package/dist/assets/{JsonOutput-DeeAtdky.js → JsonOutput-Bu92ihyf.js} +1 -1
  3. package/dist/assets/{MarimoErrorOutput-Dh-877oV.js → MarimoErrorOutput-B6VFcCOD.js} +1 -1
  4. package/dist/assets/{RenderHTML-C7JgAfHC.js → RenderHTML-Cqn8OKqJ.js} +1 -1
  5. package/dist/assets/{RunButton-C9d_w3qn.js → RunButton-CjlJVYRU.js} +1 -1
  6. package/dist/assets/{add-cell-with-ai-zrX9HOPy.js → add-cell-with-ai-CoNAy8Wk.js} +1 -1
  7. package/dist/assets/{add-connection-dialog-OQxtKyCV.js → add-connection-dialog-D28GcLwH.js} +1 -1
  8. package/dist/assets/{agent-panel-DF7_IEEH.js → agent-panel-BsUX99c5.js} +1 -1
  9. package/dist/assets/{ai-model-dropdown-DIItpu01.js → ai-model-dropdown-jajg9hms.js} +1 -1
  10. package/dist/assets/{app-config-button-CeDIYZUc.js → app-config-button-CHcCBh-B.js} +1 -1
  11. package/dist/assets/{blob-iewSQmkZ.js → blob-kift6pGB.js} +1 -1
  12. package/dist/assets/{cell-editor-BkHTcrF-.js → cell-editor-ByVa98Tu.js} +1 -1
  13. package/dist/assets/{cell-link-ZLZTXwR8.js → cell-link-CnfnwA6v.js} +1 -1
  14. package/dist/assets/{cells-DyE9dSiM.js → cells-BEcungGa.js} +1 -1
  15. package/dist/assets/{chat-display-B9XOYJaA.js → chat-display-CL_JFB9v.js} +1 -1
  16. package/dist/assets/{chat-panel-Drx8ToF5.js → chat-panel-CSzekzAv.js} +1 -1
  17. package/dist/assets/{chat-ui-CJ1VFz1m.js → chat-ui-C1eAy9FG.js} +1 -1
  18. package/dist/assets/{column-preview-Ls8UnJOt.js → column-preview-BZX77DV6.js} +1 -1
  19. package/dist/assets/{command-palette-DWyHSatV.js → command-palette-56SvxMFF.js} +1 -1
  20. package/dist/assets/{common-03vbDqrN.js → common-fL5LEOMt.js} +1 -1
  21. package/dist/assets/{components-J_vBLfsO.js → components-BtTyGydI.js} +1 -1
  22. package/dist/assets/{datasource-B4VfwXg_.js → datasource-uyI476er.js} +1 -1
  23. package/dist/assets/{dependency-graph-panel-B24NhlCS.js → dependency-graph-panel-DQ6IwmNu.js} +1 -1
  24. package/dist/assets/{documentation-panel-C4y_ufGj.js → documentation-panel-ChxeMQDj.js} +1 -1
  25. package/dist/assets/{download-Kg8_rqQH.js → download-Dv0iO8M_.js} +1 -1
  26. package/dist/assets/{edit-page-DL_yo5rn.js → edit-page-B1Vy-UvZ.js} +4 -4
  27. package/dist/assets/{error-entries-Cy1y8FaI.js → error-entries-B5GaQ2cq.js} +1 -1
  28. package/dist/assets/{error-panel-D_pwhWfh.js → error-panel-D_YO8QtX.js} +1 -1
  29. package/dist/assets/{file-explorer-panel-QoJu0RbE.js → file-explorer-panel-1JRkBA_A.js} +1 -1
  30. package/dist/assets/{file-icons-BN7fZ7-c.js → file-icons-D18ZIT8U.js} +1 -1
  31. package/dist/assets/{file-name-input-qU-dl8Og.js → file-name-input-Dp8aYmEH.js} +1 -1
  32. package/dist/assets/{floating-outline-Coq72JrA.js → floating-outline-B14J6Uv7.js} +1 -1
  33. package/dist/assets/{home-page-C6NwS9L9.js → home-page-CoMZwM0i.js} +1 -1
  34. package/dist/assets/{index-DMvKFHTV.js → index-B6Nvcqin.js} +6 -6
  35. package/dist/assets/layout-FSOVn_sw.js +9 -0
  36. package/dist/assets/{logs-panel-zYelRd3A.js → logs-panel-BwA2j1LD.js} +1 -1
  37. package/dist/assets/{markdown-renderer-BqMslrdb.js → markdown-renderer-IN72oVfj.js} +1 -1
  38. package/dist/assets/{name-cell-input-jrtswt5e.js → name-cell-input-BOFMaTa1.js} +1 -1
  39. package/dist/assets/{outline-panel-B0P8XNnQ.js → outline-panel-xZQU-sfs.js} +1 -1
  40. package/dist/assets/{packages-panel-C08E4Wjm.js → packages-panel-gfl3Dnuj.js} +1 -1
  41. package/dist/assets/{pair-with-agent-modal-BZBengJw.js → pair-with-agent-modal-CNxmIMFM.js} +2 -2
  42. package/dist/assets/{panel-accordion-state-Cyy4afrx.js → panel-accordion-state-BBB6Kqr-.js} +1 -1
  43. package/dist/assets/{panels-DRtPsJ1u.js → panels-mouc5Y1Z.js} +1 -1
  44. package/dist/assets/{process-output-BiA5MKpM.js → process-output-C-rOBNl7.js} +1 -1
  45. package/dist/assets/{readonly-code-display-B45Jy4vH.js → readonly-code-display-fUSnJEhE.js} +1 -1
  46. package/dist/assets/{readonly-python-code-BQ5Ti6Hw.js → readonly-python-code-C2BktOKY.js} +1 -1
  47. package/dist/assets/{reveal-component-Bna3jncc.js → reveal-component-CsovRN4m.js} +1 -1
  48. package/dist/assets/run-page-CRcnkzFj.js +1 -0
  49. package/dist/assets/{scratchpad-panel-m2LRBFI5.js → scratchpad-panel-BkqXEAfy.js} +1 -1
  50. package/dist/assets/{session-panel-BV8Whoy8.js → session-panel-CnIUsX9O.js} +1 -1
  51. package/dist/assets/shell-DLpUCctE.js +1 -0
  52. package/dist/assets/{skeleton-CWFWp9eU.js → skeleton-7uu6KXmn.js} +1 -1
  53. package/dist/assets/{snippets-panel-DBzdOGwQ.js → snippets-panel-BoziU8SV.js} +1 -1
  54. package/dist/assets/{state-rP7TRCla.js → state-DNIOp9vd.js} +1 -1
  55. package/dist/assets/{state-DPS9Q717.js → state-DaMe_1Uy.js} +1 -1
  56. package/dist/assets/{tracing-BP1J14GT.js → tracing-COpxb-Up.js} +1 -1
  57. package/dist/assets/{tracing-panel-CQasWudc.js → tracing-panel-DnNQLsh8.js} +2 -2
  58. package/dist/assets/{tree-actions-CrB9REp3.js → tree-actions-CjTwlxy1.js} +1 -1
  59. package/dist/assets/{useAddCell-DHYPnl7W.js → useAddCell-ZP7MPBcM.js} +1 -1
  60. package/dist/assets/{useCellActionButton-C7bEu9tJ.js → useCellActionButton-va5-Bjgq.js} +1 -1
  61. package/dist/assets/{useDeleteCell-CIzxZKUw.js → useDeleteCell-CuEKdiht.js} +1 -1
  62. package/dist/assets/{useDependencyPanelTab-CLmRGbOD.js → useDependencyPanelTab-DDQx4yD6.js} +1 -1
  63. package/dist/assets/{useNotebookActions-Q97EgZxR.js → useNotebookActions-DEBmnVAR.js} +1 -1
  64. package/dist/assets/{useRunCells-Csh5VYKu.js → useRunCells-DccIcaY0.js} +1 -1
  65. package/dist/assets/{useSplitCell-BfT7UcKM.js → useSplitCell-CoAAhbPs.js} +1 -1
  66. package/dist/index.html +19 -19
  67. package/package.json +1 -1
  68. package/src/components/editor/output/__tests__/ansi-reduce.test.ts +36 -10
  69. package/src/components/editor/output/ansi-reduce.ts +2 -7
  70. package/src/components/editor/renderers/vertical-layout/__tests__/vertical-layout.test.ts +64 -2
  71. package/src/components/editor/renderers/vertical-layout/utils.ts +73 -0
  72. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +19 -49
  73. package/src/components/static-html/__tests__/static-banner.test.tsx +112 -0
  74. package/src/components/static-html/static-banner.tsx +121 -68
  75. package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +35 -2
  76. package/dist/assets/layout-ByAlvlct.js +0 -9
  77. package/dist/assets/run-page-CFC5C_It.js +0 -1
@@ -1,4 +1,4 @@
1
- import{Hn as e,Ja as t,Ka as n,b as r,qa as i,rt as a}from"./cells-DyE9dSiM.js";import{i as o}from"./strings-CpYReX2Q.js";function s(e){if(i(e.mimetype)){if(!Array.isArray(e.data))return null;let t=e.data.filter(e=>!e.type.includes(`ancestor`));return t.length===0?null:{errorData:t}}return t(e.mimetype)?typeof e.data!=`string`||e.data.length===0?null:{errorData:[],tracebackHtml:e.data}:null}function c(e){return e.some(e=>`traceback`in e&&e.traceback)}function l(e){let n=e?.find(e=>t(e.mimetype));if(!(!n||typeof n.data!=`string`||n.data.length===0))return n.data}function u(e,t){if(e.tracebackHtml)return e.tracebackHtml;if(!c(e.errorData))return l(t)}function d(t){let{cellIds:i,cellRuntime:a,cellData:o}=t.get(r),c=[];for(let[t,r]of i.inOrderIds.entries()){let i=a[r],l=i.output;if(!l||!n(l.mimetype))continue;let d=s(l);if(!d)continue;let f=e(o[r].name,t),p=o[r].lastCodeRun??o[r].code;c.push({cellId:r,cellName:f,cellCode:p,errorData:d.errorData,tracebackHtml:u(d,i.consoleOutputs)})}return c}function f(e){return e.type===`setup-refs`?`The setup cell cannot have references`:e.type===`cycle`?`This cell is in a cycle`:e.type===`multiple-defs`?`The variable '${e.name}' was defined by another cell`:e.type===`import-star`||e.type===`ancestor-stopped`||e.type===`ancestor-prevented`||e.type===`exception`||e.type===`strict-exception`?e.msg:e.type===`interruption`?`This cell was interrupted and needs to be re-run`:e.type===`syntax`||e.type===`unknown`||e.type===`sql-error`?e.msg:e.type===`internal`?e.msg||`An internal error occurred`:(o(e),`Unknown error`)}function p(e){let t=f(e);return`traceback`in e&&e.traceback&&(t+=`\n\nTraceback:\n${a(e.traceback)}`),t}function m(e){let t=[e.cellName];return e.tracebackHtml&&t.push(a(e.tracebackHtml)),e.errorData.length>0&&t.push(e.errorData.map(p).join(`
1
+ import{Hn as e,Ja as t,Ka as n,b as r,qa as i,rt as a}from"./cells-BEcungGa.js";import{i as o}from"./strings-CpYReX2Q.js";function s(e){if(i(e.mimetype)){if(!Array.isArray(e.data))return null;let t=e.data.filter(e=>!e.type.includes(`ancestor`));return t.length===0?null:{errorData:t}}return t(e.mimetype)?typeof e.data!=`string`||e.data.length===0?null:{errorData:[],tracebackHtml:e.data}:null}function c(e){return e.some(e=>`traceback`in e&&e.traceback)}function l(e){let n=e?.find(e=>t(e.mimetype));if(!(!n||typeof n.data!=`string`||n.data.length===0))return n.data}function u(e,t){if(e.tracebackHtml)return e.tracebackHtml;if(!c(e.errorData))return l(t)}function d(t){let{cellIds:i,cellRuntime:a,cellData:o}=t.get(r),c=[];for(let[t,r]of i.inOrderIds.entries()){let i=a[r],l=i.output;if(!l||!n(l.mimetype))continue;let d=s(l);if(!d)continue;let f=e(o[r].name,t),p=o[r].lastCodeRun??o[r].code;c.push({cellId:r,cellName:f,cellCode:p,errorData:d.errorData,tracebackHtml:u(d,i.consoleOutputs)})}return c}function f(e){return e.type===`setup-refs`?`The setup cell cannot have references`:e.type===`cycle`?`This cell is in a cycle`:e.type===`multiple-defs`?`The variable '${e.name}' was defined by another cell`:e.type===`import-star`||e.type===`ancestor-stopped`||e.type===`ancestor-prevented`||e.type===`exception`||e.type===`strict-exception`?e.msg:e.type===`interruption`?`This cell was interrupted and needs to be re-run`:e.type===`syntax`||e.type===`unknown`||e.type===`sql-error`?e.msg:e.type===`internal`?e.msg||`An internal error occurred`:(o(e),`Unknown error`)}function p(e){let t=f(e);return`traceback`in e&&e.traceback&&(t+=`\n\nTraceback:\n${a(e.traceback)}`),t}function m(e){let t=[e.cellName];return e.tracebackHtml&&t.push(a(e.tracebackHtml)),e.errorData.length>0&&t.push(e.errorData.map(p).join(`
2
2
 
3
3
  `)),t.join(`
4
4
 
@@ -1 +1 @@
1
- import"./rolldown-runtime-B0Z9INg1.js";import{t as e}from"./react-CBDbhulC.js";import{A as t}from"./cells-DyE9dSiM.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{t as r}from"./jsx-runtime-B74pBk57.js";import{t as i}from"./createLucideIcon-B7HeEoG2.js";import{t as a}from"./MarimoErrorOutput-Dh-877oV.js";import{n as o}from"./cell-link-ZLZTXwR8.js";import{t as s}from"./empty-state-kWyb5dCS.js";var c=i(`party-popper`,[[`path`,{d:`M5.8 11.3 2 22l10.7-3.79`,key:`gwxi1d`}],[`path`,{d:`M4 3h.01`,key:`1vcuye`}],[`path`,{d:`M22 8h.01`,key:`1mrtc2`}],[`path`,{d:`M15 2h.01`,key:`1cjtqr`}],[`path`,{d:`M22 20h.01`,key:`1mrys2`}],[`path`,{d:`m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10`,key:`hbicv8`}],[`path`,{d:`m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17`,key:`1i94pl`}],[`path`,{d:`m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7`,key:`1cofks`}],[`path`,{d:`M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z`,key:`4kbmks`}]]),l=n();e();var u=r(),d=()=>{let e=(0,l.c)(5),n=t();if(n.length===0){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,u.jsx)(s,{title:`No errors!`,icon:(0,u.jsx)(c,{})}),e[0]=t):t=e[0],t}let r;e[1]===n?r=e[2]:(r=n.map(f),e[1]=n,e[2]=r);let i;return e[3]===r?i=e[4]:(i=(0,u.jsx)(`div`,{className:`flex flex-col h-full overflow-auto`,children:r}),e[3]=r,e[4]=i),i};function f(e){return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`text-xs font-mono font-semibold bg-muted border-y px-2 py-1`,children:(0,u.jsx)(o,{cellId:e.cellId})}),(0,u.jsx)(`div`,{className:`px-2`,children:(0,u.jsx)(a,{errors:e.output.data,cellId:e.cellId},e.cellId)},e.cellId)]},e.cellId)}export{d as default};
1
+ import"./rolldown-runtime-B0Z9INg1.js";import{t as e}from"./react-CBDbhulC.js";import{A as t}from"./cells-BEcungGa.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{t as r}from"./jsx-runtime-B74pBk57.js";import{t as i}from"./createLucideIcon-B7HeEoG2.js";import{t as a}from"./MarimoErrorOutput-B6VFcCOD.js";import{n as o}from"./cell-link-CnfnwA6v.js";import{t as s}from"./empty-state-kWyb5dCS.js";var c=i(`party-popper`,[[`path`,{d:`M5.8 11.3 2 22l10.7-3.79`,key:`gwxi1d`}],[`path`,{d:`M4 3h.01`,key:`1vcuye`}],[`path`,{d:`M22 8h.01`,key:`1mrtc2`}],[`path`,{d:`M15 2h.01`,key:`1cjtqr`}],[`path`,{d:`M22 20h.01`,key:`1mrys2`}],[`path`,{d:`m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10`,key:`hbicv8`}],[`path`,{d:`m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17`,key:`1i94pl`}],[`path`,{d:`m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7`,key:`1cofks`}],[`path`,{d:`M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z`,key:`4kbmks`}]]),l=n();e();var u=r(),d=()=>{let e=(0,l.c)(5),n=t();if(n.length===0){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,u.jsx)(s,{title:`No errors!`,icon:(0,u.jsx)(c,{})}),e[0]=t):t=e[0],t}let r;e[1]===n?r=e[2]:(r=n.map(f),e[1]=n,e[2]=r);let i;return e[3]===r?i=e[4]:(i=(0,u.jsx)(`div`,{className:`flex flex-col h-full overflow-auto`,children:r}),e[3]=r,e[4]=i),i};function f(e){return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`div`,{className:`text-xs font-mono font-semibold bg-muted border-y px-2 py-1`,children:(0,u.jsx)(o,{cellId:e.cellId})}),(0,u.jsx)(`div`,{className:`px-2`,children:(0,u.jsx)(a,{errors:e.output.data,cellId:e.cellId},e.cellId)},e.cellId)]},e.cellId)}export{d as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,t as i}from"./useEvent-xfs0Sn4r.js";import{t as a}from"./react-CBDbhulC.js";import{At as o,Cn as s,Co as c,D as l,Dt as u,Et as d,Mt as f,Ot as p,Sn as m,Tt as h,Wt as g,ii as _,jt as v,kn as y,kt as b,oa as x,vn as S,yo as C}from"./cells-DyE9dSiM.js";import{t as w}from"./compiler-runtime-CYIjoINj.js";import{g as T,p as E}from"./utils-CWSZQEjr.js";import{g as D}from"./useEventListener-D27Dii_l.js";import{t as O}from"./invariant-Ci2dTZ72.js";import{N as k,r as A}from"./config-D4frVGQ4.js";import{t as j}from"./cn-ldLVeaqm.js";import{t as M}from"./jsx-runtime-B74pBk57.js";import{r as N}from"./config-ycxJQP2b.js";import{o as P}from"./alert-dialog-BVi_GyOB.js";import{a as F,c as I,p as L,r as R,t as z}from"./dropdown-menu-CqNabM1f.js";import{Pt as B,a as V,h as H,i as U,o as W,s as G}from"./JsonOutput-DeeAtdky.js";import{c as K,n as q,r as ee}from"./download-Kg8_rqQH.js";import{t as J}from"./tooltip-D7dq6bnc.js";import{t as Y}from"./button-Btj6GXNy.js";import{Tt as te}from"./dist-PIe1xcZo.js";import{n as X,r as ne,t as re}from"./requests-C6_IaFh7.js";import{t as Z}from"./createLucideIcon-B7HeEoG2.js";import{t as ie}from"./arrow-left-DrqK6gPp.js";import{n as ae}from"./LazyAnyLanguageCodeMirror-zSwE3dvU.js";import{r as oe}from"./useNumberFormatter-DHJ9s6Vk.js";import{a as se,i as ce,n as le,r as ue,t as de}from"./tree-actions-CrB9REp3.js";import{a as fe}from"./markdown-renderer-BqMslrdb.js";import{u as pe}from"./toDate-hGYJX0Ha.js";import{t as me}from"./copy-BMXKNElG.js";import{t as he}from"./external-link-Bp3BxyRA.js";import{a as ge,i as _e,n as ve,r as ye,t as be}from"./file-icons-BN7fZ7-c.js";import{t as xe}from"./file-DF8n85RA.js";import{n as Se,t as Ce}from"./components-CBlGIIAX.js";import{b as we}from"./write-secret-modal-lNU_7c2x.js";import{n as Te,t as Ee}from"./spinner-Ck-Hgfvj.js";import{a as De,c as Oe,d as ke,f as Ae,i as je,l as Me,n as Ne,r as Pe,t as Fe,u as Ie}from"./file-name-input-qU-dl8Og.js";import{t as Le}from"./refresh-cw-Bf-rx_aV.js";import{t as Re}from"./save-BybsbOKz.js";import{t as ze}from"./triangle-alert-MihykDYG.js";import{n as Be,t as Ve}from"./es-BuMFDpR4.js";import{t as He}from"./use-toast-DpWHUGuF.js";import{n as Ue,t as We}from"./paths-zcL04qUW.js";import{t as Ge}from"./context-Do8M9TDF.js";import{n as Ke}from"./useAsyncData-Buhk-UgR.js";import{n as qe}from"./copy-Cg05mM3C.js";import{t as Je}from"./copy-icon-CRxVZTJ9.js";import{t as Ye}from"./blob-iewSQmkZ.js";import{a as Xe}from"./errors-DzO-nXy-.js";import{n as Ze,t as Qe}from"./alert-dmKwNsrp.js";import{n as $e}from"./error-banner-BYN8YUMe.js";import{a as et}from"./renderShortcut-DK_OucLT.js";import{t as tt}from"./bundle.esm-DzY74mzC.js";import{t as nt}from"./useAddCell-DHYPnl7W.js";import{n as rt}from"./pathUtils-Cryrlpma.js";import{n as it}from"./semaphore-BjoL5P0h.js";import{t as at}from"./empty-state-kWyb5dCS.js";import{t as ot}from"./formatting-BJlT1s_3.js";import{a as st,i as ct,n as lt,o as ut,r as dt,s as ft,t as pt}from"./components-J_vBLfsO.js";import{n as mt,t as ht}from"./marimo-icons-C3KxMV9A.js";import{t as gt}from"./links-DPh7yoP-.js";import{n as _t}from"./panel-accordion-state-Cyy4afrx.js";var vt=Z(`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`}]]),yt=Z(`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`}]]),bt=Z(`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`}]]),xt=Z(`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`}]]),St=Z(`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`}]]),Ct=Z(`folder-root`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}],[`path`,{d:`M12 15v5`,key:`11xva1`}]]),wt=Z(`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`}]]),Tt=Z(`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`}]]),Et=Z(`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`}]]),Q=e(a(),1),Dt=w(),$=M(),Ot=e=>{let t=(0,Dt.c)(17),{filename:n,filenameIcon:r,onBack:i,onRefresh:a,onDownload:o,actions:s}=e,c;t[0]===i?c=t[1]:(c=i&&(0,$.jsx)(J,{content:`Back to file list`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:i,children:(0,$.jsx)(ie,{className:`h-4 w-4`})})}),t[0]=i,t[1]=c);let l;t[2]!==n||t[3]!==r?(l=n?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate`,children:[r,n]}):(0,$.jsx)(`span`,{className:`flex-1`}),t[2]=n,t[3]=r,t[4]=l):l=t[4];let u;t[5]===a?u=t[6]:(u=a&&(0,$.jsx)(J,{content:`Refresh`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:a,children:(0,$.jsx)(Le,{className:`h-3.5 w-3.5`})})}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o&&(0,$.jsx)(J,{content:`Download`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:o,children:(0,$.jsx)(B,{className:`h-3.5 w-3.5`})})}),t[7]=o,t[8]=d);let f;t[9]!==s||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[u,s,d]}),t[9]=s,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==l||t[15]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-center shrink-0 border-b px-1 gap-1`,children:[c,l,f]}),t[13]=c,t[14]=l,t[15]=f,t[16]=p):p=t[16],p},kt=new Set([`http`,`file`,`in-memory`]);function At(e){return JSON.stringify(e).slice(1,-1)}var jt=new Set([`datasets`,`spaces`,`buckets`]);function Mt(e){let t=e.split(`/`).filter(Boolean);return t[0]===`datasets`&&t.length>=4?{repoType:`dataset`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t[0]===`spaces`&&t.length>=4?{repoType:`space`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t.length>=3&&!jt.has(t[0])?{repoType:`model`,repoId:`${t[0]}/${t[1]}`,filename:t.slice(2).join(`/`)}:null}function Nt(e){return`from huggingface_hub import hf_hub_download\n\nlocal_path = hf_hub_download(\n repo_id="${At(e.repoId)}",\n filename="${At(e.filename)}",\n repo_type="${At(e.repoType)}",\n)`}var Pt=[{id:`read-file`,label:`Insert read snippet`,icon:vt,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=At(e.entry.path);if(e.backendType===`huggingface`){let t=Mt(e.entry.path);return t?`${Nt(t)}\n\nwith open(local_path, "rb") as f:\n _data = f.read()\n_data`:null}return e.backendType===`obstore`?`_data = ${e.variableName}.get("${t}").bytes()\n_data`:`_data = ${e.variableName}.cat_file("${t}")\n_data`}},{id:`download-file`,label:`Insert download snippet`,icon:xt,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=At(e.entry.path);if(e.backendType===`huggingface`){let t=Mt(e.entry.path);return t?`${Nt(t)}\nlocal_path`:null}if(e.backendType===`obstore`)return kt.has(e.protocol)?null:`from datetime import timedelta\nfrom obstore import sign\n\nsigned_url = sign(\n ${e.variableName}, "GET", "${t}",\n expires_in=timedelta(hours=1),\n)\nsigned_url`;let n=At(e.entry.path.split(`/`).pop()||`download`);return`${e.variableName}.get("${t}", "${n}")`}}],Ft=104857600;function It(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}var Lt=e=>{let t=(0,Dt.c)(83),{entry:n,namespace:r,protocol:i,backendType:a,onBack:o}=e,{locale:s}=Ge(),c=nt(),l;t[0]===n.path?l=t[1]:(l=It(n.path),t[0]=n.path,t[1]=l);let u=l,d=n.mimeType||`text/plain`,p;t[2]===d?p=t[3]:(p=G(d),t[2]=d,t[3]=p);let m=p,h=m&&n.size>Ft&&n.size>0,g,_;t[4]!==n.path||t[5]!==m||t[6]!==r||t[7]!==h?(g=async()=>{if(h)return null;let e=await f.request({namespace:r,path:n.path,preview:!m});if(e.error)throw Error(e.error);if(!e.url)throw Error(`No URL returned`);if(m)return{type:`media`,url:e.url};let t=await fetch(e.url);if(!t.ok)throw Error(`Failed to fetch preview: ${t.statusText}`);return{type:`text`,content:await t.text()}},_=[r,n.path,m,h],t[4]=n.path,t[5]=m,t[6]=r,t[7]=h,t[8]=g,t[9]=_):(g=t[8],_=t[9]);let{data:v,isPending:y,error:b,refetch:x}=Ke(g,_),S;t[10]!==n.path||t[11]!==u||t[12]!==r?(S=async()=>{try{let e=await f.request({namespace:r,path:n.path});if(e.error){He({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&ee(e.url,e.filename??u)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),He({title:`Download failed`,description:String(t),variant:`danger`})}},t[10]=n.path,t[11]=u,t[12]=r,t[13]=S):S=t[13];let C=S,w;t[14]!==c||t[15]!==a||t[16]!==n||t[17]!==r||t[18]!==i?(w=Pt.map(e=>{let t=e.getCode({variableName:r,protocol:i,entry:n,backendType:a});if(t===null)return null;let o=e.icon;return(0,$.jsx)(J,{content:e.label,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:()=>c(t),"aria-label":e.label,children:(0,$.jsx)(o,{className:`h-3.5 w-3.5`})})},e.id)}),t[14]=c,t[15]=a,t[16]=n,t[17]=r,t[18]=i,t[19]=w):w=t[19];let T=w,E;t[20]===u?E=t[21]:(E=_e(u),t[20]=u,t[21]=E);let O;t[22]!==C||t[23]!==u||t[24]!==o||t[25]!==T||t[26]!==E?(O=(0,$.jsx)(Ot,{filename:u,filenameIcon:E,onBack:o,onDownload:C,actions:T}),t[22]=C,t[23]=u,t[24]=o,t[25]=T,t[26]=E,t[27]=O):O=t[27];let k=O,A;t[28]!==n.lastModified||t[29]!==n.path||t[30]!==n.size||t[31]!==s||t[32]!==d?(A=e=>{let{includeMime:t}=e,r=t!==void 0&&t;return(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),(0,$.jsxs)(`div`,{className:`truncate flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[11px]`,children:n.path}),(0,$.jsx)(Je,{value:n.path,className:`h-3 w-3`})]}),r&&(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),r&&(0,$.jsx)(`span`,{children:d}),n.size>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:ot(n.size,s)})]}),n.lastModified!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Modified`}),(0,$.jsx)(`span`,{children:new Date(n.lastModified*1e3).toLocaleString()})]})]})},t[28]=n.lastModified,t[29]=n.path,t[30]=n.size,t[31]=s,t[32]=d,t[33]=A):A=t[33];let j=A;if(h){let e;t[34]===j?e=t[35]:(e=j({includeMime:!0}),t[34]=j,t[35]=e);let r;t[36]!==n.size||t[37]!==s?(r=ot(n.size,s),t[36]=n.size,t[37]=s,t[38]=r):r=t[38];let i;t[39]===r?i=t[40]:(i=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-muted-foreground italic`,children:[`File is too large to preview (`,r,`).`]}),t[39]=r,t[40]=i);let a;return t[41]!==k||t[42]!==e||t[43]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[41]=k,t[42]=e,t[43]=i,t[44]=a):a=t[44],a}if(y){let e;t[45]===j?e=t[46]:(e=j({}),t[45]=j,t[46]=e);let n;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24`,children:[(0,$.jsx)(Te,{className:`h-4 w-4 animate-spin`}),`Loading preview...`]}),t[47]=n):n=t[47];let r;return t[48]!==k||t[49]!==e?(r=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n]}),t[48]=k,t[49]=e,t[50]=r):r=t[50],r}if(b){let e;t[51]===j?e=t[52]:(e=j({includeMime:!0}),t[51]=j,t[52]=e);let n;t[53]===b.message?n=t[54]:(n=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-destructive`,children:[`Failed to load preview: `,b.message]}),t[53]=b.message,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(Le,{className:`h-3 w-3 mr-1`}),t[55]=r):r=t[55];let i;t[56]===x?i=t[57]:(i=(0,$.jsx)(`div`,{className:`px-4 pb-4`,children:(0,$.jsxs)(Y,{variant:`secondary`,size:`xs`,onClick:x,children:[r,`Retry`]})}),t[56]=x,t[57]=i);let a;return t[58]!==k||t[59]!==e||t[60]!==n||t[61]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n,i]}),t[58]=k,t[59]=e,t[60]=n,t[61]=i,t[62]=a):a=t[62],a}if(v){let e;t[63]===j?e=t[64]:(e=j({}),t[63]=j,t[64]=e);let n=v.type===`text`?v.content:void 0,r;t[65]!==v.type||t[66]!==v.url?(r=v.type===`media`?{url:v.url}:void 0,t[65]=v.type,t[66]=v.url,t[67]=r):r=t[67];let i;t[68]!==d||t[69]!==u||t[70]!==n||t[71]!==r?(i=(0,$.jsx)(U,{mimeType:d,filename:u,contents:n,mediaSource:r}),t[68]=d,t[69]=u,t[70]=n,t[71]=r,t[72]=i):i=t[72];let a;return t[73]!==k||t[74]!==e||t[75]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[73]=k,t[74]=e,t[75]=i,t[76]=a):a=t[76],a}let M;t[77]===j?M=t[78]:(M=j({includeMime:!0}),t[77]=j,t[78]=M);let N;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsxs)(`div`,{className:`p-4 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(xe,{className:`h-4 w-4`}),`Preview not available for this file type.`]}),t[79]=N):N=t[79];let P;return t[80]!==k||t[81]!==M?(P=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,M,N]}),t[80]=k,t[81]=M,t[82]=P):P=t[82],P},Rt=16;function zt(e){return{paddingLeft:e*Rt}}function Bt(e,t){return new Date(e*1e3).toLocaleDateString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Vt(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}function Ht(e){return e.endsWith(`/`)?e:`${e}/`}function Ut(e,t){let n=e.metadata?.id;return typeof n==`string`&&n.length>0?n:`${e.path}::${t}`}function Wt(e,{namespace:t,searchValue:n,entriesByPath:r}){let i=n.trim().toLowerCase(),a=e.path.toLowerCase();if(Vt(e.path).toLowerCase().includes(i)||a.includes(i))return!0;if(e.kind===`directory`){let i=r.get(v(t,Ht(e.path)));if(i)return i.some(e=>Wt(e,{namespace:t,searchValue:n,entriesByPath:r}))}return!1}function Gt(e,t){return t.searchValue.trim()?e.filter(e=>Wt(e,t)):e}var Kt=5;function qt(e){return{query:e,status:`idle`}}function Jt(e){return e.status===`idle`||e.status===`error`||e.status===`capped`}function Yt(e,t,n){return t.get(e)===void 0||n.get(e)?.nextPageToken!=null}function Xt({hasSearch:e,hasLoadedMatches:t,isPending:n,remoteSearch:r,searchKey:i,entriesByPath:a,pageMetadataByPath:o}){return!e||t||n||!Jt(r)?!1:Yt(i,a,o)}function Zt(e){let t=e.trim(),n=t.lastIndexOf(`/`);return n===-1?``:t.slice(0,n+1)}function Qt(e,t){let n=t.trim().toLowerCase();return!n||e.path.toLowerCase().includes(n)||Vt(e.path).toLowerCase().includes(n)}var $t=e=>{let t=(0,Dt.c)(15),{depth:n,isLoading:r,error:i,onLoadMore:a}=e,o;t[0]===n?o=t[1]:(o=zt(n),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=r&&(0,$.jsx)(Te,{className:`h-3 w-3 mr-1 animate-spin`}),t[2]=r,t[3]=s);let c=r?`Loading...`:`Load more`,l;t[4]!==r||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(Y,{variant:`text`,size:`xs`,className:`h-6 px-0 hover:text-blue-600`,disabled:r,onClick:a,children:[s,c]}),t[4]=r,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=i&&(0,$.jsxs)(`span`,{className:`ml-2 text-destructive`,children:[`Failed to load: `,i.message]}),t[9]=i,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,$.jsxs)(`div`,{className:`py-px text-xs`,style:o,children:[l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d},en=e=>{let t=(0,Dt.c)(44),{namespace:n,protocol:r,rootPath:i,backendType:a,prefix:o,depth:s,locale:c,searchValue:l,onOpenFile:d}=e,{entriesByPath:f}=u(),{entries:p,isPending:m,error:h,hasMore:g,loadMore:_,isLoadingMore:v,loadMoreError:y}=b(n,o);if(m){let e;t[0]===s?e=t[1]:(e=zt(s),t[0]=s,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Te,{className:`h-3 w-3 animate-spin`}),t[2]=n):n=t[2];let r;return t[3]===e?r=t[4]:(r=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 py-1 text-xs text-muted-foreground`,style:e,children:[n,`Loading...`]}),t[3]=e,t[4]=r),r}if(h){let e;t[5]===s?e=t[6]:(e=zt(s),t[5]=s,t[6]=e);let n;return t[7]!==h.message||t[8]!==e?(n=(0,$.jsxs)(`div`,{className:`py-1 text-xs text-destructive`,style:e,children:[`Failed to load: `,h.message]}),t[7]=h.message,t[8]=e,t[9]=n):n=t[9],n}if(p.length===0){let e;t[10]===s?e=t[11]:(e=zt(s),t[10]=s,t[11]=e);let n;return t[12]===e?n=t[13]:(n=(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:e,children:`Empty`}),t[12]=e,t[13]=n),n}let x;if(t[14]!==a||t[15]!==p||t[16]!==s||t[17]!==f||t[18]!==c||t[19]!==n||t[20]!==d||t[21]!==r||t[22]!==i||t[23]!==l){let e=Gt(p,{namespace:n,searchValue:l,entriesByPath:f}),o;t[25]!==a||t[26]!==p||t[27]!==s||t[28]!==c||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==i||t[33]!==l?(o=e=>{let t=Ut(e,p.indexOf(e));return(0,$.jsx)(tn,{rowKey:t,entry:e,namespace:n,protocol:r,rootPath:i,backendType:a,depth:s,locale:c,searchValue:l,onOpenFile:d},t)},t[25]=a,t[26]=p,t[27]=s,t[28]=c,t[29]=n,t[30]=d,t[31]=r,t[32]=i,t[33]=l,t[34]=o):o=t[34],x=e.map(o),t[14]=a,t[15]=p,t[16]=s,t[17]=f,t[18]=c,t[19]=n,t[20]=d,t[21]=r,t[22]=i,t[23]=l,t[24]=x}else x=t[24];let S;t[35]!==s||t[36]!==g||t[37]!==v||t[38]!==_||t[39]!==y?(S=g&&(0,$.jsx)($t,{depth:s,isLoading:v,error:y,onLoadMore:_}),t[35]=s,t[36]=g,t[37]=v,t[38]=_,t[39]=y,t[40]=S):S=t[40];let C;return t[41]!==x||t[42]!==S?(C=(0,$.jsxs)($.Fragment,{children:[x,S]}),t[41]=x,t[42]=S,t[43]=C):C=t[43],C},tn=e=>{let t=(0,Dt.c)(115),{entry:n,rowKey:r,namespace:i,protocol:a,rootPath:o,backendType:c,depth:l,locale:d,searchValue:p,onOpenFile:m}=e,[h,g]=(0,Q.useState)(!1),{entriesByPath:_}=u(),y=nt(),b=n.kind===`directory`,x,S,C,w,T,E,O,k,A,M,N;if(t[0]!==c||t[1]!==l||t[2]!==_||t[3]!==n||t[4]!==b||t[5]!==h||t[6]!==i||t[7]!==m||t[8]!==a||t[9]!==r||t[10]!==p){w=Vt(n.path);let e;t[22]===p?e=t[23]:(e=p.trim(),t[22]=p,t[23]=e);let o=!!e;T=b&&o&&w.toLowerCase().includes(p.trim().toLowerCase());let u;t[24]!==_||t[25]!==n.path||t[26]!==o||t[27]!==b||t[28]!==i||t[29]!==p?(u=b&&o&&!!_.get(v(i,Ht(n.path)))?.some(e=>Wt(e,{namespace:i,searchValue:p,entriesByPath:_})),t[24]=_,t[25]=n.path,t[26]=o,t[27]=b,t[28]=i,t[29]=p,t[30]=u):u=t[30],S=h||u;let d;t[31]!==n.path||t[32]!==i?(d=async()=>{try{let e=await f.request({namespace:i,path:n.path});if(e.error){He({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&ee(e.url,e.filename??`download`)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),He({title:`Download failed`,description:String(t),variant:`danger`})}},t[31]=n.path,t[32]=i,t[33]=d):d=t[33],C=d,x=s;let y=b&&`font-medium`;t[34]===y?E=t[35]:(E=j(`text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5`,y),t[34]=y,t[35]=E),t[36]===l?O=t[37]:(O=zt(l),t[36]=l,t[37]=O),k=`${i}:${r}`,t[38]!==c||t[39]!==S||t[40]!==n||t[41]!==b||t[42]!==i||t[43]!==m||t[44]!==a?(A=()=>{b?g(!S):m({entry:n,namespace:i,protocol:a,backendType:c})},t[38]=c,t[39]=S,t[40]=n,t[41]=b,t[42]=i,t[43]=m,t[44]=a,t[45]=A):A=t[45],t[46]!==S||t[47]!==b?(M=b?(0,$.jsx)(ce,{isExpanded:S,className:`h-3 w-3`}):(0,$.jsx)(`span`,{className:`w-3 shrink-0`}),t[46]=S,t[47]=b,t[48]=M):M=t[48],N=b?(0,$.jsx)(ge,{className:j(`h-3.5 w-3.5 shrink-0`,ve.directory)}):_e(w),t[0]=c,t[1]=l,t[2]=_,t[3]=n,t[4]=b,t[5]=h,t[6]=i,t[7]=m,t[8]=a,t[9]=r,t[10]=p,t[11]=x,t[12]=S,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=O,t[18]=k,t[19]=A,t[20]=M,t[21]=N}else x=t[11],S=t[12],C=t[13],w=t[14],T=t[15],E=t[16],O=t[17],k=t[18],A=t[19],M=t[20],N=t[21];let P;t[49]===w?P=t[50]:(P=(0,$.jsx)(`span`,{className:`truncate flex-1 text-left`,children:w}),t[49]=w,t[50]=P);let V;t[51]!==n.size||t[52]!==d?(V=n.size>0&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums`,children:ot(n.size,d)}),t[51]=n.size,t[52]=d,t[53]=V):V=t[53];let H;t[54]!==n.lastModified||t[55]!==d?(H=n.lastModified!=null&&(0,$.jsx)(J,{content:`Last modified: ${new Date(n.lastModified*1e3).toLocaleString()}`,children:(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap`,children:Bt(n.lastModified,d)})}),t[54]=n.lastModified,t[55]=d,t[56]=H):H=t[56];let U;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(le,{iconClassName:`h-3 w-3`,onClick:an})}),t[57]=U):U=t[57];let W;t[58]!==c||t[59]!==n||t[60]!==b||t[61]!==i||t[62]!==m||t[63]!==a?(W=!b&&(0,$.jsxs)(F,{onSelect:()=>m({entry:n,namespace:i,protocol:a,backendType:c}),children:[(0,$.jsx)(Et,{className:`h-3.5 w-3.5 mr-2`}),`View`]}),t[58]=c,t[59]=n,t[60]=b,t[61]=i,t[62]=m,t[63]=a,t[64]=W):W=t[64];let G;t[65]===n.path?G=t[66]:(G=async()=>{await qe(n.path),He({title:`Copied to clipboard`})},t[65]=n.path,t[66]=G);let K;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(me,{className:de}),t[67]=K):K=t[67];let q;t[68]===G?q=t[69]:(q=(0,$.jsxs)(F,{onSelect:G,children:[K,`Copy path`]}),t[68]=G,t[69]=q);let Y;t[70]!==C||t[71]!==b?(Y=!b&&(0,$.jsxs)(F,{onSelect:()=>C(),children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[70]=C,t[71]=b,t[72]=Y):Y=t[72];let te;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(I,{}),t[73]=te):te=t[73];let X;t[74]!==y||t[75]!==c||t[76]!==n||t[77]!==i||t[78]!==a?(X=Pt.map(e=>{let t=e.getCode({variableName:i,protocol:a,entry:n,backendType:c});if(t===null)return null;let r=e.icon;return(0,$.jsxs)(F,{onSelect:()=>y(t),children:[(0,$.jsx)(r,{className:de}),e.label]},e.id)}),t[74]=y,t[75]=c,t[76]=n,t[77]=i,t[78]=a,t[79]=X):X=t[79];let ne;t[80]!==W||t[81]!==q||t[82]!==Y||t[83]!==X?(ne=(0,$.jsxs)(z,{children:[U,(0,$.jsxs)(R,{align:`end`,onClick:on,onCloseAutoFocus:sn,children:[W,q,Y,te,X]})]}),t[80]=W,t[81]=q,t[82]=Y,t[83]=X,t[84]=ne):ne=t[84];let re;t[85]!==ne||t[86]!==V||t[87]!==H?(re=(0,$.jsxs)(`div`,{className:`flex items-center`,children:[V,H,ne]}),t[85]=ne,t[86]=V,t[87]=H,t[88]=re):re=t[88];let Z;t[89]!==x||t[90]!==E||t[91]!==re||t[92]!==O||t[93]!==k||t[94]!==A||t[95]!==M||t[96]!==N||t[97]!==P?(Z=(0,$.jsxs)(x,{className:E,style:O,value:k,onSelect:A,children:[M,N,P,re]}),t[89]=x,t[90]=E,t[91]=re,t[92]=O,t[93]=k,t[94]=A,t[95]=M,t[96]=N,t[97]=P,t[98]=Z):Z=t[98];let ie;t[99]!==c||t[100]!==l||t[101]!==S||t[102]!==n.path||t[103]!==b||t[104]!==d||t[105]!==i||t[106]!==m||t[107]!==a||t[108]!==o||t[109]!==p||t[110]!==T?(ie=b&&S&&(0,$.jsx)(en,{namespace:i,protocol:a,rootPath:o,backendType:c,prefix:Ht(n.path),depth:l+1,locale:d,searchValue:T?``:p,onOpenFile:m}),t[99]=c,t[100]=l,t[101]=S,t[102]=n.path,t[103]=b,t[104]=d,t[105]=i,t[106]=m,t[107]=a,t[108]=o,t[109]=p,t[110]=T,t[111]=ie):ie=t[111];let ae;return t[112]!==Z||t[113]!==ie?(ae=(0,$.jsxs)($.Fragment,{children:[Z,ie]}),t[112]=Z,t[113]=ie,t[114]=ae):ae=t[114],ae},nn=e=>{let t=(0,Dt.c)(66),{namespace:n,locale:r,searchValue:i,remoteSearch:a,onContinueRemoteSearch:o,onOpenFile:c}=e,[l,d]=(0,Q.useState)(!0),{entriesByPath:f,pageMetadataByPath:m}=u(),{clearNamespaceCache:h}=p(),g=n.name??n.displayName,{entries:_,isPending:y,error:x,hasMore:S,loadMore:C,isLoadingMore:w,loadMoreError:T,refetch:E}=b(g),D;t[0]!==h||t[1]!==g||t[2]!==E?(D=e=>{e.stopPropagation(),h(g),E()},t[0]=h,t[1]=g,t[2]=E,t[3]=D):D=t[3];let O=D,k=y?n.storageEntries:_,A;if(t[4]!==k||t[5]!==f||t[6]!==x||t[7]!==O||t[8]!==S||t[9]!==l||t[10]!==w||t[11]!==y||t[12]!==C||t[13]!==T||t[14]!==r||t[15]!==n.backendType||t[16]!==n.displayName||t[17]!==n.name||t[18]!==n.protocol||t[19]!==n.rootPath||t[20]!==g||t[21]!==o||t[22]!==c||t[23]!==m||t[24]!==a||t[25]!==i){let e=Gt(k,{namespace:g,searchValue:i,entriesByPath:f}),u=Zt(i),p=v(g,u),h=u===``?[]:f.get(p)??[],_=Gt(h,{namespace:g,searchValue:i,entriesByPath:f}),b;t[27]===i?b=t[28]:(b=i.trim(),t[27]=i,t[28]=b);let E=!!b,D=e.length>0||_.length>0,j=u!==``&&Xt({hasSearch:E,hasLoadedMatches:D,isPending:y,remoteSearch:a,searchKey:p,entriesByPath:f,pageMetadataByPath:m}),M=E&&e.length===0,N;bb0:{if(y&&k.length===0){let e;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Te,{className:`h-3 w-3 animate-spin`}),`Loading...`]}),t[29]=e):e=t[29],N=e;break bb0}if(a.status===`searching`){let e;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Te,{className:`h-3 w-3 animate-spin`}),`Searching more entries...`]}),t[30]=e):e=t[30],N=e;break bb0}if(a.status===`error`){let e;t[31]===a.error.message?e=t[32]:(e=(0,$.jsxs)(`span`,{className:`text-destructive`,children:[`Search failed: `,a.error.message]}),t[31]=a.error.message,t[32]=e),N=e;break bb0}if(a.status===`capped`){let e;t[33]===o?e=t[34]:(e=(0,$.jsx)(Y,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Continue searching`}),t[33]=o,t[34]=e);let n;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[35]=n):n=t[35];let r;t[36]===e?r=t[37]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Searched more entries.`,e,n]}),t[36]=e,t[37]=r),N=r;break bb0}if(a.status===`exhausted`&&!D){N=`No matches`;break bb0}if(!E&&!y&&k.length===0){N=`No entries`;break bb0}if(j){let e;t[38]===o?e=t[39]:(e=(0,$.jsx)(Y,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Search more entries`}),t[38]=o,t[39]=e);let n;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[40]=n):n=t[40];let r;t[41]===e?r=t[42]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`No loaded matches.`,e,n]}),t[41]=e,t[42]=r),N=r;break bb0}if(E&&!D&&k.length>0){N=`No matches`;break bb0}N=null}let P=N,F;t[43]===l?F=t[44]:(F=()=>d(!l),t[43]=l,t[44]=F);let I;t[45]===l?I=t[46]:(I=(0,$.jsx)(ce,{isExpanded:l,className:`h-3 w-3`}),t[45]=l,t[46]=I);let L;t[47]===n.protocol?L=t[48]:(L=(0,$.jsx)(Ce,{protocol:n.protocol}),t[47]=n.protocol,t[48]=L);let R;t[49]===n.displayName?R=t[50]:(R=(0,$.jsx)(`span`,{children:n.displayName}),t[49]=n.displayName,t[50]=R);let z;t[51]===n.name?z=t[52]:(z=n.name&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground font-normal`,children:[`(`,(0,$.jsx)(ft,{variableName:n.name}),`)`]}),t[51]=n.name,t[52]=z);let B;t[53]===O?B=t[54]:(B=(0,$.jsx)(ue,{onClick:O,tooltip:`Refresh storage connection`,className:`p-0`,iconClassName:`h-3 w-3`}),t[53]=O,t[54]=B);let V=n.rootPath||`(root)`,U;t[55]===V?U=t[56]:(U=(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-normal tabular-nums ml-auto`,children:V}),t[55]=V,t[56]=U);let W;t[57]!==n.name||t[58]!==B||t[59]!==U||t[60]!==F||t[61]!==I||t[62]!==L||t[63]!==R||t[64]!==z?(W=(0,$.jsxs)(s,{value:n.name,onSelect:F,className:`flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none`,children:[I,L,R,z,B,U]}),t[57]=n.name,t[58]=B,t[59]=U,t[60]=F,t[61]=I,t[62]=L,t[63]=R,t[64]=z,t[65]=W):W=t[65],A=(0,$.jsxs)($.Fragment,{children:[W,l&&(0,$.jsxs)($.Fragment,{children:[x&&k.length===0&&(0,$.jsx)(H,{error:x,style:zt(1),className:`py-1 text-xs h-auto overflow-auto max-h-32 items-start`,showIcon:!1}),!x&&P&&(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:zt(1),children:P}),e.map(e=>{let t=Ut(e,k.indexOf(e));return(0,$.jsx)(tn,{rowKey:t,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:c},t)}),M&&_.map(e=>{let t=Ut(e,h.indexOf(e));return(0,$.jsx)(tn,{rowKey:`remote-search:${t}`,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:c},`remote-search:${t}`)}),S&&!j&&(0,$.jsx)($t,{depth:1,isLoading:w,error:T,onLoadMore:C})]})]}),t[4]=k,t[5]=f,t[6]=x,t[7]=O,t[8]=S,t[9]=l,t[10]=w,t[11]=y,t[12]=C,t[13]=T,t[14]=r,t[15]=n.backendType,t[16]=n.displayName,t[17]=n.name,t[18]=n.protocol,t[19]=n.rootPath,t[20]=g,t[21]=o,t[22]=c,t[23]=m,t[24]=a,t[25]=i,t[26]=A}else A=t[26];return A},rn=()=>{let e=(0,Dt.c)(63),{namespaces:t,entriesByPath:n,pageMetadataByPath:r}=u(),{locale:i}=Ge(),[a,s]=(0,Q.useState)(``),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[l,d]=(0,Q.useState)(c),[f,p]=(0,Q.useState)(null),h=o(),g;e[1]===a?g=e[2]:(g=a.trim(),e[1]=a,e[2]=g);let _=!!g,b;e[3]===a?b=e[4]:(b=a.trim(),e[3]=a,e[4]=b);let x=b,C;e[5]!==x||e[6]!==l?(C=e=>{let t=l[e];return t?.query===x?t:qt(x)},e[5]=x,e[6]=l,e[7]=C):C=e[7];let w=C,T;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>{d(n=>({...n,[e]:t}))},e[8]=T):T=e[8];let E=T,D;e[9]!==x||e[10]!==n||e[11]!==r||e[12]!==w?(D=e=>{if(!x)return!1;let t=e.name??e.displayName,i=Zt(x);if(i===``||!Jt(w(t))||Gt(n.get(v(t,``))??e.storageEntries,{namespace:t,searchValue:x,entriesByPath:n}).length>0)return!1;let a=v(t,i);return Gt(n.get(a)??[],{namespace:t,searchValue:x,entriesByPath:n}).length>0?!1:Yt(a,n,r)},e[9]=x,e[10]=n,e[11]=r,e[12]=w,e[13]=D):D=e[13];let O=D,k;e[14]!==O||e[15]!==x||e[16]!==n||e[17]!==h||e[18]!==r?(k=async e=>{if(!O(e))return;let t=x,i=e.name??e.displayName,a=Zt(t),o=v(i,a),s=n.get(o),c=r.get(o)?.nextPageToken??null,l=s!==void 0;E(i,{query:t,status:`searching`});try{for(let e=0;e<Kt;e++){let e=!l||c!==null,n=[];if(e){let e=await h({namespace:i,prefix:a,pageToken:c,append:l});n=e.entries,c=e.next_page_token??null,l=!0}if((e?n:s??[]).some(e=>Qt(e,t))){E(i,{query:t,status:`found`});return}if(c===null){E(i,{query:t,status:`exhausted`});return}}E(i,{query:t,status:`capped`})}catch(e){let n=e;E(i,{query:t,status:`error`,error:n instanceof Error?n:Error(String(n))})}},e[14]=O,e[15]=x,e[16]=n,e[17]=h,e[18]=r,e[19]=k):k=e[19];let A=k,M;e[20]!==O||e[21]!==A||e[22]!==t?(M=()=>{let e=t.filter(O);for(let t of e)A(t)},e[20]=O,e[21]=A,e[22]=t,e[23]=M):M=e[23];let N=M;if(t.length===0){let t;return e[24]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(at,{title:`No storage connected`,description:(0,$.jsxs)(`span`,{children:[`Create an obstore or fsspec connection in your notebook. See the`,` `,(0,$.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,$.jsx)(ut,{group:`storage`,label:`Add remote storage`,variant:`outline`,size:`sm`}),icon:(0,$.jsx)(Se,{className:`h-8 w-8`})}),e[24]=t):t=e[24],t}let P;e[25]===f?P=e[26]:(P=f&&(0,$.jsx)(Lt,{entry:f.entry,namespace:f.namespace,protocol:f.protocol,backendType:f.backendType,onBack:()=>p(null)}),e[25]=f,e[26]=P);let F=f&&`hidden`,I;e[27]===F?I=e[28]:(I=j(`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin`,F),e[27]=F,e[28]=I);let L;e[29]!==O||e[30]!==N||e[31]!==t?(L=e=>{e.key===`Enter`&&t.some(O)&&(e.preventDefault(),N())},e[29]=O,e[30]=N,e[31]=t,e[32]=L):L=e[32];let R;e[33]!==a||e[34]!==L?(R=(0,$.jsx)(m,{placeholder:`Search entries...`,className:`h-6 m-1`,value:a,onValueChange:s,onKeyDown:L,rootClassName:`flex-1 border-b-0`}),e[33]=a,e[34]=L,e[35]=R):R=e[35];let z;e[36]===_?z=e[37]:(z=_&&(0,$.jsx)(Y,{variant:`text`,size:`xs`,className:`float-right border-none px-2 m-0 h-full`,onClick:()=>s(``),children:(0,$.jsx)(oe,{className:`h-4 w-4`})}),e[36]=_,e[37]=z);let B,V;e[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(J,{content:`Search by file name within loaded entries, or by prefix (e.g. 'folder/x') for backend search. Press Enter to fetch more results.`,delayDuration:200,children:(0,$.jsx)(pe,{className:`h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2`})}),V=(0,$.jsx)(ut,{group:`storage`,label:`Add remote storage`,compact:!0,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`}),e[38]=B,e[39]=V):(B=e[38],V=e[39]);let H;e[40]!==R||e[41]!==z?(H=(0,$.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[R,z,B,V]}),e[40]=R,e[41]=z,e[42]=H):H=e[42];let U;if(e[43]!==A||e[44]!==i||e[45]!==t||e[46]!==w||e[47]!==a){let n;e[49]!==A||e[50]!==i||e[51]!==w||e[52]!==a?(n=e=>{let t=e.name??e.displayName;return(0,$.jsx)(nn,{namespace:e,locale:i,searchValue:a,remoteSearch:w(t),onContinueRemoteSearch:()=>void A(e),onOpenFile:p},t)},e[49]=A,e[50]=i,e[51]=w,e[52]=a,e[53]=n):n=e[53],U=t.map(n),e[43]=A,e[44]=i,e[45]=t,e[46]=w,e[47]=a,e[48]=U}else U=e[48];let W;e[54]===U?W=e[55]:(W=(0,$.jsx)(y,{className:`flex flex-col`,children:U}),e[54]=U,e[55]=W);let G;e[56]!==I||e[57]!==H||e[58]!==W?(G=(0,$.jsxs)(S,{className:I,shouldFilter:!1,children:[H,W]}),e[56]=I,e[57]=H,e[58]=W,e[59]=G):G=e[59];let K;return e[60]!==G||e[61]!==P?(K=(0,$.jsxs)(`div`,{className:`h-full flex flex-col`,children:[P,G]}),e[60]=G,e[61]=P,e[62]=K):K=e[62],K};function an(e){return e.stopPropagation()}function on(e){return e.stopPropagation()}function sn(e){return e.preventDefault()}var cn=(0,Q.createContext)(null);function ln(){return(0,Q.useContext)(cn)??void 0}var un=e=>{let t=(0,Dt.c)(3),{children:n}=e,r=ke(),i;return t[0]!==n||t[1]!==r?(i=(0,$.jsx)(cn.Provider,{value:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},dn=e=>{let t=(0,Dt.c)(5),{children:n}=e,[r,i]=(0,Q.useState)(null),a;t[0]!==n||t[1]!==r?(a=r&&(0,$.jsx)(Ae,{backend:Ie,options:{rootElement:r},children:(0,$.jsx)(un,{children:n})}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;return t[3]===a?o=t[4]:(o=(0,$.jsx)(`div`,{ref:i,className:`contents`,children:a}),t[3]=a,t[4]=o),o};async function fn(e,t){if(!k()){let n=A().formatNavigableHttpURL(`api/files/download`,new URLSearchParams({path:e}));ee(n.toString(),t);return}let n=await re().sendFileDetails({path:e});if(n.isBase64&&n.contents){let e=Ye(fe(n.contents,n.mimeType||`application/octet-stream`));q(e,t)}else q(new Blob([n.contents||``],{type:n.mimeType||`application/octet-stream`}),t)}var pn=e=>{let t=(0,Dt.c)(21),{file:n,mimeType:r,message:i,onDownload:a}=e,{locale:o}=Ge(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),t[0]=s):s=t[0];let c;t[1]===n.path?c=t[2]:(c=(0,$.jsx)(`span`,{className:`font-mono text-xs break-all`,children:n.path}),t[1]=n.path,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),t[3]=l):l=t[3];let u;t[4]===r?u=t[5]:(u=(0,$.jsx)(`span`,{children:r}),t[4]=r,t[5]=u);let d;t[6]!==n.size||t[7]!==o?(d=n.size!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:ot(n.size,o)})]}),t[6]=n.size,t[7]=o,t[8]=d):d=t[8];let f;t[9]!==c||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-2`,children:[s,c,l,u,d]}),t[9]=c,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]===i?p=t[14]:(p=(0,$.jsx)(`div`,{className:`mt-4 text-muted-foreground italic`,children:i}),t[13]=i,t[14]=p);let m;t[15]===a?m=t[16]:(m=a&&(0,$.jsxs)(Y,{variant:`outline`,size:`sm`,className:`mt-4`,onClick:a,children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[15]=a,t[16]=m);let h;return t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(`div`,{className:`p-4 text-sm`,children:[f,p,m]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h};function mn(e,t){let n=e||`text/plain`;return G(n)?`media`:t?`unsupported`:n===`text/csv`?`csv`:n.startsWith(`text/`)||n!=="default"&&n in V||e==null?`text`:`unsupported`}var hn=10485760,gn=new Map,_n=({file:e,onOpenNotebook:t})=>{let{sendFileDetails:n,sendUpdateFile:i}=ne(),a=r(T),o=r(E),s=r(C),[c,l]=(0,Q.useState)(``),{data:u,isPending:d,error:f,setData:p,refetch:m}=Ke(async()=>{let t=await n({path:e.path,maxBytes:hn}),r=mn(t.mimeType,t.isBase64);if(!t.isTooLarge&&r===`text`){let n=t.contents||``;l(gn.get(e.path)??n)}return t},[e.path]),h=async()=>{c!==u?.contents&&await i({path:e.path,contents:c}).then(e=>{e.success&&(p(e=>({...e,contents:c})),l(c))})},g=(0,Q.useRef)(c);if(g.current=c,(0,Q.useEffect)(()=>()=>{if(u?.contents==null||u.isTooLarge||mn(u.mimeType,u.isBase64)!==`text`)return;let t=g.current;t===u.contents?gn.delete(e.path):gn.set(e.path,t)},[e.path,u?.contents,u?.isTooLarge,u?.mimeType,u?.isBase64]),f)return(0,$.jsx)($e,{error:f});if(d||!u)return null;let _=u.mimeType||`text/plain`,v=mn(u.mimeType,u.isBase64),y=v===`text`,b=v===`csv`,x=v===`media`,S=s&&u.file.isMarimoFile&&(e.path===s||e.path.endsWith(`/${s}`)),w=async()=>{await fn(e.path,u.file.name)},D=te.of([{key:a.getHotkey(`global.save`).key,stopPropagation:!0,run:()=>c!==u.contents&&(h(),!0)}]),O=(0,$.jsx)(Ot,{filename:u.file.name,onRefresh:m,onDownload:o?void 0:w,actions:(0,$.jsxs)($.Fragment,{children:[e.isMarimoFile&&t&&!k()&&(0,$.jsx)(J,{content:`Open notebook`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:e=>t(e),children:(0,$.jsx)(he,{className:`h-3.5 w-3.5`})})}),y&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{content:`Copy contents to clipboard`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:async()=>{await qe(c)},children:(0,$.jsx)(me,{className:`h-3.5 w-3.5`})})}),(0,$.jsx)(J,{content:et(`global.save`),children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:h,disabled:c===u.contents,children:(0,$.jsx)(Re,{className:`h-3.5 w-3.5`})})})]})]})});if(u.isTooLarge||v===`unsupported`)return(0,$.jsxs)($.Fragment,{children:[O,(0,$.jsx)(pn,{file:u.file,mimeType:_,message:u.isTooLarge?`File is too large to preview.`:`This file type cannot be previewed.`,onDownload:o?void 0:w})]});let A=y&&S&&(0,$.jsxs)(Qe,{variant:`warning`,className:`rounded-none`,children:[(0,$.jsx)(ze,{className:`h-4 w-4`}),(0,$.jsx)(Ze,{children:`Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution.`})]}),j=x&&u.contents?W({contents:u.contents,mimeType:_,isBase64:u.isBase64??!1}):void 0;return(0,$.jsxs)($.Fragment,{children:[O,A,(0,$.jsx)(U,{mimeType:_,filename:u.file.name,contents:y?c:b?u.contents??void 0:void 0,mediaSource:j,readOnly:!y,onChange:y?l:void 0,extensions:y?[D]:[]})]})},vn=n(e=>{let t=e(X);return O(t,`no requestClientAtom set`),new Oe({getRoots:t.getFileRoots,listFiles:t.sendListFiles,createFileOrFolder:t.sendCreateFileOrFolder,deleteFileOrFolder:t.sendDeleteFileOrFolder,copyFileOrFolder:t.sendCopyFileOrFolder,renameFileOrFolder:t.sendRenameFileOrFolder})}),yn=n({}),bn=` `,xn={directory:e=>`os.listdir("${e}")`,python:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,json:e=>`with open("${e}", "r") as _f:\n${bn}_data = json.load(_f)\n`,code:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,text:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,image:e=>`mo.image("${e}")`,audio:e=>`mo.audio("${e}")`,video:e=>`mo.video("${e}")`,pdf:e=>`with open("${e}", "rb") as _f:\n${bn}...\n`,zip:e=>`with open("${e}", "rb") as _f:\n${bn}...\n`,data:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,unknown:e=>`with open("${e}", "r") as _f:\n${bn}...\n`},Sn=104857600,Cn=5,wn=`data-file-explorer-directory-path`;function Tn(e){let{destinationPath:t,getDestinationLabel:n=e=>e,onUploadStart:r,refreshDestination:i,...a}=e,{sendCreateFileOrFolder:o}=ne();return Ve({multiple:!0,maxSize:Sn,...a,onError:e=>{D.error(e),He({title:`File upload failed`,description:e.message,variant:`danger`})},onDropRejected:e=>{He({title:`File upload failed`,description:(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,$.jsxs)(`div`,{children:[e.file.name,` (`,e.errors.map(e=>e.message).join(`, `),`)`]},e.file.name))}),variant:`danger`})},onDrop:async(e,a,s)=>{if(e.length===0)return;let c=typeof t==`function`?t(s):t,l=n(c),u=e.length===1?`Uploading file to ${l}...`:`Uploading files to ${l}...`;r?.(c,e);let d;try{d=await K(u,async t=>(t.addTotal(e.length),En({files:e,destinationPath:c,createFile:o,onFileProcessed:()=>t.increment(1)})))}catch{await i(c);return}await i(c),kn(d,l)}})}async function En({files:e,destinationPath:t,createFile:n,onFileProcessed:r}){let i=await it(e,Cn,async e=>{try{return{file:e,response:await n({path:Dn({destinationPath:t,filePath:jn(An(e))}),type:`file`,name:e.name,file:e})}}catch(t){return{file:e,response:{success:!1,message:Xe(t)}}}finally{r?.()}});return{successful:i.filter(({response:e})=>e.success),failed:i.filter(({response:e})=>!e.success)}}function Dn({destinationPath:e,filePath:t}){if(!t)return e;if(Ue.isAbsolute(t))throw Error(`Upload path must be relative: ${t}`);let n=t.split(/[\\/]+/).slice(0,-1).filter(Boolean);if(n.includes(`..`))throw Error(`Upload path cannot contain parent traversal: ${t}`);let r=n.filter(e=>e!==`.`);if(r.length===0)return e;let i=We.guessDeliminator(e),a=r.join(i.deliminator);return i.join(e,a)}function On(e,t){return e instanceof Element&&e.closest(`[${wn}]`)?.getAttribute(wn)||t}function kn(e,t){let n=e.successful.length+e.failed.length;if(e.failed.length>0){let r;r=e.successful.length===0?n===1?`File upload failed`:`Files failed to upload`:`${e.successful.length} of ${n} files uploaded`,He({title:r,description:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Destination: `,t,`.`]}),e.failed.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,`:`,` `,t.message||`The server rejected the upload.`]},`${e.name}-${n}`))]}),variant:`danger`});return}let r=e.successful.filter(({file:e,response:t})=>t.info?.name&&t.info.name!==e.name);He({title:n===1?`File uploaded`:`${n} files uploaded`,description:r.length===0?`Uploaded to ${t}.`:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Uploaded to `,t,`.`]}),r.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,` was saved as `,t.info?.name,`.`]},`${e.name}-${n}`))]})})}function An(e){if(e.webkitRelativePath)return e.webkitRelativePath;if(`path`in e&&typeof e.path==`string`)return e.path;if(`relativePath`in e&&typeof e.relativePath==`string`)return e.relativePath}function jn(e){if(e)return e.replace(/^\/+/,``)}var Mn=c(`marimo:showHiddenFiles`,!0,_,{getOnInit:!0}),Nn=Q.createContext(null),Pn=e=>{let n=(0,Dt.c)(110),{height:r,externalDropDestinationPath:a}=e,o=a===void 0?null:a,s=(0,Q.useRef)(null),c=ln(),[l]=t(vn),u;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[0]=u):u=n[0];let[d,f]=(0,Q.useState)(u),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=t(Mn),[y,b]=t(yn),x;n[1]===l?x=n[2]:(x=e=>l.refreshPath(e),n[1]=l,n[2]=x);let S=i(x),C=(0,Q.useRef)(``),w;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>C.current,n[3]=w):w=n[3];let T;n[4]===l?T=n[5]:(T=e=>Vn(l,e),n[4]=l,n[5]=T);let E;n[6]!==S||n[7]!==T?(E={noClick:!0,noDrag:!0,noKeyboard:!0,destinationPath:w,getDestinationLabel:T,refreshDestination:S},n[6]=S,n[7]=T,n[8]=E):E=n[8];let{getInputProps:D,open:O}=Tn(E),k;n[9]===O?k=n[10]:(k=e=>{C.current=e,O()},n[9]=O,n[10]=k);let A=i(k),{openPrompt:j}=we(),M;n[11]===l?M=n[12]:(M=()=>l.initialize(f),n[11]=l,n[12]=M);let N;n[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],n[13]=N):N=n[13];let{isPending:P,error:F}=Ke(M,N),I;n[14]!==y||n[15]!==l?(I=()=>l.refreshAll(Object.keys(y).filter(e=>y[e])),n[14]=y,n[15]=l,n[16]=I):I=n[16];let L=i(I),R;n[17]!==v||n[18]!==_?(R=()=>{v(!_)},n[17]=v,n[18]=_,n[19]=R):R=n[19];let z=i(R),B;n[20]!==j||n[21]!==h?.id||n[22]!==l?(B=async()=>{j({title:`Folder name`,onConfirm:async e=>{l.createFolder(e,h?.id??null)}})},n[20]=j,n[21]=h?.id,n[22]=l,n[23]=B):B=n[23];let V=i(B),H;n[24]!==j||n[25]!==h?.id||n[26]!==l?(H=async()=>{j({title:`File name`,onConfirm:async e=>{l.createFile({name:e,parentId:h?.id??null})}})},n[24]=j,n[25]=h?.id,n[26]=l,n[27]=H):H=n[27];let U=i(H),W;n[28]!==j||n[29]!==h?.id||n[30]!==l?(W=async()=>{j({title:`Notebook name`,onConfirm:async e=>{l.createFile({name:e,parentId:h?.id??null,type:`notebook`})}})},n[28]=j,n[29]=h?.id,n[30]=l,n[31]=W):W=n[31];let G=i(W),K;n[32]===b?K=n[33]:(K=()=>{s.current?.closeAll(),b({})},n[32]=b,n[33]=K);let q=i(K),ee;n[34]!==d||n[35]!==_?(ee=Hn(d,_),n[34]=d,n[35]=_,n[36]=ee):ee=n[36];let J=ee,te,X;n[37]!==h||n[38]!==J?(te=()=>{h&&!Wn(J,h.id)&&g(null)},X=[h,J],n[37]=h,n[38]=J,n[39]=te,n[40]=X):(te=n[39],X=n[40]),Q.useEffect(te,X);let ne;n[41]!==o||n[42]!==A||n[43]!==l?(ne={tree:l,uploadFiles:A,externalDropDestinationPath:o},n[41]=o,n[42]=A,n[43]=l,n[44]=ne):ne=n[44];let re=ne;if(P){let e;return n[45]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ee,{size:`medium`,centered:!0}),n[45]=e):e=n[45],e}if(F){let e;return n[46]===F?e=n[47]:(e=(0,$.jsx)($e,{error:F}),n[46]=F,n[47]=e),e}if(p){let e;n[48]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>m(null),n[48]=e):e=n[48];let t;n[49]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Y,{onClick:e,"data-testid":`file-explorer-back-button`,variant:`text`,size:`xs`,className:`mb-0`,children:(0,$.jsx)(ie,{size:16})}),n[49]=t):t=n[49];let r;n[50]===p.name?r=n[51]:(r=(0,$.jsxs)(`div`,{className:`flex items-center pl-1 pr-3 shrink-0 border-b justify-between`,children:[t,(0,$.jsx)(`span`,{className:`font-bold`,children:p.name})]}),n[50]=p.name,n[51]=r);let i;n[52]!==p||n[53]!==l?(i=l.isPrimaryNode(p)?e=>{let t=l.getPrimaryRelativePath(p.path);t!==null&&Bn(e,t)}:void 0,n[52]=p,n[53]=l,n[54]=i):i=n[54];let a;n[55]!==p||n[56]!==i?(a=(0,$.jsx)(Q.Suspense,{children:(0,$.jsx)(_n,{onOpenNotebook:i,file:p})}),n[55]=p,n[56]=i,n[57]=a):a=n[57];let o;return n[58]!==r||n[59]!==a?(o=(0,$.jsxs)($.Fragment,{children:[r,a]}),n[58]=r,n[59]=a,n[60]=o):o=n[60],o}let Z;n[61]===D?Z=n[62]:(Z=D(),n[61]=D,n[62]=Z);let ae;n[63]===Z?ae=n[64]:(ae=(0,$.jsx)(`input`,{"data-testid":`file-explorer-upload-input`,...Z}),n[63]=Z,n[64]=ae);let oe;n[65]!==h?.path||n[66]!==l?(oe=h?.path??l.getPrimaryRootPath(),n[65]=h?.path,n[66]=l,n[67]=oe):oe=n[67];let se;n[68]!==h?.path||n[69]!==l?(se=h?.path??l.getPrimaryRootPath(),n[68]=h?.path,n[69]=l,n[70]=se):se=n[70];let ce;n[71]!==se||n[72]!==l?(ce=Vn(l,se),n[71]=se,n[72]=l,n[73]=ce):ce=n[73];let le;n[74]!==q||n[75]!==U||n[76]!==V||n[77]!==G||n[78]!==z||n[79]!==L||n[80]!==A||n[81]!==_||n[82]!==oe||n[83]!==ce?(le=(0,$.jsx)(In,{onRefresh:L,onHidden:z,showHiddenFiles:_,onCreateFile:U,onCreateNotebook:G,onCreateFolder:V,onCollapseAll:q,uploadDestinationPath:oe,uploadDestinationLabel:ce,onUpload:A}),n[74]=q,n[75]=U,n[76]=V,n[77]=G,n[78]=z,n[79]=L,n[80]=A,n[81]=_,n[82]=oe,n[83]=ce,n[84]=le):le=n[84];let ue=r-33,de,fe,pe;n[85]===l?(de=n[86],fe=n[87],pe=n[88]):(de=async e=>{let{ids:t}=e;for(let e of t)await l.delete(e)},fe=async e=>{let{id:t,name:n}=e;await l.rename(t,n)},pe=async e=>{let{dragIds:t,parentId:n}=e;await l.move(t,n)},n[85]=l,n[86]=de,n[87]=fe,n[88]=pe);let me;n[89]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>{let t=e[0];if(!t){g(null);return}if(t.data.isDirectory){g({id:t.id,path:t.data.path});return}g(null),m(t.data)},n[89]=me):me=n[89];let he;n[90]!==y||n[91]!==b||n[92]!==l?(he=async e=>{if(await l.expand(e)){let t=y[e]??!1;b({...y,[e]:!t})}},n[90]=y,n[91]=b,n[92]=l,n[93]=he):he=n[93];let ge;n[94]!==c||n[95]!==y||n[96]!==ue||n[97]!==de||n[98]!==fe||n[99]!==pe||n[100]!==he||n[101]!==J?(ge=(0,$.jsx)(Me,{width:`100%`,ref:s,height:ue,className:`h-full`,data:J,initialOpenState:y,openByDefault:!1,dndManager:c,renderCursor:Gn,disableDrag:Kn,disableDrop:Jn,onDelete:de,onRename:fe,onMove:pe,onSelect:me,onToggle:he,padding:15,rowHeight:30,indent:Fn,overscanCount:1e3,disableMultiSelection:!0,children:Rn}),n[94]=c,n[95]=y,n[96]=ue,n[97]=de,n[98]=fe,n[99]=pe,n[100]=he,n[101]=J,n[102]=ge):ge=n[102];let _e;n[103]!==re||n[104]!==ge?(_e=(0,$.jsx)(Nn,{value:re,children:ge}),n[103]=re,n[104]=ge,n[105]=_e):_e=n[105];let ve;return n[106]!==ae||n[107]!==le||n[108]!==_e?(ve=(0,$.jsxs)($.Fragment,{children:[ae,le,_e]}),n[106]=ae,n[107]=le,n[108]=_e,n[109]=ve):ve=n[109],ve},Fn=15,In=e=>{let t=(0,Dt.c)(35),{onRefresh:n,onHidden:r,showHiddenFiles:i,onCreateFile:a,onCreateNotebook:o,onCreateFolder:s,onCollapseAll:c,uploadDestinationPath:l,uploadDestinationLabel:u,onUpload:d}=e,f=`Upload files to ${u}`,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(mt,{size:16}),t[0]=p):p=t[0];let m;t[1]===o?m=t[2]:(m=(0,$.jsx)(J,{content:`Add notebook`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-notebook-button`,onClick:o,variant:`text`,size:`xs`,children:p})}),t[1]=o,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(bt,{size:16}),t[3]=h):h=t[3];let g;t[4]===a?g=t[5]:(g=(0,$.jsx)(J,{content:`Add file`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-file-button`,onClick:a,variant:`text`,size:`xs`,children:h})}),t[4]=a,t[5]=g);let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(St,{size:16}),t[6]=_):_=t[6];let v;t[7]===s?v=t[8]:(v=(0,$.jsx)(J,{content:`Add folder`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-folder-button`,onClick:s,variant:`text`,size:`xs`,children:_})}),t[7]=s,t[8]=v);let y;t[9]!==d||t[10]!==l?(y=()=>d(l),t[9]=d,t[10]=l,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Be,{size:16}),t[12]=b):b=t[12];let x;t[13]!==y||t[14]!==f?(x=(0,$.jsx)(Y,{"data-testid":`file-explorer-upload-button`,"aria-label":f,onClick:y,variant:`text`,size:`xs`,children:b}),t[13]=y,t[14]=f,t[15]=x):x=t[15];let S;t[16]!==x||t[17]!==f?(S=(0,$.jsx)(J,{content:f,children:x}),t[16]=x,t[17]=f,t[18]=S):S=t[18];let C;t[19]===n?C=t[20]:(C=(0,$.jsx)(ue,{"data-testid":`file-explorer-refresh-button`,onClick:n}),t[19]=n,t[20]=C);let w;t[21]!==r||t[22]!==i?(w=(0,$.jsx)(se,{"data-testid":`file-explorer-hidden-files-button`,isVisible:i,onToggle:r,showTooltip:`Show hidden files`,hideTooltip:`Hide hidden files`}),t[21]=r,t[22]=i,t[23]=w):w=t[23];let T;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(yt,{size:16}),t[24]=T):T=t[24];let E;t[25]===c?E=t[26]:(E=(0,$.jsx)(J,{content:`Collapse all folders`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-collapse-button`,onClick:c,variant:`text`,size:`xs`,children:T})}),t[25]=c,t[26]=E);let D;return t[27]!==S||t[28]!==C||t[29]!==w||t[30]!==E||t[31]!==m||t[32]!==g||t[33]!==v?(D=(0,$.jsxs)(`div`,{className:`flex items-center justify-end px-2 shrink-0 border-b`,children:[m,g,v,S,C,w,E]}),t[27]=S,t[28]=C,t[29]=w,t[30]=E,t[31]=m,t[32]=g,t[33]=v,t[34]=D):D=t[34],D},Ln=e=>{let t=(0,Dt.c)(14),{node:n,onOpenMarimoFile:r}=e,i;t[0]===n?i=t[1]:(i=e=>{n.data.isDirectory||(e.stopPropagation(),n.select())},t[0]=n,t[1]=i);let a;t[2]!==n.data.isMarimoFile||t[3]!==n.data.isPrimaryRoot||t[4]!==r?(a=n.data.isMarimoFile&&n.data.isPrimaryRoot&&!k()&&(0,$.jsxs)(`span`,{"data-testid":`file-explorer-open-marimo-button`,className:`shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline`,onClick:r,children:[`open `,(0,$.jsx)(he,{className:`inline ml-1`,size:12})]}),t[2]=n.data.isMarimoFile,t[3]=n.data.isPrimaryRoot,t[4]=r,t[5]=a):a=t[5];let o;t[6]!==n.data.name||t[7]!==i||t[8]!==a?(o=(0,$.jsxs)(`span`,{className:`flex-1 overflow-hidden text-ellipsis`,onClick:i,children:[n.data.name,a]}),t[6]=n.data.name,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s=o,c;return t[10]!==s||t[11]!==n.data.isRoot||t[12]!==n.data.path?(c=n.data.isRoot?(0,$.jsx)(J,{content:n.data.path,children:s}):s,t[10]=s,t[11]=n.data.isRoot,t[12]=n.data.path,t[13]=c):c=t[13],c},Rn=e=>{let t=(0,Dt.c)(115),{node:n,style:a,dragHandle:o}=e,{openFile:s}=ne(),c=r(E),u;t[0]!==n.data.isDirectory||t[1]!==n.data.name?(u=n.data.isDirectory?`directory`:ye(n.data.name),t[0]=n.data.isDirectory,t[1]=n.data.name,t[2]=u):u=t[2];let d=u,f=be[d],{openConfirm:p,openPrompt:m}=we(),{createNewCell:h}=l(),_=g(),v;t[3]!==h||t[4]!==_?(v=e=>{h({code:e,before:!1,cellId:_??`__end__`})},t[3]=h,t[4]=_,t[5]=v):v=t[5];let y=v,b=(0,Q.use)(Nn),S=b?.tree,C=n.data.isDirectory&&b?.externalDropDestinationPath===n.data.path,w;t[6]!==n.data.path||t[7]!==S?(w=async e=>{let t=S?.getPrimaryRelativePath(n.data.path);t!=null&&Bn(e,t)},t[6]=n.data.path,t[7]=S,t[8]=w):w=t[8];let T=w,D;t[9]!==n.data.name||t[10]!==n.id||t[11]!==n.tree||t[12]!==p?(D=async e=>{e.stopPropagation(),e.preventDefault(),p({title:`Delete file`,description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,$.jsx)(P,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":`Confirm`,children:`Delete`})})},t[9]=n.data.name,t[10]=n.id,t[11]=n.tree,t[12]=p,t[13]=D):D=t[13];let O=D,A;t[14]!==n||t[15]!==m||t[16]!==S?(A=async()=>{n.open(),m({title:`Folder name`,onConfirm:async e=>{S?.createFolder(e,n.id)}})},t[14]=n,t[15]=m,t[16]=S,t[17]=A):A=t[17];let M=i(A),N;t[18]!==n||t[19]!==m||t[20]!==S?(N=async()=>{n.open(),m({title:`File name`,onConfirm:async e=>{S?.createFile({name:e,parentId:n.id})}})},t[18]=n,t[19]=m,t[20]=S,t[21]=N):N=t[21];let L=i(N),R;t[22]!==n||t[23]!==m||t[24]!==S?(R=async()=>{n.open(),m({title:`Notebook name`,onConfirm:async e=>{S?.createFile({name:e,parentId:n.id,type:`notebook`})}})},t[22]=n,t[23]=m,t[24]=S,t[25]=R):R=t[25];let z=i(R),V;t[26]!==n.data.name||t[27]!==n.id||t[28]!==S?(V=async()=>{S&&await S.copy(n.id,rt(n.data.name))},t[26]=n.data.name,t[27]=n.id,t[28]=S,t[29]=V):V=t[29];let H=i(V),U;t[30]!==n.data.isDirectory||t[31]!==n.data.path?(U=n.data.isDirectory?{[wn]:n.data.path}:{},t[30]=n.data.isDirectory,t[31]=n.data.path,t[32]=U):U=t[32];let W;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(W=j(`flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group`),t[33]=W):W=t[33];let G=!n.data.isRoot,K,q;t[34]===n?(K=t[35],q=t[36]):(K=e=>{e.stopPropagation(),n.data.isDirectory&&(n.select(),n.toggle())},q=(0,$.jsx)(zn,{node:n}),t[34]=n,t[35]=K,t[36]=q);let ee=n.willReceiveDrop&&n.data.isDirectory&&`bg-accent/80 hover:bg-accent/80 text-accent-foreground`,J=n.isSelected&&`bg-accent/60 hover:bg-accent/60 text-accent-foreground`,Y=C&&`bg-primary/15 hover:bg-primary/15 text-accent-foreground ring-1 ring-inset ring-primary`,te;t[37]!==ee||t[38]!==J||t[39]!==Y?(te=j(`flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group`,ee,J,Y),t[37]=ee,t[38]=J,t[39]=Y,t[40]=te):te=t[40];let X;t[41]!==f||t[42]!==d||t[43]!==n.data.isMarimoFile||t[44]!==n.data.isRoot?(X=n.data.isRoot?(0,$.jsx)(Ct,{className:`w-5 h-5 shrink-0 mr-2 text-primary`,strokeWidth:1.5}):n.data.isMarimoFile?(0,$.jsx)(ht,{className:`w-5 h-5 shrink-0 mr-2`,strokeWidth:1.5}):(0,$.jsx)(f,{className:j(`w-5 h-5 shrink-0 mr-2`,ve[d]),strokeWidth:1.5}),t[41]=f,t[42]=d,t[43]=n.data.isMarimoFile,t[44]=n.data.isRoot,t[45]=X):X=t[45];let re;t[46]!==T||t[47]!==n?(re=n.isEditing?(0,$.jsx)(Fe,{node:n}):(0,$.jsx)(Ln,{node:n,onOpenMarimoFile:T}),t[46]=T,t[47]=n,t[48]=re):re=t[48];let Z;t[49]===n?Z=t[50]:(Z=!n.data.isDirectory&&(0,$.jsxs)(F,{onSelect:()=>n.select(),"data-testid":`file-explorer-open-file-menu-item`,children:[(0,$.jsx)(Et,{className:`h-3.5 w-3.5 mr-2`}),`Open file`]}),t[49]=n,t[50]=Z);let ie;t[51]!==n.data.isDirectory||t[52]!==n.data.path||t[53]!==s?(ie=!n.data.isDirectory&&!k()&&(0,$.jsxs)(F,{onSelect:()=>{s({path:n.data.path})},"data-testid":`file-explorer-open-external-menu-item`,children:[(0,$.jsx)(he,{className:`h-3.5 w-3.5 mr-2`}),`Open file in external editor`]}),t[51]=n.data.isDirectory,t[52]=n.data.path,t[53]=s,t[54]=ie):ie=t[54];let oe;t[55]!==b||t[56]!==L||t[57]!==M||t[58]!==z||t[59]!==n.data.isDirectory||t[60]!==n.data.path?(oe=n.data.isDirectory&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(F,{onSelect:()=>z(),"data-testid":`file-explorer-create-notebook-menu-item`,children:[(0,$.jsx)(mt,{className:`h-3.5 w-3.5 mr-2`}),`Create notebook`]}),(0,$.jsxs)(F,{onSelect:()=>L(),"data-testid":`file-explorer-create-file-menu-item`,children:[(0,$.jsx)(bt,{className:`h-3.5 w-3.5 mr-2`}),`Create file`]}),(0,$.jsxs)(F,{onSelect:()=>M(),"data-testid":`file-explorer-create-folder-menu-item`,children:[(0,$.jsx)(St,{className:`h-3.5 w-3.5 mr-2`}),`Create folder`]}),(0,$.jsxs)(F,{onSelect:()=>b?.uploadFiles(n.data.path),"data-testid":`file-explorer-upload-files-menu-item`,children:[(0,$.jsx)(Be,{className:`h-3.5 w-3.5 mr-2`}),`Upload files here`]}),(0,$.jsx)(I,{})]}),t[55]=b,t[56]=L,t[57]=M,t[58]=z,t[59]=n.data.isDirectory,t[60]=n.data.path,t[61]=oe):oe=t[61];let se;t[62]!==H||t[63]!==n?(se=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(De,{onSelect:()=>n.edit(),testId:`file-explorer-rename-menu-item`}),(0,$.jsx)(Pe,{onSelect:H,testId:`file-explorer-duplicate-menu-item`})]}),t[62]=H,t[63]=n,t[64]=se):se=t[64];let ce;t[65]===n.data.path?ce=t[66]:(ce=async()=>{await qe(n.data.path),He({title:`Copied to clipboard`})},t[65]=n.data.path,t[66]=ce);let le;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(wt,{className:de}),t[67]=le):le=t[67];let ue;t[68]===ce?ue=t[69]:(ue=(0,$.jsxs)(F,{onSelect:ce,"data-testid":`file-explorer-copy-path-menu-item`,children:[le,`Copy path`]}),t[68]=ce,t[69]=ue);let fe;t[70]!==n.data.isPrimaryRoot||t[71]!==n.data.isRoot||t[72]!==n.data.path||t[73]!==S?(fe=S&&n.data.isPrimaryRoot&&!n.data.isRoot&&(0,$.jsxs)(F,{onSelect:async()=>{let e=S.getPrimaryRelativePath(n.data.path);e!==null&&(await qe(e),He({title:`Copied to clipboard`}))},"data-testid":`file-explorer-copy-relative-path-menu-item`,children:[(0,$.jsx)(wt,{className:`h-3.5 w-3.5 mr-2`}),`Copy relative path`]}),t[70]=n.data.isPrimaryRoot,t[71]=n.data.isRoot,t[72]=n.data.path,t[73]=S,t[74]=fe):fe=t[74];let pe;t[75]!==d||t[76]!==y||t[77]!==n.data?(pe=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsxs)(F,{onSelect:()=>{let{path:e}=n.data,t=xn[d](e);y(t)},"data-testid":`file-explorer-insert-snippet-menu-item`,children:[(0,$.jsx)(ae,{className:`h-3.5 w-3.5 mr-2`}),`Insert snippet for reading file`]}),(0,$.jsxs)(F,{onSelect:async()=>{He({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:e}=n.data,t=xn[d](e);await qe(t)},"data-testid":`file-explorer-copy-snippet-menu-item`,children:[(0,$.jsx)(x,{className:`h-3.5 w-3.5 mr-2`}),`Copy snippet for reading file`]})]}),t[75]=d,t[76]=y,t[77]=n.data,t[78]=pe):pe=t[78];let me;t[79]!==T||t[80]!==n.data.isMarimoFile||t[81]!==n.data.isPrimaryRoot?(me=n.data.isMarimoFile&&n.data.isPrimaryRoot&&!k()&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsxs)(F,{onSelect:T,"data-testid":`file-explorer-open-notebook-menu-item`,children:[(0,$.jsx)(Tt,{className:`h-3.5 w-3.5 mr-2`}),`Open notebook`]})]}),t[79]=T,t[80]=n.data.isMarimoFile,t[81]=n.data.isPrimaryRoot,t[82]=me):me=t[82];let ge;t[83]!==c||t[84]!==n.data.isDirectory||t[85]!==n.data.name||t[86]!==n.data.path?(ge=!n.data.isDirectory&&!c&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsxs)(F,{onSelect:async()=>{await fn(n.data.path,n.data.name)},"data-testid":`file-explorer-download-menu-item`,children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]})]}),t[83]=c,t[84]=n.data.isDirectory,t[85]=n.data.name,t[86]=n.data.path,t[87]=ge):ge=t[87];let _e;t[88]!==O||t[89]!==n.data.isRoot?(_e=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsx)(Ne,{onSelect:O,testId:`file-explorer-delete-menu-item`})]}),t[88]=O,t[89]=n.data.isRoot,t[90]=_e):_e=t[90];let xe;t[91]!==Z||t[92]!==ie||t[93]!==oe||t[94]!==se||t[95]!==ue||t[96]!==fe||t[97]!==pe||t[98]!==me||t[99]!==ge||t[100]!==_e?(xe=(0,$.jsxs)(je,{testId:`file-explorer-more-button`,iconClassName:`w-5 h-5`,children:[Z,ie,oe,se,ue,fe,pe,me,ge,_e]}),t[91]=Z,t[92]=ie,t[93]=oe,t[94]=se,t[95]=ue,t[96]=fe,t[97]=pe,t[98]=me,t[99]=ge,t[100]=_e,t[101]=xe):xe=t[101];let Se;t[102]!==te||t[103]!==X||t[104]!==re||t[105]!==xe?(Se=(0,$.jsxs)(`span`,{className:te,children:[X,re,xe]}),t[102]=te,t[103]=X,t[104]=re,t[105]=xe,t[106]=Se):Se=t[106];let Ce;return t[107]!==o||t[108]!==a||t[109]!==G||t[110]!==K||t[111]!==q||t[112]!==Se||t[113]!==U?(Ce=(0,$.jsxs)(`div`,{style:a,ref:o,...U,className:W,draggable:G,onClick:K,children:[q,Se]}),t[107]=o,t[108]=a,t[109]=G,t[110]=K,t[111]=q,t[112]=Se,t[113]=U,t[114]=Ce):Ce=t[114],Ce},zn=e=>{let t=(0,Dt.c)(3),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`w-4 h-4 shrink-0`}),t[0]=e):e=t[0],e}let r;return t[1]===n.isOpen?r=t[2]:(r=(0,$.jsx)(ce,{isExpanded:n.isOpen,className:`w-4 h-4`}),t[1]=n.isOpen,t[2]=r),r};function Bn(e,t){e.stopPropagation(),e.preventDefault(),gt(t)}function Vn(e,t){return e.getDisplayPath(t)}function Hn(e,t){if(t)return e;let n=[];for(let r of e){if(!r.isRoot&&Un(r.name))continue;let e=r;if(r.children){let n=Hn(r.children,t);n!==r.children&&(e={...r,children:n})}n.push(e)}return n}function Un(e){return!!e.startsWith(`.`)}function Wn(e,t){return e.some(e=>e.id===t||(e.children?Wn(e.children,t):!1))}function Gn(){return null}function Kn(e){return e.isRoot}function qn(e){return e.data.isRoot}function Jn(e){let{parentNode:t,dragNodes:n}=e;return n.some(qn)||(t?!t.data.isDirectory:!1)}var Yn=e=>{let t=(0,Dt.c)(44),{height:n}=e,i=r(vn),[a,o]=(0,Q.useState)(null),s;t[0]===i?s=t[1]:(s=e=>Xn(e,i.getPrimaryRootPath()),t[0]=i,t[1]=s);let c=s,l;t[2]===i?l=t[3]:(l=e=>i.refreshPath(e),t[2]=i,t[3]=l);let u=l,d;t[4]===i?d=t[5]:(d=e=>Vn(i,e),t[4]=i,t[5]=d);let f,p;t[6]===c?(f=t[7],p=t[8]):(f=e=>o(c(e)),p=e=>o(c(e)),t[6]=c,t[7]=f,t[8]=p);let m,h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>o(null),h=()=>o(null),t[9]=m,t[10]=h):(m=t[9],h=t[10]);let g;t[11]!==c||t[12]!==u||t[13]!==d||t[14]!==f||t[15]!==p?(g={noClick:!0,noKeyboard:!0,destinationPath:c,getDestinationLabel:d,refreshDestination:u,onDragEnter:f,onDragOver:p,onDragLeave:m,onUploadStart:h},t[11]=c,t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=g):g=t[16];let{getRootProps:_,getInputProps:v,isDragActive:y}=Tn(g),b;t[17]!==a||t[18]!==i?(b=a??i.getPrimaryRootPath(),t[17]=a,t[18]=i,t[19]=b):b=t[19];let x=b,S;t[20]!==x||t[21]!==i?(S=Vn(i,x),t[20]=x,t[21]=i,t[22]=S):S=t[22];let C=S,w;t[23]===_?w=t[24]:(w=_(),t[23]=_,t[24]=w);let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=j(`flex flex-col overflow-hidden relative`),t[25]=T):T=t[25];let E;t[26]===n?E=t[27]:(E={height:n},t[26]=n,t[27]=E);let D;t[28]===v?D=t[29]:(D=v(),t[28]=v,t[29]=D);let O;t[30]===D?O=t[31]:(O=(0,$.jsx)(`input`,{...D}),t[30]=D,t[31]=O);let k;t[32]!==C||t[33]!==y?(k=y&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-start justify-center pt-3 bg-accent/20 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none`,children:(0,$.jsxs)(`span`,{className:`px-3 py-1.5 rounded-md bg-background/95 border shadow-sm text-sm font-semibold text-primary`,children:[`Drop files into `,C]})}),t[32]=C,t[33]=y,t[34]=k):k=t[34];let A=y?x:null,M;t[35]!==n||t[36]!==A?(M=(0,$.jsx)(Pn,{height:n,externalDropDestinationPath:A}),t[35]=n,t[36]=A,t[37]=M):M=t[37];let N;return t[38]!==w||t[39]!==E||t[40]!==O||t[41]!==k||t[42]!==M?(N=(0,$.jsx)(dn,{children:(0,$.jsxs)(`div`,{...w,className:T,style:E,children:[O,k,M]})}),t[38]=w,t[39]=E,t[40]=O,t[41]=k,t[42]=M,t[43]=N):N=t[43],N};function Xn(e,t){return Array.isArray(e)?t:On(e.target,t)}var Zn=()=>{let e=(0,Dt.c)(40),{ref:n,height:i}=tt(),a=i===void 0?500:i,[o,s]=t(_t),c=r(d).length,l=h(`storage`),u;bb0:{if(!o.hasUserInteracted&&c>0){if(o.openSections.includes(`remote-storage`)){u=o.openSections;break bb0}let t;e[0]===o.openSections?t=e[1]:(t=[...o.openSections,`remote-storage`],e[0]=o.openSections,e[1]=t),u=t;break bb0}u=o.openSections}let f=u,p;e[2]===s?p=e[3]:(p=e=>{s({openSections:e,hasUserInteracted:!0})},e[2]=s,e[3]=p);let m=p,g=a-66,_;e[4]===f?_=e[5]:(_=f.includes(`remote-storage`),e[4]=f,e[5]=_);let v=_,y=l.length>0,b;e[6]!==f||e[7]!==v?(b=v&&f.includes(`files`),e[6]=f,e[7]=v,e[8]=b):b=e[8];let x=b,S;e[9]!==g||e[10]!==x?(S=x?Math.round(g*.4):g,e[9]=g,e[10]=x,e[11]=S):S=e[11];let C=S,w=Math.max(200,x?g-C:g),T;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Se,{className:`w-4 h-4`}),e[12]=T):T=e[12];let E;e[13]===c?E=e[14]:(E=c>0&&(0,$.jsx)(st,{children:c}),e[13]=c,e[14]=E);let D;e[15]!==l.length||e[16]!==y?(D=y&&(0,$.jsx)(pt,{count:l.length,type:`storage`}),e[15]=l.length,e[16]=y,e[17]=D):D=e[17];let O;e[18]!==E||e[19]!==D?(O=(0,$.jsxs)(ct,{children:[T,` Remote storage`,E,D]}),e[18]=E,e[19]=D,e[20]=O):O=e[20];let k;e[21]===C?k=e[22]:(k={maxHeight:C},e[21]=C,e[22]=k);let A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(rn,{}),e[23]=A):A=e[23];let j;e[24]===k?j=e[25]:(j=(0,$.jsx)(lt,{className:`overflow-auto`,style:k,children:A}),e[24]=k,e[25]=j);let M;e[26]!==j||e[27]!==O?(M=(0,$.jsxs)(dt,{value:`remote-storage`,children:[O,j]}),e[26]=j,e[27]=O,e[28]=M):M=e[28];let P;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsxs)(ct,{children:[(0,$.jsx)(xe,{className:`w-4 h-4`}),`Files`]}),e[29]=P):P=e[29];let F;e[30]===w?F=e[31]:(F=(0,$.jsxs)(dt,{value:`files`,children:[P,(0,$.jsx)(lt,{children:(0,$.jsx)(Yn,{height:w})})]}),e[30]=w,e[31]=F);let I;e[32]!==m||e[33]!==f||e[34]!==M||e[35]!==F?(I=(0,$.jsxs)(N,{type:`multiple`,value:f,onValueChange:m,children:[M,F]}),e[32]=m,e[33]=f,e[34]=M,e[35]=F,e[36]=I):I=e[36];let L;return e[37]!==n||e[38]!==I?(L=(0,$.jsx)(`div`,{ref:n,className:`h-full overflow-auto`,children:I}),e[37]=n,e[38]=I,e[39]=L):L=e[39],L};export{Zn as default,Xn as getUploadDestinationForEvent};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,f as n,l as r,t as i}from"./useEvent-xfs0Sn4r.js";import{t as a}from"./react-CBDbhulC.js";import{At as o,Cn as s,Co as c,D as l,Dt as u,Et as d,Mt as f,Ot as p,Sn as m,Tt as h,Wt as g,ii as _,jt as v,kn as y,kt as b,oa as x,vn as S,yo as C}from"./cells-BEcungGa.js";import{t as w}from"./compiler-runtime-CYIjoINj.js";import{g as T,p as E}from"./utils-CWSZQEjr.js";import{g as D}from"./useEventListener-D27Dii_l.js";import{t as O}from"./invariant-Ci2dTZ72.js";import{N as k,r as A}from"./config-D4frVGQ4.js";import{t as j}from"./cn-ldLVeaqm.js";import{t as M}from"./jsx-runtime-B74pBk57.js";import{r as N}from"./config-ycxJQP2b.js";import{o as P}from"./alert-dialog-BVi_GyOB.js";import{a as F,c as I,p as L,r as R,t as z}from"./dropdown-menu-CqNabM1f.js";import{Pt as B,a as V,h as H,i as U,o as W,s as G}from"./JsonOutput-Bu92ihyf.js";import{c as K,n as q,r as ee}from"./download-Dv0iO8M_.js";import{t as J}from"./tooltip-D7dq6bnc.js";import{t as Y}from"./button-Btj6GXNy.js";import{Tt as te}from"./dist-PIe1xcZo.js";import{n as X,r as ne,t as re}from"./requests-C6_IaFh7.js";import{t as Z}from"./createLucideIcon-B7HeEoG2.js";import{t as ie}from"./arrow-left-DrqK6gPp.js";import{n as ae}from"./LazyAnyLanguageCodeMirror-zSwE3dvU.js";import{r as oe}from"./useNumberFormatter-DHJ9s6Vk.js";import{a as se,i as ce,n as le,r as ue,t as de}from"./tree-actions-CjTwlxy1.js";import{a as fe}from"./markdown-renderer-IN72oVfj.js";import{u as pe}from"./toDate-hGYJX0Ha.js";import{t as me}from"./copy-BMXKNElG.js";import{t as he}from"./external-link-Bp3BxyRA.js";import{a as ge,i as _e,n as ve,r as ye,t as be}from"./file-icons-D18ZIT8U.js";import{t as xe}from"./file-DF8n85RA.js";import{n as Se,t as Ce}from"./components-CBlGIIAX.js";import{b as we}from"./write-secret-modal-lNU_7c2x.js";import{n as Te,t as Ee}from"./spinner-Ck-Hgfvj.js";import{a as De,c as Oe,d as ke,f as Ae,i as je,l as Me,n as Ne,r as Pe,t as Fe,u as Ie}from"./file-name-input-Dp8aYmEH.js";import{t as Le}from"./refresh-cw-Bf-rx_aV.js";import{t as Re}from"./save-BybsbOKz.js";import{t as ze}from"./triangle-alert-MihykDYG.js";import{n as Be,t as Ve}from"./es-BuMFDpR4.js";import{t as He}from"./use-toast-DpWHUGuF.js";import{n as Ue,t as We}from"./paths-zcL04qUW.js";import{t as Ge}from"./context-Do8M9TDF.js";import{n as Ke}from"./useAsyncData-Buhk-UgR.js";import{n as qe}from"./copy-Cg05mM3C.js";import{t as Je}from"./copy-icon-CRxVZTJ9.js";import{t as Ye}from"./blob-kift6pGB.js";import{a as Xe}from"./errors-DzO-nXy-.js";import{n as Ze,t as Qe}from"./alert-dmKwNsrp.js";import{n as $e}from"./error-banner-BYN8YUMe.js";import{a as et}from"./renderShortcut-DK_OucLT.js";import{t as tt}from"./bundle.esm-DzY74mzC.js";import{t as nt}from"./useAddCell-ZP7MPBcM.js";import{n as rt}from"./pathUtils-Cryrlpma.js";import{n as it}from"./semaphore-BjoL5P0h.js";import{t as at}from"./empty-state-kWyb5dCS.js";import{t as ot}from"./formatting-BJlT1s_3.js";import{a as st,i as ct,n as lt,o as ut,r as dt,s as ft,t as pt}from"./components-BtTyGydI.js";import{n as mt,t as ht}from"./marimo-icons-C3KxMV9A.js";import{t as gt}from"./links-DPh7yoP-.js";import{n as _t}from"./panel-accordion-state-BBB6Kqr-.js";var vt=Z(`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`}]]),yt=Z(`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`}]]),bt=Z(`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`}]]),xt=Z(`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`}]]),St=Z(`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`}]]),Ct=Z(`folder-root`,[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`circle`,{cx:`12`,cy:`13`,r:`2`,key:`1c1ljs`}],[`path`,{d:`M12 15v5`,key:`11xva1`}]]),wt=Z(`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`}]]),Tt=Z(`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`}]]),Et=Z(`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`}]]),Q=e(a(),1),Dt=w(),$=M(),Ot=e=>{let t=(0,Dt.c)(17),{filename:n,filenameIcon:r,onBack:i,onRefresh:a,onDownload:o,actions:s}=e,c;t[0]===i?c=t[1]:(c=i&&(0,$.jsx)(J,{content:`Back to file list`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:i,children:(0,$.jsx)(ie,{className:`h-4 w-4`})})}),t[0]=i,t[1]=c);let l;t[2]!==n||t[3]!==r?(l=n?(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate`,children:[r,n]}):(0,$.jsx)(`span`,{className:`flex-1`}),t[2]=n,t[3]=r,t[4]=l):l=t[4];let u;t[5]===a?u=t[6]:(u=a&&(0,$.jsx)(J,{content:`Refresh`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:a,children:(0,$.jsx)(Le,{className:`h-3.5 w-3.5`})})}),t[5]=a,t[6]=u);let d;t[7]===o?d=t[8]:(d=o&&(0,$.jsx)(J,{content:`Download`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:o,children:(0,$.jsx)(B,{className:`h-3.5 w-3.5`})})}),t[7]=o,t[8]=d);let f;t[9]!==s||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center gap-0.5 shrink-0`,children:[u,s,d]}),t[9]=s,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==c||t[14]!==l||t[15]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-center shrink-0 border-b px-1 gap-1`,children:[c,l,f]}),t[13]=c,t[14]=l,t[15]=f,t[16]=p):p=t[16],p},kt=new Set([`http`,`file`,`in-memory`]);function At(e){return JSON.stringify(e).slice(1,-1)}var jt=new Set([`datasets`,`spaces`,`buckets`]);function Mt(e){let t=e.split(`/`).filter(Boolean);return t[0]===`datasets`&&t.length>=4?{repoType:`dataset`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t[0]===`spaces`&&t.length>=4?{repoType:`space`,repoId:`${t[1]}/${t[2]}`,filename:t.slice(3).join(`/`)}:t.length>=3&&!jt.has(t[0])?{repoType:`model`,repoId:`${t[0]}/${t[1]}`,filename:t.slice(2).join(`/`)}:null}function Nt(e){return`from huggingface_hub import hf_hub_download\n\nlocal_path = hf_hub_download(\n repo_id="${At(e.repoId)}",\n filename="${At(e.filename)}",\n repo_type="${At(e.repoType)}",\n)`}var Pt=[{id:`read-file`,label:`Insert read snippet`,icon:vt,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=At(e.entry.path);if(e.backendType===`huggingface`){let t=Mt(e.entry.path);return t?`${Nt(t)}\n\nwith open(local_path, "rb") as f:\n _data = f.read()\n_data`:null}return e.backendType===`obstore`?`_data = ${e.variableName}.get("${t}").bytes()\n_data`:`_data = ${e.variableName}.cat_file("${t}")\n_data`}},{id:`download-file`,label:`Insert download snippet`,icon:xt,getCode:e=>{if(e.entry.kind===`directory`)return null;let t=At(e.entry.path);if(e.backendType===`huggingface`){let t=Mt(e.entry.path);return t?`${Nt(t)}\nlocal_path`:null}if(e.backendType===`obstore`)return kt.has(e.protocol)?null:`from datetime import timedelta\nfrom obstore import sign\n\nsigned_url = sign(\n ${e.variableName}, "GET", "${t}",\n expires_in=timedelta(hours=1),\n)\nsigned_url`;let n=At(e.entry.path.split(`/`).pop()||`download`);return`${e.variableName}.get("${t}", "${n}")`}}],Ft=104857600;function It(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}var Lt=e=>{let t=(0,Dt.c)(83),{entry:n,namespace:r,protocol:i,backendType:a,onBack:o}=e,{locale:s}=Ge(),c=nt(),l;t[0]===n.path?l=t[1]:(l=It(n.path),t[0]=n.path,t[1]=l);let u=l,d=n.mimeType||`text/plain`,p;t[2]===d?p=t[3]:(p=G(d),t[2]=d,t[3]=p);let m=p,h=m&&n.size>Ft&&n.size>0,g,_;t[4]!==n.path||t[5]!==m||t[6]!==r||t[7]!==h?(g=async()=>{if(h)return null;let e=await f.request({namespace:r,path:n.path,preview:!m});if(e.error)throw Error(e.error);if(!e.url)throw Error(`No URL returned`);if(m)return{type:`media`,url:e.url};let t=await fetch(e.url);if(!t.ok)throw Error(`Failed to fetch preview: ${t.statusText}`);return{type:`text`,content:await t.text()}},_=[r,n.path,m,h],t[4]=n.path,t[5]=m,t[6]=r,t[7]=h,t[8]=g,t[9]=_):(g=t[8],_=t[9]);let{data:v,isPending:y,error:b,refetch:x}=Ke(g,_),S;t[10]!==n.path||t[11]!==u||t[12]!==r?(S=async()=>{try{let e=await f.request({namespace:r,path:n.path});if(e.error){He({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&ee(e.url,e.filename??u)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),He({title:`Download failed`,description:String(t),variant:`danger`})}},t[10]=n.path,t[11]=u,t[12]=r,t[13]=S):S=t[13];let C=S,w;t[14]!==c||t[15]!==a||t[16]!==n||t[17]!==r||t[18]!==i?(w=Pt.map(e=>{let t=e.getCode({variableName:r,protocol:i,entry:n,backendType:a});if(t===null)return null;let o=e.icon;return(0,$.jsx)(J,{content:e.label,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:()=>c(t),"aria-label":e.label,children:(0,$.jsx)(o,{className:`h-3.5 w-3.5`})})},e.id)}),t[14]=c,t[15]=a,t[16]=n,t[17]=r,t[18]=i,t[19]=w):w=t[19];let T=w,E;t[20]===u?E=t[21]:(E=_e(u),t[20]=u,t[21]=E);let O;t[22]!==C||t[23]!==u||t[24]!==o||t[25]!==T||t[26]!==E?(O=(0,$.jsx)(Ot,{filename:u,filenameIcon:E,onBack:o,onDownload:C,actions:T}),t[22]=C,t[23]=u,t[24]=o,t[25]=T,t[26]=E,t[27]=O):O=t[27];let k=O,A;t[28]!==n.lastModified||t[29]!==n.path||t[30]!==n.size||t[31]!==s||t[32]!==d?(A=e=>{let{includeMime:t}=e,r=t!==void 0&&t;return(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),(0,$.jsxs)(`div`,{className:`truncate flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`font-mono text-[11px]`,children:n.path}),(0,$.jsx)(Je,{value:n.path,className:`h-3 w-3`})]}),r&&(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),r&&(0,$.jsx)(`span`,{children:d}),n.size>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:ot(n.size,s)})]}),n.lastModified!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Modified`}),(0,$.jsx)(`span`,{children:new Date(n.lastModified*1e3).toLocaleString()})]})]})},t[28]=n.lastModified,t[29]=n.path,t[30]=n.size,t[31]=s,t[32]=d,t[33]=A):A=t[33];let j=A;if(h){let e;t[34]===j?e=t[35]:(e=j({includeMime:!0}),t[34]=j,t[35]=e);let r;t[36]!==n.size||t[37]!==s?(r=ot(n.size,s),t[36]=n.size,t[37]=s,t[38]=r):r=t[38];let i;t[39]===r?i=t[40]:(i=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-muted-foreground italic`,children:[`File is too large to preview (`,r,`).`]}),t[39]=r,t[40]=i);let a;return t[41]!==k||t[42]!==e||t[43]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[41]=k,t[42]=e,t[43]=i,t[44]=a):a=t[44],a}if(y){let e;t[45]===j?e=t[46]:(e=j({}),t[45]=j,t[46]=e);let n;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24`,children:[(0,$.jsx)(Te,{className:`h-4 w-4 animate-spin`}),`Loading preview...`]}),t[47]=n):n=t[47];let r;return t[48]!==k||t[49]!==e?(r=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n]}),t[48]=k,t[49]=e,t[50]=r):r=t[50],r}if(b){let e;t[51]===j?e=t[52]:(e=j({includeMime:!0}),t[51]=j,t[52]=e);let n;t[53]===b.message?n=t[54]:(n=(0,$.jsxs)(`div`,{className:`px-4 pb-4 text-xs text-destructive`,children:[`Failed to load preview: `,b.message]}),t[53]=b.message,t[54]=n);let r;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(Le,{className:`h-3 w-3 mr-1`}),t[55]=r):r=t[55];let i;t[56]===x?i=t[57]:(i=(0,$.jsx)(`div`,{className:`px-4 pb-4`,children:(0,$.jsxs)(Y,{variant:`secondary`,size:`xs`,onClick:x,children:[r,`Retry`]})}),t[56]=x,t[57]=i);let a;return t[58]!==k||t[59]!==e||t[60]!==n||t[61]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,n,i]}),t[58]=k,t[59]=e,t[60]=n,t[61]=i,t[62]=a):a=t[62],a}if(v){let e;t[63]===j?e=t[64]:(e=j({}),t[63]=j,t[64]=e);let n=v.type===`text`?v.content:void 0,r;t[65]!==v.type||t[66]!==v.url?(r=v.type===`media`?{url:v.url}:void 0,t[65]=v.type,t[66]=v.url,t[67]=r):r=t[67];let i;t[68]!==d||t[69]!==u||t[70]!==n||t[71]!==r?(i=(0,$.jsx)(U,{mimeType:d,filename:u,contents:n,mediaSource:r}),t[68]=d,t[69]=u,t[70]=n,t[71]=r,t[72]=i):i=t[72];let a;return t[73]!==k||t[74]!==e||t[75]!==i?(a=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,e,i]}),t[73]=k,t[74]=e,t[75]=i,t[76]=a):a=t[76],a}let M;t[77]===j?M=t[78]:(M=j({includeMime:!0}),t[77]=j,t[78]=M);let N;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsxs)(`div`,{className:`p-4 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(xe,{className:`h-4 w-4`}),`Preview not available for this file type.`]}),t[79]=N):N=t[79];let P;return t[80]!==k||t[81]!==M?(P=(0,$.jsxs)(`div`,{className:`flex flex-col h-full`,children:[k,M,N]}),t[80]=k,t[81]=M,t[82]=P):P=t[82],P},Rt=16;function zt(e){return{paddingLeft:e*Rt}}function Bt(e,t){return new Date(e*1e3).toLocaleDateString(t,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})}function Vt(e){let t=e.endsWith(`/`)?e.slice(0,-1):e,n=t.split(`/`);return n[n.length-1]||t}function Ht(e){return e.endsWith(`/`)?e:`${e}/`}function Ut(e,t){let n=e.metadata?.id;return typeof n==`string`&&n.length>0?n:`${e.path}::${t}`}function Wt(e,{namespace:t,searchValue:n,entriesByPath:r}){let i=n.trim().toLowerCase(),a=e.path.toLowerCase();if(Vt(e.path).toLowerCase().includes(i)||a.includes(i))return!0;if(e.kind===`directory`){let i=r.get(v(t,Ht(e.path)));if(i)return i.some(e=>Wt(e,{namespace:t,searchValue:n,entriesByPath:r}))}return!1}function Gt(e,t){return t.searchValue.trim()?e.filter(e=>Wt(e,t)):e}var Kt=5;function qt(e){return{query:e,status:`idle`}}function Jt(e){return e.status===`idle`||e.status===`error`||e.status===`capped`}function Yt(e,t,n){return t.get(e)===void 0||n.get(e)?.nextPageToken!=null}function Xt({hasSearch:e,hasLoadedMatches:t,isPending:n,remoteSearch:r,searchKey:i,entriesByPath:a,pageMetadataByPath:o}){return!e||t||n||!Jt(r)?!1:Yt(i,a,o)}function Zt(e){let t=e.trim(),n=t.lastIndexOf(`/`);return n===-1?``:t.slice(0,n+1)}function Qt(e,t){let n=t.trim().toLowerCase();return!n||e.path.toLowerCase().includes(n)||Vt(e.path).toLowerCase().includes(n)}var $t=e=>{let t=(0,Dt.c)(15),{depth:n,isLoading:r,error:i,onLoadMore:a}=e,o;t[0]===n?o=t[1]:(o=zt(n),t[0]=n,t[1]=o);let s;t[2]===r?s=t[3]:(s=r&&(0,$.jsx)(Te,{className:`h-3 w-3 mr-1 animate-spin`}),t[2]=r,t[3]=s);let c=r?`Loading...`:`Load more`,l;t[4]!==r||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(Y,{variant:`text`,size:`xs`,className:`h-6 px-0 hover:text-blue-600`,disabled:r,onClick:a,children:[s,c]}),t[4]=r,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===i?u=t[10]:(u=i&&(0,$.jsxs)(`span`,{className:`ml-2 text-destructive`,children:[`Failed to load: `,i.message]}),t[9]=i,t[10]=u);let d;return t[11]!==o||t[12]!==l||t[13]!==u?(d=(0,$.jsxs)(`div`,{className:`py-px text-xs`,style:o,children:[l,u]}),t[11]=o,t[12]=l,t[13]=u,t[14]=d):d=t[14],d},en=e=>{let t=(0,Dt.c)(44),{namespace:n,protocol:r,rootPath:i,backendType:a,prefix:o,depth:s,locale:c,searchValue:l,onOpenFile:d}=e,{entriesByPath:f}=u(),{entries:p,isPending:m,error:h,hasMore:g,loadMore:_,isLoadingMore:v,loadMoreError:y}=b(n,o);if(m){let e;t[0]===s?e=t[1]:(e=zt(s),t[0]=s,t[1]=e);let n;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Te,{className:`h-3 w-3 animate-spin`}),t[2]=n):n=t[2];let r;return t[3]===e?r=t[4]:(r=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 py-1 text-xs text-muted-foreground`,style:e,children:[n,`Loading...`]}),t[3]=e,t[4]=r),r}if(h){let e;t[5]===s?e=t[6]:(e=zt(s),t[5]=s,t[6]=e);let n;return t[7]!==h.message||t[8]!==e?(n=(0,$.jsxs)(`div`,{className:`py-1 text-xs text-destructive`,style:e,children:[`Failed to load: `,h.message]}),t[7]=h.message,t[8]=e,t[9]=n):n=t[9],n}if(p.length===0){let e;t[10]===s?e=t[11]:(e=zt(s),t[10]=s,t[11]=e);let n;return t[12]===e?n=t[13]:(n=(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:e,children:`Empty`}),t[12]=e,t[13]=n),n}let x;if(t[14]!==a||t[15]!==p||t[16]!==s||t[17]!==f||t[18]!==c||t[19]!==n||t[20]!==d||t[21]!==r||t[22]!==i||t[23]!==l){let e=Gt(p,{namespace:n,searchValue:l,entriesByPath:f}),o;t[25]!==a||t[26]!==p||t[27]!==s||t[28]!==c||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==i||t[33]!==l?(o=e=>{let t=Ut(e,p.indexOf(e));return(0,$.jsx)(tn,{rowKey:t,entry:e,namespace:n,protocol:r,rootPath:i,backendType:a,depth:s,locale:c,searchValue:l,onOpenFile:d},t)},t[25]=a,t[26]=p,t[27]=s,t[28]=c,t[29]=n,t[30]=d,t[31]=r,t[32]=i,t[33]=l,t[34]=o):o=t[34],x=e.map(o),t[14]=a,t[15]=p,t[16]=s,t[17]=f,t[18]=c,t[19]=n,t[20]=d,t[21]=r,t[22]=i,t[23]=l,t[24]=x}else x=t[24];let S;t[35]!==s||t[36]!==g||t[37]!==v||t[38]!==_||t[39]!==y?(S=g&&(0,$.jsx)($t,{depth:s,isLoading:v,error:y,onLoadMore:_}),t[35]=s,t[36]=g,t[37]=v,t[38]=_,t[39]=y,t[40]=S):S=t[40];let C;return t[41]!==x||t[42]!==S?(C=(0,$.jsxs)($.Fragment,{children:[x,S]}),t[41]=x,t[42]=S,t[43]=C):C=t[43],C},tn=e=>{let t=(0,Dt.c)(115),{entry:n,rowKey:r,namespace:i,protocol:a,rootPath:o,backendType:c,depth:l,locale:d,searchValue:p,onOpenFile:m}=e,[h,g]=(0,Q.useState)(!1),{entriesByPath:_}=u(),y=nt(),b=n.kind===`directory`,x,S,C,w,T,E,O,k,A,M,N;if(t[0]!==c||t[1]!==l||t[2]!==_||t[3]!==n||t[4]!==b||t[5]!==h||t[6]!==i||t[7]!==m||t[8]!==a||t[9]!==r||t[10]!==p){w=Vt(n.path);let e;t[22]===p?e=t[23]:(e=p.trim(),t[22]=p,t[23]=e);let o=!!e;T=b&&o&&w.toLowerCase().includes(p.trim().toLowerCase());let u;t[24]!==_||t[25]!==n.path||t[26]!==o||t[27]!==b||t[28]!==i||t[29]!==p?(u=b&&o&&!!_.get(v(i,Ht(n.path)))?.some(e=>Wt(e,{namespace:i,searchValue:p,entriesByPath:_})),t[24]=_,t[25]=n.path,t[26]=o,t[27]=b,t[28]=i,t[29]=p,t[30]=u):u=t[30],S=h||u;let d;t[31]!==n.path||t[32]!==i?(d=async()=>{try{let e=await f.request({namespace:i,path:n.path});if(e.error){He({title:`Download failed`,description:e.error,variant:`danger`});return}e.url&&ee(e.url,e.filename??`download`)}catch(e){let t=e;D.error(`Failed to download storage entry`,t),He({title:`Download failed`,description:String(t),variant:`danger`})}},t[31]=n.path,t[32]=i,t[33]=d):d=t[33],C=d,x=s;let y=b&&`font-medium`;t[34]===y?E=t[35]:(E=j(`text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5`,y),t[34]=y,t[35]=E),t[36]===l?O=t[37]:(O=zt(l),t[36]=l,t[37]=O),k=`${i}:${r}`,t[38]!==c||t[39]!==S||t[40]!==n||t[41]!==b||t[42]!==i||t[43]!==m||t[44]!==a?(A=()=>{b?g(!S):m({entry:n,namespace:i,protocol:a,backendType:c})},t[38]=c,t[39]=S,t[40]=n,t[41]=b,t[42]=i,t[43]=m,t[44]=a,t[45]=A):A=t[45],t[46]!==S||t[47]!==b?(M=b?(0,$.jsx)(ce,{isExpanded:S,className:`h-3 w-3`}):(0,$.jsx)(`span`,{className:`w-3 shrink-0`}),t[46]=S,t[47]=b,t[48]=M):M=t[48],N=b?(0,$.jsx)(ge,{className:j(`h-3.5 w-3.5 shrink-0`,ve.directory)}):_e(w),t[0]=c,t[1]=l,t[2]=_,t[3]=n,t[4]=b,t[5]=h,t[6]=i,t[7]=m,t[8]=a,t[9]=r,t[10]=p,t[11]=x,t[12]=S,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=O,t[18]=k,t[19]=A,t[20]=M,t[21]=N}else x=t[11],S=t[12],C=t[13],w=t[14],T=t[15],E=t[16],O=t[17],k=t[18],A=t[19],M=t[20],N=t[21];let P;t[49]===w?P=t[50]:(P=(0,$.jsx)(`span`,{className:`truncate flex-1 text-left`,children:w}),t[49]=w,t[50]=P);let V;t[51]!==n.size||t[52]!==d?(V=n.size>0&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums`,children:ot(n.size,d)}),t[51]=n.size,t[52]=d,t[53]=V):V=t[53];let H;t[54]!==n.lastModified||t[55]!==d?(H=n.lastModified!=null&&(0,$.jsx)(J,{content:`Last modified: ${new Date(n.lastModified*1e3).toLocaleString()}`,children:(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground pr-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap`,children:Bt(n.lastModified,d)})}),t[54]=n.lastModified,t[55]=d,t[56]=H):H=t[56];let U;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(le,{iconClassName:`h-3 w-3`,onClick:an})}),t[57]=U):U=t[57];let W;t[58]!==c||t[59]!==n||t[60]!==b||t[61]!==i||t[62]!==m||t[63]!==a?(W=!b&&(0,$.jsxs)(F,{onSelect:()=>m({entry:n,namespace:i,protocol:a,backendType:c}),children:[(0,$.jsx)(Et,{className:`h-3.5 w-3.5 mr-2`}),`View`]}),t[58]=c,t[59]=n,t[60]=b,t[61]=i,t[62]=m,t[63]=a,t[64]=W):W=t[64];let G;t[65]===n.path?G=t[66]:(G=async()=>{await qe(n.path),He({title:`Copied to clipboard`})},t[65]=n.path,t[66]=G);let K;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(me,{className:de}),t[67]=K):K=t[67];let q;t[68]===G?q=t[69]:(q=(0,$.jsxs)(F,{onSelect:G,children:[K,`Copy path`]}),t[68]=G,t[69]=q);let Y;t[70]!==C||t[71]!==b?(Y=!b&&(0,$.jsxs)(F,{onSelect:()=>C(),children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[70]=C,t[71]=b,t[72]=Y):Y=t[72];let te;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(I,{}),t[73]=te):te=t[73];let X;t[74]!==y||t[75]!==c||t[76]!==n||t[77]!==i||t[78]!==a?(X=Pt.map(e=>{let t=e.getCode({variableName:i,protocol:a,entry:n,backendType:c});if(t===null)return null;let r=e.icon;return(0,$.jsxs)(F,{onSelect:()=>y(t),children:[(0,$.jsx)(r,{className:de}),e.label]},e.id)}),t[74]=y,t[75]=c,t[76]=n,t[77]=i,t[78]=a,t[79]=X):X=t[79];let ne;t[80]!==W||t[81]!==q||t[82]!==Y||t[83]!==X?(ne=(0,$.jsxs)(z,{children:[U,(0,$.jsxs)(R,{align:`end`,onClick:on,onCloseAutoFocus:sn,children:[W,q,Y,te,X]})]}),t[80]=W,t[81]=q,t[82]=Y,t[83]=X,t[84]=ne):ne=t[84];let re;t[85]!==ne||t[86]!==V||t[87]!==H?(re=(0,$.jsxs)(`div`,{className:`flex items-center`,children:[V,H,ne]}),t[85]=ne,t[86]=V,t[87]=H,t[88]=re):re=t[88];let Z;t[89]!==x||t[90]!==E||t[91]!==re||t[92]!==O||t[93]!==k||t[94]!==A||t[95]!==M||t[96]!==N||t[97]!==P?(Z=(0,$.jsxs)(x,{className:E,style:O,value:k,onSelect:A,children:[M,N,P,re]}),t[89]=x,t[90]=E,t[91]=re,t[92]=O,t[93]=k,t[94]=A,t[95]=M,t[96]=N,t[97]=P,t[98]=Z):Z=t[98];let ie;t[99]!==c||t[100]!==l||t[101]!==S||t[102]!==n.path||t[103]!==b||t[104]!==d||t[105]!==i||t[106]!==m||t[107]!==a||t[108]!==o||t[109]!==p||t[110]!==T?(ie=b&&S&&(0,$.jsx)(en,{namespace:i,protocol:a,rootPath:o,backendType:c,prefix:Ht(n.path),depth:l+1,locale:d,searchValue:T?``:p,onOpenFile:m}),t[99]=c,t[100]=l,t[101]=S,t[102]=n.path,t[103]=b,t[104]=d,t[105]=i,t[106]=m,t[107]=a,t[108]=o,t[109]=p,t[110]=T,t[111]=ie):ie=t[111];let ae;return t[112]!==Z||t[113]!==ie?(ae=(0,$.jsxs)($.Fragment,{children:[Z,ie]}),t[112]=Z,t[113]=ie,t[114]=ae):ae=t[114],ae},nn=e=>{let t=(0,Dt.c)(66),{namespace:n,locale:r,searchValue:i,remoteSearch:a,onContinueRemoteSearch:o,onOpenFile:c}=e,[l,d]=(0,Q.useState)(!0),{entriesByPath:f,pageMetadataByPath:m}=u(),{clearNamespaceCache:h}=p(),g=n.name??n.displayName,{entries:_,isPending:y,error:x,hasMore:S,loadMore:C,isLoadingMore:w,loadMoreError:T,refetch:E}=b(g),D;t[0]!==h||t[1]!==g||t[2]!==E?(D=e=>{e.stopPropagation(),h(g),E()},t[0]=h,t[1]=g,t[2]=E,t[3]=D):D=t[3];let O=D,k=y?n.storageEntries:_,A;if(t[4]!==k||t[5]!==f||t[6]!==x||t[7]!==O||t[8]!==S||t[9]!==l||t[10]!==w||t[11]!==y||t[12]!==C||t[13]!==T||t[14]!==r||t[15]!==n.backendType||t[16]!==n.displayName||t[17]!==n.name||t[18]!==n.protocol||t[19]!==n.rootPath||t[20]!==g||t[21]!==o||t[22]!==c||t[23]!==m||t[24]!==a||t[25]!==i){let e=Gt(k,{namespace:g,searchValue:i,entriesByPath:f}),u=Zt(i),p=v(g,u),h=u===``?[]:f.get(p)??[],_=Gt(h,{namespace:g,searchValue:i,entriesByPath:f}),b;t[27]===i?b=t[28]:(b=i.trim(),t[27]=i,t[28]=b);let E=!!b,D=e.length>0||_.length>0,j=u!==``&&Xt({hasSearch:E,hasLoadedMatches:D,isPending:y,remoteSearch:a,searchKey:p,entriesByPath:f,pageMetadataByPath:m}),M=E&&e.length===0,N;bb0:{if(y&&k.length===0){let e;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Te,{className:`h-3 w-3 animate-spin`}),`Loading...`]}),t[29]=e):e=t[29],N=e;break bb0}if(a.status===`searching`){let e;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Te,{className:`h-3 w-3 animate-spin`}),`Searching more entries...`]}),t[30]=e):e=t[30],N=e;break bb0}if(a.status===`error`){let e;t[31]===a.error.message?e=t[32]:(e=(0,$.jsxs)(`span`,{className:`text-destructive`,children:[`Search failed: `,a.error.message]}),t[31]=a.error.message,t[32]=e),N=e;break bb0}if(a.status===`capped`){let e;t[33]===o?e=t[34]:(e=(0,$.jsx)(Y,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Continue searching`}),t[33]=o,t[34]=e);let n;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[35]=n):n=t[35];let r;t[36]===e?r=t[37]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`Searched more entries.`,e,n]}),t[36]=e,t[37]=r),N=r;break bb0}if(a.status===`exhausted`&&!D){N=`No matches`;break bb0}if(!E&&!y&&k.length===0){N=`No entries`;break bb0}if(j){let e;t[38]===o?e=t[39]:(e=(0,$.jsx)(Y,{variant:`text`,size:`xs`,className:`h-5 px-0 text-xs hover:text-blue-600`,onClick:o,children:`Search more entries`}),t[38]=o,t[39]=e);let n;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`span`,{className:`text-[10px]`,children:`(or press Enter)`}),t[40]=n):n=t[40];let r;t[41]===e?r=t[42]:(r=(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[`No loaded matches.`,e,n]}),t[41]=e,t[42]=r),N=r;break bb0}if(E&&!D&&k.length>0){N=`No matches`;break bb0}N=null}let P=N,F;t[43]===l?F=t[44]:(F=()=>d(!l),t[43]=l,t[44]=F);let I;t[45]===l?I=t[46]:(I=(0,$.jsx)(ce,{isExpanded:l,className:`h-3 w-3`}),t[45]=l,t[46]=I);let L;t[47]===n.protocol?L=t[48]:(L=(0,$.jsx)(Ce,{protocol:n.protocol}),t[47]=n.protocol,t[48]=L);let R;t[49]===n.displayName?R=t[50]:(R=(0,$.jsx)(`span`,{children:n.displayName}),t[49]=n.displayName,t[50]=R);let z;t[51]===n.name?z=t[52]:(z=n.name&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground font-normal`,children:[`(`,(0,$.jsx)(ft,{variableName:n.name}),`)`]}),t[51]=n.name,t[52]=z);let B;t[53]===O?B=t[54]:(B=(0,$.jsx)(ue,{onClick:O,tooltip:`Refresh storage connection`,className:`p-0`,iconClassName:`h-3 w-3`}),t[53]=O,t[54]=B);let V=n.rootPath||`(root)`,U;t[55]===V?U=t[56]:(U=(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground font-normal tabular-nums ml-auto`,children:V}),t[55]=V,t[56]=U);let W;t[57]!==n.name||t[58]!==B||t[59]!==U||t[60]!==F||t[61]!==I||t[62]!==L||t[63]!==R||t[64]!==z?(W=(0,$.jsxs)(s,{value:n.name,onSelect:F,className:`flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none`,children:[I,L,R,z,B,U]}),t[57]=n.name,t[58]=B,t[59]=U,t[60]=F,t[61]=I,t[62]=L,t[63]=R,t[64]=z,t[65]=W):W=t[65],A=(0,$.jsxs)($.Fragment,{children:[W,l&&(0,$.jsxs)($.Fragment,{children:[x&&k.length===0&&(0,$.jsx)(H,{error:x,style:zt(1),className:`py-1 text-xs h-auto overflow-auto max-h-32 items-start`,showIcon:!1}),!x&&P&&(0,$.jsx)(`div`,{className:`py-1 text-xs text-muted-foreground italic`,style:zt(1),children:P}),e.map(e=>{let t=Ut(e,k.indexOf(e));return(0,$.jsx)(tn,{rowKey:t,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:c},t)}),M&&_.map(e=>{let t=Ut(e,h.indexOf(e));return(0,$.jsx)(tn,{rowKey:`remote-search:${t}`,entry:e,namespace:g,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:r,searchValue:i,onOpenFile:c},`remote-search:${t}`)}),S&&!j&&(0,$.jsx)($t,{depth:1,isLoading:w,error:T,onLoadMore:C})]})]}),t[4]=k,t[5]=f,t[6]=x,t[7]=O,t[8]=S,t[9]=l,t[10]=w,t[11]=y,t[12]=C,t[13]=T,t[14]=r,t[15]=n.backendType,t[16]=n.displayName,t[17]=n.name,t[18]=n.protocol,t[19]=n.rootPath,t[20]=g,t[21]=o,t[22]=c,t[23]=m,t[24]=a,t[25]=i,t[26]=A}else A=t[26];return A},rn=()=>{let e=(0,Dt.c)(63),{namespaces:t,entriesByPath:n,pageMetadataByPath:r}=u(),{locale:i}=Ge(),[a,s]=(0,Q.useState)(``),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[l,d]=(0,Q.useState)(c),[f,p]=(0,Q.useState)(null),h=o(),g;e[1]===a?g=e[2]:(g=a.trim(),e[1]=a,e[2]=g);let _=!!g,b;e[3]===a?b=e[4]:(b=a.trim(),e[3]=a,e[4]=b);let x=b,C;e[5]!==x||e[6]!==l?(C=e=>{let t=l[e];return t?.query===x?t:qt(x)},e[5]=x,e[6]=l,e[7]=C):C=e[7];let w=C,T;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(e,t)=>{d(n=>({...n,[e]:t}))},e[8]=T):T=e[8];let E=T,D;e[9]!==x||e[10]!==n||e[11]!==r||e[12]!==w?(D=e=>{if(!x)return!1;let t=e.name??e.displayName,i=Zt(x);if(i===``||!Jt(w(t))||Gt(n.get(v(t,``))??e.storageEntries,{namespace:t,searchValue:x,entriesByPath:n}).length>0)return!1;let a=v(t,i);return Gt(n.get(a)??[],{namespace:t,searchValue:x,entriesByPath:n}).length>0?!1:Yt(a,n,r)},e[9]=x,e[10]=n,e[11]=r,e[12]=w,e[13]=D):D=e[13];let O=D,k;e[14]!==O||e[15]!==x||e[16]!==n||e[17]!==h||e[18]!==r?(k=async e=>{if(!O(e))return;let t=x,i=e.name??e.displayName,a=Zt(t),o=v(i,a),s=n.get(o),c=r.get(o)?.nextPageToken??null,l=s!==void 0;E(i,{query:t,status:`searching`});try{for(let e=0;e<Kt;e++){let e=!l||c!==null,n=[];if(e){let e=await h({namespace:i,prefix:a,pageToken:c,append:l});n=e.entries,c=e.next_page_token??null,l=!0}if((e?n:s??[]).some(e=>Qt(e,t))){E(i,{query:t,status:`found`});return}if(c===null){E(i,{query:t,status:`exhausted`});return}}E(i,{query:t,status:`capped`})}catch(e){let n=e;E(i,{query:t,status:`error`,error:n instanceof Error?n:Error(String(n))})}},e[14]=O,e[15]=x,e[16]=n,e[17]=h,e[18]=r,e[19]=k):k=e[19];let A=k,M;e[20]!==O||e[21]!==A||e[22]!==t?(M=()=>{let e=t.filter(O);for(let t of e)A(t)},e[20]=O,e[21]=A,e[22]=t,e[23]=M):M=e[23];let N=M;if(t.length===0){let t;return e[24]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(at,{title:`No storage connected`,description:(0,$.jsxs)(`span`,{children:[`Create an obstore or fsspec connection in your notebook. See the`,` `,(0,$.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,$.jsx)(ut,{group:`storage`,label:`Add remote storage`,variant:`outline`,size:`sm`}),icon:(0,$.jsx)(Se,{className:`h-8 w-8`})}),e[24]=t):t=e[24],t}let P;e[25]===f?P=e[26]:(P=f&&(0,$.jsx)(Lt,{entry:f.entry,namespace:f.namespace,protocol:f.protocol,backendType:f.backendType,onBack:()=>p(null)}),e[25]=f,e[26]=P);let F=f&&`hidden`,I;e[27]===F?I=e[28]:(I=j(`border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin`,F),e[27]=F,e[28]=I);let L;e[29]!==O||e[30]!==N||e[31]!==t?(L=e=>{e.key===`Enter`&&t.some(O)&&(e.preventDefault(),N())},e[29]=O,e[30]=N,e[31]=t,e[32]=L):L=e[32];let R;e[33]!==a||e[34]!==L?(R=(0,$.jsx)(m,{placeholder:`Search entries...`,className:`h-6 m-1`,value:a,onValueChange:s,onKeyDown:L,rootClassName:`flex-1 border-b-0`}),e[33]=a,e[34]=L,e[35]=R):R=e[35];let z;e[36]===_?z=e[37]:(z=_&&(0,$.jsx)(Y,{variant:`text`,size:`xs`,className:`float-right border-none px-2 m-0 h-full`,onClick:()=>s(``),children:(0,$.jsx)(oe,{className:`h-4 w-4`})}),e[36]=_,e[37]=z);let B,V;e[38]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(J,{content:`Search by file name within loaded entries, or by prefix (e.g. 'folder/x') for backend search. Press Enter to fetch more results.`,delayDuration:200,children:(0,$.jsx)(pe,{className:`h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2`})}),V=(0,$.jsx)(ut,{group:`storage`,label:`Add remote storage`,compact:!0,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`}),e[38]=B,e[39]=V):(B=e[38],V=e[39]);let H;e[40]!==R||e[41]!==z?(H=(0,$.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[R,z,B,V]}),e[40]=R,e[41]=z,e[42]=H):H=e[42];let U;if(e[43]!==A||e[44]!==i||e[45]!==t||e[46]!==w||e[47]!==a){let n;e[49]!==A||e[50]!==i||e[51]!==w||e[52]!==a?(n=e=>{let t=e.name??e.displayName;return(0,$.jsx)(nn,{namespace:e,locale:i,searchValue:a,remoteSearch:w(t),onContinueRemoteSearch:()=>void A(e),onOpenFile:p},t)},e[49]=A,e[50]=i,e[51]=w,e[52]=a,e[53]=n):n=e[53],U=t.map(n),e[43]=A,e[44]=i,e[45]=t,e[46]=w,e[47]=a,e[48]=U}else U=e[48];let W;e[54]===U?W=e[55]:(W=(0,$.jsx)(y,{className:`flex flex-col`,children:U}),e[54]=U,e[55]=W);let G;e[56]!==I||e[57]!==H||e[58]!==W?(G=(0,$.jsxs)(S,{className:I,shouldFilter:!1,children:[H,W]}),e[56]=I,e[57]=H,e[58]=W,e[59]=G):G=e[59];let K;return e[60]!==G||e[61]!==P?(K=(0,$.jsxs)(`div`,{className:`h-full flex flex-col`,children:[P,G]}),e[60]=G,e[61]=P,e[62]=K):K=e[62],K};function an(e){return e.stopPropagation()}function on(e){return e.stopPropagation()}function sn(e){return e.preventDefault()}var cn=(0,Q.createContext)(null);function ln(){return(0,Q.useContext)(cn)??void 0}var un=e=>{let t=(0,Dt.c)(3),{children:n}=e,r=ke(),i;return t[0]!==n||t[1]!==r?(i=(0,$.jsx)(cn.Provider,{value:r,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i},dn=e=>{let t=(0,Dt.c)(5),{children:n}=e,[r,i]=(0,Q.useState)(null),a;t[0]!==n||t[1]!==r?(a=r&&(0,$.jsx)(Ae,{backend:Ie,options:{rootElement:r},children:(0,$.jsx)(un,{children:n})}),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o;return t[3]===a?o=t[4]:(o=(0,$.jsx)(`div`,{ref:i,className:`contents`,children:a}),t[3]=a,t[4]=o),o};async function fn(e,t){if(!k()){let n=A().formatNavigableHttpURL(`api/files/download`,new URLSearchParams({path:e}));ee(n.toString(),t);return}let n=await re().sendFileDetails({path:e});if(n.isBase64&&n.contents){let e=Ye(fe(n.contents,n.mimeType||`application/octet-stream`));q(e,t)}else q(new Blob([n.contents||``],{type:n.mimeType||`application/octet-stream`}),t)}var pn=e=>{let t=(0,Dt.c)(21),{file:n,mimeType:r,message:i,onDownload:a}=e,{locale:o}=Ge(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Path`}),t[0]=s):s=t[0];let c;t[1]===n.path?c=t[2]:(c=(0,$.jsx)(`span`,{className:`font-mono text-xs break-all`,children:n.path}),t[1]=n.path,t[2]=c);let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Type`}),t[3]=l):l=t[3];let u;t[4]===r?u=t[5]:(u=(0,$.jsx)(`span`,{children:r}),t[4]=r,t[5]=u);let d;t[6]!==n.size||t[7]!==o?(d=n.size!=null&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`text-muted-foreground font-medium`,children:`Size`}),(0,$.jsx)(`span`,{children:ot(n.size,o)})]}),t[6]=n.size,t[7]=o,t[8]=d):d=t[8];let f;t[9]!==c||t[10]!==u||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-2`,children:[s,c,l,u,d]}),t[9]=c,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]===i?p=t[14]:(p=(0,$.jsx)(`div`,{className:`mt-4 text-muted-foreground italic`,children:i}),t[13]=i,t[14]=p);let m;t[15]===a?m=t[16]:(m=a&&(0,$.jsxs)(Y,{variant:`outline`,size:`sm`,className:`mt-4`,onClick:a,children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]}),t[15]=a,t[16]=m);let h;return t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(`div`,{className:`p-4 text-sm`,children:[f,p,m]}),t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h};function mn(e,t){let n=e||`text/plain`;return G(n)?`media`:t?`unsupported`:n===`text/csv`?`csv`:n.startsWith(`text/`)||n!=="default"&&n in V||e==null?`text`:`unsupported`}var hn=10485760,gn=new Map,_n=({file:e,onOpenNotebook:t})=>{let{sendFileDetails:n,sendUpdateFile:i}=ne(),a=r(T),o=r(E),s=r(C),[c,l]=(0,Q.useState)(``),{data:u,isPending:d,error:f,setData:p,refetch:m}=Ke(async()=>{let t=await n({path:e.path,maxBytes:hn}),r=mn(t.mimeType,t.isBase64);if(!t.isTooLarge&&r===`text`){let n=t.contents||``;l(gn.get(e.path)??n)}return t},[e.path]),h=async()=>{c!==u?.contents&&await i({path:e.path,contents:c}).then(e=>{e.success&&(p(e=>({...e,contents:c})),l(c))})},g=(0,Q.useRef)(c);if(g.current=c,(0,Q.useEffect)(()=>()=>{if(u?.contents==null||u.isTooLarge||mn(u.mimeType,u.isBase64)!==`text`)return;let t=g.current;t===u.contents?gn.delete(e.path):gn.set(e.path,t)},[e.path,u?.contents,u?.isTooLarge,u?.mimeType,u?.isBase64]),f)return(0,$.jsx)($e,{error:f});if(d||!u)return null;let _=u.mimeType||`text/plain`,v=mn(u.mimeType,u.isBase64),y=v===`text`,b=v===`csv`,x=v===`media`,S=s&&u.file.isMarimoFile&&(e.path===s||e.path.endsWith(`/${s}`)),w=async()=>{await fn(e.path,u.file.name)},D=te.of([{key:a.getHotkey(`global.save`).key,stopPropagation:!0,run:()=>c!==u.contents&&(h(),!0)}]),O=(0,$.jsx)(Ot,{filename:u.file.name,onRefresh:m,onDownload:o?void 0:w,actions:(0,$.jsxs)($.Fragment,{children:[e.isMarimoFile&&t&&!k()&&(0,$.jsx)(J,{content:`Open notebook`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:e=>t(e),children:(0,$.jsx)(he,{className:`h-3.5 w-3.5`})})}),y&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(J,{content:`Copy contents to clipboard`,children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:async()=>{await qe(c)},children:(0,$.jsx)(me,{className:`h-3.5 w-3.5`})})}),(0,$.jsx)(J,{content:et(`global.save`),children:(0,$.jsx)(Y,{variant:`text`,size:`xs`,onClick:h,disabled:c===u.contents,children:(0,$.jsx)(Re,{className:`h-3.5 w-3.5`})})})]})]})});if(u.isTooLarge||v===`unsupported`)return(0,$.jsxs)($.Fragment,{children:[O,(0,$.jsx)(pn,{file:u.file,mimeType:_,message:u.isTooLarge?`File is too large to preview.`:`This file type cannot be previewed.`,onDownload:o?void 0:w})]});let A=y&&S&&(0,$.jsxs)(Qe,{variant:`warning`,className:`rounded-none`,children:[(0,$.jsx)(ze,{className:`h-4 w-4`}),(0,$.jsx)(Ze,{children:`Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution.`})]}),j=x&&u.contents?W({contents:u.contents,mimeType:_,isBase64:u.isBase64??!1}):void 0;return(0,$.jsxs)($.Fragment,{children:[O,A,(0,$.jsx)(U,{mimeType:_,filename:u.file.name,contents:y?c:b?u.contents??void 0:void 0,mediaSource:j,readOnly:!y,onChange:y?l:void 0,extensions:y?[D]:[]})]})},vn=n(e=>{let t=e(X);return O(t,`no requestClientAtom set`),new Oe({getRoots:t.getFileRoots,listFiles:t.sendListFiles,createFileOrFolder:t.sendCreateFileOrFolder,deleteFileOrFolder:t.sendDeleteFileOrFolder,copyFileOrFolder:t.sendCopyFileOrFolder,renameFileOrFolder:t.sendRenameFileOrFolder})}),yn=n({}),bn=` `,xn={directory:e=>`os.listdir("${e}")`,python:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,json:e=>`with open("${e}", "r") as _f:\n${bn}_data = json.load(_f)\n`,code:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,text:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,image:e=>`mo.image("${e}")`,audio:e=>`mo.audio("${e}")`,video:e=>`mo.video("${e}")`,pdf:e=>`with open("${e}", "rb") as _f:\n${bn}...\n`,zip:e=>`with open("${e}", "rb") as _f:\n${bn}...\n`,data:e=>`with open("${e}", "r") as _f:\n${bn}...\n`,unknown:e=>`with open("${e}", "r") as _f:\n${bn}...\n`},Sn=104857600,Cn=5,wn=`data-file-explorer-directory-path`;function Tn(e){let{destinationPath:t,getDestinationLabel:n=e=>e,onUploadStart:r,refreshDestination:i,...a}=e,{sendCreateFileOrFolder:o}=ne();return Ve({multiple:!0,maxSize:Sn,...a,onError:e=>{D.error(e),He({title:`File upload failed`,description:e.message,variant:`danger`})},onDropRejected:e=>{He({title:`File upload failed`,description:(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,children:e.map(e=>(0,$.jsxs)(`div`,{children:[e.file.name,` (`,e.errors.map(e=>e.message).join(`, `),`)`]},e.file.name))}),variant:`danger`})},onDrop:async(e,a,s)=>{if(e.length===0)return;let c=typeof t==`function`?t(s):t,l=n(c),u=e.length===1?`Uploading file to ${l}...`:`Uploading files to ${l}...`;r?.(c,e);let d;try{d=await K(u,async t=>(t.addTotal(e.length),En({files:e,destinationPath:c,createFile:o,onFileProcessed:()=>t.increment(1)})))}catch{await i(c);return}await i(c),kn(d,l)}})}async function En({files:e,destinationPath:t,createFile:n,onFileProcessed:r}){let i=await it(e,Cn,async e=>{try{return{file:e,response:await n({path:Dn({destinationPath:t,filePath:jn(An(e))}),type:`file`,name:e.name,file:e})}}catch(t){return{file:e,response:{success:!1,message:Xe(t)}}}finally{r?.()}});return{successful:i.filter(({response:e})=>e.success),failed:i.filter(({response:e})=>!e.success)}}function Dn({destinationPath:e,filePath:t}){if(!t)return e;if(Ue.isAbsolute(t))throw Error(`Upload path must be relative: ${t}`);let n=t.split(/[\\/]+/).slice(0,-1).filter(Boolean);if(n.includes(`..`))throw Error(`Upload path cannot contain parent traversal: ${t}`);let r=n.filter(e=>e!==`.`);if(r.length===0)return e;let i=We.guessDeliminator(e),a=r.join(i.deliminator);return i.join(e,a)}function On(e,t){return e instanceof Element&&e.closest(`[${wn}]`)?.getAttribute(wn)||t}function kn(e,t){let n=e.successful.length+e.failed.length;if(e.failed.length>0){let r;r=e.successful.length===0?n===1?`File upload failed`:`Files failed to upload`:`${e.successful.length} of ${n} files uploaded`,He({title:r,description:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Destination: `,t,`.`]}),e.failed.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,`:`,` `,t.message||`The server rejected the upload.`]},`${e.name}-${n}`))]}),variant:`danger`});return}let r=e.successful.filter(({file:e,response:t})=>t.info?.name&&t.info.name!==e.name);He({title:n===1?`File uploaded`:`${n} files uploaded`,description:r.length===0?`Uploaded to ${t}.`:(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsxs)(`div`,{children:[`Uploaded to `,t,`.`]}),r.map(({file:e,response:t},n)=>(0,$.jsxs)(`div`,{children:[e.name,` was saved as `,t.info?.name,`.`]},`${e.name}-${n}`))]})})}function An(e){if(e.webkitRelativePath)return e.webkitRelativePath;if(`path`in e&&typeof e.path==`string`)return e.path;if(`relativePath`in e&&typeof e.relativePath==`string`)return e.relativePath}function jn(e){if(e)return e.replace(/^\/+/,``)}var Mn=c(`marimo:showHiddenFiles`,!0,_,{getOnInit:!0}),Nn=Q.createContext(null),Pn=e=>{let n=(0,Dt.c)(110),{height:r,externalDropDestinationPath:a}=e,o=a===void 0?null:a,s=(0,Q.useRef)(null),c=ln(),[l]=t(vn),u;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[0]=u):u=n[0];let[d,f]=(0,Q.useState)(u),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=t(Mn),[y,b]=t(yn),x;n[1]===l?x=n[2]:(x=e=>l.refreshPath(e),n[1]=l,n[2]=x);let S=i(x),C=(0,Q.useRef)(``),w;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>C.current,n[3]=w):w=n[3];let T;n[4]===l?T=n[5]:(T=e=>Vn(l,e),n[4]=l,n[5]=T);let E;n[6]!==S||n[7]!==T?(E={noClick:!0,noDrag:!0,noKeyboard:!0,destinationPath:w,getDestinationLabel:T,refreshDestination:S},n[6]=S,n[7]=T,n[8]=E):E=n[8];let{getInputProps:D,open:O}=Tn(E),k;n[9]===O?k=n[10]:(k=e=>{C.current=e,O()},n[9]=O,n[10]=k);let A=i(k),{openPrompt:j}=we(),M;n[11]===l?M=n[12]:(M=()=>l.initialize(f),n[11]=l,n[12]=M);let N;n[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=[],n[13]=N):N=n[13];let{isPending:P,error:F}=Ke(M,N),I;n[14]!==y||n[15]!==l?(I=()=>l.refreshAll(Object.keys(y).filter(e=>y[e])),n[14]=y,n[15]=l,n[16]=I):I=n[16];let L=i(I),R;n[17]!==v||n[18]!==_?(R=()=>{v(!_)},n[17]=v,n[18]=_,n[19]=R):R=n[19];let z=i(R),B;n[20]!==j||n[21]!==h?.id||n[22]!==l?(B=async()=>{j({title:`Folder name`,onConfirm:async e=>{l.createFolder(e,h?.id??null)}})},n[20]=j,n[21]=h?.id,n[22]=l,n[23]=B):B=n[23];let V=i(B),H;n[24]!==j||n[25]!==h?.id||n[26]!==l?(H=async()=>{j({title:`File name`,onConfirm:async e=>{l.createFile({name:e,parentId:h?.id??null})}})},n[24]=j,n[25]=h?.id,n[26]=l,n[27]=H):H=n[27];let U=i(H),W;n[28]!==j||n[29]!==h?.id||n[30]!==l?(W=async()=>{j({title:`Notebook name`,onConfirm:async e=>{l.createFile({name:e,parentId:h?.id??null,type:`notebook`})}})},n[28]=j,n[29]=h?.id,n[30]=l,n[31]=W):W=n[31];let G=i(W),K;n[32]===b?K=n[33]:(K=()=>{s.current?.closeAll(),b({})},n[32]=b,n[33]=K);let q=i(K),ee;n[34]!==d||n[35]!==_?(ee=Hn(d,_),n[34]=d,n[35]=_,n[36]=ee):ee=n[36];let J=ee,te,X;n[37]!==h||n[38]!==J?(te=()=>{h&&!Wn(J,h.id)&&g(null)},X=[h,J],n[37]=h,n[38]=J,n[39]=te,n[40]=X):(te=n[39],X=n[40]),Q.useEffect(te,X);let ne;n[41]!==o||n[42]!==A||n[43]!==l?(ne={tree:l,uploadFiles:A,externalDropDestinationPath:o},n[41]=o,n[42]=A,n[43]=l,n[44]=ne):ne=n[44];let re=ne;if(P){let e;return n[45]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Ee,{size:`medium`,centered:!0}),n[45]=e):e=n[45],e}if(F){let e;return n[46]===F?e=n[47]:(e=(0,$.jsx)($e,{error:F}),n[46]=F,n[47]=e),e}if(p){let e;n[48]===Symbol.for(`react.memo_cache_sentinel`)?(e=()=>m(null),n[48]=e):e=n[48];let t;n[49]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Y,{onClick:e,"data-testid":`file-explorer-back-button`,variant:`text`,size:`xs`,className:`mb-0`,children:(0,$.jsx)(ie,{size:16})}),n[49]=t):t=n[49];let r;n[50]===p.name?r=n[51]:(r=(0,$.jsxs)(`div`,{className:`flex items-center pl-1 pr-3 shrink-0 border-b justify-between`,children:[t,(0,$.jsx)(`span`,{className:`font-bold`,children:p.name})]}),n[50]=p.name,n[51]=r);let i;n[52]!==p||n[53]!==l?(i=l.isPrimaryNode(p)?e=>{let t=l.getPrimaryRelativePath(p.path);t!==null&&Bn(e,t)}:void 0,n[52]=p,n[53]=l,n[54]=i):i=n[54];let a;n[55]!==p||n[56]!==i?(a=(0,$.jsx)(Q.Suspense,{children:(0,$.jsx)(_n,{onOpenNotebook:i,file:p})}),n[55]=p,n[56]=i,n[57]=a):a=n[57];let o;return n[58]!==r||n[59]!==a?(o=(0,$.jsxs)($.Fragment,{children:[r,a]}),n[58]=r,n[59]=a,n[60]=o):o=n[60],o}let Z;n[61]===D?Z=n[62]:(Z=D(),n[61]=D,n[62]=Z);let ae;n[63]===Z?ae=n[64]:(ae=(0,$.jsx)(`input`,{"data-testid":`file-explorer-upload-input`,...Z}),n[63]=Z,n[64]=ae);let oe;n[65]!==h?.path||n[66]!==l?(oe=h?.path??l.getPrimaryRootPath(),n[65]=h?.path,n[66]=l,n[67]=oe):oe=n[67];let se;n[68]!==h?.path||n[69]!==l?(se=h?.path??l.getPrimaryRootPath(),n[68]=h?.path,n[69]=l,n[70]=se):se=n[70];let ce;n[71]!==se||n[72]!==l?(ce=Vn(l,se),n[71]=se,n[72]=l,n[73]=ce):ce=n[73];let le;n[74]!==q||n[75]!==U||n[76]!==V||n[77]!==G||n[78]!==z||n[79]!==L||n[80]!==A||n[81]!==_||n[82]!==oe||n[83]!==ce?(le=(0,$.jsx)(In,{onRefresh:L,onHidden:z,showHiddenFiles:_,onCreateFile:U,onCreateNotebook:G,onCreateFolder:V,onCollapseAll:q,uploadDestinationPath:oe,uploadDestinationLabel:ce,onUpload:A}),n[74]=q,n[75]=U,n[76]=V,n[77]=G,n[78]=z,n[79]=L,n[80]=A,n[81]=_,n[82]=oe,n[83]=ce,n[84]=le):le=n[84];let ue=r-33,de,fe,pe;n[85]===l?(de=n[86],fe=n[87],pe=n[88]):(de=async e=>{let{ids:t}=e;for(let e of t)await l.delete(e)},fe=async e=>{let{id:t,name:n}=e;await l.rename(t,n)},pe=async e=>{let{dragIds:t,parentId:n}=e;await l.move(t,n)},n[85]=l,n[86]=de,n[87]=fe,n[88]=pe);let me;n[89]===Symbol.for(`react.memo_cache_sentinel`)?(me=e=>{let t=e[0];if(!t){g(null);return}if(t.data.isDirectory){g({id:t.id,path:t.data.path});return}g(null),m(t.data)},n[89]=me):me=n[89];let he;n[90]!==y||n[91]!==b||n[92]!==l?(he=async e=>{if(await l.expand(e)){let t=y[e]??!1;b({...y,[e]:!t})}},n[90]=y,n[91]=b,n[92]=l,n[93]=he):he=n[93];let ge;n[94]!==c||n[95]!==y||n[96]!==ue||n[97]!==de||n[98]!==fe||n[99]!==pe||n[100]!==he||n[101]!==J?(ge=(0,$.jsx)(Me,{width:`100%`,ref:s,height:ue,className:`h-full`,data:J,initialOpenState:y,openByDefault:!1,dndManager:c,renderCursor:Gn,disableDrag:Kn,disableDrop:Jn,onDelete:de,onRename:fe,onMove:pe,onSelect:me,onToggle:he,padding:15,rowHeight:30,indent:Fn,overscanCount:1e3,disableMultiSelection:!0,children:Rn}),n[94]=c,n[95]=y,n[96]=ue,n[97]=de,n[98]=fe,n[99]=pe,n[100]=he,n[101]=J,n[102]=ge):ge=n[102];let _e;n[103]!==re||n[104]!==ge?(_e=(0,$.jsx)(Nn,{value:re,children:ge}),n[103]=re,n[104]=ge,n[105]=_e):_e=n[105];let ve;return n[106]!==ae||n[107]!==le||n[108]!==_e?(ve=(0,$.jsxs)($.Fragment,{children:[ae,le,_e]}),n[106]=ae,n[107]=le,n[108]=_e,n[109]=ve):ve=n[109],ve},Fn=15,In=e=>{let t=(0,Dt.c)(35),{onRefresh:n,onHidden:r,showHiddenFiles:i,onCreateFile:a,onCreateNotebook:o,onCreateFolder:s,onCollapseAll:c,uploadDestinationPath:l,uploadDestinationLabel:u,onUpload:d}=e,f=`Upload files to ${u}`,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(mt,{size:16}),t[0]=p):p=t[0];let m;t[1]===o?m=t[2]:(m=(0,$.jsx)(J,{content:`Add notebook`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-notebook-button`,onClick:o,variant:`text`,size:`xs`,children:p})}),t[1]=o,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(bt,{size:16}),t[3]=h):h=t[3];let g;t[4]===a?g=t[5]:(g=(0,$.jsx)(J,{content:`Add file`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-file-button`,onClick:a,variant:`text`,size:`xs`,children:h})}),t[4]=a,t[5]=g);let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(St,{size:16}),t[6]=_):_=t[6];let v;t[7]===s?v=t[8]:(v=(0,$.jsx)(J,{content:`Add folder`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-add-folder-button`,onClick:s,variant:`text`,size:`xs`,children:_})}),t[7]=s,t[8]=v);let y;t[9]!==d||t[10]!==l?(y=()=>d(l),t[9]=d,t[10]=l,t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(Be,{size:16}),t[12]=b):b=t[12];let x;t[13]!==y||t[14]!==f?(x=(0,$.jsx)(Y,{"data-testid":`file-explorer-upload-button`,"aria-label":f,onClick:y,variant:`text`,size:`xs`,children:b}),t[13]=y,t[14]=f,t[15]=x):x=t[15];let S;t[16]!==x||t[17]!==f?(S=(0,$.jsx)(J,{content:f,children:x}),t[16]=x,t[17]=f,t[18]=S):S=t[18];let C;t[19]===n?C=t[20]:(C=(0,$.jsx)(ue,{"data-testid":`file-explorer-refresh-button`,onClick:n}),t[19]=n,t[20]=C);let w;t[21]!==r||t[22]!==i?(w=(0,$.jsx)(se,{"data-testid":`file-explorer-hidden-files-button`,isVisible:i,onToggle:r,showTooltip:`Show hidden files`,hideTooltip:`Hide hidden files`}),t[21]=r,t[22]=i,t[23]=w):w=t[23];let T;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(yt,{size:16}),t[24]=T):T=t[24];let E;t[25]===c?E=t[26]:(E=(0,$.jsx)(J,{content:`Collapse all folders`,children:(0,$.jsx)(Y,{"data-testid":`file-explorer-collapse-button`,onClick:c,variant:`text`,size:`xs`,children:T})}),t[25]=c,t[26]=E);let D;return t[27]!==S||t[28]!==C||t[29]!==w||t[30]!==E||t[31]!==m||t[32]!==g||t[33]!==v?(D=(0,$.jsxs)(`div`,{className:`flex items-center justify-end px-2 shrink-0 border-b`,children:[m,g,v,S,C,w,E]}),t[27]=S,t[28]=C,t[29]=w,t[30]=E,t[31]=m,t[32]=g,t[33]=v,t[34]=D):D=t[34],D},Ln=e=>{let t=(0,Dt.c)(14),{node:n,onOpenMarimoFile:r}=e,i;t[0]===n?i=t[1]:(i=e=>{n.data.isDirectory||(e.stopPropagation(),n.select())},t[0]=n,t[1]=i);let a;t[2]!==n.data.isMarimoFile||t[3]!==n.data.isPrimaryRoot||t[4]!==r?(a=n.data.isMarimoFile&&n.data.isPrimaryRoot&&!k()&&(0,$.jsxs)(`span`,{"data-testid":`file-explorer-open-marimo-button`,className:`shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline`,onClick:r,children:[`open `,(0,$.jsx)(he,{className:`inline ml-1`,size:12})]}),t[2]=n.data.isMarimoFile,t[3]=n.data.isPrimaryRoot,t[4]=r,t[5]=a):a=t[5];let o;t[6]!==n.data.name||t[7]!==i||t[8]!==a?(o=(0,$.jsxs)(`span`,{className:`flex-1 overflow-hidden text-ellipsis`,onClick:i,children:[n.data.name,a]}),t[6]=n.data.name,t[7]=i,t[8]=a,t[9]=o):o=t[9];let s=o,c;return t[10]!==s||t[11]!==n.data.isRoot||t[12]!==n.data.path?(c=n.data.isRoot?(0,$.jsx)(J,{content:n.data.path,children:s}):s,t[10]=s,t[11]=n.data.isRoot,t[12]=n.data.path,t[13]=c):c=t[13],c},Rn=e=>{let t=(0,Dt.c)(115),{node:n,style:a,dragHandle:o}=e,{openFile:s}=ne(),c=r(E),u;t[0]!==n.data.isDirectory||t[1]!==n.data.name?(u=n.data.isDirectory?`directory`:ye(n.data.name),t[0]=n.data.isDirectory,t[1]=n.data.name,t[2]=u):u=t[2];let d=u,f=be[d],{openConfirm:p,openPrompt:m}=we(),{createNewCell:h}=l(),_=g(),v;t[3]!==h||t[4]!==_?(v=e=>{h({code:e,before:!1,cellId:_??`__end__`})},t[3]=h,t[4]=_,t[5]=v):v=t[5];let y=v,b=(0,Q.use)(Nn),S=b?.tree,C=n.data.isDirectory&&b?.externalDropDestinationPath===n.data.path,w;t[6]!==n.data.path||t[7]!==S?(w=async e=>{let t=S?.getPrimaryRelativePath(n.data.path);t!=null&&Bn(e,t)},t[6]=n.data.path,t[7]=S,t[8]=w):w=t[8];let T=w,D;t[9]!==n.data.name||t[10]!==n.id||t[11]!==n.tree||t[12]!==p?(D=async e=>{e.stopPropagation(),e.preventDefault(),p({title:`Delete file`,description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,$.jsx)(P,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":`Confirm`,children:`Delete`})})},t[9]=n.data.name,t[10]=n.id,t[11]=n.tree,t[12]=p,t[13]=D):D=t[13];let O=D,A;t[14]!==n||t[15]!==m||t[16]!==S?(A=async()=>{n.open(),m({title:`Folder name`,onConfirm:async e=>{S?.createFolder(e,n.id)}})},t[14]=n,t[15]=m,t[16]=S,t[17]=A):A=t[17];let M=i(A),N;t[18]!==n||t[19]!==m||t[20]!==S?(N=async()=>{n.open(),m({title:`File name`,onConfirm:async e=>{S?.createFile({name:e,parentId:n.id})}})},t[18]=n,t[19]=m,t[20]=S,t[21]=N):N=t[21];let L=i(N),R;t[22]!==n||t[23]!==m||t[24]!==S?(R=async()=>{n.open(),m({title:`Notebook name`,onConfirm:async e=>{S?.createFile({name:e,parentId:n.id,type:`notebook`})}})},t[22]=n,t[23]=m,t[24]=S,t[25]=R):R=t[25];let z=i(R),V;t[26]!==n.data.name||t[27]!==n.id||t[28]!==S?(V=async()=>{S&&await S.copy(n.id,rt(n.data.name))},t[26]=n.data.name,t[27]=n.id,t[28]=S,t[29]=V):V=t[29];let H=i(V),U;t[30]!==n.data.isDirectory||t[31]!==n.data.path?(U=n.data.isDirectory?{[wn]:n.data.path}:{},t[30]=n.data.isDirectory,t[31]=n.data.path,t[32]=U):U=t[32];let W;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(W=j(`flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group`),t[33]=W):W=t[33];let G=!n.data.isRoot,K,q;t[34]===n?(K=t[35],q=t[36]):(K=e=>{e.stopPropagation(),n.data.isDirectory&&(n.select(),n.toggle())},q=(0,$.jsx)(zn,{node:n}),t[34]=n,t[35]=K,t[36]=q);let ee=n.willReceiveDrop&&n.data.isDirectory&&`bg-accent/80 hover:bg-accent/80 text-accent-foreground`,J=n.isSelected&&`bg-accent/60 hover:bg-accent/60 text-accent-foreground`,Y=C&&`bg-primary/15 hover:bg-primary/15 text-accent-foreground ring-1 ring-inset ring-primary`,te;t[37]!==ee||t[38]!==J||t[39]!==Y?(te=j(`flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group`,ee,J,Y),t[37]=ee,t[38]=J,t[39]=Y,t[40]=te):te=t[40];let X;t[41]!==f||t[42]!==d||t[43]!==n.data.isMarimoFile||t[44]!==n.data.isRoot?(X=n.data.isRoot?(0,$.jsx)(Ct,{className:`w-5 h-5 shrink-0 mr-2 text-primary`,strokeWidth:1.5}):n.data.isMarimoFile?(0,$.jsx)(ht,{className:`w-5 h-5 shrink-0 mr-2`,strokeWidth:1.5}):(0,$.jsx)(f,{className:j(`w-5 h-5 shrink-0 mr-2`,ve[d]),strokeWidth:1.5}),t[41]=f,t[42]=d,t[43]=n.data.isMarimoFile,t[44]=n.data.isRoot,t[45]=X):X=t[45];let re;t[46]!==T||t[47]!==n?(re=n.isEditing?(0,$.jsx)(Fe,{node:n}):(0,$.jsx)(Ln,{node:n,onOpenMarimoFile:T}),t[46]=T,t[47]=n,t[48]=re):re=t[48];let Z;t[49]===n?Z=t[50]:(Z=!n.data.isDirectory&&(0,$.jsxs)(F,{onSelect:()=>n.select(),"data-testid":`file-explorer-open-file-menu-item`,children:[(0,$.jsx)(Et,{className:`h-3.5 w-3.5 mr-2`}),`Open file`]}),t[49]=n,t[50]=Z);let ie;t[51]!==n.data.isDirectory||t[52]!==n.data.path||t[53]!==s?(ie=!n.data.isDirectory&&!k()&&(0,$.jsxs)(F,{onSelect:()=>{s({path:n.data.path})},"data-testid":`file-explorer-open-external-menu-item`,children:[(0,$.jsx)(he,{className:`h-3.5 w-3.5 mr-2`}),`Open file in external editor`]}),t[51]=n.data.isDirectory,t[52]=n.data.path,t[53]=s,t[54]=ie):ie=t[54];let oe;t[55]!==b||t[56]!==L||t[57]!==M||t[58]!==z||t[59]!==n.data.isDirectory||t[60]!==n.data.path?(oe=n.data.isDirectory&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(F,{onSelect:()=>z(),"data-testid":`file-explorer-create-notebook-menu-item`,children:[(0,$.jsx)(mt,{className:`h-3.5 w-3.5 mr-2`}),`Create notebook`]}),(0,$.jsxs)(F,{onSelect:()=>L(),"data-testid":`file-explorer-create-file-menu-item`,children:[(0,$.jsx)(bt,{className:`h-3.5 w-3.5 mr-2`}),`Create file`]}),(0,$.jsxs)(F,{onSelect:()=>M(),"data-testid":`file-explorer-create-folder-menu-item`,children:[(0,$.jsx)(St,{className:`h-3.5 w-3.5 mr-2`}),`Create folder`]}),(0,$.jsxs)(F,{onSelect:()=>b?.uploadFiles(n.data.path),"data-testid":`file-explorer-upload-files-menu-item`,children:[(0,$.jsx)(Be,{className:`h-3.5 w-3.5 mr-2`}),`Upload files here`]}),(0,$.jsx)(I,{})]}),t[55]=b,t[56]=L,t[57]=M,t[58]=z,t[59]=n.data.isDirectory,t[60]=n.data.path,t[61]=oe):oe=t[61];let se;t[62]!==H||t[63]!==n?(se=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(De,{onSelect:()=>n.edit(),testId:`file-explorer-rename-menu-item`}),(0,$.jsx)(Pe,{onSelect:H,testId:`file-explorer-duplicate-menu-item`})]}),t[62]=H,t[63]=n,t[64]=se):se=t[64];let ce;t[65]===n.data.path?ce=t[66]:(ce=async()=>{await qe(n.data.path),He({title:`Copied to clipboard`})},t[65]=n.data.path,t[66]=ce);let le;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(wt,{className:de}),t[67]=le):le=t[67];let ue;t[68]===ce?ue=t[69]:(ue=(0,$.jsxs)(F,{onSelect:ce,"data-testid":`file-explorer-copy-path-menu-item`,children:[le,`Copy path`]}),t[68]=ce,t[69]=ue);let fe;t[70]!==n.data.isPrimaryRoot||t[71]!==n.data.isRoot||t[72]!==n.data.path||t[73]!==S?(fe=S&&n.data.isPrimaryRoot&&!n.data.isRoot&&(0,$.jsxs)(F,{onSelect:async()=>{let e=S.getPrimaryRelativePath(n.data.path);e!==null&&(await qe(e),He({title:`Copied to clipboard`}))},"data-testid":`file-explorer-copy-relative-path-menu-item`,children:[(0,$.jsx)(wt,{className:`h-3.5 w-3.5 mr-2`}),`Copy relative path`]}),t[70]=n.data.isPrimaryRoot,t[71]=n.data.isRoot,t[72]=n.data.path,t[73]=S,t[74]=fe):fe=t[74];let pe;t[75]!==d||t[76]!==y||t[77]!==n.data?(pe=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsxs)(F,{onSelect:()=>{let{path:e}=n.data,t=xn[d](e);y(t)},"data-testid":`file-explorer-insert-snippet-menu-item`,children:[(0,$.jsx)(ae,{className:`h-3.5 w-3.5 mr-2`}),`Insert snippet for reading file`]}),(0,$.jsxs)(F,{onSelect:async()=>{He({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:e}=n.data,t=xn[d](e);await qe(t)},"data-testid":`file-explorer-copy-snippet-menu-item`,children:[(0,$.jsx)(x,{className:`h-3.5 w-3.5 mr-2`}),`Copy snippet for reading file`]})]}),t[75]=d,t[76]=y,t[77]=n.data,t[78]=pe):pe=t[78];let me;t[79]!==T||t[80]!==n.data.isMarimoFile||t[81]!==n.data.isPrimaryRoot?(me=n.data.isMarimoFile&&n.data.isPrimaryRoot&&!k()&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsxs)(F,{onSelect:T,"data-testid":`file-explorer-open-notebook-menu-item`,children:[(0,$.jsx)(Tt,{className:`h-3.5 w-3.5 mr-2`}),`Open notebook`]})]}),t[79]=T,t[80]=n.data.isMarimoFile,t[81]=n.data.isPrimaryRoot,t[82]=me):me=t[82];let ge;t[83]!==c||t[84]!==n.data.isDirectory||t[85]!==n.data.name||t[86]!==n.data.path?(ge=!n.data.isDirectory&&!c&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsxs)(F,{onSelect:async()=>{await fn(n.data.path,n.data.name)},"data-testid":`file-explorer-download-menu-item`,children:[(0,$.jsx)(B,{className:`h-3.5 w-3.5 mr-2`}),`Download`]})]}),t[83]=c,t[84]=n.data.isDirectory,t[85]=n.data.name,t[86]=n.data.path,t[87]=ge):ge=t[87];let _e;t[88]!==O||t[89]!==n.data.isRoot?(_e=!n.data.isRoot&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(I,{}),(0,$.jsx)(Ne,{onSelect:O,testId:`file-explorer-delete-menu-item`})]}),t[88]=O,t[89]=n.data.isRoot,t[90]=_e):_e=t[90];let xe;t[91]!==Z||t[92]!==ie||t[93]!==oe||t[94]!==se||t[95]!==ue||t[96]!==fe||t[97]!==pe||t[98]!==me||t[99]!==ge||t[100]!==_e?(xe=(0,$.jsxs)(je,{testId:`file-explorer-more-button`,iconClassName:`w-5 h-5`,children:[Z,ie,oe,se,ue,fe,pe,me,ge,_e]}),t[91]=Z,t[92]=ie,t[93]=oe,t[94]=se,t[95]=ue,t[96]=fe,t[97]=pe,t[98]=me,t[99]=ge,t[100]=_e,t[101]=xe):xe=t[101];let Se;t[102]!==te||t[103]!==X||t[104]!==re||t[105]!==xe?(Se=(0,$.jsxs)(`span`,{className:te,children:[X,re,xe]}),t[102]=te,t[103]=X,t[104]=re,t[105]=xe,t[106]=Se):Se=t[106];let Ce;return t[107]!==o||t[108]!==a||t[109]!==G||t[110]!==K||t[111]!==q||t[112]!==Se||t[113]!==U?(Ce=(0,$.jsxs)(`div`,{style:a,ref:o,...U,className:W,draggable:G,onClick:K,children:[q,Se]}),t[107]=o,t[108]=a,t[109]=G,t[110]=K,t[111]=q,t[112]=Se,t[113]=U,t[114]=Ce):Ce=t[114],Ce},zn=e=>{let t=(0,Dt.c)(3),{node:n}=e;if(!n.data.isDirectory){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`w-4 h-4 shrink-0`}),t[0]=e):e=t[0],e}let r;return t[1]===n.isOpen?r=t[2]:(r=(0,$.jsx)(ce,{isExpanded:n.isOpen,className:`w-4 h-4`}),t[1]=n.isOpen,t[2]=r),r};function Bn(e,t){e.stopPropagation(),e.preventDefault(),gt(t)}function Vn(e,t){return e.getDisplayPath(t)}function Hn(e,t){if(t)return e;let n=[];for(let r of e){if(!r.isRoot&&Un(r.name))continue;let e=r;if(r.children){let n=Hn(r.children,t);n!==r.children&&(e={...r,children:n})}n.push(e)}return n}function Un(e){return!!e.startsWith(`.`)}function Wn(e,t){return e.some(e=>e.id===t||(e.children?Wn(e.children,t):!1))}function Gn(){return null}function Kn(e){return e.isRoot}function qn(e){return e.data.isRoot}function Jn(e){let{parentNode:t,dragNodes:n}=e;return n.some(qn)||(t?!t.data.isDirectory:!1)}var Yn=e=>{let t=(0,Dt.c)(44),{height:n}=e,i=r(vn),[a,o]=(0,Q.useState)(null),s;t[0]===i?s=t[1]:(s=e=>Xn(e,i.getPrimaryRootPath()),t[0]=i,t[1]=s);let c=s,l;t[2]===i?l=t[3]:(l=e=>i.refreshPath(e),t[2]=i,t[3]=l);let u=l,d;t[4]===i?d=t[5]:(d=e=>Vn(i,e),t[4]=i,t[5]=d);let f,p;t[6]===c?(f=t[7],p=t[8]):(f=e=>o(c(e)),p=e=>o(c(e)),t[6]=c,t[7]=f,t[8]=p);let m,h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>o(null),h=()=>o(null),t[9]=m,t[10]=h):(m=t[9],h=t[10]);let g;t[11]!==c||t[12]!==u||t[13]!==d||t[14]!==f||t[15]!==p?(g={noClick:!0,noKeyboard:!0,destinationPath:c,getDestinationLabel:d,refreshDestination:u,onDragEnter:f,onDragOver:p,onDragLeave:m,onUploadStart:h},t[11]=c,t[12]=u,t[13]=d,t[14]=f,t[15]=p,t[16]=g):g=t[16];let{getRootProps:_,getInputProps:v,isDragActive:y}=Tn(g),b;t[17]!==a||t[18]!==i?(b=a??i.getPrimaryRootPath(),t[17]=a,t[18]=i,t[19]=b):b=t[19];let x=b,S;t[20]!==x||t[21]!==i?(S=Vn(i,x),t[20]=x,t[21]=i,t[22]=S):S=t[22];let C=S,w;t[23]===_?w=t[24]:(w=_(),t[23]=_,t[24]=w);let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=j(`flex flex-col overflow-hidden relative`),t[25]=T):T=t[25];let E;t[26]===n?E=t[27]:(E={height:n},t[26]=n,t[27]=E);let D;t[28]===v?D=t[29]:(D=v(),t[28]=v,t[29]=D);let O;t[30]===D?O=t[31]:(O=(0,$.jsx)(`input`,{...D}),t[30]=D,t[31]=O);let k;t[32]!==C||t[33]!==y?(k=y&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-start justify-center pt-3 bg-accent/20 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none`,children:(0,$.jsxs)(`span`,{className:`px-3 py-1.5 rounded-md bg-background/95 border shadow-sm text-sm font-semibold text-primary`,children:[`Drop files into `,C]})}),t[32]=C,t[33]=y,t[34]=k):k=t[34];let A=y?x:null,M;t[35]!==n||t[36]!==A?(M=(0,$.jsx)(Pn,{height:n,externalDropDestinationPath:A}),t[35]=n,t[36]=A,t[37]=M):M=t[37];let N;return t[38]!==w||t[39]!==E||t[40]!==O||t[41]!==k||t[42]!==M?(N=(0,$.jsx)(dn,{children:(0,$.jsxs)(`div`,{...w,className:T,style:E,children:[O,k,M]})}),t[38]=w,t[39]=E,t[40]=O,t[41]=k,t[42]=M,t[43]=N):N=t[43],N};function Xn(e,t){return Array.isArray(e)?t:On(e.target,t)}var Zn=()=>{let e=(0,Dt.c)(40),{ref:n,height:i}=tt(),a=i===void 0?500:i,[o,s]=t(_t),c=r(d).length,l=h(`storage`),u;bb0:{if(!o.hasUserInteracted&&c>0){if(o.openSections.includes(`remote-storage`)){u=o.openSections;break bb0}let t;e[0]===o.openSections?t=e[1]:(t=[...o.openSections,`remote-storage`],e[0]=o.openSections,e[1]=t),u=t;break bb0}u=o.openSections}let f=u,p;e[2]===s?p=e[3]:(p=e=>{s({openSections:e,hasUserInteracted:!0})},e[2]=s,e[3]=p);let m=p,g=a-66,_;e[4]===f?_=e[5]:(_=f.includes(`remote-storage`),e[4]=f,e[5]=_);let v=_,y=l.length>0,b;e[6]!==f||e[7]!==v?(b=v&&f.includes(`files`),e[6]=f,e[7]=v,e[8]=b):b=e[8];let x=b,S;e[9]!==g||e[10]!==x?(S=x?Math.round(g*.4):g,e[9]=g,e[10]=x,e[11]=S):S=e[11];let C=S,w=Math.max(200,x?g-C:g),T;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(Se,{className:`w-4 h-4`}),e[12]=T):T=e[12];let E;e[13]===c?E=e[14]:(E=c>0&&(0,$.jsx)(st,{children:c}),e[13]=c,e[14]=E);let D;e[15]!==l.length||e[16]!==y?(D=y&&(0,$.jsx)(pt,{count:l.length,type:`storage`}),e[15]=l.length,e[16]=y,e[17]=D):D=e[17];let O;e[18]!==E||e[19]!==D?(O=(0,$.jsxs)(ct,{children:[T,` Remote storage`,E,D]}),e[18]=E,e[19]=D,e[20]=O):O=e[20];let k;e[21]===C?k=e[22]:(k={maxHeight:C},e[21]=C,e[22]=k);let A;e[23]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(rn,{}),e[23]=A):A=e[23];let j;e[24]===k?j=e[25]:(j=(0,$.jsx)(lt,{className:`overflow-auto`,style:k,children:A}),e[24]=k,e[25]=j);let M;e[26]!==j||e[27]!==O?(M=(0,$.jsxs)(dt,{value:`remote-storage`,children:[O,j]}),e[26]=j,e[27]=O,e[28]=M):M=e[28];let P;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsxs)(ct,{children:[(0,$.jsx)(xe,{className:`w-4 h-4`}),`Files`]}),e[29]=P):P=e[29];let F;e[30]===w?F=e[31]:(F=(0,$.jsxs)(dt,{value:`files`,children:[P,(0,$.jsx)(lt,{children:(0,$.jsx)(Yn,{height:w})})]}),e[30]=w,e[31]=F);let I;e[32]!==m||e[33]!==f||e[34]!==M||e[35]!==F?(I=(0,$.jsxs)(N,{type:`multiple`,value:f,onValueChange:m,children:[M,F]}),e[32]=m,e[33]=f,e[34]=M,e[35]=F,e[36]=I):I=e[36];let L;return e[37]!==n||e[38]!==I?(L=(0,$.jsx)(`div`,{ref:n,className:`h-full overflow-auto`,children:I}),e[37]=n,e[38]=I,e[39]=L):L=e[39],L};export{Zn as default,Xn as getUploadDestinationForEvent};
@@ -1 +1 @@
1
- import{Qi as e}from"./cells-DyE9dSiM.js";import{t}from"./cn-ldLVeaqm.js";import{t as n}from"./jsx-runtime-B74pBk57.js";import{t as r}from"./createLucideIcon-B7HeEoG2.js";import{n as i,t as a}from"./file-headphone-rFCxFRI8.js";import{t as o}from"./file-DF8n85RA.js";import{t as s}from"./image-ab13yGv4.js";var c=r(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),l=r(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),u=r(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),d=r(`folder-archive`,[[`circle`,{cx:`15`,cy:`19`,r:`2`,key:`u2pros`}],[`path`,{d:`M20.9 19.8A2 2 0 0 0 22 18V8a2 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 2h5.1`,key:`1jj40k`}],[`path`,{d:`M15 11v-1`,key:`cntcp`}],[`path`,{d:`M15 17v-2`,key:`1279jj`}]]),f=r(`folder`,[[`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`}]]),p=n(),m={py:`python`,txt:`text`,md:`text`,qmd:`text`,log:`text`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,svg:`image`,webp:`image`,csv:`data`,parquet:`data`,arrow:`data`,xlsx:`data`,json:`json`,js:`code`,ts:`code`,tsx:`code`,html:`code`,css:`code`,toml:`code`,yaml:`code`,yml:`code`,wasm:`code`,mp3:`audio`,m4a:`audio`,ogg:`audio`,wav:`audio`,mp4:`video`,m4v:`video`,mpeg:`video`,webm:`video`,mkv:`video`,pdf:`pdf`,zip:`zip`,tar:`zip`,gz:`zip`};function h(e){let t=e.split(`.`).pop()?.toLowerCase();return t?m[t]??`unknown`:`unknown`}var g={directory:f,python:c,code:c,json:i,text:e,image:s,audio:a,video:l,data:u,pdf:e,zip:d,unknown:o},_={directory:`text-amber-500`,python:`text-blue-500`,code:`text-blue-500`,json:`text-blue-500`,text:`text-muted-foreground`,image:`text-purple-500`,audio:`text-orange-500`,video:`text-orange-500`,data:`text-green-500`,pdf:`text-red-500`,zip:`text-muted-foreground`,unknown:`text-muted-foreground`};function v(e,n){let r=h(e),i=g[r],a=_[r];return(0,p.jsx)(i,{className:t(`h-3.5 w-3.5 shrink-0`,a,n)})}export{f as a,v as i,_ as n,h as r,g as t};
1
+ import{Qi as e}from"./cells-BEcungGa.js";import{t}from"./cn-ldLVeaqm.js";import{t as n}from"./jsx-runtime-B74pBk57.js";import{t as r}from"./createLucideIcon-B7HeEoG2.js";import{n as i,t as a}from"./file-headphone-rFCxFRI8.js";import{t as o}from"./file-DF8n85RA.js";import{t as s}from"./image-ab13yGv4.js";var c=r(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),l=r(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),u=r(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),d=r(`folder-archive`,[[`circle`,{cx:`15`,cy:`19`,r:`2`,key:`u2pros`}],[`path`,{d:`M20.9 19.8A2 2 0 0 0 22 18V8a2 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 2h5.1`,key:`1jj40k`}],[`path`,{d:`M15 11v-1`,key:`cntcp`}],[`path`,{d:`M15 17v-2`,key:`1279jj`}]]),f=r(`folder`,[[`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`}]]),p=n(),m={py:`python`,txt:`text`,md:`text`,qmd:`text`,log:`text`,png:`image`,jpg:`image`,jpeg:`image`,gif:`image`,svg:`image`,webp:`image`,csv:`data`,parquet:`data`,arrow:`data`,xlsx:`data`,json:`json`,js:`code`,ts:`code`,tsx:`code`,html:`code`,css:`code`,toml:`code`,yaml:`code`,yml:`code`,wasm:`code`,mp3:`audio`,m4a:`audio`,ogg:`audio`,wav:`audio`,mp4:`video`,m4v:`video`,mpeg:`video`,webm:`video`,mkv:`video`,pdf:`pdf`,zip:`zip`,tar:`zip`,gz:`zip`};function h(e){let t=e.split(`.`).pop()?.toLowerCase();return t?m[t]??`unknown`:`unknown`}var g={directory:f,python:c,code:c,json:i,text:e,image:s,audio:a,video:l,data:u,pdf:e,zip:d,unknown:o},_={directory:`text-amber-500`,python:`text-blue-500`,code:`text-blue-500`,json:`text-blue-500`,text:`text-muted-foreground`,image:`text-purple-500`,audio:`text-orange-500`,video:`text-orange-500`,data:`text-green-500`,pdf:`text-red-500`,zip:`text-muted-foreground`,unknown:`text-muted-foreground`};function v(e,n){let r=h(e),i=g[r],a=_[r];return(0,p.jsx)(i,{className:t(`h-3.5 w-3.5 shrink-0`,a,n)})}export{f as a,v as i,_ as n,h as r,g as t};