@marimo-team/frontend 0.20.5-dev83 → 0.20.5-dev87

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 (48) hide show
  1. package/dist/assets/{JsonOutput-BRjuq1Jw.js → JsonOutput-DjokO226.js} +1 -1
  2. package/dist/assets/{LazyAnyLanguageCodeMirror-CwbmGJrl.js → LazyAnyLanguageCodeMirror-Cqo8_z2X.js} +2 -2
  3. package/dist/assets/{RenderHTML-B0MiHkXS.js → RenderHTML-ncKzTdNN.js} +1 -1
  4. package/dist/assets/{add-cell-with-ai-BC41mi_U.js → add-cell-with-ai-Bl1TJ3Bp.js} +1 -1
  5. package/dist/assets/{agent-panel-CXdo6rmq.js → agent-panel-DFVcMxMV.js} +1 -1
  6. package/dist/assets/{ai-model-dropdown-V-_6L1Ri.js → ai-model-dropdown-DxpOlTBW.js} +1 -1
  7. package/dist/assets/{any-language-editor-BsZ7S7c3.js → any-language-editor-TJ9GwX4u.js} +1 -1
  8. package/dist/assets/{app-config-button-bSfCHsrZ.js → app-config-button-zy3OAtTs.js} +1 -1
  9. package/dist/assets/{cell-editor-BphfP1AG.js → cell-editor-CSaoLcvI.js} +1 -1
  10. package/dist/assets/{chat-display-Dv9VfU7V.js → chat-display-CWCYGDhk.js} +1 -1
  11. package/dist/assets/{chat-panel-BMoo_OFn.js → chat-panel-CYOmGmIc.js} +1 -1
  12. package/dist/assets/{column-preview-DBQzaLrY.js → column-preview-UqRUB1pJ.js} +1 -1
  13. package/dist/assets/{command-palette-D-iipine.js → command-palette-CQFQWyFs.js} +1 -1
  14. package/dist/assets/{common-Msb-h79F.js → common-D7Sae5Jl.js} +1 -1
  15. package/dist/assets/{context-aware-panel-CaZEaV8C.js → context-aware-panel-DScGcWey.js} +1 -1
  16. package/dist/assets/copy-BvFGCBvy.js +1 -0
  17. package/dist/assets/{copy-icon-Cu7az85f.js → copy-icon-HTFh4odu.js} +1 -1
  18. package/dist/assets/{dependency-graph-panel-RAEDBSLL.js → dependency-graph-panel-Cg4IqU-y.js} +1 -1
  19. package/dist/assets/{documentation-panel-B5ZS7rdM.js → documentation-panel-D5CHwsu6.js} +1 -1
  20. package/dist/assets/{edit-page-CfrFWBII.js → edit-page-BQEJKlvv.js} +7 -7
  21. package/dist/assets/{file-explorer-panel-DiJOGwKe.js → file-explorer-panel-DclnBp04.js} +1 -1
  22. package/dist/assets/{glide-data-editor-UlfiEtnp.js → glide-data-editor-caCB-p9t.js} +1 -1
  23. package/dist/assets/{home-page-2mWoP4xq.js → home-page-Cz5JcEtF.js} +1 -1
  24. package/dist/assets/{hooks-ChoVWWrC.js → hooks-BOa-vQTI.js} +1 -1
  25. package/dist/assets/{index-D3l50M_C.js → index-lo-_Mee6.js} +4 -4
  26. package/dist/assets/{layout-OuSaBBrA.js → layout-BOEBdVW9.js} +3 -3
  27. package/dist/assets/{markdown-renderer-D2_DEfz5.js → markdown-renderer-DwRjZSV8.js} +1 -1
  28. package/dist/assets/{packages-panel-BGH4NaYQ.js → packages-panel-CPHdKpTu.js} +1 -1
  29. package/dist/assets/{panels-Z0QtbAii.js → panels-BfLG6GHU.js} +1 -1
  30. package/dist/assets/{readonly-python-code-YmScI7wz.js → readonly-python-code-Cyn1aSna.js} +1 -1
  31. package/dist/assets/{run-page-D5R165Vz.js → run-page-lC8nyJai.js} +1 -1
  32. package/dist/assets/{scratchpad-panel-Dx0D4qLp.js → scratchpad-panel-B1HOh6tu.js} +1 -1
  33. package/dist/assets/{secrets-panel-DbkurO8B.js → secrets-panel-Bd4T4aNP.js} +1 -1
  34. package/dist/assets/{session-panel-D2vq8N6n.js → session-panel-3pPZOei4.js} +1 -1
  35. package/dist/assets/{snippets-panel-BReCSuHT.js → snippets-panel-DVBJJk2i.js} +1 -1
  36. package/dist/assets/{terminal-D3Lu-b1F.js → terminal-D7RRO5NO.js} +1 -1
  37. package/dist/assets/{useBoolean-DbIYzMhl.js → useBoolean-COWWzCBr.js} +1 -1
  38. package/dist/assets/{useCellActionButton-5K5fLTMd.js → useCellActionButton-DFS0hpsU.js} +1 -1
  39. package/dist/assets/{useDependencyPanelTab-CVeDMlz5.js → useDependencyPanelTab-Dakjo7fJ.js} +1 -1
  40. package/dist/assets/{useNotebookActions-CFogiTi9.js → useNotebookActions-CtiT4Mzf.js} +1 -1
  41. package/dist/index.html +14 -14
  42. package/package.json +1 -1
  43. package/src/components/editor/cell/cell-context-menu.tsx +2 -6
  44. package/src/components/editor/output/console/ConsoleOutput.tsx +51 -2
  45. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +94 -3
  46. package/src/utils/__tests__/copy.test.ts +129 -0
  47. package/src/utils/copy.ts +43 -0
  48. package/dist/assets/copy-f2iEg0yL.js +0 -1
@@ -1 +1 @@
1
- import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as x}from"./useEvent-O0nX5vok.js";import{Bn as de,Fn as ne,T as se,ar as re,bi as ce,cr as he,ir as me,lt as pe,mt as ke,or as fe,v as ue,wt as K}from"./cells-wT6clfi5.js";import{t as ye}from"./compiler-runtime-B3qBwwSJ.js";import{a as be,o as xe,r as je}from"./utils-BvPM6Bro.js";import{t as ve}from"./jsx-runtime-icT_Ltz2.js";import{r as Ce}from"./requests-Bgjtqo_1.js";import{t as f}from"./createLucideIcon-Cm-Z7dYr.js";import{n as V,r as G}from"./x-BI1M8X_v.js";import{a as ge,h as Ie}from"./download-RVcmZh1N.js";import{t as we}from"./chevron-right-D0GQBpTb.js";import{t as Q}from"./circle-plus-CGG-gArM.js";import{t as ze}from"./code-xml-DwHPF_nL.js";import{t as We}from"./eye-off-vwi9L975.js";import{t as Me}from"./image-DXfkah9d.js";import{t as _e}from"./link-Cf10mh3t.js";import{t as Te}from"./play-DKSqmedg.js";import{a as Ae,n as Se}from"./state-BN6sGgkm.js";import{t as Ne}from"./trash-2-CAoNMkjq.js";import{t as Be}from"./use-toast-Hc8CXlvz.js";import{a as De,c as Re,n as Ee}from"./dialog-DCGn-_Ip.js";import{n as He}from"./ImperativeModal-b5nJtLod.js";import{t as Oe}from"./copy-f2iEg0yL.js";import{r as F}from"./html-to-image-DBFAQbWm.js";import{t as Pe}from"./label-BuJDtc39.js";import{t as Ue}from"./useDeleteCell-CmX8_XRr.js";import{n as qe,t as Le}from"./icons-T5yQRjuT.js";import{n as $}from"./name-cell-input-BhRgpz9L.js";import{t as J}from"./multi-icon-DpydcgWs.js";import{t as Fe}from"./useSplitCell-CZQNZZ7B.js";var X=f("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Y=f("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Z=f("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Ke=f("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),ee=f("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),le=f("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Ve(a){let e=new URL(window.location.href);return e.hash=`scrollTo=${encodeURIComponent(a)}`,e.toString()}function Ge(a){var c;let e=(c=a.match(/scrollTo=([^&]+)/))==null?void 0:c[1];return e?decodeURIComponent(e.split("&")[0]):null}function te(a){return a==="_"?!1:!!(a&&a.trim().length>0)}var Qe=ye(),l=ae(ve(),1);function $e(a){let e=(0,Qe.c)(47),{cell:c,closePopover:u}=a,{createNewCell:h,updateCellConfig:n,updateCellName:j,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:T,markUntouched:A}=se(),S=Fe(),N=ke(c==null?void 0:c.cellId),B=!x(ue),D=Ue(),{openModal:v}=He(),R=ie(Se),E=x(je),y=x(xe),oe=x(pe),b=x(be),{saveCellConfig:s}=Ce();if(!c||oe){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0],t}let{cellId:o,config:i,getEditorView:r,name:m,hasOutput:C,hasConsoleOutput:H,status:O}=c,g;e[1]!==o||e[2]!==i.disabled||e[3]!==s||e[4]!==n?(g=async()=>{let t={disabled:!i.disabled};await s({configs:{[o]:t}}),n({cellId:o,config:t})},e[1]=o,e[2]=i.disabled,e[3]=s,e[4]=n,e[5]=g):g=e[5];let P=g,I;e[6]!==o||e[7]!==i.hide_code||e[8]!==r||e[9]!==s||e[10]!==n?(I=async()=>{let t={hide_code:!i.hide_code};await s({configs:{[o]:t}}),n({cellId:o,config:t});let L=r();L&&(t.hide_code?L.contentDOM.blur():L.focus())},e[6]=o,e[7]=i.hide_code,e[8]=r,e[9]=s,e[10]=n,e[11]=I):I=e[11];let U=I,d=o===ce,w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,l.jsx)(Te,{size:13,strokeWidth:1.5}),e[12]=w):w=e[12];let q=O==="running"||O==="queued"||O==="disabled-transitively"||i.disabled,k;e[13]===N?k=e[14]:(k=()=>N(),e[13]=N,e[14]=k);let z;return e[15]!==_||e[16]!==E||e[17]!==b||e[18]!==y||e[19]!==B||e[20]!==o||e[21]!==T||e[22]!==u||e[23]!==i.disabled||e[24]!==i.hide_code||e[25]!==h||e[26]!==D||e[27]!==r||e[28]!==H||e[29]!==C||e[30]!==d||e[31]!==A||e[32]!==p||e[33]!==m||e[34]!==v||e[35]!==s||e[36]!==M||e[37]!==W||e[38]!==R||e[39]!==S||e[40]!==q||e[41]!==k||e[42]!==P||e[43]!==U||e[44]!==n||e[45]!==j?(z=[[{icon:w,label:"Run cell",hotkey:"cell.run",hidden:q,redundant:!0,handle:k},{icon:(0,l.jsx)(Ae,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!E,handle:()=>{R(t=>(t==null?void 0:t.cellId)===o?null:{cellId:o})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Z,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>S({cellId:o})},{icon:(0,l.jsx)(ze,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let t=r();t&&de({[o]:t})}},{icon:i.hide_code?(0,l.jsx)(me,{size:13,strokeWidth:1.5}):(0,l.jsx)(We,{size:13,strokeWidth:1.5}),label:i.hide_code?"Show code":"Hide code",handle:U,hotkey:"cell.hideCode"},{icon:i.disabled?(0,l.jsx)(ee,{size:13,strokeWidth:1.5}):(0,l.jsx)(le,{size:13,strokeWidth:1.5}),label:i.disabled?"Enable execution":"Disable execution",handle:P,hidden:d}],[{icon:(0,l.jsx)(Le,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),K(t,{language:"markdown",keepCodeAsIs:!1}),i.hide_code||(await s({configs:{[o]:{hide_code:!0}}}),n({cellId:o,config:{hide_code:!0}}),A({cellId:o})))},hidden:d},{icon:(0,l.jsx)(re,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),K(t,{language:"sql",keepCodeAsIs:!1}))},hidden:d},{icon:(0,l.jsx)(qe,{}),label:"Toggle as Python",handle:()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),ne(t,"python",{force:!0}))},hidden:d}],[{icon:(0,l.jsxs)(J,{children:[(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),(0,l.jsx)(V,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>h({cellId:o,before:!0}),hidden:d,redundant:!0},{icon:(0,l.jsxs)(J,{children:[(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),(0,l.jsx)(G,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>h({cellId:o,before:!1}),redundant:!0},{icon:(0,l.jsx)(V,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>p({cellId:o,before:!0}),hidden:d},{icon:(0,l.jsx)(G,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:o,before:!1}),hidden:d},{icon:(0,l.jsx)(Ie,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>p({cellId:o,direction:"left"}),hidden:b!=="columns"||d},{icon:(0,l.jsx)(we,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>p({cellId:o,direction:"right"}),hidden:b!=="columns"||d},{icon:(0,l.jsx)(Y,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>W({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(X,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>M({cellId:o,scroll:!1}),hidden:d},{icon:(0,l.jsx)(fe,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",handle:()=>_({cellId:o}),hidden:b!=="columns"||d}],[{icon:(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!C,handle:()=>ge(o,"result")},{icon:(0,l.jsx)(he,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(C||H),handle:()=>{T({cellId:o})}}],[{icon:(0,l.jsx)(Ke,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:Ze,handleHeadless:()=>{v((0,l.jsxs)(Ee,{children:[(0,l.jsx)(De,{children:(0,l.jsx)(Re,{children:"Rename cell"})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(Pe,{htmlFor:"cell-name",children:"Cell name"}),(0,l.jsx)($,{placeholder:"cell name",value:m,onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),v(null))},onChange:t=>j({cellId:o,name:t})})]})]}))},rightElement:(0,l.jsx)($,{placeholder:"cell name",value:m,onChange:t=>j({cellId:o,name:t}),onEnterKey:()=>u==null?void 0:u()}),hidden:d},{icon:(0,l.jsx)(_e,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!te(m),tooltip:te(m)?void 0:"Only named cells can be linked to",handle:async()=>{await Oe(Ve(m)),Be({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!B,variant:"danger",icon:(0,l.jsx)(Ne,{size:13,strokeWidth:1.5}),handle:()=>{D({cellId:o})}}]].map(Xe).filter(Je),e[15]=_,e[16]=E,e[17]=b,e[18]=y,e[19]=B,e[20]=o,e[21]=T,e[22]=u,e[23]=i.disabled,e[24]=i.hide_code,e[25]=h,e[26]=D,e[27]=r,e[28]=H,e[29]=C,e[30]=d,e[31]=A,e[32]=p,e[33]=m,e[34]=v,e[35]=s,e[36]=M,e[37]=W,e[38]=R,e[39]=S,e[40]=q,e[41]=k,e[42]=P,e[43]=U,e[44]=n,e[45]=j,e[46]=z):z=e[46],z}function Je(a){return a.length>0}function Xe(a){return a.filter(Ye)}function Ye(a){return!a.hidden}function Ze(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Z as a,ee as i,Ge as n,Y as o,le as r,X as s,$e as t};
1
+ import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as x}from"./useEvent-O0nX5vok.js";import{Bn as ne,Fn as de,T as se,ar as re,bi as ce,cr as he,ir as me,lt as pe,mt as ke,or as fe,v as ue,wt as K}from"./cells-wT6clfi5.js";import{t as ye}from"./compiler-runtime-B3qBwwSJ.js";import{a as be,o as xe,r as je}from"./utils-BvPM6Bro.js";import{t as ve}from"./jsx-runtime-icT_Ltz2.js";import{r as Ce}from"./requests-Bgjtqo_1.js";import{t as f}from"./createLucideIcon-Cm-Z7dYr.js";import{n as V,r as G}from"./x-BI1M8X_v.js";import{a as ge,h as Ie}from"./download-RVcmZh1N.js";import{t as we}from"./chevron-right-D0GQBpTb.js";import{t as Q}from"./circle-plus-CGG-gArM.js";import{t as ze}from"./code-xml-DwHPF_nL.js";import{t as We}from"./eye-off-vwi9L975.js";import{t as Me}from"./image-DXfkah9d.js";import{t as _e}from"./link-Cf10mh3t.js";import{t as Te}from"./play-DKSqmedg.js";import{a as Ae,n as Se}from"./state-BN6sGgkm.js";import{t as Ne}from"./trash-2-CAoNMkjq.js";import{t as Be}from"./use-toast-Hc8CXlvz.js";import{a as De,c as Re,n as Ee}from"./dialog-DCGn-_Ip.js";import{n as He}from"./ImperativeModal-b5nJtLod.js";import{n as Oe}from"./copy-BvFGCBvy.js";import{r as F}from"./html-to-image-DBFAQbWm.js";import{t as Pe}from"./label-BuJDtc39.js";import{t as Ue}from"./useDeleteCell-CmX8_XRr.js";import{n as qe,t as Le}from"./icons-T5yQRjuT.js";import{n as $}from"./name-cell-input-BhRgpz9L.js";import{t as J}from"./multi-icon-DpydcgWs.js";import{t as Fe}from"./useSplitCell-CZQNZZ7B.js";var X=f("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),Y=f("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]),Z=f("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]),Ke=f("text-cursor-input",[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]]),ee=f("zap-off",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),le=f("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function Ve(a){let e=new URL(window.location.href);return e.hash=`scrollTo=${encodeURIComponent(a)}`,e.toString()}function Ge(a){var c;let e=(c=a.match(/scrollTo=([^&]+)/))==null?void 0:c[1];return e?decodeURIComponent(e.split("&")[0]):null}function te(a){return a==="_"?!1:!!(a&&a.trim().length>0)}var Qe=ye(),l=ae(ve(),1);function $e(a){let e=(0,Qe.c)(47),{cell:c,closePopover:u}=a,{createNewCell:h,updateCellConfig:d,updateCellName:j,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:T,markUntouched:A}=se(),S=Fe(),N=ke(c==null?void 0:c.cellId),B=!x(ue),D=Ue(),{openModal:v}=He(),R=ie(Se),E=x(je),y=x(xe),oe=x(pe),b=x(be),{saveCellConfig:s}=Ce();if(!c||oe){let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0],t}let{cellId:o,config:i,getEditorView:r,name:m,hasOutput:C,hasConsoleOutput:H,status:O}=c,g;e[1]!==o||e[2]!==i.disabled||e[3]!==s||e[4]!==d?(g=async()=>{let t={disabled:!i.disabled};await s({configs:{[o]:t}}),d({cellId:o,config:t})},e[1]=o,e[2]=i.disabled,e[3]=s,e[4]=d,e[5]=g):g=e[5];let P=g,I;e[6]!==o||e[7]!==i.hide_code||e[8]!==r||e[9]!==s||e[10]!==d?(I=async()=>{let t={hide_code:!i.hide_code};await s({configs:{[o]:t}}),d({cellId:o,config:t});let L=r();L&&(t.hide_code?L.contentDOM.blur():L.focus())},e[6]=o,e[7]=i.hide_code,e[8]=r,e[9]=s,e[10]=d,e[11]=I):I=e[11];let U=I,n=o===ce,w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=(0,l.jsx)(Te,{size:13,strokeWidth:1.5}),e[12]=w):w=e[12];let q=O==="running"||O==="queued"||O==="disabled-transitively"||i.disabled,k;e[13]===N?k=e[14]:(k=()=>N(),e[13]=N,e[14]=k);let z;return e[15]!==_||e[16]!==E||e[17]!==b||e[18]!==y||e[19]!==B||e[20]!==o||e[21]!==T||e[22]!==u||e[23]!==i.disabled||e[24]!==i.hide_code||e[25]!==h||e[26]!==D||e[27]!==r||e[28]!==H||e[29]!==C||e[30]!==n||e[31]!==A||e[32]!==p||e[33]!==m||e[34]!==v||e[35]!==s||e[36]!==M||e[37]!==W||e[38]!==R||e[39]!==S||e[40]!==q||e[41]!==k||e[42]!==P||e[43]!==U||e[44]!==d||e[45]!==j?(z=[[{icon:w,label:"Run cell",hotkey:"cell.run",hidden:q,redundant:!0,handle:k},{icon:(0,l.jsx)(Ae,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!E,handle:()=>{R(t=>(t==null?void 0:t.cellId)===o?null:{cellId:o})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Z,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>S({cellId:o})},{icon:(0,l.jsx)(ze,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let t=r();t&&ne({[o]:t})}},{icon:i.hide_code?(0,l.jsx)(me,{size:13,strokeWidth:1.5}):(0,l.jsx)(We,{size:13,strokeWidth:1.5}),label:i.hide_code?"Show code":"Hide code",handle:U,hotkey:"cell.hideCode"},{icon:i.disabled?(0,l.jsx)(ee,{size:13,strokeWidth:1.5}):(0,l.jsx)(le,{size:13,strokeWidth:1.5}),label:i.disabled?"Enable execution":"Disable execution",handle:P,hidden:n}],[{icon:(0,l.jsx)(Le,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),K(t,{language:"markdown",keepCodeAsIs:!1}),i.hide_code||(await s({configs:{[o]:{hide_code:!0}}}),d({cellId:o,config:{hide_code:!0}}),A({cellId:o})))},hidden:n},{icon:(0,l.jsx)(re,{size:13,strokeWidth:1.5}),label:"Convert to SQL",handle:()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),K(t,{language:"sql",keepCodeAsIs:!1}))},hidden:n},{icon:(0,l.jsx)(qe,{}),label:"Toggle as Python",handle:()=>{let t=r();t&&(F({autoInstantiate:y,createNewCell:h}),de(t,"python",{force:!0}))},hidden:n}],[{icon:(0,l.jsxs)(J,{children:[(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),(0,l.jsx)(V,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>h({cellId:o,before:!0}),hidden:n,redundant:!0},{icon:(0,l.jsxs)(J,{children:[(0,l.jsx)(Q,{size:13,strokeWidth:1.5}),(0,l.jsx)(G,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>h({cellId:o,before:!1}),redundant:!0},{icon:(0,l.jsx)(V,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>p({cellId:o,before:!0}),hidden:n},{icon:(0,l.jsx)(G,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:o,before:!1}),hidden:n},{icon:(0,l.jsx)(Ie,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>p({cellId:o,direction:"left"}),hidden:b!=="columns"||n},{icon:(0,l.jsx)(we,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>p({cellId:o,direction:"right"}),hidden:b!=="columns"||n},{icon:(0,l.jsx)(Y,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>W({cellId:o,scroll:!1}),hidden:n},{icon:(0,l.jsx)(X,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>M({cellId:o,scroll:!1}),hidden:n},{icon:(0,l.jsx)(fe,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",handle:()=>_({cellId:o}),hidden:b!=="columns"||n}],[{icon:(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!C,handle:()=>ge(o,"result")},{icon:(0,l.jsx)(he,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(C||H),handle:()=>{T({cellId:o})}}],[{icon:(0,l.jsx)(Ke,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:Ze,handleHeadless:()=>{v((0,l.jsxs)(Ee,{children:[(0,l.jsx)(De,{children:(0,l.jsx)(Re,{children:"Rename cell"})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(Pe,{htmlFor:"cell-name",children:"Cell name"}),(0,l.jsx)($,{placeholder:"cell name",value:m,onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),t.stopPropagation(),v(null))},onChange:t=>j({cellId:o,name:t})})]})]}))},rightElement:(0,l.jsx)($,{placeholder:"cell name",value:m,onChange:t=>j({cellId:o,name:t}),onEnterKey:()=>u==null?void 0:u()}),hidden:n},{icon:(0,l.jsx)(_e,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!te(m),tooltip:te(m)?void 0:"Only named cells can be linked to",handle:async()=>{await Oe(Ve(m)),Be({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!B,variant:"danger",icon:(0,l.jsx)(Ne,{size:13,strokeWidth:1.5}),handle:()=>{D({cellId:o})}}]].map(Xe).filter(Je),e[15]=_,e[16]=E,e[17]=b,e[18]=y,e[19]=B,e[20]=o,e[21]=T,e[22]=u,e[23]=i.disabled,e[24]=i.hide_code,e[25]=h,e[26]=D,e[27]=r,e[28]=H,e[29]=C,e[30]=n,e[31]=A,e[32]=p,e[33]=m,e[34]=v,e[35]=s,e[36]=M,e[37]=W,e[38]=R,e[39]=S,e[40]=q,e[41]=k,e[42]=P,e[43]=U,e[44]=d,e[45]=j,e[46]=z):z=e[46],z}function Je(a){return a.length>0}function Xe(a){return a.filter(Ye)}function Ye(a){return!a.hidden}function Ze(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Z as a,ee as i,Ge as n,Y as o,le as r,X as s,$e as t};
@@ -1 +1 @@
1
- import{s as M}from"./chunk-LvLJmgfZ.js";import{d as X,l as Y,n as V,p as Z,u as $}from"./useEvent-O0nX5vok.js";import{t as ee}from"./react-Bj1aDYRI.js";import{W as te,kt as re}from"./cells-wT6clfi5.js";import{t as W}from"./compiler-runtime-B3qBwwSJ.js";import{t as le}from"./jsx-runtime-icT_Ltz2.js";import{t as ae}from"./cn-BoaCR37F.js";import{t as ne}from"./createLucideIcon-Cm-Z7dYr.js";import{t as se}from"./useCellActionButton-5K5fLTMd.js";import{a as oe,n as ie,o as ce,t as me}from"./tooltip-CNmaER6z.js";import{d as de}from"./alert-dialog-DbQ_TZC7.js";import{i as B,r as he,t as G}from"./popover-JNsSzROl.js";import{a as pe,c as fe,i as ue,o as xe,r as je,t as be,u as ye}from"./command-DGKK2-4P.js";import{n as ve}from"./focus-q8oYkLV6.js";import{a as Ne,i as ge}from"./renderShortcut-C3rk7kIN.js";var ke=ne("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),J=W(),h=M(ee(),1),t=M(le(),1);const K=h.memo(h.forwardRef((r,a)=>{let e=(0,J.c)(39),{children:n,showTooltip:c,...m}=r,p=c===void 0?!0:c,[d,I]=(0,h.useState)(!1),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=()=>I(!1),e[0]=N):N=e[0];let U=N,D=(0,h.useRef)(null),E=se({cell:m,closePopover:U}).map(Ce).filter(_e),P=de(),g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{te(()=>{D.current&&D.current.scrollIntoView({behavior:"auto",block:"nearest"})})},e[1]=g):g=e[1];let T=V(g),k;e[2]===T?k=e[3]:(k=s=>{I(o=>{let l=typeof s=="function"?s(o):s;return l&&T(),l})},e[2]=T,e[3]=k);let i=V(k),w;e[4]===i?w=e[5]:(w=()=>({toggle:()=>i(Se)}),e[4]=i,e[5]=w),(0,h.useImperativeHandle)(a,w);let O=he,A=be,F=re(m.cellId),f;e[6]===F?f=e[7]:(f=(0,t.jsx)(pe,{placeholder:"Search actions...",className:"h-6 m-1",...F}),e[6]=F,e[7]=f);let H=ye,u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(je,{children:"No results"}),e[8]=u):u=e[8];let R=E.map((s,o)=>(0,t.jsxs)(h.Fragment,{children:[(0,t.jsx)(ue,{children:s.map(l=>{let z=(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[l.icon&&(0,t.jsx)("div",{className:"mr-2 w-5 text-muted-foreground",children:l.icon}),(0,t.jsx)("div",{className:"flex-1",children:l.label}),(0,t.jsxs)("div",{className:"shrink-0 text-sm",children:[l.hotkey&&ge(l.hotkey),l.rightElement]})]});return l.tooltip&&(z=(0,t.jsx)(me,{content:l.tooltip,delayDuration:100,children:z})),(0,t.jsx)(xe,{className:ae(l.disabled&&"opacity-50!"),onSelect:()=>{l.disableClick||l.disabled||(l.handle(),I(!1))},variant:l.variant,children:z},l.label)})},o),o<E.length-1&&(0,t.jsx)(fe,{})]},o)),x;e[9]!==H||e[10]!==u||e[11]!==R?(x=(0,t.jsxs)(H,{children:[u,R]}),e[9]=H,e[10]=u,e[11]=R,e[12]=x):x=e[12];let j;e[13]!==A||e[14]!==x||e[15]!==f?(j=(0,t.jsxs)(A,{children:[f,x]}),e[13]=A,e[14]=x,e[15]=f,e[16]=j):j=e[16];let C;e[17]!==O||e[18]!==P||e[19]!==j?(C=(0,t.jsx)(O,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...P,children:j}),e[17]=O,e[18]=P,e[19]=j,e[20]=C):C=e[20];let b=C;if(!p){let s;e[21]===n?s=e[22]:(s=(0,t.jsx)(B,{asChild:!0,children:n}),e[21]=n,e[22]=s);let o;return e[23]!==b||e[24]!==i||e[25]!==d||e[26]!==s?(o=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[s,b]}),e[23]=b,e[24]=i,e[25]=d,e[26]=s,e[27]=o):o=e[27],o}let _;e[28]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)(ie,{tabIndex:-1,children:Ne("cell.cellActions")}),e[28]=_):_=e[28];let q=!d&&_,y;e[29]===n?y=e[30]:(y=(0,t.jsx)(ce,{ref:D,children:(0,t.jsx)(B,{className:"flex",children:n})}),e[29]=n,e[30]=y);let v;e[31]!==q||e[32]!==y?(v=(0,t.jsxs)(oe,{delayDuration:200,disableHoverableContent:!0,children:[q,y]}),e[31]=q,e[32]=y,e[33]=v):v=e[33];let S;return e[34]!==b||e[35]!==i||e[36]!==d||e[37]!==v?(S=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[v,b]}),e[34]=b,e[35]=i,e[36]=d,e[37]=v,e[38]=S):S=e[38],S})),L=h.memo(r=>{let a=(0,J.c)(5),{children:e,cellId:n}=r,c;a[0]===n?c=a[1]:(c=ve(n),a[0]=n,a[1]=c);let m=$(c);if(!m)return null;let p;return a[2]!==e||a[3]!==m?(p=(0,t.jsx)(K,{showTooltip:!1,...m,children:e}),a[2]=e,a[3]=m,a[4]=p):p=a[4],p});L.displayName="ConnectionCellActionsDropdown";function we(r){return!r.redundant}function Ce(r){return r.filter(we)}function _e(r){return r.length>0}function Se(r){return!r}var Ie=W();const Q=Z("minimap");function De(){let r=(0,Ie.c)(3),[a,e]=Y(Q),n;return r[0]!==a||r[1]!==e?(n={dependencyPanelTab:a,setDependencyPanelTab:e},r[0]=a,r[1]=e,r[2]=n):n=r[2],n}function Pe(){return X(Q)}export{ke as a,L as i,Pe as n,K as r,De as t};
1
+ import{s as M}from"./chunk-LvLJmgfZ.js";import{d as X,l as Y,n as V,p as Z,u as $}from"./useEvent-O0nX5vok.js";import{t as ee}from"./react-Bj1aDYRI.js";import{W as te,kt as re}from"./cells-wT6clfi5.js";import{t as W}from"./compiler-runtime-B3qBwwSJ.js";import{t as le}from"./jsx-runtime-icT_Ltz2.js";import{t as ae}from"./cn-BoaCR37F.js";import{t as ne}from"./createLucideIcon-Cm-Z7dYr.js";import{t as se}from"./useCellActionButton-DFS0hpsU.js";import{a as oe,n as ie,o as ce,t as me}from"./tooltip-CNmaER6z.js";import{d as de}from"./alert-dialog-DbQ_TZC7.js";import{i as B,r as he,t as G}from"./popover-JNsSzROl.js";import{a as pe,c as fe,i as ue,o as xe,r as je,t as be,u as ye}from"./command-DGKK2-4P.js";import{n as ve}from"./focus-q8oYkLV6.js";import{a as Ne,i as ge}from"./renderShortcut-C3rk7kIN.js";var ke=ne("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),J=W(),h=M(ee(),1),t=M(le(),1);const K=h.memo(h.forwardRef((r,a)=>{let e=(0,J.c)(39),{children:n,showTooltip:c,...m}=r,p=c===void 0?!0:c,[d,I]=(0,h.useState)(!1),N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=()=>I(!1),e[0]=N):N=e[0];let U=N,D=(0,h.useRef)(null),E=se({cell:m,closePopover:U}).map(Ce).filter(_e),P=de(),g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{te(()=>{D.current&&D.current.scrollIntoView({behavior:"auto",block:"nearest"})})},e[1]=g):g=e[1];let T=V(g),k;e[2]===T?k=e[3]:(k=s=>{I(o=>{let l=typeof s=="function"?s(o):s;return l&&T(),l})},e[2]=T,e[3]=k);let i=V(k),w;e[4]===i?w=e[5]:(w=()=>({toggle:()=>i(Se)}),e[4]=i,e[5]=w),(0,h.useImperativeHandle)(a,w);let O=he,A=be,F=re(m.cellId),f;e[6]===F?f=e[7]:(f=(0,t.jsx)(pe,{placeholder:"Search actions...",className:"h-6 m-1",...F}),e[6]=F,e[7]=f);let H=ye,u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(je,{children:"No results"}),e[8]=u):u=e[8];let R=E.map((s,o)=>(0,t.jsxs)(h.Fragment,{children:[(0,t.jsx)(ue,{children:s.map(l=>{let z=(0,t.jsxs)("div",{className:"flex items-center flex-1",children:[l.icon&&(0,t.jsx)("div",{className:"mr-2 w-5 text-muted-foreground",children:l.icon}),(0,t.jsx)("div",{className:"flex-1",children:l.label}),(0,t.jsxs)("div",{className:"shrink-0 text-sm",children:[l.hotkey&&ge(l.hotkey),l.rightElement]})]});return l.tooltip&&(z=(0,t.jsx)(me,{content:l.tooltip,delayDuration:100,children:z})),(0,t.jsx)(xe,{className:ae(l.disabled&&"opacity-50!"),onSelect:()=>{l.disableClick||l.disabled||(l.handle(),I(!1))},variant:l.variant,children:z},l.label)})},o),o<E.length-1&&(0,t.jsx)(fe,{})]},o)),x;e[9]!==H||e[10]!==u||e[11]!==R?(x=(0,t.jsxs)(H,{children:[u,R]}),e[9]=H,e[10]=u,e[11]=R,e[12]=x):x=e[12];let j;e[13]!==A||e[14]!==x||e[15]!==f?(j=(0,t.jsxs)(A,{children:[f,x]}),e[13]=A,e[14]=x,e[15]=f,e[16]=j):j=e[16];let C;e[17]!==O||e[18]!==P||e[19]!==j?(C=(0,t.jsx)(O,{className:"w-[300px] p-0 pt-1 overflow-auto",scrollable:!0,...P,children:j}),e[17]=O,e[18]=P,e[19]=j,e[20]=C):C=e[20];let b=C;if(!p){let s;e[21]===n?s=e[22]:(s=(0,t.jsx)(B,{asChild:!0,children:n}),e[21]=n,e[22]=s);let o;return e[23]!==b||e[24]!==i||e[25]!==d||e[26]!==s?(o=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[s,b]}),e[23]=b,e[24]=i,e[25]=d,e[26]=s,e[27]=o):o=e[27],o}let _;e[28]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)(ie,{tabIndex:-1,children:Ne("cell.cellActions")}),e[28]=_):_=e[28];let q=!d&&_,y;e[29]===n?y=e[30]:(y=(0,t.jsx)(ce,{ref:D,children:(0,t.jsx)(B,{className:"flex",children:n})}),e[29]=n,e[30]=y);let v;e[31]!==q||e[32]!==y?(v=(0,t.jsxs)(oe,{delayDuration:200,disableHoverableContent:!0,children:[q,y]}),e[31]=q,e[32]=y,e[33]=v):v=e[33];let S;return e[34]!==b||e[35]!==i||e[36]!==d||e[37]!==v?(S=(0,t.jsxs)(G,{open:d,onOpenChange:i,children:[v,b]}),e[34]=b,e[35]=i,e[36]=d,e[37]=v,e[38]=S):S=e[38],S})),L=h.memo(r=>{let a=(0,J.c)(5),{children:e,cellId:n}=r,c;a[0]===n?c=a[1]:(c=ve(n),a[0]=n,a[1]=c);let m=$(c);if(!m)return null;let p;return a[2]!==e||a[3]!==m?(p=(0,t.jsx)(K,{showTooltip:!1,...m,children:e}),a[2]=e,a[3]=m,a[4]=p):p=a[4],p});L.displayName="ConnectionCellActionsDropdown";function we(r){return!r.redundant}function Ce(r){return r.filter(we)}function _e(r){return r.length>0}function Se(r){return!r}var Ie=W();const Q=Z("minimap");function De(){let r=(0,Ie.c)(3),[a,e]=Y(Q),n;return r[0]!==a||r[1]!==e?(n={dependencyPanelTab:a,setDependencyPanelTab:e},r[0]=a,r[1]=e,r[2]=n):n=r[2],n}function Pe(){return X(Q)}export{ke as a,L as i,Pe as n,K as r,De as t};
@@ -1 +1 @@
1
- import{s as we}from"./chunk-LvLJmgfZ.js";import{d as L,l as Ze,p as Qe,u as de}from"./useEvent-O0nX5vok.js";import{t as et}from"./react-Bj1aDYRI.js";import{Cn as tt,En as at,Gt as ot,Nr as nt,Sn as it,T as ge,_ as st,ar as lt,cr as rt,dt as je,h as ve,lt as dt,pr as ct,pt as ht,rr as pt,t as mt,ut,vi as ce,xn as ft}from"./cells-wT6clfi5.js";import{t as _}from"./compiler-runtime-B3qBwwSJ.js";import{n as yt}from"./assertNever-CTRGz-ul.js";import{s as Ce}from"./useLifecycle-CWjBWFMI.js";import{i as kt,n as ze}from"./add-connection-dialog-CIHDuGfD.js";import{n as bt,x as xt}from"./ai-model-dropdown-V-_6L1Ri.js";import{c as Me,m as T}from"./useEventListener-BGihH8bs.js";import{y as wt}from"./utils-BvPM6Bro.js";import{n as A,t as We}from"./constants-Rz_lD4HK.js";import{S as he,h as gt,x as jt}from"./config-DeEqZTX7.js";import{t as vt}from"./jsx-runtime-icT_Ltz2.js";import{r as Ct,t as pe}from"./button-BZAv3veu.js";import{r as H}from"./requests-Bgjtqo_1.js";import{t as h}from"./createLucideIcon-Cm-Z7dYr.js";import{a as Se,f as zt,i as De,m as Mt,p as _e,u as Ae}from"./layout-OuSaBBrA.js";import{t as Ne}from"./check-BE0hEwVo.js";import{c as Pe,d as me,n as Wt,o as St,r as ue,t as Dt}from"./download-RVcmZh1N.js";import{f as _t}from"./maps-CqKCrVZ8.js";import{r as At}from"./useCellActionButton-5K5fLTMd.js";import{t as Nt}from"./copy-CkudG0Ej.js";import{t as Pt}from"./download-DBW9RXtT.js";import{t as It}from"./eye-off-vwi9L975.js";import{t as Et}from"./file-plus-corner-lLQw9OnR.js";import{t as J}from"./file-DzHkbIdO.js";import{t as Lt}from"./github-BVtI-3F1.js";import{m as Tt}from"./form-BEIQJWib.js";import{n as Ht,r as qt,t as Rt}from"./youtube-DE-Ej6FR.js";import{n as Bt,t as Ft}from"./square-CxAsQQ77.js";import{t as Ot}from"./image-DXfkah9d.js";import{t as Vt}from"./link-Cf10mh3t.js";import{r as Yt}from"./input-C5eatTLl.js";import{t as Kt}from"./settings-CzQUw9rV.js";import{x as Ut}from"./azure-Dy9N467C.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as Ie,t as Gt}from"./paths-D2lG83Oh.js";import{o as $t}from"./session-CXChHxAw.js";import{a as Jt,c as Xt,i as Zt,n as Qt,r as ea,s as ta,t as aa}from"./select-Ch6m1k2G.js";import{t as oa}from"./tooltip-CNmaER6z.js";import{o as na}from"./alert-dialog-DbQ_TZC7.js";import{a as ia,c as sa,i as la,n as ra,r as da}from"./dialog-DCGn-_Ip.js";import{n as fe}from"./ImperativeModal-b5nJtLod.js";import{r as ca,t as ha}from"./share-DdWa0mV7.js";import{t as X}from"./copy-f2iEg0yL.js";import{a as pa}from"./cell-link-CL9widoN.js";import{a as ma}from"./renderShortcut-C3rk7kIN.js";import{t as ua}from"./icons-T5yQRjuT.js";import{t as fa}from"./links-XdsYEk97.js";import{r as ya,t as Ee}from"./hooks-ChoVWWrC.js";import{t as Le}from"./types-DBNA0l6L.js";var ka=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),ba=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Te=h("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"}]]),He=h("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=h("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"}]]),xa=h("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"}]]),wa=h("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"}]]),ga=h("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"}]]),Re=h("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"}]]),ja=h("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"}]]),va=h("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"}]]),Ca=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Be=h("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"}]]),za=h("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"}]]),Ma=h("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"}]]),Fe=h("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"}]]),Oe=_(),ye=we(et(),1),a=we(vt(),1),Z="https://static.marimo.app";const Wa=e=>{let t=(0,Oe.c)(25),{onClose:n}=e,[o,s]=(0,ye.useState)(""),{exportAsHTML:r}=H(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Z}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let P=await r({download:!1,includeCode:!0,files:zt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Z}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:P,path:l})}).catch(()=>{z.dismiss(),C({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:A.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({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."]})})},t[0]=r,t[1]=n,t[2]=l,t[3]=d):d=t[3];let m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(sa,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(ia,{children:[m,(0,a.jsxs)(da,{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:Z,target:"_blank",children:Z}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(Yt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(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)(Sa,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let y;t[11]!==u||t[12]!==f?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(pe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(pe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await X(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(la,{children:[k,b]}),t[18]=k,t[19]=b,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(ra,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,y,x]})}),t[21]=d,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var Sa=e=>{let t=(0,Oe.c)(8),[n,o]=ye.useState(!1),s;t[0]===e.text?s=t[1]:(s=Ct.stopPropagation(async m=>{m.preventDefault(),await X(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(pe,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(oa,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Da=_();function _a(){let e=document.getElementsByClassName(We.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=ce.findElement(t);if(!o){T.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:ce.parse(o.id)}}}return T.warn("No visible output area found for scroll anchor"),null}function Aa(e){if(!e){T.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(ce.create(e.cellId));if(!t){T.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${We.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ve(){let e=(0,Da.c)(2),t=L(je),n;return e[0]===t?n=e[1]:(n=()=>{let o=_a();t(s=>({mode:ut(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Aa(o)})})},e[0]=t,e[1]=n),n}const Ye=Qe(!1);var Na=_();const Pa=()=>{let e=(0,Na.c)(7),{selectedLayout:t}=Se(),{setLayoutView:n}=De();if(he()&&!at("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(ta,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Xt,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Qt,{children:(0,a.jsxs)(ea,{children:[(0,a.jsx)(Jt,{children:"View as"}),Le.map(Ea)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(aa,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Ia(e){return(0,a.jsx)(Ke(e),{className:"h-4 w-4"})}function Ke(e){switch(e){case"vertical":return ja;case"grid":return qt;case"slides":return Be;default:return yt(e),Ft}}function Ue(e){return Ce(e)}function Ea(e){return(0,a.jsx)(Zt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ia(e),(0,a.jsx)("span",{children:Ue(e)})]})},e)}async function La(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Ta=_();function Ha(e){let t=(0,Ta.c)(5),{openPrompt:n,closeModal:o}=fe(),{sendCopy:s}=H(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=Gt.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Ie.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Ie.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),fa(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const qa=()=>{let{updateCellConfig:e}=ge(),{saveCellConfig:t}=H();return(0,ye.useCallback)(async()=>{let n=new ot,o=ve(),s=o.cellIds.inOrderIds,r={};for(let i of s){if(o.cellData[i]===void 0)continue;let{code:d,config:m}=o.cellData[i];m.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let l=Me.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var Ra=_();function Ge(){let e=(0,Ra.c)(4),{openConfirm:t}=fe(),n=L(gt),{sendRestart:o}=H(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{t({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)(na,{onClick:async()=>{n({state:jt.CLOSING}),await o(),ca()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var Ba=_(),N=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Fa(){var be,xe;let e=(0,Ba.c)(51),t=pa(),{openModal:n,closeModal:o}=fe(),{toggleApplication:s}=ft(),{selectedPanel:r}=it(),[l]=Ze(je),i=de(dt),d=qa(),[m]=wt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ge(),b=Ge(),x=ht(),j=Ha(t),v=L(Ye),P=L(bt),z=L(xt),{exportAsIPYNB:ee,exportAsMarkdown:te,readCode:I,saveCellConfig:ae,updateCellOutputs:M}=H(),W=ya(),oe=de(st),ne=de(mt),{selectedLayout:q}=Se(),{setLayoutView:ie}=De(),R=Ve(),B=((be=m.sharing)==null?void 0:be.html)??!0,F=((xe=m.sharing)==null?void 0:xe.wasm)??!0,ke=!he(),se=q==="slides",$e=so,Je=io,O;e[0]!==t||e[1]!==W||e[2]!==M?(O=async c=>{let{preset:p,title:E}=c;if(!t){Q();return}await Pe(E,async re=>{await Ee({takeScreenshots:()=>W({progress:re}),updateCellOutputs:M}),await La({filename:t,preset:p,downloadPDF:Wt})})},e[0]=t,e[1]=W,e[2]=M,e[3]=O):O=e[3];let S=O,V;e[4]===S?V=e[5]:(V=async()=>{if(ke){await S({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),p=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(no,0),setTimeout(()=>window.dispatchEvent(p),0)},e[4]=S,e[5]=V);let Y=V,K;e[6]!==ee||e[7]!==t||e[8]!==W||e[9]!==M?(K=async()=>{if(!t){Q();return}await Pe("Downloading IPYNB...",async c=>{await Ee({takeScreenshots:()=>W({progress:c}),updateCellOutputs:M});let p=await ee({download:!1});ue(new Blob([p],{type:"application/x-ipynb+json"}),me.toIPYNB(document.title))})},e[6]=ee,e[7]=t,e[8]=W,e[9]=M,e[10]=K):K=e[10];let le=K,U;e[11]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let G;e[12]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),e[12]=G):G=e[12];let D;e[13]===t?D=e[14]:(D=async()=>{if(!t){Q();return}await Ae({filename:t,includeCode:!0})},e[13]=t,e[14]=D);let $;return e[15]!==f||e[16]!==ne||e[17]!==u||e[18]!==o||e[19]!==y||e[20]!==j||e[21]!==S||e[22]!==k||e[23]!==te||e[24]!==t||e[25]!==Y||e[26]!==le||e[27]!==oe||e[28]!==d||e[29]!==se||e[30]!==i||e[31]!==n||e[32]!==I||e[33]!==b||e[34]!==x||e[35]!==ae||e[36]!==q||e[37]!==r||e[38]!==v||e[39]!==z||e[40]!==ie||e[41]!==P||e[42]!==B||e[43]!==F||e[44]!==D||e[45]!==s||e[46]!==R||e[47]!==g||e[48]!==w||e[49]!==l.mode?($=[{icon:U,label:"Download",handle:N,dropdown:[{icon:G,label:"Download as HTML",handle:D},{icon:(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){Q();return}await Ae({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(ua,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await te({download:!1});ue(new Blob([c],{type:"text/plain"}),me.toMarkdown(document.title))}},{icon:(0,a.jsx)(va,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:le},{icon:(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await I();ue(new Blob([c.contents],{type:"text/plain"}),me.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(Ot,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",ma("global.hideCode",!1)]}),handle:oo},se?{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:N,dropdown:[{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:Y},{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:Je(!0),hidden:!ke,handle:async()=>{await S({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:Y}]},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!B&&!F,dropdown:[{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!B,handle:async()=>{n((0,a.jsx)(Wa,{onClose:o}))}},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await X(ha({code:(await I()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:N,dropdown:tt.flatMap(c=>{let{type:p,Icon:E,hidden:re,additionalKeywords:Xe}=c;return re?[]:{label:Ce(p),rightElement:$e(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:Xe}})},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Ut,{size:14,strokeWidth:1.5}):(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{R()}},...Le.map((c,p)=>{let E=Ke(c);return{divider:p===0,label:Ue(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:q===c&&(0,a.jsx)(Ne,{size:14})}),handle:()=>{ie(c),l.mode==="edit"&&R()}}})]},{icon:(0,a.jsx)(wa,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||he(),handle:j},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await X((await I()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!oe||i,handle:async()=>{let c=nt(ve());await ae({configs:Me.fromEntries(c.map(ao))});for(let p of c)w({cellId:p,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(lt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(ze,{onClose:o}))}},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(ze,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ne||i,handle:()=>{g()}},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(rt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:k,redundant:!0},{divider:!0,icon:(0,a.jsx)(He,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(to)},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(eo)},{icon:(0,a.jsx)(Kt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>P(Qa),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Za},{icon:(0,a.jsx)(Lt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Xa},{icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ja},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:$a},{icon:(0,a.jsx)(pt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ga}]},{divider:!0,icon:(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ua},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ka}].filter(Ya).map(Oa),e[15]=f,e[16]=ne,e[17]=u,e[18]=o,e[19]=y,e[20]=j,e[21]=S,e[22]=k,e[23]=te,e[24]=t,e[25]=Y,e[26]=le,e[27]=oe,e[28]=d,e[29]=se,e[30]=i,e[31]=n,e[32]=I,e[33]=b,e[34]=x,e[35]=ae,e[36]=q,e[37]=r,e[38]=v,e[39]=z,e[40]=ie,e[41]=P,e[42]=B,e[43]=F,e[44]=D,e[45]=s,e[46]=R,e[47]=g,e[48]=w,e[49]=l.mode,e[50]=$):$=e[50],$}function Oa(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Va)}:e}function Va(e){return!e.hidden}function Ya(e){return!e.hidden}function Ka(){let e=$t();window.open(e,"_blank")}function Ua(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ga(){window.open(A.releasesPage,"_blank")}function $a(){window.open(A.youtube,"_blank")}function Ja(){window.open(A.discordLink,"_blank")}function Xa(){window.open(A.githubPage,"_blank")}function Za(){window.open(A.docsPage,"_blank")}function Qa(e){return!e}function eo(e){return!e}function to(e){return!e}function ao(e){return[e,{disabled:!1}]}async function oo(){let e=document.getElementById("App");e&&await St({element:e,filename:document.title,prepare:Dt})}function no(){return window.print()}function io(e){return e?(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 so(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Ne,{size:14})})}function Q(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ve as a,qe as c,Ye as i,He as l,Ge as n,Fe as o,Pa as r,Re as s,Fa as t,Te as u};
1
+ import{s as we}from"./chunk-LvLJmgfZ.js";import{d as L,l as Ze,p as Qe,u as de}from"./useEvent-O0nX5vok.js";import{t as et}from"./react-Bj1aDYRI.js";import{Cn as tt,En as at,Gt as ot,Nr as nt,Sn as it,T as ge,_ as st,ar as lt,cr as rt,dt as je,h as ve,lt as dt,pr as ct,pt as ht,rr as pt,t as mt,ut,vi as ce,xn as ft}from"./cells-wT6clfi5.js";import{t as _}from"./compiler-runtime-B3qBwwSJ.js";import{n as yt}from"./assertNever-CTRGz-ul.js";import{s as Ce}from"./useLifecycle-CWjBWFMI.js";import{i as kt,n as ze}from"./add-connection-dialog-CIHDuGfD.js";import{n as bt,x as xt}from"./ai-model-dropdown-DxpOlTBW.js";import{c as Me,m as T}from"./useEventListener-BGihH8bs.js";import{y as wt}from"./utils-BvPM6Bro.js";import{n as A,t as We}from"./constants-Rz_lD4HK.js";import{S as he,h as gt,x as jt}from"./config-DeEqZTX7.js";import{t as vt}from"./jsx-runtime-icT_Ltz2.js";import{r as Ct,t as pe}from"./button-BZAv3veu.js";import{r as H}from"./requests-Bgjtqo_1.js";import{t as h}from"./createLucideIcon-Cm-Z7dYr.js";import{a as Se,f as zt,i as De,m as Mt,p as _e,u as Ae}from"./layout-BOEBdVW9.js";import{t as Ne}from"./check-BE0hEwVo.js";import{c as Pe,d as me,n as Wt,o as St,r as ue,t as Dt}from"./download-RVcmZh1N.js";import{f as _t}from"./maps-CqKCrVZ8.js";import{r as At}from"./useCellActionButton-DFS0hpsU.js";import{t as Nt}from"./copy-CkudG0Ej.js";import{t as Pt}from"./download-DBW9RXtT.js";import{t as It}from"./eye-off-vwi9L975.js";import{t as Et}from"./file-plus-corner-lLQw9OnR.js";import{t as J}from"./file-DzHkbIdO.js";import{t as Lt}from"./github-BVtI-3F1.js";import{m as Tt}from"./form-BEIQJWib.js";import{n as Ht,r as qt,t as Rt}from"./youtube-DE-Ej6FR.js";import{n as Bt,t as Ft}from"./square-CxAsQQ77.js";import{t as Ot}from"./image-DXfkah9d.js";import{t as Vt}from"./link-Cf10mh3t.js";import{r as Yt}from"./input-C5eatTLl.js";import{t as Kt}from"./settings-CzQUw9rV.js";import{x as Ut}from"./azure-Dy9N467C.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as Ie,t as Gt}from"./paths-D2lG83Oh.js";import{o as $t}from"./session-CXChHxAw.js";import{a as Jt,c as Xt,i as Zt,n as Qt,r as ea,s as ta,t as aa}from"./select-Ch6m1k2G.js";import{t as oa}from"./tooltip-CNmaER6z.js";import{o as na}from"./alert-dialog-DbQ_TZC7.js";import{a as ia,c as sa,i as la,n as ra,r as da}from"./dialog-DCGn-_Ip.js";import{n as fe}from"./ImperativeModal-b5nJtLod.js";import{r as ca,t as ha}from"./share-DdWa0mV7.js";import{n as X}from"./copy-BvFGCBvy.js";import{a as pa}from"./cell-link-CL9widoN.js";import{a as ma}from"./renderShortcut-C3rk7kIN.js";import{t as ua}from"./icons-T5yQRjuT.js";import{t as fa}from"./links-XdsYEk97.js";import{r as ya,t as Ee}from"./hooks-BOa-vQTI.js";import{t as Le}from"./types-DBNA0l6L.js";var ka=h("circle-chevron-down",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]),ba=h("circle-chevron-right",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]),Te=h("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"}]]),He=h("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=h("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"}]]),xa=h("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"}]]),wa=h("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"}]]),ga=h("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"}]]),Re=h("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"}]]),ja=h("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"}]]),va=h("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"}]]),Ca=h("panel-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]),Be=h("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"}]]),za=h("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"}]]),Ma=h("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"}]]),Fe=h("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"}]]),Oe=_(),ye=we(et(),1),a=we(vt(),1),Z="https://static.marimo.app";const Wa=e=>{let t=(0,Oe.c)(25),{onClose:n}=e,[o,s]=(0,ye.useState)(""),{exportAsHTML:r}=H(),l=`${o}-${Math.random().toString(36).slice(2,6)}`,i=`${Z}/static/${l}`,d;t[0]!==r||t[1]!==n||t[2]!==l?(d=async v=>{v.preventDefault(),n();let P=await r({download:!1,includeCode:!0,files:zt.INSTANCE.filenames()}),z=C({title:"Uploading static notebook...",description:"Please wait."});await fetch(`${Z}/api/static`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({html:P,path:l})}).catch(()=>{z.dismiss(),C({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:A.issuesPage,target:"_blank",className:"underline",children:"GitHub"}),"."]})})}),z.dismiss(),C({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."]})})},t[0]=r,t[1]=n,t[2]=l,t[3]=d):d=t[3];let m;t[4]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(sa,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(ia,{children:[m,(0,a.jsxs)(da,{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:Z,target:"_blank",children:Z}),"."]})]}),t[5]=w):w=t[5];let g;t[6]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{s(v.target.value.toLowerCase().replaceAll(/\s/g,"-").replaceAll(/[^\da-z-]/g,""))},t[6]=g):g=t[6];let u;t[7]===o?u=t[8]:(u=(0,a.jsx)(Yt,{"data-testid":"slug-input",id:"slug",autoFocus:!0,value:o,placeholder:"Notebook slug",onChange:g,required:!0,autoComplete:"off"}),t[7]=o,t[8]=u);let f;t[9]===i?f=t[10]:(f=(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)(Sa,{text:i}),(0,a.jsx)("span",{className:"text-primary",children:i})]})]}),t[9]=i,t[10]=f);let y;t[11]!==u||t[12]!==f?(y=(0,a.jsxs)("div",{className:"flex flex-col gap-6 py-4",children:[u,f]}),t[11]=u,t[12]=f,t[13]=y):y=t[13];let k;t[14]===n?k=t[15]:(k=(0,a.jsx)(pe,{"data-testid":"cancel-share-static-notebook-button",variant:"secondary",onClick:n,children:"Cancel"}),t[14]=n,t[15]=k);let b;t[16]===i?b=t[17]:(b=(0,a.jsx)(pe,{"data-testid":"share-static-notebook-button","aria-label":"Save",variant:"default",type:"submit",onClick:async()=>{await X(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(la,{children:[k,b]}),t[18]=k,t[19]=b,t[20]=x):x=t[20];let j;return t[21]!==d||t[22]!==x||t[23]!==y?(j=(0,a.jsx)(ra,{className:"w-fit",children:(0,a.jsxs)("form",{onSubmit:d,children:[w,y,x]})}),t[21]=d,t[22]=x,t[23]=y,t[24]=j):j=t[24],j};var Sa=e=>{let t=(0,Oe.c)(8),[n,o]=ye.useState(!1),s;t[0]===e.text?s=t[1]:(s=Ct.stopPropagation(async m=>{m.preventDefault(),await X(e.text),o(!0),setTimeout(()=>o(!1),2e3)}),t[0]=e.text,t[1]=s);let r=s,l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),t[2]=l):l=t[2];let i;t[3]===r?i=t[4]:(i=(0,a.jsx)(pe,{"data-testid":"copy-static-notebook-url-button",onClick:r,size:"xs",variant:"secondary",children:l}),t[3]=r,t[4]=i);let d;return t[5]!==n||t[6]!==i?(d=(0,a.jsx)(oa,{content:"Copied!",open:n,children:i}),t[5]=n,t[6]=i,t[7]=d):d=t[7],d},Da=_();function _a(){let e=document.getElementsByClassName(We.outputArea);for(let t of e){let n=t.getBoundingClientRect();if(n.bottom>0&&n.top<window.innerHeight){let o=ce.findElement(t);if(!o){T.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:ce.parse(o.id)}}}return T.warn("No visible output area found for scroll anchor"),null}function Aa(e){if(!e){T.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(ce.create(e.cellId));if(!t){T.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${We.outputArea}`)){T.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ve(){let e=(0,Da.c)(2),t=L(je),n;return e[0]===t?n=e[1]:(n=()=>{let o=_a();t(s=>({mode:ut(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Aa(o)})})},e[0]=t,e[1]=n),n}const Ye=Qe(!1);var Na=_();const Pa=()=>{let e=(0,Na.c)(7),{selectedLayout:t}=Se(),{setLayoutView:n}=De();if(he()&&!at("wasm_layouts"))return null;let o;e[0]===n?o=e[1]:(o=i=>n(i),e[0]=n,e[1]=o);let s;e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsx)(ta,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)(Xt,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Qt,{children:(0,a.jsxs)(ea,{children:[(0,a.jsx)(Jt,{children:"View as"}),Le.map(Ea)]})}),e[3]=r):r=e[3];let l;return e[4]!==t||e[5]!==o?(l=(0,a.jsxs)(aa,{"data-testid":"layout-select",value:t,onValueChange:o,children:[s,r]}),e[4]=t,e[5]=o,e[6]=l):l=e[6],l};function Ia(e){return(0,a.jsx)(Ke(e),{className:"h-4 w-4"})}function Ke(e){switch(e){case"vertical":return ja;case"grid":return qt;case"slides":return Be;default:return yt(e),Ft}}function Ue(e){return Ce(e)}function Ea(e){return(0,a.jsx)(Zt,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5 leading-5",children:[Ia(e),(0,a.jsx)("span",{children:Ue(e)})]})},e)}async function La(e){let{filename:t,preset:n,downloadPDF:o}=e;await o({filename:t,webpdf:!1,preset:n,includeInputs:!0,rasterServer:"static"})}var Ta=_();function Ha(e){let t=(0,Ta.c)(5),{openPrompt:n,closeModal:o}=fe(),{sendCopy:s}=H(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=Gt.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Ie.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Ie.dirname(e),i);s({source:e,destination:d}).then(()=>{o(),C({title:"Notebook copied",description:"A copy of the notebook has been created."}),fa(d)})}})},t[0]=o,t[1]=n,t[2]=s,t[3]=e,t[4]=r):r=t[4],r}const qa=()=>{let{updateCellConfig:e}=ge(),{saveCellConfig:t}=H();return(0,ye.useCallback)(async()=>{let n=new ot,o=ve(),s=o.cellIds.inOrderIds,r={};for(let i of s){if(o.cellData[i]===void 0)continue;let{code:d,config:m}=o.cellData[i];m.hide_code||n.isSupported(d)&&(r[i]={hide_code:!0})}let l=Me.entries(r);if(l.length!==0){await t({configs:r});for(let[i,d]of l)e({cellId:i,config:d})}},[e])};var Ra=_();function Ge(){let e=(0,Ra.c)(4),{openConfirm:t}=fe(),n=L(gt),{sendRestart:o}=H(),s;return e[0]!==t||e[1]!==o||e[2]!==n?(s=()=>{t({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)(na,{onClick:async()=>{n({state:jt.CLOSING}),await o(),ca()},"aria-label":"Confirm Restart",children:"Restart"})})},e[0]=t,e[1]=o,e[2]=n,e[3]=s):s=e[3],s}var Ba=_(),N=e=>{e==null||e.preventDefault(),e==null||e.stopPropagation()};function Fa(){var be,xe;let e=(0,Ba.c)(51),t=pa(),{openModal:n,closeModal:o}=fe(),{toggleApplication:s}=ft(),{selectedPanel:r}=it(),[l]=Ze(je),i=de(dt),d=qa(),[m]=wt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ge(),b=Ge(),x=ht(),j=Ha(t),v=L(Ye),P=L(bt),z=L(xt),{exportAsIPYNB:ee,exportAsMarkdown:te,readCode:I,saveCellConfig:ae,updateCellOutputs:M}=H(),W=ya(),oe=de(st),ne=de(mt),{selectedLayout:q}=Se(),{setLayoutView:ie}=De(),R=Ve(),B=((be=m.sharing)==null?void 0:be.html)??!0,F=((xe=m.sharing)==null?void 0:xe.wasm)??!0,ke=!he(),se=q==="slides",$e=so,Je=io,O;e[0]!==t||e[1]!==W||e[2]!==M?(O=async c=>{let{preset:p,title:E}=c;if(!t){Q();return}await Pe(E,async re=>{await Ee({takeScreenshots:()=>W({progress:re}),updateCellOutputs:M}),await La({filename:t,preset:p,downloadPDF:Wt})})},e[0]=t,e[1]=W,e[2]=M,e[3]=O):O=e[3];let S=O,V;e[4]===S?V=e[5]:(V=async()=>{if(ke){await S({preset:"document",title:"Downloading Document PDF..."});return}let c=new Event("export-beforeprint"),p=new Event("export-afterprint");window.dispatchEvent(c),setTimeout(no,0),setTimeout(()=>window.dispatchEvent(p),0)},e[4]=S,e[5]=V);let Y=V,K;e[6]!==ee||e[7]!==t||e[8]!==W||e[9]!==M?(K=async()=>{if(!t){Q();return}await Pe("Downloading IPYNB...",async c=>{await Ee({takeScreenshots:()=>W({progress:c}),updateCellOutputs:M});let p=await ee({download:!1});ue(new Blob([p],{type:"application/x-ipynb+json"}),me.toIPYNB(document.title))})},e[6]=ee,e[7]=t,e[8]=W,e[9]=M,e[10]=K):K=e[10];let le=K,U;e[11]===Symbol.for("react.memo_cache_sentinel")?(U=(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let G;e[12]===Symbol.for("react.memo_cache_sentinel")?(G=(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),e[12]=G):G=e[12];let D;e[13]===t?D=e[14]:(D=async()=>{if(!t){Q();return}await Ae({filename:t,includeCode:!0})},e[13]=t,e[14]=D);let $;return e[15]!==f||e[16]!==ne||e[17]!==u||e[18]!==o||e[19]!==y||e[20]!==j||e[21]!==S||e[22]!==k||e[23]!==te||e[24]!==t||e[25]!==Y||e[26]!==le||e[27]!==oe||e[28]!==d||e[29]!==se||e[30]!==i||e[31]!==n||e[32]!==I||e[33]!==b||e[34]!==x||e[35]!==ae||e[36]!==q||e[37]!==r||e[38]!==v||e[39]!==z||e[40]!==ie||e[41]!==P||e[42]!==B||e[43]!==F||e[44]!==D||e[45]!==s||e[46]!==R||e[47]!==g||e[48]!==w||e[49]!==l.mode?($=[{icon:U,label:"Download",handle:N,dropdown:[{icon:G,label:"Download as HTML",handle:D},{icon:(0,a.jsx)(_e,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){Q();return}await Ae({filename:t,includeCode:!1})}},{icon:(0,a.jsx)(ua,{strokeWidth:1.5,style:{width:14,height:14}}),label:"Download as Markdown",handle:async()=>{let c=await te({download:!1});ue(new Blob([c],{type:"text/plain"}),me.toMarkdown(document.title))}},{icon:(0,a.jsx)(va,{size:14,strokeWidth:1.5}),label:"Download as ipynb",handle:le},{icon:(0,a.jsx)(Mt,{size:14,strokeWidth:1.5}),label:"Download Python code",handle:async()=>{let c=await I();ue(new Blob([c.contents],{type:"text/plain"}),me.toPY(document.title))}},{divider:!0,icon:(0,a.jsx)(Ot,{size:14,strokeWidth:1.5}),label:"Download as PNG",disabled:l.mode!=="present",tooltip:l.mode==="present"?void 0:(0,a.jsxs)("span",{children:["Only available in app view. ",(0,a.jsx)("br",{}),"Toggle with: ",ma("global.hideCode",!1)]}),handle:oo},se?{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:N,dropdown:[{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Document Layout",handle:Y},{icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Slides Layout",rightElement:Je(!0),hidden:!ke,handle:async()=>{await S({preset:"slides",title:"Downloading Slides PDF..."})}}]}:{divider:!0,icon:(0,a.jsx)(J,{size:14,strokeWidth:1.5}),label:"Download as PDF",handle:Y}]},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!B&&!F,dropdown:[{icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"Publish HTML to web",hidden:!B,handle:async()=>{n((0,a.jsx)(Wa,{onClose:o}))}},{icon:(0,a.jsx)(Vt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await X(ha({code:(await I()).contents})),C({title:"Copied",description:"Link copied to clipboard."})}}]},{icon:(0,a.jsx)(Ca,{size:14,strokeWidth:1.5}),label:"Helper panel",redundant:!0,handle:N,dropdown:tt.flatMap(c=>{let{type:p,Icon:E,hidden:re,additionalKeywords:Xe}=c;return re?[]:{label:Ce(p),rightElement:$e(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:Xe}})},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Ut,{size:14,strokeWidth:1.5}):(0,a.jsx)(Re,{size:14,strokeWidth:1.5}),label:"Toggle app view",hotkey:"global.hideCode",handle:()=>{R()}},...Le.map((c,p)=>{let E=Ke(c);return{divider:p===0,label:Ue(c),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),rightElement:(0,a.jsx)("div",{className:"w-8 flex justify-end",children:q===c&&(0,a.jsx)(Ne,{size:14})}),handle:()=>{ie(c),l.mode==="edit"&&R()}}})]},{icon:(0,a.jsx)(wa,{size:14,strokeWidth:1.5}),label:"Duplicate notebook",hidden:!t||he(),handle:j},{icon:(0,a.jsx)(Te,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await X((await I()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(At,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!oe||i,handle:async()=>{let c=nt(ve());await ae({configs:Me.fromEntries(c.map(ao))});for(let p of c)w({cellId:p,config:{disabled:!1}})}},{divider:!0,icon:(0,a.jsx)(qe,{size:14,strokeWidth:1.5}),label:"Add setup cell",handle:()=>{f({})}},{icon:(0,a.jsx)(lt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(ze,{onClose:o}))}},{icon:(0,a.jsx)(kt,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(ze,{defaultTab:"storage",onClose:o}))}},{icon:(0,a.jsx)(Fe,{size:14,strokeWidth:1.5}),label:"Undo cell deletion",hidden:!ne||i,handle:()=>{g()}},{icon:(0,a.jsx)(Ma,{size:14,strokeWidth:1.5}),label:"Restart kernel",variant:"danger",handle:b,additionalKeywords:["reset","reload","restart"]},{icon:(0,a.jsx)(xa,{size:14,strokeWidth:1.5}),label:"Re-run all cells",redundant:!0,hotkey:"global.runAll",handle:async()=>{x()}},{icon:(0,a.jsx)(rt,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(It,{size:14,strokeWidth:1.5}),label:"Hide all markdown code",handle:d,redundant:!0},{icon:(0,a.jsx)(ba,{size:14,strokeWidth:1.5}),label:"Collapse all sections",hotkey:"global.collapseAllSections",handle:y,redundant:!0},{icon:(0,a.jsx)(ka,{size:14,strokeWidth:1.5}),label:"Expand all sections",hotkey:"global.expandAllSections",handle:k,redundant:!0},{divider:!0,icon:(0,a.jsx)(He,{size:14,strokeWidth:1.5}),label:"Command palette",hotkey:"global.commandPalette",handle:()=>v(to)},{icon:(0,a.jsx)(ga,{size:14,strokeWidth:1.5}),label:"Keyboard shortcuts",hotkey:"global.showHelp",handle:()=>z(eo)},{icon:(0,a.jsx)(Kt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>P(Qa),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(_t,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Za},{icon:(0,a.jsx)(Lt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Xa},{icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ja},{icon:(0,a.jsx)(Rt,{size:14,strokeWidth:1.5}),label:"YouTube",handle:$a},{icon:(0,a.jsx)(pt,{size:14,strokeWidth:1.5}),label:"Changelog",handle:Ga}]},{divider:!0,icon:(0,a.jsx)(Bt,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ua},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ka}].filter(Ya).map(Oa),e[15]=f,e[16]=ne,e[17]=u,e[18]=o,e[19]=y,e[20]=j,e[21]=S,e[22]=k,e[23]=te,e[24]=t,e[25]=Y,e[26]=le,e[27]=oe,e[28]=d,e[29]=se,e[30]=i,e[31]=n,e[32]=I,e[33]=b,e[34]=x,e[35]=ae,e[36]=q,e[37]=r,e[38]=v,e[39]=z,e[40]=ie,e[41]=P,e[42]=B,e[43]=F,e[44]=D,e[45]=s,e[46]=R,e[47]=g,e[48]=w,e[49]=l.mode,e[50]=$):$=e[50],$}function Oa(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Va)}:e}function Va(e){return!e.hidden}function Ya(e){return!e.hidden}function Ka(){let e=$t();window.open(e,"_blank")}function Ua(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function Ga(){window.open(A.releasesPage,"_blank")}function $a(){window.open(A.youtube,"_blank")}function Ja(){window.open(A.discordLink,"_blank")}function Xa(){window.open(A.githubPage,"_blank")}function Za(){window.open(A.docsPage,"_blank")}function Qa(e){return!e}function eo(e){return!e}function to(e){return!e}function ao(e){return[e,{disabled:!1}]}async function oo(){let e=document.getElementById("App");e&&await St({element:e,filename:document.title,prepare:Dt})}function no(){return window.print()}function io(e){return e?(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 so(e){return(0,a.jsx)("div",{className:"w-8 flex justify-end",children:e&&(0,a.jsx)(Ne,{size:14})})}function Q(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ve as a,qe as c,Ye as i,He as l,Ge as n,Fe as o,Pa as r,Re as s,Fa as t,Te as u};
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-D3l50M_C.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-lo-_Mee6.js"></script>
70
70
  <link rel="modulepreload" crossorigin href="./assets/preload-helper-BW0IMuFq.js">
71
71
  <link rel="modulepreload" crossorigin href="./assets/clsx-BDxNtGmi.js">
72
72
  <link rel="modulepreload" crossorigin href="./assets/cn-BoaCR37F.js">
@@ -162,7 +162,7 @@
162
162
  <link rel="modulepreload" crossorigin href="./assets/useAsyncData-a8f2Q_nk.js">
163
163
  <link rel="modulepreload" crossorigin href="./assets/errors-0IrrdfSG.js">
164
164
  <link rel="modulepreload" crossorigin href="./assets/error-banner-CAuK5DPN.js">
165
- <link rel="modulepreload" crossorigin href="./assets/copy-f2iEg0yL.js">
165
+ <link rel="modulepreload" crossorigin href="./assets/copy-BvFGCBvy.js">
166
166
  <link rel="modulepreload" crossorigin href="./assets/memoize-Bw1ifb7c.js">
167
167
  <link rel="modulepreload" crossorigin href="./assets/get-DBdMgUNq.js">
168
168
  <link rel="modulepreload" crossorigin href="./assets/capitalize-DcpkQwJe.js">
@@ -171,7 +171,7 @@
171
171
  <link rel="modulepreload" crossorigin href="./assets/refresh-cw-CHAHPgkx.js">
172
172
  <link rel="modulepreload" crossorigin href="./assets/trash-2-CAoNMkjq.js">
173
173
  <link rel="modulepreload" crossorigin href="./assets/triangle-alert-qZo1ox6x.js">
174
- <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-V-_6L1Ri.js">
174
+ <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-DxpOlTBW.js">
175
175
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-CuYNS33t.js">
176
176
  <link rel="modulepreload" crossorigin href="./assets/precisionRound-CCOoIlcP.js">
177
177
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-CGfP-Ye3.js">
@@ -184,16 +184,16 @@
184
184
  <link rel="modulepreload" crossorigin href="./assets/datasource-DIETDMi4.js">
185
185
  <link rel="modulepreload" crossorigin href="./assets/state-BN6sGgkm.js">
186
186
  <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-CimwFZPP.js">
187
- <link rel="modulepreload" crossorigin href="./assets/copy-icon-Cu7az85f.js">
187
+ <link rel="modulepreload" crossorigin href="./assets/copy-icon-HTFh4odu.js">
188
188
  <link rel="modulepreload" crossorigin href="./assets/html-to-image-DBFAQbWm.js">
189
189
  <link rel="modulepreload" crossorigin href="./assets/focus-q8oYkLV6.js">
190
- <link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-CwbmGJrl.js">
190
+ <link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-Cqo8_z2X.js">
191
191
  <link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-DEi7JZeU.js">
192
192
  <link rel="modulepreload" crossorigin href="./assets/katex-0Z75JF53.js">
193
- <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-D2_DEfz5.js">
193
+ <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-DwRjZSV8.js">
194
194
  <link rel="modulepreload" crossorigin href="./assets/command-DGKK2-4P.js">
195
195
  <link rel="modulepreload" crossorigin href="./assets/download-RVcmZh1N.js">
196
- <link rel="modulepreload" crossorigin href="./assets/RenderHTML-B0MiHkXS.js">
196
+ <link rel="modulepreload" crossorigin href="./assets/RenderHTML-ncKzTdNN.js">
197
197
  <link rel="modulepreload" crossorigin href="./assets/useIframeCapabilities-DG-6GyGn.js">
198
198
  <link rel="modulepreload" crossorigin href="./assets/formats-DEgTLsde.js">
199
199
  <link rel="modulepreload" crossorigin href="./assets/en-US-BO8E69bZ.js">
@@ -205,7 +205,7 @@
205
205
  <link rel="modulepreload" crossorigin href="./assets/useDateFormatter-DOoVZUts.js">
206
206
  <link rel="modulepreload" crossorigin href="./assets/range-CJeRXUtp.js">
207
207
  <link rel="modulepreload" crossorigin href="./assets/table-BCnp9gKC.js">
208
- <link rel="modulepreload" crossorigin href="./assets/JsonOutput-BRjuq1Jw.js">
208
+ <link rel="modulepreload" crossorigin href="./assets/JsonOutput-DjokO226.js">
209
209
  <link rel="modulepreload" crossorigin href="./assets/useDeleteCell-CmX8_XRr.js">
210
210
  <link rel="modulepreload" crossorigin href="./assets/icons-T5yQRjuT.js">
211
211
  <link rel="modulepreload" crossorigin href="./assets/process-output-BXIvuDcK.js">
@@ -215,32 +215,32 @@
215
215
  <link rel="modulepreload" crossorigin href="./assets/file-DzHkbIdO.js">
216
216
  <link rel="modulepreload" crossorigin href="./assets/image-DXfkah9d.js">
217
217
  <link rel="modulepreload" crossorigin href="./assets/play-DKSqmedg.js">
218
- <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-BC41mi_U.js">
218
+ <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-Bl1TJ3Bp.js">
219
219
  <link rel="modulepreload" crossorigin href="./assets/isEmpty-CfmnKtgL.js">
220
220
  <link rel="modulepreload" crossorigin href="./assets/bot-message-square-CK6eoGWy.js">
221
- <link rel="modulepreload" crossorigin href="./assets/chat-display-Dv9VfU7V.js">
221
+ <link rel="modulepreload" crossorigin href="./assets/chat-display-CWCYGDhk.js">
222
222
  <link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-DV8gdCvH.js">
223
223
  <link rel="modulepreload" crossorigin href="./assets/square-function-B006EYFX.js">
224
224
  <link rel="modulepreload" crossorigin href="./assets/spec-CYMZZDXr.js">
225
225
  <link rel="modulepreload" crossorigin href="./assets/ellipsis-vertical-CAB7tdza.js">
226
226
  <link rel="modulepreload" crossorigin href="./assets/components-U5Mj1xiO.js">
227
- <link rel="modulepreload" crossorigin href="./assets/column-preview-DBQzaLrY.js">
227
+ <link rel="modulepreload" crossorigin href="./assets/column-preview-UqRUB1pJ.js">
228
228
  <link rel="modulepreload" crossorigin href="./assets/toggle-AwCCScbH.js">
229
229
  <link rel="modulepreload" crossorigin href="./assets/globals-Bh7qAnqa.js">
230
230
  <link rel="modulepreload" crossorigin href="./assets/share-DdWa0mV7.js">
231
231
  <link rel="modulepreload" crossorigin href="./assets/_baseSet-D5BgdrnX.js">
232
232
  <link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-DTuXFbj-.js">
233
- <link rel="modulepreload" crossorigin href="./assets/context-aware-panel-CaZEaV8C.js">
233
+ <link rel="modulepreload" crossorigin href="./assets/context-aware-panel-DScGcWey.js">
234
234
  <link rel="modulepreload" crossorigin href="./assets/floating-outline-jCvD7_Ne.js">
235
235
  <link rel="modulepreload" crossorigin href="./assets/useAddCell-ErFmQedu.js">
236
236
  <link rel="modulepreload" crossorigin href="./assets/eye-off-vwi9L975.js">
237
- <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-YmScI7wz.js">
237
+ <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-Cyn1aSna.js">
238
238
  <link rel="modulepreload" crossorigin href="./assets/file-headphone-B5q2Ow55.js">
239
239
  <link rel="modulepreload" crossorigin href="./assets/file-icons-Br3viuqL.js">
240
240
  <link rel="modulepreload" crossorigin href="./assets/refresh-ccw-DLpfIr8v.js">
241
241
  <link rel="modulepreload" crossorigin href="./assets/form-BEIQJWib.js">
242
242
  <link rel="modulepreload" crossorigin href="./assets/field-9GctqEPJ.js">
243
- <link rel="modulepreload" crossorigin href="./assets/useBoolean-DbIYzMhl.js">
243
+ <link rel="modulepreload" crossorigin href="./assets/useBoolean-COWWzCBr.js">
244
244
  <link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-BEmJ3M7I.js">
245
245
  <link rel="modulepreload" crossorigin href="./assets/types-C1RN112u.js">
246
246
  <link rel="modulepreload" crossorigin href="./assets/prop-types-C638SUfx.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.20.5-dev83",
3
+ "version": "0.20.5-dev87",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -25,7 +25,7 @@ import { CellOutputId } from "@/core/cells/ids";
25
25
  import { isOutputEmpty } from "@/core/cells/outputs";
26
26
  import { goToDefinitionAtCursorPosition } from "@/core/codemirror/go-to-definition/utils";
27
27
  import { sendToPanelManager } from "@/core/vscode/vscode-bindings";
28
- import { copyToClipboard } from "@/utils/copy";
28
+ import { copyImageToClipboard, copyToClipboard } from "@/utils/copy";
29
29
  import { getImageExtension } from "@/utils/filenames";
30
30
  import { Logger } from "@/utils/Logger";
31
31
  import type { ActionButton } from "../actions/types";
@@ -127,11 +127,7 @@ export const CellActionsContextMenu = ({
127
127
  icon: <ClipboardCopyIcon size={13} strokeWidth={1.5} />,
128
128
  handle: async () => {
129
129
  if (imageRightClicked) {
130
- const response = await fetch(imageRightClicked.src);
131
- const blob = await response.blob();
132
- const item = new ClipboardItem({ [blob.type]: blob });
133
- await navigator.clipboard
134
- .write([item])
130
+ await copyImageToClipboard(imageRightClicked.src)
135
131
  .then(() => {
136
132
  toast({
137
133
  title: "Copied image to clipboard",
@@ -6,7 +6,7 @@ import {
6
6
  ChevronsUpDownIcon,
7
7
  WrapTextIcon,
8
8
  } from "lucide-react";
9
- import React, { useLayoutEffect } from "react";
9
+ import React, { useEffect, useLayoutEffect, useRef, useState } from "react";
10
10
  import { ToggleButton } from "react-aria-components";
11
11
  import { DebuggerControls } from "@/components/debugger/debugger-code";
12
12
  import { CopyClipboardIcon } from "@/components/icons/copy-icon";
@@ -33,6 +33,52 @@ import { useWrapText } from "../useWrapText";
33
33
  import { processOutput } from "./process-output";
34
34
  import { RenderTextWithLinks } from "./text-rendering";
35
35
 
36
+ /**
37
+ * Delay in ms before clearing console outputs.
38
+ * This prevents flickering when a cell re-runs and outputs are briefly cleared
39
+ * before new outputs arrive (e.g., plt.show() with a slider).
40
+ */
41
+ export const CONSOLE_CLEAR_DEBOUNCE_MS = 200;
42
+
43
+ /**
44
+ * Debounces the clearing of console outputs.
45
+ * - Non-empty updates are applied immediately.
46
+ * - Transitions to empty are delayed by CONSOLE_CLEAR_DEBOUNCE_MS,
47
+ * giving new outputs a chance to arrive and replace the old ones
48
+ * without a visible flicker.
49
+ */
50
+ function useDebouncedConsoleOutputs<T>(outputs: T[]): T[] {
51
+ const [debouncedOutputs, setDebouncedOutputs] = useState(outputs);
52
+ const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
53
+
54
+ // Non-empty outputs: apply immediately and cancel any pending clear
55
+ if (outputs.length > 0 && debouncedOutputs !== outputs) {
56
+ if (timerRef.current !== null) {
57
+ clearTimeout(timerRef.current);
58
+ timerRef.current = null;
59
+ }
60
+ setDebouncedOutputs(outputs);
61
+ }
62
+
63
+ // Empty outputs: delay the clear so new outputs can arrive first
64
+ useEffect(() => {
65
+ if (outputs.length === 0 && timerRef.current === null) {
66
+ timerRef.current = setTimeout(() => {
67
+ timerRef.current = null;
68
+ setDebouncedOutputs([]);
69
+ }, CONSOLE_CLEAR_DEBOUNCE_MS);
70
+ }
71
+ return () => {
72
+ if (timerRef.current !== null) {
73
+ clearTimeout(timerRef.current);
74
+ timerRef.current = null;
75
+ }
76
+ };
77
+ }, [outputs]);
78
+
79
+ return debouncedOutputs;
80
+ }
81
+
36
82
  interface Props {
37
83
  cellId: CellId;
38
84
  cellName: string;
@@ -63,7 +109,7 @@ const ConsoleOutputInternal = (props: Props): React.ReactNode => {
63
109
  setValue: setStdinValue,
64
110
  });
65
111
  const {
66
- consoleOutputs,
112
+ consoleOutputs: rawConsoleOutputs,
67
113
  stale,
68
114
  cellName,
69
115
  cellId,
@@ -73,6 +119,9 @@ const ConsoleOutputInternal = (props: Props): React.ReactNode => {
73
119
  className,
74
120
  } = props;
75
121
 
122
+ // Debounce clearing to prevent flickering when cells re-run
123
+ const consoleOutputs = useDebouncedConsoleOutputs(rawConsoleOutputs);
124
+
76
125
  /* The debugger UI needs some work. For now just use the regular
77
126
  /* console output. */
78
127
  /* if (debuggerActive) {
@@ -1,13 +1,13 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
- import { fireEvent, render, screen } from "@testing-library/react";
4
- import { describe, expect, it, vi } from "vitest";
3
+ import { act, fireEvent, render, screen } from "@testing-library/react";
4
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
5
5
  import { SetupMocks } from "@/__mocks__/common";
6
6
  import { TooltipProvider } from "@/components/ui/tooltip";
7
7
  import type { CellId } from "@/core/cells/ids";
8
8
  import type { WithResponse } from "@/core/cells/types";
9
9
  import type { OutputMessage } from "@/core/kernel/messages";
10
- import { ConsoleOutput } from "../ConsoleOutput";
10
+ import { CONSOLE_CLEAR_DEBOUNCE_MS, ConsoleOutput } from "../ConsoleOutput";
11
11
 
12
12
  SetupMocks.resizeObserver();
13
13
 
@@ -193,3 +193,94 @@ describe("ConsoleOutput pdb history", () => {
193
193
  expect(input).toHaveValue("");
194
194
  });
195
195
  });
196
+
197
+ describe("ConsoleOutput debounced clearing", () => {
198
+ beforeEach(() => {
199
+ vi.useFakeTimers();
200
+ });
201
+
202
+ afterEach(() => {
203
+ vi.useRealTimers();
204
+ });
205
+
206
+ const createOutput = (
207
+ data: string,
208
+ channel = "stdout",
209
+ ): WithResponse<OutputMessage> => ({
210
+ channel: channel as "stdout" | "stderr",
211
+ mimetype: "text/plain",
212
+ data,
213
+ timestamp: 0,
214
+ response: undefined,
215
+ });
216
+
217
+ const defaultProps = {
218
+ cellId: "cell-1" as CellId,
219
+ cellName: "test_cell",
220
+ consoleOutputs: [] as WithResponse<OutputMessage>[],
221
+ stale: false,
222
+ debuggerActive: false,
223
+ onSubmitDebugger: vi.fn(),
224
+ };
225
+
226
+ it("should keep old outputs visible when cleared, then show new outputs immediately", () => {
227
+ const outputs1 = [createOutput("hello world")];
228
+
229
+ const { rerender } = renderWithProvider(
230
+ <ConsoleOutput {...defaultProps} consoleOutputs={outputs1} />,
231
+ );
232
+
233
+ // Old output is visible
234
+ expect(screen.getByText("hello world")).toBeInTheDocument();
235
+
236
+ // Clear outputs (simulates cell re-run)
237
+ rerender(
238
+ <TooltipProvider>
239
+ <ConsoleOutput {...defaultProps} consoleOutputs={[]} />
240
+ </TooltipProvider>,
241
+ );
242
+
243
+ // Old output should still be visible during debounce period
244
+ expect(screen.getByText("hello world")).toBeInTheDocument();
245
+
246
+ // New outputs arrive before debounce fires
247
+ const outputs2 = [createOutput("new output")];
248
+ rerender(
249
+ <TooltipProvider>
250
+ <ConsoleOutput {...defaultProps} consoleOutputs={outputs2} />
251
+ </TooltipProvider>,
252
+ );
253
+
254
+ // New output should be shown immediately
255
+ expect(screen.getByText("new output")).toBeInTheDocument();
256
+ expect(screen.queryByText("hello world")).not.toBeInTheDocument();
257
+ });
258
+
259
+ it("should clear outputs after debounce period if no new outputs arrive", () => {
260
+ const outputs1 = [createOutput("old output")];
261
+
262
+ const { rerender } = renderWithProvider(
263
+ <ConsoleOutput {...defaultProps} consoleOutputs={outputs1} />,
264
+ );
265
+
266
+ expect(screen.getByText("old output")).toBeInTheDocument();
267
+
268
+ // Clear outputs
269
+ rerender(
270
+ <TooltipProvider>
271
+ <ConsoleOutput {...defaultProps} consoleOutputs={[]} />
272
+ </TooltipProvider>,
273
+ );
274
+
275
+ // Still visible during debounce
276
+ expect(screen.getByText("old output")).toBeInTheDocument();
277
+
278
+ // Advance past debounce period
279
+ act(() => {
280
+ vi.advanceTimersByTime(CONSOLE_CLEAR_DEBOUNCE_MS + 1);
281
+ });
282
+
283
+ // Now the output should be cleared
284
+ expect(screen.queryByText("old output")).not.toBeInTheDocument();
285
+ });
286
+ });