@marimo-team/frontend 0.23.9-dev33 → 0.23.9-dev36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{CellStatus-Dm3YCiM6.js → CellStatus-D_6Kac7g.js} +1 -1
- package/dist/assets/{ConnectedDataExplorerComponent-CduY7ZLg.js → ConnectedDataExplorerComponent-DJhqEvUc.js} +1 -1
- package/dist/assets/{JsonOutput-DzATTBoP.js → JsonOutput-H6HB87kK.js} +12 -12
- package/dist/assets/{MarimoErrorOutput-XPsNfvEO.js → MarimoErrorOutput-d8qLIXHx.js} +2 -2
- package/dist/assets/{RenderHTML-BvW-obUg.js → RenderHTML-CBsvWTjU.js} +1 -1
- package/dist/assets/{RunButton-BUq1ZIzv.js → RunButton-BpQQEGB4.js} +1 -1
- package/dist/assets/{add-cell-with-ai-C4H664zc.js → add-cell-with-ai-Df5gxolt.js} +1 -1
- package/dist/assets/{add-connection-dialog-DdJBM1-Q.js → add-connection-dialog-gM0QtdYy.js} +1 -1
- package/dist/assets/{agent-panel-BB1ZRQse.js → agent-panel-CJcG1enH.js} +1 -1
- package/dist/assets/{ai-model-dropdown-9UrkfG-1.js → ai-model-dropdown-M1IdPOVK.js} +4 -4
- package/dist/assets/{app-config-button-N_G5k5XW.js → app-config-button-CiN27Nmp.js} +1 -1
- package/dist/assets/cell-editor-CNmFerQl.js +20 -0
- package/dist/assets/{cell-link-Bkd6QnOS.js → cell-link-BEtbRN19.js} +1 -1
- package/dist/assets/{cells-BP6kg4iF.js → cells-BXZ3FSp9.js} +2 -2
- package/dist/assets/{chat-display-76m4LMD2.js → chat-display-BFLNH0B7.js} +1 -1
- package/dist/assets/{chat-panel-BAIgHYyO.js → chat-panel-C2Ky6IBI.js} +1 -1
- package/dist/assets/{chat-ui-BggP20am.js → chat-ui-B7g-u_qk.js} +1 -1
- package/dist/assets/{column-preview-9_vf_vQt.js → column-preview-DDR-SBCD.js} +1 -1
- package/dist/assets/{command-palette-drFTNlvg.js → command-palette-C0bO32IA.js} +1 -1
- package/dist/assets/{common-G2mwxgr_.js → common-DeA5uNL9.js} +1 -1
- package/dist/assets/{components-D2tmc0KN.js → components-Cng4XB_w.js} +1 -1
- package/dist/assets/{components-DvggA56E.js → components-CpiEO4PD.js} +1 -1
- package/dist/assets/{config-hed0CaQL.js → config-BG-ACF7_.js} +1 -1
- package/dist/assets/{datasource-BjfZ5rCV.js → datasource-WRQecO8l.js} +1 -1
- package/dist/assets/{dependency-graph-panel-BQlFSqu5.js → dependency-graph-panel-DxriiKwj.js} +1 -1
- package/dist/assets/{documentation-panel-BbVMQHz5.js → documentation-panel-CWdrQzu5.js} +1 -1
- package/dist/assets/{download-DrC3sFE3.js → download-96wP8V0p.js} +1 -1
- package/dist/assets/{edit-page-ClIQhScA.js → edit-page-CvlbW4P0.js} +6 -6
- package/dist/assets/{error-panel-aaHrLkBh.js → error-panel-8XzSuC1I.js} +1 -1
- package/dist/assets/{file-explorer-panel-BQ9nMxks.js → file-explorer-panel-a5ksD489.js} +3 -3
- package/dist/assets/{file-icons-pUZ3DUy5.js → file-icons-CVihyOvq.js} +1 -1
- package/dist/assets/{floating-outline-CDjyi71K.js → floating-outline-Cvm2qN8K.js} +1 -1
- package/dist/assets/{focus-D2kXD_rc.js → focus-DDYdCBX6.js} +1 -1
- package/dist/assets/{form-COQrUWdR.js → form-DLzm3BCq.js} +1 -1
- package/dist/assets/{glide-data-editor-7_pHQtPX.js → glide-data-editor-Dg0e0Gop.js} +1 -1
- package/dist/assets/{globals-Dd7eo1nD.js → globals-CYbHM4QS.js} +1 -1
- package/dist/assets/{home-page-DNFOElFw.js → home-page-uHyo5m6a.js} +1 -1
- package/dist/assets/{hooks-DjKf5pQ9.js → hooks-DuLk_j3D.js} +1 -1
- package/dist/assets/{html-to-image-EYrNFuGt.js → html-to-image-Nf7ijTtQ.js} +1 -1
- package/dist/assets/{index-DsF3qFAR.js → index-Bld_cdN5.js} +5 -5
- package/dist/assets/{kiosk-mode-Ht1DwVD4.js → kiosk-mode-Do8_sps4.js} +1 -1
- package/dist/assets/{layout-CwCyg6Oq.js → layout-BLEM1ssf.js} +3 -3
- package/dist/assets/{logs-panel-8V1eZbE7.js → logs-panel-5n3ctE2J.js} +1 -1
- package/dist/assets/{markdown-renderer-d9Lol4Mr.js → markdown-renderer-C4nMzmEI.js} +1 -1
- package/dist/assets/{mermaid-DAflnvW9.js → mermaid-C1kGbsPj.js} +1 -1
- package/dist/assets/{name-cell-input-DDR4EexG.js → name-cell-input-Cj_BDNnx.js} +1 -1
- package/dist/assets/{outline-panel-B-fr1jRf.js → outline-panel-xSNPEqmX.js} +1 -1
- package/dist/assets/{packages-panel-B4MR9Vnv.js → packages-panel-CXxRJgcn.js} +1 -1
- package/dist/assets/{pair-with-agent-modal-Derso4uY.js → pair-with-agent-modal-Cg38WIJM.js} +1 -1
- package/dist/assets/{panels-DsbaLR3B.js → panels-GDG1qxPv.js} +1 -1
- package/dist/assets/{process-output-CJeKhzqO.js → process-output-CExje38p.js} +1 -1
- package/dist/assets/{radio-group-cvI-M2aa.js → radio-group-BgIE4hAy.js} +1 -1
- package/dist/assets/{readonly-python-code-BmZ0KZKm.js → readonly-python-code-Cmj3Lveo.js} +1 -1
- package/dist/assets/renderShortcut-CUc_HCHW.js +1 -0
- package/dist/assets/{reveal-component-Bff44fKv.js → reveal-component-C34NH9Hx.js} +1 -1
- package/dist/assets/{run-page-4im7P8v3.js → run-page-NpRrbT0Y.js} +1 -1
- package/dist/assets/{scratchpad-panel-BFvydb89.js → scratchpad-panel-B3GWgvFG.js} +1 -1
- package/dist/assets/{session-panel-CwggjKWr.js → session-panel-DuKsSNdR.js} +1 -1
- package/dist/assets/{snippets-panel-BmWXl5GE.js → snippets-panel-BlHGRNIg.js} +1 -1
- package/dist/assets/{state-d_LoPKHg.js → state-Bt-mCXoz.js} +1 -1
- package/dist/assets/{state-G8Xj60GT.js → state-DUrsoPal.js} +3 -3
- package/dist/assets/{switch-YcZLs0mS.js → switch-Z7gfNPvp.js} +1 -1
- package/dist/assets/{terminal-BydBi1dE.js → terminal-ChwnouBc.js} +1 -1
- package/dist/assets/{textarea-DV6LIVoz.js → textarea-CMdRAIqd.js} +1 -1
- package/dist/assets/{tracing-CvLPM0Wh.js → tracing-CProSFdv.js} +1 -1
- package/dist/assets/{tracing-panel-iTdY5N_y.js → tracing-panel-7NGYhtTI.js} +2 -2
- package/dist/assets/{useBoolean-oqDq5zze.js → useBoolean-Begogf9u.js} +1 -1
- package/dist/assets/{useCellActionButton-CsyGJEYN.js → useCellActionButton-tt8ToMnj.js} +1 -1
- package/dist/assets/{useDeleteCell-BQA5MqKt.js → useDeleteCell-1tWVtBPJ.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-CIH_2h1J.js → useDependencyPanelTab-BRZy7_Yd.js} +1 -1
- package/dist/assets/{useHotkey-BtqYcnxQ.js → useHotkey-CvaNHTub.js} +1 -1
- package/dist/assets/{useNotebookActions-jRhy52S-.js → useNotebookActions-B-lHeeZb.js} +1 -1
- package/dist/assets/{useRunCells-rD6HJnx6.js → useRunCells-PwtrEJj7.js} +1 -1
- package/dist/assets/{useSplitCell-CqznVs7m.js → useSplitCell-B86fJI0_.js} +1 -1
- package/dist/assets/useTheme-DJn91dnL.js +1 -0
- package/dist/assets/utils-Df7TLCkF.js +1 -0
- package/dist/assets/{vega-component-DOlcjhuV.js → vega-component-BcDGvncM.js} +1 -1
- package/dist/index.html +29 -29
- package/package.json +1 -1
- package/src/components/app-config/ai-config.tsx +74 -15
- package/src/components/chat/chat-panel.tsx +2 -2
- package/src/components/data-table/__tests__/header-items.test.tsx +220 -10
- package/src/components/data-table/column-header.tsx +17 -12
- package/src/components/data-table/header-items.tsx +40 -16
- package/src/components/editor/actions/useCellActionButton.tsx +3 -3
- package/src/components/editor/cell/code/cell-editor.tsx +7 -4
- package/src/components/editor/chrome/types.ts +13 -6
- package/src/components/editor/chrome/wrapper/app-chrome.tsx +6 -4
- package/src/components/editor/chrome/wrapper/footer-items/ai-status.tsx +10 -1
- package/src/components/editor/chrome/wrapper/sidebar.tsx +7 -5
- package/src/components/editor/errors/auto-fix.tsx +3 -3
- package/src/components/editor/navigation/__tests__/navigation.test.ts +15 -0
- package/src/components/editor/navigation/navigation.ts +5 -0
- package/src/components/editor/output/MarimoTracebackOutput.tsx +4 -3
- package/src/components/editor/renderers/cell-array.tsx +27 -24
- package/src/core/config/__tests__/config-schema.test.ts +2 -0
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/config/config.ts +16 -0
- package/dist/assets/cell-editor-B-9MV21_.js +0 -20
- package/dist/assets/renderShortcut-CzUfgpdJ.js +0 -1
- package/dist/assets/useTheme-KJ1rGmnj.js +0 -1
- package/dist/assets/utils-Bok_hGT2.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as i}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as l}from"./react-Bj1aDYRI.js";import{A as a}from"./cells-
|
|
1
|
+
import{s as i}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as l}from"./react-Bj1aDYRI.js";import{A as a}from"./cells-BXZ3FSp9.js";import"./react-dom-CSu739Rf.js";import{t as s}from"./compiler-runtime-B3qBwwSJ.js";import{t as c}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{t as d}from"./createLucideIcon-D5guW7EU.js";import{t as h}from"./MarimoErrorOutput-d8qLIXHx.js";import"./dist-CBSMxaO_.js";import"./dist-CpTFpfm_.js";import"./dist-B1U1kGCR.js";import"./dist-ChF5Ln9c.js";import"./dist-CPczQFlJ.js";import"./session-0B5NBztP.js";import"./purify.es-B9KxLTTS.js";import{n as f}from"./cell-link-BEtbRN19.js";import{t as n}from"./empty-state-Cjt8SfMh.js";var x=d("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"}]]),y=s();l();var r=i(c(),1),k=()=>{let t=(0,y.c)(5),m=a();if(m.length===0){let p;return t[0]===Symbol.for("react.memo_cache_sentinel")?(p=(0,r.jsx)(n,{title:"No errors!",icon:(0,r.jsx)(x,{})}),t[0]=p):p=t[0],p}let o;t[1]===m?o=t[2]:(o=m.map(u),t[1]=m,t[2]=o);let e;return t[3]===o?e=t[4]:(e=(0,r.jsx)("div",{className:"flex flex-col h-full overflow-auto",children:o}),t[3]=o,t[4]=e),e};function u(t){return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"text-xs font-mono font-semibold bg-muted border-y px-2 py-1",children:(0,r.jsx)(f,{cellId:t.cellId})}),(0,r.jsx)("div",{className:"px-2",children:(0,r.jsx)(h,{errors:t.output.data,cellId:t.cellId},t.cellId)},t.cellId)]},t.cellId)}export{k as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as qe}from"./chunk-LvLJmgfZ.js";import{i as It,l as ke,n as ee,p as Ue,u as ye}from"./useEvent-D91BmmQi.js";import{t as At}from"./react-Bj1aDYRI.js";import{D as Et,Fn as We,Oi as Ge,vr as Rt,wi as Ht,wr as Lt}from"./cells-
|
|
1
|
+
import{s as qe}from"./chunk-LvLJmgfZ.js";import{i as It,l as ke,n as ee,p as Ue,u as ye}from"./useEvent-D91BmmQi.js";import{t as At}from"./react-Bj1aDYRI.js";import{D as Et,Fn as We,Oi as Ge,vr as Rt,wi as Ht,wr as Lt}from"./cells-BXZ3FSp9.js";import"./react-dom-CSu739Rf.js";import{t as fe}from"./compiler-runtime-B3qBwwSJ.js";import{_ as Me}from"./useEventListener-DvoEXWke.js";import{t as Vt}from"./invariant-BUdrueMv.js";import{f as Je,h as Bt}from"./utils-Df7TLCkF.js";import{T as _e}from"./config-BG-ACF7_.js";import{t as ie}from"./cn-DCUzRj2J.js";import{t as qt}from"./jsx-runtime-BqBOg78p.js";import"./fullscreen-eipL3i3Y.js";import{n as Ut}from"./multi-map-CUuNtzHt.js";import{o as Wt}from"./alert-dialog-BqFLkbUc.js";import"./popover-Bz_0Vkyf.js";import{a as R,c as ue,p as Gt,r as Jt,t as Kt}from"./dropdown-menu-CR7cnzLX.js";import{a as Yt,i as Ke,o as Fe,wt as De}from"./JsonOutput-H6HB87kK.js";import{c as Xt,h as Zt,i as ze,r as Ce}from"./download-96wP8V0p.js";import{r as Ye}from"./radio-group-BgIE4hAy.js";import{t as H}from"./tooltip-DTV9tlSr.js";import{n as Qt,t as A}from"./button-BbCh-29a.js";import{St as ea}from"./dist-BrR4M-k3.js";import"./cjs-BRGiG41H.js";import"./main-B0OX4z33.js";import"./useNonce-DfoVjkkH.js";import{n as ta,r as Pe}from"./requests-DIwGYs0l.js";import{t as re}from"./createLucideIcon-D5guW7EU.js";import{a as Xe,c as Ze,i as Qe,n as Se,o as Oe,r as aa,t as na}from"./state-DTislnZA.js";import{n as ra}from"./LazyAnyLanguageCodeMirror-BEvXb3VX.js";import{t as sa}from"./x-C-6liIBr.js";import{n as Te}from"./markdown-renderer-C4nMzmEI.js";import{u as la}from"./toDate-B5A0DFEz.js";import{t as et}from"./copy-BwrPA9zQ.js";import{t as $e}from"./external-link-BTNxSavU.js";import{a as oa,i as tt,n as at,r as ia,t as ca}from"./file-icons-CVihyOvq.js";import{t as nt}from"./file-BrdxGLRX.js";import{i as rt,r as da,t as st}from"./add-connection-dialog-gM0QtdYy.js";import{n as Ie,t as ma}from"./spinner-Bhir8k53.js";import{a as pa,c as ha,d as xa,f as fa,i as ua,l as ya,n as ja,r as ga,t as ba,u as va}from"./file-name-input-BNHbCr1E.js";import{t as lt}from"./plus-BgB18UzY.js";import{t as ot}from"./refresh-cw-DHwG4Mac.js";import{t as wa}from"./save-Clg5dMoP.js";import{t as Na}from"./triangle-alert-D2p96PEF.js";import{n as ka,t as _a}from"./es-DGgq-Wes.js";import"./dist-CBSMxaO_.js";import"./dist-CpTFpfm_.js";import"./dist-B1U1kGCR.js";import"./dist-ChF5Ln9c.js";import"./dist-CPczQFlJ.js";import{t as te}from"./use-toast-IPAtJGea.js";import{t as Fa}from"./paths-D5zczhUD.js";import"./session-0B5NBztP.js";import"./purify.es-B9KxLTTS.js";import"./dates-CTxr0EqQ.js";import{n as je}from"./copy-LK56fFow.js";import{t as Ca}from"./copy-icon-OjtDb4gO.js";import{t as it}from"./context-QkTujrKn.js";import{n as ct}from"./ImperativeModal-B3Th7k4R.js";import{t as dt}from"./blob-Bgnx1kuY.js";import"./utils-DCL4n9wx.js";import"./vega-loader.browser-C8wT63Va.js";import"./defaultLocale-BLUna9fQ.js";import"./defaultLocale-DzliDDTm.js";import{n as Sa,t as Ma}from"./alert-yTS3WpF4.js";import{n as mt}from"./error-banner-LdWZDbqd.js";import"./chunk-5FQGJX7Z-D9iBG0F7.js";import"./html-to-image-Nf7ijTtQ.js";import{o as Da}from"./focus-DDYdCBX6.js";import{n as Ae}from"./useAsyncData-bgszE9F0.js";import"./react-resizable-panels.browser.esm-CV8-hvjx.js";import{a as za,d as Pa,o as pt,t as Oa}from"./command-KARR7KMq.js";import{a as Ta}from"./renderShortcut-CUc_HCHW.js";import{t as $a}from"./bundle.esm-DjhGJy4I.js";import{i as Ee,n as Ia,r as ht,t as ge}from"./tree-actions-BM_EJr3E.js";import{a as Aa}from"./components-CpiEO4PD.js";import{n as Ea}from"./pathUtils-CJjndqMI.js";import{n as Ra}from"./semaphore-FlZezxaf.js";import{t as Ha}from"./empty-state-Cjt8SfMh.js";import{t as Re}from"./formatting-CSG9kqNb.js";import{a as La,i as Va,n as xt,r as ft,t as ut}from"./components-Cng4XB_w.js";import{n as yt,t as Ba}from"./marimo-icons-CiwvnnsT.js";import{t as qa}from"./links-1rtF1-eC.js";var Ua=re("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"}]]),Wa=re("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"}]]),jt=re("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"}]]),Ga=re("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"}]]),gt=re("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"}]]),bt=re("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"}]]),Ja=re("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"}]]),vt=re("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"}]]),$=qe(At(),1),Ka=fe(),a=qe(qt(),1);const wt=t=>{let e=(0,Ka.c)(17),{filename:n,filenameIcon:i,onBack:o,onRefresh:r,onDownload:d,actions:c}=t,x;e[0]===o?x=e[1]:(x=o&&(0,a.jsx)(H,{content:"Back to file list",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:o,children:(0,a.jsx)(Ze,{className:"h-4 w-4"})})}),e[0]=o,e[1]=x);let s;e[2]!==n||e[3]!==i?(s=n?(0,a.jsxs)("span",{className:"flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate",children:[i,n]}):(0,a.jsx)("span",{className:"flex-1"}),e[2]=n,e[3]=i,e[4]=s):s=e[4];let y;e[5]===r?y=e[6]:(y=r&&(0,a.jsx)(H,{content:"Refresh",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:r,children:(0,a.jsx)(ot,{className:"h-3.5 w-3.5"})})}),e[5]=r,e[6]=y);let m;e[7]===d?m=e[8]:(m=d&&(0,a.jsx)(H,{content:"Download",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:d,children:(0,a.jsx)(De,{className:"h-3.5 w-3.5"})})}),e[7]=d,e[8]=m);let f;e[9]!==c||e[10]!==y||e[11]!==m?(f=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[y,c,m]}),e[9]=c,e[10]=y,e[11]=m,e[12]=f):f=e[12];let u;return e[13]!==x||e[14]!==s||e[15]!==f?(u=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[x,s,f]}),e[13]=x,e[14]=s,e[15]=f,e[16]=u):u=e[16],u};var Ya=new Set(["http","file","in-memory"]);function He(t){return JSON.stringify(t).slice(1,-1)}const Nt=[{id:"read-file",label:"Insert read snippet",icon:Ua,getCode:t=>{if(t.entry.kind==="directory")return null;let e=He(t.entry.path);return t.backendType==="obstore"?`_data = ${t.variableName}.get("${e}").bytes()
|
|
2
2
|
_data`:`_data = ${t.variableName}.cat_file("${e}")
|
|
3
3
|
_data`}},{id:"download-file",label:"Insert download snippet",icon:Ga,getCode:t=>{if(t.entry.kind==="directory")return null;let e=He(t.entry.path);if(t.backendType==="obstore")return Ya.has(t.protocol)?null:`from datetime import timedelta
|
|
4
4
|
from obstore import sign
|
|
@@ -7,7 +7,7 @@ signed_url = sign(
|
|
|
7
7
|
${t.variableName}, "GET", "${e}",
|
|
8
8
|
expires_in=timedelta(hours=1),
|
|
9
9
|
)
|
|
10
|
-
signed_url`;let n=He(t.entry.path.split("/").pop()||"download");return`${t.variableName}.get("${e}", "${n}")`}}];var Xa=100*1024*1024;function Za(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}const Qa=({entry:t,namespace:e,protocol:n,backendType:i,onBack:o})=>{let{locale:r}=it(),d=Ye(),c=Za(t.path),x=t.mimeType||"text/plain",s=_e(x),y=s&&t.size>Xa&&t.size>0,{data:m,isPending:f,error:u,refetch:g}=Ae(async()=>{if(y)return null;let p=await Oe.request({namespace:e,path:t.path,preview:!s});if(p.error)throw Error(p.error);if(!p.url)throw Error("No URL returned");if(s)return{type:"media",url:p.url};let b=await fetch(p.url);if(!b.ok)throw Error(`Failed to fetch preview: ${b.statusText}`);return{type:"text",content:await b.text()}},[e,t.path,s,y]),w=(0,$.useCallback)(async()=>{try{let p=await Oe.request({namespace:e,path:t.path});if(p.error){te({title:"Download failed",description:p.error,variant:"danger"});return}p.url&&ze(p.url,p.filename??c)}catch(p){Me.error("Failed to download storage entry",p),te({title:"Download failed",description:String(p),variant:"danger"})}},[e,t.path,c]),v=Nt.map(p=>{let b=p.getCode({variableName:e,protocol:n,entry:t,backendType:i});if(b===null)return null;let h=p.icon;return(0,a.jsx)(H,{content:p.label,children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:()=>d(b),"aria-label":p.label,children:(0,a.jsx)(h,{className:"h-3.5 w-3.5"})})},p.id)}),l=(0,a.jsx)(wt,{filename:c,filenameIcon:tt(c),onBack:o,onDownload:w,actions:v}),j=({includeMime:p=!1})=>(0,a.jsxs)("div",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs",children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Path"}),(0,a.jsxs)("div",{className:"truncate flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"font-mono text-[11px]",children:t.path}),(0,a.jsx)(Ca,{value:t.path,className:"h-3 w-3"})]}),p&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),p&&(0,a.jsx)("span",{children:x}),t.size>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Size"}),(0,a.jsx)("span",{children:Re(t.size,r)})]}),t.lastModified!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Modified"}),(0,a.jsx)("span",{children:new Date(t.lastModified*1e3).toLocaleString()})]})]});return y?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-muted-foreground italic",children:["File is too large to preview (",Re(t.size,r),")."]})]}):f?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({}),(0,a.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24",children:[(0,a.jsx)(Ie,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):u?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",u.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)(A,{variant:"secondary",size:"xs",onClick:g,children:[(0,a.jsx)(ot,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):m?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({}),(0,a.jsx)(Ke,{mimeType:x,contents:m.type==="text"?m.content:void 0,mediaSource:m.type==="media"?{url:m.url}:void 0})]}):(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(nt,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var Le=fe(),en=16;function se(t){return{paddingLeft:t*en}}function tn(t,e){return new Date(t*1e3).toLocaleDateString(e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function kt(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}function Ve(t,e,n,i){let o=n.toLowerCase();if(kt(t.path).toLowerCase().includes(o))return!0;if(t.kind==="directory"){let r=i.get(Xe(e,t.path));if(r)return r.some(d=>Ve(d,e,n,i))}return!1}function Ft(t,e,n,i){return n.trim()?t.filter(o=>Ve(o,e,n,i)):t}var an=t=>{let e=(0,Le.c)(36),{namespace:n,protocol:i,rootPath:o,backendType:r,prefix:d,depth:c,locale:x,searchValue:s,onOpenFile:y}=t,{entriesByPath:m}=Se(),{entries:f,isPending:u,error:g}=Qe(n,d);if(u){let l;e[0]===c?l=e[1]:(l=se(c),e[0]=c,e[1]=l);let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsx)(Ie,{className:"h-3 w-3 animate-spin"}),e[2]=j):j=e[2];let p;return e[3]===l?p=e[4]:(p=(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:l,children:[j,"Loading..."]}),e[3]=l,e[4]=p),p}if(g){let l;e[5]===c?l=e[6]:(l=se(c),e[5]=c,e[6]=l);let j;return e[7]!==g.message||e[8]!==l?(j=(0,a.jsxs)("div",{className:"py-1 text-xs text-destructive",style:l,children:["Failed to load: ",g.message]}),e[7]=g.message,e[8]=l,e[9]=j):j=e[9],j}if(f.length===0){let l;e[10]===c?l=e[11]:(l=se(c),e[10]=c,e[11]=l);let j;return e[12]===l?j=e[13]:(j=(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:l,children:"Empty"}),e[12]=l,e[13]=j),j}let w;if(e[14]!==r||e[15]!==f||e[16]!==c||e[17]!==m||e[18]!==x||e[19]!==n||e[20]!==y||e[21]!==i||e[22]!==o||e[23]!==s){let l=Ft(f,n,s,m),j;e[25]!==r||e[26]!==c||e[27]!==x||e[28]!==n||e[29]!==y||e[30]!==i||e[31]!==o||e[32]!==s?(j=p=>(0,a.jsx)(_t,{entry:p,namespace:n,protocol:i,rootPath:o,backendType:r,depth:c,locale:x,searchValue:s,onOpenFile:y},p.path),e[25]=r,e[26]=c,e[27]=x,e[28]=n,e[29]=y,e[30]=i,e[31]=o,e[32]=s,e[33]=j):j=e[33],w=l.map(j),e[14]=r,e[15]=f,e[16]=c,e[17]=m,e[18]=x,e[19]=n,e[20]=y,e[21]=i,e[22]=o,e[23]=s,e[24]=w}else w=e[24];let v;return e[34]===w?v=e[35]:(v=(0,a.jsx)(a.Fragment,{children:w}),e[34]=w,e[35]=v),v},_t=({entry:t,namespace:e,protocol:n,rootPath:i,backendType:o,depth:r,locale:d,searchValue:c,onOpenFile:x})=>{var b;let[s,y]=(0,$.useState)(!1),{entriesByPath:m}=Se(),f=Ye(),u=t.kind==="directory",g=kt(t.path),w=!!c.trim(),v=u&&w&&g.toLowerCase().includes(c.trim().toLowerCase()),l=u&&w&&!!((b=m.get(Xe(e,t.path)))!=null&&b.some(h=>Ve(h,e,c,m))),j=s||l,p=(0,$.useCallback)(async()=>{try{let h=await Oe.request({namespace:e,path:t.path});if(h.error){te({title:"Download failed",description:h.error,variant:"danger"});return}h.url&&ze(h.url,h.filename??"download")}catch(h){Me.error("Failed to download storage entry",h),te({title:"Download failed",description:String(h),variant:"danger"})}},[e,t.path]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(pt,{className:ie("text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5",u&&"font-medium"),style:se(r),value:`${e}:${t.path}`,onSelect:()=>{u?y(!j):x({entry:t,namespace:e,protocol:n,backendType:o})},children:[u?(0,a.jsx)(Ee,{isExpanded:j,className:"h-3 w-3"}):(0,a.jsx)("span",{className:"w-3 shrink-0"}),u?(0,a.jsx)(oa,{className:ie("h-3.5 w-3.5 shrink-0",at.directory)}):tt(g),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:g}),(0,a.jsxs)("div",{className:"flex items-center",children:[t.size>0&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums",children:Re(t.size,d)}),t.lastModified!=null&&(0,a.jsx)(H,{content:`Last modified: ${new Date(t.lastModified*1e3).toLocaleString()}`,children:(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap",children:tn(t.lastModified,d)})}),(0,a.jsxs)(Kt,{children:[(0,a.jsx)(Gt,{asChild:!0,children:(0,a.jsx)(Ia,{iconClassName:"h-3 w-3",onClick:h=>h.stopPropagation()})}),(0,a.jsxs)(Jt,{align:"end",onClick:h=>h.stopPropagation(),onCloseAutoFocus:h=>h.preventDefault(),children:[!u&&(0,a.jsxs)(R,{onSelect:()=>x({entry:t,namespace:e,protocol:n,backendType:o}),children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"View"]}),(0,a.jsxs)(R,{onSelect:async()=>{await je(t.path),te({title:"Copied to clipboard"})},children:[(0,a.jsx)(et,{className:ge}),"Copy path"]}),!u&&(0,a.jsxs)(R,{onSelect:()=>p(),children:[(0,a.jsx)(De,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{}),Nt.map(h=>{let k=h.getCode({variableName:e,protocol:n,entry:t,backendType:o});if(k===null)return null;let F=h.icon;return(0,a.jsxs)(R,{onSelect:()=>f(k),children:[(0,a.jsx)(F,{className:ge}),h.label]},h.id)})]})]})]})]}),u&&j&&(0,a.jsx)(an,{namespace:e,protocol:n,rootPath:i,backendType:o,prefix:t.path,depth:r+1,locale:d,searchValue:v?"":c,onOpenFile:x})]})},nn=t=>{let e=(0,Le.c)(43),{namespace:n,locale:i,searchValue:o,onOpenFile:r}=t,[d,c]=(0,$.useState)(!0),{entriesByPath:x}=Se(),{clearNamespaceCache:s}=aa(),y=n.name??n.displayName,{entries:m,isPending:f,error:u,refetch:g}=Qe(y),w;e[0]!==s||e[1]!==y||e[2]!==g?(w=p=>{p.stopPropagation(),s(y),g()},e[0]=s,e[1]=y,e[2]=g,e[3]=w):w=e[3];let v=w,l=f?n.storageEntries:m,j;if(e[4]!==l||e[5]!==x||e[6]!==u||e[7]!==v||e[8]!==d||e[9]!==f||e[10]!==i||e[11]!==n.backendType||e[12]!==n.displayName||e[13]!==n.name||e[14]!==n.protocol||e[15]!==n.rootPath||e[16]!==y||e[17]!==r||e[18]!==o){let p=Ft(l,y,o,x),b;e[20]===d?b=e[21]:(b=()=>c(!d),e[20]=d,e[21]=b);let h;e[22]===d?h=e[23]:(h=(0,a.jsx)(Ee,{isExpanded:d,className:"h-3 w-3"}),e[22]=d,e[23]=h);let k;e[24]===n.protocol?k=e[25]:(k=(0,a.jsx)(da,{protocol:n.protocol}),e[24]=n.protocol,e[25]=k);let F;e[26]===n.displayName?F=e[27]:(F=(0,a.jsx)("span",{children:n.displayName}),e[26]=n.displayName,e[27]=F);let _;e[28]===n.name?_=e[29]:(_=n.name&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground font-normal",children:["(",(0,a.jsx)(La,{variableName:n.name}),")"]}),e[28]=n.name,e[29]=_);let M;e[30]===v?M=e[31]:(M=(0,a.jsx)(ht,{onClick:v,tooltip:"Refresh storage connection",className:"p-0",iconClassName:"h-3 w-3"}),e[30]=v,e[31]=M);let D=n.rootPath||"(root)",C;e[32]===D?C=e[33]:(C=(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-normal tabular-nums ml-auto",children:D}),e[32]=D,e[33]=C);let S;e[34]!==n.name||e[35]!==C||e[36]!==b||e[37]!==h||e[38]!==k||e[39]!==F||e[40]!==_||e[41]!==M?(S=(0,a.jsxs)(pt,{value:n.name,onSelect:b,className:"flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none",children:[h,k,F,_,M,C]}),e[34]=n.name,e[35]=C,e[36]=b,e[37]=h,e[38]=k,e[39]=F,e[40]=_,e[41]=M,e[42]=S):S=e[42],j=(0,a.jsxs)(a.Fragment,{children:[S,d&&(0,a.jsxs)(a.Fragment,{children:[f&&l.length===0&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:se(1),children:[(0,a.jsx)(Ie,{className:"h-3 w-3 animate-spin"}),"Loading..."]}),u&&l.length===0&&(0,a.jsx)(Aa,{error:u,style:se(1),className:"py-1 text-xs h-auto overflow-auto max-h-32 items-start",showIcon:!1}),!f&&l.length===0&&!u&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No entries"}),o&&p.length===0&&l.length>0&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No matches"}),p.map(T=>(0,a.jsx)(_t,{entry:T,namespace:y,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:i,searchValue:o,onOpenFile:r},T.path))]})]}),e[4]=l,e[5]=x,e[6]=u,e[7]=v,e[8]=d,e[9]=f,e[10]=i,e[11]=n.backendType,e[12]=n.displayName,e[13]=n.name,e[14]=n.protocol,e[15]=n.rootPath,e[16]=y,e[17]=r,e[18]=o,e[19]=j}else j=e[19];return j};const rn=()=>{let t=(0,Le.c)(31),{namespaces:e}=Se(),{locale:n}=it(),[i,o]=(0,$.useState)(""),[r,d]=(0,$.useState)(null),c=!!i.trim();if(e.length===0){let b;t[0]===Symbol.for("react.memo_cache_sentinel")?(b=(0,a.jsxs)("span",{children:["Create an obstore or fsspec connection in your notebook. See the"," ",(0,a.jsx)("a",{className:"text-link",href:"https://docs.marimo.io/guides/working_with_data/remote_storage/#quick-start",target:"_blank",rel:"noopener noreferrer",children:"docs"}),"."]}),t[0]=b):b=t[0];let h;return t[1]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsx)(Ha,{title:"No storage connected",description:b,action:(0,a.jsx)(st,{defaultTab:"storage",children:(0,a.jsxs)(A,{variant:"outline",size:"sm",children:["Add remote storage",(0,a.jsx)(lt,{className:"h-4 w-4 ml-2"})]})}),icon:(0,a.jsx)(rt,{className:"h-8 w-8"})}),t[1]=h):h=t[1],h}let x;t[2]===r?x=t[3]:(x=r&&(0,a.jsx)(Qa,{entry:r.entry,namespace:r.namespace,protocol:r.protocol,backendType:r.backendType,onBack:()=>d(null)}),t[2]=r,t[3]=x);let s=r&&"hidden",y;t[4]===s?y=t[5]:(y=ie("border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin",s),t[4]=s,t[5]=y);let m;t[6]===i?m=t[7]:(m=(0,a.jsx)(za,{placeholder:"Search entries...",className:"h-6 m-1",value:i,onValueChange:o,rootClassName:"flex-1 border-b-0"}),t[6]=i,t[7]=m);let f;t[8]===c?f=t[9]:(f=c&&(0,a.jsx)(A,{variant:"text",size:"xs",className:"float-right border-none px-2 m-0 h-full",onClick:()=>o(""),children:(0,a.jsx)(sa,{className:"h-4 w-4"})}),t[8]=c,t[9]=f);let u;t[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(H,{content:"Filters loaded entries only. Expand directories to include their contents in the search.",delayDuration:200,children:(0,a.jsx)(la,{className:"h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2"})}),t[10]=u):u=t[10];let g;t[11]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(st,{defaultTab:"storage",children:(0,a.jsx)(A,{variant:"ghost",size:"sm",className:"px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0",children:(0,a.jsx)(lt,{className:"h-4 w-4"})})}),t[11]=g):g=t[11];let w;t[12]!==m||t[13]!==f?(w=(0,a.jsxs)("div",{className:"flex items-center w-full border-b",children:[m,f,u,g]}),t[12]=m,t[13]=f,t[14]=w):w=t[14];let v;if(t[15]!==n||t[16]!==e||t[17]!==i){let b;t[19]!==n||t[20]!==i?(b=h=>(0,a.jsx)(nn,{namespace:h,locale:n,searchValue:i,onOpenFile:d},h.name??h.displayName),t[19]=n,t[20]=i,t[21]=b):b=t[21],v=e.map(b),t[15]=n,t[16]=e,t[17]=i,t[18]=v}else v=t[18];let l;t[22]===v?l=t[23]:(l=(0,a.jsx)(Pa,{className:"flex flex-col",children:v}),t[22]=v,t[23]=l);let j;t[24]!==y||t[25]!==w||t[26]!==l?(j=(0,a.jsxs)(Oa,{className:y,shouldFilter:!1,children:[w,l]}),t[24]=y,t[25]=w,t[26]=l,t[27]=j):j=t[27];let p;return t[28]!==x||t[29]!==j?(p=(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[x,j]}),t[28]=x,t[29]=j,t[30]=p):p=t[30],p};var Ct=fe(),St=(0,$.createContext)(null);function sn(){return(0,$.useContext)(St)??void 0}var ln=t=>{let e=(0,Ct.c)(3),{children:n}=t,i=xa(),o;return e[0]!==n||e[1]!==i?(o=(0,a.jsx)(St.Provider,{value:i,children:n}),e[0]=n,e[1]=i,e[2]=o):o=e[2],o};const on=t=>{let e=(0,Ct.c)(5),{children:n}=t,[i,o]=(0,$.useState)(null),r;e[0]!==n||e[1]!==i?(r=i&&(0,a.jsx)(fa,{backend:va,options:{rootElement:i},children:(0,a.jsx)(ln,{children:n})}),e[0]=n,e[1]=i,e[2]=r):r=e[2];let d;return e[3]===r?d=e[4]:(d=(0,a.jsx)("div",{ref:o,className:"contents",children:r}),e[3]=r,e[4]=d),d};var Be=new Map;const cn=({file:t,onOpenNotebook:e})=>{let{sendFileDetails:n,sendUpdateFile:i}=Pe(),o=ye(Bt),r=ye(Je),d=ye(Ht),[c,x]=(0,$.useState)(""),{data:s,isPending:y,error:m,setData:f,refetch:u}=Ae(async()=>{let k=await n({path:t.path}),F=k.contents||"";return x(Be.get(t.path)||F),k},[t.path]),g=async()=>{c!==(s==null?void 0:s.contents)&&await i({path:t.path,contents:c}).then(k=>{k.success&&(f(F=>({...F,contents:c})),x(c))})},w=(0,$.useRef)(c);if(w.current=c,(0,$.useEffect)(()=>()=>{if(!(s!=null&&s.contents))return;let k=w.current;k===s.contents?Be.delete(t.path):Be.set(t.path,k)},[t.path,s==null?void 0:s.contents]),m)return(0,a.jsx)(mt,{error:m});if(y||!s)return null;let v=s.mimeType||"text/plain",l=v in Yt,j=d&&s.file.isMarimoFile&&(t.path===d||t.path.endsWith(`/${d}`));if(!s.contents&&!l)return(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 p-6",children:[(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Name"}),(0,a.jsx)("div",{children:s.file.name}),(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Type"}),(0,a.jsx)("div",{children:v})]});let p=(0,a.jsx)(wt,{filename:s.file.name,onRefresh:u,onDownload:r?void 0:()=>{if(s.isBase64&&s.contents){_e(v)?ze(Te(s.contents,v),s.file.name):Ce(dt(Te(s.contents,s.mimeType||"application/octet-stream")),s.file.name);return}Ce(new Blob([s.contents||c],{type:v}),s.file.name)},actions:(0,a.jsxs)(a.Fragment,{children:[t.isMarimoFile&&!Fe()&&(0,a.jsx)(H,{content:"Open notebook",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:k=>e(k),children:(0,a.jsx)($e,{className:"h-3.5 w-3.5"})})}),!_e(v)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(H,{content:"Copy contents to clipboard",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:async()=>{await je(c)},children:(0,a.jsx)(et,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(H,{content:Ta("global.save"),children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:g,disabled:c===s.contents,children:(0,a.jsx)(wa,{className:"h-3.5 w-3.5"})})})]})]})}),b=_e(v),h=!b&&v!=="text/csv";return(0,a.jsxs)(a.Fragment,{children:[p,h&&j&&(0,a.jsxs)(Ma,{variant:"warning",className:"rounded-none",children:[(0,a.jsx)(Na,{className:"h-4 w-4"}),(0,a.jsx)(Sa,{children:"Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution."})]}),(0,a.jsx)(Ke,{mimeType:v,contents:b?void 0:h?c:s.contents??void 0,mediaSource:b?{base64:s.contents,mime:v}:void 0,readOnly:!h,onChange:x,extensions:[ea.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>c===s.contents?!1:(g(),!0)}])]})]})},Mt=Ue(t=>{let e=t(ta);return Vt(e,"no requestClientAtom set"),new ha({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,copyFileOrFolder:e.sendCopyFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),dn=Ue({});async function mn(){await It.get(Mt).refreshAll([])}var le=" ";const Dt={directory:t=>`os.listdir("${t}")`,python:t=>`with open("${t}", "r") as _f:
|
|
10
|
+
signed_url`;let n=He(t.entry.path.split("/").pop()||"download");return`${t.variableName}.get("${e}", "${n}")`}}];var Xa=100*1024*1024;function Za(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}const Qa=({entry:t,namespace:e,protocol:n,backendType:i,onBack:o})=>{let{locale:r}=it(),d=Ye(),c=Za(t.path),x=t.mimeType||"text/plain",s=Fe(x),y=s&&t.size>Xa&&t.size>0,{data:m,isPending:f,error:u,refetch:g}=Ae(async()=>{if(y)return null;let p=await Oe.request({namespace:e,path:t.path,preview:!s});if(p.error)throw Error(p.error);if(!p.url)throw Error("No URL returned");if(s)return{type:"media",url:p.url};let b=await fetch(p.url);if(!b.ok)throw Error(`Failed to fetch preview: ${b.statusText}`);return{type:"text",content:await b.text()}},[e,t.path,s,y]),w=(0,$.useCallback)(async()=>{try{let p=await Oe.request({namespace:e,path:t.path});if(p.error){te({title:"Download failed",description:p.error,variant:"danger"});return}p.url&&ze(p.url,p.filename??c)}catch(p){Me.error("Failed to download storage entry",p),te({title:"Download failed",description:String(p),variant:"danger"})}},[e,t.path,c]),v=Nt.map(p=>{let b=p.getCode({variableName:e,protocol:n,entry:t,backendType:i});if(b===null)return null;let h=p.icon;return(0,a.jsx)(H,{content:p.label,children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:()=>d(b),"aria-label":p.label,children:(0,a.jsx)(h,{className:"h-3.5 w-3.5"})})},p.id)}),l=(0,a.jsx)(wt,{filename:c,filenameIcon:tt(c),onBack:o,onDownload:w,actions:v}),j=({includeMime:p=!1})=>(0,a.jsxs)("div",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-1.5 p-4 text-xs",children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Path"}),(0,a.jsxs)("div",{className:"truncate flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"font-mono text-[11px]",children:t.path}),(0,a.jsx)(Ca,{value:t.path,className:"h-3 w-3"})]}),p&&(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Type"}),p&&(0,a.jsx)("span",{children:x}),t.size>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Size"}),(0,a.jsx)("span",{children:Re(t.size,r)})]}),t.lastModified!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground font-medium",children:"Modified"}),(0,a.jsx)("span",{children:new Date(t.lastModified*1e3).toLocaleString()})]})]});return y?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-muted-foreground italic",children:["File is too large to preview (",Re(t.size,r),")."]})]}):f?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({}),(0,a.jsxs)("div",{className:"flex-1 flex items-center justify-center gap-2 text-xs text-muted-foreground min-h-24",children:[(0,a.jsx)(Ie,{className:"h-4 w-4 animate-spin"}),"Loading preview..."]})]}):u?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"px-4 pb-4 text-xs text-destructive",children:["Failed to load preview: ",u.message]}),(0,a.jsx)("div",{className:"px-4 pb-4",children:(0,a.jsxs)(A,{variant:"secondary",size:"xs",onClick:g,children:[(0,a.jsx)(ot,{className:"h-3 w-3 mr-1"}),"Retry"]})})]}):m?(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({}),(0,a.jsx)(Ke,{mimeType:x,contents:m.type==="text"?m.content:void 0,mediaSource:m.type==="media"?{url:m.url}:void 0})]}):(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[l,j({includeMime:!0}),(0,a.jsxs)("div",{className:"p-4 flex items-center gap-2 text-xs text-muted-foreground",children:[(0,a.jsx)(nt,{className:"h-4 w-4"}),"Preview not available for this file type."]})]})};var Le=fe(),en=16;function se(t){return{paddingLeft:t*en}}function tn(t,e){return new Date(t*1e3).toLocaleDateString(e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function kt(t){let e=t.endsWith("/")?t.slice(0,-1):t,n=e.split("/");return n[n.length-1]||e}function Ve(t,e,n,i){let o=n.toLowerCase();if(kt(t.path).toLowerCase().includes(o))return!0;if(t.kind==="directory"){let r=i.get(Xe(e,t.path));if(r)return r.some(d=>Ve(d,e,n,i))}return!1}function _t(t,e,n,i){return n.trim()?t.filter(o=>Ve(o,e,n,i)):t}var an=t=>{let e=(0,Le.c)(36),{namespace:n,protocol:i,rootPath:o,backendType:r,prefix:d,depth:c,locale:x,searchValue:s,onOpenFile:y}=t,{entriesByPath:m}=Se(),{entries:f,isPending:u,error:g}=Qe(n,d);if(u){let l;e[0]===c?l=e[1]:(l=se(c),e[0]=c,e[1]=l);let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=(0,a.jsx)(Ie,{className:"h-3 w-3 animate-spin"}),e[2]=j):j=e[2];let p;return e[3]===l?p=e[4]:(p=(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:l,children:[j,"Loading..."]}),e[3]=l,e[4]=p),p}if(g){let l;e[5]===c?l=e[6]:(l=se(c),e[5]=c,e[6]=l);let j;return e[7]!==g.message||e[8]!==l?(j=(0,a.jsxs)("div",{className:"py-1 text-xs text-destructive",style:l,children:["Failed to load: ",g.message]}),e[7]=g.message,e[8]=l,e[9]=j):j=e[9],j}if(f.length===0){let l;e[10]===c?l=e[11]:(l=se(c),e[10]=c,e[11]=l);let j;return e[12]===l?j=e[13]:(j=(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:l,children:"Empty"}),e[12]=l,e[13]=j),j}let w;if(e[14]!==r||e[15]!==f||e[16]!==c||e[17]!==m||e[18]!==x||e[19]!==n||e[20]!==y||e[21]!==i||e[22]!==o||e[23]!==s){let l=_t(f,n,s,m),j;e[25]!==r||e[26]!==c||e[27]!==x||e[28]!==n||e[29]!==y||e[30]!==i||e[31]!==o||e[32]!==s?(j=p=>(0,a.jsx)(Ft,{entry:p,namespace:n,protocol:i,rootPath:o,backendType:r,depth:c,locale:x,searchValue:s,onOpenFile:y},p.path),e[25]=r,e[26]=c,e[27]=x,e[28]=n,e[29]=y,e[30]=i,e[31]=o,e[32]=s,e[33]=j):j=e[33],w=l.map(j),e[14]=r,e[15]=f,e[16]=c,e[17]=m,e[18]=x,e[19]=n,e[20]=y,e[21]=i,e[22]=o,e[23]=s,e[24]=w}else w=e[24];let v;return e[34]===w?v=e[35]:(v=(0,a.jsx)(a.Fragment,{children:w}),e[34]=w,e[35]=v),v},Ft=({entry:t,namespace:e,protocol:n,rootPath:i,backendType:o,depth:r,locale:d,searchValue:c,onOpenFile:x})=>{var b;let[s,y]=(0,$.useState)(!1),{entriesByPath:m}=Se(),f=Ye(),u=t.kind==="directory",g=kt(t.path),w=!!c.trim(),v=u&&w&&g.toLowerCase().includes(c.trim().toLowerCase()),l=u&&w&&!!((b=m.get(Xe(e,t.path)))!=null&&b.some(h=>Ve(h,e,c,m))),j=s||l,p=(0,$.useCallback)(async()=>{try{let h=await Oe.request({namespace:e,path:t.path});if(h.error){te({title:"Download failed",description:h.error,variant:"danger"});return}h.url&&ze(h.url,h.filename??"download")}catch(h){Me.error("Failed to download storage entry",h),te({title:"Download failed",description:String(h),variant:"danger"})}},[e,t.path]);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(pt,{className:ie("text-xs flex items-center gap-1.5 cursor-pointer rounded-none group h-6.5",u&&"font-medium"),style:se(r),value:`${e}:${t.path}`,onSelect:()=>{u?y(!j):x({entry:t,namespace:e,protocol:n,backendType:o})},children:[u?(0,a.jsx)(Ee,{isExpanded:j,className:"h-3 w-3"}):(0,a.jsx)("span",{className:"w-3 shrink-0"}),u?(0,a.jsx)(oa,{className:ie("h-3.5 w-3.5 shrink-0",at.directory)}):tt(g),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:g}),(0,a.jsxs)("div",{className:"flex items-center",children:[t.size>0&&(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-2 opacity-0 group-hover:opacity-100 transition-opacity tabular-nums",children:Re(t.size,d)}),t.lastModified!=null&&(0,a.jsx)(H,{content:`Last modified: ${new Date(t.lastModified*1e3).toLocaleString()}`,children:(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground pr-1 opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap",children:tn(t.lastModified,d)})}),(0,a.jsxs)(Kt,{children:[(0,a.jsx)(Gt,{asChild:!0,children:(0,a.jsx)(Ia,{iconClassName:"h-3 w-3",onClick:h=>h.stopPropagation()})}),(0,a.jsxs)(Jt,{align:"end",onClick:h=>h.stopPropagation(),onCloseAutoFocus:h=>h.preventDefault(),children:[!u&&(0,a.jsxs)(R,{onSelect:()=>x({entry:t,namespace:e,protocol:n,backendType:o}),children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"View"]}),(0,a.jsxs)(R,{onSelect:async()=>{await je(t.path),te({title:"Copied to clipboard"})},children:[(0,a.jsx)(et,{className:ge}),"Copy path"]}),!u&&(0,a.jsxs)(R,{onSelect:()=>p(),children:[(0,a.jsx)(De,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{}),Nt.map(h=>{let k=h.getCode({variableName:e,protocol:n,entry:t,backendType:o});if(k===null)return null;let _=h.icon;return(0,a.jsxs)(R,{onSelect:()=>f(k),children:[(0,a.jsx)(_,{className:ge}),h.label]},h.id)})]})]})]})]}),u&&j&&(0,a.jsx)(an,{namespace:e,protocol:n,rootPath:i,backendType:o,prefix:t.path,depth:r+1,locale:d,searchValue:v?"":c,onOpenFile:x})]})},nn=t=>{let e=(0,Le.c)(43),{namespace:n,locale:i,searchValue:o,onOpenFile:r}=t,[d,c]=(0,$.useState)(!0),{entriesByPath:x}=Se(),{clearNamespaceCache:s}=aa(),y=n.name??n.displayName,{entries:m,isPending:f,error:u,refetch:g}=Qe(y),w;e[0]!==s||e[1]!==y||e[2]!==g?(w=p=>{p.stopPropagation(),s(y),g()},e[0]=s,e[1]=y,e[2]=g,e[3]=w):w=e[3];let v=w,l=f?n.storageEntries:m,j;if(e[4]!==l||e[5]!==x||e[6]!==u||e[7]!==v||e[8]!==d||e[9]!==f||e[10]!==i||e[11]!==n.backendType||e[12]!==n.displayName||e[13]!==n.name||e[14]!==n.protocol||e[15]!==n.rootPath||e[16]!==y||e[17]!==r||e[18]!==o){let p=_t(l,y,o,x),b;e[20]===d?b=e[21]:(b=()=>c(!d),e[20]=d,e[21]=b);let h;e[22]===d?h=e[23]:(h=(0,a.jsx)(Ee,{isExpanded:d,className:"h-3 w-3"}),e[22]=d,e[23]=h);let k;e[24]===n.protocol?k=e[25]:(k=(0,a.jsx)(da,{protocol:n.protocol}),e[24]=n.protocol,e[25]=k);let _;e[26]===n.displayName?_=e[27]:(_=(0,a.jsx)("span",{children:n.displayName}),e[26]=n.displayName,e[27]=_);let F;e[28]===n.name?F=e[29]:(F=n.name&&(0,a.jsxs)("span",{className:"text-xs text-muted-foreground font-normal",children:["(",(0,a.jsx)(La,{variableName:n.name}),")"]}),e[28]=n.name,e[29]=F);let M;e[30]===v?M=e[31]:(M=(0,a.jsx)(ht,{onClick:v,tooltip:"Refresh storage connection",className:"p-0",iconClassName:"h-3 w-3"}),e[30]=v,e[31]=M);let D=n.rootPath||"(root)",C;e[32]===D?C=e[33]:(C=(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-normal tabular-nums ml-auto",children:D}),e[32]=D,e[33]=C);let S;e[34]!==n.name||e[35]!==C||e[36]!==b||e[37]!==h||e[38]!==k||e[39]!==_||e[40]!==F||e[41]!==M?(S=(0,a.jsxs)(pt,{value:n.name,onSelect:b,className:"flex flex-row font-semibold h-7 text-xs gap-1.5 bg-(--slate-2) text-muted-foreground rounded-none",children:[h,k,_,F,M,C]}),e[34]=n.name,e[35]=C,e[36]=b,e[37]=h,e[38]=k,e[39]=_,e[40]=F,e[41]=M,e[42]=S):S=e[42],j=(0,a.jsxs)(a.Fragment,{children:[S,d&&(0,a.jsxs)(a.Fragment,{children:[f&&l.length===0&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 py-1 text-xs text-muted-foreground",style:se(1),children:[(0,a.jsx)(Ie,{className:"h-3 w-3 animate-spin"}),"Loading..."]}),u&&l.length===0&&(0,a.jsx)(Aa,{error:u,style:se(1),className:"py-1 text-xs h-auto overflow-auto max-h-32 items-start",showIcon:!1}),!f&&l.length===0&&!u&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No entries"}),o&&p.length===0&&l.length>0&&(0,a.jsx)("div",{className:"py-1 text-xs text-muted-foreground italic",style:se(1),children:"No matches"}),p.map(T=>(0,a.jsx)(Ft,{entry:T,namespace:y,protocol:n.protocol,rootPath:n.rootPath,backendType:n.backendType,depth:1,locale:i,searchValue:o,onOpenFile:r},T.path))]})]}),e[4]=l,e[5]=x,e[6]=u,e[7]=v,e[8]=d,e[9]=f,e[10]=i,e[11]=n.backendType,e[12]=n.displayName,e[13]=n.name,e[14]=n.protocol,e[15]=n.rootPath,e[16]=y,e[17]=r,e[18]=o,e[19]=j}else j=e[19];return j};const rn=()=>{let t=(0,Le.c)(31),{namespaces:e}=Se(),{locale:n}=it(),[i,o]=(0,$.useState)(""),[r,d]=(0,$.useState)(null),c=!!i.trim();if(e.length===0){let b;t[0]===Symbol.for("react.memo_cache_sentinel")?(b=(0,a.jsxs)("span",{children:["Create an obstore or fsspec connection in your notebook. See the"," ",(0,a.jsx)("a",{className:"text-link",href:"https://docs.marimo.io/guides/working_with_data/remote_storage/#quick-start",target:"_blank",rel:"noopener noreferrer",children:"docs"}),"."]}),t[0]=b):b=t[0];let h;return t[1]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsx)(Ha,{title:"No storage connected",description:b,action:(0,a.jsx)(st,{defaultTab:"storage",children:(0,a.jsxs)(A,{variant:"outline",size:"sm",children:["Add remote storage",(0,a.jsx)(lt,{className:"h-4 w-4 ml-2"})]})}),icon:(0,a.jsx)(rt,{className:"h-8 w-8"})}),t[1]=h):h=t[1],h}let x;t[2]===r?x=t[3]:(x=r&&(0,a.jsx)(Qa,{entry:r.entry,namespace:r.namespace,protocol:r.protocol,backendType:r.backendType,onBack:()=>d(null)}),t[2]=r,t[3]=x);let s=r&&"hidden",y;t[4]===s?y=t[5]:(y=ie("border-b bg-background rounded-none h-full pb-10 overflow-auto outline-hidden scrollbar-thin",s),t[4]=s,t[5]=y);let m;t[6]===i?m=t[7]:(m=(0,a.jsx)(za,{placeholder:"Search entries...",className:"h-6 m-1",value:i,onValueChange:o,rootClassName:"flex-1 border-b-0"}),t[6]=i,t[7]=m);let f;t[8]===c?f=t[9]:(f=c&&(0,a.jsx)(A,{variant:"text",size:"xs",className:"float-right border-none px-2 m-0 h-full",onClick:()=>o(""),children:(0,a.jsx)(sa,{className:"h-4 w-4"})}),t[8]=c,t[9]=f);let u;t[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(H,{content:"Filters loaded entries only. Expand directories to include their contents in the search.",delayDuration:200,children:(0,a.jsx)(la,{className:"h-3.5 w-3.5 shrink-0 cursor-help text-muted-foreground hover:text-foreground mr-2"})}),t[10]=u):u=t[10];let g;t[11]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(st,{defaultTab:"storage",children:(0,a.jsx)(A,{variant:"ghost",size:"sm",className:"px-2 border-0 border-l border-muted-background rounded-none focus-visible:ring-0 focus-visible:ring-offset-0",children:(0,a.jsx)(lt,{className:"h-4 w-4"})})}),t[11]=g):g=t[11];let w;t[12]!==m||t[13]!==f?(w=(0,a.jsxs)("div",{className:"flex items-center w-full border-b",children:[m,f,u,g]}),t[12]=m,t[13]=f,t[14]=w):w=t[14];let v;if(t[15]!==n||t[16]!==e||t[17]!==i){let b;t[19]!==n||t[20]!==i?(b=h=>(0,a.jsx)(nn,{namespace:h,locale:n,searchValue:i,onOpenFile:d},h.name??h.displayName),t[19]=n,t[20]=i,t[21]=b):b=t[21],v=e.map(b),t[15]=n,t[16]=e,t[17]=i,t[18]=v}else v=t[18];let l;t[22]===v?l=t[23]:(l=(0,a.jsx)(Pa,{className:"flex flex-col",children:v}),t[22]=v,t[23]=l);let j;t[24]!==y||t[25]!==w||t[26]!==l?(j=(0,a.jsxs)(Oa,{className:y,shouldFilter:!1,children:[w,l]}),t[24]=y,t[25]=w,t[26]=l,t[27]=j):j=t[27];let p;return t[28]!==x||t[29]!==j?(p=(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[x,j]}),t[28]=x,t[29]=j,t[30]=p):p=t[30],p};var Ct=fe(),St=(0,$.createContext)(null);function sn(){return(0,$.useContext)(St)??void 0}var ln=t=>{let e=(0,Ct.c)(3),{children:n}=t,i=xa(),o;return e[0]!==n||e[1]!==i?(o=(0,a.jsx)(St.Provider,{value:i,children:n}),e[0]=n,e[1]=i,e[2]=o):o=e[2],o};const on=t=>{let e=(0,Ct.c)(5),{children:n}=t,[i,o]=(0,$.useState)(null),r;e[0]!==n||e[1]!==i?(r=i&&(0,a.jsx)(fa,{backend:va,options:{rootElement:i},children:(0,a.jsx)(ln,{children:n})}),e[0]=n,e[1]=i,e[2]=r):r=e[2];let d;return e[3]===r?d=e[4]:(d=(0,a.jsx)("div",{ref:o,className:"contents",children:r}),e[3]=r,e[4]=d),d};var Be=new Map;const cn=({file:t,onOpenNotebook:e})=>{let{sendFileDetails:n,sendUpdateFile:i}=Pe(),o=ye(Bt),r=ye(Je),d=ye(Ht),[c,x]=(0,$.useState)(""),{data:s,isPending:y,error:m,setData:f,refetch:u}=Ae(async()=>{let k=await n({path:t.path}),_=k.contents||"";return x(Be.get(t.path)||_),k},[t.path]),g=async()=>{c!==(s==null?void 0:s.contents)&&await i({path:t.path,contents:c}).then(k=>{k.success&&(f(_=>({..._,contents:c})),x(c))})},w=(0,$.useRef)(c);if(w.current=c,(0,$.useEffect)(()=>()=>{if(!(s!=null&&s.contents))return;let k=w.current;k===s.contents?Be.delete(t.path):Be.set(t.path,k)},[t.path,s==null?void 0:s.contents]),m)return(0,a.jsx)(mt,{error:m});if(y||!s)return null;let v=s.mimeType||"text/plain",l=v in Yt,j=d&&s.file.isMarimoFile&&(t.path===d||t.path.endsWith(`/${d}`));if(!s.contents&&!l)return(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 p-6",children:[(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Name"}),(0,a.jsx)("div",{children:s.file.name}),(0,a.jsx)("div",{className:"font-bold text-muted-foreground",children:"Type"}),(0,a.jsx)("div",{children:v})]});let p=(0,a.jsx)(wt,{filename:s.file.name,onRefresh:u,onDownload:r?void 0:()=>{if(s.isBase64&&s.contents){Fe(v)?ze(Te(s.contents,v),s.file.name):Ce(dt(Te(s.contents,s.mimeType||"application/octet-stream")),s.file.name);return}Ce(new Blob([s.contents||c],{type:v}),s.file.name)},actions:(0,a.jsxs)(a.Fragment,{children:[t.isMarimoFile&&!_e()&&(0,a.jsx)(H,{content:"Open notebook",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:k=>e(k),children:(0,a.jsx)($e,{className:"h-3.5 w-3.5"})})}),!Fe(v)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(H,{content:"Copy contents to clipboard",children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:async()=>{await je(c)},children:(0,a.jsx)(et,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(H,{content:Ta("global.save"),children:(0,a.jsx)(A,{variant:"text",size:"xs",onClick:g,disabled:c===s.contents,children:(0,a.jsx)(wa,{className:"h-3.5 w-3.5"})})})]})]})}),b=Fe(v),h=!b&&v!=="text/csv";return(0,a.jsxs)(a.Fragment,{children:[p,h&&j&&(0,a.jsxs)(Ma,{variant:"warning",className:"rounded-none",children:[(0,a.jsx)(Na,{className:"h-4 w-4"}),(0,a.jsx)(Sa,{children:"Editing the notebook file directly while running in marimo's editor may cause unintended changes. Please use with caution."})]}),(0,a.jsx)(Ke,{mimeType:v,contents:b?void 0:h?c:s.contents??void 0,mediaSource:b?{base64:s.contents,mime:v}:void 0,readOnly:!h,onChange:x,extensions:[ea.of([{key:o.getHotkey("global.save").key,stopPropagation:!0,run:()=>c===s.contents?!1:(g(),!0)}])]})]})},Mt=Ue(t=>{let e=t(ta);return Vt(e,"no requestClientAtom set"),new ha({listFiles:e.sendListFiles,createFileOrFolder:e.sendCreateFileOrFolder,deleteFileOrFolder:e.sendDeleteFileOrFolder,copyFileOrFolder:e.sendCopyFileOrFolder,renameFileOrFolder:e.sendRenameFileOrFolder})}),dn=Ue({});async function mn(){await It.get(Mt).refreshAll([])}var le=" ";const Dt={directory:t=>`os.listdir("${t}")`,python:t=>`with open("${t}", "r") as _f:
|
|
11
11
|
${le}...
|
|
12
12
|
`,json:t=>`with open("${t}", "r") as _f:
|
|
13
13
|
${le}_data = json.load(_f)
|
|
@@ -23,4 +23,4 @@ ${le}...
|
|
|
23
23
|
${le}...
|
|
24
24
|
`,unknown:t=>`with open("${t}", "r") as _f:
|
|
25
25
|
${le}...
|
|
26
|
-
`};var pn=fe(),hn=1024*1024*100,xn=5;function zt(t){let e=(0,pn.c)(7),n;e[0]===t?n=e[1]:(n=t===void 0?{}:t,e[0]=t,e[1]=n);let i=n,{sendCreateFileOrFolder:o}=Pe(),r;e[2]===o?r=e[3]:(r=async c=>{if(c.length===0)return;let x=c.length===1;await Xt(x?"Uploading file...":"Uploading files...",async s=>{s.addTotal(c.length),await Ra(c,xn,async y=>{let m=bn(gn(y)),f="";m&&(f=_a.guessDeliminator(m).dirname(m)),await o({path:f,type:"file",name:y.name,file:y}),s.increment(1)}),await mn()},{title:x?"File uploaded":`${c.length} files uploaded`})},e[2]=o,e[3]=r);let d;return e[4]!==i||e[5]!==r?(d={multiple:!0,maxSize:hn,onError:jn,onDropRejected:fn,onDrop:r,...i},e[4]=i,e[5]=r,e[6]=d):d=e[6],Fa(d)}function fn(t){te({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(un)}),variant:"danger"})}function un(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(yn).join(", "),")"]},t.file.name)}function yn(t){return t.message}function jn(t){Me.error(t),te({title:"File upload failed",description:t.message,variant:"danger"})}function gn(t){if(t.webkitRelativePath)return t.webkitRelativePath;if("path"in t&&typeof t.path=="string")return t.path;if("relativePath"in t&&typeof t.relativePath=="string")return t.relativePath}function bn(t){if(t)return t.replace(/^\/+/,"")}var be=fe(),vn=Ge("marimo:showHiddenFiles",!0,We,{getOnInit:!0}),Pt=$.createContext(null);const wn=t=>{let e=(0,be.c)(73),{height:n}=t,i=(0,$.useRef)(null),o=sn(),[r]=ke(Mt),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[c,x]=(0,$.useState)(d),[s,y]=(0,$.useState)(null),[m,f]=ke(vn),{openPrompt:u}=ct(),[g,w]=ke(dn),v;e[1]===r?v=e[2]:(v=()=>r.initialize(x),e[1]=r,e[2]=v);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3];let{isPending:j,error:p}=Ae(v,l),b;e[4]!==g||e[5]!==r?(b=()=>r.refreshAll(Object.keys(g).filter(N=>g[N])),e[4]=g,e[5]=r,e[6]=b):b=e[6];let h=ee(b),k;e[7]!==f||e[8]!==m?(k=()=>{f(!m)},e[7]=f,e[8]=m,e[9]=k):k=e[9];let F=ee(k),_;e[10]!==u||e[11]!==r?(_=async()=>{u({title:"Folder name",onConfirm:async N=>{r.createFolder(N,null)}})},e[10]=u,e[11]=r,e[12]=_):_=e[12];let M=ee(_),D;e[13]!==u||e[14]!==r?(D=async()=>{u({title:"File name",onConfirm:async N=>{r.createFile({name:N,parentId:null})}})},e[13]=u,e[14]=r,e[15]=D):D=e[15];let C=ee(D),S;e[16]!==u||e[17]!==r?(S=async()=>{u({title:"Notebook name",onConfirm:async N=>{r.createFile({name:N,parentId:null,type:"notebook"})}})},e[16]=u,e[17]=r,e[18]=S):S=e[18];let T=ee(S),P;e[19]===w?P=e[20]:(P=()=>{var N;(N=i.current)==null||N.closeAll(),w({})},e[19]=w,e[20]=P);let E=ee(P),K;e[21]!==c||e[22]!==m?(K=Tt(c,m),e[21]=c,e[22]=m,e[23]=K):K=e[23];let oe=K;if(j){let N;return e[24]===Symbol.for("react.memo_cache_sentinel")?(N=(0,a.jsx)(ma,{size:"medium",centered:!0}),e[24]=N):N=e[24],N}if(p){let N;return e[25]===p?N=e[26]:(N=(0,a.jsx)(mt,{error:p}),e[25]=p,e[26]=N),N}if(s){let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=()=>y(null),e[27]=N):N=e[27];let O;e[28]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(A,{onClick:N,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(Ze,{size:16})}),e[28]=O):O=e[28];let I;e[29]===s.name?I=e[30]:(I=(0,a.jsxs)("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[O,(0,a.jsx)("span",{className:"font-bold",children:s.name})]}),e[29]=s.name,e[30]=I);let J;e[31]!==s.path||e[32]!==r?(J=ne=>Ot(ne,r.relativeFromRoot(s.path)),e[31]=s.path,e[32]=r,e[33]=J):J=e[33];let X;e[34]!==s||e[35]!==J?(X=(0,a.jsx)($.Suspense,{children:(0,a.jsx)(cn,{onOpenNotebook:J,file:s})}),e[34]=s,e[35]=J,e[36]=X):X=e[36];let Z;return e[37]!==I||e[38]!==X?(Z=(0,a.jsxs)(a.Fragment,{children:[I,X]}),e[37]=I,e[38]=X,e[39]=Z):Z=e[39],Z}let L;e[40]!==E||e[41]!==C||e[42]!==M||e[43]!==T||e[44]!==F||e[45]!==h||e[46]!==m||e[47]!==r?(L=(0,a.jsx)(kn,{onRefresh:h,onHidden:F,showHiddenFiles:m,onCreateFile:C,onCreateNotebook:T,onCreateFolder:M,onCollapseAll:E,tree:r}),e[40]=E,e[41]=C,e[42]=M,e[43]=T,e[44]=F,e[45]=h,e[46]=m,e[47]=r,e[48]=L):L=e[48];let Q=n-33,V,B,q;e[49]===r?(V=e[50],B=e[51],q=e[52]):(V=async N=>{let{ids:O}=N;for(let I of O)await r.delete(I)},B=async N=>{let{id:O,name:I}=N;await r.rename(O,I)},q=async N=>{let{dragIds:O,parentId:I}=N;await r.move(O,I)},e[49]=r,e[50]=V,e[51]=B,e[52]=q);let Y;e[53]===Symbol.for("react.memo_cache_sentinel")?(Y=N=>{let O=N[0];O&&(O.data.isDirectory||y(O.data))},e[53]=Y):Y=e[53];let U;e[54]!==g||e[55]!==w||e[56]!==r?(U=async N=>{if(await r.expand(N)){let O=g[N]??!1;w({...g,[N]:!O})}},e[54]=g,e[55]=w,e[56]=r,e[57]=U):U=e[57];let W;e[58]!==o||e[59]!==g||e[60]!==Q||e[61]!==V||e[62]!==B||e[63]!==q||e[64]!==U||e[65]!==oe?(W=(0,a.jsx)(ya,{width:"100%",ref:i,height:Q,className:"h-full",data:oe,initialOpenState:g,openByDefault:!1,dndManager:o,renderCursor:Mn,disableDrop:Dn,onDelete:V,onRename:B,onMove:q,onSelect:Y,onToggle:U,padding:15,rowHeight:30,indent:Nn,overscanCount:1e3,disableMultiSelection:!0,children:_n}),e[58]=o,e[59]=g,e[60]=Q,e[61]=V,e[62]=B,e[63]=q,e[64]=U,e[65]=oe,e[66]=W):W=e[66];let G;e[67]!==W||e[68]!==r?(G=(0,a.jsx)(Pt,{value:r,children:W}),e[67]=W,e[68]=r,e[69]=G):G=e[69];let ae;return e[70]!==L||e[71]!==G?(ae=(0,a.jsxs)(a.Fragment,{children:[L,G]}),e[70]=L,e[71]=G,e[72]=ae):ae=e[72],ae};var Nn=15,kn=t=>{let e=(0,be.c)(42),{onRefresh:n,onHidden:i,showHiddenFiles:o,onCreateFile:r,onCreateNotebook:d,onCreateFolder:c,onCollapseAll:x}=t,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={noDrag:!0,noDragEventsBubbling:!0},e[0]=s):s=e[0];let{getRootProps:y,getInputProps:m}=zt(s),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)(yt,{size:16}),e[1]=f):f=e[1];let u;e[2]===d?u=e[3]:(u=(0,a.jsx)(H,{content:"Add notebook",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-notebook-button",onClick:d,variant:"text",size:"xs",children:f})}),e[2]=d,e[3]=u);let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(jt,{size:16}),e[4]=g):g=e[4];let w;e[5]===r?w=e[6]:(w=(0,a.jsx)(H,{content:"Add file",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-file-button",onClick:r,variant:"text",size:"xs",children:g})}),e[5]=r,e[6]=w);let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=(0,a.jsx)(gt,{size:16}),e[7]=v):v=e[7];let l;e[8]===c?l=e[9]:(l=(0,a.jsx)(H,{content:"Add folder",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-folder-button",onClick:c,variant:"text",size:"xs",children:v})}),e[8]=c,e[9]=l);let j;e[10]===y?j=e[11]:(j=y({}),e[10]=y,e[11]=j);let p,b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=Qt({variant:"text",size:"xs"}),p=(0,a.jsx)(ka,{size:16}),e[12]=p,e[13]=b):(p=e[12],b=e[13]);let h;e[14]===j?h=e[15]:(h=(0,a.jsx)(H,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...j,className:b,children:p})}),e[14]=j,e[15]=h);let k;e[16]===m?k=e[17]:(k=m({}),e[16]=m,e[17]=k);let F;e[18]===k?F=e[19]:(F=(0,a.jsx)("input",{...k,type:"file"}),e[18]=k,e[19]=F);let _;e[20]===n?_=e[21]:(_=(0,a.jsx)(ht,{"data-testid":"file-explorer-refresh-button",onClick:n}),e[20]=n,e[21]=_);let M=o?"Hide hidden files":"Show hidden files",D;e[22]===o?D=e[23]:(D=o?(0,a.jsx)(Rt,{size:16,className:"text-primary"}):(0,a.jsx)(Zt,{size:16}),e[22]=o,e[23]=D);let C;e[24]!==i||e[25]!==D?(C=(0,a.jsx)(A,{"data-testid":"file-explorer-hidden-files-button",onClick:i,variant:"text",size:"xs",children:D}),e[24]=i,e[25]=D,e[26]=C):C=e[26];let S;e[27]!==M||e[28]!==C?(S=(0,a.jsx)(H,{content:M,children:C}),e[27]=M,e[28]=C,e[29]=S):S=e[29];let T;e[30]===Symbol.for("react.memo_cache_sentinel")?(T=(0,a.jsx)(Wa,{size:16}),e[30]=T):T=e[30];let P;e[31]===x?P=e[32]:(P=(0,a.jsx)(H,{content:"Collapse all folders",children:(0,a.jsx)(A,{"data-testid":"file-explorer-collapse-button",onClick:x,variant:"text",size:"xs",children:T})}),e[31]=x,e[32]=P);let E;return e[33]!==h||e[34]!==F||e[35]!==_||e[36]!==S||e[37]!==P||e[38]!==u||e[39]!==w||e[40]!==l?(E=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[u,w,l,h,F,_,S,P]}),e[33]=h,e[34]=F,e[35]=_,e[36]=S,e[37]=P,e[38]=u,e[39]=w,e[40]=l,e[41]=E):E=e[41],E},Fn=t=>{let e=(0,be.c)(9),{node:n,onOpenMarimoFile:i}=t,o;e[0]===n?o=e[1]:(o=c=>{n.data.isDirectory||(c.stopPropagation(),n.select())},e[0]=n,e[1]=o);let r;e[2]!==n.data.isMarimoFile||e[3]!==i?(r=n.data.isMarimoFile&&!Fe()&&(0,a.jsxs)("span",{"data-testid":"file-explorer-open-marimo-button",className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:i,children:["open ",(0,a.jsx)($e,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=i,e[4]=r):r=e[4];let d;return e[5]!==n.data.name||e[6]!==o||e[7]!==r?(d=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:o,children:[n.data.name,r]}),e[5]=n.data.name,e[6]=o,e[7]=r,e[8]=d):d=e[8],d},_n=t=>{let e=(0,be.c)(116),{node:n,style:i,dragHandle:o}=t,{openFile:r,sendFileDetails:d}=Pe(),c=ye(Je),x;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(x=n.data.isDirectory?"directory":ia(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=x):x=e[2];let s=x,y=ca[s],{openConfirm:m,openPrompt:f}=ct(),{createNewCell:u}=Et(),g=Da(),w;e[3]!==u||e[4]!==g?(w=z=>{u({code:z,before:!1,cellId:g??"__end__"})},e[3]=u,e[4]=g,e[5]=w):w=e[5];let v=w,l=(0,$.use)(Pt),j;e[6]!==n.data.path||e[7]!==l?(j=async z=>{Ot(z,l?l.relativeFromRoot(n.data.path):n.data.path)},e[6]=n.data.path,e[7]=l,e[8]=j):j=e[8];let p=j,b;e[9]!==n.data.name||e[10]!==n.id||e[11]!==n.tree||e[12]!==m?(b=async z=>{z.stopPropagation(),z.preventDefault(),m({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,a.jsx)(Wt,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},e[9]=n.data.name,e[10]=n.id,e[11]=n.tree,e[12]=m,e[13]=b):b=e[13];let h=b,k;e[14]!==n||e[15]!==f||e[16]!==l?(k=async()=>{n.open(),f({title:"Folder name",onConfirm:async z=>{l==null||l.createFolder(z,n.id)}})},e[14]=n,e[15]=f,e[16]=l,e[17]=k):k=e[17];let F=ee(k),_;e[18]!==n||e[19]!==f||e[20]!==l?(_=async()=>{n.open(),f({title:"File name",onConfirm:async z=>{l==null||l.createFile({name:z,parentId:n.id})}})},e[18]=n,e[19]=f,e[20]=l,e[21]=_):_=e[21];let M=ee(_),D;e[22]!==n||e[23]!==f||e[24]!==l?(D=async()=>{n.open(),f({title:"Notebook name",onConfirm:async z=>{l==null||l.createFile({name:z,parentId:n.id,type:"notebook"})}})},e[22]=n,e[23]=f,e[24]=l,e[25]=D):D=e[25];let C=ee(D),S;e[26]!==n.data.name||e[27]!==n.id||e[28]!==l?(S=async()=>{l&&await l.copy(n.id,Ea(n.data.name))},e[26]=n.data.name,e[27]=n.id,e[28]=l,e[29]=S):S=e[29];let T=ee(S),P;e[30]===Symbol.for("react.memo_cache_sentinel")?(P=ie("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[30]=P):P=e[30];let E,K;e[31]===n?(E=e[32],K=e[33]):(E=z=>{z.stopPropagation(),n.data.isDirectory&&n.toggle()},K=(0,a.jsx)(Cn,{node:n}),e[31]=n,e[32]=E,e[33]=K);let oe=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground",L;e[34]===oe?L=e[35]:(L=ie("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",oe),e[34]=oe,e[35]=L);let Q;e[36]!==y||e[37]!==s||e[38]!==n.data.isMarimoFile?(Q=n.data.isMarimoFile?(0,a.jsx)(Ba,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}):(0,a.jsx)(y,{className:ie("w-5 h-5 shrink-0 mr-2",at[s]),strokeWidth:1.5}),e[36]=y,e[37]=s,e[38]=n.data.isMarimoFile,e[39]=Q):Q=e[39];let V;e[40]!==p||e[41]!==n?(V=n.isEditing?(0,a.jsx)(ba,{node:n}):(0,a.jsx)(Fn,{node:n,onOpenMarimoFile:p}),e[40]=p,e[41]=n,e[42]=V):V=e[42];let B;e[43]===n?B=e[44]:(B=!n.data.isDirectory&&(0,a.jsxs)(R,{onSelect:()=>n.select(),"data-testid":"file-explorer-open-file-menu-item",children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"Open file"]}),e[43]=n,e[44]=B);let q;e[45]!==n.data.isDirectory||e[46]!==n.data.path||e[47]!==r?(q=!n.data.isDirectory&&!Fe()&&(0,a.jsxs)(R,{onSelect:()=>{r({path:n.data.path})},"data-testid":"file-explorer-open-external-menu-item",children:[(0,a.jsx)($e,{className:"h-3.5 w-3.5 mr-2"}),"Open file in external editor"]}),e[45]=n.data.isDirectory,e[46]=n.data.path,e[47]=r,e[48]=q):q=e[48];let Y;e[49]!==M||e[50]!==F||e[51]!==C||e[52]!==n.data.isDirectory?(Y=n.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(R,{onSelect:()=>C(),"data-testid":"file-explorer-create-notebook-menu-item",children:[(0,a.jsx)(yt,{className:"h-3.5 w-3.5 mr-2"}),"Create notebook"]}),(0,a.jsxs)(R,{onSelect:()=>M(),"data-testid":"file-explorer-create-file-menu-item",children:[(0,a.jsx)(jt,{className:"h-3.5 w-3.5 mr-2"}),"Create file"]}),(0,a.jsxs)(R,{onSelect:()=>F(),"data-testid":"file-explorer-create-folder-menu-item",children:[(0,a.jsx)(gt,{className:"h-3.5 w-3.5 mr-2"}),"Create folder"]}),(0,a.jsx)(ue,{})]}),e[49]=M,e[50]=F,e[51]=C,e[52]=n.data.isDirectory,e[53]=Y):Y=e[53];let U;e[54]===n?U=e[55]:(U=(0,a.jsx)(pa,{onSelect:()=>n.edit(),testId:"file-explorer-rename-menu-item"}),e[54]=n,e[55]=U);let W;e[56]===T?W=e[57]:(W=(0,a.jsx)(ga,{onSelect:T,testId:"file-explorer-duplicate-menu-item"}),e[56]=T,e[57]=W);let G;e[58]===n.data.path?G=e[59]:(G=async()=>{await je(n.data.path),te({title:"Copied to clipboard"})},e[58]=n.data.path,e[59]=G);let ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(ae=(0,a.jsx)(bt,{className:ge}),e[60]=ae):ae=e[60];let N;e[61]===G?N=e[62]:(N=(0,a.jsxs)(R,{onSelect:G,"data-testid":"file-explorer-copy-path-menu-item",children:[ae,"Copy path"]}),e[61]=G,e[62]=N);let O;e[63]!==n.data.path||e[64]!==l?(O=l&&(0,a.jsxs)(R,{onSelect:async()=>{await je(l.relativeFromRoot(n.data.path)),te({title:"Copied to clipboard"})},"data-testid":"file-explorer-copy-relative-path-menu-item",children:[(0,a.jsx)(bt,{className:"h-3.5 w-3.5 mr-2"}),"Copy relative path"]}),e[63]=n.data.path,e[64]=l,e[65]=O):O=e[65];let I;e[66]===Symbol.for("react.memo_cache_sentinel")?(I=(0,a.jsx)(ue,{}),e[66]=I):I=e[66];let J;e[67]!==s||e[68]!==v||e[69]!==n.data?(J=()=>{let{path:z}=n.data;v(Dt[s](z))},e[67]=s,e[68]=v,e[69]=n.data,e[70]=J):J=e[70];let X;e[71]===Symbol.for("react.memo_cache_sentinel")?(X=(0,a.jsx)(ra,{className:ge}),e[71]=X):X=e[71];let Z;e[72]===J?Z=e[73]:(Z=(0,a.jsxs)(R,{onSelect:J,"data-testid":"file-explorer-insert-snippet-menu-item",children:[X,"Insert snippet for reading file"]}),e[72]=J,e[73]=Z);let ne;e[74]!==s||e[75]!==n.data?(ne=async()=>{te({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:z}=n.data;await je(Dt[s](z))},e[74]=s,e[75]=n.data,e[76]=ne):ne=e[76];let ve;e[77]===Symbol.for("react.memo_cache_sentinel")?(ve=(0,a.jsx)(Lt,{className:ge}),e[77]=ve):ve=e[77];let ce;e[78]===ne?ce=e[79]:(ce=(0,a.jsxs)(R,{onSelect:ne,"data-testid":"file-explorer-copy-snippet-menu-item",children:[ve,"Copy snippet for reading file"]}),e[78]=ne,e[79]=ce);let de;e[80]!==p||e[81]!==n.data.isMarimoFile?(de=n.data.isMarimoFile&&!Fe()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ue,{}),(0,a.jsxs)(R,{onSelect:p,"data-testid":"file-explorer-open-notebook-menu-item",children:[(0,a.jsx)(Ja,{className:"h-3.5 w-3.5 mr-2"}),"Open notebook"]})]}),e[80]=p,e[81]=n.data.isMarimoFile,e[82]=de):de=e[82];let we;e[83]===Symbol.for("react.memo_cache_sentinel")?(we=(0,a.jsx)(ue,{}),e[83]=we):we=e[83];let me;e[84]!==c||e[85]!==n.data.isDirectory||e[86]!==n.data.name||e[87]!==n.data.path||e[88]!==d?(me=!n.data.isDirectory&&!c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(R,{onSelect:async()=>{let z=await d({path:n.data.path});z.isBase64&&z.contents?Ce(dt(Te(z.contents,z.mimeType||"application/octet-stream")),n.data.name):Ce(new Blob([z.contents||""]),n.data.name)},"data-testid":"file-explorer-download-menu-item",children:[(0,a.jsx)(De,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{})]}),e[84]=c,e[85]=n.data.isDirectory,e[86]=n.data.name,e[87]=n.data.path,e[88]=d,e[89]=me):me=e[89];let pe;e[90]===h?pe=e[91]:(pe=(0,a.jsx)(ja,{onSelect:h,testId:"file-explorer-delete-menu-item"}),e[90]=h,e[91]=pe);let he;e[92]!==B||e[93]!==q||e[94]!==Y||e[95]!==U||e[96]!==W||e[97]!==N||e[98]!==O||e[99]!==Z||e[100]!==ce||e[101]!==de||e[102]!==me||e[103]!==pe?(he=(0,a.jsxs)(ua,{testId:"file-explorer-more-button",iconClassName:"w-5 h-5",children:[B,q,Y,U,W,N,O,I,Z,ce,de,we,me,pe]}),e[92]=B,e[93]=q,e[94]=Y,e[95]=U,e[96]=W,e[97]=N,e[98]=O,e[99]=Z,e[100]=ce,e[101]=de,e[102]=me,e[103]=pe,e[104]=he):he=e[104];let xe;e[105]!==L||e[106]!==Q||e[107]!==V||e[108]!==he?(xe=(0,a.jsxs)("span",{className:L,children:[Q,V,he]}),e[105]=L,e[106]=Q,e[107]=V,e[108]=he,e[109]=xe):xe=e[109];let Ne;return e[110]!==o||e[111]!==i||e[112]!==E||e[113]!==K||e[114]!==xe?(Ne=(0,a.jsxs)("div",{style:i,ref:o,className:P,draggable:!0,onClick:E,children:[K,xe]}),e[110]=o,e[111]=i,e[112]=E,e[113]=K,e[114]=xe,e[115]=Ne):Ne=e[115],Ne},Cn=t=>{let e=(0,be.c)(3),{node:n}=t;if(!n.data.isDirectory){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)("span",{className:"w-4 h-4 shrink-0"}),e[0]=o):o=e[0],o}let i;return e[1]===n.isOpen?i=e[2]:(i=(0,a.jsx)(Ee,{isExpanded:n.isOpen,className:"w-4 h-4"}),e[1]=n.isOpen,e[2]=i),i};function Ot(t,e){t.stopPropagation(),t.preventDefault(),qa(e)}function Tt(t,e){if(e)return t;let n=[];for(let i of t){if(Sn(i.name))continue;let o=i;if(i.children){let r=Tt(i.children,e);r!==i.children&&(o={...i,children:r})}n.push(o)}return n}function Sn(t){return!!t.startsWith(".")}function Mn(){return null}function Dn(t){let{parentNode:e}=t;return!e.data.isDirectory}var $t=fe(),zn=Ge("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},We),Pn=t=>{let e=(0,$t.c)(20),{height:n}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noClick:!0,noKeyboard:!0},e[0]=i):i=e[0];let{getRootProps:o,getInputProps:r,isDragActive:d}=zt(i),c;e[1]===o?c=e[2]:(c=o(),e[1]=o,e[2]=c);let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=ie("flex flex-col overflow-hidden relative"),e[3]=x):x=e[3];let s;e[4]===n?s=e[5]:(s={height:n},e[4]=n,e[5]=s);let y;e[6]===r?y=e[7]:(y=r(),e[6]=r,e[7]=y);let m;e[8]===y?m=e[9]:(m=(0,a.jsx)("input",{...y}),e[8]=y,e[9]=m);let f;e[10]===d?f=e[11]:(f=d&&(0,a.jsx)("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),e[10]=d,e[11]=f);let u;e[12]===n?u=e[13]:(u=(0,a.jsx)(wn,{height:n}),e[12]=n,e[13]=u);let g;return e[14]!==c||e[15]!==s||e[16]!==m||e[17]!==f||e[18]!==u?(g=(0,a.jsx)(on,{children:(0,a.jsxs)("div",{...c,className:x,style:s,children:[m,f,u]})}),e[14]=c,e[15]=s,e[16]=m,e[17]=f,e[18]=u,e[19]=g):g=e[19],g},On=33,Tn=()=>{let t=(0,$t.c)(36),{ref:e,height:n}=$a(),i=n===void 0?500:n,[o,r]=ke(zn),d=ye(na).length,c;e:{if(!o.hasUserInteracted&&d>0){if(o.openSections.includes("remote-storage")){c=o.openSections;break e}let P;t[0]===o.openSections?P=t[1]:(P=[...o.openSections,"remote-storage"],t[0]=o.openSections,t[1]=P),c=P;break e}c=o.openSections}let x=c,s;t[2]===r?s=t[3]:(s=P=>{r({openSections:P,hasUserInteracted:!0})},t[2]=r,t[3]=s);let y=s,m=i-On*2,f;t[4]===x?f=t[5]:(f=x.includes("remote-storage"),t[4]=x,t[5]=f);let u=f,g;t[6]!==x||t[7]!==u?(g=u&&x.includes("files"),t[6]=x,t[7]=u,t[8]=g):g=t[8];let w=g,v;t[9]!==m||t[10]!==w?(v=w?Math.round(m*.4):m,t[9]=m,t[10]=w,t[11]=v):v=t[11];let l=v,j=Math.max(200,w?m-l:m),p;t[12]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(rt,{className:"w-4 h-4"}),t[12]=p):p=t[12];let b;t[13]===d?b=t[14]:(b=d>0&&(0,a.jsx)(Va,{children:d}),t[13]=d,t[14]=b);let h;t[15]===b?h=t[16]:(h=(0,a.jsxs)(ft,{children:[p," Remote storage",b]}),t[15]=b,t[16]=h);let k;t[17]===l?k=t[18]:(k={maxHeight:l},t[17]=l,t[18]=k);let F;t[19]===Symbol.for("react.memo_cache_sentinel")?(F=(0,a.jsx)(rn,{}),t[19]=F):F=t[19];let _;t[20]===k?_=t[21]:(_=(0,a.jsx)(ut,{className:"overflow-auto",style:k,children:F}),t[20]=k,t[21]=_);let M;t[22]!==_||t[23]!==h?(M=(0,a.jsxs)(xt,{value:"remote-storage",children:[h,_]}),t[22]=_,t[23]=h,t[24]=M):M=t[24];let D;t[25]===Symbol.for("react.memo_cache_sentinel")?(D=(0,a.jsxs)(ft,{children:[(0,a.jsx)(nt,{className:"w-4 h-4"}),"Files"]}),t[25]=D):D=t[25];let C;t[26]===j?C=t[27]:(C=(0,a.jsxs)(xt,{value:"files",children:[D,(0,a.jsx)(ut,{children:(0,a.jsx)(Pn,{height:j})})]}),t[26]=j,t[27]=C);let S;t[28]!==y||t[29]!==x||t[30]!==M||t[31]!==C?(S=(0,a.jsxs)(Ut,{type:"multiple",value:x,onValueChange:y,children:[M,C]}),t[28]=y,t[29]=x,t[30]=M,t[31]=C,t[32]=S):S=t[32];let T;return t[33]!==e||t[34]!==S?(T=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:S}),t[33]=e,t[34]=S,t[35]=T):T=t[35],T};export{Tn as default};
|
|
26
|
+
`};var pn=fe(),hn=1024*1024*100,xn=5;function zt(t){let e=(0,pn.c)(7),n;e[0]===t?n=e[1]:(n=t===void 0?{}:t,e[0]=t,e[1]=n);let i=n,{sendCreateFileOrFolder:o}=Pe(),r;e[2]===o?r=e[3]:(r=async c=>{if(c.length===0)return;let x=c.length===1;await Xt(x?"Uploading file...":"Uploading files...",async s=>{s.addTotal(c.length),await Ra(c,xn,async y=>{let m=bn(gn(y)),f="";m&&(f=Fa.guessDeliminator(m).dirname(m)),await o({path:f,type:"file",name:y.name,file:y}),s.increment(1)}),await mn()},{title:x?"File uploaded":`${c.length} files uploaded`})},e[2]=o,e[3]=r);let d;return e[4]!==i||e[5]!==r?(d={multiple:!0,maxSize:hn,onError:jn,onDropRejected:fn,onDrop:r,...i},e[4]=i,e[5]=r,e[6]=d):d=e[6],_a(d)}function fn(t){te({title:"File upload failed",description:(0,a.jsx)("div",{className:"flex flex-col gap-1",children:t.map(un)}),variant:"danger"})}function un(t){return(0,a.jsxs)("div",{children:[t.file.name," (",t.errors.map(yn).join(", "),")"]},t.file.name)}function yn(t){return t.message}function jn(t){Me.error(t),te({title:"File upload failed",description:t.message,variant:"danger"})}function gn(t){if(t.webkitRelativePath)return t.webkitRelativePath;if("path"in t&&typeof t.path=="string")return t.path;if("relativePath"in t&&typeof t.relativePath=="string")return t.relativePath}function bn(t){if(t)return t.replace(/^\/+/,"")}var be=fe(),vn=Ge("marimo:showHiddenFiles",!0,We,{getOnInit:!0}),Pt=$.createContext(null);const wn=t=>{let e=(0,be.c)(73),{height:n}=t,i=(0,$.useRef)(null),o=sn(),[r]=ke(Mt),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[c,x]=(0,$.useState)(d),[s,y]=(0,$.useState)(null),[m,f]=ke(vn),{openPrompt:u}=ct(),[g,w]=ke(dn),v;e[1]===r?v=e[2]:(v=()=>r.initialize(x),e[1]=r,e[2]=v);let l;e[3]===Symbol.for("react.memo_cache_sentinel")?(l=[],e[3]=l):l=e[3];let{isPending:j,error:p}=Ae(v,l),b;e[4]!==g||e[5]!==r?(b=()=>r.refreshAll(Object.keys(g).filter(N=>g[N])),e[4]=g,e[5]=r,e[6]=b):b=e[6];let h=ee(b),k;e[7]!==f||e[8]!==m?(k=()=>{f(!m)},e[7]=f,e[8]=m,e[9]=k):k=e[9];let _=ee(k),F;e[10]!==u||e[11]!==r?(F=async()=>{u({title:"Folder name",onConfirm:async N=>{r.createFolder(N,null)}})},e[10]=u,e[11]=r,e[12]=F):F=e[12];let M=ee(F),D;e[13]!==u||e[14]!==r?(D=async()=>{u({title:"File name",onConfirm:async N=>{r.createFile({name:N,parentId:null})}})},e[13]=u,e[14]=r,e[15]=D):D=e[15];let C=ee(D),S;e[16]!==u||e[17]!==r?(S=async()=>{u({title:"Notebook name",onConfirm:async N=>{r.createFile({name:N,parentId:null,type:"notebook"})}})},e[16]=u,e[17]=r,e[18]=S):S=e[18];let T=ee(S),P;e[19]===w?P=e[20]:(P=()=>{var N;(N=i.current)==null||N.closeAll(),w({})},e[19]=w,e[20]=P);let E=ee(P),K;e[21]!==c||e[22]!==m?(K=Tt(c,m),e[21]=c,e[22]=m,e[23]=K):K=e[23];let oe=K;if(j){let N;return e[24]===Symbol.for("react.memo_cache_sentinel")?(N=(0,a.jsx)(ma,{size:"medium",centered:!0}),e[24]=N):N=e[24],N}if(p){let N;return e[25]===p?N=e[26]:(N=(0,a.jsx)(mt,{error:p}),e[25]=p,e[26]=N),N}if(s){let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=()=>y(null),e[27]=N):N=e[27];let O;e[28]===Symbol.for("react.memo_cache_sentinel")?(O=(0,a.jsx)(A,{onClick:N,"data-testid":"file-explorer-back-button",variant:"text",size:"xs",className:"mb-0",children:(0,a.jsx)(Ze,{size:16})}),e[28]=O):O=e[28];let I;e[29]===s.name?I=e[30]:(I=(0,a.jsxs)("div",{className:"flex items-center pl-1 pr-3 shrink-0 border-b justify-between",children:[O,(0,a.jsx)("span",{className:"font-bold",children:s.name})]}),e[29]=s.name,e[30]=I);let J;e[31]!==s.path||e[32]!==r?(J=ne=>Ot(ne,r.relativeFromRoot(s.path)),e[31]=s.path,e[32]=r,e[33]=J):J=e[33];let X;e[34]!==s||e[35]!==J?(X=(0,a.jsx)($.Suspense,{children:(0,a.jsx)(cn,{onOpenNotebook:J,file:s})}),e[34]=s,e[35]=J,e[36]=X):X=e[36];let Z;return e[37]!==I||e[38]!==X?(Z=(0,a.jsxs)(a.Fragment,{children:[I,X]}),e[37]=I,e[38]=X,e[39]=Z):Z=e[39],Z}let L;e[40]!==E||e[41]!==C||e[42]!==M||e[43]!==T||e[44]!==_||e[45]!==h||e[46]!==m||e[47]!==r?(L=(0,a.jsx)(kn,{onRefresh:h,onHidden:_,showHiddenFiles:m,onCreateFile:C,onCreateNotebook:T,onCreateFolder:M,onCollapseAll:E,tree:r}),e[40]=E,e[41]=C,e[42]=M,e[43]=T,e[44]=_,e[45]=h,e[46]=m,e[47]=r,e[48]=L):L=e[48];let Q=n-33,V,B,q;e[49]===r?(V=e[50],B=e[51],q=e[52]):(V=async N=>{let{ids:O}=N;for(let I of O)await r.delete(I)},B=async N=>{let{id:O,name:I}=N;await r.rename(O,I)},q=async N=>{let{dragIds:O,parentId:I}=N;await r.move(O,I)},e[49]=r,e[50]=V,e[51]=B,e[52]=q);let Y;e[53]===Symbol.for("react.memo_cache_sentinel")?(Y=N=>{let O=N[0];O&&(O.data.isDirectory||y(O.data))},e[53]=Y):Y=e[53];let U;e[54]!==g||e[55]!==w||e[56]!==r?(U=async N=>{if(await r.expand(N)){let O=g[N]??!1;w({...g,[N]:!O})}},e[54]=g,e[55]=w,e[56]=r,e[57]=U):U=e[57];let W;e[58]!==o||e[59]!==g||e[60]!==Q||e[61]!==V||e[62]!==B||e[63]!==q||e[64]!==U||e[65]!==oe?(W=(0,a.jsx)(ya,{width:"100%",ref:i,height:Q,className:"h-full",data:oe,initialOpenState:g,openByDefault:!1,dndManager:o,renderCursor:Mn,disableDrop:Dn,onDelete:V,onRename:B,onMove:q,onSelect:Y,onToggle:U,padding:15,rowHeight:30,indent:Nn,overscanCount:1e3,disableMultiSelection:!0,children:Fn}),e[58]=o,e[59]=g,e[60]=Q,e[61]=V,e[62]=B,e[63]=q,e[64]=U,e[65]=oe,e[66]=W):W=e[66];let G;e[67]!==W||e[68]!==r?(G=(0,a.jsx)(Pt,{value:r,children:W}),e[67]=W,e[68]=r,e[69]=G):G=e[69];let ae;return e[70]!==L||e[71]!==G?(ae=(0,a.jsxs)(a.Fragment,{children:[L,G]}),e[70]=L,e[71]=G,e[72]=ae):ae=e[72],ae};var Nn=15,kn=t=>{let e=(0,be.c)(42),{onRefresh:n,onHidden:i,showHiddenFiles:o,onCreateFile:r,onCreateNotebook:d,onCreateFolder:c,onCollapseAll:x}=t,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={noDrag:!0,noDragEventsBubbling:!0},e[0]=s):s=e[0];let{getRootProps:y,getInputProps:m}=zt(s),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=(0,a.jsx)(yt,{size:16}),e[1]=f):f=e[1];let u;e[2]===d?u=e[3]:(u=(0,a.jsx)(H,{content:"Add notebook",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-notebook-button",onClick:d,variant:"text",size:"xs",children:f})}),e[2]=d,e[3]=u);let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=(0,a.jsx)(jt,{size:16}),e[4]=g):g=e[4];let w;e[5]===r?w=e[6]:(w=(0,a.jsx)(H,{content:"Add file",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-file-button",onClick:r,variant:"text",size:"xs",children:g})}),e[5]=r,e[6]=w);let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=(0,a.jsx)(gt,{size:16}),e[7]=v):v=e[7];let l;e[8]===c?l=e[9]:(l=(0,a.jsx)(H,{content:"Add folder",children:(0,a.jsx)(A,{"data-testid":"file-explorer-add-folder-button",onClick:c,variant:"text",size:"xs",children:v})}),e[8]=c,e[9]=l);let j;e[10]===y?j=e[11]:(j=y({}),e[10]=y,e[11]=j);let p,b;e[12]===Symbol.for("react.memo_cache_sentinel")?(b=Qt({variant:"text",size:"xs"}),p=(0,a.jsx)(ka,{size:16}),e[12]=p,e[13]=b):(p=e[12],b=e[13]);let h;e[14]===j?h=e[15]:(h=(0,a.jsx)(H,{content:"Upload file",children:(0,a.jsx)("button",{"data-testid":"file-explorer-upload-button",...j,className:b,children:p})}),e[14]=j,e[15]=h);let k;e[16]===m?k=e[17]:(k=m({}),e[16]=m,e[17]=k);let _;e[18]===k?_=e[19]:(_=(0,a.jsx)("input",{...k,type:"file"}),e[18]=k,e[19]=_);let F;e[20]===n?F=e[21]:(F=(0,a.jsx)(ht,{"data-testid":"file-explorer-refresh-button",onClick:n}),e[20]=n,e[21]=F);let M=o?"Hide hidden files":"Show hidden files",D;e[22]===o?D=e[23]:(D=o?(0,a.jsx)(Rt,{size:16,className:"text-primary"}):(0,a.jsx)(Zt,{size:16}),e[22]=o,e[23]=D);let C;e[24]!==i||e[25]!==D?(C=(0,a.jsx)(A,{"data-testid":"file-explorer-hidden-files-button",onClick:i,variant:"text",size:"xs",children:D}),e[24]=i,e[25]=D,e[26]=C):C=e[26];let S;e[27]!==M||e[28]!==C?(S=(0,a.jsx)(H,{content:M,children:C}),e[27]=M,e[28]=C,e[29]=S):S=e[29];let T;e[30]===Symbol.for("react.memo_cache_sentinel")?(T=(0,a.jsx)(Wa,{size:16}),e[30]=T):T=e[30];let P;e[31]===x?P=e[32]:(P=(0,a.jsx)(H,{content:"Collapse all folders",children:(0,a.jsx)(A,{"data-testid":"file-explorer-collapse-button",onClick:x,variant:"text",size:"xs",children:T})}),e[31]=x,e[32]=P);let E;return e[33]!==h||e[34]!==_||e[35]!==F||e[36]!==S||e[37]!==P||e[38]!==u||e[39]!==w||e[40]!==l?(E=(0,a.jsxs)("div",{className:"flex items-center justify-end px-2 shrink-0 border-b",children:[u,w,l,h,_,F,S,P]}),e[33]=h,e[34]=_,e[35]=F,e[36]=S,e[37]=P,e[38]=u,e[39]=w,e[40]=l,e[41]=E):E=e[41],E},_n=t=>{let e=(0,be.c)(9),{node:n,onOpenMarimoFile:i}=t,o;e[0]===n?o=e[1]:(o=c=>{n.data.isDirectory||(c.stopPropagation(),n.select())},e[0]=n,e[1]=o);let r;e[2]!==n.data.isMarimoFile||e[3]!==i?(r=n.data.isMarimoFile&&!_e()&&(0,a.jsxs)("span",{"data-testid":"file-explorer-open-marimo-button",className:"shrink-0 ml-2 text-sm hidden group-hover:inline hover:underline",onClick:i,children:["open ",(0,a.jsx)($e,{className:"inline ml-1",size:12})]}),e[2]=n.data.isMarimoFile,e[3]=i,e[4]=r):r=e[4];let d;return e[5]!==n.data.name||e[6]!==o||e[7]!==r?(d=(0,a.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",onClick:o,children:[n.data.name,r]}),e[5]=n.data.name,e[6]=o,e[7]=r,e[8]=d):d=e[8],d},Fn=t=>{let e=(0,be.c)(116),{node:n,style:i,dragHandle:o}=t,{openFile:r,sendFileDetails:d}=Pe(),c=ye(Je),x;e[0]!==n.data.isDirectory||e[1]!==n.data.name?(x=n.data.isDirectory?"directory":ia(n.data.name),e[0]=n.data.isDirectory,e[1]=n.data.name,e[2]=x):x=e[2];let s=x,y=ca[s],{openConfirm:m,openPrompt:f}=ct(),{createNewCell:u}=Et(),g=Da(),w;e[3]!==u||e[4]!==g?(w=z=>{u({code:z,before:!1,cellId:g??"__end__"})},e[3]=u,e[4]=g,e[5]=w):w=e[5];let v=w,l=(0,$.use)(Pt),j;e[6]!==n.data.path||e[7]!==l?(j=async z=>{Ot(z,l?l.relativeFromRoot(n.data.path):n.data.path)},e[6]=n.data.path,e[7]=l,e[8]=j):j=e[8];let p=j,b;e[9]!==n.data.name||e[10]!==n.id||e[11]!==n.tree||e[12]!==m?(b=async z=>{z.stopPropagation(),z.preventDefault(),m({title:"Delete file",description:`Are you sure you want to delete ${n.data.name}?`,confirmAction:(0,a.jsx)(Wt,{onClick:async()=>{await n.tree.delete(n.id)},"aria-label":"Confirm",children:"Delete"})})},e[9]=n.data.name,e[10]=n.id,e[11]=n.tree,e[12]=m,e[13]=b):b=e[13];let h=b,k;e[14]!==n||e[15]!==f||e[16]!==l?(k=async()=>{n.open(),f({title:"Folder name",onConfirm:async z=>{l==null||l.createFolder(z,n.id)}})},e[14]=n,e[15]=f,e[16]=l,e[17]=k):k=e[17];let _=ee(k),F;e[18]!==n||e[19]!==f||e[20]!==l?(F=async()=>{n.open(),f({title:"File name",onConfirm:async z=>{l==null||l.createFile({name:z,parentId:n.id})}})},e[18]=n,e[19]=f,e[20]=l,e[21]=F):F=e[21];let M=ee(F),D;e[22]!==n||e[23]!==f||e[24]!==l?(D=async()=>{n.open(),f({title:"Notebook name",onConfirm:async z=>{l==null||l.createFile({name:z,parentId:n.id,type:"notebook"})}})},e[22]=n,e[23]=f,e[24]=l,e[25]=D):D=e[25];let C=ee(D),S;e[26]!==n.data.name||e[27]!==n.id||e[28]!==l?(S=async()=>{l&&await l.copy(n.id,Ea(n.data.name))},e[26]=n.data.name,e[27]=n.id,e[28]=l,e[29]=S):S=e[29];let T=ee(S),P;e[30]===Symbol.for("react.memo_cache_sentinel")?(P=ie("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group"),e[30]=P):P=e[30];let E,K;e[31]===n?(E=e[32],K=e[33]):(E=z=>{z.stopPropagation(),n.data.isDirectory&&n.toggle()},K=(0,a.jsx)(Cn,{node:n}),e[31]=n,e[32]=E,e[33]=K);let oe=n.willReceiveDrop&&n.data.isDirectory&&"bg-accent/80 hover:bg-accent/80 text-accent-foreground",L;e[34]===oe?L=e[35]:(L=ie("flex items-center pl-1 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden group",oe),e[34]=oe,e[35]=L);let Q;e[36]!==y||e[37]!==s||e[38]!==n.data.isMarimoFile?(Q=n.data.isMarimoFile?(0,a.jsx)(Ba,{className:"w-5 h-5 shrink-0 mr-2",strokeWidth:1.5}):(0,a.jsx)(y,{className:ie("w-5 h-5 shrink-0 mr-2",at[s]),strokeWidth:1.5}),e[36]=y,e[37]=s,e[38]=n.data.isMarimoFile,e[39]=Q):Q=e[39];let V;e[40]!==p||e[41]!==n?(V=n.isEditing?(0,a.jsx)(ba,{node:n}):(0,a.jsx)(_n,{node:n,onOpenMarimoFile:p}),e[40]=p,e[41]=n,e[42]=V):V=e[42];let B;e[43]===n?B=e[44]:(B=!n.data.isDirectory&&(0,a.jsxs)(R,{onSelect:()=>n.select(),"data-testid":"file-explorer-open-file-menu-item",children:[(0,a.jsx)(vt,{className:"h-3.5 w-3.5 mr-2"}),"Open file"]}),e[43]=n,e[44]=B);let q;e[45]!==n.data.isDirectory||e[46]!==n.data.path||e[47]!==r?(q=!n.data.isDirectory&&!_e()&&(0,a.jsxs)(R,{onSelect:()=>{r({path:n.data.path})},"data-testid":"file-explorer-open-external-menu-item",children:[(0,a.jsx)($e,{className:"h-3.5 w-3.5 mr-2"}),"Open file in external editor"]}),e[45]=n.data.isDirectory,e[46]=n.data.path,e[47]=r,e[48]=q):q=e[48];let Y;e[49]!==M||e[50]!==_||e[51]!==C||e[52]!==n.data.isDirectory?(Y=n.data.isDirectory&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(R,{onSelect:()=>C(),"data-testid":"file-explorer-create-notebook-menu-item",children:[(0,a.jsx)(yt,{className:"h-3.5 w-3.5 mr-2"}),"Create notebook"]}),(0,a.jsxs)(R,{onSelect:()=>M(),"data-testid":"file-explorer-create-file-menu-item",children:[(0,a.jsx)(jt,{className:"h-3.5 w-3.5 mr-2"}),"Create file"]}),(0,a.jsxs)(R,{onSelect:()=>_(),"data-testid":"file-explorer-create-folder-menu-item",children:[(0,a.jsx)(gt,{className:"h-3.5 w-3.5 mr-2"}),"Create folder"]}),(0,a.jsx)(ue,{})]}),e[49]=M,e[50]=_,e[51]=C,e[52]=n.data.isDirectory,e[53]=Y):Y=e[53];let U;e[54]===n?U=e[55]:(U=(0,a.jsx)(pa,{onSelect:()=>n.edit(),testId:"file-explorer-rename-menu-item"}),e[54]=n,e[55]=U);let W;e[56]===T?W=e[57]:(W=(0,a.jsx)(ga,{onSelect:T,testId:"file-explorer-duplicate-menu-item"}),e[56]=T,e[57]=W);let G;e[58]===n.data.path?G=e[59]:(G=async()=>{await je(n.data.path),te({title:"Copied to clipboard"})},e[58]=n.data.path,e[59]=G);let ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(ae=(0,a.jsx)(bt,{className:ge}),e[60]=ae):ae=e[60];let N;e[61]===G?N=e[62]:(N=(0,a.jsxs)(R,{onSelect:G,"data-testid":"file-explorer-copy-path-menu-item",children:[ae,"Copy path"]}),e[61]=G,e[62]=N);let O;e[63]!==n.data.path||e[64]!==l?(O=l&&(0,a.jsxs)(R,{onSelect:async()=>{await je(l.relativeFromRoot(n.data.path)),te({title:"Copied to clipboard"})},"data-testid":"file-explorer-copy-relative-path-menu-item",children:[(0,a.jsx)(bt,{className:"h-3.5 w-3.5 mr-2"}),"Copy relative path"]}),e[63]=n.data.path,e[64]=l,e[65]=O):O=e[65];let I;e[66]===Symbol.for("react.memo_cache_sentinel")?(I=(0,a.jsx)(ue,{}),e[66]=I):I=e[66];let J;e[67]!==s||e[68]!==v||e[69]!==n.data?(J=()=>{let{path:z}=n.data;v(Dt[s](z))},e[67]=s,e[68]=v,e[69]=n.data,e[70]=J):J=e[70];let X;e[71]===Symbol.for("react.memo_cache_sentinel")?(X=(0,a.jsx)(ra,{className:ge}),e[71]=X):X=e[71];let Z;e[72]===J?Z=e[73]:(Z=(0,a.jsxs)(R,{onSelect:J,"data-testid":"file-explorer-insert-snippet-menu-item",children:[X,"Insert snippet for reading file"]}),e[72]=J,e[73]=Z);let ne;e[74]!==s||e[75]!==n.data?(ne=async()=>{te({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:z}=n.data;await je(Dt[s](z))},e[74]=s,e[75]=n.data,e[76]=ne):ne=e[76];let ve;e[77]===Symbol.for("react.memo_cache_sentinel")?(ve=(0,a.jsx)(Lt,{className:ge}),e[77]=ve):ve=e[77];let ce;e[78]===ne?ce=e[79]:(ce=(0,a.jsxs)(R,{onSelect:ne,"data-testid":"file-explorer-copy-snippet-menu-item",children:[ve,"Copy snippet for reading file"]}),e[78]=ne,e[79]=ce);let de;e[80]!==p||e[81]!==n.data.isMarimoFile?(de=n.data.isMarimoFile&&!_e()&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ue,{}),(0,a.jsxs)(R,{onSelect:p,"data-testid":"file-explorer-open-notebook-menu-item",children:[(0,a.jsx)(Ja,{className:"h-3.5 w-3.5 mr-2"}),"Open notebook"]})]}),e[80]=p,e[81]=n.data.isMarimoFile,e[82]=de):de=e[82];let we;e[83]===Symbol.for("react.memo_cache_sentinel")?(we=(0,a.jsx)(ue,{}),e[83]=we):we=e[83];let me;e[84]!==c||e[85]!==n.data.isDirectory||e[86]!==n.data.name||e[87]!==n.data.path||e[88]!==d?(me=!n.data.isDirectory&&!c&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(R,{onSelect:async()=>{let z=await d({path:n.data.path});z.isBase64&&z.contents?Ce(dt(Te(z.contents,z.mimeType||"application/octet-stream")),n.data.name):Ce(new Blob([z.contents||""]),n.data.name)},"data-testid":"file-explorer-download-menu-item",children:[(0,a.jsx)(De,{className:"h-3.5 w-3.5 mr-2"}),"Download"]}),(0,a.jsx)(ue,{})]}),e[84]=c,e[85]=n.data.isDirectory,e[86]=n.data.name,e[87]=n.data.path,e[88]=d,e[89]=me):me=e[89];let pe;e[90]===h?pe=e[91]:(pe=(0,a.jsx)(ja,{onSelect:h,testId:"file-explorer-delete-menu-item"}),e[90]=h,e[91]=pe);let he;e[92]!==B||e[93]!==q||e[94]!==Y||e[95]!==U||e[96]!==W||e[97]!==N||e[98]!==O||e[99]!==Z||e[100]!==ce||e[101]!==de||e[102]!==me||e[103]!==pe?(he=(0,a.jsxs)(ua,{testId:"file-explorer-more-button",iconClassName:"w-5 h-5",children:[B,q,Y,U,W,N,O,I,Z,ce,de,we,me,pe]}),e[92]=B,e[93]=q,e[94]=Y,e[95]=U,e[96]=W,e[97]=N,e[98]=O,e[99]=Z,e[100]=ce,e[101]=de,e[102]=me,e[103]=pe,e[104]=he):he=e[104];let xe;e[105]!==L||e[106]!==Q||e[107]!==V||e[108]!==he?(xe=(0,a.jsxs)("span",{className:L,children:[Q,V,he]}),e[105]=L,e[106]=Q,e[107]=V,e[108]=he,e[109]=xe):xe=e[109];let Ne;return e[110]!==o||e[111]!==i||e[112]!==E||e[113]!==K||e[114]!==xe?(Ne=(0,a.jsxs)("div",{style:i,ref:o,className:P,draggable:!0,onClick:E,children:[K,xe]}),e[110]=o,e[111]=i,e[112]=E,e[113]=K,e[114]=xe,e[115]=Ne):Ne=e[115],Ne},Cn=t=>{let e=(0,be.c)(3),{node:n}=t;if(!n.data.isDirectory){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,a.jsx)("span",{className:"w-4 h-4 shrink-0"}),e[0]=o):o=e[0],o}let i;return e[1]===n.isOpen?i=e[2]:(i=(0,a.jsx)(Ee,{isExpanded:n.isOpen,className:"w-4 h-4"}),e[1]=n.isOpen,e[2]=i),i};function Ot(t,e){t.stopPropagation(),t.preventDefault(),qa(e)}function Tt(t,e){if(e)return t;let n=[];for(let i of t){if(Sn(i.name))continue;let o=i;if(i.children){let r=Tt(i.children,e);r!==i.children&&(o={...i,children:r})}n.push(o)}return n}function Sn(t){return!!t.startsWith(".")}function Mn(){return null}function Dn(t){let{parentNode:e}=t;return!e.data.isDirectory}var $t=fe(),zn=Ge("marimo:file-explorer-panel:state",{openSections:["files"],hasUserInteracted:!1},We),Pn=t=>{let e=(0,$t.c)(20),{height:n}=t,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={noClick:!0,noKeyboard:!0},e[0]=i):i=e[0];let{getRootProps:o,getInputProps:r,isDragActive:d}=zt(i),c;e[1]===o?c=e[2]:(c=o(),e[1]=o,e[2]=c);let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=ie("flex flex-col overflow-hidden relative"),e[3]=x):x=e[3];let s;e[4]===n?s=e[5]:(s={height:n},e[4]=n,e[5]=s);let y;e[6]===r?y=e[7]:(y=r(),e[6]=r,e[7]=y);let m;e[8]===y?m=e[9]:(m=(0,a.jsx)("input",{...y}),e[8]=y,e[9]=m);let f;e[10]===d?f=e[11]:(f=d&&(0,a.jsx)("div",{className:"absolute inset-0 flex items-center uppercase justify-center text-xl font-bold text-primary/90 bg-accent/85 z-10 border-2 border-dashed border-primary/90 rounded-lg pointer-events-none",children:"Drop files here"}),e[10]=d,e[11]=f);let u;e[12]===n?u=e[13]:(u=(0,a.jsx)(wn,{height:n}),e[12]=n,e[13]=u);let g;return e[14]!==c||e[15]!==s||e[16]!==m||e[17]!==f||e[18]!==u?(g=(0,a.jsx)(on,{children:(0,a.jsxs)("div",{...c,className:x,style:s,children:[m,f,u]})}),e[14]=c,e[15]=s,e[16]=m,e[17]=f,e[18]=u,e[19]=g):g=e[19],g},On=33,Tn=()=>{let t=(0,$t.c)(36),{ref:e,height:n}=$a(),i=n===void 0?500:n,[o,r]=ke(zn),d=ye(na).length,c;e:{if(!o.hasUserInteracted&&d>0){if(o.openSections.includes("remote-storage")){c=o.openSections;break e}let P;t[0]===o.openSections?P=t[1]:(P=[...o.openSections,"remote-storage"],t[0]=o.openSections,t[1]=P),c=P;break e}c=o.openSections}let x=c,s;t[2]===r?s=t[3]:(s=P=>{r({openSections:P,hasUserInteracted:!0})},t[2]=r,t[3]=s);let y=s,m=i-On*2,f;t[4]===x?f=t[5]:(f=x.includes("remote-storage"),t[4]=x,t[5]=f);let u=f,g;t[6]!==x||t[7]!==u?(g=u&&x.includes("files"),t[6]=x,t[7]=u,t[8]=g):g=t[8];let w=g,v;t[9]!==m||t[10]!==w?(v=w?Math.round(m*.4):m,t[9]=m,t[10]=w,t[11]=v):v=t[11];let l=v,j=Math.max(200,w?m-l:m),p;t[12]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsx)(rt,{className:"w-4 h-4"}),t[12]=p):p=t[12];let b;t[13]===d?b=t[14]:(b=d>0&&(0,a.jsx)(Va,{children:d}),t[13]=d,t[14]=b);let h;t[15]===b?h=t[16]:(h=(0,a.jsxs)(ft,{children:[p," Remote storage",b]}),t[15]=b,t[16]=h);let k;t[17]===l?k=t[18]:(k={maxHeight:l},t[17]=l,t[18]=k);let _;t[19]===Symbol.for("react.memo_cache_sentinel")?(_=(0,a.jsx)(rn,{}),t[19]=_):_=t[19];let F;t[20]===k?F=t[21]:(F=(0,a.jsx)(ut,{className:"overflow-auto",style:k,children:_}),t[20]=k,t[21]=F);let M;t[22]!==F||t[23]!==h?(M=(0,a.jsxs)(xt,{value:"remote-storage",children:[h,F]}),t[22]=F,t[23]=h,t[24]=M):M=t[24];let D;t[25]===Symbol.for("react.memo_cache_sentinel")?(D=(0,a.jsxs)(ft,{children:[(0,a.jsx)(nt,{className:"w-4 h-4"}),"Files"]}),t[25]=D):D=t[25];let C;t[26]===j?C=t[27]:(C=(0,a.jsxs)(xt,{value:"files",children:[D,(0,a.jsx)(ut,{children:(0,a.jsx)(Pn,{height:j})})]}),t[26]=j,t[27]=C);let S;t[28]!==y||t[29]!==x||t[30]!==M||t[31]!==C?(S=(0,a.jsxs)(Ut,{type:"multiple",value:x,onValueChange:y,children:[M,C]}),t[28]=y,t[29]=x,t[30]=M,t[31]=C,t[32]=S):S=t[32];let T;return t[33]!==e||t[34]!==S?(T=(0,a.jsx)("div",{ref:e,className:"h-full overflow-auto",children:S}),t[33]=e,t[34]=S,t[35]=T):T=t[35],T};export{Tn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as y}from"./chunk-LvLJmgfZ.js";import{_r as d}from"./cells-
|
|
1
|
+
import{s as y}from"./chunk-LvLJmgfZ.js";import{_r as d}from"./cells-BXZ3FSp9.js";import{t as f}from"./cn-DCUzRj2J.js";import{t as g}from"./jsx-runtime-BqBOg78p.js";import{t as e}from"./createLucideIcon-D5guW7EU.js";import{n as c,t as k}from"./file-headphone-BrQspHac.js";import{t as u}from"./file-BrdxGLRX.js";import{t as v}from"./image-DQHXdEQn.js";var r=e("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=e("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"}]]),x=e("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"}]]),z=e("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"}]]),p=e("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"}]]),M=y(g(),1),j={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 i(o){var a;let t=(a=o.split(".").pop())==null?void 0:a.toLowerCase();return t?j[t]??"unknown":"unknown"}const m={directory:p,python:r,code:r,json:c,text:d,image:v,audio:k,video:l,data:x,pdf:d,zip:z,unknown:u},s={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 w(o,t){let a=i(o),h=m[a],n=s[a];return(0,M.jsx)(h,{className:f("h-3.5 w-3.5 shrink-0",n,t)})}export{p as a,w as i,s as n,i as r,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{s as _}from"./chunk-LvLJmgfZ.js";import{u as j}from"./useEvent-D91BmmQi.js";import{t as M}from"./react-Bj1aDYRI.js";import{S as H,at as k,vt as I}from"./cells-
|
|
1
|
+
import{s as _}from"./chunk-LvLJmgfZ.js";import{u as j}from"./useEvent-D91BmmQi.js";import{t as M}from"./react-Bj1aDYRI.js";import{S as H,at as k,vt as I}from"./cells-BXZ3FSp9.js";import{t as S}from"./compiler-runtime-B3qBwwSJ.js";import{_ as $}from"./useEventListener-DvoEXWke.js";import{t as x}from"./cn-DCUzRj2J.js";import{t as B}from"./jsx-runtime-BqBOg78p.js";var L=S(),g=_(M(),1);function T(){return k()==="edit"?document.getElementById("App"):void 0}function O(t){let e=(0,L.c)(7),[r,a]=(0,g.useState)(void 0),[o,s]=(0,g.useState)(void 0),l=(0,g.useRef)(null),n=(0,g.useRef)(null),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=new Map,e[0]=f):f=e[0];let u=(0,g.useRef)(f),i,m;e[1]===t?(i=e[2],m=e[3]):(i=()=>t.length===0?void 0:(l.current=new IntersectionObserver(d=>{let v=!1;if(d.forEach(h=>{let b=h.target;h.isIntersecting?(!n.current||b.getBoundingClientRect().top<n.current.getBoundingClientRect().top)&&(n.current=b,v=!0):b===n.current&&(n.current=null,v=!0)}),v&&n.current){let h=I(n.current);a("id"in h?h.id:h.path),s(u.current.get(n.current))}},{root:T(),rootMargin:"0px",threshold:0}),t.forEach(d=>{var v;if(d){let h=I(d[0]),b=t.map(D).filter(w=>"id"in h?w.id===h.id:w.textContent===d[0].textContent).indexOf(d[0]);u.current.set(d[0],b),(v=l.current)==null||v.observe(d[0])}}),()=>{l.current&&l.current.disconnect(),n.current=null}),m=[t],e[1]=t,e[2]=i,e[3]=m),(0,g.useEffect)(i,m);let c;return e[4]!==r||e[5]!==o?(c={activeHeaderId:r,activeOccurrences:o},e[4]=r,e[5]=o,e[6]=c):c=e[6],c}function D(t){let[e]=t;return e}function C(t){if(t.length===0)return[];let e=new Map;return t.map(r=>{let a="id"in r.by?r.by.id:r.by.path,o=e.get(a)??0;e.set(a,o+1);let s=N(r,o);return s?[s,a]:null}).filter(Boolean)}function E(t,e){let r=N(t,e);if(!r){$.warn("Could not find element for outline item",t);return}r.scrollIntoView({behavior:"smooth",block:"start"}),r.classList.add("outline-item-highlight"),setTimeout(()=>{r.classList.remove("outline-item-highlight")},3e3)}function N(t,e){return"id"in t.by?document.querySelectorAll(`[id="${CSS.escape(t.by.id)}"]`)[e]:document.evaluate(t.by.path,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}var y=S(),p=_(B(),1);const A=()=>{let t=(0,y.c)(19),{items:e}=j(H),r;t[0]===e?r=t[1]:(r=C(e),t[0]=e,t[1]=r);let{activeHeaderId:a,activeOccurrences:o}=O(r),[s,l]=g.useState(!1);if(e.length<2)return null;let n,f,u;t[2]===Symbol.for("react.memo_cache_sentinel")?(n=()=>l(!0),f=()=>l(!1),u=x("fixed top-[25vh] right-8 z-10000 print:hidden","hidden md:block"),t[2]=n,t[3]=f,t[4]=u):(n=t[2],f=t[3],u=t[4]);let i=s?"-left-[280px] opacity-100":"left-[300px] opacity-0",m;t[5]===i?m=t[6]:(m=x("-top-4 max-h-[70vh] bg-background rounded-lg shadow-lg absolute overflow-auto transition-all duration-300 w-[300px] border",i),t[5]=i,t[6]=m);let c;t[7]!==a||t[8]!==o||t[9]!==e||t[10]!==m?(c=(0,p.jsx)(R,{className:m,items:e,activeHeaderId:a,activeOccurrences:o}),t[7]=a,t[8]=o,t[9]=e,t[10]=m,t[11]=c):c=t[11];let d;t[12]!==a||t[13]!==o||t[14]!==e?(d=(0,p.jsx)(P,{items:e,activeHeaderId:a,activeOccurrences:o}),t[12]=a,t[13]=o,t[14]=e,t[15]=d):d=t[15];let v;return t[16]!==c||t[17]!==d?(v=(0,p.jsxs)("div",{onMouseEnter:n,onMouseLeave:f,className:u,children:[c,d]}),t[16]=c,t[17]=d,t[18]=v):v=t[18],v},P=t=>{let e=(0,y.c)(8),{items:r,activeHeaderId:a,activeOccurrences:o}=t,s,l;if(e[0]!==a||e[1]!==o||e[2]!==r){let f=new Map;s="flex flex-col gap-4 items-end max-h-[70vh] overflow-hidden",l=r.map((u,i)=>{let m="id"in u.by?u.by.id:u.by.path,c=f.get(m)??0;return f.set(m,c+1),(0,p.jsx)("div",{className:x("h-[2px] bg-muted-foreground/60",u.level===1&&"w-5",u.level===2&&"w-4",u.level===3&&"w-3",u.level===4&&"w-2",c===o&&a===m&&"bg-foreground"),onClick:()=>E(u,c)},`${m}-${i}`)}),e[0]=a,e[1]=o,e[2]=r,e[3]=s,e[4]=l}else s=e[3],l=e[4];let n;return e[5]!==s||e[6]!==l?(n=(0,p.jsx)("div",{className:s,children:l}),e[5]=s,e[6]=l,e[7]=n):n=e[7],n},R=t=>{let e=(0,y.c)(11),{items:r,activeHeaderId:a,activeOccurrences:o,className:s}=t,l,n;if(e[0]!==a||e[1]!==o||e[2]!==s||e[3]!==r){let u=new Map;e[6]===s?l=e[7]:(l=x("flex flex-col overflow-auto py-4 pl-2",s),e[6]=s,e[7]=l),n=r.map((i,m)=>{let c="id"in i.by?i.by.id:i.by.path,d=u.get(c)??0;u.set(c,d+1);let v=`${c}-${m}`,h={className:x("px-2 py-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l",i.level===1&&"font-semibold",i.level===2&&"ml-3",i.level===3&&"ml-6",i.level===4&&"ml-9",d===o&&a===c&&"text-accent-foreground"),onClick:()=>E(i,d)};return i.html?(0,p.jsx)("div",{...h,dangerouslySetInnerHTML:{__html:i.html}},v):(0,p.jsx)("div",{...h,children:i.name},v)}),e[0]=a,e[1]=o,e[2]=s,e[3]=r,e[4]=l,e[5]=n}else l=e[4],n=e[5];let f;return e[8]!==l||e[9]!==n?(f=(0,p.jsx)("div",{className:l,children:n}),e[8]=l,e[9]=n,e[10]=f):f=e[10],f};export{O as i,R as n,C as r,A as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as s,u as C}from"./useEvent-D91BmmQi.js";import{b as d}from"./cells-
|
|
1
|
+
import{p as s,u as C}from"./useEvent-D91BmmQi.js";import{b as d}from"./cells-BXZ3FSp9.js";import{t as m}from"./createReducer-CI9qeK_X.js";function p(){return{focusedCellId:null,lastFocusedCellId:null}}var{reducer:w,createActions:V,valueAtom:a,useActions:g}=m(p,{focusCell:(l,e)=>({...l,focusedCellId:e.cellId,lastFocusedCellId:e.cellId}),toggleCell:(l,e)=>l.focusedCellId===e.cellId?{...l,focusedCellId:null}:{...l,focusedCellId:e.cellId,lastFocusedCellId:e.cellId},blurCell:l=>({...l,focusedCellId:null})});const c=s(l=>l(a).lastFocusedCellId);function F(){return C(c)}const _=s(l=>{let e=l(c);return!e||e==="__scratch__"?null:r(e,l(d))});function h(l){return s(e=>r(l,e(d)))}function r(l,e){var o;let{cellData:i,cellHandles:f,cellRuntime:I}=e,u=i[l],t=I[l],n=(o=f[l])==null?void 0:o.current;return!u||!n?null:{cellId:l,name:u.name,config:u.config,status:t?t.status:"idle",getEditorView:()=>n.editorView,hasOutput:(t==null?void 0:t.output)!=null,hasConsoleOutput:(t==null?void 0:t.consoleOutputs)!=null}}export{g as a,c as i,h as n,F as o,_ as r,a as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as Q}from"./chunk-LvLJmgfZ.js";import{t as fe}from"./react-Bj1aDYRI.js";import{Bt as xe}from"./cells-
|
|
1
|
+
import{s as Q}from"./chunk-LvLJmgfZ.js";import{t as fe}from"./react-Bj1aDYRI.js";import{Bt as xe}from"./cells-BXZ3FSp9.js";import{_ as R,c as ue,d as Z,f as B,g as je,h as F,l as ve,m as ge,o as be,p as E,s as ye,t as I,u as W,y as q}from"./zod-H_cgTO0M.js";import{t as X}from"./compiler-runtime-B3qBwwSJ.js";import{_ as Ce,d as Ne}from"./useEventListener-DvoEXWke.js";import{t as K}from"./cn-DCUzRj2J.js";import{t as we}from"./jsx-runtime-BqBOg78p.js";import{c as Se,i as Y,l as ke,n as Oe,r as Ve,s as $e,t as Ae}from"./select-DZcFyKFQ.js";import{C as ee,N as Le,S as ne}from"./JsonOutput-H6HB87kK.js";import{t as _e}from"./label-xHqFtfdz.js";import{n as ze,t as Ee}from"./radio-group-BgIE4hAy.js";import{t as Me}from"./tooltip-DTV9tlSr.js";import{r as Pe,t as re}from"./button-BbCh-29a.js";import{t as se}from"./strings-wdPMRf6Z.js";import{t as Te}from"./createLucideIcon-D5guW7EU.js";import{t as De}from"./plus-BgB18UzY.js";import{t as Je}from"./refresh-ccw-C-n2VFP5.js";import{n as Ze,t as U}from"./input-C3Hrdlqq.js";import{a as k,c as C,d as O,h as Be,l as V,m as Fe,o as S,r as te,u as y,y as Ie}from"./textarea-CMdRAIqd.js";import{t as qe}from"./trash-2-rVklqqFF.js";var Ke=Te("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);const A={of(r){return JSON.stringify(r)},parse(r){if(!r)return{};try{return JSON.parse(r)}catch{return{label:r}}}};function ae(){return Math.floor(Math.random()*1e5)}function Ue(r){return r instanceof I.ZodArray}function le(r){return r instanceof I.ZodPipe}function Ge(r){return r instanceof I.ZodTuple}function ie(r){return"unwrap"in r?r.unwrap():r}function D(r){let e=t=>{if(t instanceof E){let a=[...t.values];return t.values.size===1?a[0]:a}if(t instanceof W){let a=t.def.defaultValue;return typeof a=="function"?a():a}if(le(t))return e(t.in);if(Ge(t))return t.def.items.map(a=>e(a));if("unwrap"in t)return e(ie(t))};return r instanceof q||r instanceof Z?e(r.options[0]):Ue(r)?He(r)?[D(r.element)]:[]:r instanceof R?"":r instanceof B?r.options[0]:r instanceof F?Object.fromEntries(Object.entries(r.shape).map(([t,a])=>[t,e(a)])):e(r)}function _(r){if(r instanceof E)return r;if(r instanceof F){let e=r.shape.type;if(e instanceof E)return e;throw Error("Invalid schema")}if(r instanceof q||r instanceof Z)return _(r.options[0]);throw Ce.warn(r),Error("Invalid schema")}function He(r){return!r.safeParse([]).success}var oe=X(),ce=Q(fe(),1),n=Q(we(),1),de=`
|
|
2
2
|
`;const pe=r=>{let e=(0,oe.c)(24),{value:t,options:a,onChange:l,className:d,placeholder:o,textAreaClassName:h,comboBoxClassName:m}=r,[s,i]=(0,ce.useState)(!1),p;e[0]===t?p=e[1]:(p=J(t),e[0]=t,e[1]=p);let f=p,x;e[2]!==m||e[3]!==l||e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==h||e[8]!==f?(x=()=>s?(0,n.jsx)(G,{value:f,className:h,onChange:l,placeholder:o?`${o}: one per line`:"One value per line"}):(0,n.jsx)(ne,{placeholder:o,displayValue:Qe,className:K("w-full max-w-[400px]",m),multiple:!0,value:f,onValueChange:l,keepPopoverOpenOnSelect:!0,chips:!0,chipsClassName:"flex-row flex-wrap min-w-[210px]",children:a.map(Re)}),e[2]=m,e[3]=l,e[4]=a,e[5]=o,e[6]=s,e[7]=h,e[8]=f,e[9]=x):x=e[9];let c=x,v;e[10]===d?v=e[11]:(v=K("flex gap-1",d),e[10]=d,e[11]=v);let u;e[12]===c?u=e[13]:(u=c(),e[12]=c,e[13]=u);let g=s?"Switch to multi-select":"Switch to textarea",j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=(0,n.jsx)(Ie,{className:"w-3 h-3"}),e[14]=j):j=e[14];let b;e[15]===s?b=e[16]:(b=(0,n.jsx)(Le,{size:"xs",onPressedChange:i,pressed:s,children:j}),e[15]=s,e[16]=b);let N;e[17]!==g||e[18]!==b?(N=(0,n.jsx)(Me,{content:g,children:b}),e[17]=g,e[18]=b,e[19]=N):N=e[19];let w;return e[20]!==v||e[21]!==u||e[22]!==N?(w=(0,n.jsxs)("div",{className:v,children:[u,N]}),e[20]=v,e[21]=u,e[22]=N,e[23]=w):w=e[23],w},G=r=>{let e=(0,oe.c)(11),{className:t,value:a,onChange:l,placeholder:d}=r,o,h;if(e[0]!==a){let p=J(a);o=te,h=p.join(de),e[0]=a,e[1]=o,e[2]=h}else o=e[1],h=e[2];let m;e[3]===l?m=e[4]:(m=p=>{if(p.target.value===""){l([]);return}l(p.target.value.split(de))},e[3]=l,e[4]=m);let s=d?`${d}: one per line`:"One value per line",i;return e[5]!==o||e[6]!==t||e[7]!==h||e[8]!==m||e[9]!==s?(i=(0,n.jsx)(o,{value:h,className:t,rows:4,onChange:m,placeholder:s}),e[5]=o,e[6]=t,e[7]=h,e[8]=m,e[9]=s,e[10]=i):i=e[10],i};function J(r){return r==null?[]:Array.isArray(r)?r:[r].filter(e=>e!=null||e!=="")}function Qe(r){return r}function Re(r){return(0,n.jsx)(ee,{value:r,children:r},r)}var z=X();const We=r=>{let e=(0,z.c)(11),{schema:t,form:a,path:l,renderers:d,children:o}=r,h=l===void 0?"":l,m;e[0]===d?m=e[1]:(m=d===void 0?[]:d,e[0]=d,e[1]=m);let s=m,i;e[2]!==a||e[3]!==h||e[4]!==s||e[5]!==t?(i=$(t,a,h,s),e[2]=a,e[3]=h,e[4]=s,e[5]=t,e[6]=i):i=e[6];let p;return e[7]!==o||e[8]!==a||e[9]!==i?(p=(0,n.jsxs)(Fe,{...a,children:[o,i]}),e[7]=o,e[8]=a,e[9]=i,e[10]=p):p=e[10],p};function $(r,e,t,a){for(let s of a){let{isMatch:i,Component:p}=s;if(i(r))return(0,n.jsx)(p,{schema:r,form:e,path:t})}let{label:l,description:d,special:o,direction:h="column",minLength:m}=A.parse(r.description||"");if(r instanceof W){let s=r.unwrap();return s=!s.description&&r.description?s.describe(r.description):s,$(s,e,t,a)}if(r instanceof je){let s=r.unwrap();return s=!s.description&&r.description?s.describe(r.description):s,$(s,e,t,a)}if(r instanceof F)return(0,n.jsxs)("div",{className:K("flex",h==="row"?"flex-row gap-6 items-start":h==="two-columns"?"grid grid-cols-2 gap-y-6":"flex-col gap-6"),children:[(0,n.jsx)(y,{children:l}),Ne.entries(r.shape).map(([s,i])=>{let p=i instanceof E,f=$(i,e,rn(t,s),a);return p?(0,n.jsx)(ce.Fragment,{children:f},s):(0,n.jsx)("div",{className:"flex flex-row align-start",children:f},s)})]});if(r instanceof R)return o==="time"?(0,n.jsx)(C,{control:e.control,name:t,render:({field:s})=>(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)(S,{children:d}),(0,n.jsx)(k,{children:(0,n.jsx)(U,{...s,onValueChange:s.onChange,type:"time",className:"my-0"})}),(0,n.jsx)(O,{})]})}):(0,n.jsx)(me,{schema:r,form:e,path:t});if(r instanceof ue)return(0,n.jsx)(C,{control:e.control,name:t,render:({field:s})=>(0,n.jsxs)(V,{children:[(0,n.jsxs)("div",{className:"flex flex-row items-start space-x-2",children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)(S,{children:d}),(0,n.jsx)(k,{children:(0,n.jsx)(xe,{"data-testid":"marimo-plugin-data-frames-boolean-checkbox",checked:s.value,onCheckedChange:s.onChange})})]}),(0,n.jsx)(O,{})]})});if(r instanceof ge)return o==="random_number_button"?(0,n.jsx)(C,{control:e.control,name:t,render:({field:s})=>(0,n.jsxs)(re,{size:"xs","data-testid":"marimo-plugin-data-frames-random-number-button",variant:"secondary",onClick:()=>{s.onChange(ae())},children:[(0,n.jsx)(Je,{className:"w-3.5 h-3.5 mr-1"}),l]})}):(0,n.jsx)(C,{control:e.control,name:t,render:({field:s})=>(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)(S,{children:d}),(0,n.jsx)(k,{children:(0,n.jsx)(Ze,{...s,className:"my-0",onValueChange:s.onChange})}),(0,n.jsx)(O,{})]})});if(r instanceof ve){let s=o==="datetime"?"datetime-local":o==="time"?"time":"date";return(0,n.jsx)(C,{control:e.control,name:t,render:({field:i})=>(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)(S,{children:d}),(0,n.jsx)(k,{children:(0,n.jsx)(U,{...i,onValueChange:i.onChange,type:s,className:"my-0"})}),(0,n.jsx)(O,{})]})})}if(r instanceof be)return(0,n.jsx)(me,{schema:r,form:e,path:t});if(r instanceof B)return(0,n.jsx)(en,{schema:r,form:e,path:t,options:r.options.map(s=>s.toString())});if(r instanceof ye){if(o==="text_area_multiline")return(0,n.jsx)(Ye,{schema:r,form:e,path:t});let s=r.element;return s instanceof B?(0,n.jsx)(nn,{schema:r,form:e,path:t,itemLabel:l,options:s.options.map(i=>i.toString())}):(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)(_e,{children:l}),(0,n.jsx)(Xe,{schema:r.element,form:e,path:t,minLength:m,renderers:a},t)]})}if(r instanceof Z){let s=r.def,i=s.options,p=s.discriminator,f=x=>i.find(c=>_(c).value===x);return(0,n.jsx)(C,{control:e.control,name:t,render:({field:x})=>{let c=x.value,v=i.map(j=>_(j).value),u=c&&typeof c=="object"&&p in c?c[p]:v[0],g=f(u);return(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)("div",{className:"flex border-b mb-4 -mt-2",children:v.map(j=>(0,n.jsx)("button",{type:"button",className:`px-4 py-2 ${u===j?"border-b-2 border-primary font-medium":"text-muted-foreground"}`,onClick:()=>{let b=f(j);b?x.onChange(D(b)):x.onChange({[p]:j})},children:j},j))}),(0,n.jsx)("div",{className:"flex flex-col",children:g&&$(g,e,t,a)},u)]})}})}return r instanceof q?(0,n.jsx)(C,{control:e.control,name:t,render:({field:s})=>{let i=r.options,p=s.value,f=i.map(c=>_(c).value);p||(p=f[0]);let x=i.find(c=>_(c).value===p);return(0,n.jsxs)("div",{className:"flex flex-col mb-4 gap-1",children:[(0,n.jsx)(y,{children:l}),(0,n.jsx)(ke,{"data-testid":"marimo-plugin-data-frames-union-select",...s,children:f.map(c=>(0,n.jsx)("option",{value:c,children:c},c))}),x&&$(x,e,t,a)]})}}):r instanceof E?(0,n.jsx)(C,{control:e.control,name:t,render:({field:s})=>(0,n.jsx)("input",{...s,type:"hidden",value:String([...r.values][0]??"")})}):"unwrap"in r?$(ie(r),e,t,a):le(r)?$(r.in,e,t,a):(0,n.jsxs)("div",{children:["Unknown schema type"," ",r==null?t:JSON.stringify(r.type??r)]})}var Xe=r=>{let e=(0,z.c)(39),{schema:t,form:a,path:l,minLength:d,renderers:o}=r,h;e[0]===t.description?h=e[1]:(h=A.parse(t.description||""),e[0]=t.description,e[1]=h);let{label:m,description:s}=h,i=a.control,p;e[2]!==i||e[3]!==l?(p={control:i,name:l},e[2]=i,e[3]=l,e[4]=p):p=e[4];let{fields:f,append:x,remove:c}=Be(p),v=d!=null&&f.length<d,u=d==null||f.length>d,g;e[5]===m?g=e[6]:(g=(0,n.jsx)(y,{children:m}),e[5]=m,e[6]=g);let j;e[7]===s?j=e[8]:(j=(0,n.jsx)(S,{children:s}),e[7]=s,e[8]=j);let b;if(e[9]!==u||e[10]!==f||e[11]!==a||e[12]!==l||e[13]!==c||e[14]!==o||e[15]!==t){let T;e[17]!==u||e[18]!==a||e[19]!==l||e[20]!==c||e[21]!==o||e[22]!==t?(T=(he,H)=>(0,n.jsxs)("div",{className:"flex flex-row pl-2 ml-2 border-l-2 border-disabled hover-actions-parent relative pr-5 pt-1 items-center w-fit",onKeyDown:Pe.onEnter(sn),children:[$(t,a,`${l}[${H}]`,o),u&&(0,n.jsx)(qe,{className:"w-4 h-4 ml-2 my-1 text-muted-foreground hover:text-destructive cursor-pointer absolute right-0 top-5",onClick:()=>{c(H)}})]},he.id),e[17]=u,e[18]=a,e[19]=l,e[20]=c,e[21]=o,e[22]=t,e[23]=T):T=e[23],b=f.map(T),e[9]=u,e[10]=f,e[11]=a,e[12]=l,e[13]=c,e[14]=o,e[15]=t,e[16]=b}else b=e[16];let N;e[24]!==v||e[25]!==d?(N=v&&(0,n.jsx)("div",{className:"text-destructive text-xs font-semibold",children:(0,n.jsxs)("div",{children:["At least ",d," required."]})}),e[24]=v,e[25]=d,e[26]=N):N=e[26];let w;e[27]!==x||e[28]!==t?(w=()=>{x(D(t))},e[27]=x,e[28]=t,e[29]=w):w=e[29];let M;e[30]===Symbol.for("react.memo_cache_sentinel")?(M=(0,n.jsx)(De,{className:"w-3.5 h-3.5 mr-1"}),e[30]=M):M=e[30];let L;e[31]===w?L=e[32]:(L=(0,n.jsx)("div",{children:(0,n.jsxs)(re,{size:"xs","data-testid":"marimo-plugin-data-frames-add-array-item",variant:"text",className:"hover:text-accent-foreground",onClick:w,children:[M,"Add"]})}),e[31]=w,e[32]=L);let P;return e[33]!==g||e[34]!==j||e[35]!==b||e[36]!==N||e[37]!==L?(P=(0,n.jsxs)("div",{className:"flex flex-col gap-2 min-w-[220px]",children:[g,j,b,N,L]}),e[33]=g,e[34]=j,e[35]=b,e[36]=N,e[37]=L,e[38]=P):P=e[38],P},me=r=>{let e=(0,z.c)(21),{schema:t,form:a,path:l}=r,d;e[0]===t.description?d=e[1]:(d=A.parse(t.description),e[0]=t.description,e[1]=d);let{label:o,description:h,placeholder:m,disabled:s,inputType:i}=d;if(i==="textarea"){let x;e[2]!==h||e[3]!==s||e[4]!==o||e[5]!==m?(x=v=>{let{field:u}=v;return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:o}),(0,n.jsx)(S,{children:h}),(0,n.jsx)(k,{children:(0,n.jsx)(te,{...u,value:u.value,onChange:u.onChange,className:"my-0",placeholder:m,disabled:s})}),(0,n.jsx)(O,{})]})},e[2]=h,e[3]=s,e[4]=o,e[5]=m,e[6]=x):x=e[6];let c;return e[7]!==a.control||e[8]!==l||e[9]!==x?(c=(0,n.jsx)(C,{control:a.control,name:l,render:x}),e[7]=a.control,e[8]=l,e[9]=x,e[10]=c):c=e[10],c}let p;e[11]!==h||e[12]!==s||e[13]!==i||e[14]!==o||e[15]!==m?(p=x=>{let{field:c}=x;return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:o}),(0,n.jsx)(S,{children:h}),(0,n.jsx)(k,{children:(0,n.jsx)(U,{...c,type:i,value:c.value,onValueChange:c.onChange,className:"my-0",placeholder:m,disabled:s})}),(0,n.jsx)(O,{})]})},e[11]=h,e[12]=s,e[13]=i,e[14]=o,e[15]=m,e[16]=p):p=e[16];let f;return e[17]!==a.control||e[18]!==l||e[19]!==p?(f=(0,n.jsx)(C,{control:a.control,name:l,render:p}),e[17]=a.control,e[18]=l,e[19]=p,e[20]=f):f=e[20],f},Ye=r=>{let e=(0,z.c)(10),{schema:t,form:a,path:l}=r,d;e[0]===t.description?d=e[1]:(d=A.parse(t.description),e[0]=t.description,e[1]=d);let{label:o,description:h,placeholder:m}=d,s;e[2]!==h||e[3]!==o||e[4]!==m?(s=p=>{let{field:f}=p;return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:o}),(0,n.jsx)(S,{children:h}),(0,n.jsx)(k,{children:(0,n.jsx)(G,{...f,placeholder:m})}),(0,n.jsx)(O,{})]})},e[2]=h,e[3]=o,e[4]=m,e[5]=s):s=e[5];let i;return e[6]!==a.control||e[7]!==l||e[8]!==s?(i=(0,n.jsx)(C,{control:a.control,name:l,render:s}),e[6]=a.control,e[7]=l,e[8]=s,e[9]=i):i=e[9],i},en=r=>{let e=(0,z.c)(22),{schema:t,form:a,path:l,options:d,textTransform:o}=r,h;e[0]===t.description?h=e[1]:(h=A.parse(t.description),e[0]=t.description,e[1]=h);let{label:m,description:s,disabled:i,special:p}=h;if(p==="radio_group"){let c;e[2]!==s||e[3]!==m||e[4]!==d||e[5]!==l?(c=u=>{let{field:g}=u;return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{children:m}),(0,n.jsx)(S,{children:s}),(0,n.jsx)(k,{children:(0,n.jsx)(Ee,{className:"flex flex-row gap-2 pt-1 items-center",value:g.value,onValueChange:g.onChange,children:d.map(j=>(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(ze,{value:j,id:`${l}-${j}`},j),(0,n.jsx)(y,{className:"whitespace-pre",htmlFor:`${l}-${j}`,children:se.startCase(j)})]},j))})}),(0,n.jsx)(O,{})]})},e[2]=s,e[3]=m,e[4]=d,e[5]=l,e[6]=c):c=e[6];let v;return e[7]!==i||e[8]!==a.control||e[9]!==l||e[10]!==c?(v=(0,n.jsx)(C,{control:a.control,name:l,disabled:i,render:c}),e[7]=i,e[8]=a.control,e[9]=l,e[10]=c,e[11]=v):v=e[11],v}let f;e[12]!==s||e[13]!==m||e[14]!==d||e[15]!==o?(f=c=>{let{field:v}=c;return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{className:"whitespace-pre",children:m}),(0,n.jsx)(S,{children:s}),(0,n.jsx)(k,{children:(0,n.jsxs)(Ae,{"data-testid":"marimo-plugin-data-frames-select",value:v.value,onValueChange:v.onChange,children:[(0,n.jsx)($e,{className:"min-w-[180px]",children:(0,n.jsx)(Se,{placeholder:"--"})}),(0,n.jsx)(Oe,{children:(0,n.jsxs)(Ve,{children:[d.map(u=>(0,n.jsx)(Y,{value:u,children:(o==null?void 0:o(u))??u},u)),d.length===0&&(0,n.jsx)(Y,{disabled:!0,value:"--",children:"No options"})]})})]})}),(0,n.jsx)(O,{})]})},e[12]=s,e[13]=m,e[14]=d,e[15]=o,e[16]=f):f=e[16];let x;return e[17]!==i||e[18]!==a.control||e[19]!==l||e[20]!==f?(x=(0,n.jsx)(C,{control:a.control,name:l,disabled:i,render:f}),e[17]=i,e[18]=a.control,e[19]=l,e[20]=f,e[21]=x):x=e[21],x},nn=r=>{let e=(0,z.c)(15),{schema:t,form:a,path:l,options:d,itemLabel:o,showSwitchable:h}=r,m;e[0]===t.description?m=e[1]:(m=A.parse(t.description),e[0]=t.description,e[1]=m);let{label:s,description:i,placeholder:p}=m,f;e[2]!==o||e[3]!==p?(f=p??(o?`Select ${o==null?void 0:o.toLowerCase()}`:void 0),e[2]=o,e[3]=p,e[4]=f):f=e[4];let x=f,c;e[5]!==i||e[6]!==s||e[7]!==d||e[8]!==x||e[9]!==h?(c=u=>{let{field:g}=u,j=J(g.value);return(0,n.jsxs)(V,{children:[(0,n.jsx)(y,{className:"whitespace-pre",children:s}),(0,n.jsx)(S,{children:i}),(0,n.jsx)(k,{children:h?(0,n.jsx)(pe,{...g,value:j,options:d,placeholder:x}):(0,n.jsx)(ne,{className:"min-w-[180px]",placeholder:x,displayValue:tn,multiple:!0,chips:!0,keepPopoverOpenOnSelect:!0,value:j,onValueChange:g.onChange,children:d.map(an)})}),(0,n.jsx)(O,{})]})},e[5]=i,e[6]=s,e[7]=d,e[8]=x,e[9]=h,e[10]=c):c=e[10];let v;return e[11]!==a.control||e[12]!==l||e[13]!==c?(v=(0,n.jsx)(C,{control:a.control,name:l,render:c}),e[11]=a.control,e[12]=l,e[13]=c,e[14]=v):v=e[14],v};function rn(...r){return r.filter(e=>e!=="").join(".")}function sn(r){return r.preventDefault()}function tn(r){return se.startCase(r)}function an(r){return(0,n.jsx)(ee,{value:r,children:r},r)}export{J as a,A as c,G as i,ae as l,$ as n,D as o,pe as r,_ as s,We as t,Ke as u};
|