@marimo-team/frontend 0.23.17-dev43 → 0.23.17-dev45
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/{JsonOutput-CWfu9qbN.js → JsonOutput-W3f6H6VQ.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-B9QSRg6T.js → MarimoErrorOutput-COZo8cfk.js} +3 -3
- package/dist/assets/{add-cell-with-ai-GZi9Icll.js → add-cell-with-ai-CuLILhtV.js} +1 -1
- package/dist/assets/{add-connection-dialog-D2WiF1f8.js → add-connection-dialog-Dld_PDdZ.js} +1 -1
- package/dist/assets/{agent-panel-BWIkm6ln.js → agent-panel-3Ta5EPgw.js} +1 -1
- package/dist/assets/{ai-model-dropdown-BmcXWjub.js → ai-model-dropdown-CIqhiHxf.js} +1 -1
- package/dist/assets/{app-config-button-QHaORuxs.js → app-config-button-EyzXs1Nt.js} +1 -1
- package/dist/assets/{cell-editor-Cwor7oUx.js → cell-editor-C5qD14SG.js} +1 -1
- package/dist/assets/{chat-display-CH-dFAC3.js → chat-display-CBpsXLHT.js} +1 -1
- package/dist/assets/chat-panel-VAvLxFDw.js +4 -0
- package/dist/assets/{chat-ui-DDkwFM3p.js → chat-ui-BcI4PAQ1.js} +1 -1
- package/dist/assets/{column-preview-Dw1ASLnm.js → column-preview-Dxxs9Brz.js} +1 -1
- package/dist/assets/{command-palette--Mo9OaH2.js → command-palette-B1EO8oVR.js} +1 -1
- package/dist/assets/{components-BQ3c1B_F.js → components-RV25kGIW.js} +1 -1
- package/dist/assets/config-BVfo0E1-.js +1 -0
- package/dist/assets/{datasource-DfQvKiJ1.js → datasource-D0eBPOXe.js} +1 -1
- package/dist/assets/{dependency-graph-panel-gbgUGtYS.js → dependency-graph-panel-BKWUzXHX.js} +1 -1
- package/dist/assets/{edit-page-DhZPSJ6P.js → edit-page-GtsW1Yeh.js} +4 -4
- package/dist/assets/{error-panel-Upmm4kG5.js → error-panel-v0YdlA0h.js} +1 -1
- package/dist/assets/{file-explorer-panel-BulU96v_.js → file-explorer-panel-DSZY0Q7h.js} +1 -1
- package/dist/assets/{form-D-Bo8F9Q.js → form-BGoLLcgk.js} +1 -1
- package/dist/assets/{home-page-Dvm2dFdU.js → home-page-DLeE6pH_.js} +1 -1
- package/dist/assets/{index-BPwg3EAk.js → index-C_pCjmat.js} +3 -3
- package/dist/assets/index-WoaGtlKd.css +2 -0
- package/dist/assets/{layout-D7Yzn4XY.js → layout-QkEddeXT.js} +3 -3
- package/dist/assets/{packages-panel-IN-yS3e2.js → packages-panel-CiKYP9Ij.js} +1 -1
- package/dist/assets/{panels-C5PIEySE.js → panels-Swk0l08v.js} +1 -1
- package/dist/assets/{reveal-component-BPaqYFXU.js → reveal-component-De_cjq3p.js} +1 -1
- package/dist/assets/{run-page-kWVbQ6KV.js → run-page-DmXT_-MQ.js} +1 -1
- package/dist/assets/{scratchpad-panel-l1iGto9s.js → scratchpad-panel-BtGHIRdJ.js} +1 -1
- package/dist/assets/{session-panel-CBmLYzFL.js → session-panel-kBLydN0h.js} +1 -1
- package/dist/assets/{skeleton-DhhF_mJP.js → skeleton-CJymG2v3.js} +1 -1
- package/dist/assets/state-DDimGh2o.js +1 -0
- package/dist/assets/{useCellActionButton-CrFbi8en.js → useCellActionButton-n2-2xb-5.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-OeFV2bye.js → useDependencyPanelTab-DQZmbkd-.js} +1 -1
- package/dist/assets/{useNotebookActions-CylmZilh.js → useNotebookActions-BUQta3nX.js} +1 -1
- package/dist/index.html +9 -9
- package/package.json +1 -1
- package/src/components/ai/ai-model-dropdown.tsx +2 -2
- package/src/components/chat/__tests__/capabilities-popover.test.tsx +38 -0
- package/src/components/chat/capabilities-popover.tsx +68 -0
- package/src/components/chat/chat-panel.tsx +17 -12
- package/src/components/editor/chrome/wrapper/useOpenAiAssistant.ts +2 -2
- package/src/core/ai/__tests__/config.test.tsx +96 -0
- package/src/core/ai/config.ts +16 -22
- package/src/core/ai/state.ts +10 -0
- package/src/core/network/types.ts +1 -0
- package/dist/assets/chat-panel-DLgorYjE.js +0 -4
- package/dist/assets/config-Cbkt6Rb1.js +0 -1
- package/dist/assets/index-Dttsymhw.css +0 -2
- package/dist/assets/state-COqqdiUM.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{k as a}from"./cells-DxL32Atg.js";import"./react-dom-CSu739Rf.js";import{t as s}from"./compiler-runtime-B3qBwwSJ.js";import{t as c}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-B51geQ_6.js";import"./dist-gUHullA_.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{t as d}from"./createLucideIcon-w-Qo9n0R.js";import{t as h}from"./MarimoErrorOutput-
|
|
1
|
+
import{s as i}from"./chunk-LvLJmgfZ.js";import"./useEvent-D91BmmQi.js";import{t as l}from"./react-Bj1aDYRI.js";import{k as a}from"./cells-DxL32Atg.js";import"./react-dom-CSu739Rf.js";import{t as s}from"./compiler-runtime-B3qBwwSJ.js";import{t as c}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-B51geQ_6.js";import"./dist-gUHullA_.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{t as d}from"./createLucideIcon-w-Qo9n0R.js";import{t as h}from"./MarimoErrorOutput-COZo8cfk.js";import"./dist-Jbd9zUbK.js";import"./dist-BWXIz8tq.js";import"./dist-DX04AOlt.js";import"./dist-D5nYeU7Q.js";import"./dist-6qzebh8f.js";import"./session-BtBr2zr3.js";import"./purify.es-CWmnYhGI.js";import{n as f}from"./cell-link-uPmFMRTh.js";import{t as n}from"./empty-state-JOk_hLQe.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 Je}from"./chunk-LvLJmgfZ.js";import{i as Et,l as Fe,n as ae,p as Ye,u as je}from"./useEvent-D91BmmQi.js";import{t as At}from"./react-Bj1aDYRI.js";import{$i as Ht,E as qt,Kn as Ut,Ur as Kt,ra as Wt}from"./cells-DxL32Atg.js";import"./react-dom-CSu739Rf.js";import{t as oe}from"./compiler-runtime-B3qBwwSJ.js";import{g as Te}from"./useEventListener-B_wSLgFR.js";import{t as Gt}from"./invariant-CkiqGLcK.js";import{g as Jt,p as Xe}from"./utils-C5VWChv9.js";import{N as be,r as Yt}from"./config-Bm5B9wGP.js";import{t as le}from"./cn-DYvqRARy.js";import{t as Xt}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-B51geQ_6.js";import{r as Zt}from"./config-
|
|
1
|
+
import{s as Je}from"./chunk-LvLJmgfZ.js";import{i as Et,l as Fe,n as ae,p as Ye,u as je}from"./useEvent-D91BmmQi.js";import{t as At}from"./react-Bj1aDYRI.js";import{$i as Ht,E as qt,Kn as Ut,Ur as Kt,ra as Wt}from"./cells-DxL32Atg.js";import"./react-dom-CSu739Rf.js";import{t as oe}from"./compiler-runtime-B3qBwwSJ.js";import{g as Te}from"./useEventListener-B_wSLgFR.js";import{t as Gt}from"./invariant-CkiqGLcK.js";import{g as Jt,p as Xe}from"./utils-C5VWChv9.js";import{N as be,r as Yt}from"./config-Bm5B9wGP.js";import{t as le}from"./cn-DYvqRARy.js";import{t as Xt}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-B51geQ_6.js";import{r as Zt}from"./config-BVfo0E1-.js";import{o as Qt}from"./alert-dialog-DMh8_LWc.js";import"./popover-DHbixh3D.js";import{a as X,c as ue,p as ea,r as ta,t as aa}from"./dropdown-menu-BGBlPKNz.js";import{Lt as Me,a as ra,h as na,i as Ze,o as sa,s as Qe}from"./JsonOutput-W3f6H6VQ.js";import{c as oa,n as et,r as ze}from"./download-Tklnz6pn.js";import{r as tt}from"./radio-group-ByLzIKjm.js";import{t as Z}from"./tooltip-BcgbFR7q.js";import{n as la,t as H}from"./button-BB1AV4Rb.js";import{Tt as ia}from"./dist-gUHullA_.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{n as ca,r as $e,t as da}from"./requests-9-v2bhoi.js";import{t as ne}from"./createLucideIcon-w-Qo9n0R.js";import{t as at}from"./arrow-left-pVgT2h-8.js";import{n as ma}from"./LazyAnyLanguageCodeMirror-Dcvy_p3-.js";import{t as pa}from"./x-C-Eq0ag8.js";import{a as ha,i as Oe,n as xa,r as rt,t as ve}from"./tree-actions-o2iyMmKN.js";import{a as fa}from"./markdown-renderer-DpskAUxO.js";import{u as ua}from"./toDate-Ct2FT81-.js";import{t as nt}from"./copy-3iHFdt22.js";import{t as Le}from"./external-link-BOlXZUla.js";import{a as ya,i as st,n as ot,r as ga,t as ja}from"./file-icons-NkObNkr_.js";import{t as lt}from"./file-CJH9JNGH.js";import{n as it,t as ba}from"./components-Bm1d4vm9.js";import{n as we,t as va}from"./spinner-D-V4psAa.js";import{a as wa,c as Na,d as ka,f as _a,i as Sa,l as Ca,n as Fa,r as Ma,t as Pa,u as Da}from"./file-name-input-BQJ9U9lU.js";import{t as ct}from"./plus-AgXtozBz.js";import{t as dt}from"./refresh-cw-CYq4mK5a.js";import{t as Ta}from"./save-DBuEmnnF.js";import{t as za}from"./triangle-alert-BL4YVsPy.js";import{n as $a,t as Oa}from"./es-Dl2xAwTv.js";import"./dist-Jbd9zUbK.js";import"./dist-BWXIz8tq.js";import"./dist-DX04AOlt.js";import"./dist-D5nYeU7Q.js";import"./dist-6qzebh8f.js";import{t as re}from"./use-toast-BwJoaaDM.js";import{t as La}from"./paths-BKO-pHK6.js";import"./session-BtBr2zr3.js";import"./purify.es-CWmnYhGI.js";import"./dates-BzOh4kS_.js";import{n as Ne}from"./copy-B-LLR1Yy.js";import{t as Ba}from"./copy-icon-DWG8Y-xW.js";import{t as Be}from"./context-BFPaAUK_.js";import{n as mt}from"./ImperativeModal-Ci0icDPt.js";import{t as Ia}from"./blob-BzgGkt3B.js";import"./tooltip-BMi4WFDl.js";import"./vega-loader.browser-CAfmqKEc.js";import"./defaultLocale-t77eoiwF.js";import"./defaultLocale-BUCH2FMc.js";import{n as Ra,t as Va}from"./alert-jlwhGxSb.js";import{n as pt}from"./error-banner-BkIr-0dH.js";import"./chunk-5FQGJX7Z-CYQpNADu.js";import"./html-to-image-ChNWEUlR.js";import{o as Ea}from"./focus-BBiJct2G.js";import{n as Ie}from"./useAsyncData-Bg5iAViP.js";import"./react-resizable-panels.browser.esm-Z-MD3n3J.js";import{a as Aa,f as Ha,o as ht,t as qa}from"./command-CPFHYoYk.js";import{a as Ua}from"./renderShortcut-DnqsU4zj.js";import{t as Ka}from"./bundle.esm-CvMga-X6.js";import{n as Wa}from"./pathUtils-icFgkNy9.js";import{n as Ga}from"./semaphore-C-Nli4KG.js";import{t as Ja}from"./empty-state-JOk_hLQe.js";import{t as Pe}from"./formatting-qNOrQYRN.js";import{a as Ya,i as Xa,n as xt,r as ft,t as ut}from"./components-RV25kGIW.js";import{t as yt}from"./add-connection-dialog-Dld_PDdZ.js";import{a as Za,i as gt,n as De,o as ye,r as Qa,s as Re,t as er}from"./state-BkoVfBqt.js";import{n as jt,t as tr}from"./marimo-icons-yD_pAOm9.js";import{t as ar}from"./links-DBc28bsl.js";import{n as rr}from"./panel-accordion-state-BkWYwckU.js";var nr=ne("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"}]]),sr=ne("copy-minus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]),bt=ne("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"}]]),or=ne("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"}]]),vt=ne("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"}]]),wt=ne("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"}]]),lr=ne("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"}]]),Nt=ne("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"}]]),O=Je(At(),1),ir=oe(),a=Je(Xt(),1);const kt=t=>{let e=(0,ir.c)(17),{filename:r,filenameIcon:o,onBack:i,onRefresh:n,onDownload:m,actions:l}=t,c;e[0]===i?c=e[1]:(c=i&&(0,a.jsx)(Z,{content:"Back to file list",children:(0,a.jsx)(H,{variant:"text",size:"xs",onClick:i,children:(0,a.jsx)(at,{className:"h-4 w-4"})})}),e[0]=i,e[1]=c);let s;e[2]!==r||e[3]!==o?(s=r?(0,a.jsxs)("span",{className:"flex items-center gap-1.5 flex-1 min-w-0 text-xs font-semibold truncate",children:[o,r]}):(0,a.jsx)("span",{className:"flex-1"}),e[2]=r,e[3]=o,e[4]=s):s=e[4];let f;e[5]===n?f=e[6]:(f=n&&(0,a.jsx)(Z,{content:"Refresh",children:(0,a.jsx)(H,{variant:"text",size:"xs",onClick:n,children:(0,a.jsx)(dt,{className:"h-3.5 w-3.5"})})}),e[5]=n,e[6]=f);let p;e[7]===m?p=e[8]:(p=m&&(0,a.jsx)(Z,{content:"Download",children:(0,a.jsx)(H,{variant:"text",size:"xs",onClick:m,children:(0,a.jsx)(Me,{className:"h-3.5 w-3.5"})})}),e[7]=m,e[8]=p);let x;e[9]!==l||e[10]!==f||e[11]!==p?(x=(0,a.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[f,l,p]}),e[9]=l,e[10]=f,e[11]=p,e[12]=x):x=e[12];let u;return e[13]!==c||e[14]!==s||e[15]!==x?(u=(0,a.jsxs)("div",{className:"flex items-center shrink-0 border-b px-1 gap-1",children:[c,s,x]}),e[13]=c,e[14]=s,e[15]=x,e[16]=u):u=e[16],u};var cr=new Set(["http","file","in-memory"]);function ge(t){return JSON.stringify(t).slice(1,-1)}var dr=new Set(["datasets","spaces","buckets"]);function _t(t){let e=t.split("/").filter(Boolean);return e[0]==="datasets"&&e.length>=4?{repoType:"dataset",repoId:`${e[1]}/${e[2]}`,filename:e.slice(3).join("/")}:e[0]==="spaces"&&e.length>=4?{repoType:"space",repoId:`${e[1]}/${e[2]}`,filename:e.slice(3).join("/")}:e.length>=3&&!dr.has(e[0])?{repoType:"model",repoId:`${e[0]}/${e[1]}`,filename:e.slice(2).join("/")}:null}function St(t){return`from huggingface_hub import hf_hub_download
|
|
2
2
|
|
|
3
3
|
local_path = hf_hub_download(
|
|
4
4
|
repo_id="${ge(t.repoId)}",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{s as H}from"./chunk-LvLJmgfZ.js";import{t as fe}from"./react-Bj1aDYRI.js";import{Nt as xe}from"./cells-DxL32Atg.js";import{_ as Q,c as ue,d as F,f as I,g as je,h as q,l as ve,m as ge,o as be,p as T,s as Ne,t as B,u as R,y as K}from"./zod-CIOjj3iA.js";import{t as X}from"./compiler-runtime-B3qBwwSJ.js";import{g as we}from"./useEventListener-B_wSLgFR.js";import{t as Ce}from"./objects-BlG0ZrO0.js";import{t as J}from"./cn-DYvqRARy.js";import{t as ye}from"./jsx-runtime-Blw4afVn.js";import{c as Se,i as Y,l as Oe,n as ke,r as Ve,s as $e,t as Ae}from"./select-Clmc8Hw2.js";import{N as ee,P as re,W as Le}from"./JsonOutput-
|
|
1
|
+
import{s as H}from"./chunk-LvLJmgfZ.js";import{t as fe}from"./react-Bj1aDYRI.js";import{Nt as xe}from"./cells-DxL32Atg.js";import{_ as Q,c as ue,d as F,f as I,g as je,h as q,l as ve,m as ge,o as be,p as T,s as Ne,t as B,u as R,y as K}from"./zod-CIOjj3iA.js";import{t as X}from"./compiler-runtime-B3qBwwSJ.js";import{g as we}from"./useEventListener-B_wSLgFR.js";import{t as Ce}from"./objects-BlG0ZrO0.js";import{t as J}from"./cn-DYvqRARy.js";import{t as ye}from"./jsx-runtime-Blw4afVn.js";import{c as Se,i as Y,l as Oe,n as ke,r as Ve,s as $e,t as Ae}from"./select-Clmc8Hw2.js";import{N as ee,P as re,W as Le}from"./JsonOutput-W3f6H6VQ.js";import{t as Pe}from"./label-DUD3SZnk.js";import{n as Ee,t as Te}from"./radio-group-ByLzIKjm.js";import{t as _e}from"./tooltip-BcgbFR7q.js";import{r as ze,t as ne}from"./button-BB1AV4Rb.js";import{t as se}from"./strings-DMKwTex-.js";import{t as De}from"./plus-AgXtozBz.js";import{t as Je}from"./refresh-ccw-sLaKP2vj.js";import{n as Me,t as U}from"./input-_AaMXWgD.js";import{a as w,c as O,d as Ze,f as Fe,g as Ie,n as k,o as V,r as S,s as N}from"./form-BIUQB1NI.js";import{t as qe}from"./trash-2-72W0TZ3L.js";import{r as te}from"./textarea-BzWvGIrJ.js";const A={of(n){return JSON.stringify(n)},parse(n){if(!n)return{};try{return JSON.parse(n)}catch{return{label:n}}}};function ae(){return Math.floor(Math.random()*1e5)}function Be(n){return n instanceof B.ZodArray}function le(n){return n instanceof B.ZodPipe}function Ke(n){return n instanceof B.ZodTuple}function ie(n){return"unwrap"in n?n.unwrap():n}function M(n){let e=t=>{if(t instanceof T){let a=[...t.values];return t.values.size===1?a[0]:a}if(t instanceof R){let a=t.def.defaultValue;return typeof a=="function"?a():a}if(le(t))return e(t.in);if(Ke(t))return t.def.items.map(a=>e(a));if("unwrap"in t)return e(ie(t))};return n instanceof K||n instanceof F?e(n.options[0]):Be(n)?Ue(n)?[M(n.element)]:[]:n instanceof Q?"":n instanceof I?n.options[0]:n instanceof q?Object.fromEntries(Object.entries(n.shape).map(([t,a])=>[t,e(a)])):e(n)}function P(n){if(n instanceof T)return n;if(n instanceof q){let e=n.shape.type;if(e instanceof T)return e;throw Error("Invalid schema")}if(n instanceof K||n instanceof F)return P(n.options[0]);throw we.warn(n),Error("Invalid schema")}function Ue(n){return!n.safeParse([]).success}var oe=X(),ce=H(fe(),1),r=H(ye(),1),de=`
|
|
2
2
|
`;const me=n=>{let e=(0,oe.c)(24),{value:t,options:a,onChange:l,className:c,placeholder:o,textAreaClassName:f,comboBoxClassName:h}=n,[s,i]=(0,ce.useState)(!1),m;e[0]===t?m=e[1]:(m=Z(t),e[0]=t,e[1]=m);let p=m,x;e[2]!==h||e[3]!==l||e[4]!==a||e[5]!==o||e[6]!==s||e[7]!==f||e[8]!==p?(x=()=>s?(0,r.jsx)(W,{value:p,className:f,onChange:l,placeholder:o?`${o}: one per line`:"One value per line"}):(0,r.jsx)(ee,{placeholder:o,displayValue:We,className:J("w-full max-w-[400px]",h),multiple:!0,value:p,onValueChange:l,keepPopoverOpenOnSelect:!0,chips:!0,chipsClassName:"flex-row flex-wrap min-w-[210px]",children:a.map(Ge)}),e[2]=h,e[3]=l,e[4]=a,e[5]=o,e[6]=s,e[7]=f,e[8]=p,e[9]=x):x=e[9];let d=x,v;e[10]===c?v=e[11]:(v=J("flex gap-1",c),e[10]=c,e[11]=v);let u;e[12]===d?u=e[13]:(u=d(),e[12]=d,e[13]=u);let g=s?"Switch to multi-select":"Switch to textarea",j;e[14]===Symbol.for("react.memo_cache_sentinel")?(j=(0,r.jsx)(Ie,{className:"w-3 h-3"}),e[14]=j):j=e[14];let b;e[15]===s?b=e[16]:(b=(0,r.jsx)(Le,{size:"xs",onPressedChange:i,pressed:s,children:j}),e[15]=s,e[16]=b);let C;e[17]!==g||e[18]!==b?(C=(0,r.jsx)(_e,{content:g,children:b}),e[17]=g,e[18]=b,e[19]=C):C=e[19];let y;return e[20]!==v||e[21]!==u||e[22]!==C?(y=(0,r.jsxs)("div",{className:v,children:[u,C]}),e[20]=v,e[21]=u,e[22]=C,e[23]=y):y=e[23],y},W=n=>{let e=(0,oe.c)(11),{className:t,value:a,onChange:l,placeholder:c}=n,o,f;if(e[0]!==a){let m=Z(a);o=te,f=m.join(de),e[0]=a,e[1]=o,e[2]=f}else o=e[1],f=e[2];let h;e[3]===l?h=e[4]:(h=m=>{if(m.target.value===""){l([]);return}l(m.target.value.split(de))},e[3]=l,e[4]=h);let s=c?`${c}: one per line`:"One value per line",i;return e[5]!==o||e[6]!==t||e[7]!==f||e[8]!==h||e[9]!==s?(i=(0,r.jsx)(o,{value:f,className:t,rows:4,onChange:h,placeholder:s}),e[5]=o,e[6]=t,e[7]=f,e[8]=h,e[9]=s,e[10]=i):i=e[10],i};function Z(n){return n==null?[]:Array.isArray(n)?n:[n].filter(e=>e!=null||e!=="")}function We(n){return n}function Ge(n){return(0,r.jsx)(re,{value:n,children:n},n)}var E=X();const He=n=>{let e=(0,E.c)(14),{schema:t,form:a,path:l,renderers:c,children:o}=n,f=l===void 0?"":l,h,s,i,m;if(e[0]!==o||e[1]!==a||e[2]!==f||e[3]!==t||e[4]!==c){let x=c===void 0?[]:c;h=Ze,s=a,i=o,m=$({schema:t,form:a,path:f,renderers:x}),e[0]=o,e[1]=a,e[2]=f,e[3]=t,e[4]=c,e[5]=h,e[6]=s,e[7]=i,e[8]=m}else h=e[5],s=e[6],i=e[7],m=e[8];let p;return e[9]!==h||e[10]!==s||e[11]!==i||e[12]!==m?(p=(0,r.jsxs)(h,{...s,children:[i,m]}),e[9]=h,e[10]=s,e[11]=i,e[12]=m,e[13]=p):p=e[13],p};function $({schema:n,form:e,path:t,renderers:a}){for(let s of a){let{isMatch:i,Component:m}=s;if(i(n))return(0,r.jsx)(m,{schema:n,form:e,path:t})}let{label:l,description:c,special:o,direction:f="column",minLength:h}=A.parse(n.description||"");if(n instanceof R){let s=n.unwrap();return s=!s.description&&n.description?s.describe(n.description):s,$({schema:s,form:e,path:t,renderers:a})}if(n instanceof je){let s=n.unwrap();return s=!s.description&&n.description?s.describe(n.description):s,$({schema:s,form:e,path:t,renderers:a})}if(n instanceof q)return(0,r.jsxs)("div",{className:J("flex",f==="row"?"flex-row gap-6 items-start":f==="two-columns"?"grid grid-cols-2 gap-y-6":"flex-col gap-6"),children:[(0,r.jsx)(N,{children:l}),Ce.entries(n.shape).map(([s,i])=>{let m=i instanceof T,p=$({schema:i,form:e,path:er(t,s),renderers:a});return m?(0,r.jsx)(ce.Fragment,{children:p},s):(0,r.jsx)("div",{className:"flex flex-row align-start",children:p},s)})]});if(n instanceof Q)return o==="time"?(0,r.jsx)(w,{control:e.control,name:t,render:({field:s})=>(0,r.jsxs)(V,{children:[(0,r.jsx)(N,{children:l}),(0,r.jsx)(S,{children:c}),(0,r.jsx)(k,{children:(0,r.jsx)(U,{...s,onValueChange:s.onChange,type:"time",className:"my-0"})}),(0,r.jsx)(O,{})]})}):(0,r.jsx)(he,{schema:n,form:e,path:t});if(n instanceof ue)return(0,r.jsx)(w,{control:e.control,name:t,render:({field:s})=>(0,r.jsxs)(V,{children:[(0,r.jsxs)("div",{className:J("flex flex-row gap-2",c?"items-start":"items-center"),children:[(0,r.jsx)(k,{children:(0,r.jsx)(xe,{"data-testid":"marimo-plugin-data-frames-boolean-checkbox",checked:s.value,onCheckedChange:s.onChange,className:c?"mt-0.5":void 0})}),(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(N,{children:l}),(0,r.jsx)(S,{children:c})]})]}),(0,r.jsx)(O,{})]})});if(n instanceof ge)return o==="random_number_button"?(0,r.jsx)(w,{control:e.control,name:t,render:({field:s})=>(0,r.jsxs)(ne,{size:"xs","data-testid":"marimo-plugin-data-frames-random-number-button",variant:"secondary",onClick:()=>{s.onChange(ae())},children:[(0,r.jsx)(Je,{className:"w-3.5 h-3.5 mr-1"}),l]})}):(0,r.jsx)(w,{control:e.control,name:t,render:({field:s})=>(0,r.jsxs)(V,{children:[(0,r.jsx)(N,{children:l}),(0,r.jsx)(S,{children:c}),(0,r.jsx)(k,{children:(0,r.jsx)(Me,{...s,className:"my-0",onValueChange:s.onChange})}),(0,r.jsx)(O,{})]})});if(n instanceof ve){let s=o==="datetime"?"datetime-local":o==="time"?"time":"date";return(0,r.jsx)(w,{control:e.control,name:t,render:({field:i})=>(0,r.jsxs)(V,{children:[(0,r.jsx)(N,{children:l}),(0,r.jsx)(S,{children:c}),(0,r.jsx)(k,{children:(0,r.jsx)(U,{...i,onValueChange:i.onChange,type:s,className:"my-0"})}),(0,r.jsx)(O,{})]})})}if(n instanceof be)return(0,r.jsx)(he,{schema:n,form:e,path:t});if(n instanceof I)return(0,r.jsx)(Xe,{schema:n,form:e,path:t,options:n.options.map(s=>s.toString())});if(n instanceof Ne){if(o==="text_area_multiline")return(0,r.jsx)(Re,{schema:n,form:e,path:t});let s=n.element;return s instanceof I?(0,r.jsx)(Ye,{schema:n,form:e,path:t,itemLabel:l,options:s.options.map(i=>i.toString())}):(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,r.jsx)(Pe,{children:l}),(0,r.jsx)(Qe,{schema:n.element,form:e,path:t,minLength:h,renderers:a},t)]})}if(n instanceof F){let s=n.def,i=s.options,m=s.discriminator,p=x=>i.find(d=>P(d).value===x);return(0,r.jsx)(w,{control:e.control,name:t,render:({field:x})=>{let d=x.value,v=i.map(j=>P(j).value),u=d&&typeof d=="object"&&m in d?d[m]:v[0],g=p(u);return(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)(N,{className:"mb-2",children:l}),(0,r.jsx)("div",{className:"flex border-b mb-4",children:v.map(j=>(0,r.jsx)("button",{type:"button",className:`px-4 py-2 text-sm ${u===j?"border-b-2 border-primary font-medium":"text-muted-foreground"}`,onClick:()=>{let b=p(j);b?x.onChange(M(b)):x.onChange({[m]:j})},children:j},j))}),(0,r.jsx)("div",{className:"flex flex-col",children:g&&$({schema:g,form:e,path:t,renderers:a})},u)]})}})}return n instanceof K?(0,r.jsx)(w,{control:e.control,name:t,render:({field:s})=>{let i=n.options,m=s.value,p=i.map(d=>P(d).value);m||(m=p[0]);let x=i.find(d=>P(d).value===m);return(0,r.jsxs)("div",{className:"flex flex-col mb-4 gap-1",children:[(0,r.jsx)(N,{children:l}),(0,r.jsx)(Oe,{"data-testid":"marimo-plugin-data-frames-union-select",...s,children:p.map(d=>(0,r.jsx)("option",{value:d,children:d},d))}),x&&$({schema:x,form:e,path:t,renderers:a})]})}}):n instanceof T?(0,r.jsx)(w,{control:e.control,name:t,render:({field:s})=>(0,r.jsx)("input",{...s,type:"hidden",value:String([...n.values][0]??"")})}):"unwrap"in n?$({schema:ie(n),form:e,path:t,renderers:a}):le(n)?$({schema:n.in,form:e,path:t,renderers:a}):(0,r.jsxs)("div",{children:["Unknown schema type"," ",n==null?t:JSON.stringify(n.type??n)]})}var Qe=n=>{let e=(0,E.c)(39),{schema:t,form:a,path:l,minLength:c,renderers:o}=n,f;e[0]===t.description?f=e[1]:(f=A.parse(t.description||""),e[0]=t.description,e[1]=f);let{label:h,description:s}=f,i=a.control,m;e[2]!==i||e[3]!==l?(m={control:i,name:l},e[2]=i,e[3]=l,e[4]=m):m=e[4];let{fields:p,append:x,remove:d}=Fe(m),v=c!=null&&p.length<c,u=c==null||p.length>c,g;e[5]===h?g=e[6]:(g=(0,r.jsx)(N,{children:h}),e[5]=h,e[6]=g);let j;e[7]===s?j=e[8]:(j=(0,r.jsx)(S,{children:s}),e[7]=s,e[8]=j);let b;if(e[9]!==u||e[10]!==p||e[11]!==a||e[12]!==l||e[13]!==d||e[14]!==o||e[15]!==t){let D;e[17]!==u||e[18]!==a||e[19]!==l||e[20]!==d||e[21]!==o||e[22]!==t?(D=(pe,G)=>(0,r.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:ze.onEnter(rr),children:[$({schema:t,form:a,path:`${l}[${G}]`,renderers:o}),u&&(0,r.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:()=>{d(G)}})]},pe.id),e[17]=u,e[18]=a,e[19]=l,e[20]=d,e[21]=o,e[22]=t,e[23]=D):D=e[23],b=p.map(D),e[9]=u,e[10]=p,e[11]=a,e[12]=l,e[13]=d,e[14]=o,e[15]=t,e[16]=b}else b=e[16];let C;e[24]!==v||e[25]!==c?(C=v&&(0,r.jsx)("div",{className:"text-destructive text-xs font-semibold",children:(0,r.jsxs)("div",{children:["At least ",c," required."]})}),e[24]=v,e[25]=c,e[26]=C):C=e[26];let y;e[27]!==x||e[28]!==t?(y=()=>{x(M(t))},e[27]=x,e[28]=t,e[29]=y):y=e[29];let _;e[30]===Symbol.for("react.memo_cache_sentinel")?(_=(0,r.jsx)(De,{className:"w-3.5 h-3.5 mr-1"}),e[30]=_):_=e[30];let L;e[31]===y?L=e[32]:(L=(0,r.jsx)("div",{children:(0,r.jsxs)(ne,{size:"xs","data-testid":"marimo-plugin-data-frames-add-array-item",variant:"text",className:"hover:text-accent-foreground",onClick:y,children:[_,"Add"]})}),e[31]=y,e[32]=L);let z;return e[33]!==g||e[34]!==j||e[35]!==b||e[36]!==C||e[37]!==L?(z=(0,r.jsxs)("div",{className:"flex flex-col gap-2 min-w-[220px]",children:[g,j,b,C,L]}),e[33]=g,e[34]=j,e[35]=b,e[36]=C,e[37]=L,e[38]=z):z=e[38],z},he=n=>{let e=(0,E.c)(21),{schema:t,form:a,path:l}=n,c;e[0]===t.description?c=e[1]:(c=A.parse(t.description),e[0]=t.description,e[1]=c);let{label:o,description:f,placeholder:h,disabled:s,inputType:i}=c;if(i==="textarea"){let x;e[2]!==f||e[3]!==s||e[4]!==o||e[5]!==h?(x=v=>{let{field:u}=v;return(0,r.jsxs)(V,{children:[(0,r.jsx)(N,{children:o}),(0,r.jsx)(S,{children:f}),(0,r.jsx)(k,{children:(0,r.jsx)(te,{...u,value:u.value,onChange:u.onChange,className:"my-0",placeholder:h,disabled:s})}),(0,r.jsx)(O,{})]})},e[2]=f,e[3]=s,e[4]=o,e[5]=h,e[6]=x):x=e[6];let d;return e[7]!==a.control||e[8]!==l||e[9]!==x?(d=(0,r.jsx)(w,{control:a.control,name:l,render:x}),e[7]=a.control,e[8]=l,e[9]=x,e[10]=d):d=e[10],d}let m;e[11]!==f||e[12]!==s||e[13]!==i||e[14]!==o||e[15]!==h?(m=x=>{let{field:d}=x;return(0,r.jsxs)(V,{children:[(0,r.jsx)(N,{children:o}),(0,r.jsx)(S,{children:f}),(0,r.jsx)(k,{children:(0,r.jsx)(U,{...d,type:i,value:d.value,onValueChange:d.onChange,className:"my-0",placeholder:h,disabled:s})}),(0,r.jsx)(O,{})]})},e[11]=f,e[12]=s,e[13]=i,e[14]=o,e[15]=h,e[16]=m):m=e[16];let p;return e[17]!==a.control||e[18]!==l||e[19]!==m?(p=(0,r.jsx)(w,{control:a.control,name:l,render:m}),e[17]=a.control,e[18]=l,e[19]=m,e[20]=p):p=e[20],p},Re=n=>{let e=(0,E.c)(10),{schema:t,form:a,path:l}=n,c;e[0]===t.description?c=e[1]:(c=A.parse(t.description),e[0]=t.description,e[1]=c);let{label:o,description:f,placeholder:h}=c,s;e[2]!==f||e[3]!==o||e[4]!==h?(s=m=>{let{field:p}=m;return(0,r.jsxs)(V,{children:[(0,r.jsx)(N,{children:o}),(0,r.jsx)(S,{children:f}),(0,r.jsx)(k,{children:(0,r.jsx)(W,{...p,placeholder:h})}),(0,r.jsx)(O,{})]})},e[2]=f,e[3]=o,e[4]=h,e[5]=s):s=e[5];let i;return e[6]!==a.control||e[7]!==l||e[8]!==s?(i=(0,r.jsx)(w,{control:a.control,name:l,render:s}),e[6]=a.control,e[7]=l,e[8]=s,e[9]=i):i=e[9],i},Xe=n=>{let e=(0,E.c)(22),{schema:t,form:a,path:l,options:c,textTransform:o}=n,f;e[0]===t.description?f=e[1]:(f=A.parse(t.description),e[0]=t.description,e[1]=f);let{label:h,description:s,disabled:i,special:m}=f;if(m==="radio_group"){let d;e[2]!==s||e[3]!==h||e[4]!==c||e[5]!==l?(d=u=>{let{field:g}=u;return(0,r.jsxs)(V,{children:[(0,r.jsx)(N,{children:h}),(0,r.jsx)(S,{children:s}),(0,r.jsx)(k,{children:(0,r.jsx)(Te,{className:"flex flex-row gap-2 pt-1 items-center",value:g.value,onValueChange:g.onChange,children:c.map(j=>(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)(Ee,{value:j,id:`${l}-${j}`},j),(0,r.jsx)(N,{className:"whitespace-pre",htmlFor:`${l}-${j}`,children:se.startCase(j)})]},j))})}),(0,r.jsx)(O,{})]})},e[2]=s,e[3]=h,e[4]=c,e[5]=l,e[6]=d):d=e[6];let v;return e[7]!==i||e[8]!==a.control||e[9]!==l||e[10]!==d?(v=(0,r.jsx)(w,{control:a.control,name:l,disabled:i,render:d}),e[7]=i,e[8]=a.control,e[9]=l,e[10]=d,e[11]=v):v=e[11],v}let p;e[12]!==s||e[13]!==h||e[14]!==c||e[15]!==o?(p=d=>{let{field:v}=d;return(0,r.jsxs)(V,{children:[(0,r.jsx)(N,{className:"whitespace-pre",children:h}),(0,r.jsx)(S,{children:s}),(0,r.jsx)(k,{children:(0,r.jsxs)(Ae,{"data-testid":"marimo-plugin-data-frames-select",value:v.value,onValueChange:v.onChange,children:[(0,r.jsx)($e,{className:"min-w-[180px]",children:(0,r.jsx)(Se,{placeholder:"--"})}),(0,r.jsx)(ke,{children:(0,r.jsxs)(Ve,{children:[c.map(u=>(0,r.jsx)(Y,{value:u,children:(o==null?void 0:o(u))??u},u)),c.length===0&&(0,r.jsx)(Y,{disabled:!0,value:"--",children:"No options"})]})})]})}),(0,r.jsx)(O,{})]})},e[12]=s,e[13]=h,e[14]=c,e[15]=o,e[16]=p):p=e[16];let x;return e[17]!==i||e[18]!==a.control||e[19]!==l||e[20]!==p?(x=(0,r.jsx)(w,{control:a.control,name:l,disabled:i,render:p}),e[17]=i,e[18]=a.control,e[19]=l,e[20]=p,e[21]=x):x=e[21],x},Ye=n=>{let e=(0,E.c)(15),{schema:t,form:a,path:l,options:c,itemLabel:o,showSwitchable:f}=n,h;e[0]===t.description?h=e[1]:(h=A.parse(t.description),e[0]=t.description,e[1]=h);let{label:s,description:i,placeholder:m}=h,p;e[2]!==o||e[3]!==m?(p=m??(o?`Select ${o==null?void 0:o.toLowerCase()}`:void 0),e[2]=o,e[3]=m,e[4]=p):p=e[4];let x=p,d;e[5]!==i||e[6]!==s||e[7]!==c||e[8]!==x||e[9]!==f?(d=u=>{let{field:g}=u,j=Z(g.value);return(0,r.jsxs)(V,{children:[(0,r.jsx)(N,{className:"whitespace-pre",children:s}),(0,r.jsx)(S,{children:i}),(0,r.jsx)(k,{children:f?(0,r.jsx)(me,{...g,value:j,options:c,placeholder:x}):(0,r.jsx)(ee,{className:"min-w-[180px]",placeholder:x,displayValue:nr,multiple:!0,chips:!0,keepPopoverOpenOnSelect:!0,value:j,onValueChange:g.onChange,children:c.map(sr)})}),(0,r.jsx)(O,{})]})},e[5]=i,e[6]=s,e[7]=c,e[8]=x,e[9]=f,e[10]=d):d=e[10];let v;return e[11]!==a.control||e[12]!==l||e[13]!==d?(v=(0,r.jsx)(w,{control:a.control,name:l,render:d}),e[11]=a.control,e[12]=l,e[13]=d,e[14]=v):v=e[14],v};function er(...n){return n.filter(e=>e!=="").join(".")}function rr(n){return n.preventDefault()}function nr(n){return se.startCase(n)}function sr(n){return(0,r.jsx)(re,{value:n,children:n},n)}export{Z as a,A as c,W as i,ae as l,$ as n,M as o,me as r,P as s,He as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as re}from"./chunk-LvLJmgfZ.js";import{d as je,l as oe,n as ae}from"./useEvent-D91BmmQi.js";import{t as be}from"./react-Bj1aDYRI.js";import{Br as ve,Ir as se,Kn as ie,Kr as ke,Nt as we,Rr as Ne,qr as _e,ra as ne}from"./cells-DxL32Atg.js";import"./react-dom-CSu739Rf.js";import{t as le}from"./compiler-runtime-B3qBwwSJ.js";import{_ as ce}from"./useEventListener-B_wSLgFR.js";import{t as Se}from"./objects-BlG0ZrO0.js";import{n as E}from"./constants-CDyU_g2F.js";import{P as Ce}from"./config-Bm5B9wGP.js";import{t as ze}from"./ErrorBoundary-BfMsWVQU.js";import{t as Ie}from"./cn-DYvqRARy.js";import{t as Me}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-B51geQ_6.js";import{o as Re}from"./alert-dialog-DMh8_LWc.js";import"./popover-DHbixh3D.js";import{a as Pe,c as De,p as Oe,r as Te,t as We}from"./dropdown-menu-BGBlPKNz.js";import{t as Ae}from"./label-DUD3SZnk.js";import{t as Fe}from"./tooltip-BcgbFR7q.js";import{t as B}from"./button-BB1AV4Rb.js";import"./dist-gUHullA_.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{r as q}from"./requests-9-v2bhoi.js";import{t as H}from"./createLucideIcon-w-Qo9n0R.js";import{t as Ue}from"./chart-no-axes-column-iDRxid4h.js";import{r as $e}from"./x-C-Eq0ag8.js";import{t as Le}from"./chevron-right-BS_NcSch.js";import{o as me,s as Ee}from"./tree-actions-o2iyMmKN.js";import{t as He}from"./circle-play-9HoTo51X.js";import{t as K}from"./external-link-BOlXZUla.js";import{r as Ve,t as Be}from"./file-icons-NkObNkr_.js";import{t as qe}from"./file-CJH9JNGH.js";import{n as Ye,r as Je,t as Ge}from"./youtube-OwaksuQt.js";import{t as Ke}from"./link-CHdiBDr5.js";import{t as Q}from"./spinner-D-V4psAa.js";import{t as Qe}from"./package-Bxz_8e44.js";import{a as Xe,i as Ze,l as et,n as tt,o as rt,r as ot,s as at,t as st}from"./file-name-input-BQJ9U9lU.js";import{n as it,r as nt,t as lt}from"./app-config-button-QHaORuxs.js";import{t as ct}from"./refresh-ccw-sLaKP2vj.js";import{dt as mt,r as dt}from"./input-_AaMXWgD.js";import"./dist-Jbd9zUbK.js";import"./dist-BWXIz8tq.js";import"./dist-DX04AOlt.js";import"./dist-D5nYeU7Q.js";import"./dist-6qzebh8f.js";import{t as de}from"./use-toast-BwJoaaDM.js";import{n as he}from"./paths-BKO-pHK6.js";import{c as pe,n as ht,o as pt,t as ft}from"./session-BtBr2zr3.js";import"./purify.es-CWmnYhGI.js";import{s as ut}from"./dates-BzOh4kS_.js";import{t as xt}from"./context-BFPaAUK_.js";import{n as gt}from"./ImperativeModal-Ci0icDPt.js";import{a as yt}from"./errors-DCPV979Q.js";import{n as jt}from"./react-icons.esm-D4GMDkIf.js";import{t as fe}from"./error-banner-BkIr-0dH.js";import{n as X,t as bt}from"./useAsyncData-Bg5iAViP.js";import{t as Z}from"./icons-NFYKylj6.js";import{t as vt}from"./github-A_zUd4Uj.js";import{n as kt}from"./marimo-icons-yD_pAOm9.js";import{t as wt}from"./links-DBc28bsl.js";import"./Inputs-BmtHnGKp.js";import{t as Nt}from"./useInterval-CjGsg4ie.js";var _t=H("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),St=H("book-text",[["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:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]),Ct=H("graduation-cap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]),zt=H("orbit",[["path",{d:"M20.341 6.484A10 10 0 0 1 10.266 21.85",key:"1enhxb"}],["path",{d:"M3.659 17.516A10 10 0 0 1 13.74 2.152",key:"1crzgf"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}]]),It=H("panels-top-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]),P=re(be(),1),ee=le(),r=re(Me(),1),Mt={intro:["Introduction",_t,"Get started with marimo basics"],dataflow:["Dataflow",_e,"Learn how cells interact with each other"],ui:["UI Elements",It,"Create interactive UI components"],markdown:["Markdown",se,"Format text with parameterized markdown"],plots:["Plots",Ue,"Create interactive visualizations"],sql:["SQL",Ne,"Query databases directly in marimo"],layout:["Layout",Je,"Customize the layout of your cells' output"],fileformat:["File format",qe,"Understand marimo's pure-Python file format"],"external-dependencies":["External dependencies",Qe,"Declare dependencies with Python script metadata"],"for-jupyter-users":["For Jupyter users",zt,"Transiting from Jupyter to marimo"],"markdown-format":["Markdown format",Z,"Using marimo to edit markdown files"]};const Rt=()=>{let t=(0,ee.c)(6),{openTutorial:e}=q(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(Ct,{className:"w-4 h-4 mr-2"}),t[0]=o):o=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(Oe,{asChild:!0,children:(0,r.jsxs)(B,{"data-testid":"open-tutorial-button",size:"xs",variant:"outline",children:[o,"Tutorials",(0,r.jsx)(jt,{className:"w-3 h-3 ml-1"})]})}),t[1]=s):s=t[1];let a;t[2]===e?a=t[3]:(a=Se.entries(Mt).map(i=>{let[m,h]=i,[p,u,l]=h;return(0,r.jsxs)(Pe,{onSelect:async()=>{let c=await e({tutorialId:m});c&&wt(c.path)},children:[(0,r.jsx)(u,{strokeWidth:1.5,className:"w-4 h-4 mr-3 self-start mt-1.5 text-muted-foreground"}),(0,r.jsx)("div",{className:"flex items-center",children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{children:p}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground pr-1",children:l})]})})]},m)}),t[2]=e,t[3]=a);let n;return t[4]===a?n=t[5]:(n=(0,r.jsxs)(We,{children:[s,(0,r.jsx)(Te,{side:"bottom",align:"end",className:"print:hidden",children:a})]}),t[4]=a,t[5]=n),n};var Pt=[{title:"Documentation",description:"Official marimo documentation and API reference",icon:ke,url:E.docsPage},{title:"GitHub",description:"View source code, report issues, or contribute",icon:vt,url:E.githubPage},{title:"Community",description:"Join the marimo Discord community",icon:Ye,url:E.discordLink},{title:"molab",description:"Run marimo notebooks in the cloud",icon:kt,url:E.molab},{title:"YouTube",description:"Watch tutorials and demos",icon:Ge,url:E.youtube},{title:"Changelog",description:"See what's new in marimo",icon:se,url:E.releasesPage}];const Dt=()=>{let t=(0,ee.c)(2),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(Y,{Icon:Ke,children:"Resources"}),t[0]=e):e=t[0];let o;return t[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[e,(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:Pt.map(Ot)})]}),t[1]=o):o=t[1],o},Y=t=>{let e=(0,ee.c)(8),{Icon:o,control:s,children:a}=t,n;e[0]===o?n=e[1]:(n=(0,r.jsx)(o,{className:"h-5 w-5"}),e[0]=o,e[1]=n);let i;e[2]!==a||e[3]!==n?(i=(0,r.jsxs)("h2",{className:"flex items-center gap-2 text-xl font-semibold text-muted-foreground select-none",children:[n,a]}),e[2]=a,e[3]=n,e[4]=i):i=e[4];let m;return e[5]!==s||e[6]!==i?(m=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[i,s]}),e[5]=s,e[6]=i,e[7]=m):m=e[7],m};function Ot(t){return(0,r.jsxs)("a",{href:t.url,target:"_blank",className:"flex items-start gap-3 py-3 px-3 rounded-lg border hover:bg-accent/20 transition-colors shadow-xs",children:[(0,r.jsx)(t.icon,{className:"w-5 h-5 mt-1.5 text-primary"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-medium",children:t.title}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t.description})]})]},t.title)}const te=P.createContext({runningNotebooks:new Map,setRunningNotebooks:ce.NOOP}),J=P.createContext({root:"",refreshWorkspace:ce.NOOP}),Tt=ne("marimo:home:include-markdown",!1,ie,{getOnInit:!0}),ue=ne("marimo:home:expanded-folders",{},ie,{getOnInit:!0});var W=le();function xe(t){return`${ft()}-${encodeURIComponent(t)}`}var Wt=()=>{let t=(0,W.c)(58),[e,o]=(0,P.useState)(0),{getRecentFiles:s,getRunningNotebooks:a}=q(),n;t[0]===s?n=t[1]:(n=()=>s(),t[0]=s,t[1]=n);let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=[],t[2]=i):i=t[2];let m=X(n,i),h,p;t[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{o(qt)},p={delayMs:1e4,whenVisible:!0},t[3]=h,t[4]=p):(h=t[3],p=t[4]),Nt(h,p);let u;t[5]===a?u=t[6]:(u=async()=>{let R=await a();return me.keyBy(R.files,Yt)},t[5]=a,t[6]=u);let l;t[7]===e?l=t[8]:(l=[e],t[7]=e,t[8]=l);let c=X(u,l),f,d,y,x,v,b,g,j,k,N,_,D,S;if(t[9]!==m||t[10]!==c){k=Symbol.for("react.early_return_sentinel");e:{let R=bt(m,c);if(R.error)throw R.error;let F=R.data;if(!F){let V;t[24]===Symbol.for("react.memo_cache_sentinel")?(V=(0,r.jsx)(Q,{centered:!0,size:"xlarge"}),t[24]=V):V=t[24],k=V;break e}let[$,L]=F;x=$,y=P.Suspense,d=te,g={runningNotebooks:L,setRunningNotebooks:c.setData};let w,U;t[25]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsx)(Rt,{}),U=(0,r.jsx)(lt,{showAppConfig:!1}),t[25]=w,t[26]=U):(w=t[25],U=t[26]);let G=`This will shutdown the notebook server and terminate all running notebooks (${L.size}). You'll lose all data that's in memory.`;t[27]===G?j=t[28]:(j=(0,r.jsxs)("div",{className:"absolute top-3 right-5 flex gap-3 z-50",children:[w,U,(0,r.jsx)(it,{description:G})]}),t[27]=G,t[28]=j),D="flex flex-col gap-6 max-w-6xl container pt-5 pb-20 z-10",t[29]===Symbol.for("react.memo_cache_sentinel")?(S=(0,r.jsx)("img",{src:"logo.png",alt:"marimo logo",className:"w-48 mb-2"}),v=(0,r.jsx)(Vt,{}),b=(0,r.jsx)(Dt,{}),t[29]=v,t[30]=b,t[31]=S):(v=t[29],b=t[30],S=t[31]),f=ge,t[32]===Symbol.for("react.memo_cache_sentinel")?(N=(0,r.jsx)(Y,{Icon:He,children:"Running notebooks"}),t[32]=N):N=t[32],_=[...L.values()]}t[9]=m,t[10]=c,t[11]=f,t[12]=d,t[13]=y,t[14]=x,t[15]=v,t[16]=b,t[17]=g,t[18]=j,t[19]=k,t[20]=N,t[21]=_,t[22]=D,t[23]=S}else f=t[11],d=t[12],y=t[13],x=t[14],v=t[15],b=t[16],g=t[17],j=t[18],k=t[19],N=t[20],_=t[21],D=t[22],S=t[23];if(k!==Symbol.for("react.early_return_sentinel"))return k;let C;t[33]!==f||t[34]!==N||t[35]!==_?(C=(0,r.jsx)(f,{header:N,files:_}),t[33]=f,t[34]=N,t[35]=_,t[36]=C):C=t[36];let A;t[37]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(Y,{Icon:ve,children:"Recent notebooks"}),t[37]=A):A=t[37];let z;t[38]===x.files?z=t[39]:(z=(0,r.jsx)(ge,{header:A,files:x.files}),t[38]=x.files,t[39]=z);let I;t[40]===m.refetch?I=t[41]:(I=(0,r.jsx)(ze,{children:(0,r.jsx)(At,{onRefreshRecents:m.refetch})}),t[40]=m.refetch,t[41]=I);let O;t[42]!==v||t[43]!==b||t[44]!==C||t[45]!==z||t[46]!==I||t[47]!==D||t[48]!==S?(O=(0,r.jsxs)("div",{className:D,children:[S,v,b,C,z,I]}),t[42]=v,t[43]=b,t[44]=C,t[45]=z,t[46]=I,t[47]=D,t[48]=S,t[49]=O):O=t[49];let M;t[50]!==d||t[51]!==g||t[52]!==j||t[53]!==O?(M=(0,r.jsxs)(d,{value:g,children:[j,O]}),t[50]=d,t[51]=g,t[52]=j,t[53]=O,t[54]=M):M=t[54];let T;return t[55]!==y||t[56]!==M?(T=(0,r.jsx)(y,{children:M}),t[55]=y,t[56]=M,t[57]=T):T=t[57],T},At=t=>{let e=(0,W.c)(54),{onRefreshRecents:o}=t,{getWorkspaceFiles:s}=q(),[a,n]=oe(Tt),[i,m]=(0,P.useState)(""),h;e[0]!==s||e[1]!==a?(h=()=>s({includeMarkdown:a}),e[0]=s,e[1]=a,e[2]=h):h=e[2];let p;e[3]===a?p=e[4]:(p=[a],e[3]=a,e[4]=p);let{isPending:u,data:l,error:c,isFetching:f,refetch:d}=X(h,p),y;e[5]!==o||e[6]!==d?(y=()=>{d(),o()},e[5]=o,e[6]=d,e[7]=y):y=e[7];let x=ae(y);l==null||l.root;let v=(l==null?void 0:l.root)??"",b;e[8]!==x||e[9]!==v?(b={root:v,refreshWorkspace:x},e[8]=x,e[9]=v,e[10]=b):b=e[10];let g=b;if(u){let w;return e[11]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsx)(Q,{centered:!0,size:"xlarge",className:"mt-6"}),e[11]=w):w=e[11],w}if(c){let w;e[12]===c?w=e[13]:(w=yt(c),e[12]=c,e[13]=w);let U;return e[14]===w?U=e[15]:(U=(0,r.jsx)(fe,{kind:"danger",className:"rounded p-4",children:w}),e[14]=w,e[15]=U),U}let j;e[16]!==l.fileCount||e[17]!==l.hasMore?(j=l.hasMore&&(0,r.jsxs)(fe,{kind:"warn",className:"rounded p-4",children:["Showing first ",l.fileCount," files. Your workspace has more files."]}),e[16]=l.fileCount,e[17]=l.hasMore,e[18]=j):j=e[18];let k,N;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=(0,r.jsx)(mt,{size:13}),N=w=>m(w.target.value),e[19]=k,e[20]=N):(k=e[19],N=e[20]);let _;e[21]===i?_=e[22]:(_=(0,r.jsx)(dt,{id:"search",value:i,icon:k,onChange:N,placeholder:"Search",className:"mb-0 border-border"}),e[21]=i,e[22]=_);let D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsx)(Ft,{}),e[23]=D):D=e[23];let S;e[24]===n?S=e[25]:(S=w=>n(!!w),e[24]=n,e[25]=S);let C;e[26]!==a||e[27]!==S?(C=(0,r.jsx)(we,{"data-testid":"include-markdown-checkbox",id:"include-markdown",checked:a,onCheckedChange:S}),e[26]=a,e[27]=S,e[28]=C):C=e[28];let A;e[29]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(Ae,{htmlFor:"include-markdown",children:"Include markdown"}),e[29]=A):A=e[29];let z;e[30]!==C||e[31]!==_?(z=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[_,D,C,A]}),e[30]=C,e[31]=_,e[32]=z):z=e[32];let I;e[33]===d?I=e[34]:(I=()=>d(),e[33]=d,e[34]=I);let O;e[35]===Symbol.for("react.memo_cache_sentinel")?(O=(0,r.jsx)(ct,{className:"w-4 h-4"}),e[35]=O):O=e[35];let M;e[36]===I?M=e[37]:(M=(0,r.jsx)(B,{variant:"text",size:"icon",className:"w-4 h-4 ml-1 p-0 opacity-70 hover:opacity-100",onClick:I,"aria-label":"Refresh workspace",children:O}),e[36]=I,e[37]=M);let T;e[38]===f?T=e[39]:(T=f&&(0,r.jsx)(Q,{size:"small"}),e[38]=f,e[39]=T);let R;e[40]!==z||e[41]!==M||e[42]!==T?(R=(0,r.jsxs)(Y,{Icon:St,control:z,children:["Workspace",M,T]}),e[40]=z,e[41]=M,e[42]=T,e[43]=R):R=e[43];let F;e[44]!==i||e[45]!==l.files?(F=(0,r.jsx)("div",{className:"flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background",children:(0,r.jsx)(Ut,{searchText:i,files:l.files})}),e[44]=i,e[45]=l.files,e[46]=F):F=e[46];let $;e[47]!==R||e[48]!==F||e[49]!==j?($=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[j,R,F]}),e[47]=R,e[48]=F,e[49]=j,e[50]=$):$=e[50];let L;return e[51]!==$||e[52]!==g?(L=(0,r.jsx)(J,{value:g,children:$}),e[51]=$,e[52]=g,e[53]=L):L=e[53],L},Ft=()=>{let t=(0,W.c)(5),e=je(ue),o;t[0]===e?o=t[1]:(o=()=>{e({})},t[0]=e,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(Ee,{className:"w-4 h-4 mr-1"}),t[2]=s):s=t[2];let a;return t[3]===o?a=t[4]:(a=(0,r.jsxs)(B,{variant:"text",size:"sm",className:"h-fit hidden sm:flex",onClick:o,children:[s,"Collapse all"]}),t[3]=o,t[4]=a),a},Ut=t=>{let e=(0,W.c)(20),{files:o,searchText:s}=t,[a,n]=oe(ue),i=Object.keys(a).length===0,m=(0,P.useRef)(void 0),{root:h,refreshWorkspace:p}=(0,P.use)(J),u;e[0]===h?u=e[1]:(u={root:h},e[0]=h,e[1]=u);let{renameFile:l}=rt(u),c,f;e[2]===i?(c=e[3],f=e[4]):(c=()=>{var g;i&&((g=m.current)==null||g.closeAll())},f=[i],e[2]=i,e[3]=c,e[4]=f),(0,P.useEffect)(c,f);let d;e[5]!==p||e[6]!==l?(d=async(g,j)=>{var N;let k=(N=m.current)==null?void 0:N.get(g);if(!k){de({title:"Failed",description:`Node with id ${g} not found in the tree`});return}await l(k.data,j)&&p()},e[5]=p,e[6]=l,e[7]=d):d=e[7];let y=ae(d);if(o.length===0){let g;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=(0,r.jsx)("div",{className:"flex flex-col px-5 py-10 items-center justify-center",children:(0,r.jsx)("p",{className:"text-center text-muted-foreground",children:"No files in this workspace"})}),e[8]=g):g=e[8],g}let x;e[9]!==a||e[10]!==n?(x=async g=>{let j=a[g]??!1;n({...a,[g]:!j})},e[9]=a,e[10]=n,e[11]=x):x=e[11];let v;e[12]===y?v=e[13]:(v=async g=>{let{id:j,name:k}=g;await y(j,k)},e[12]=y,e[13]=v);let b;return e[14]!==o||e[15]!==a||e[16]!==s||e[17]!==x||e[18]!==v?(b=(0,r.jsx)(et,{ref:m,width:"100%",height:500,searchTerm:s,className:"h-full",idAccessor:Jt,data:o,openByDefault:!1,initialOpenState:a,onToggle:x,onRename:v,padding:5,rowHeight:35,indent:15,overscanCount:1e3,renderCursor:Gt,disableDrop:!0,disableDrag:!0,disableMultiSelection:!0,children:$t}),e[14]=o,e[15]=a,e[16]=s,e[17]=x,e[18]=v,e[19]=b):b=e[19],b},$t=t=>{let e=(0,W.c)(18),{node:o,style:s}=t,a=Be[o.data.isDirectory?"directory":Ve(o.data.name)],n;e[0]===a?n=e[1]:(n=(0,r.jsx)(a,{className:"w-5 h-5 shrink-0",strokeWidth:1.5}),e[0]=a,e[1]=n);let i=n,{root:m}=(0,P.use)(J),{runningNotebooks:h}=(0,P.use)(te),p;e[2]!==i||e[3]!==o||e[4]!==m||e[5]!==h?(p=()=>{if(o.isEditing)return(0,r.jsxs)("div",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",children:[i,(0,r.jsx)(st,{node:o})]});if(o.data.isDirectory)return(0,r.jsxs)("span",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",children:[i,o.data.name]});let x=o.data.path.startsWith(m)&&he.isAbsolute(o.data.path)?he.rest(o.data.path,m):o.data.path,v=x.endsWith(".md")||x.endsWith(".qmd"),b=h.has(x);return(0,r.jsxs)("a",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",href:pe(`?file=${encodeURIComponent(x)}`).toString(),target:xe(x),children:[i,(0,r.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",children:[o.data.name,v&&(0,r.jsx)(Z,{className:"ml-2 inline opacity-80"})]}),(0,r.jsx)(Lt,{node:o,isRunning:b}),(0,r.jsx)("div",{className:"w-8 h-8 flex items-center justify-center shrink-0",children:(0,r.jsx)(ye,{filePath:x})}),(0,r.jsx)(K,{size:20,className:"group-hover:opacity-100 opacity-0 text-primary shrink-0"})]})},e[2]=i,e[3]=o,e[4]=m,e[5]=h,e[6]=p):p=e[6];let u=p,l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=Ie("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group h-full"),e[7]=l):l=e[7];let c,f;e[8]===o?(c=e[9],f=e[10]):(c=x=>{x.stopPropagation(),o.data.isDirectory&&o.toggle()},f=(0,r.jsx)(Et,{node:o}),e[8]=o,e[9]=c,e[10]=f);let d;e[11]===u?d=e[12]:(d=u(),e[11]=u,e[12]=d);let y;return e[13]!==s||e[14]!==c||e[15]!==f||e[16]!==d?(y=(0,r.jsxs)("div",{style:s,className:l,onClick:c,children:[f,d]}),e[13]=s,e[14]=c,e[15]=f,e[16]=d,e[17]=y):y=e[17],y},Lt=t=>{let e=(0,W.c)(19),{node:o,isRunning:s}=t,{root:a,refreshWorkspace:n}=(0,P.use)(J),i;e[0]!==o||e[1]!==n||e[2]!==a?(i={node:o,root:a,onAfterChange:n},e[0]=o,e[1]=n,e[2]=a,e[3]=i):i=e[3];let{handleRename:m,handleDuplicate:h,handleDelete:p}=at(i),u=s?"Stop the notebook's kernel before renaming or deleting.":void 0,l;e[4]!==m||e[5]!==s||e[6]!==u?(l=(0,r.jsx)(Xe,{onSelect:m,disabled:s,title:u}),e[4]=m,e[5]=s,e[6]=u,e[7]=l):l=e[7];let c;e[8]===h?c=e[9]:(c=(0,r.jsx)(ot,{onSelect:h}),e[8]=h,e[9]=c);let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=(0,r.jsx)(De,{}),e[10]=f):f=e[10];let d;e[11]!==p||e[12]!==s||e[13]!==u?(d=(0,r.jsx)(tt,{onSelect:p,disabled:s,title:u}),e[11]=p,e[12]=s,e[13]=u,e[14]=d):d=e[14];let y;return e[15]!==l||e[16]!==c||e[17]!==d?(y=(0,r.jsxs)(Ze,{testId:"workspace-more-button",buttonClassName:"w-8 h-8 p-0 shrink-0",contentClassName:"print:hidden w-fit min-w-[140px]",preventDefaultOnTrigger:!0,children:[l,c,f,d]}),e[15]=l,e[16]=c,e[17]=d,e[18]=y):y=e[18],y},Et=t=>{let e=(0,W.c)(3),{node:o}=t;if(!o.data.isDirectory){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)("span",{className:"w-5 h-5 shrink-0"}),e[0]=a):a=e[0],a}let s;return e[1]===o.isOpen?s=e[2]:(s=o.isOpen?(0,r.jsx)($e,{className:"w-5 h-5 shrink-0"}):(0,r.jsx)(Le,{className:"w-5 h-5 shrink-0"}),e[1]=o.isOpen,e[2]=s),s},ge=t=>{let e=(0,W.c)(7),{header:o,files:s}=t;if(s.length===0)return null;let a;e[0]===s?a=e[1]:(a=s.map(Kt),e[0]=s,e[1]=a);let n;e[2]===a?n=e[3]:(n=(0,r.jsx)("div",{className:"flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background",children:a}),e[2]=a,e[3]=n);let i;return e[4]!==o||e[5]!==n?(i=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[o,n]}),e[4]=o,e[5]=n,e[6]=i):i=e[6],i},Ht=t=>{let e=(0,W.c)(41),{file:o}=t,{locale:s}=xt(),a;e[0]===o.path?a=e[1]:(a=ht(o.path),e[0]=o.path,e[1]=a);let n=a,i,m,h,p;if(e[2]!==o.initializationId||e[3]!==o.path||e[4]!==n){let N=pe(n?`?file=${encodeURIComponent(o.initializationId??o.path)}&session_id=${o.path}`:`?file=${encodeURIComponent(o.path)}`),_;e[9]===o.path?_=e[10]:(_=o.path.endsWith(".md"),e[9]=o.path,e[10]=_),i=_,m="py-1.5 px-4 hover:bg-(--blue-2) hover:text-primary transition-all duration-300 cursor-pointer group relative flex gap-4 items-center",h=o.path,p=N.toString(),e[2]=o.initializationId,e[3]=o.path,e[4]=n,e[5]=i,e[6]=m,e[7]=h,e[8]=p}else i=e[5],m=e[6],h=e[7],p=e[8];let u=o.initializationId||o.path,l;e[11]===u?l=e[12]:(l=xe(u),e[11]=u,e[12]=l);let c;e[13]===i?c=e[14]:(c=i&&(0,r.jsx)("span",{className:"opacity-80",children:(0,r.jsx)(Z,{})}),e[13]=i,e[14]=c);let f;e[15]!==o.name||e[16]!==c?(f=(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[o.name,c]}),e[15]=o.name,e[16]=c,e[17]=f):f=e[17];let d;e[18]===o.path?d=e[19]:(d=(0,r.jsx)("p",{title:o.path,className:"text-sm text-muted-foreground overflow-hidden whitespace-nowrap text-ellipsis",children:o.path}),e[18]=o.path,e[19]=d);let y;e[20]!==f||e[21]!==d?(y=(0,r.jsxs)("div",{className:"flex flex-col justify-between flex-1",children:[f,d]}),e[20]=f,e[21]=d,e[22]=y):y=e[22];let x;e[23]===o.path?x=e[24]:(x=(0,r.jsx)("div",{children:(0,r.jsx)(ye,{filePath:o.path})}),e[23]=o.path,e[24]=x);let v;e[25]===Symbol.for("react.memo_cache_sentinel")?(v=(0,r.jsx)(K,{size:20,className:"group-hover:opacity-100 opacity-0 transition-all duration-300 text-primary"}),e[25]=v):v=e[25];let b;e[26]===x?b=e[27]:(b=(0,r.jsxs)("div",{className:"flex gap-3 items-center",children:[x,v]}),e[26]=x,e[27]=b);let g;e[28]!==o.lastModified||e[29]!==s?(g=!!o.lastModified&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground opacity-80",children:ut(o.lastModified*1e3,s)}),e[28]=o.lastModified,e[29]=s,e[30]=g):g=e[30];let j;e[31]!==b||e[32]!==g?(j=(0,r.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[b,g]}),e[31]=b,e[32]=g,e[33]=j):j=e[33];let k;return e[34]!==y||e[35]!==j||e[36]!==m||e[37]!==h||e[38]!==p||e[39]!==l?(k=(0,r.jsxs)("a",{className:m,href:p,target:l,children:[y,j]},h),e[34]=y,e[35]=j,e[36]=m,e[37]=h,e[38]=p,e[39]=l,e[40]=k):k=e[40],k},ye=t=>{let e=(0,W.c)(10),{filePath:o}=t,{openConfirm:s,closeModal:a}=gt(),{shutdownSession:n}=q(),{runningNotebooks:i,setRunningNotebooks:m}=(0,P.use)(te);if(!i.has(o))return null;let h;e[0]!==a||e[1]!==o||e[2]!==s||e[3]!==i||e[4]!==m||e[5]!==n?(h=l=>{l.stopPropagation(),l.preventDefault(),s({title:"Shutdown",description:"This will terminate the Python kernel. You'll lose all data that's in memory.",variant:"destructive",confirmAction:(0,r.jsx)(Re,{onClick:()=>{let c=i.get(o);Ce(c==null?void 0:c.sessionId),n({sessionId:c.sessionId}).then(f=>{m(me.keyBy(f.files,Qt))}),a(),de({description:"Notebook has been shutdown."})},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[0]=a,e[1]=o,e[2]=s,e[3]=i,e[4]=m,e[5]=n,e[6]=h):h=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=(0,r.jsx)(nt,{size:14}),e[7]=p):p=e[7];let u;return e[8]===h?u=e[9]:(u=(0,r.jsx)(Fe,{content:"Shutdown",children:(0,r.jsx)(B,{size:"icon",variant:"outline",className:"opacity-80 hover:opacity-100 hover:bg-accent text-destructive border-destructive hover:border-destructive hover:text-destructive bg-background hover:bg-(--red-1)",onClick:h,children:p})}),e[8]=h,e[9]=u),u},Vt=()=>{let t=(0,W.c)(3),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=pt(),t[0]=e):e=t[0];let o=e,s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Create a new notebook"}),t[1]=s):s=t[1];let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsxs)("a",{className:`relative rounded-lg p-6 group
|
|
1
|
+
import{s as re}from"./chunk-LvLJmgfZ.js";import{d as je,l as oe,n as ae}from"./useEvent-D91BmmQi.js";import{t as be}from"./react-Bj1aDYRI.js";import{Br as ve,Ir as se,Kn as ie,Kr as ke,Nt as we,Rr as Ne,qr as _e,ra as ne}from"./cells-DxL32Atg.js";import"./react-dom-CSu739Rf.js";import{t as le}from"./compiler-runtime-B3qBwwSJ.js";import{_ as ce}from"./useEventListener-B_wSLgFR.js";import{t as Se}from"./objects-BlG0ZrO0.js";import{n as E}from"./constants-CDyU_g2F.js";import{P as Ce}from"./config-Bm5B9wGP.js";import{t as ze}from"./ErrorBoundary-BfMsWVQU.js";import{t as Ie}from"./cn-DYvqRARy.js";import{t as Me}from"./jsx-runtime-Blw4afVn.js";import"./fullscreen-B51geQ_6.js";import{o as Re}from"./alert-dialog-DMh8_LWc.js";import"./popover-DHbixh3D.js";import{a as Pe,c as De,p as Oe,r as Te,t as We}from"./dropdown-menu-BGBlPKNz.js";import{t as Ae}from"./label-DUD3SZnk.js";import{t as Fe}from"./tooltip-BcgbFR7q.js";import{t as B}from"./button-BB1AV4Rb.js";import"./dist-gUHullA_.js";import"./cjs-D5tzp-Y6.js";import"./main-BNL5rxQw.js";import"./useNonce-CbdaHKzX.js";import{r as q}from"./requests-9-v2bhoi.js";import{t as H}from"./createLucideIcon-w-Qo9n0R.js";import{t as Ue}from"./chart-no-axes-column-iDRxid4h.js";import{r as $e}from"./x-C-Eq0ag8.js";import{t as Le}from"./chevron-right-BS_NcSch.js";import{o as me,s as Ee}from"./tree-actions-o2iyMmKN.js";import{t as He}from"./circle-play-9HoTo51X.js";import{t as K}from"./external-link-BOlXZUla.js";import{r as Ve,t as Be}from"./file-icons-NkObNkr_.js";import{t as qe}from"./file-CJH9JNGH.js";import{n as Ye,r as Je,t as Ge}from"./youtube-OwaksuQt.js";import{t as Ke}from"./link-CHdiBDr5.js";import{t as Q}from"./spinner-D-V4psAa.js";import{t as Qe}from"./package-Bxz_8e44.js";import{a as Xe,i as Ze,l as et,n as tt,o as rt,r as ot,s as at,t as st}from"./file-name-input-BQJ9U9lU.js";import{n as it,r as nt,t as lt}from"./app-config-button-EyzXs1Nt.js";import{t as ct}from"./refresh-ccw-sLaKP2vj.js";import{dt as mt,r as dt}from"./input-_AaMXWgD.js";import"./dist-Jbd9zUbK.js";import"./dist-BWXIz8tq.js";import"./dist-DX04AOlt.js";import"./dist-D5nYeU7Q.js";import"./dist-6qzebh8f.js";import{t as de}from"./use-toast-BwJoaaDM.js";import{n as he}from"./paths-BKO-pHK6.js";import{c as pe,n as ht,o as pt,t as ft}from"./session-BtBr2zr3.js";import"./purify.es-CWmnYhGI.js";import{s as ut}from"./dates-BzOh4kS_.js";import{t as xt}from"./context-BFPaAUK_.js";import{n as gt}from"./ImperativeModal-Ci0icDPt.js";import{a as yt}from"./errors-DCPV979Q.js";import{n as jt}from"./react-icons.esm-D4GMDkIf.js";import{t as fe}from"./error-banner-BkIr-0dH.js";import{n as X,t as bt}from"./useAsyncData-Bg5iAViP.js";import{t as Z}from"./icons-NFYKylj6.js";import{t as vt}from"./github-A_zUd4Uj.js";import{n as kt}from"./marimo-icons-yD_pAOm9.js";import{t as wt}from"./links-DBc28bsl.js";import"./Inputs-BmtHnGKp.js";import{t as Nt}from"./useInterval-CjGsg4ie.js";var _t=H("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),St=H("book-text",[["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:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]),Ct=H("graduation-cap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]),zt=H("orbit",[["path",{d:"M20.341 6.484A10 10 0 0 1 10.266 21.85",key:"1enhxb"}],["path",{d:"M3.659 17.516A10 10 0 0 1 13.74 2.152",key:"1crzgf"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}]]),It=H("panels-top-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]),P=re(be(),1),ee=le(),r=re(Me(),1),Mt={intro:["Introduction",_t,"Get started with marimo basics"],dataflow:["Dataflow",_e,"Learn how cells interact with each other"],ui:["UI Elements",It,"Create interactive UI components"],markdown:["Markdown",se,"Format text with parameterized markdown"],plots:["Plots",Ue,"Create interactive visualizations"],sql:["SQL",Ne,"Query databases directly in marimo"],layout:["Layout",Je,"Customize the layout of your cells' output"],fileformat:["File format",qe,"Understand marimo's pure-Python file format"],"external-dependencies":["External dependencies",Qe,"Declare dependencies with Python script metadata"],"for-jupyter-users":["For Jupyter users",zt,"Transiting from Jupyter to marimo"],"markdown-format":["Markdown format",Z,"Using marimo to edit markdown files"]};const Rt=()=>{let t=(0,ee.c)(6),{openTutorial:e}=q(),o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsx)(Ct,{className:"w-4 h-4 mr-2"}),t[0]=o):o=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(Oe,{asChild:!0,children:(0,r.jsxs)(B,{"data-testid":"open-tutorial-button",size:"xs",variant:"outline",children:[o,"Tutorials",(0,r.jsx)(jt,{className:"w-3 h-3 ml-1"})]})}),t[1]=s):s=t[1];let a;t[2]===e?a=t[3]:(a=Se.entries(Mt).map(i=>{let[m,h]=i,[p,u,l]=h;return(0,r.jsxs)(Pe,{onSelect:async()=>{let c=await e({tutorialId:m});c&&wt(c.path)},children:[(0,r.jsx)(u,{strokeWidth:1.5,className:"w-4 h-4 mr-3 self-start mt-1.5 text-muted-foreground"}),(0,r.jsx)("div",{className:"flex items-center",children:(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{children:p}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground pr-1",children:l})]})})]},m)}),t[2]=e,t[3]=a);let n;return t[4]===a?n=t[5]:(n=(0,r.jsxs)(We,{children:[s,(0,r.jsx)(Te,{side:"bottom",align:"end",className:"print:hidden",children:a})]}),t[4]=a,t[5]=n),n};var Pt=[{title:"Documentation",description:"Official marimo documentation and API reference",icon:ke,url:E.docsPage},{title:"GitHub",description:"View source code, report issues, or contribute",icon:vt,url:E.githubPage},{title:"Community",description:"Join the marimo Discord community",icon:Ye,url:E.discordLink},{title:"molab",description:"Run marimo notebooks in the cloud",icon:kt,url:E.molab},{title:"YouTube",description:"Watch tutorials and demos",icon:Ge,url:E.youtube},{title:"Changelog",description:"See what's new in marimo",icon:se,url:E.releasesPage}];const Dt=()=>{let t=(0,ee.c)(2),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,r.jsx)(Y,{Icon:Ke,children:"Resources"}),t[0]=e):e=t[0];let o;return t[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[e,(0,r.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:Pt.map(Ot)})]}),t[1]=o):o=t[1],o},Y=t=>{let e=(0,ee.c)(8),{Icon:o,control:s,children:a}=t,n;e[0]===o?n=e[1]:(n=(0,r.jsx)(o,{className:"h-5 w-5"}),e[0]=o,e[1]=n);let i;e[2]!==a||e[3]!==n?(i=(0,r.jsxs)("h2",{className:"flex items-center gap-2 text-xl font-semibold text-muted-foreground select-none",children:[n,a]}),e[2]=a,e[3]=n,e[4]=i):i=e[4];let m;return e[5]!==s||e[6]!==i?(m=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[i,s]}),e[5]=s,e[6]=i,e[7]=m):m=e[7],m};function Ot(t){return(0,r.jsxs)("a",{href:t.url,target:"_blank",className:"flex items-start gap-3 py-3 px-3 rounded-lg border hover:bg-accent/20 transition-colors shadow-xs",children:[(0,r.jsx)(t.icon,{className:"w-5 h-5 mt-1.5 text-primary"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-medium",children:t.title}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t.description})]})]},t.title)}const te=P.createContext({runningNotebooks:new Map,setRunningNotebooks:ce.NOOP}),J=P.createContext({root:"",refreshWorkspace:ce.NOOP}),Tt=ne("marimo:home:include-markdown",!1,ie,{getOnInit:!0}),ue=ne("marimo:home:expanded-folders",{},ie,{getOnInit:!0});var W=le();function xe(t){return`${ft()}-${encodeURIComponent(t)}`}var Wt=()=>{let t=(0,W.c)(58),[e,o]=(0,P.useState)(0),{getRecentFiles:s,getRunningNotebooks:a}=q(),n;t[0]===s?n=t[1]:(n=()=>s(),t[0]=s,t[1]=n);let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=[],t[2]=i):i=t[2];let m=X(n,i),h,p;t[3]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{o(qt)},p={delayMs:1e4,whenVisible:!0},t[3]=h,t[4]=p):(h=t[3],p=t[4]),Nt(h,p);let u;t[5]===a?u=t[6]:(u=async()=>{let R=await a();return me.keyBy(R.files,Yt)},t[5]=a,t[6]=u);let l;t[7]===e?l=t[8]:(l=[e],t[7]=e,t[8]=l);let c=X(u,l),f,d,y,x,v,b,g,j,k,N,_,D,S;if(t[9]!==m||t[10]!==c){k=Symbol.for("react.early_return_sentinel");e:{let R=bt(m,c);if(R.error)throw R.error;let F=R.data;if(!F){let V;t[24]===Symbol.for("react.memo_cache_sentinel")?(V=(0,r.jsx)(Q,{centered:!0,size:"xlarge"}),t[24]=V):V=t[24],k=V;break e}let[$,L]=F;x=$,y=P.Suspense,d=te,g={runningNotebooks:L,setRunningNotebooks:c.setData};let w,U;t[25]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsx)(Rt,{}),U=(0,r.jsx)(lt,{showAppConfig:!1}),t[25]=w,t[26]=U):(w=t[25],U=t[26]);let G=`This will shutdown the notebook server and terminate all running notebooks (${L.size}). You'll lose all data that's in memory.`;t[27]===G?j=t[28]:(j=(0,r.jsxs)("div",{className:"absolute top-3 right-5 flex gap-3 z-50",children:[w,U,(0,r.jsx)(it,{description:G})]}),t[27]=G,t[28]=j),D="flex flex-col gap-6 max-w-6xl container pt-5 pb-20 z-10",t[29]===Symbol.for("react.memo_cache_sentinel")?(S=(0,r.jsx)("img",{src:"logo.png",alt:"marimo logo",className:"w-48 mb-2"}),v=(0,r.jsx)(Vt,{}),b=(0,r.jsx)(Dt,{}),t[29]=v,t[30]=b,t[31]=S):(v=t[29],b=t[30],S=t[31]),f=ge,t[32]===Symbol.for("react.memo_cache_sentinel")?(N=(0,r.jsx)(Y,{Icon:He,children:"Running notebooks"}),t[32]=N):N=t[32],_=[...L.values()]}t[9]=m,t[10]=c,t[11]=f,t[12]=d,t[13]=y,t[14]=x,t[15]=v,t[16]=b,t[17]=g,t[18]=j,t[19]=k,t[20]=N,t[21]=_,t[22]=D,t[23]=S}else f=t[11],d=t[12],y=t[13],x=t[14],v=t[15],b=t[16],g=t[17],j=t[18],k=t[19],N=t[20],_=t[21],D=t[22],S=t[23];if(k!==Symbol.for("react.early_return_sentinel"))return k;let C;t[33]!==f||t[34]!==N||t[35]!==_?(C=(0,r.jsx)(f,{header:N,files:_}),t[33]=f,t[34]=N,t[35]=_,t[36]=C):C=t[36];let A;t[37]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(Y,{Icon:ve,children:"Recent notebooks"}),t[37]=A):A=t[37];let z;t[38]===x.files?z=t[39]:(z=(0,r.jsx)(ge,{header:A,files:x.files}),t[38]=x.files,t[39]=z);let I;t[40]===m.refetch?I=t[41]:(I=(0,r.jsx)(ze,{children:(0,r.jsx)(At,{onRefreshRecents:m.refetch})}),t[40]=m.refetch,t[41]=I);let O;t[42]!==v||t[43]!==b||t[44]!==C||t[45]!==z||t[46]!==I||t[47]!==D||t[48]!==S?(O=(0,r.jsxs)("div",{className:D,children:[S,v,b,C,z,I]}),t[42]=v,t[43]=b,t[44]=C,t[45]=z,t[46]=I,t[47]=D,t[48]=S,t[49]=O):O=t[49];let M;t[50]!==d||t[51]!==g||t[52]!==j||t[53]!==O?(M=(0,r.jsxs)(d,{value:g,children:[j,O]}),t[50]=d,t[51]=g,t[52]=j,t[53]=O,t[54]=M):M=t[54];let T;return t[55]!==y||t[56]!==M?(T=(0,r.jsx)(y,{children:M}),t[55]=y,t[56]=M,t[57]=T):T=t[57],T},At=t=>{let e=(0,W.c)(54),{onRefreshRecents:o}=t,{getWorkspaceFiles:s}=q(),[a,n]=oe(Tt),[i,m]=(0,P.useState)(""),h;e[0]!==s||e[1]!==a?(h=()=>s({includeMarkdown:a}),e[0]=s,e[1]=a,e[2]=h):h=e[2];let p;e[3]===a?p=e[4]:(p=[a],e[3]=a,e[4]=p);let{isPending:u,data:l,error:c,isFetching:f,refetch:d}=X(h,p),y;e[5]!==o||e[6]!==d?(y=()=>{d(),o()},e[5]=o,e[6]=d,e[7]=y):y=e[7];let x=ae(y);l==null||l.root;let v=(l==null?void 0:l.root)??"",b;e[8]!==x||e[9]!==v?(b={root:v,refreshWorkspace:x},e[8]=x,e[9]=v,e[10]=b):b=e[10];let g=b;if(u){let w;return e[11]===Symbol.for("react.memo_cache_sentinel")?(w=(0,r.jsx)(Q,{centered:!0,size:"xlarge",className:"mt-6"}),e[11]=w):w=e[11],w}if(c){let w;e[12]===c?w=e[13]:(w=yt(c),e[12]=c,e[13]=w);let U;return e[14]===w?U=e[15]:(U=(0,r.jsx)(fe,{kind:"danger",className:"rounded p-4",children:w}),e[14]=w,e[15]=U),U}let j;e[16]!==l.fileCount||e[17]!==l.hasMore?(j=l.hasMore&&(0,r.jsxs)(fe,{kind:"warn",className:"rounded p-4",children:["Showing first ",l.fileCount," files. Your workspace has more files."]}),e[16]=l.fileCount,e[17]=l.hasMore,e[18]=j):j=e[18];let k,N;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=(0,r.jsx)(mt,{size:13}),N=w=>m(w.target.value),e[19]=k,e[20]=N):(k=e[19],N=e[20]);let _;e[21]===i?_=e[22]:(_=(0,r.jsx)(dt,{id:"search",value:i,icon:k,onChange:N,placeholder:"Search",className:"mb-0 border-border"}),e[21]=i,e[22]=_);let D;e[23]===Symbol.for("react.memo_cache_sentinel")?(D=(0,r.jsx)(Ft,{}),e[23]=D):D=e[23];let S;e[24]===n?S=e[25]:(S=w=>n(!!w),e[24]=n,e[25]=S);let C;e[26]!==a||e[27]!==S?(C=(0,r.jsx)(we,{"data-testid":"include-markdown-checkbox",id:"include-markdown",checked:a,onCheckedChange:S}),e[26]=a,e[27]=S,e[28]=C):C=e[28];let A;e[29]===Symbol.for("react.memo_cache_sentinel")?(A=(0,r.jsx)(Ae,{htmlFor:"include-markdown",children:"Include markdown"}),e[29]=A):A=e[29];let z;e[30]!==C||e[31]!==_?(z=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[_,D,C,A]}),e[30]=C,e[31]=_,e[32]=z):z=e[32];let I;e[33]===d?I=e[34]:(I=()=>d(),e[33]=d,e[34]=I);let O;e[35]===Symbol.for("react.memo_cache_sentinel")?(O=(0,r.jsx)(ct,{className:"w-4 h-4"}),e[35]=O):O=e[35];let M;e[36]===I?M=e[37]:(M=(0,r.jsx)(B,{variant:"text",size:"icon",className:"w-4 h-4 ml-1 p-0 opacity-70 hover:opacity-100",onClick:I,"aria-label":"Refresh workspace",children:O}),e[36]=I,e[37]=M);let T;e[38]===f?T=e[39]:(T=f&&(0,r.jsx)(Q,{size:"small"}),e[38]=f,e[39]=T);let R;e[40]!==z||e[41]!==M||e[42]!==T?(R=(0,r.jsxs)(Y,{Icon:St,control:z,children:["Workspace",M,T]}),e[40]=z,e[41]=M,e[42]=T,e[43]=R):R=e[43];let F;e[44]!==i||e[45]!==l.files?(F=(0,r.jsx)("div",{className:"flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background",children:(0,r.jsx)(Ut,{searchText:i,files:l.files})}),e[44]=i,e[45]=l.files,e[46]=F):F=e[46];let $;e[47]!==R||e[48]!==F||e[49]!==j?($=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[j,R,F]}),e[47]=R,e[48]=F,e[49]=j,e[50]=$):$=e[50];let L;return e[51]!==$||e[52]!==g?(L=(0,r.jsx)(J,{value:g,children:$}),e[51]=$,e[52]=g,e[53]=L):L=e[53],L},Ft=()=>{let t=(0,W.c)(5),e=je(ue),o;t[0]===e?o=t[1]:(o=()=>{e({})},t[0]=e,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)(Ee,{className:"w-4 h-4 mr-1"}),t[2]=s):s=t[2];let a;return t[3]===o?a=t[4]:(a=(0,r.jsxs)(B,{variant:"text",size:"sm",className:"h-fit hidden sm:flex",onClick:o,children:[s,"Collapse all"]}),t[3]=o,t[4]=a),a},Ut=t=>{let e=(0,W.c)(20),{files:o,searchText:s}=t,[a,n]=oe(ue),i=Object.keys(a).length===0,m=(0,P.useRef)(void 0),{root:h,refreshWorkspace:p}=(0,P.use)(J),u;e[0]===h?u=e[1]:(u={root:h},e[0]=h,e[1]=u);let{renameFile:l}=rt(u),c,f;e[2]===i?(c=e[3],f=e[4]):(c=()=>{var g;i&&((g=m.current)==null||g.closeAll())},f=[i],e[2]=i,e[3]=c,e[4]=f),(0,P.useEffect)(c,f);let d;e[5]!==p||e[6]!==l?(d=async(g,j)=>{var N;let k=(N=m.current)==null?void 0:N.get(g);if(!k){de({title:"Failed",description:`Node with id ${g} not found in the tree`});return}await l(k.data,j)&&p()},e[5]=p,e[6]=l,e[7]=d):d=e[7];let y=ae(d);if(o.length===0){let g;return e[8]===Symbol.for("react.memo_cache_sentinel")?(g=(0,r.jsx)("div",{className:"flex flex-col px-5 py-10 items-center justify-center",children:(0,r.jsx)("p",{className:"text-center text-muted-foreground",children:"No files in this workspace"})}),e[8]=g):g=e[8],g}let x;e[9]!==a||e[10]!==n?(x=async g=>{let j=a[g]??!1;n({...a,[g]:!j})},e[9]=a,e[10]=n,e[11]=x):x=e[11];let v;e[12]===y?v=e[13]:(v=async g=>{let{id:j,name:k}=g;await y(j,k)},e[12]=y,e[13]=v);let b;return e[14]!==o||e[15]!==a||e[16]!==s||e[17]!==x||e[18]!==v?(b=(0,r.jsx)(et,{ref:m,width:"100%",height:500,searchTerm:s,className:"h-full",idAccessor:Jt,data:o,openByDefault:!1,initialOpenState:a,onToggle:x,onRename:v,padding:5,rowHeight:35,indent:15,overscanCount:1e3,renderCursor:Gt,disableDrop:!0,disableDrag:!0,disableMultiSelection:!0,children:$t}),e[14]=o,e[15]=a,e[16]=s,e[17]=x,e[18]=v,e[19]=b):b=e[19],b},$t=t=>{let e=(0,W.c)(18),{node:o,style:s}=t,a=Be[o.data.isDirectory?"directory":Ve(o.data.name)],n;e[0]===a?n=e[1]:(n=(0,r.jsx)(a,{className:"w-5 h-5 shrink-0",strokeWidth:1.5}),e[0]=a,e[1]=n);let i=n,{root:m}=(0,P.use)(J),{runningNotebooks:h}=(0,P.use)(te),p;e[2]!==i||e[3]!==o||e[4]!==m||e[5]!==h?(p=()=>{if(o.isEditing)return(0,r.jsxs)("div",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",children:[i,(0,r.jsx)(st,{node:o})]});if(o.data.isDirectory)return(0,r.jsxs)("span",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",children:[i,o.data.name]});let x=o.data.path.startsWith(m)&&he.isAbsolute(o.data.path)?he.rest(o.data.path,m):o.data.path,v=x.endsWith(".md")||x.endsWith(".qmd"),b=h.has(x);return(0,r.jsxs)("a",{className:"flex items-center pl-1 cursor-pointer hover:bg-accent/50 hover:text-accent-foreground rounded-l flex-1 overflow-hidden h-full pr-3 gap-2",href:pe(`?file=${encodeURIComponent(x)}`).toString(),target:xe(x),children:[i,(0,r.jsxs)("span",{className:"flex-1 overflow-hidden text-ellipsis",children:[o.data.name,v&&(0,r.jsx)(Z,{className:"ml-2 inline opacity-80"})]}),(0,r.jsx)(Lt,{node:o,isRunning:b}),(0,r.jsx)("div",{className:"w-8 h-8 flex items-center justify-center shrink-0",children:(0,r.jsx)(ye,{filePath:x})}),(0,r.jsx)(K,{size:20,className:"group-hover:opacity-100 opacity-0 text-primary shrink-0"})]})},e[2]=i,e[3]=o,e[4]=m,e[5]=h,e[6]=p):p=e[6];let u=p,l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=Ie("flex items-center cursor-pointer ml-1 text-muted-foreground whitespace-nowrap group h-full"),e[7]=l):l=e[7];let c,f;e[8]===o?(c=e[9],f=e[10]):(c=x=>{x.stopPropagation(),o.data.isDirectory&&o.toggle()},f=(0,r.jsx)(Et,{node:o}),e[8]=o,e[9]=c,e[10]=f);let d;e[11]===u?d=e[12]:(d=u(),e[11]=u,e[12]=d);let y;return e[13]!==s||e[14]!==c||e[15]!==f||e[16]!==d?(y=(0,r.jsxs)("div",{style:s,className:l,onClick:c,children:[f,d]}),e[13]=s,e[14]=c,e[15]=f,e[16]=d,e[17]=y):y=e[17],y},Lt=t=>{let e=(0,W.c)(19),{node:o,isRunning:s}=t,{root:a,refreshWorkspace:n}=(0,P.use)(J),i;e[0]!==o||e[1]!==n||e[2]!==a?(i={node:o,root:a,onAfterChange:n},e[0]=o,e[1]=n,e[2]=a,e[3]=i):i=e[3];let{handleRename:m,handleDuplicate:h,handleDelete:p}=at(i),u=s?"Stop the notebook's kernel before renaming or deleting.":void 0,l;e[4]!==m||e[5]!==s||e[6]!==u?(l=(0,r.jsx)(Xe,{onSelect:m,disabled:s,title:u}),e[4]=m,e[5]=s,e[6]=u,e[7]=l):l=e[7];let c;e[8]===h?c=e[9]:(c=(0,r.jsx)(ot,{onSelect:h}),e[8]=h,e[9]=c);let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=(0,r.jsx)(De,{}),e[10]=f):f=e[10];let d;e[11]!==p||e[12]!==s||e[13]!==u?(d=(0,r.jsx)(tt,{onSelect:p,disabled:s,title:u}),e[11]=p,e[12]=s,e[13]=u,e[14]=d):d=e[14];let y;return e[15]!==l||e[16]!==c||e[17]!==d?(y=(0,r.jsxs)(Ze,{testId:"workspace-more-button",buttonClassName:"w-8 h-8 p-0 shrink-0",contentClassName:"print:hidden w-fit min-w-[140px]",preventDefaultOnTrigger:!0,children:[l,c,f,d]}),e[15]=l,e[16]=c,e[17]=d,e[18]=y):y=e[18],y},Et=t=>{let e=(0,W.c)(3),{node:o}=t;if(!o.data.isDirectory){let a;return e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsx)("span",{className:"w-5 h-5 shrink-0"}),e[0]=a):a=e[0],a}let s;return e[1]===o.isOpen?s=e[2]:(s=o.isOpen?(0,r.jsx)($e,{className:"w-5 h-5 shrink-0"}):(0,r.jsx)(Le,{className:"w-5 h-5 shrink-0"}),e[1]=o.isOpen,e[2]=s),s},ge=t=>{let e=(0,W.c)(7),{header:o,files:s}=t;if(s.length===0)return null;let a;e[0]===s?a=e[1]:(a=s.map(Kt),e[0]=s,e[1]=a);let n;e[2]===a?n=e[3]:(n=(0,r.jsx)("div",{className:"flex flex-col divide-y divide-(--slate-3) border rounded overflow-hidden max-h-192 overflow-y-auto shadow-sm bg-background",children:a}),e[2]=a,e[3]=n);let i;return e[4]!==o||e[5]!==n?(i=(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[o,n]}),e[4]=o,e[5]=n,e[6]=i):i=e[6],i},Ht=t=>{let e=(0,W.c)(41),{file:o}=t,{locale:s}=xt(),a;e[0]===o.path?a=e[1]:(a=ht(o.path),e[0]=o.path,e[1]=a);let n=a,i,m,h,p;if(e[2]!==o.initializationId||e[3]!==o.path||e[4]!==n){let N=pe(n?`?file=${encodeURIComponent(o.initializationId??o.path)}&session_id=${o.path}`:`?file=${encodeURIComponent(o.path)}`),_;e[9]===o.path?_=e[10]:(_=o.path.endsWith(".md"),e[9]=o.path,e[10]=_),i=_,m="py-1.5 px-4 hover:bg-(--blue-2) hover:text-primary transition-all duration-300 cursor-pointer group relative flex gap-4 items-center",h=o.path,p=N.toString(),e[2]=o.initializationId,e[3]=o.path,e[4]=n,e[5]=i,e[6]=m,e[7]=h,e[8]=p}else i=e[5],m=e[6],h=e[7],p=e[8];let u=o.initializationId||o.path,l;e[11]===u?l=e[12]:(l=xe(u),e[11]=u,e[12]=l);let c;e[13]===i?c=e[14]:(c=i&&(0,r.jsx)("span",{className:"opacity-80",children:(0,r.jsx)(Z,{})}),e[13]=i,e[14]=c);let f;e[15]!==o.name||e[16]!==c?(f=(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[o.name,c]}),e[15]=o.name,e[16]=c,e[17]=f):f=e[17];let d;e[18]===o.path?d=e[19]:(d=(0,r.jsx)("p",{title:o.path,className:"text-sm text-muted-foreground overflow-hidden whitespace-nowrap text-ellipsis",children:o.path}),e[18]=o.path,e[19]=d);let y;e[20]!==f||e[21]!==d?(y=(0,r.jsxs)("div",{className:"flex flex-col justify-between flex-1",children:[f,d]}),e[20]=f,e[21]=d,e[22]=y):y=e[22];let x;e[23]===o.path?x=e[24]:(x=(0,r.jsx)("div",{children:(0,r.jsx)(ye,{filePath:o.path})}),e[23]=o.path,e[24]=x);let v;e[25]===Symbol.for("react.memo_cache_sentinel")?(v=(0,r.jsx)(K,{size:20,className:"group-hover:opacity-100 opacity-0 transition-all duration-300 text-primary"}),e[25]=v):v=e[25];let b;e[26]===x?b=e[27]:(b=(0,r.jsxs)("div",{className:"flex gap-3 items-center",children:[x,v]}),e[26]=x,e[27]=b);let g;e[28]!==o.lastModified||e[29]!==s?(g=!!o.lastModified&&(0,r.jsx)("div",{className:"text-xs text-muted-foreground opacity-80",children:ut(o.lastModified*1e3,s)}),e[28]=o.lastModified,e[29]=s,e[30]=g):g=e[30];let j;e[31]!==b||e[32]!==g?(j=(0,r.jsxs)("div",{className:"flex flex-col gap-1 items-end",children:[b,g]}),e[31]=b,e[32]=g,e[33]=j):j=e[33];let k;return e[34]!==y||e[35]!==j||e[36]!==m||e[37]!==h||e[38]!==p||e[39]!==l?(k=(0,r.jsxs)("a",{className:m,href:p,target:l,children:[y,j]},h),e[34]=y,e[35]=j,e[36]=m,e[37]=h,e[38]=p,e[39]=l,e[40]=k):k=e[40],k},ye=t=>{let e=(0,W.c)(10),{filePath:o}=t,{openConfirm:s,closeModal:a}=gt(),{shutdownSession:n}=q(),{runningNotebooks:i,setRunningNotebooks:m}=(0,P.use)(te);if(!i.has(o))return null;let h;e[0]!==a||e[1]!==o||e[2]!==s||e[3]!==i||e[4]!==m||e[5]!==n?(h=l=>{l.stopPropagation(),l.preventDefault(),s({title:"Shutdown",description:"This will terminate the Python kernel. You'll lose all data that's in memory.",variant:"destructive",confirmAction:(0,r.jsx)(Re,{onClick:()=>{let c=i.get(o);Ce(c==null?void 0:c.sessionId),n({sessionId:c.sessionId}).then(f=>{m(me.keyBy(f.files,Qt))}),a(),de({description:"Notebook has been shutdown."})},"aria-label":"Confirm Shutdown",children:"Shutdown"})})},e[0]=a,e[1]=o,e[2]=s,e[3]=i,e[4]=m,e[5]=n,e[6]=h):h=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=(0,r.jsx)(nt,{size:14}),e[7]=p):p=e[7];let u;return e[8]===h?u=e[9]:(u=(0,r.jsx)(Fe,{content:"Shutdown",children:(0,r.jsx)(B,{size:"icon",variant:"outline",className:"opacity-80 hover:opacity-100 hover:bg-accent text-destructive border-destructive hover:border-destructive hover:text-destructive bg-background hover:bg-(--red-1)",onClick:h,children:p})}),e[8]=h,e[9]=u),u},Vt=()=>{let t=(0,W.c)(3),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=pt(),t[0]=e):e=t[0];let o=e,s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=(0,r.jsx)("h2",{className:"text-lg font-semibold",children:"Create a new notebook"}),t[1]=s):s=t[1];let a;return t[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,r.jsxs)("a",{className:`relative rounded-lg p-6 group
|
|
2
2
|
text-primary hover:bg-(--blue-2) shadow-md-solid shadow-accent border bg-(--blue-1)
|
|
3
3
|
transition-all duration-300 cursor-pointer
|
|
4
4
|
`,href:o,target:"_blank",rel:"noreferrer",children:[s,(0,r.jsx)("div",{className:"group-hover:opacity-100 opacity-0 absolute right-5 top-0 bottom-0 rounded-lg flex items-center justify-center transition-all duration-300",children:(0,r.jsx)(K,{size:24})})]}),t[2]=a):a=t[2],a},Bt=Wt;function qt(t){return t+1}function Yt(t){return t.path}function Jt(t){return t.path}function Gt(){return null}function Kt(t){return(0,r.jsx)(Ht,{file:t},t.path)}function Qt(t){return t.path}export{Bt as default};
|