@marimo-team/frontend 0.22.5-dev22 → 0.22.5-dev24

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 (69) hide show
  1. package/dist/assets/{CellStatus-BlPM618y.js → CellStatus-CNNGwOIK.js} +1 -1
  2. package/dist/assets/{JsonOutput-fX_t4kob.js → JsonOutput-9XtRRx5l.js} +2 -2
  3. package/dist/assets/{MarimoErrorOutput-BWZIVKfh.js → MarimoErrorOutput-Bc9JufDr.js} +1 -1
  4. package/dist/assets/{RenderHTML-DHi_NcqM.js → RenderHTML-0dk6-mYI.js} +1 -1
  5. package/dist/assets/{add-cell-with-ai-BFWfrIDT.js → add-cell-with-ai-CLklC7KS.js} +1 -1
  6. package/dist/assets/{add-connection-dialog-DhD4Nslx.js → add-connection-dialog-ux7eCDRM.js} +1 -1
  7. package/dist/assets/{agent-panel-Db14RXuw.js → agent-panel-CiMrqUfl.js} +1 -1
  8. package/dist/assets/{ai-model-dropdown-DK0jvNeC.js → ai-model-dropdown-CRtaHcCu.js} +1 -1
  9. package/dist/assets/{app-config-button-ChOMoYZB.js → app-config-button-CnX21edo.js} +1 -1
  10. package/dist/assets/{cell-editor-ByEIKpU_.js → cell-editor-D7IQ3F4W.js} +1 -1
  11. package/dist/assets/{cell-link-Ci0BxazH.js → cell-link-CcAqXeeg.js} +1 -1
  12. package/dist/assets/{cells-CmiuS2Us.js → cells-EJo3u4za.js} +2 -2
  13. package/dist/assets/{chat-display-QHJlAad0.js → chat-display-BxDRpNsl.js} +1 -1
  14. package/dist/assets/{chat-panel-DdVD5b8J.js → chat-panel-dBoLqgjH.js} +1 -1
  15. package/dist/assets/{chat-ui-BAYy1pnJ.js → chat-ui-DdZo1L-v.js} +1 -1
  16. package/dist/assets/{column-preview-BD9FgWWN.js → column-preview-DrU255Z3.js} +1 -1
  17. package/dist/assets/{command-palette-_LjHuhEv.js → command-palette-n6NnK6GP.js} +1 -1
  18. package/dist/assets/{common-BTshJ1XI.js → common-Bty2yo-n.js} +1 -1
  19. package/dist/assets/{components-B6JSwyVJ.js → components-B8TZ_vT_.js} +1 -1
  20. package/dist/assets/{components-CLTwiWUR.js → components-Dh-L-jYg.js} +1 -1
  21. package/dist/assets/{datasource-DcKEJh0J.js → datasource-DY0N42ZB.js} +1 -1
  22. package/dist/assets/{dependency-graph-panel-_c0_a9O1.js → dependency-graph-panel-C23HsAdh.js} +1 -1
  23. package/dist/assets/{documentation-panel-CJQhh3mV.js → documentation-panel-okcEKCQM.js} +1 -1
  24. package/dist/assets/{download-CoP6Jndb.js → download-TSo32ofd.js} +1 -1
  25. package/dist/assets/{edit-page-B-QbMCYD.js → edit-page-RhmoqI7E.js} +3 -3
  26. package/dist/assets/{error-panel-sqHK1YIQ.js → error-panel-aq2j0jIa.js} +1 -1
  27. package/dist/assets/{file-explorer-panel-6pc2qA_Z.js → file-explorer-panel-CzYUz358.js} +1 -1
  28. package/dist/assets/{file-icons-D73064oq.js → file-icons-DBaXCICA.js} +1 -1
  29. package/dist/assets/{floating-outline-CztoJoAm.js → floating-outline-BTmyhMGv.js} +1 -1
  30. package/dist/assets/{focus-oWwbhXMU.js → focus-DXeddo75.js} +1 -1
  31. package/dist/assets/{form-Bfu7g23-.js → form-BiDLPu7R.js} +1 -1
  32. package/dist/assets/{home-page-qzErWwFK.js → home-page-BntiR5eS.js} +1 -1
  33. package/dist/assets/{hooks-BcJBkgfh.js → hooks-BgwM3Mb2.js} +1 -1
  34. package/dist/assets/{html-to-image-DRz7fjt_.js → html-to-image-BJiJlwQY.js} +1 -1
  35. package/dist/assets/{index-CQ0aAUTn.js → index-CMEhtk8a.js} +4 -4
  36. package/dist/assets/{kiosk-mode-mgrpFwQ-.js → kiosk-mode-JCcLyeoQ.js} +1 -1
  37. package/dist/assets/{layout-1KFHhkOF.js → layout-CF-7BNtf.js} +1 -1
  38. package/dist/assets/{logs-panel-BarTHrDL.js → logs-panel-BzhPrie8.js} +1 -1
  39. package/dist/assets/{markdown-renderer-BzPN8MW4.js → markdown-renderer-B9RsGqHb.js} +1 -1
  40. package/dist/assets/{name-cell-input-xHvjjUrD.js → name-cell-input-CYsY4A1G.js} +1 -1
  41. package/dist/assets/{outline-panel-D56eqBW2.js → outline-panel-BCAWCKi6.js} +1 -1
  42. package/dist/assets/{packages-panel-CRPKv2g1.js → packages-panel-5axf3DuF.js} +1 -1
  43. package/dist/assets/{panels-CVuW7WaC.js → panels-7-kbDRzv.js} +1 -1
  44. package/dist/assets/{process-output-DmjGMo3l.js → process-output-DqiZsqG9.js} +1 -1
  45. package/dist/assets/{readonly-python-code-CxvXDGBS.js → readonly-python-code-D8ITm60r.js} +1 -1
  46. package/dist/assets/{run-page-CfCgYWcm.js → run-page-9OQqe8IY.js} +1 -1
  47. package/dist/assets/{scratchpad-panel-CBMHZjXp.js → scratchpad-panel-DkqxnSH6.js} +1 -1
  48. package/dist/assets/{session-panel-maUzbOL4.js → session-panel-BuzMiMf3.js} +1 -1
  49. package/dist/assets/{snippets-panel-C87xXbH3.js → snippets-panel--mh2FUXA.js} +1 -1
  50. package/dist/assets/{state-DNRh59rT.js → state-6D_2UAw3.js} +1 -1
  51. package/dist/assets/{state-16EGv7AG.js → state-BDrig0S2.js} +1 -1
  52. package/dist/assets/{textarea-NrWjAX-x.js → textarea-Cfp3upzK.js} +1 -1
  53. package/dist/assets/{tracing-CEb8mD1j.js → tracing-BExYhl1z.js} +1 -1
  54. package/dist/assets/{tracing-panel-DbBjrYZR.js → tracing-panel-Co5DeX-F.js} +2 -2
  55. package/dist/assets/{useAddCell-DiOrQo7h.js → useAddCell-BaTlDxTu.js} +1 -1
  56. package/dist/assets/{useCellActionButton-DS91ZXRv.js → useCellActionButton-DftkIqUl.js} +1 -1
  57. package/dist/assets/{useDeleteCell-BGyrTpcv.js → useDeleteCell-d6yWnL3H.js} +1 -1
  58. package/dist/assets/{useDependencyPanelTab-Bn1hk2_w.js → useDependencyPanelTab-BaVcOBM4.js} +1 -1
  59. package/dist/assets/{useNotebookActions-ChawZjnl.js → useNotebookActions-DihtSJ4g.js} +1 -1
  60. package/dist/assets/{useRunCells-BbUvom42.js → useRunCells-d2edY6Tu.js} +1 -1
  61. package/dist/assets/{useSplitCell-B3Wpl0ev.js → useSplitCell-DOiFyMgH.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/components/editor/__tests__/Output.test.tsx +36 -1
  66. package/src/core/cells/__tests__/cells.test.ts +41 -0
  67. package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +38 -0
  68. package/src/core/cells/cells.ts +1 -1
  69. package/src/core/cells/collapseConsoleOutputs.tsx +3 -0
@@ -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-CmiuS2Us.js";import{t as N}from"./compiler-runtime-B3qBwwSJ.js";import{n as Wt,x as _t}from"./ai-model-dropdown-DK0jvNeC.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 Pt,x as At}from"./config-DoZCLcOb.js";import{t as It}from"./jsx-runtime-Blw4afVn.js";import{o as Et}from"./alert-dialog-CXspBRlP.js";import{a as Lt,c as fe,o as xe,s as Tt}from"./popover-AtoFZ7i4.js";import{a as Rt,c as $t,i as Ht,n as qt,r as Bt,s as Ft,t as Ot}from"./select--zcABebs.js";import{gt as Ut}from"./JsonOutput-fX_t4kob.js";import{c as De,d as ye,n as Vt,o as Yt,r as ke,t as Kt}from"./download-CoP6Jndb.js";import{m as Gt}from"./form-Bfu7g23-.js";import{t as Pe}from"./tooltip-DmqhBBs6.js";import{r as Ae,t as q}from"./button-BKVLeSTX.js";import{i as Jt,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,f as Xt,i as Le,m as Zt,p as Te,u as Re}from"./layout-1KFHhkOF.js";import{t as be}from"./check-B-sKate2.js";import{n as ea}from"./maps-B4xARV9R.js";import{r as ta}from"./useCellActionButton-DS91ZXRv.js";import{t as $e}from"./copy-DFMsQ6MJ.js";import{t as aa}from"./eye-off-DgRJ-xBZ.js";import{t as ae}from"./file-l37OnSN4.js";import{t as oa}from"./github-C3N4cuN4.js";import{n as na,r as sa,t as la}from"./youtube-D6LtMx2w.js";import{i as ia,n as He}from"./add-connection-dialog-DhD4Nslx.js";import{n as ra,t as da}from"./square-COtNnHUC.js";import{t as ca}from"./image-BgkzrnsX.js";import{t as ha}from"./link-dU_vDDSR.js";import{r as ma}from"./input-Bg12i6qY.js";import{t as pa}from"./settings-C1bg8A2T.js";import{t as ua}from"./sparkles-B79Qf6ma.js";import{y as fa}from"./textarea-NrWjAX-x.js";import{t as S}from"./use-toast-BDYuj3zG.js";import{n as qe,t as xa}from"./paths-BzSgteR-.js";import{o as ya}from"./session-DdnWW30b.js";import{n as F}from"./copy-Bizk-4hH.js";import{r as ka}from"./useRunCells-BbUvom42.js";import{a as Be,c as Fe,i as Oe,n as Ue,r as Ve}from"./dialog-BYjetQgE.js";import{n as we}from"./ImperativeModal-DoGv2BXV.js";import{r as ba,t as wa}from"./share-0LPgOyiW.js";import{a as ja}from"./cell-link-Ci0BxazH.js";import{a as ga}from"./renderShortcut-DrDh2657.js";import{t as va}from"./icons-DlzgV4KY.js";import{n as Ca}from"./marimo-icons-Dp8wmdDL.js";import{t as za}from"./links-C19POYUQ.js";import{r as Ma,t as Ye}from"./hooks-BcJBkgfh.js";import{t as Ke}from"./types-DOdUT9LT.js";var Wa=b("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),_a=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"}]]),Qe=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"}]]),Na=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"}]]),Sa=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"}]]),Da=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"}]]),Xe=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"}]]),Aa=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"}]]),Ia=b("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ze=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"}]]),Ea=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"}]]),La=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(It(),1);function Ta(){return"uvx marimo@latest"}function Ra(t,e,n){let o=n?" --with-token":"",s=`${Ta()} 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 $a(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var Ha="npx skills add marimo-team/marimo-pair";function qa(){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,{credentials:"include"}).then(Ba).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 Ba(t){return t.ok?t.json():null}const Fa=t=>{let e=(0,je.c)(32),{onClose:n}=t,[o,s]=(0,D.useState)("claude"),r=Pt(),i=qa(),l=!!i,d;e[0]!==o||e[1]!==l||e[2]!==r.httpURL?(d=Ra(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)(Fe,{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)(Ve,{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)(O,{command:Ha})]}),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)(Tt,{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)(O,{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)(O,{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)(O,{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)(Lt,{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)(O,{command:i,display:$a(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)(Oe,{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)(Ue,{className:"sm:max-w-lg",children:[p,v,M]}),e[29]=v,e[30]=M,e[31]=W):W=e[31],W};var O=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=Ae.stopPropagation(async x=>{x.preventDefault(),await F(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)(Pe,{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 Oa=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:Xt.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)(Fe,{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)(Ve,{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)(ma,{"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)(Ua,{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 F(l)},children:"Create"}),e[16]=l,e[17]=y);let k;e[18]!==w||e[19]!==y?(k=(0,a.jsxs)(Oe,{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)(Ue,{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 Ua=t=>{let e=(0,tt.c)(8),[n,o]=D.useState(!1),s;e[0]===t.text?s=e[1]:(s=Ae.stopPropagation(async c=>{c.preventDefault(),await F(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)(Pe,{content:"Copied!",open:n,children:l}),e[5]=n,e[6]=l,e[7]=d):d=e[7],d},Va=N();function Ya(){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 Ka(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,Va.c)(2),e=$(We),n;return t[0]===e?n=t[1]:(n=()=>{let o=Ya();e(s=>({mode:gt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ka(o)})})},t[0]=e,t[1]=n),n}const ot=ht(!1);var Ga=N();const Ja=()=>{let t=(0,Ga.c)(7),{selectedLayout:e}=Ee(),{setLayoutView:n}=Le();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)(Ft,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)($t,{placeholder:"Select a view"})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(qt,{children:(0,a.jsxs)(Bt,{children:[(0,a.jsx)(Rt,{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)(Ot,{"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 sa;case"slides":return Ze;default:return Jt(t),da}}function st(t){return Ie.startCase(t)}function Xa(t){return(0,a.jsx)(Ht,{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 Za(t){let{filename:e,preset:n,downloadPDF:o}=t;await o({filename:e,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var eo=N();function to(t){let e=(0,eo.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=xa.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."}),za(d)})}})},e[0]=o,e[1]=n,e[2]=s,e[3]=t,e[4]=r):r=e[4],r}const ao=()=>{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 oo=N();function lt(){let t=(0,oo.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)(Et,{onClick:async()=>{n({state:At.CLOSING}),await o(),ba()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=s):s=t[3],s}var no=N(),T=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function so(){var ve,Ce;let t=(0,no.c)(51),e=ja(),{openModal:n,closeModal:o}=we(),{toggleApplication:s}=Mt(),{selectedPanel:r}=xt(),[i]=ct(We),l=me(wt),d=ao(),[c]=Nt(),{updateCellConfig:m,undoDeleteCell:p,clearAllCellOutputs:h,addSetupCellIfDoesntExist:u,collapseAllCells:x,expandAllCells:w}=Me(),y=lt(),k=ka(),j=to(e),g=$(ot),z=$(Wt),v=$(_t),{exportAsIPYNB:M,exportAsMarkdown:W,readCode:_,saveCellConfig:se,updateCellOutputs:P}=B(),A=Ma(),le=me(yt),ie=me(vt),{selectedLayout:U}=Ee(),{setLayoutView:re}=Le(),V=at(),Y=((ve=c.sharing)==null?void 0:ve.html)??!0,K=((Ce=c.sharing)==null?void 0:Ce.wasm)??!0,ge=!ue(),de=U==="slides",it=Co,rt=vo,G;t[0]!==e||t[1]!==A||t[2]!==P?(G=async f=>{let{preset:C,title:R}=f;if(!e){ne();return}await De(R,async he=>{await Ye({takeScreenshots:()=>A({progress:he}),updateCellOutputs:P}),await Za({filename:e,preset:C,downloadPDF:Vt})})},t[0]=e,t[1]=A,t[2]=P,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(go,0),setTimeout(()=>window.dispatchEvent(C),0)},t[4]=I,t[5]=J);let Q=J,X;t[6]!==M||t[7]!==e||t[8]!==A||t[9]!==P?(X=async()=>{if(!e){ne();return}await De("Downloading IPYNB...",async f=>{await Ye({takeScreenshots:()=>A({progress:f}),updateCellOutputs:P});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]=A,t[9]=P,t[10]=X):X=t[10];let ce=X,Z;t[11]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,a.jsx)(Ut,{size:14,strokeWidth:1.5}),t[11]=Z):Z=t[11];let ee;t[12]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,a.jsx)(Te,{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]!==Q||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]!==U||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]!==V||t[47]!==p||t[48]!==m||t[49]!==i.mode?(te=[{icon:Z,label:"Download",handle:T,dropdown:[{icon:ee,label:"Download as HTML",handle:E},{icon:(0,a.jsx)(Te,{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)(va,{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)(Aa,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ce},{icon:(0,a.jsx)(Zt,{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)(ca,{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: ",ga("global.hideCode",!1)]}),handle:jo},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:Q},{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:Q}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Pair with an agent",handle:async()=>{n((0,a.jsx)(Fa,{onClose:o}))}},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Share",handle:T,hidden:!Y&&!K,dropdown:[{icon:(0,a.jsx)(Gt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!Y,handle:async()=>{n((0,a.jsx)(Oa,{onClose:o}))}},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!K,handle:async()=>{await F(wa({code:(await _()).contents})),S({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ia,{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)(Ze,{size:14,strokeWidth:1.5}),label:"Present as",handle:T,dropdown:[{icon:i.mode==="present"?(0,a.jsx)(fa,{size:14,strokeWidth:1.5}):(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{V()}},...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:U===f&&(0,a.jsx)(be,{size:14})}),handle:()=>{re(f),i.mode==="edit"&&V()}}})]},{icon:(0,a.jsx)(Sa,{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 F((await _()).contents),S({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(ta,{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(wo))});for(let C of f)m({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Qe,{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)(ia,{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)(La,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:y,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Na,{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)(aa,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(Wa,{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(bo)},{icon:(0,a.jsx)(Da,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(ko)},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>z(yo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Resources",handle:T,dropdown:[{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:xo},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"GitHub",handle:fo},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:uo},{icon:(0,a.jsx)(la,{size:14,strokeWidth:1.5}),label:"YouTube",handle:po},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:mo}]},{divider:!0,icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:ho},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:co}].filter(ro).map(lo),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]=Q,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]=U,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]=V,t[47]=p,t[48]=m,t[49]=i.mode,t[50]=te):te=t[50],te}function lo(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(io)}:t}function io(t){return!t.hidden}function ro(t){return!t.hidden}function co(){let t=ya();window.open(t,"_blank")}function ho(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function mo(){window.open(L.releasesPage,"_blank")}function po(){window.open(L.youtube,"_blank")}function uo(){window.open(L.discordLink,"_blank")}function fo(){window.open(L.githubPage,"_blank")}function xo(){window.open(L.docsPage,"_blank")}function yo(t){return!t}function ko(t){return!t}function bo(t){return!t}function wo(t){return[t,{disabled:!1}]}async function jo(){let t=document.getElementById("App");t&&await Yt({element:t,filename:document.title,prepare:Kt})}function go(){return window.print()}function vo(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 Co(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,Qe as c,ot as i,Je as l,lt as n,et as o,Ja as r,Xe as s,so 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-EJo3u4za.js";import{t as N}from"./compiler-runtime-B3qBwwSJ.js";import{n as Wt,x as _t}from"./ai-model-dropdown-CRtaHcCu.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 Pt,x as At}from"./config-DoZCLcOb.js";import{t as It}from"./jsx-runtime-Blw4afVn.js";import{o as Et}from"./alert-dialog-CXspBRlP.js";import{a as Lt,c as fe,o as xe,s as Tt}from"./popover-AtoFZ7i4.js";import{a as Rt,c as $t,i as Ht,n as qt,r as Bt,s as Ft,t as Ot}from"./select--zcABebs.js";import{gt as Ut}from"./JsonOutput-9XtRRx5l.js";import{c as De,d as ye,n as Vt,o as Yt,r as ke,t as Kt}from"./download-TSo32ofd.js";import{m as Gt}from"./form-BiDLPu7R.js";import{t as Pe}from"./tooltip-DmqhBBs6.js";import{r as Ae,t as q}from"./button-BKVLeSTX.js";import{i as Jt,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,f as Xt,i as Le,m as Zt,p as Te,u as Re}from"./layout-CF-7BNtf.js";import{t as be}from"./check-B-sKate2.js";import{n as ea}from"./maps-B4xARV9R.js";import{r as ta}from"./useCellActionButton-DftkIqUl.js";import{t as $e}from"./copy-DFMsQ6MJ.js";import{t as aa}from"./eye-off-DgRJ-xBZ.js";import{t as ae}from"./file-l37OnSN4.js";import{t as oa}from"./github-C3N4cuN4.js";import{n as na,r as sa,t as la}from"./youtube-D6LtMx2w.js";import{i as ia,n as He}from"./add-connection-dialog-ux7eCDRM.js";import{n as ra,t as da}from"./square-COtNnHUC.js";import{t as ca}from"./image-BgkzrnsX.js";import{t as ha}from"./link-dU_vDDSR.js";import{r as ma}from"./input-Bg12i6qY.js";import{t as pa}from"./settings-C1bg8A2T.js";import{t as ua}from"./sparkles-B79Qf6ma.js";import{y as fa}from"./textarea-Cfp3upzK.js";import{t as S}from"./use-toast-BDYuj3zG.js";import{n as qe,t as xa}from"./paths-BzSgteR-.js";import{o as ya}from"./session-DdnWW30b.js";import{n as F}from"./copy-Bizk-4hH.js";import{r as ka}from"./useRunCells-d2edY6Tu.js";import{a as Be,c as Fe,i as Oe,n as Ue,r as Ve}from"./dialog-BYjetQgE.js";import{n as we}from"./ImperativeModal-DoGv2BXV.js";import{r as ba,t as wa}from"./share-0LPgOyiW.js";import{a as ja}from"./cell-link-CcAqXeeg.js";import{a as ga}from"./renderShortcut-DrDh2657.js";import{t as va}from"./icons-DlzgV4KY.js";import{n as Ca}from"./marimo-icons-Dp8wmdDL.js";import{t as za}from"./links-C19POYUQ.js";import{r as Ma,t as Ye}from"./hooks-BgwM3Mb2.js";import{t as Ke}from"./types-DOdUT9LT.js";var Wa=b("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),_a=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"}]]),Qe=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"}]]),Na=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"}]]),Sa=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"}]]),Da=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"}]]),Xe=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"}]]),Aa=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"}]]),Ia=b("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Ze=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"}]]),Ea=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"}]]),La=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(It(),1);function Ta(){return"uvx marimo@latest"}function Ra(t,e,n){let o=n?" --with-token":"",s=`${Ta()} 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 $a(t){return t.length<=4?"****":`${"*".repeat(Math.min(t.length-4,8))}${t.slice(-4)}`}var Ha="npx skills add marimo-team/marimo-pair";function qa(){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,{credentials:"include"}).then(Ba).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 Ba(t){return t.ok?t.json():null}const Fa=t=>{let e=(0,je.c)(32),{onClose:n}=t,[o,s]=(0,D.useState)("claude"),r=Pt(),i=qa(),l=!!i,d;e[0]!==o||e[1]!==l||e[2]!==r.httpURL?(d=Ra(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)(Fe,{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)(Ve,{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)(O,{command:Ha})]}),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)(Tt,{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)(O,{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)(O,{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)(O,{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)(Lt,{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)(O,{command:i,display:$a(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)(Oe,{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)(Ue,{className:"sm:max-w-lg",children:[p,v,M]}),e[29]=v,e[30]=M,e[31]=W):W=e[31],W};var O=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=Ae.stopPropagation(async x=>{x.preventDefault(),await F(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)(Pe,{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 Oa=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:Xt.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)(Fe,{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)(Ve,{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)(ma,{"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)(Ua,{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 F(l)},children:"Create"}),e[16]=l,e[17]=y);let k;e[18]!==w||e[19]!==y?(k=(0,a.jsxs)(Oe,{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)(Ue,{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 Ua=t=>{let e=(0,tt.c)(8),[n,o]=D.useState(!1),s;e[0]===t.text?s=e[1]:(s=Ae.stopPropagation(async c=>{c.preventDefault(),await F(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)(Pe,{content:"Copied!",open:n,children:l}),e[5]=n,e[6]=l,e[7]=d):d=e[7],d},Va=N();function Ya(){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 Ka(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,Va.c)(2),e=$(We),n;return t[0]===e?n=t[1]:(n=()=>{let o=Ya();e(s=>({mode:gt(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ka(o)})})},t[0]=e,t[1]=n),n}const ot=ht(!1);var Ga=N();const Ja=()=>{let t=(0,Ga.c)(7),{selectedLayout:e}=Ee(),{setLayoutView:n}=Le();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)(Ft,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)($t,{placeholder:"Select a view"})}),t[2]=s):s=t[2];let r;t[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(qt,{children:(0,a.jsxs)(Bt,{children:[(0,a.jsx)(Rt,{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)(Ot,{"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 sa;case"slides":return Ze;default:return Jt(t),da}}function st(t){return Ie.startCase(t)}function Xa(t){return(0,a.jsx)(Ht,{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 Za(t){let{filename:e,preset:n,downloadPDF:o}=t;await o({filename:e,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var eo=N();function to(t){let e=(0,eo.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=xa.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."}),za(d)})}})},e[0]=o,e[1]=n,e[2]=s,e[3]=t,e[4]=r):r=e[4],r}const ao=()=>{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 oo=N();function lt(){let t=(0,oo.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)(Et,{onClick:async()=>{n({state:At.CLOSING}),await o(),ba()},"aria-label":"Confirm Restart",children:"Restart"})})},t[0]=e,t[1]=o,t[2]=n,t[3]=s):s=t[3],s}var no=N(),T=t=>{t==null||t.preventDefault(),t==null||t.stopPropagation()};function so(){var ve,Ce;let t=(0,no.c)(51),e=ja(),{openModal:n,closeModal:o}=we(),{toggleApplication:s}=Mt(),{selectedPanel:r}=xt(),[i]=ct(We),l=me(wt),d=ao(),[c]=Nt(),{updateCellConfig:m,undoDeleteCell:p,clearAllCellOutputs:h,addSetupCellIfDoesntExist:u,collapseAllCells:x,expandAllCells:w}=Me(),y=lt(),k=ka(),j=to(e),g=$(ot),z=$(Wt),v=$(_t),{exportAsIPYNB:M,exportAsMarkdown:W,readCode:_,saveCellConfig:se,updateCellOutputs:P}=B(),A=Ma(),le=me(yt),ie=me(vt),{selectedLayout:U}=Ee(),{setLayoutView:re}=Le(),V=at(),Y=((ve=c.sharing)==null?void 0:ve.html)??!0,K=((Ce=c.sharing)==null?void 0:Ce.wasm)??!0,ge=!ue(),de=U==="slides",it=Co,rt=vo,G;t[0]!==e||t[1]!==A||t[2]!==P?(G=async f=>{let{preset:C,title:R}=f;if(!e){ne();return}await De(R,async he=>{await Ye({takeScreenshots:()=>A({progress:he}),updateCellOutputs:P}),await Za({filename:e,preset:C,downloadPDF:Vt})})},t[0]=e,t[1]=A,t[2]=P,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(go,0),setTimeout(()=>window.dispatchEvent(C),0)},t[4]=I,t[5]=J);let Q=J,X;t[6]!==M||t[7]!==e||t[8]!==A||t[9]!==P?(X=async()=>{if(!e){ne();return}await De("Downloading IPYNB...",async f=>{await Ye({takeScreenshots:()=>A({progress:f}),updateCellOutputs:P});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]=A,t[9]=P,t[10]=X):X=t[10];let ce=X,Z;t[11]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,a.jsx)(Ut,{size:14,strokeWidth:1.5}),t[11]=Z):Z=t[11];let ee;t[12]===Symbol.for("react.memo_cache_sentinel")?(ee=(0,a.jsx)(Te,{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]!==Q||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]!==U||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]!==V||t[47]!==p||t[48]!==m||t[49]!==i.mode?(te=[{icon:Z,label:"Download",handle:T,dropdown:[{icon:ee,label:"Download as HTML",handle:E},{icon:(0,a.jsx)(Te,{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)(va,{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)(Aa,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:ce},{icon:(0,a.jsx)(Zt,{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)(ca,{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: ",ga("global.hideCode",!1)]}),handle:jo},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:Q},{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:Q}]},{icon:(0,a.jsx)(ua,{size:14,strokeWidth:1.5}),label:"Pair with an agent",handle:async()=>{n((0,a.jsx)(Fa,{onClose:o}))}},{icon:(0,a.jsx)(Ea,{size:14,strokeWidth:1.5}),label:"Share",handle:T,hidden:!Y&&!K,dropdown:[{icon:(0,a.jsx)(Gt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!Y,handle:async()=>{n((0,a.jsx)(Oa,{onClose:o}))}},{icon:(0,a.jsx)(ha,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!K,handle:async()=>{await F(wa({code:(await _()).contents})),S({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ia,{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)(Ze,{size:14,strokeWidth:1.5}),label:"Present as",handle:T,dropdown:[{icon:i.mode==="present"?(0,a.jsx)(fa,{size:14,strokeWidth:1.5}):(0,a.jsx)(Xe,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{V()}},...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:U===f&&(0,a.jsx)(be,{size:14})}),handle:()=>{re(f),i.mode==="edit"&&V()}}})]},{icon:(0,a.jsx)(Sa,{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 F((await _()).contents),S({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(ta,{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(wo))});for(let C of f)m({cellId:C,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(Qe,{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)(ia,{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)(La,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:y,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(Na,{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)(aa,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(_a,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:x,redundant:!0},{icon:(0,a.jsx)(Wa,{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(bo)},{icon:(0,a.jsx)(Da,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>v(ko)},{icon:(0,a.jsx)(pa,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>z(yo),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(ea,{size:14,strokeWidth:1.5}),label:"Resources",handle:T,dropdown:[{icon:(0,a.jsx)(zt,{size:14,strokeWidth:1.5}),label:"Documentation",handle:xo},{icon:(0,a.jsx)(oa,{size:14,strokeWidth:1.5}),label:"GitHub",handle:fo},{icon:(0,a.jsx)(na,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:uo},{icon:(0,a.jsx)(la,{size:14,strokeWidth:1.5}),label:"YouTube",handle:po},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:mo}]},{divider:!0,icon:(0,a.jsx)(ra,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:ho},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:co}].filter(ro).map(lo),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]=Q,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]=U,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]=V,t[47]=p,t[48]=m,t[49]=i.mode,t[50]=te):te=t[50],te}function lo(t){return t.dropdown?{...t,dropdown:t.dropdown.filter(io)}:t}function io(t){return!t.hidden}function ro(t){return!t.hidden}function co(){let t=ya();window.open(t,"_blank")}function ho(){let t=document.baseURI.split("?")[0];window.open(t,"_self")}function mo(){window.open(L.releasesPage,"_blank")}function po(){window.open(L.youtube,"_blank")}function uo(){window.open(L.discordLink,"_blank")}function fo(){window.open(L.githubPage,"_blank")}function xo(){window.open(L.docsPage,"_blank")}function yo(t){return!t}function ko(t){return!t}function bo(t){return!t}function wo(t){return[t,{disabled:!1}]}async function jo(){let t=document.getElementById("App");t&&await Yt({element:t,filename:document.title,prepare:Kt})}function go(){return window.print()}function vo(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 Co(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,Qe as c,ot as i,Je as l,lt as n,et as o,Ja as r,Xe as s,so 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-CmiuS2Us.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-EJo3u4za.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-CmiuS2Us.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-BGyrTpcv.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-EJo3u4za.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-d6yWnL3H.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-CQ0aAUTn.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-CMEhtk8a.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-CmiuS2Us.js">
137
+ <link rel="modulepreload" crossorigin href="./assets/cells-EJo3u4za.js">
138
138
  <link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-dxChUL02.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-Bg12i6qY.js">
150
150
  <link rel="modulepreload" crossorigin href="./assets/ImperativeModal-DoGv2BXV.js">
151
- <link rel="modulepreload" crossorigin href="./assets/cell-link-Ci0BxazH.js">
151
+ <link rel="modulepreload" crossorigin href="./assets/cell-link-CcAqXeeg.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-BbUvom42.js">
157
+ <link rel="modulepreload" crossorigin href="./assets/useRunCells-d2edY6Tu.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-BGs1Pbai.js">
161
- <link rel="modulepreload" crossorigin href="./assets/RenderHTML-DHi_NcqM.js">
162
- <link rel="modulepreload" crossorigin href="./assets/datasource-DcKEJh0J.js">
163
- <link rel="modulepreload" crossorigin href="./assets/state-16EGv7AG.js">
161
+ <link rel="modulepreload" crossorigin href="./assets/RenderHTML-0dk6-mYI.js">
162
+ <link rel="modulepreload" crossorigin href="./assets/datasource-DY0N42ZB.js">
163
+ <link rel="modulepreload" crossorigin href="./assets/state-BDrig0S2.js">
164
164
  <link rel="modulepreload" crossorigin href="./assets/sparkles-B79Qf6ma.js">
165
- <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-BWZIVKfh.js">
165
+ <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-Bc9JufDr.js">
166
166
  <link rel="modulepreload" crossorigin href="./assets/spinner-C5wIpWgQ.js">
167
- <link rel="modulepreload" crossorigin href="./assets/html-to-image-DRz7fjt_.js">
168
- <link rel="modulepreload" crossorigin href="./assets/focus-oWwbhXMU.js">
167
+ <link rel="modulepreload" crossorigin href="./assets/html-to-image-BJiJlwQY.js">
168
+ <link rel="modulepreload" crossorigin href="./assets/focus-DXeddo75.js">
169
169
  <link rel="modulepreload" crossorigin href="./assets/useAsyncData-aCoWDe-l.js">
170
170
  <link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-CoYqQxHb.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-BzPN8MW4.js">
173
+ <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-B9RsGqHb.js">
174
174
  <link rel="modulepreload" crossorigin href="./assets/command-DvF_4mQa.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-CoP6Jndb.js">
177
+ <link rel="modulepreload" crossorigin href="./assets/download-TSo32ofd.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-bXc_9BBZ.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-fX_t4kob.js">
196
+ <link rel="modulepreload" crossorigin href="./assets/JsonOutput-9XtRRx5l.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-B6JSwyVJ.js">
203
- <link rel="modulepreload" crossorigin href="./assets/column-preview-BD9FgWWN.js">
202
+ <link rel="modulepreload" crossorigin href="./assets/components-B8TZ_vT_.js">
203
+ <link rel="modulepreload" crossorigin href="./assets/column-preview-DrU255Z3.js">
204
204
  <link rel="modulepreload" crossorigin href="./assets/icons-DlzgV4KY.js">
205
- <link rel="modulepreload" crossorigin href="./assets/floating-outline-CztoJoAm.js">
206
- <link rel="modulepreload" crossorigin href="./assets/useAddCell-DiOrQo7h.js">
205
+ <link rel="modulepreload" crossorigin href="./assets/floating-outline-BTmyhMGv.js">
206
+ <link rel="modulepreload" crossorigin href="./assets/useAddCell-BaTlDxTu.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-CxvXDGBS.js">
211
+ <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-D8ITm60r.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-D73064oq.js">
215
+ <link rel="modulepreload" crossorigin href="./assets/file-icons-DBaXCICA.js">
216
216
  <link rel="modulepreload" crossorigin href="./assets/switch-C6xjg01T.js">
217
217
  <link rel="modulepreload" crossorigin href="./assets/events-Qeh-bHlj.js">
218
218
  <link rel="modulepreload" crossorigin href="./assets/globals-DQM2RvzM.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-DNRh59rT.js">
224
+ <link rel="modulepreload" crossorigin href="./assets/state-6D_2UAw3.js">
225
225
  <link rel="modulepreload" crossorigin href="./assets/label-C89F4v17.js">
226
- <link rel="modulepreload" crossorigin href="./assets/textarea-NrWjAX-x.js">
226
+ <link rel="modulepreload" crossorigin href="./assets/textarea-Cfp3upzK.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-Bfu7g23-.js">
229
+ <link rel="modulepreload" crossorigin href="./assets/form-BiDLPu7R.js">
230
230
  <link rel="modulepreload" crossorigin href="./assets/renderShortcut-DrDh2657.js">
231
231
  <link rel="modulepreload" crossorigin href="./assets/field-DTzXkFLZ.js">
232
232
  <link rel="modulepreload" crossorigin href="./assets/RSPContexts-LWFBF00h.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.22.5-dev22",
3
+ "version": "0.22.5-dev24",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -367,7 +367,7 @@ export const OutputArea = React.memo(
367
367
  forceExpand,
368
368
  className,
369
369
  }: OutputAreaProps) => {
370
- if (output === null) {
370
+ if (output == null) {
371
371
  return null;
372
372
  }
373
373
  if (output.channel === "output" && output.data === "") {
@@ -1,7 +1,9 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
  import { render, screen } from "@testing-library/react";
3
3
  import { describe, expect, it } from "vitest";
4
- import { OutputRenderer } from "../Output";
4
+ import { cellId } from "@/__tests__/branded";
5
+ import { TooltipProvider } from "@/components/ui/tooltip";
6
+ import { OutputArea, OutputRenderer } from "../Output";
5
7
 
6
8
  describe("OutputRenderer renderFallback prop", () => {
7
9
  it("should use renderFallback for unsupported mimetypes", () => {
@@ -65,6 +67,39 @@ describe("OutputRenderer renderFallback prop", () => {
65
67
  });
66
68
  });
67
69
 
70
+ describe("OutputArea null/undefined handling", () => {
71
+ it("should render null when output is null", () => {
72
+ const { container } = render(
73
+ <TooltipProvider>
74
+ <OutputArea
75
+ output={null}
76
+ cellId={cellId("test")}
77
+ stale={false}
78
+ loading={false}
79
+ allowExpand={true}
80
+ />
81
+ </TooltipProvider>,
82
+ );
83
+ expect(container.innerHTML).toBe("");
84
+ });
85
+
86
+ it("should render null when output is undefined", () => {
87
+ const { container } = render(
88
+ <TooltipProvider>
89
+ <OutputArea
90
+ // @ts-expect-error -- testing runtime safety for undefined output
91
+ output={undefined}
92
+ cellId={cellId("test")}
93
+ stale={false}
94
+ loading={false}
95
+ allowExpand={true}
96
+ />
97
+ </TooltipProvider>,
98
+ );
99
+ expect(container.innerHTML).toBe("");
100
+ });
101
+ });
102
+
68
103
  describe("OutputRenderer image and SVG rendering", () => {
69
104
  const plainSvgString =
70
105
  '<svg><rect x="0" y="0" width="10" height="10"></rect></svg>';
@@ -1209,6 +1209,47 @@ describe("cell reducer", () => {
1209
1209
  ]);
1210
1210
  });
1211
1211
 
1212
+ it("does not crash when setStdinResponse has out-of-bounds outputIndex", () => {
1213
+ const STDOUT: OutputMessage = {
1214
+ channel: "stdout",
1215
+ mimetype: "text/plain",
1216
+ data: "hello!",
1217
+ timestamp: 1,
1218
+ };
1219
+
1220
+ // Set the cell to running with a console output
1221
+ actions.prepareForRun({ cellId: firstCellId });
1222
+ actions.handleCellMessage({
1223
+ cell_id: firstCellId,
1224
+ output: undefined,
1225
+ console: null,
1226
+ status: "running",
1227
+ stale_inputs: null,
1228
+ timestamp: new Date(20).getTime() as Seconds,
1229
+ });
1230
+ actions.handleCellMessage({
1231
+ cell_id: firstCellId,
1232
+ output: undefined,
1233
+ console: STDOUT,
1234
+ status: undefined,
1235
+ stale_inputs: null,
1236
+ timestamp: new Date(22).getTime() as Seconds,
1237
+ });
1238
+
1239
+ // Try to set stdin response with an out-of-bounds index
1240
+ // This should not crash - it should return state unchanged
1241
+ actions.setStdinResponse({
1242
+ response: "test",
1243
+ cellId: firstCellId,
1244
+ outputIndex: 999,
1245
+ });
1246
+
1247
+ // Cell state should be unchanged
1248
+ const cell = cells[0];
1249
+ expect(cell.consoleOutputs).toHaveLength(1);
1250
+ expect(cell.consoleOutputs[0]).toMatchObject(STDOUT);
1251
+ });
1252
+
1212
1253
  it("can receive console when the cell is idle and will clear when starts again", () => {
1213
1254
  const OLD_STDOUT: OutputMessage = {
1214
1255
  channel: "stdout",
@@ -241,6 +241,44 @@ describe("collapseConsoleOutputs", () => {
241
241
  expect(result[2].data).toBe("<pre>E\nF\nG\nH\n</pre>");
242
242
  });
243
243
 
244
+ it("should not crash when truncating with a single output at the limit boundary", () => {
245
+ // Create outputs that push truncation to the exact boundary
246
+ const consoleOutputs: OutputMessage[] = [
247
+ {
248
+ mimetype: "text/html",
249
+ channel: "output",
250
+ data: "<div>html1</div>",
251
+ timestamp: 0,
252
+ },
253
+ {
254
+ mimetype: "text/html",
255
+ channel: "output",
256
+ data: "<div>html2</div>",
257
+ timestamp: 0,
258
+ },
259
+ ];
260
+ // With limit=1, truncation must handle edge cases gracefully
261
+ const result = collapseConsoleOutputs(consoleOutputs, 1);
262
+ expect(result[0].data).toContain("Streaming output truncated");
263
+ });
264
+
265
+ it("should handle truncation when cutoff indexes past the end of the array", () => {
266
+ // With maxLines=0, the truncation loop never runs, causing cutoff
267
+ // to index past the array. This exercises the `output == null`
268
+ // defensive branch in truncateHead().
269
+ const consoleOutputs: OutputMessage[] = [
270
+ {
271
+ mimetype: "text/html",
272
+ channel: "output",
273
+ data: "<div>content</div>",
274
+ timestamp: 0,
275
+ },
276
+ ];
277
+ const result = collapseConsoleOutputs(consoleOutputs, 0);
278
+ expect(result).toHaveLength(1);
279
+ expect(result[0].data).toContain("Streaming output truncated");
280
+ });
281
+
244
282
  describe("ANSI escape sequences", () => {
245
283
  it("should handle cursor movement with collapse", () => {
246
284
  const consoleOutputs: OutputMessage[] = [
@@ -947,7 +947,7 @@ const {
947
947
  cellReducer: (cell) => {
948
948
  const consoleOutputs = [...cell.consoleOutputs];
949
949
  const stdinOutput = consoleOutputs[outputIndex];
950
- if (stdinOutput.channel !== "stdin") {
950
+ if (stdinOutput == null || stdinOutput.channel !== "stdin") {
951
951
  Logger.warn("Expected stdin output");
952
952
  return cell;
953
953
  }
@@ -108,6 +108,9 @@ function truncateHead(consoleOutputs: OutputMessage[], limit: number) {
108
108
  timestamp: -1,
109
109
  };
110
110
  const output = consoleOutputs[cutoff];
111
+ if (output == null) {
112
+ return [warningOutput, ...consoleOutputs.slice(cutoff + 1)];
113
+ }
111
114
  if (output.mimetype === "text/plain") {
112
115
  invariant(typeof output.data === "string", "expected string");
113
116
  const outputLines = output.data.split("\n");