@marimo-team/frontend 0.23.2-dev25 → 0.23.2-dev6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/assets/{CellStatus-zTcdYfqx.js → CellStatus-Bwtcvgko.js} +1 -1
  2. package/dist/assets/{JsonOutput-CavtrueA.js → JsonOutput-ZBMYDZ3q.js} +1 -1
  3. package/dist/assets/{MarimoErrorOutput-Bmp8DLLo.js → MarimoErrorOutput-DLREr23s.js} +1 -1
  4. package/dist/assets/{RenderHTML-CM3WMmA8.js → RenderHTML-5FjN3OZH.js} +1 -1
  5. package/dist/assets/{add-cell-with-ai-_Y6SqxBB.js → add-cell-with-ai-DbPkyXyg.js} +1 -1
  6. package/dist/assets/{add-connection-dialog-BGZvJkor.js → add-connection-dialog-sNnLlFNN.js} +1 -1
  7. package/dist/assets/{agent-panel-BvL9Lu9c.js → agent-panel-DMb4Q9pS.js} +1 -1
  8. package/dist/assets/{ai-model-dropdown-Dyxi3_nW.js → ai-model-dropdown-CZB8Xt_D.js} +1 -1
  9. package/dist/assets/{app-config-button-BT2Do4RJ.js → app-config-button-b2p8_NdZ.js} +1 -1
  10. package/dist/assets/{cell-editor-B40o_zx_.js → cell-editor-BhmiBBOV.js} +1 -1
  11. package/dist/assets/{cell-link-CRkrHl-y.js → cell-link-DMyOfytV.js} +1 -1
  12. package/dist/assets/{cells-BqYYXi6G.js → cells-CAft_y9h.js} +56 -56
  13. package/dist/assets/{chat-display-M_nvYuHH.js → chat-display-CnlcyHaA.js} +1 -1
  14. package/dist/assets/{chat-panel-BMOW93uQ.js → chat-panel-DujR1b5z.js} +1 -1
  15. package/dist/assets/{chat-ui-DyeimpVh.js → chat-ui-D-qk0TXi.js} +1 -1
  16. package/dist/assets/{column-preview-AfcgbFG_.js → column-preview-D2B6qQUU.js} +1 -1
  17. package/dist/assets/{command-palette-BgvdyU3B.js → command-palette-eS5sJOYR.js} +1 -1
  18. package/dist/assets/{common-DeoGL9rK.js → common-BK4i6reD.js} +1 -1
  19. package/dist/assets/{components-CDgxb-5o.js → components-CviIANwr.js} +1 -1
  20. package/dist/assets/{components-DKHyHZBv.js → components-Dta3XEEY.js} +1 -1
  21. package/dist/assets/{datasource-COFRe84u.js → datasource-C1kSlT4s.js} +1 -1
  22. package/dist/assets/{dependency-graph-panel-BXSe6z1R.js → dependency-graph-panel-CMZnqwyn.js} +1 -1
  23. package/dist/assets/{documentation-panel-DUPcsi8P.js → documentation-panel-D9WN55Gq.js} +1 -1
  24. package/dist/assets/{download-5XbM3TL_.js → download-COyB8G-Y.js} +1 -1
  25. package/dist/assets/{edit-page-DD4uEDmX.js → edit-page-DlRqSgY9.js} +3 -3
  26. package/dist/assets/{error-panel-DQOeSv5-.js → error-panel-5I4mWGfs.js} +1 -1
  27. package/dist/assets/{file-explorer-panel-B67zjs2X.js → file-explorer-panel-B86r63YC.js} +1 -1
  28. package/dist/assets/{file-icons-Bj5YoM7H.js → file-icons-CRsc39Ny.js} +1 -1
  29. package/dist/assets/{floating-outline-XObNWtN8.js → floating-outline-Cj9Gdjkf.js} +1 -1
  30. package/dist/assets/{focus-DzMo6UAI.js → focus-BtOH5aLt.js} +1 -1
  31. package/dist/assets/{form-BJ6VFU8l.js → form-Dd-gRdD5.js} +1 -1
  32. package/dist/assets/{home-page-BUdd5uTz.js → home-page-B320ImBG.js} +1 -1
  33. package/dist/assets/{hooks-DvwShzDb.js → hooks-B5RY2sms.js} +1 -1
  34. package/dist/assets/{html-to-image-DGqJ93hW.js → html-to-image-WCAzCguU.js} +1 -1
  35. package/dist/assets/{index-y6osgSWB.js → index-BjVgEJVi.js} +18 -18
  36. package/dist/assets/{kiosk-mode-DYHoqMaZ.js → kiosk-mode-CJ7p0kAg.js} +1 -1
  37. package/dist/assets/{layout-erv8pLIP.js → layout-CnhRBcnG.js} +1 -1
  38. package/dist/assets/{logs-panel-CRW4c2IL.js → logs-panel-DG3RlQaY.js} +1 -1
  39. package/dist/assets/{markdown-renderer-DNANigO8.js → markdown-renderer-BDdzHOwK.js} +1 -1
  40. package/dist/assets/{name-cell-input-3iKP6YTw.js → name-cell-input-68gHDuvg.js} +1 -1
  41. package/dist/assets/{outline-panel-VIqWcHj6.js → outline-panel-Dr0105mz.js} +1 -1
  42. package/dist/assets/{packages-panel-D_z4ylBE.js → packages-panel-CZHZDUXZ.js} +1 -1
  43. package/dist/assets/{panels-1u-RE72f.js → panels-DkMIu1eO.js} +1 -1
  44. package/dist/assets/{process-output-Q6wVr7a-.js → process-output-CGSREMph.js} +1 -1
  45. package/dist/assets/{readonly-python-code-CI_b818F.js → readonly-python-code-3lQBDicq.js} +1 -1
  46. package/dist/assets/{run-page-DfWH_1mz.js → run-page-DX60GJ1i.js} +1 -1
  47. package/dist/assets/{scratchpad-panel-CnaiXtoJ.js → scratchpad-panel-DxI-sH1n.js} +1 -1
  48. package/dist/assets/{session-panel-C68GBFwH.js → session-panel-DxZNtbiE.js} +1 -1
  49. package/dist/assets/{snippets-panel-BmIdR0lc.js → snippets-panel-CFXjJW29.js} +1 -1
  50. package/dist/assets/{state-D1n-olwf.js → state-BFn0AerH.js} +1 -1
  51. package/dist/assets/{state-DPomuurt.js → state-CDUQVvOe.js} +1 -1
  52. package/dist/assets/{textarea-CS2o3y4W.js → textarea-CWy4stSy.js} +1 -1
  53. package/dist/assets/{tracing-CPDDwzIA.js → tracing-CIygWG5q.js} +1 -1
  54. package/dist/assets/{tracing-panel-Ku1LapXJ.js → tracing-panel-Dk7FE-7H.js} +2 -2
  55. package/dist/assets/{useAddCell-B6yUY_RG.js → useAddCell-BZ5oFC7U.js} +1 -1
  56. package/dist/assets/{useCellActionButton-SxeK4dmW.js → useCellActionButton-Dd3hgOb6.js} +1 -1
  57. package/dist/assets/{useDeleteCell-DHUjJQJx.js → useDeleteCell-BHcPGuXL.js} +1 -1
  58. package/dist/assets/{useDependencyPanelTab-CflgayoH.js → useDependencyPanelTab-B94SJnJl.js} +1 -1
  59. package/dist/assets/{useNotebookActions-Ch1o32Jw.js → useNotebookActions-PmHNCN16.js} +1 -1
  60. package/dist/assets/{useRunCells-DFYAOTWd.js → useRunCells-BJn5ZEb6.js} +1 -1
  61. package/dist/assets/{useSplitCell-Bh-NZsBl.js → useSplitCell-Bfb8riCm.js} +1 -1
  62. package/dist/index.html +22 -22
  63. package/package.json +1 -1
  64. package/src/components/editor/Output.tsx +1 -1
  65. package/src/core/codemirror/language/languages/python.ts +9 -9
  66. package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +8 -1
  67. package/src/core/codemirror/lsp/federated-lsp.ts +2 -2
  68. package/src/core/codemirror/lsp/notebook-lsp.ts +2 -2
  69. package/src/core/codemirror/lsp/utils.ts +21 -6
  70. package/src/plugins/impl/plotly/__tests__/PlotlyPlugin.test.tsx +50 -0
  71. package/src/plugins/impl/plotly/__tests__/selection.test.ts +82 -0
  72. package/src/plugins/impl/plotly/selection.ts +62 -3
@@ -1 +1 @@
1
- import{s as ze}from"./chunk-LvLJmgfZ.js";import{d as $,l as ct,p as ht,u as me}from"./useEvent-D91BmmQi.js";import{t as mt}from"./react-Bj1aDYRI.js";import{E as Me,En as pt,Jt as ut,Rr as ft,Ti as pe,Tn as xt,_ as yt,cr as kt,ct as We,h as _e,kn as bt,ot as wt,pr as jt,st as gt,t as vt,ur as Ct,vr as zt,wn as Mt}from"./cells-BqYYXi6G.js";import{t as N}from"./compiler-runtime-B3qBwwSJ.js";import{n as Wt,x as _t}from"./ai-model-dropdown-Dyxi3_nW.js";import{_ as H,d as Ne}from"./useEventListener-DGjKht0c.js";import{y as Nt}from"./utils-8btzWeZg.js";import{n as L,t as Se}from"./constants-tOPFFcLZ.js";import{S as ue,h as St,n as Dt,o as At,x as Pt}from"./config-DoZCLcOb.js";import{n as It}from"./switch-YkPg_CVc.js";import{t as Et}from"./jsx-runtime-Blw4afVn.js";import{o as Lt}from"./alert-dialog-C2mTH3GM.js";import{a as Tt,c as fe,o as xe,s as Rt}from"./popover-AtoFZ7i4.js";import{a as $t,c as Ht,i as qt,n as Bt,r as Ot,s as Ut,t as Vt}from"./select-BwwUWhww.js";import{gt as Ft}from"./JsonOutput-CavtrueA.js";import{c as De,d as ye,n as Yt,o as Kt,r as ke,t as Gt}from"./download-5XbM3TL_.js";import{m as Jt}from"./form-BJ6VFU8l.js";import{t as Ae}from"./tooltip-DmqhBBs6.js";import{r as Pe,t as q}from"./button-COIw2x9i.js";import{i as Zt,r as Qt,t as Ie}from"./strings-pfr2N700.js";import{r as B}from"./requests-9-v2bhoi.js";import{t as b}from"./createLucideIcon-w-Qo9n0R.js";import{A as Ee,a as Le,i as Te,j as Xt,k as ea,u as Re}from"./layout-erv8pLIP.js";import{t as be}from"./check-B-sKate2.js";import{n as ta}from"./maps-B4xARV9R.js";import{r as aa}from"./useCellActionButton-SxeK4dmW.js";import{t as $e}from"./copy-DFMsQ6MJ.js";import{t as oa}from"./eye-off-DgRJ-xBZ.js";import{t as ae}from"./file-l37OnSN4.js";import{t as na}from"./github-C3N4cuN4.js";import{n as sa,r as la,t as ia}from"./youtube-D6LtMx2w.js";import{i as ra,n as He}from"./add-connection-dialog-BGZvJkor.js";import{n as da,t as ca}from"./square-COtNnHUC.js";import{t as ha}from"./image-BgkzrnsX.js";import{t as ma}from"./link-dU_vDDSR.js";import{r as pa}from"./input-DNCT6U6R.js";import{t as ua}from"./settings-C1bg8A2T.js";import{t as fa}from"./sparkles-B79Qf6ma.js";import{y as xa}from"./textarea-CS2o3y4W.js";import{t as S}from"./use-toast-BDYuj3zG.js";import{n as qe,t as ya}from"./paths-BzSgteR-.js";import{o as ka}from"./session-DdnWW30b.js";import{n as O}from"./copy-Bizk-4hH.js";import{r as ba}from"./useRunCells-DFYAOTWd.js";import{a as Be,c as Oe,i as Ue,n as Ve,r as Fe}from"./dialog-H-hXtEOq.js";import{n as we}from"./ImperativeModal-hsPVDTG-.js";import{r as wa,t as ja}from"./share-0LPgOyiW.js";import{a as ga}from"./cell-link-CRkrHl-y.js";import{a as va}from"./renderShortcut-DrDh2657.js";import{t as Ca}from"./icons-DlzgV4KY.js";import{n as za}from"./marimo-icons-Dp8wmdDL.js";import{t as Ma}from"./links-C19POYUQ.js";import{r as Wa,t as Ye}from"./hooks-DvwShzDb.js";import{t as Ke}from"./types-DOdUT9LT.js";var _a=b("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Na=b("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ge=b("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Je=b("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ze=b("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Sa=b("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),Da=b("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Aa=b("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Qe=b("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),Pa=b("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),Ia=b("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Ea=b("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Xe=b("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),La=b("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Ta=b("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),et=b("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),je=N(),D=ze(mt(),1),a=ze(Et(),1);function Ra(){return"uvx marimo@latest"}function $a(t,e,n){let o=n?" --with-token":"",s=`${Ra()} pair prompt --url '${e}'${o}`;switch(t){case"claude":return`claude "$(${s} --claude)"`;case"codex":return`codex "$(${s} --codex)"`;case"opencode":return`opencode "$(${s} --opencode)"`;default:Qt(t)}}function Ha(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var qa="npx skills add marimo-team/marimo-pair";function Ba(){let t=(0,je.c)(2),[e,n]=(0,D.useState)(null),o,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{fetch(Dt("/auth/token").href,{headers:It.headers()}).then(Oa).then(r=>n((r==null?void 0:r.token)??null)).catch(()=>n(null))},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,D.useEffect)(o,s),e}function Oa(t){return t.ok?t.json():null}const Ua=t=>{let e=(0,je.c)(32),{onClose:n}=t,[o,s]=(0,D.useState)("claude"),r=At(),i=Ba(),l=!!i,d;e[0]!==o||e[1]!==l||e[2]!==r.httpURL?(d=$a(o,r.httpURL.toString(),l),e[0]=o,e[1]=l,e[2]=r.httpURL,e[3]=d):d=e[3];let c=d,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(Oe,{children:"Pair with an agent"}),e[4]=m):m=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(Be,{children:[m,(0,a.jsxs)(Fe,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,a.jsx)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Learn more"}),"."]})]}),e[5]=p):p=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"1. Install the skill"}),(0,a.jsx)(U,{command:qa})]}),e[6]=h):h=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)("span",{className:"text-sm font-medium",children:"2. Run in your terminal"}),e[7]=u):u=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=_=>s(_),e[8]=x):x=e[8];let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Rt,{className:"w-full",children:[(0,a.jsx)(fe,{value:"claude",className:"flex-1",children:"Claude"}),(0,a.jsx)(fe,{value:"codex",className:"flex-1",children:"Codex"}),(0,a.jsx)(fe,{value:"opencode",className:"flex-1",children:"OpenCode"})]}),e[9]=w):w=e[9];let y;e[10]===c?y=e[11]:(y=(0,a.jsx)(xe,{value:"claude",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[10]=c,e[11]=y);let k;e[12]===c?k=e[13]:(k=(0,a.jsx)(xe,{value:"codex",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[12]=c,e[13]=k);let j;e[14]===c?j=e[15]:(j=(0,a.jsx)(xe,{value:"opencode",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[14]=c,e[15]=j);let g;e[16]!==o||e[17]!==j||e[18]!==y||e[19]!==k?(g=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[u,(0,a.jsxs)(Tt,{value:o,onValueChange:x,children:[w,y,k,j]})]}),e[16]=o,e[17]=j,e[18]=y,e[19]=k,e[20]=g):g=e[20];let z;e[21]!==i||e[22]!==l?(z=l&&i&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"3. Paste when prompted for token"}),(0,a.jsx)(U,{command:i,display:Ha(i)})]}),e[21]=i,e[22]=l,e[23]=z):z=e[23];let v;e[24]!==g||e[25]!==z?(v=(0,a.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[h,g,z]}),e[24]=g,e[25]=z,e[26]=v):v=e[26];let M;e[27]===n?M=e[28]:(M=(0,a.jsx)(Ue,{children:(0,a.jsx)(q,{variant:"secondary",onClick:n,children:"Close"})}),e[27]=n,e[28]=M);let W;return e[29]!==v||e[30]!==M?(W=(0,a.jsxs)(Ve,{className:"sm:max-w-lg",children:[p,v,M]}),e[29]=v,e[30]=M,e[31]=W):W=e[31],W};var U=t=>{let e=(0,je.c)(15),{command:n,display:o}=t,[s,r]=(0,D.useState)(!1),i;e[0]===n?i=e[1]:(i=Pe.stopPropagation(async x=>{x.preventDefault(),await O(n),r(!0),setTimeout(()=>r(!1),2e3)}),e[0]=n,e[1]=i);let l=i,d=o??n,c;e[2]===d?c=e[3]:(c=(0,a.jsx)("code",{className:"flex-1 select-all break-words",children:d}),e[2]=d,e[3]=c);let m;e[4]===s?m=e[5]:(m=s?(0,a.jsx)(be,{size:14,strokeWidth:1.5}):(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[4]=s,e[5]=m);let p;e[6]!==l||e[7]!==m?(p=(0,a.jsx)(q,{onClick:l,size:"xs",variant:"ghost",children:m}),e[6]=l,e[7]=m,e[8]=p):p=e[8];let h;e[9]!==s||e[10]!==p?(h=(0,a.jsx)(Ae,{content:"Copied!",open:s,children:p}),e[9]=s,e[10]=p,e[11]=h):h=e[11];let u;return e[12]!==c||e[13]!==h?(u=(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[c,h]}),e[12]=c,e[13]=h,e[14]=u):u=e[14],u},tt=N(),oe="https://static.marimo.app";const Va=t=>{let e=(0,tt.c)(25),{onClose:n}=t,[o,s]=(0,D.useState)(""),{exportAsHTML:r}=B(),i=`${o}-${Math.random().toString(36).slice(2,6)}`,l=`${oe}/static/${i}`,d;e[0]!==r||e[1]!==n||e[2]!==i?(d=async g=>{g.preventDefault(),n();let z=await r({download:!1,includeCode:!0,files:ea.INSTANCE.filenames()}),v=S({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${oe}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:z,path:i})}).catch(()=>{v.dismiss(),S({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:L.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),S({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},e[0]=r,e[1]=n,e[2]=i,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(Oe,{children:"Share static notebook"}),e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsxs)(Be,{children:[c,(0,a.jsxs)(Fe,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:oe,target:"_blank",children:oe}),"."]})]}),e[5]=m):m=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=g=>{s(g.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=p):p=e[6];let h;e[7]===o?h=e[8]:(h=(0,a.jsx)(pa,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:p,required:!0,autoComplete:"off"}),e[7]=o,e[8]=h);let u;e[9]===l?u=e[10]:(u=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Fa,{text:l}),(0,a.jsx)("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=u);let x;e[11]!==h||e[12]!==u?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[h,u]}),e[11]=h,e[12]=u,e[13]=x):x=e[13];let w;e[14]===n?w=e[15]:(w=(0,a.jsx)(q,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=w);let y;e[16]===l?y=e[17]:(y=(0,a.jsx)(q,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await O(l)},children:"Create"}),e[16]=l,e[17]=y);let k;e[18]!==w||e[19]!==y?(k=(0,a.jsxs)(Ue,{children:[w,y]}),e[18]=w,e[19]=y,e[20]=k):k=e[20];let j;return e[21]!==d||e[22]!==k||e[23]!==x?(j=(0,a.jsx)(Ve,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[m,x,k]})}),e[21]=d,e[22]=k,e[23]=x,e[24]=j):j=e[24],j};var Fa=t=>{let e=(0,tt.c)(8),[n,o]=D.useState(!1),s;e[0]===t.text?s=e[1]:(s=Pe.stopPropagation(async c=>{c.preventDefault(),await O(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=s);let r=s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2];let l;e[3]===r?l=e[4]:(l=(0,a.jsx)(q,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:i}),e[3]=r,e[4]=l);let d;return e[5]!==n||e[6]!==l?(d=(0,a.jsx)(Ae,{content:"Copied!",open:n,children:l}),e[5]=n,e[6]=l,e[7]=d):d=e[7],d},Ya=N();function Ka(){let t=document.getElementsByClassName(Se.outputArea);for(let e of t){let n=e.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=pe.findElement(e);if(!o){H.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:pe.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function Ga(t){if(!t){H.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(pe.create(t.cellId));if(!e){H.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${Se.outputArea}`)){H.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function at(){let t=(0,Ya.c)(2),e=$(We),n;return t[0]===e?n=t[1]:(n=()=>{let o=Ka();e(s=>({mode:gt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ga(o)})})},t[0]=e,t[1]=n),n}const ot=ht(!1);var Ja=N();const Za=()=>{let t=(0,Ja.c)(7),{selectedLayout:e}=Le(),{setLayoutView:n}=Te();if(ue()&&!bt("wasm_layouts"))return null;let o;t[0]===n?o=t[1]:(o=l=>n(l),t[0]=n,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Ut,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Ht,{placeholder:"Select a view"})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Bt,{children:(0,a.jsxs)(Ot,{children:[(0,a.jsx)($t,{children:"View as"}),Ke.map(Xa)]})}),t[3]=r):r=t[3];let i;return t[4]!==e||t[5]!==o?(i=(0,a.jsxs)(Vt,{"data-testid":"layout-select",value:e,onValueChange:o,children:[s,r]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function Qa(t){return(0,a.jsx)(nt(t),{className:"h-4 w-4"})}function nt(t){switch(t){case"vertical":return Pa;case"grid":return la;case"slides":return Xe;default:return Zt(t),ca}}function st(t){return Ie.startCase(t)}function Xa(t){return(0,a.jsx)(qt,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Qa(t),(0,a.jsx)("span",{children:st(t)})]})},t)}async function eo(t){let{filename:e,preset:n,downloadPDF:o}=t;await o({filename:e,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var to=N();function ao(t){let e=(0,to.c)(5),{openPrompt:n,closeModal:o}=we(),{sendCopy:s}=B(),r;return e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==t?(r=()=>{if(!t)return null;let i=ya.guessDeliminator(t);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${qe.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:l=>{let d=i.join(qe.dirname(t),l);s({source:t,destination:d}).then(()=>{o(),S({title:"Notebook copied",description:"A copy of the notebook has been created."}),Ma(d)})}})},e[0]=o,e[1]=n,e[2]=s,e[3]=t,e[4]=r):r=e[4],r}const oo=()=>{let{updateCellConfig:t}=Me(),{saveCellConfig:e}=B();return(0,D.useCallback)(async()=>{let n=new ut,o=_e(),s=o.cellIds.inOrderIds,r={};for(let l of s){if(o.cellData[l]===void 0)continue;let{code:d,config:c}=o.cellData[l];c.hide_code||n.isSupported(d)&&(r[l]={hide_code:!0})}let i=Ne.entries(r);if(i.length!==0){await e({configs:r});for(let[l,d]of i)t({cellId:l,config:d})}},[t])};var no=N();function lt(){let t=(0,no.c)(4),{openConfirm:e}=we(),n=$(St),{sendRestart:o}=B(),s;return t[0]!==e||t[1]!==o||t[2]!==n?(s=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Lt,{onClick:async()=>{n({state:Pt.CLOSING}),await o(),wa()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=s):s=t[3],s}var so=N(),T=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function lo(){var ve,Ce;let t=(0,so.c)(51),e=ga(),{openModal:n,closeModal:o}=we(),{toggleApplication:s}=Mt(),{selectedPanel:r}=xt(),[i]=ct(We),l=me(wt),d=oo(),[c]=Nt(),{updateCellConfig:m,undoDeleteCell:p,clearAllCellOutputs:h,addSetupCellIfDoesntExist:u,collapseAllCells:x,expandAllCells:w}=Me(),y=lt(),k=ba(),j=ao(e),g=$(ot),z=$(Wt),v=$(_t),{exportAsIPYNB:M,exportAsMarkdown:W,readCode:_,saveCellConfig:se,updateCellOutputs:A}=B(),P=Wa(),le=me(yt),ie=me(vt),{selectedLayout:V}=Le(),{setLayoutView:re}=Te(),F=at(),Y=((ve=c.sharing)==null?void 0:ve.html)??!0,K=((Ce=c.sharing)==null?void 0:Ce.wasm)??!0,ge=!ue(),de=V==="slides",it=zo,rt=Co,G;t[0]!==e||t[1]!==P||t[2]!==A?(G=async f=>{let{preset:C,title:R}=f;if(!e){ne();return}await De(R,async he=>{await Ye({takeScreenshots:()=>P({progress:he}),updateCellOutputs:A}),await eo({filename:e,preset:C,downloadPDF:Yt})})},t[0]=e,t[1]=P,t[2]=A,t[3]=G):G=t[3];let I=G,J;t[4]===I?J=t[5]:(J=async()=>{if(ge){await I({preset:"document",title:"Downloading Document PDF..."});return}let f=new Event("export-beforeprint"),C=new Event("export-afterprint");window.dispatchEvent(f),setTimeout(vo,0),setTimeout(()=>window.dispatchEvent(C),0)},t[4]=I,t[5]=J);let Z=J,Q;t[6]!==M||t[7]!==e||t[8]!==P||t[9]!==A?(Q=async()=>{if(!e){ne();return}await De("Downloading IPYNB...",async f=>{await Ye({takeScreenshots:()=>P({progress:f}),updateCellOutputs:A});let C=await M({download:!1});ke(new Blob([C],{type:"application/x-ipynb+json"}),ye.toIPYNB(document.title))})},t[6]=M,t[7]=e,t[8]=P,t[9]=A,t[10]=Q):Q=t[10];let ce=Q,X;t[11]===Symbol.for("react.memo_cache_sentinel")?(X=(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}),t[11]=X):X=t[11];let ee;t[12]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),t[12]=ee):ee=t[12];let E;t[13]===e?E=t[14]:(E=async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!0})},t[13]=e,t[14]=E);let te;return t[15]!==u||t[16]!==ie||t[17]!==h||t[18]!==o||t[19]!==x||t[20]!==j||t[21]!==I||t[22]!==w||t[23]!==W||t[24]!==e||t[25]!==Z||t[26]!==ce||t[27]!==le||t[28]!==d||t[29]!==de||t[30]!==l||t[31]!==n||t[32]!==_||t[33]!==y||t[34]!==k||t[35]!==se||t[36]!==V||t[37]!==r||t[38]!==g||t[39]!==v||t[40]!==re||t[41]!==z||t[42]!==Y||t[43]!==K||t[44]!==E||t[45]!==s||t[46]!==F||t[47]!==p||t[48]!==m||t[49]!==i.mode?(te=[{icon:X,label:"Download",handle:T,dropdown:[{icon:ee,label:"Download as HTML",handle:E},{icon:(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!1})}},{icon:(0,a.jsx)(Ca,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let f=await W({download:!1});ke(new Blob([f],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ce},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let f=await _();ke(new Blob([f.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",va("global.hideCode",!1)]}),handle:go},de?{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:T,dropdown:[{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:Z},{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:rt(!0),hidden:!ge,handle:async()=>{await I({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:Z}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Pair with an agent",handle:async()=>{n((0,a.jsx)(Ua,{onClose:o}))}},{icon:(0,a.jsx)(La,{size:14,strokeWidth:1.5}),label:"Share",handle:T,hidden:!Y&&!K,dropdown:[{icon:(0,a.jsx)(Jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!Y,handle:async()=>{n((0,a.jsx)(Va,{onClose:o}))}},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!K,handle:async()=>{await O(ja({code:(await _()).contents})),S({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:T,dropdown:pt.flatMap(f=>{let{type:C,Icon:R,hidden:he,additionalKeywords:dt}=f;return he?[]:{label:Ie.startCase(C),rightElement:it(r===C),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),handle:()=>s(C),additionalKeywords:dt}})},{icon:(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Present as",handle:T,dropdown:[{icon:i.mode==="present"?(0,a.jsx)(xa,{size:14,strokeWidth:1.5}):(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{F()}},...Ke.map((f,C)=>{let R=nt(f);return{divider:C===0,label:st(f),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:V===f&&(0,a.jsx)(be,{size:14})}),handle:()=>{re(f),i.mode==="edit"&&F()}}})]},{icon:(0,a.jsx)(Da,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!e||ue(),handle:j},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{await O((await _()).contents),S({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!le||l,handle:async()=>{let f=ft(_e());await se({configs:Ne.fromEntries(f.map(jo))});for(let C of f)m({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ze,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(He,{onClose:o}))}},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(He,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ie||l,handle:()=>{p()}},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:y,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Sa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{h()}},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(Na,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:w,redundant:!0},{divider:!0,icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>g(wo)},{icon:(0,a.jsx)(Aa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(bo)},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>z(ko),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Resources",handle:T,dropdown:[{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:yo},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"GitHub",handle:xo},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:fo},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"YouTube",handle:uo},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:mo},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:ho}].filter(co).map(io),t[15]=u,t[16]=ie,t[17]=h,t[18]=o,t[19]=x,t[20]=j,t[21]=I,t[22]=w,t[23]=W,t[24]=e,t[25]=Z,t[26]=ce,t[27]=le,t[28]=d,t[29]=de,t[30]=l,t[31]=n,t[32]=_,t[33]=y,t[34]=k,t[35]=se,t[36]=V,t[37]=r,t[38]=g,t[39]=v,t[40]=re,t[41]=z,t[42]=Y,t[43]=K,t[44]=E,t[45]=s,t[46]=F,t[47]=p,t[48]=m,t[49]=i.mode,t[50]=te):te=t[50],te}function io(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(ro)}:t}function ro(t){return!t.hidden}function co(t){return!t.hidden}function ho(){let t=ka();window.open(t,"_blank")}function mo(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function po(){window.open(L.releasesPage,"_blank")}function uo(){window.open(L.youtube,"_blank")}function fo(){window.open(L.discordLink,"_blank")}function xo(){window.open(L.githubPage,"_blank")}function yo(){window.open(L.docsPage,"_blank")}function ko(t){return!t}function bo(t){return!t}function wo(t){return!t}function jo(t){return[t,{disabled:!1}]}async function go(){let t=document.getElementById("App");t&&await Kt({element:t,filename:document.title,prepare:Gt})}function vo(){return window.print()}function Co(t){return t?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function zo(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(be,{size:14})})}function ne(){S({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{at as a,Ze as c,ot as i,Je as l,lt as n,et as o,Za as r,Qe as s,lo as t,Ge as u};
1
+ import{s as ze}from"./chunk-LvLJmgfZ.js";import{d as $,l as ct,p as ht,u as me}from"./useEvent-D91BmmQi.js";import{t as mt}from"./react-Bj1aDYRI.js";import{E as Me,En as pt,Jt as ut,Rr as ft,Ti as pe,Tn as xt,_ as yt,cr as kt,ct as We,h as _e,kn as bt,ot as wt,pr as jt,st as gt,t as vt,ur as Ct,vr as zt,wn as Mt}from"./cells-CAft_y9h.js";import{t as N}from"./compiler-runtime-B3qBwwSJ.js";import{n as Wt,x as _t}from"./ai-model-dropdown-CZB8Xt_D.js";import{_ as H,d as Ne}from"./useEventListener-DGjKht0c.js";import{y as Nt}from"./utils-8btzWeZg.js";import{n as L,t as Se}from"./constants-tOPFFcLZ.js";import{S as ue,h as St,n as Dt,o as At,x as Pt}from"./config-DoZCLcOb.js";import{n as It}from"./switch-YkPg_CVc.js";import{t as Et}from"./jsx-runtime-Blw4afVn.js";import{o as Lt}from"./alert-dialog-C2mTH3GM.js";import{a as Tt,c as fe,o as xe,s as Rt}from"./popover-AtoFZ7i4.js";import{a as $t,c as Ht,i as qt,n as Bt,r as Ot,s as Ut,t as Vt}from"./select-BwwUWhww.js";import{gt as Ft}from"./JsonOutput-ZBMYDZ3q.js";import{c as De,d as ye,n as Yt,o as Kt,r as ke,t as Gt}from"./download-COyB8G-Y.js";import{m as Jt}from"./form-Dd-gRdD5.js";import{t as Ae}from"./tooltip-DmqhBBs6.js";import{r as Pe,t as q}from"./button-COIw2x9i.js";import{i as Zt,r as Qt,t as Ie}from"./strings-pfr2N700.js";import{r as B}from"./requests-9-v2bhoi.js";import{t as b}from"./createLucideIcon-w-Qo9n0R.js";import{A as Ee,a as Le,i as Te,j as Xt,k as ea,u as Re}from"./layout-CnhRBcnG.js";import{t as be}from"./check-B-sKate2.js";import{n as ta}from"./maps-B4xARV9R.js";import{r as aa}from"./useCellActionButton-Dd3hgOb6.js";import{t as $e}from"./copy-DFMsQ6MJ.js";import{t as oa}from"./eye-off-DgRJ-xBZ.js";import{t as ae}from"./file-l37OnSN4.js";import{t as na}from"./github-C3N4cuN4.js";import{n as sa,r as la,t as ia}from"./youtube-D6LtMx2w.js";import{i as ra,n as He}from"./add-connection-dialog-sNnLlFNN.js";import{n as da,t as ca}from"./square-COtNnHUC.js";import{t as ha}from"./image-BgkzrnsX.js";import{t as ma}from"./link-dU_vDDSR.js";import{r as pa}from"./input-DNCT6U6R.js";import{t as ua}from"./settings-C1bg8A2T.js";import{t as fa}from"./sparkles-B79Qf6ma.js";import{y as xa}from"./textarea-CWy4stSy.js";import{t as S}from"./use-toast-BDYuj3zG.js";import{n as qe,t as ya}from"./paths-BzSgteR-.js";import{o as ka}from"./session-DdnWW30b.js";import{n as O}from"./copy-Bizk-4hH.js";import{r as ba}from"./useRunCells-BJn5ZEb6.js";import{a as Be,c as Oe,i as Ue,n as Ve,r as Fe}from"./dialog-H-hXtEOq.js";import{n as we}from"./ImperativeModal-hsPVDTG-.js";import{r as wa,t as ja}from"./share-0LPgOyiW.js";import{a as ga}from"./cell-link-DMyOfytV.js";import{a as va}from"./renderShortcut-DrDh2657.js";import{t as Ca}from"./icons-DlzgV4KY.js";import{n as za}from"./marimo-icons-Dp8wmdDL.js";import{t as Ma}from"./links-C19POYUQ.js";import{r as Wa,t as Ye}from"./hooks-B5RY2sms.js";import{t as Ke}from"./types-DOdUT9LT.js";var _a=b("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),Na=b("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Ge=b("clipboard-copy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]),Je=b("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]),Ze=b("diamond-plus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]),Sa=b("fast-forward",[["path",{d:"M12 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 12 18z",key:"b19h5q"}],["path",{d:"M2 6a2 2 0 0 1 3.414-1.414l6 6a2 2 0 0 1 0 2.828l-6 6A2 2 0 0 1 2 18z",key:"h7h5ge"}]]),Da=b("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]),Aa=b("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]),Qe=b("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),Pa=b("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]]),Ia=b("notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]),Ea=b("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Xe=b("presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]),La=b("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),Ta=b("square-power",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]),et=b("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),je=N(),D=ze(mt(),1),a=ze(Et(),1);function Ra(){return"uvx marimo@latest"}function $a(t,e,n){let o=n?" --with-token":"",s=`${Ra()} pair prompt --url '${e}'${o}`;switch(t){case"claude":return`claude "$(${s} --claude)"`;case"codex":return`codex "$(${s} --codex)"`;case"opencode":return`opencode "$(${s} --opencode)"`;default:Qt(t)}}function Ha(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var qa="npx skills add marimo-team/marimo-pair";function Ba(){let t=(0,je.c)(2),[e,n]=(0,D.useState)(null),o,s;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{fetch(Dt("/auth/token").href,{headers:It.headers()}).then(Oa).then(r=>n((r==null?void 0:r.token)??null)).catch(()=>n(null))},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,D.useEffect)(o,s),e}function Oa(t){return t.ok?t.json():null}const Ua=t=>{let e=(0,je.c)(32),{onClose:n}=t,[o,s]=(0,D.useState)("claude"),r=At(),i=Ba(),l=!!i,d;e[0]!==o||e[1]!==l||e[2]!==r.httpURL?(d=$a(o,r.httpURL.toString(),l),e[0]=o,e[1]=l,e[2]=r.httpURL,e[3]=d):d=e[3];let c=d,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(Oe,{children:"Pair with an agent"}),e[4]=m):m=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,a.jsxs)(Be,{children:[m,(0,a.jsxs)(Fe,{children:["Use an AI coding agent to pair-program on this notebook."," ",(0,a.jsx)("a",{href:"https://links.marimo.app/marimo-pair",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Learn more"}),"."]})]}),e[5]=p):p=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"1. Install the skill"}),(0,a.jsx)(U,{command:qa})]}),e[6]=h):h=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)("span",{className:"text-sm font-medium",children:"2. Run in your terminal"}),e[7]=u):u=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=_=>s(_),e[8]=x):x=e[8];let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(Rt,{className:"w-full",children:[(0,a.jsx)(fe,{value:"claude",className:"flex-1",children:"Claude"}),(0,a.jsx)(fe,{value:"codex",className:"flex-1",children:"Codex"}),(0,a.jsx)(fe,{value:"opencode",className:"flex-1",children:"OpenCode"})]}),e[9]=w):w=e[9];let y;e[10]===c?y=e[11]:(y=(0,a.jsx)(xe,{value:"claude",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[10]=c,e[11]=y);let k;e[12]===c?k=e[13]:(k=(0,a.jsx)(xe,{value:"codex",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[12]=c,e[13]=k);let j;e[14]===c?j=e[15]:(j=(0,a.jsx)(xe,{value:"opencode",className:"mt-3",children:(0,a.jsx)(U,{command:c})}),e[14]=c,e[15]=j);let g;e[16]!==o||e[17]!==j||e[18]!==y||e[19]!==k?(g=(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[u,(0,a.jsxs)(Tt,{value:o,onValueChange:x,children:[w,y,k,j]})]}),e[16]=o,e[17]=j,e[18]=y,e[19]=k,e[20]=g):g=e[20];let z;e[21]!==i||e[22]!==l?(z=l&&i&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium",children:"3. Paste when prompted for token"}),(0,a.jsx)(U,{command:i,display:Ha(i)})]}),e[21]=i,e[22]=l,e[23]=z):z=e[23];let v;e[24]!==g||e[25]!==z?(v=(0,a.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[h,g,z]}),e[24]=g,e[25]=z,e[26]=v):v=e[26];let M;e[27]===n?M=e[28]:(M=(0,a.jsx)(Ue,{children:(0,a.jsx)(q,{variant:"secondary",onClick:n,children:"Close"})}),e[27]=n,e[28]=M);let W;return e[29]!==v||e[30]!==M?(W=(0,a.jsxs)(Ve,{className:"sm:max-w-lg",children:[p,v,M]}),e[29]=v,e[30]=M,e[31]=W):W=e[31],W};var U=t=>{let e=(0,je.c)(15),{command:n,display:o}=t,[s,r]=(0,D.useState)(!1),i;e[0]===n?i=e[1]:(i=Pe.stopPropagation(async x=>{x.preventDefault(),await O(n),r(!0),setTimeout(()=>r(!1),2e3)}),e[0]=n,e[1]=i);let l=i,d=o??n,c;e[2]===d?c=e[3]:(c=(0,a.jsx)("code",{className:"flex-1 select-all break-words",children:d}),e[2]=d,e[3]=c);let m;e[4]===s?m=e[5]:(m=s?(0,a.jsx)(be,{size:14,strokeWidth:1.5}):(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[4]=s,e[5]=m);let p;e[6]!==l||e[7]!==m?(p=(0,a.jsx)(q,{onClick:l,size:"xs",variant:"ghost",children:m}),e[6]=l,e[7]=m,e[8]=p):p=e[8];let h;e[9]!==s||e[10]!==p?(h=(0,a.jsx)(Ae,{content:"Copied!",open:s,children:p}),e[9]=s,e[10]=p,e[11]=h):h=e[11];let u;return e[12]!==c||e[13]!==h?(u=(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-xs",children:[c,h]}),e[12]=c,e[13]=h,e[14]=u):u=e[14],u},tt=N(),oe="https://static.marimo.app";const Va=t=>{let e=(0,tt.c)(25),{onClose:n}=t,[o,s]=(0,D.useState)(""),{exportAsHTML:r}=B(),i=`${o}-${Math.random().toString(36).slice(2,6)}`,l=`${oe}/static/${i}`,d;e[0]!==r||e[1]!==n||e[2]!==i?(d=async g=>{g.preventDefault(),n();let z=await r({download:!1,includeCode:!0,files:ea.INSTANCE.filenames()}),v=S({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${oe}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:z,path:i})}).catch(()=>{v.dismiss(),S({title:"Error uploading static page",description:(0,a.jsxs)("div",{children:["Please try again later. If the problem persists, please file a bug report on"," ",(0,a.jsx)("a",{href:L.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),v.dismiss(),S({title:"Static page uploaded!",description:(0,a.jsxs)("div",{children:["The URL has been copied to your clipboard.",(0,a.jsx)("br",{}),"You can share it with anyone."]})})},e[0]=r,e[1]=n,e[2]=i,e[3]=d):d=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=(0,a.jsx)(Oe,{children:"Share static notebook"}),e[4]=c):c=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsxs)(Be,{children:[c,(0,a.jsxs)(Fe,{children:["You can publish a static, non-interactive version of this notebook to the public web. We will create a link for you that lives on"," ",(0,a.jsx)("a",{href:oe,target:"_blank",children:oe}),"."]})]}),e[5]=m):m=e[5];let p;e[6]===Symbol.for("react.memo_cache_sentinel")?(p=g=>{s(g.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},e[6]=p):p=e[6];let h;e[7]===o?h=e[8]:(h=(0,a.jsx)(pa,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:p,required:!0,autoComplete:"off"}),e[7]=o,e[8]=h);let u;e[9]===l?u=e[10]:(u=(0,a.jsxs)("div",{className:"font-semibold text-sm text-muted-foreground gap-2 flex flex-col",children:["Anyone will be able to access your notebook at this URL:",(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Fa,{text:l}),(0,a.jsx)("span",{className:"text-primary",children:l})]})]}),e[9]=l,e[10]=u);let x;e[11]!==h||e[12]!==u?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[h,u]}),e[11]=h,e[12]=u,e[13]=x):x=e[13];let w;e[14]===n?w=e[15]:(w=(0,a.jsx)(q,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),e[14]=n,e[15]=w);let y;e[16]===l?y=e[17]:(y=(0,a.jsx)(q,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await O(l)},children:"Create"}),e[16]=l,e[17]=y);let k;e[18]!==w||e[19]!==y?(k=(0,a.jsxs)(Ue,{children:[w,y]}),e[18]=w,e[19]=y,e[20]=k):k=e[20];let j;return e[21]!==d||e[22]!==k||e[23]!==x?(j=(0,a.jsx)(Ve,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[m,x,k]})}),e[21]=d,e[22]=k,e[23]=x,e[24]=j):j=e[24],j};var Fa=t=>{let e=(0,tt.c)(8),[n,o]=D.useState(!1),s;e[0]===t.text?s=e[1]:(s=Pe.stopPropagation(async c=>{c.preventDefault(),await O(t.text),o(!0),setTimeout(()=>o(!1),2e3)}),e[0]=t.text,e[1]=s);let r=s,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i=(0,a.jsx)($e,{size:14,strokeWidth:1.5}),e[2]=i):i=e[2];let l;e[3]===r?l=e[4]:(l=(0,a.jsx)(q,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:i}),e[3]=r,e[4]=l);let d;return e[5]!==n||e[6]!==l?(d=(0,a.jsx)(Ae,{content:"Copied!",open:n,children:l}),e[5]=n,e[6]=l,e[7]=d):d=e[7],d},Ya=N();function Ka(){let t=document.getElementsByClassName(Se.outputArea);for(let e of t){let n=e.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=pe.findElement(e);if(!o){H.warn("Could not find HTMLCellId for visible output area",e);continue}return{cellId:pe.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function Ga(t){if(!t){H.warn("No scroll anchor provided to restore scroll position");return}let e=document.getElementById(pe.create(t.cellId));if(!e){H.warn("Could not find cell element to restore scroll position",t.cellId);return}if(!e.querySelector(`.${Se.outputArea}`)){H.warn("Could not find output area to restore scroll position",t.cellId);return}e.scrollIntoView({block:"start",behavior:"auto"})}function at(){let t=(0,Ya.c)(2),e=$(We),n;return t[0]===e?n=t[1]:(n=()=>{let o=Ka();e(s=>({mode:gt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ga(o)})})},t[0]=e,t[1]=n),n}const ot=ht(!1);var Ja=N();const Za=()=>{let t=(0,Ja.c)(7),{selectedLayout:e}=Le(),{setLayoutView:n}=Te();if(ue()&&!bt("wasm_layouts"))return null;let o;t[0]===n?o=t[1]:(o=l=>n(l),t[0]=n,t[1]=o);let s;t[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(Ut,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Ht,{placeholder:"Select a view"})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Bt,{children:(0,a.jsxs)(Ot,{children:[(0,a.jsx)($t,{children:"View as"}),Ke.map(Xa)]})}),t[3]=r):r=t[3];let i;return t[4]!==e||t[5]!==o?(i=(0,a.jsxs)(Vt,{"data-testid":"layout-select",value:e,onValueChange:o,children:[s,r]}),t[4]=e,t[5]=o,t[6]=i):i=t[6],i};function Qa(t){return(0,a.jsx)(nt(t),{className:"h-4 w-4"})}function nt(t){switch(t){case"vertical":return Pa;case"grid":return la;case"slides":return Xe;default:return Zt(t),ca}}function st(t){return Ie.startCase(t)}function Xa(t){return(0,a.jsx)(qt,{value:t,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Qa(t),(0,a.jsx)("span",{children:st(t)})]})},t)}async function eo(t){let{filename:e,preset:n,downloadPDF:o}=t;await o({filename:e,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var to=N();function ao(t){let e=(0,to.c)(5),{openPrompt:n,closeModal:o}=we(),{sendCopy:s}=B(),r;return e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==t?(r=()=>{if(!t)return null;let i=ya.guessDeliminator(t);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${qe.basename(t)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:l=>{let d=i.join(qe.dirname(t),l);s({source:t,destination:d}).then(()=>{o(),S({title:"Notebook copied",description:"A copy of the notebook has been created."}),Ma(d)})}})},e[0]=o,e[1]=n,e[2]=s,e[3]=t,e[4]=r):r=e[4],r}const oo=()=>{let{updateCellConfig:t}=Me(),{saveCellConfig:e}=B();return(0,D.useCallback)(async()=>{let n=new ut,o=_e(),s=o.cellIds.inOrderIds,r={};for(let l of s){if(o.cellData[l]===void 0)continue;let{code:d,config:c}=o.cellData[l];c.hide_code||n.isSupported(d)&&(r[l]={hide_code:!0})}let i=Ne.entries(r);if(i.length!==0){await e({configs:r});for(let[l,d]of i)t({cellId:l,config:d})}},[t])};var no=N();function lt(){let t=(0,no.c)(4),{openConfirm:e}=we(),n=$(St),{sendRestart:o}=B(),s;return t[0]!==e||t[1]!==o||t[2]!==n?(s=()=>{e({title:"Restart Kernel",description:"This will restart the Python kernel. You'll lose all data that's in memory. You will also lose any unsaved changes, so make sure to save your work before restarting.",variant:"destructive",confirmAction:(0,a.jsx)(Lt,{onClick:async()=>{n({state:Pt.CLOSING}),await o(),wa()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=s):s=t[3],s}var so=N(),T=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function lo(){var ve,Ce;let t=(0,so.c)(51),e=ga(),{openModal:n,closeModal:o}=we(),{toggleApplication:s}=Mt(),{selectedPanel:r}=xt(),[i]=ct(We),l=me(wt),d=oo(),[c]=Nt(),{updateCellConfig:m,undoDeleteCell:p,clearAllCellOutputs:h,addSetupCellIfDoesntExist:u,collapseAllCells:x,expandAllCells:w}=Me(),y=lt(),k=ba(),j=ao(e),g=$(ot),z=$(Wt),v=$(_t),{exportAsIPYNB:M,exportAsMarkdown:W,readCode:_,saveCellConfig:se,updateCellOutputs:A}=B(),P=Wa(),le=me(yt),ie=me(vt),{selectedLayout:V}=Le(),{setLayoutView:re}=Te(),F=at(),Y=((ve=c.sharing)==null?void 0:ve.html)??!0,K=((Ce=c.sharing)==null?void 0:Ce.wasm)??!0,ge=!ue(),de=V==="slides",it=zo,rt=Co,G;t[0]!==e||t[1]!==P||t[2]!==A?(G=async f=>{let{preset:C,title:R}=f;if(!e){ne();return}await De(R,async he=>{await Ye({takeScreenshots:()=>P({progress:he}),updateCellOutputs:A}),await eo({filename:e,preset:C,downloadPDF:Yt})})},t[0]=e,t[1]=P,t[2]=A,t[3]=G):G=t[3];let I=G,J;t[4]===I?J=t[5]:(J=async()=>{if(ge){await I({preset:"document",title:"Downloading Document PDF..."});return}let f=new Event("export-beforeprint"),C=new Event("export-afterprint");window.dispatchEvent(f),setTimeout(vo,0),setTimeout(()=>window.dispatchEvent(C),0)},t[4]=I,t[5]=J);let Z=J,Q;t[6]!==M||t[7]!==e||t[8]!==P||t[9]!==A?(Q=async()=>{if(!e){ne();return}await De("Downloading IPYNB...",async f=>{await Ye({takeScreenshots:()=>P({progress:f}),updateCellOutputs:A});let C=await M({download:!1});ke(new Blob([C],{type:"application/x-ipynb+json"}),ye.toIPYNB(document.title))})},t[6]=M,t[7]=e,t[8]=P,t[9]=A,t[10]=Q):Q=t[10];let ce=Q,X;t[11]===Symbol.for("react.memo_cache_sentinel")?(X=(0,a.jsx)(Ft,{size:14,strokeWidth:1.5}),t[11]=X):X=t[11];let ee;t[12]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),t[12]=ee):ee=t[12];let E;t[13]===e?E=t[14]:(E=async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!0})},t[13]=e,t[14]=E);let te;return t[15]!==u||t[16]!==ie||t[17]!==h||t[18]!==o||t[19]!==x||t[20]!==j||t[21]!==I||t[22]!==w||t[23]!==W||t[24]!==e||t[25]!==Z||t[26]!==ce||t[27]!==le||t[28]!==d||t[29]!==de||t[30]!==l||t[31]!==n||t[32]!==_||t[33]!==y||t[34]!==k||t[35]!==se||t[36]!==V||t[37]!==r||t[38]!==g||t[39]!==v||t[40]!==re||t[41]!==z||t[42]!==Y||t[43]!==K||t[44]!==E||t[45]!==s||t[46]!==F||t[47]!==p||t[48]!==m||t[49]!==i.mode?(te=[{icon:X,label:"Download",handle:T,dropdown:[{icon:ee,label:"Download as HTML",handle:E},{icon:(0,a.jsx)(Ee,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!e){ne();return}await Re({filename:e,includeCode:!1})}},{icon:(0,a.jsx)(Ca,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let f=await W({download:!1});ke(new Blob([f],{type:"text/plain"}),ye.toMarkdown(document.title))}},{icon:(0,a.jsx)(Ia,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ce},{icon:(0,a.jsx)(Xt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let f=await _();ke(new Blob([f.contents],{type:"text/plain"}),ye.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:i.mode!=="present",tooltip:i.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",va("global.hideCode",!1)]}),handle:go},de?{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:T,dropdown:[{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:Z},{icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:rt(!0),hidden:!ge,handle:async()=>{await I({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(ae,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:Z}]},{icon:(0,a.jsx)(fa,{size:14,strokeWidth:1.5}),label:"Pair with an agent",handle:async()=>{n((0,a.jsx)(Ua,{onClose:o}))}},{icon:(0,a.jsx)(La,{size:14,strokeWidth:1.5}),label:"Share",handle:T,hidden:!Y&&!K,dropdown:[{icon:(0,a.jsx)(Jt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!Y,handle:async()=>{n((0,a.jsx)(Va,{onClose:o}))}},{icon:(0,a.jsx)(ma,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!K,handle:async()=>{await O(ja({code:(await _()).contents})),S({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:T,dropdown:pt.flatMap(f=>{let{type:C,Icon:R,hidden:he,additionalKeywords:dt}=f;return he?[]:{label:Ie.startCase(C),rightElement:it(r===C),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),handle:()=>s(C),additionalKeywords:dt}})},{icon:(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Present as",handle:T,dropdown:[{icon:i.mode==="present"?(0,a.jsx)(xa,{size:14,strokeWidth:1.5}):(0,a.jsx)(Qe,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{F()}},...Ke.map((f,C)=>{let R=nt(f);return{divider:C===0,label:st(f),icon:(0,a.jsx)(R,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:V===f&&(0,a.jsx)(be,{size:14})}),handle:()=>{re(f),i.mode==="edit"&&F()}}})]},{icon:(0,a.jsx)(Da,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!e||ue(),handle:j},{icon:(0,a.jsx)(Ge,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!e,handle:async()=>{await O((await _()).contents),S({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(aa,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!le||l,handle:async()=>{let f=ft(_e());await se({configs:Ne.fromEntries(f.map(jo))});for(let C of f)m({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Ze,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{u({})}},{icon:(0,a.jsx)(Ct,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(He,{onClose:o}))}},{icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(He,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(et,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ie||l,handle:()=>{p()}},{icon:(0,a.jsx)(Ta,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:y,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Sa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{k()}},{icon:(0,a.jsx)(jt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{h()}},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(Na,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:w,redundant:!0},{divider:!0,icon:(0,a.jsx)(Je,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>g(wo)},{icon:(0,a.jsx)(Aa,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(bo)},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>z(ko),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(ta,{size:14,strokeWidth:1.5}),label:"Resources",handle:T,dropdown:[{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:yo},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"GitHub",handle:xo},{icon:(0,a.jsx)(sa,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:fo},{icon:(0,a.jsx)(ia,{size:14,strokeWidth:1.5}),label:"YouTube",handle:uo},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:po}]},{divider:!0,icon:(0,a.jsx)(da,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:mo},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:ho}].filter(co).map(io),t[15]=u,t[16]=ie,t[17]=h,t[18]=o,t[19]=x,t[20]=j,t[21]=I,t[22]=w,t[23]=W,t[24]=e,t[25]=Z,t[26]=ce,t[27]=le,t[28]=d,t[29]=de,t[30]=l,t[31]=n,t[32]=_,t[33]=y,t[34]=k,t[35]=se,t[36]=V,t[37]=r,t[38]=g,t[39]=v,t[40]=re,t[41]=z,t[42]=Y,t[43]=K,t[44]=E,t[45]=s,t[46]=F,t[47]=p,t[48]=m,t[49]=i.mode,t[50]=te):te=t[50],te}function io(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(ro)}:t}function ro(t){return!t.hidden}function co(t){return!t.hidden}function ho(){let t=ka();window.open(t,"_blank")}function mo(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function po(){window.open(L.releasesPage,"_blank")}function uo(){window.open(L.youtube,"_blank")}function fo(){window.open(L.discordLink,"_blank")}function xo(){window.open(L.githubPage,"_blank")}function yo(){window.open(L.docsPage,"_blank")}function ko(t){return!t}function bo(t){return!t}function wo(t){return!t}function jo(t){return[t,{disabled:!1}]}async function go(){let t=document.getElementById("App");t&&await Kt({element:t,filename:document.title,prepare:Gt})}function vo(){return window.print()}function Co(t){return t?(0,a.jsx)("span",{className:"ml-3 shrink-0 rounded-full border border-emerald-200 bg-emerald-50 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-emerald-700",children:"Recommended"}):null}function zo(t){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:t&&(0,a.jsx)(be,{size:14})})}function ne(){S({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{at as a,Ze as c,ot as i,Je as l,lt as n,et as o,Za as r,Qe as s,lo as t,Ge as u};
@@ -1 +1 @@
1
- import{d as g,n as i,p as k}from"./useEvent-D91BmmQi.js";import{E as v,Ln as w,Ur as F,h as d,yt as b,zr as _}from"./cells-BqYYXi6G.js";import{t as x}from"./compiler-runtime-B3qBwwSJ.js";import{_ as z}from"./useEventListener-DGjKht0c.js";import{o as D}from"./dist-BNTOYRCs.js";import{r as E}from"./requests-9-v2bhoi.js";var u=x();const y=k(!1);function H(){let r=(0,u.c)(2),n=f(),t;return r[0]===n?t=r[1]:(t=()=>n(F(d())),r[0]=n,r[1]=t),i(t)}function L(r){let n=(0,u.c)(3),t=f(),e;return n[0]!==r||n[1]!==t?(e=()=>{r!==void 0&&t([r])},n[0]=r,n[1]=t,n[2]=e):e=n[2],i(e)}function U(){let r=(0,u.c)(2),n=f(),t;return r[0]===n?t=r[1]:(t=()=>n(_(d())),r[0]=n,r[1]=t),i(t)}function f(){let r=(0,u.c)(4),{prepareForRun:n}=v(),{sendRun:t}=E(),e=g(y),o;return r[0]!==n||r[1]!==t||r[2]!==e?(o=async s=>{if(s.length===0)return;let c=d();return e(!0),I({cellIds:s,sendRun:t,prepareForRun:n,notebook:c})},r[0]=n,r[1]=t,r[2]=e,r[3]=o):o=r[3],i(o)}async function I({cellIds:r,sendRun:n,prepareForRun:t,notebook:e}){var m,h,R;if(r.length===0)return;let{cellHandles:o,cellData:s}=e,c=[];for(let a of r){let l=(h=(m=o[a])==null?void 0:m.current)==null?void 0:h.editorView,p;l?(w(l)!=="markdown"&&D(l),p=b(l)):p=((R=s[a])==null?void 0:R.code)||"",c.push(p),t({cellId:a})}await n({cellIds:r,codes:c}).catch(a=>{z.error(a)})}export{f as a,L as i,I as n,H as o,U as r,y as t};
1
+ import{d as g,n as i,p as k}from"./useEvent-D91BmmQi.js";import{E as v,Ln as w,Ur as F,h as d,yt as b,zr as _}from"./cells-CAft_y9h.js";import{t as x}from"./compiler-runtime-B3qBwwSJ.js";import{_ as z}from"./useEventListener-DGjKht0c.js";import{o as D}from"./dist-BNTOYRCs.js";import{r as E}from"./requests-9-v2bhoi.js";var u=x();const y=k(!1);function H(){let r=(0,u.c)(2),n=f(),t;return r[0]===n?t=r[1]:(t=()=>n(F(d())),r[0]=n,r[1]=t),i(t)}function L(r){let n=(0,u.c)(3),t=f(),e;return n[0]!==r||n[1]!==t?(e=()=>{r!==void 0&&t([r])},n[0]=r,n[1]=t,n[2]=e):e=n[2],i(e)}function U(){let r=(0,u.c)(2),n=f(),t;return r[0]===n?t=r[1]:(t=()=>n(_(d())),r[0]=n,r[1]=t),i(t)}function f(){let r=(0,u.c)(4),{prepareForRun:n}=v(),{sendRun:t}=E(),e=g(y),o;return r[0]!==n||r[1]!==t||r[2]!==e?(o=async s=>{if(s.length===0)return;let c=d();return e(!0),I({cellIds:s,sendRun:t,prepareForRun:n,notebook:c})},r[0]=n,r[1]=t,r[2]=e,r[3]=o):o=r[3],i(o)}async function I({cellIds:r,sendRun:n,prepareForRun:t,notebook:e}){var m,h,R;if(r.length===0)return;let{cellHandles:o,cellData:s}=e,c=[];for(let a of r){let l=(h=(m=o[a])==null?void 0:m.current)==null?void 0:h.editorView,p;l?(w(l)!=="markdown"&&D(l),p=b(l)):p=((R=s[a])==null?void 0:R.code)||"",c.push(p),t({cellId:a})}await n({cellIds:r,codes:c}).catch(a=>{z.error(a)})}export{f as a,L as i,I as n,H as o,U as r,y as t};
@@ -1 +1 @@
1
- import{s as m}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-D91BmmQi.js";import{E as d,f,yt as u}from"./cells-BqYYXi6G.js";import{t as c}from"./compiler-runtime-B3qBwwSJ.js";import{t as C}from"./jsx-runtime-Blw4afVn.js";import{t as h}from"./use-toast-BDYuj3zG.js";import{r as v}from"./useDeleteCell-DHUjJQJx.js";var x=c(),b=m(C(),1);function j(){let t=(0,x.c)(3),{splitCell:i,undoSplitCell:r}=d(),o;return t[0]!==i||t[1]!==r?(o=s=>{let l=f(s.cellId);if(!l)return;let a=u(l);i(s);let{dismiss:n}=h({title:"Cell split",action:(0,b.jsx)(v,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{r({...s,snapshot:a}),e()},children:"Undo"})}),e=n},t[0]=i,t[1]=r,t[2]=o):o=t[2],p(o)}export{j as t};
1
+ import{s as m}from"./chunk-LvLJmgfZ.js";import{n as p}from"./useEvent-D91BmmQi.js";import{E as d,f,yt as u}from"./cells-CAft_y9h.js";import{t as c}from"./compiler-runtime-B3qBwwSJ.js";import{t as C}from"./jsx-runtime-Blw4afVn.js";import{t as h}from"./use-toast-BDYuj3zG.js";import{r as v}from"./useDeleteCell-BHcPGuXL.js";var x=c(),b=m(C(),1);function j(){let t=(0,x.c)(3),{splitCell:i,undoSplitCell:r}=d(),o;return t[0]!==i||t[1]!==r?(o=s=>{let l=f(s.cellId);if(!l)return;let a=u(l);i(s);let{dismiss:n}=h({title:"Cell split",action:(0,b.jsx)(v,{"data-testid":"undo-split-button",size:"sm",variant:"outline",onClick:()=>{r({...s,snapshot:a}),e()},children:"Undo"})}),e=n},t[0]=i,t[1]=r,t[2]=o):o=t[2],p(o)}export{j as t};
package/dist/index.html CHANGED
@@ -66,7 +66,7 @@
66
66
  <marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
67
67
  <!-- /TODO -->
68
68
  <title>{{ title }}</title>
69
- <script type="module" crossorigin src="./assets/index-y6osgSWB.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-BjVgEJVi.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-D2MJg03u.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
@@ -134,7 +134,7 @@
134
134
  <link rel="modulepreload" crossorigin href="./assets/debounce-BbSyBDA8.js">
135
135
  <link rel="modulepreload" crossorigin href="./assets/database-zap-BxfYZ6ML.js">
136
136
  <link rel="modulepreload" crossorigin href="./assets/main-BNL5rxQw.js">
137
- <link rel="modulepreload" crossorigin href="./assets/cells-BqYYXi6G.js">
137
+ <link rel="modulepreload" crossorigin href="./assets/cells-CAft_y9h.js">
138
138
  <link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-CxTq44MI.js">
139
139
  <link rel="modulepreload" crossorigin href="./assets/kbd-BUtlbGdu.js">
140
140
  <link rel="modulepreload" crossorigin href="./assets/useInstallPackage-CeM6oPsT.js">
@@ -148,33 +148,33 @@
148
148
  <link rel="modulepreload" crossorigin href="./assets/usePress-BXMIcLWP.js">
149
149
  <link rel="modulepreload" crossorigin href="./assets/input-DNCT6U6R.js">
150
150
  <link rel="modulepreload" crossorigin href="./assets/ImperativeModal-hsPVDTG-.js">
151
- <link rel="modulepreload" crossorigin href="./assets/cell-link-CRkrHl-y.js">
151
+ <link rel="modulepreload" crossorigin href="./assets/cell-link-DMyOfytV.js">
152
152
  <link rel="modulepreload" crossorigin href="./assets/multi-map-MSuUqmbC.js">
153
153
  <link rel="modulepreload" crossorigin href="./assets/alert-DF3HbVtk.js">
154
154
  <link rel="modulepreload" crossorigin href="./assets/chevron-right-CgvDWFE3.js">
155
155
  <link rel="modulepreload" crossorigin href="./assets/dropdown-menu-DrHAuMTb.js">
156
156
  <link rel="modulepreload" crossorigin href="./assets/links-DOybeRem.js">
157
- <link rel="modulepreload" crossorigin href="./assets/useRunCells-DFYAOTWd.js">
157
+ <link rel="modulepreload" crossorigin href="./assets/useRunCells-BJn5ZEb6.js">
158
158
  <link rel="modulepreload" crossorigin href="./assets/copy-Bizk-4hH.js">
159
159
  <link rel="modulepreload" crossorigin href="./assets/copy-DFMsQ6MJ.js">
160
160
  <link rel="modulepreload" crossorigin href="./assets/copy-icon-Ci08KCdY.js">
161
- <link rel="modulepreload" crossorigin href="./assets/RenderHTML-CM3WMmA8.js">
162
- <link rel="modulepreload" crossorigin href="./assets/datasource-COFRe84u.js">
163
- <link rel="modulepreload" crossorigin href="./assets/state-DPomuurt.js">
161
+ <link rel="modulepreload" crossorigin href="./assets/RenderHTML-5FjN3OZH.js">
162
+ <link rel="modulepreload" crossorigin href="./assets/datasource-C1kSlT4s.js">
163
+ <link rel="modulepreload" crossorigin href="./assets/state-CDUQVvOe.js">
164
164
  <link rel="modulepreload" crossorigin href="./assets/sparkles-B79Qf6ma.js">
165
- <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-Bmp8DLLo.js">
165
+ <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-DLREr23s.js">
166
166
  <link rel="modulepreload" crossorigin href="./assets/spinner-C5wIpWgQ.js">
167
- <link rel="modulepreload" crossorigin href="./assets/html-to-image-DGqJ93hW.js">
168
- <link rel="modulepreload" crossorigin href="./assets/focus-DzMo6UAI.js">
167
+ <link rel="modulepreload" crossorigin href="./assets/html-to-image-WCAzCguU.js">
168
+ <link rel="modulepreload" crossorigin href="./assets/focus-BtOH5aLt.js">
169
169
  <link rel="modulepreload" crossorigin href="./assets/useAsyncData-aCoWDe-l.js">
170
170
  <link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-CsrwfW0n.js">
171
171
  <link rel="modulepreload" crossorigin href="./assets/micromark-factory-space-DzSMahmM.js">
172
172
  <link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-Cyc7d5AB.js">
173
- <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-DNANigO8.js">
173
+ <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-BDdzHOwK.js">
174
174
  <link rel="modulepreload" crossorigin href="./assets/command-DnzBp4l4.js">
175
175
  <link rel="modulepreload" crossorigin href="./assets/popover-AtoFZ7i4.js">
176
176
  <link rel="modulepreload" crossorigin href="./assets/errors-CZb6hI2x.js">
177
- <link rel="modulepreload" crossorigin href="./assets/download-5XbM3TL_.js">
177
+ <link rel="modulepreload" crossorigin href="./assets/download-COyB8G-Y.js">
178
178
  <link rel="modulepreload" crossorigin href="./assets/table-B03CpBmt.js">
179
179
  <link rel="modulepreload" crossorigin href="./assets/useIframeCapabilities-C8jvQ1Lj.js">
180
180
  <link rel="modulepreload" crossorigin href="./assets/error-banner-frvr6JXK.js">
@@ -193,26 +193,26 @@
193
193
  <link rel="modulepreload" crossorigin href="./assets/ellipsis-DidENKDy.js">
194
194
  <link rel="modulepreload" crossorigin href="./assets/message-circle-DiHwtSG8.js">
195
195
  <link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-BUNcfKXO.js">
196
- <link rel="modulepreload" crossorigin href="./assets/JsonOutput-CavtrueA.js">
196
+ <link rel="modulepreload" crossorigin href="./assets/JsonOutput-ZBMYDZ3q.js">
197
197
  <link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-CsXoiEZx.js">
198
198
  <link rel="modulepreload" crossorigin href="./assets/square-function-BecUoMho.js">
199
199
  <link rel="modulepreload" crossorigin href="./assets/spec-DqqZbNbU.js">
200
200
  <link rel="modulepreload" crossorigin href="./assets/ellipsis-vertical-DEH0lwkn.js">
201
201
  <link rel="modulepreload" crossorigin href="./assets/refresh-cw-CiOe0azG.js">
202
- <link rel="modulepreload" crossorigin href="./assets/components-DKHyHZBv.js">
203
- <link rel="modulepreload" crossorigin href="./assets/column-preview-AfcgbFG_.js">
202
+ <link rel="modulepreload" crossorigin href="./assets/components-Dta3XEEY.js">
203
+ <link rel="modulepreload" crossorigin href="./assets/column-preview-D2B6qQUU.js">
204
204
  <link rel="modulepreload" crossorigin href="./assets/icons-DlzgV4KY.js">
205
- <link rel="modulepreload" crossorigin href="./assets/floating-outline-XObNWtN8.js">
206
- <link rel="modulepreload" crossorigin href="./assets/useAddCell-B6yUY_RG.js">
205
+ <link rel="modulepreload" crossorigin href="./assets/floating-outline-Cj9Gdjkf.js">
206
+ <link rel="modulepreload" crossorigin href="./assets/useAddCell-BZ5oFC7U.js">
207
207
  <link rel="modulepreload" crossorigin href="./assets/objectWithoutPropertiesLoose-smPWkHxB.js">
208
208
  <link rel="modulepreload" crossorigin href="./assets/esm-BqofWdD5.js">
209
209
  <link rel="modulepreload" crossorigin href="./assets/eye-off-DgRJ-xBZ.js">
210
210
  <link rel="modulepreload" crossorigin href="./assets/plus-BYq_Btg-.js">
211
- <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-CI_b818F.js">
211
+ <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-3lQBDicq.js">
212
212
  <link rel="modulepreload" crossorigin href="./assets/file-headphone-5_PGMxRL.js">
213
213
  <link rel="modulepreload" crossorigin href="./assets/file-l37OnSN4.js">
214
214
  <link rel="modulepreload" crossorigin href="./assets/image-BgkzrnsX.js">
215
- <link rel="modulepreload" crossorigin href="./assets/file-icons-Bj5YoM7H.js">
215
+ <link rel="modulepreload" crossorigin href="./assets/file-icons-CRsc39Ny.js">
216
216
  <link rel="modulepreload" crossorigin href="./assets/switch-YkPg_CVc.js">
217
217
  <link rel="modulepreload" crossorigin href="./assets/events-Qeh-bHlj.js">
218
218
  <link rel="modulepreload" crossorigin href="./assets/globals-Bu6OEURn.js">
@@ -221,12 +221,12 @@
221
221
  <link rel="modulepreload" crossorigin href="./assets/memoize-BwAF2XN5.js">
222
222
  <link rel="modulepreload" crossorigin href="./assets/get-D7jeR2wg.js">
223
223
  <link rel="modulepreload" crossorigin href="./assets/_baseSet-49dbm-yb.js">
224
- <link rel="modulepreload" crossorigin href="./assets/state-D1n-olwf.js">
224
+ <link rel="modulepreload" crossorigin href="./assets/state-BFn0AerH.js">
225
225
  <link rel="modulepreload" crossorigin href="./assets/label-C89F4v17.js">
226
- <link rel="modulepreload" crossorigin href="./assets/textarea-CS2o3y4W.js">
226
+ <link rel="modulepreload" crossorigin href="./assets/textarea-CWy4stSy.js">
227
227
  <link rel="modulepreload" crossorigin href="./assets/refresh-ccw-CfYqAbmq.js">
228
228
  <link rel="modulepreload" crossorigin href="./assets/trash-2-DunI72kV.js">
229
- <link rel="modulepreload" crossorigin href="./assets/form-BJ6VFU8l.js">
229
+ <link rel="modulepreload" crossorigin href="./assets/form-Dd-gRdD5.js">
230
230
  <link rel="modulepreload" crossorigin href="./assets/renderShortcut-DrDh2657.js">
231
231
  <link rel="modulepreload" crossorigin href="./assets/field-DaQqUJ5I.js">
232
232
  <link rel="modulepreload" crossorigin href="./assets/RSPContexts-DzigvqmT.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.23.2-dev25",
3
+ "version": "0.23.2-dev6",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -263,7 +263,7 @@ const MimeBundleOutputRenderer: React.FC<{
263
263
  const { mode } = useAtomValue(viewStateAtom);
264
264
  const appView = mode === "present" || mode === "read";
265
265
 
266
- // Extract metadata if present (e.g., for retina image rendering)
266
+ // Extract metadata if present (e.g., to maintain a constant display size regardless of DPI/PPI)
267
267
  const metadata = mimebundle[METADATA_KEY];
268
268
 
269
269
  // Filter out metadata from the mime entries and type narrow
@@ -36,7 +36,7 @@ import { FederatedLanguageServerClient } from "../../lsp/federated-lsp";
36
36
  import { NotebookLanguageServerClient } from "../../lsp/notebook-lsp";
37
37
  import { createTransport } from "../../lsp/transports";
38
38
  import { CellDocumentUri, type ILanguageServerClient } from "../../lsp/types";
39
- import { getLSPDocumentRootUri } from "../../lsp/utils";
39
+ import { getLspRootUri, getLspWorkspaceFolders } from "../../lsp/utils";
40
40
  import {
41
41
  clickablePlaceholderExtension,
42
42
  smartPlaceholderExtension,
@@ -54,8 +54,8 @@ const pylspClient = once((lspConfig: LSPConfig) => {
54
54
 
55
55
  const lspClientOpts = {
56
56
  transport,
57
- rootUri: getLSPDocumentRootUri(),
58
- workspaceFolders: [],
57
+ rootUri: getLspRootUri(),
58
+ workspaceFolders: getLspWorkspaceFolders(),
59
59
  };
60
60
  const config = lspConfig?.pylsp;
61
61
 
@@ -161,8 +161,8 @@ const tyLspClient = once((_: LSPConfig) => {
161
161
 
162
162
  const lspClientOpts = {
163
163
  transport,
164
- rootUri: getLSPDocumentRootUri(),
165
- workspaceFolders: [],
164
+ rootUri: getLspRootUri(),
165
+ workspaceFolders: getLspWorkspaceFolders(),
166
166
  };
167
167
 
168
168
  // We wrap the client in a NotebookLanguageServerClient to add some
@@ -192,8 +192,8 @@ const pyreflyClient = once(
192
192
 
193
193
  const lspClientOpts = {
194
194
  transport,
195
- rootUri: getLSPDocumentRootUri(),
196
- workspaceFolders: [],
195
+ rootUri: getLspRootUri(),
196
+ workspaceFolders: getLspWorkspaceFolders(),
197
197
  };
198
198
 
199
199
  // We wrap the client in a NotebookLanguageServerClient to add some
@@ -230,8 +230,8 @@ const pyrightClient = once((_: LSPConfig) => {
230
230
 
231
231
  const lspClientOpts = {
232
232
  transport,
233
- rootUri: getLSPDocumentRootUri(),
234
- workspaceFolders: [],
233
+ rootUri: getLspRootUri(),
234
+ workspaceFolders: getLspWorkspaceFolders(),
235
235
  };
236
236
 
237
237
  // We wrap the client in a NotebookLanguageServerClient to add some
@@ -12,6 +12,7 @@ import { cellId } from "@/__tests__/branded";
12
12
  import type { CellId } from "@/core/cells/ids";
13
13
  import { store } from "@/core/state/jotai";
14
14
  import { topologicalCodesAtom } from "../../copilot/getCodes";
15
+ import { lspWorkspaceAtom } from "@/core/saving/file-state";
15
16
  import { languageAdapterState } from "../../language/extension";
16
17
  import { PythonLanguageAdapter } from "../../language/languages/python";
17
18
  import { languageMetadataField } from "../../language/metadata";
@@ -285,6 +286,12 @@ describe("NotebookLanguageServerClient", () => {
285
286
  },
286
287
  };
287
288
  }
289
+ if (atom === lspWorkspaceAtom) {
290
+ return {
291
+ rootUri: "file:///project",
292
+ documentUri: "file:///project/__marimo_notebook__.py",
293
+ };
294
+ }
288
295
  return undefined;
289
296
  });
290
297
 
@@ -421,7 +428,7 @@ describe("NotebookLanguageServerClient", () => {
421
428
  expect(result).toEqual(mockCompletionResponse);
422
429
  expect(mockClient.textDocumentCompletion).toHaveBeenCalledWith(
423
430
  expect.objectContaining({
424
- textDocument: { uri: "file:///__marimo_notebook__.py" },
431
+ textDocument: { uri: "file:///project/__marimo_notebook__.py" },
425
432
  }),
426
433
  );
427
434
  });
@@ -3,7 +3,7 @@
3
3
  import type * as LSP from "vscode-languageserver-protocol";
4
4
  import { Objects } from "@/utils/objects";
5
5
  import type { ILanguageServerClient } from "./types";
6
- import { getLSPDocument } from "./utils";
6
+ import { getLspDocumentUri } from "./utils";
7
7
 
8
8
  function removeFalseyValues<T extends object>(obj: T): T {
9
9
  return Objects.filter(obj, (value) => value !== false && value !== null) as T;
@@ -20,7 +20,7 @@ export class FederatedLanguageServerClient implements ILanguageServerClient {
20
20
 
21
21
  constructor(clients: ILanguageServerClient[]) {
22
22
  this.clients = clients;
23
- this.documentUri = getLSPDocument();
23
+ this.documentUri = getLspDocumentUri();
24
24
  }
25
25
 
26
26
  onNotification(
@@ -22,7 +22,7 @@ import {
22
22
  type ILanguageServerClient,
23
23
  isClientWithNotify,
24
24
  } from "./types";
25
- import { getLSPDocument } from "./utils";
25
+ import { getLspDocumentUri } from "./utils";
26
26
 
27
27
  /**
28
28
  * Check if a variable name is private (starts with underscore but not dunder).
@@ -189,7 +189,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {
189
189
  EditorView | null | undefined
190
190
  > = defaultGetNotebookEditors,
191
191
  ) {
192
- this.documentUri = getLSPDocument();
192
+ this.documentUri = getLspDocumentUri();
193
193
  this.getNotebookEditors = getNotebookEditors;
194
194
  this.initialSettings = initialSettings;
195
195
  this.client = client;
@@ -1,11 +1,26 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
- import { getFilenameFromDOM } from "@/core/dom/htmlUtils";
3
- import { Paths } from "@/utils/paths";
2
+ import { lspWorkspaceAtom } from "@/core/saving/file-state";
3
+ import { store } from "@/core/state/jotai";
4
4
 
5
- export function getLSPDocument() {
6
- return `file://${getFilenameFromDOM() ?? "/__marimo_notebook__.py"}`;
5
+ export function getLspRootUri() {
6
+ const lspWorkspace = store.get(lspWorkspaceAtom);
7
+ // The backend provides rootUri for active notebook sessions.
8
+ // For non-notebook pages (home, gallery), lspWorkspace is null,
9
+ // so return a valid file URI fallback.
10
+ return lspWorkspace?.rootUri ?? "file:///";
7
11
  }
8
12
 
9
- export function getLSPDocumentRootUri() {
10
- return `file://${Paths.dirname(getFilenameFromDOM() ?? "/")}`;
13
+ export function getLspWorkspaceFolders() {
14
+ const lspWorkspace = store.get(lspWorkspaceAtom);
15
+ const rootUri = lspWorkspace?.rootUri;
16
+ // Return workspace folders only if rootUri is set; empty array otherwise.
17
+ return rootUri ? [{ uri: rootUri, name: "marimo" }] : [];
18
+ }
19
+
20
+ export function getLspDocumentUri() {
21
+ const lspWorkspace = store.get(lspWorkspaceAtom);
22
+ // The backend provides documentUri for active notebook sessions.
23
+ // For non-notebook pages (home, gallery), lspWorkspace is null,
24
+ // so return a valid file URI fallback.
25
+ return lspWorkspace?.documentUri ?? "file:///__marimo_notebook__.py";
11
26
  }
@@ -112,6 +112,56 @@ describe("PlotlyPlugin", () => {
112
112
  });
113
113
  });
114
114
 
115
+ it("clicking a box element triggers onClick", async () => {
116
+ const setValue = vi.fn<Setter<unknown>>();
117
+
118
+ render(
119
+ <Suspense fallback={null}>
120
+ <PlotlyComponent
121
+ figure={{
122
+ data: [{ type: "box" }],
123
+ layout: {},
124
+ frames: null,
125
+ }}
126
+ value={undefined}
127
+ setValue={setValue}
128
+ host={document.createElement("div")}
129
+ config={{}}
130
+ />
131
+ </Suspense>,
132
+ );
133
+
134
+ await waitFor(() => {
135
+ expect(capturedPlotProps).not.toBeNull();
136
+ });
137
+
138
+ act(() => {
139
+ capturedPlotProps?.onClick?.({
140
+ points: [
141
+ {
142
+ data: { type: "box" },
143
+ x: "Group A",
144
+ y: 3,
145
+ pointIndex: 0,
146
+ pointNumber: 0,
147
+ curveNumber: 0,
148
+ },
149
+ ],
150
+ });
151
+ });
152
+
153
+ expect(setValue).toHaveBeenCalledTimes(1);
154
+ const updater = setValue.mock.calls[0][0] as (value: unknown) => unknown;
155
+ expect(updater({})).toEqual({
156
+ selections: [],
157
+ points: [
158
+ { x: "Group A", y: 3, curveNumber: 0, pointNumber: 0, pointIndex: 0 },
159
+ ],
160
+ indices: [0],
161
+ range: undefined,
162
+ });
163
+ });
164
+
115
165
  it("clicking a violin element triggers onClick", async () => {
116
166
  const setValue = vi.fn<Setter<unknown>>();
117
167
 
@@ -102,6 +102,14 @@ describe("shouldHandleClickSelection", () => {
102
102
  expect(shouldHandleClickSelection([heatmapPoint])).toBe(true);
103
103
  });
104
104
 
105
+ it("accepts box clicks", () => {
106
+ const boxPoint = createPlotDatum({
107
+ data: { type: "box" },
108
+ });
109
+
110
+ expect(shouldHandleClickSelection([boxPoint])).toBe(true);
111
+ });
112
+
105
113
  it("accepts violin clicks", () => {
106
114
  const violinPoint = createPlotDatum({
107
115
  data: { type: "violin" },
@@ -126,6 +134,22 @@ describe("shouldHandleClickSelection", () => {
126
134
  expect(shouldHandleClickSelection([linePoint])).toBe(true);
127
135
  });
128
136
 
137
+ it("accepts funnel clicks", () => {
138
+ const funnelPoint = createPlotDatum({
139
+ data: { type: "funnel" },
140
+ });
141
+
142
+ expect(shouldHandleClickSelection([funnelPoint])).toBe(true);
143
+ });
144
+
145
+ it("accepts funnelarea clicks", () => {
146
+ const funnelAreaPoint = createPlotDatum({
147
+ data: { type: "funnelarea" },
148
+ });
149
+
150
+ expect(shouldHandleClickSelection([funnelAreaPoint])).toBe(true);
151
+ });
152
+
129
153
  it("accepts waterfall clicks", () => {
130
154
  const waterfallPoint = createPlotDatum({
131
155
  data: { type: "waterfall" },
@@ -214,6 +238,64 @@ describe("extractPoints", () => {
214
238
  expect(extractPoints([point])).toEqual([{ x: 1, y: 2, z: 3 }]);
215
239
  });
216
240
 
241
+ it("returns funnel-specific fields for funnel traces", () => {
242
+ const point = createPlotDatum({
243
+ x: 1000,
244
+ y: "Visit",
245
+ label: "Visit",
246
+ value: 1000,
247
+ percentInitial: 1.0,
248
+ percentPrevious: 1.0,
249
+ percentTotal: 1.0,
250
+ curveNumber: 0,
251
+ pointIndex: 0,
252
+ pointNumber: 0,
253
+ data: { type: "funnel" },
254
+ });
255
+
256
+ expect(extractPoints([point])).toEqual([
257
+ {
258
+ x: 1000,
259
+ y: "Visit",
260
+ label: "Visit",
261
+ value: 1000,
262
+ percentInitial: 1.0,
263
+ percentPrevious: 1.0,
264
+ percentTotal: 1.0,
265
+ curveNumber: 0,
266
+ pointIndex: 0,
267
+ pointNumber: 0,
268
+ },
269
+ ]);
270
+ });
271
+
272
+ it("returns funnelarea-specific fields without x/y for funnelarea traces", () => {
273
+ const point = createPlotDatum({
274
+ label: "Stage A",
275
+ value: 500,
276
+ percentInitial: 0.5,
277
+ percentPrevious: 0.8,
278
+ percentTotal: 0.5,
279
+ curveNumber: 0,
280
+ pointNumber: 1,
281
+ x: 99,
282
+ y: 99,
283
+ data: { type: "funnelarea" },
284
+ });
285
+
286
+ expect(extractPoints([point])).toEqual([
287
+ {
288
+ label: "Stage A",
289
+ value: 500,
290
+ percentInitial: 0.5,
291
+ percentPrevious: 0.8,
292
+ percentTotal: 0.5,
293
+ curveNumber: 0,
294
+ pointNumber: 1,
295
+ },
296
+ ]);
297
+ });
298
+
217
299
  it("returns x/y/pointIndex for waterfall clicks", () => {
218
300
  const point = createPlotDatum({
219
301
  x: "Revenue",