@marimo-team/frontend 0.21.2-dev27 → 0.21.2-dev28

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 (57) hide show
  1. package/dist/assets/JsonOutput-BKsCyU13.js +46 -0
  2. package/dist/assets/{LazyAnyLanguageCodeMirror-m8w66E4s.js → LazyAnyLanguageCodeMirror-Dmh6kfiy.js} +2 -2
  3. package/dist/assets/{RenderHTML-C_fyTOvC.js → RenderHTML-D_zT74Lq.js} +1 -1
  4. package/dist/assets/{add-cell-with-ai-BRtYorDJ.js → add-cell-with-ai-mTm-dtan.js} +1 -1
  5. package/dist/assets/{agent-panel-DGJVT16i.js → agent-panel-B33uC899.js} +4 -4
  6. package/dist/assets/{ai-model-dropdown-DudGwo8M.js → ai-model-dropdown-aWQwR5QF.js} +1 -1
  7. package/dist/assets/{any-language-editor-DwQMnAM3.js → any-language-editor-C4OP3txB.js} +1 -1
  8. package/dist/assets/{app-config-button-DpzUMkw9.js → app-config-button-BPvtPnFO.js} +1 -1
  9. package/dist/assets/{cell-editor-2jUky7HX.js → cell-editor-CphJ_7RI.js} +1 -1
  10. package/dist/assets/{chat-display-CUgnBuwx.js → chat-display-B6a8fK7j.js} +1 -1
  11. package/dist/assets/{chat-panel-BOonHbD0.js → chat-panel-B247iLHO.js} +1 -1
  12. package/dist/assets/{column-preview-DxF69H1r.js → column-preview-CtAbPvyW.js} +1 -1
  13. package/dist/assets/{command-palette-DOuVk9HJ.js → command-palette-Ba8b6UXV.js} +1 -1
  14. package/dist/assets/{common-lw1c9Wgv.js → common-DrrPhv3x.js} +1 -1
  15. package/dist/assets/{context-aware-panel-BvlpddI6.js → context-aware-panel-91O6JrAw.js} +3 -3
  16. package/dist/assets/copy-CA4fP28I.js +1 -0
  17. package/dist/assets/{copy-icon-BgmMM9Zg.js → copy-icon-C6n2vWSW.js} +1 -1
  18. package/dist/assets/{dependency-graph-panel-8tHjw4xN.js → dependency-graph-panel-BHHmugpa.js} +1 -1
  19. package/dist/assets/{documentation-panel-CiqkAFTI.js → documentation-panel-C0LXfz0P.js} +1 -1
  20. package/dist/assets/{edit-page-BVY1l3nw.js → edit-page-DrMpMRcp.js} +3 -3
  21. package/dist/assets/{file-explorer-panel-_OxGV-EN.js → file-explorer-panel-BS6bXHdR.js} +1 -1
  22. package/dist/assets/{glide-data-editor-xt5xNZeV.js → glide-data-editor-CoE8cs_o.js} +1 -1
  23. package/dist/assets/{home-page-h9VVoEDu.js → home-page-D7Z_Tlyv.js} +1 -1
  24. package/dist/assets/{hooks-Dy_0RQ1Z.js → hooks-3nahTPnh.js} +1 -1
  25. package/dist/assets/index-CIk_2P5O.js +38 -0
  26. package/dist/assets/{layout-BC0sIu2P.js → layout-fT20kG4_.js} +3 -3
  27. package/dist/assets/{markdown-renderer-Cj9ft7VI.js → markdown-renderer-A3Ed0cjI.js} +1 -1
  28. package/dist/assets/{packages-panel-B1mp4FDH.js → packages-panel-BU9XDexQ.js} +1 -1
  29. package/dist/assets/{panels-DQcWYSGG.js → panels-BQFJvWY0.js} +1 -1
  30. package/dist/assets/{readonly-python-code-CKdreYF8.js → readonly-python-code-i_LeNopW.js} +1 -1
  31. package/dist/assets/{run-page-BVFSk_-Z.js → run-page-DRNJCJFp.js} +1 -1
  32. package/dist/assets/{scratchpad-panel-DKj6qzI8.js → scratchpad-panel-DlQ1e62a.js} +1 -1
  33. package/dist/assets/{secrets-panel-B1Z-6dmz.js → secrets-panel-CfWyTaso.js} +1 -1
  34. package/dist/assets/{session-panel-C4ctrCWJ.js → session-panel-B1yjHqHu.js} +1 -1
  35. package/dist/assets/{snippets-panel-DXimlux2.js → snippets-panel-Dk7Ka2Gd.js} +1 -1
  36. package/dist/assets/{terminal-Cr7wbEjz.js → terminal-BZZqbl0D.js} +1 -1
  37. package/dist/assets/{useBoolean-3u0CYJkt.js → useBoolean-BYlCXj8U.js} +1 -1
  38. package/dist/assets/{useCellActionButton-CL2hZzP1.js → useCellActionButton-D-FPtHfb.js} +1 -1
  39. package/dist/assets/{useDependencyPanelTab-uG7OU1qF.js → useDependencyPanelTab-CYwz2tNi.js} +1 -1
  40. package/dist/assets/{useNotebookActions-DkhkeIz3.js → useNotebookActions-BeK3aC7s.js} +1 -1
  41. package/dist/index.html +14 -14
  42. package/package.json +1 -1
  43. package/src/components/data-table/__tests__/utils.test.ts +138 -1
  44. package/src/components/data-table/context-menu.tsx +9 -5
  45. package/src/components/data-table/data-table.tsx +3 -0
  46. package/src/components/data-table/range-focus/__tests__/atoms.test.ts +8 -2
  47. package/src/components/data-table/range-focus/__tests__/test-utils.ts +2 -0
  48. package/src/components/data-table/range-focus/__tests__/utils.test.ts +82 -8
  49. package/src/components/data-table/range-focus/atoms.ts +2 -2
  50. package/src/components/data-table/range-focus/utils.ts +50 -12
  51. package/src/components/data-table/types.ts +7 -0
  52. package/src/components/data-table/utils.ts +87 -0
  53. package/src/plugins/impl/DataTablePlugin.tsx +23 -2
  54. package/src/utils/copy.ts +18 -5
  55. package/dist/assets/JsonOutput-BRPU4yqw.js +0 -46
  56. package/dist/assets/copy-YwM0Pd7v.js +0 -1
  57. package/dist/assets/index-D3_EYEUd.js +0 -38
@@ -1 +1 @@
1
- import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as b}from"./useEvent-O0nX5vok.js";import{An as ne,E as de,Jn as se,Qn as re,Tn as ce,Xn as he,Yn as me,di as pe,mt as Q,v as ke,wn as fe}from"./cells-Bg7-G3QJ.js";import{t as ue}from"./compiler-runtime-B3qBwwSJ.js";import{a as ye,o as be,r as xe}from"./utils-tNbLd14P.js";import{t as je}from"./jsx-runtime-icT_Ltz2.js";import{r as ve}from"./requests-Bgjtqo_1.js";import{t as f}from"./createLucideIcon-Cm-Z7dYr.js";import{n as F,r as V}from"./x-BI1M8X_v.js";import{a as we,h as Ce}from"./download-hacnp18J.js";import{t as ge}from"./chevron-right-D0GQBpTb.js";import{t as G}from"./circle-plus-CGG-gArM.js";import{t as Ie}from"./code-xml-DwHPF_nL.js";import{t as ze}from"./eye-off-vwi9L975.js";import{t as We}from"./image-DXfkah9d.js";import{t as Me}from"./link-Cf10mh3t.js";import{t as _e}from"./play-DKSqmedg.js";import{a as Ae,n as Se}from"./state-CXu3CC70.js";import{t as Te}from"./trash-2-CAoNMkjq.js";import{t as De}from"./use-toast-Hc8CXlvz.js";import{r as Ee}from"./mode-CdFYvrq5.js";import{a as Ne,c as Re,n as Be}from"./dialog-CVN1lcMF.js";import{n as He}from"./ImperativeModal-qEtcJ95s.js";import{n as Le}from"./copy-YwM0Pd7v.js";import{i as Pe}from"./useRunCells-RUEojcb5.js";import{r as K}from"./html-to-image-CN0roffg.js";import{t as qe}from"./label-TNNaT1M9.js";import{t as Oe}from"./useDeleteCell-DSrWT4rB.js";import{n as Ue,t as Qe}from"./icons-CrUXojcA.js";import{n as J}from"./name-cell-input-l9v5UNrY.js";import{t as X}from"./multi-icon-DEWnuZs2.js";import{t as Fe}from"./useSplitCell-Ct0VLOTS.js";var Y=f("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),$=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"}]]),Ve=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 Ge(a){let e=new URL(window.location.href);return e.hash=`scrollTo=${encodeURIComponent(a)}`,e.toString()}function Ke(a){var c;let e=(c=a.match(/scrollTo=([^&]+)/))==null?void 0:c[1];return e?decodeURIComponent(e.split("&")[0]):null}function oe(a){return a==="_"?!1:!!(a&&a.trim().length>0)}var Je=ue(),l=ae(je(),1);function Xe(a){let e=(0,Je.c)(47),{cell:c,closePopover:u}=a,{createNewCell:m,updateCellConfig:s,updateCellName:x,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:A,markUntouched:S}=de(),T=Fe(),D=Pe(c==null?void 0:c.cellId),E=!b(ke),N=Oe(),{openModal:j}=He(),R=ie(Se),B=b(xe),v=b(be),te=b(Ee),y=b(ye),{saveCellConfig:r}=ve();if(!c||te){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0],o}let{cellId:t,config:i,getEditorView:d,name:h,hasOutput:w,hasConsoleOutput:H,status:L}=c,C;e[1]!==t||e[2]!==i.disabled||e[3]!==r||e[4]!==s?(C=async()=>{let o={disabled:!i.disabled};await r({configs:{[t]:o}}),s({cellId:t,config:o})},e[1]=t,e[2]=i.disabled,e[3]=r,e[4]=s,e[5]=C):C=e[5];let P=C,g;e[6]!==t||e[7]!==i.hide_code||e[8]!==d||e[9]!==r||e[10]!==s?(g=async()=>{let o={hide_code:!i.hide_code};await r({configs:{[t]:o}}),s({cellId:t,config:o});let U=d();U&&(o.hide_code?U.contentDOM.blur():U.focus())},e[6]=t,e[7]=i.hide_code,e[8]=d,e[9]=r,e[10]=s,e[11]=g):g=e[11];let q=g,n=t===pe,I;e[12]===Symbol.for("react.memo_cache_sentinel")?(I=(0,l.jsx)(_e,{size:13,strokeWidth:1.5}),e[12]=I):I=e[12];let O=L==="running"||L==="queued"||L==="disabled-transitively"||i.disabled,k;e[13]===D?k=e[14]:(k=()=>D(),e[13]=D,e[14]=k);let z;return e[15]!==_||e[16]!==B||e[17]!==y||e[18]!==v||e[19]!==E||e[20]!==t||e[21]!==A||e[22]!==u||e[23]!==i.disabled||e[24]!==i.hide_code||e[25]!==m||e[26]!==N||e[27]!==d||e[28]!==H||e[29]!==w||e[30]!==n||e[31]!==S||e[32]!==p||e[33]!==h||e[34]!==j||e[35]!==r||e[36]!==M||e[37]!==W||e[38]!==R||e[39]!==T||e[40]!==O||e[41]!==k||e[42]!==P||e[43]!==q||e[44]!==s||e[45]!==x?(z=[[{icon:I,label:"Run cell",hotkey:"cell.run",hidden:O,redundant:!0,handle:k},{icon:(0,l.jsx)(Ae,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!B,handle:()=>{R(o=>(o==null?void 0:o.cellId)===t?null:{cellId:t})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Z,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>T({cellId:t})},{icon:(0,l.jsx)(Ie,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let o=d();o&&ne({[t]:o})}},{icon:i.hide_code?(0,l.jsx)(se,{size:13,strokeWidth:1.5}):(0,l.jsx)(ze,{size:13,strokeWidth:1.5}),label:i.hide_code?"Show code":"Hide code",handle:q,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)(Qe,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let o=d();o&&(K({autoInstantiate:v,createNewCell:m}),Q(o,{language:"markdown",keepCodeAsIs:!1}),i.hide_code||(await r({configs:{[t]:{hide_code:!0}}}),s({cellId:t,config:{hide_code:!0}}),S({cellId:t})))},hidden:n},fe(d())==="sql"?{icon:(0,l.jsx)(Ue,{}),label:"View as Python",hotkey:"cell.viewAsSQL",handle:()=>{let o=d();o&&ce(o,"python",{force:!0})},hidden:n}:{icon:(0,l.jsx)(me,{size:13,strokeWidth:1.5}),label:"Convert to SQL",hotkey:"cell.viewAsSQL",handle:()=>{let o=d();o&&(K({autoInstantiate:v,createNewCell:m}),Q(o,{language:"sql",keepCodeAsIs:!1}))},hidden:n}],[{icon:(0,l.jsxs)(X,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(F,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>m({cellId:t,before:!0}),hidden:n,redundant:!0},{icon:(0,l.jsxs)(X,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(V,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>m({cellId:t,before:!1}),redundant:!0},{icon:(0,l.jsx)(F,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>p({cellId:t,before:!0}),hidden:n},{icon:(0,l.jsx)(V,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:t,before:!1}),hidden:n},{icon:(0,l.jsx)(Ce,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>p({cellId:t,direction:"left"}),hidden:y!=="columns"||n},{icon:(0,l.jsx)(ge,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>p({cellId:t,direction:"right"}),hidden:y!=="columns"||n},{icon:(0,l.jsx)($,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>W({cellId:t,scroll:!1}),hidden:n},{icon:(0,l.jsx)(Y,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>M({cellId:t,scroll:!1}),hidden:n},{icon:(0,l.jsx)(he,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",handle:()=>_({cellId:t}),hidden:y!=="columns"||n}],[{icon:(0,l.jsx)(We,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!w,handle:()=>we(t,"result")},{icon:(0,l.jsx)(re,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(w||H),handle:()=>{A({cellId:t})}}],[{icon:(0,l.jsx)(Ve,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:el,handleHeadless:()=>{j((0,l.jsxs)(Be,{children:[(0,l.jsx)(Ne,{children:(0,l.jsx)(Re,{children:"Rename cell"})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(qe,{htmlFor:"cell-name",children:"Cell name"}),(0,l.jsx)(J,{placeholder:"cell name",value:h,onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),o.stopPropagation(),j(null))},onChange:o=>x({cellId:t,name:o})})]})]}))},rightElement:(0,l.jsx)(J,{placeholder:"cell name",value:h,onChange:o=>x({cellId:t,name:o}),onEnterKey:()=>u==null?void 0:u()}),hidden:n},{icon:(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!oe(h),tooltip:oe(h)?void 0:"Only named cells can be linked to",handle:async()=>{await Le(Ge(h)),De({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!E,variant:"danger",icon:(0,l.jsx)(Te,{size:13,strokeWidth:1.5}),handle:()=>{N({cellId:t})}}]].map($e).filter(Ye),e[15]=_,e[16]=B,e[17]=y,e[18]=v,e[19]=E,e[20]=t,e[21]=A,e[22]=u,e[23]=i.disabled,e[24]=i.hide_code,e[25]=m,e[26]=N,e[27]=d,e[28]=H,e[29]=w,e[30]=n,e[31]=S,e[32]=p,e[33]=h,e[34]=j,e[35]=r,e[36]=M,e[37]=W,e[38]=R,e[39]=T,e[40]=O,e[41]=k,e[42]=P,e[43]=q,e[44]=s,e[45]=x,e[46]=z):z=e[46],z}function Ye(a){return a.length>0}function $e(a){return a.filter(Ze)}function Ze(a){return!a.hidden}function el(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Z as a,ee as i,Ke as n,$ as o,le as r,Y as s,Xe as t};
1
+ import{s as ae}from"./chunk-LvLJmgfZ.js";import{d as ie,u as b}from"./useEvent-O0nX5vok.js";import{An as ne,E as de,Jn as se,Qn as re,Tn as ce,Xn as he,Yn as me,di as pe,mt as Q,v as ke,wn as fe}from"./cells-Bg7-G3QJ.js";import{t as ue}from"./compiler-runtime-B3qBwwSJ.js";import{a as ye,o as be,r as xe}from"./utils-tNbLd14P.js";import{t as je}from"./jsx-runtime-icT_Ltz2.js";import{r as ve}from"./requests-Bgjtqo_1.js";import{t as f}from"./createLucideIcon-Cm-Z7dYr.js";import{n as F,r as V}from"./x-BI1M8X_v.js";import{a as we,h as Ce}from"./download-hacnp18J.js";import{t as ge}from"./chevron-right-D0GQBpTb.js";import{t as G}from"./circle-plus-CGG-gArM.js";import{t as Ie}from"./code-xml-DwHPF_nL.js";import{t as ze}from"./eye-off-vwi9L975.js";import{t as We}from"./image-DXfkah9d.js";import{t as Me}from"./link-Cf10mh3t.js";import{t as _e}from"./play-DKSqmedg.js";import{a as Ae,n as Se}from"./state-CXu3CC70.js";import{t as Te}from"./trash-2-CAoNMkjq.js";import{t as De}from"./use-toast-Hc8CXlvz.js";import{r as Ee}from"./mode-CdFYvrq5.js";import{a as Ne,c as Re,n as Be}from"./dialog-CVN1lcMF.js";import{n as He}from"./ImperativeModal-qEtcJ95s.js";import{n as Le}from"./copy-CA4fP28I.js";import{i as Pe}from"./useRunCells-RUEojcb5.js";import{r as K}from"./html-to-image-CN0roffg.js";import{t as qe}from"./label-TNNaT1M9.js";import{t as Oe}from"./useDeleteCell-DSrWT4rB.js";import{n as Ue,t as Qe}from"./icons-CrUXojcA.js";import{n as J}from"./name-cell-input-l9v5UNrY.js";import{t as X}from"./multi-icon-DEWnuZs2.js";import{t as Fe}from"./useSplitCell-Ct0VLOTS.js";var Y=f("chevrons-down",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]),$=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"}]]),Ve=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 Ge(a){let e=new URL(window.location.href);return e.hash=`scrollTo=${encodeURIComponent(a)}`,e.toString()}function Ke(a){var c;let e=(c=a.match(/scrollTo=([^&]+)/))==null?void 0:c[1];return e?decodeURIComponent(e.split("&")[0]):null}function oe(a){return a==="_"?!1:!!(a&&a.trim().length>0)}var Je=ue(),l=ae(je(),1);function Xe(a){let e=(0,Je.c)(47),{cell:c,closePopover:u}=a,{createNewCell:m,updateCellConfig:s,updateCellName:x,moveCell:p,sendToTop:W,sendToBottom:M,addColumnBreakpoint:_,clearCellOutput:A,markUntouched:S}=de(),T=Fe(),D=Pe(c==null?void 0:c.cellId),E=!b(ke),N=Oe(),{openModal:j}=He(),R=ie(Se),B=b(xe),v=b(be),te=b(Ee),y=b(ye),{saveCellConfig:r}=ve();if(!c||te){let o;return e[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],e[0]=o):o=e[0],o}let{cellId:t,config:i,getEditorView:d,name:h,hasOutput:w,hasConsoleOutput:H,status:L}=c,C;e[1]!==t||e[2]!==i.disabled||e[3]!==r||e[4]!==s?(C=async()=>{let o={disabled:!i.disabled};await r({configs:{[t]:o}}),s({cellId:t,config:o})},e[1]=t,e[2]=i.disabled,e[3]=r,e[4]=s,e[5]=C):C=e[5];let P=C,g;e[6]!==t||e[7]!==i.hide_code||e[8]!==d||e[9]!==r||e[10]!==s?(g=async()=>{let o={hide_code:!i.hide_code};await r({configs:{[t]:o}}),s({cellId:t,config:o});let U=d();U&&(o.hide_code?U.contentDOM.blur():U.focus())},e[6]=t,e[7]=i.hide_code,e[8]=d,e[9]=r,e[10]=s,e[11]=g):g=e[11];let q=g,n=t===pe,I;e[12]===Symbol.for("react.memo_cache_sentinel")?(I=(0,l.jsx)(_e,{size:13,strokeWidth:1.5}),e[12]=I):I=e[12];let O=L==="running"||L==="queued"||L==="disabled-transitively"||i.disabled,k;e[13]===D?k=e[14]:(k=()=>D(),e[13]=D,e[14]=k);let z;return e[15]!==_||e[16]!==B||e[17]!==y||e[18]!==v||e[19]!==E||e[20]!==t||e[21]!==A||e[22]!==u||e[23]!==i.disabled||e[24]!==i.hide_code||e[25]!==m||e[26]!==N||e[27]!==d||e[28]!==H||e[29]!==w||e[30]!==n||e[31]!==S||e[32]!==p||e[33]!==h||e[34]!==j||e[35]!==r||e[36]!==M||e[37]!==W||e[38]!==R||e[39]!==T||e[40]!==O||e[41]!==k||e[42]!==P||e[43]!==q||e[44]!==s||e[45]!==x?(z=[[{icon:I,label:"Run cell",hotkey:"cell.run",hidden:O,redundant:!0,handle:k},{icon:(0,l.jsx)(Ae,{size:13,strokeWidth:1.5}),label:"Refactor with AI",hidden:!B,handle:()=>{R(o=>(o==null?void 0:o.cellId)===t?null:{cellId:t})},hotkey:"cell.aiCompletion"},{icon:(0,l.jsx)(Z,{size:13,strokeWidth:1.5}),label:"Split",hotkey:"cell.splitCell",handle:()=>T({cellId:t})},{icon:(0,l.jsx)(Ie,{size:13,strokeWidth:1.5}),label:"Format",hotkey:"cell.format",handle:()=>{let o=d();o&&ne({[t]:o})}},{icon:i.hide_code?(0,l.jsx)(se,{size:13,strokeWidth:1.5}):(0,l.jsx)(ze,{size:13,strokeWidth:1.5}),label:i.hide_code?"Show code":"Hide code",handle:q,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)(Qe,{}),label:"Convert to Markdown",hotkey:"cell.viewAsMarkdown",handle:async()=>{let o=d();o&&(K({autoInstantiate:v,createNewCell:m}),Q(o,{language:"markdown",keepCodeAsIs:!1}),i.hide_code||(await r({configs:{[t]:{hide_code:!0}}}),s({cellId:t,config:{hide_code:!0}}),S({cellId:t})))},hidden:n},fe(d())==="sql"?{icon:(0,l.jsx)(Ue,{}),label:"View as Python",hotkey:"cell.viewAsSQL",handle:()=>{let o=d();o&&ce(o,"python",{force:!0})},hidden:n}:{icon:(0,l.jsx)(me,{size:13,strokeWidth:1.5}),label:"Convert to SQL",hotkey:"cell.viewAsSQL",handle:()=>{let o=d();o&&(K({autoInstantiate:v,createNewCell:m}),Q(o,{language:"sql",keepCodeAsIs:!1}))},hidden:n}],[{icon:(0,l.jsxs)(X,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(F,{size:8,strokeWidth:2})]}),label:"Create cell above",hotkey:"cell.createAbove",handle:()=>m({cellId:t,before:!0}),hidden:n,redundant:!0},{icon:(0,l.jsxs)(X,{children:[(0,l.jsx)(G,{size:13,strokeWidth:1.5}),(0,l.jsx)(V,{size:8,strokeWidth:2})]}),label:"Create cell below",hotkey:"cell.createBelow",handle:()=>m({cellId:t,before:!1}),redundant:!0},{icon:(0,l.jsx)(F,{size:13,strokeWidth:1.5}),label:"Move cell up",hotkey:"cell.moveUp",handle:()=>p({cellId:t,before:!0}),hidden:n},{icon:(0,l.jsx)(V,{size:13,strokeWidth:1.5}),label:"Move cell down",hotkey:"cell.moveDown",handle:()=>p({cellId:t,before:!1}),hidden:n},{icon:(0,l.jsx)(Ce,{size:13,strokeWidth:1.5}),label:"Move cell left",hotkey:"cell.moveLeft",handle:()=>p({cellId:t,direction:"left"}),hidden:y!=="columns"||n},{icon:(0,l.jsx)(ge,{size:13,strokeWidth:1.5}),label:"Move cell right",hotkey:"cell.moveRight",handle:()=>p({cellId:t,direction:"right"}),hidden:y!=="columns"||n},{icon:(0,l.jsx)($,{size:13,strokeWidth:1.5}),label:"Send to top",hotkey:"cell.sendToTop",handle:()=>W({cellId:t,scroll:!1}),hidden:n},{icon:(0,l.jsx)(Y,{size:13,strokeWidth:1.5}),label:"Send to bottom",hotkey:"cell.sendToBottom",handle:()=>M({cellId:t,scroll:!1}),hidden:n},{icon:(0,l.jsx)(he,{size:13,strokeWidth:1.5}),label:"Break into new column",hotkey:"cell.addColumnBreakpoint",handle:()=>_({cellId:t}),hidden:y!=="columns"||n}],[{icon:(0,l.jsx)(We,{size:13,strokeWidth:1.5}),label:"Export output as PNG",hidden:!w,handle:()=>we(t,"result")},{icon:(0,l.jsx)(re,{size:13,strokeWidth:1.5}),label:"Clear output",hidden:!(w||H),handle:()=>{A({cellId:t})}}],[{icon:(0,l.jsx)(Ve,{size:13,strokeWidth:1.5}),label:"Name",disableClick:!0,handle:el,handleHeadless:()=>{j((0,l.jsxs)(Be,{children:[(0,l.jsx)(Ne,{children:(0,l.jsx)(Re,{children:"Rename cell"})}),(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)(qe,{htmlFor:"cell-name",children:"Cell name"}),(0,l.jsx)(J,{placeholder:"cell name",value:h,onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),o.stopPropagation(),j(null))},onChange:o=>x({cellId:t,name:o})})]})]}))},rightElement:(0,l.jsx)(J,{placeholder:"cell name",value:h,onChange:o=>x({cellId:t,name:o}),onEnterKey:()=>u==null?void 0:u()}),hidden:n},{icon:(0,l.jsx)(Me,{size:13,strokeWidth:1.5}),label:"Copy link to cell",disabled:!oe(h),tooltip:oe(h)?void 0:"Only named cells can be linked to",handle:async()=>{await Le(Ge(h)),De({description:"Link copied to clipboard"})}}],[{label:"Delete",hidden:!E,variant:"danger",icon:(0,l.jsx)(Te,{size:13,strokeWidth:1.5}),handle:()=>{N({cellId:t})}}]].map($e).filter(Ye),e[15]=_,e[16]=B,e[17]=y,e[18]=v,e[19]=E,e[20]=t,e[21]=A,e[22]=u,e[23]=i.disabled,e[24]=i.hide_code,e[25]=m,e[26]=N,e[27]=d,e[28]=H,e[29]=w,e[30]=n,e[31]=S,e[32]=p,e[33]=h,e[34]=j,e[35]=r,e[36]=M,e[37]=W,e[38]=R,e[39]=T,e[40]=O,e[41]=k,e[42]=P,e[43]=q,e[44]=s,e[45]=x,e[46]=z):z=e[46],z}function Ye(a){return a.length>0}function $e(a){return a.filter(Ze)}function Ze(a){return!a.hidden}function el(a){a==null||a.stopPropagation(),a==null||a.preventDefault()}export{Z as a,ee as i,Ke as n,$ as o,le as r,Y as s,Xe as t};
@@ -1 +1 @@
1
- import{s as G}from"./chunk-LvLJmgfZ.js";import{d as X,l as Y,n as M,p as Z,u as $}from"./useEvent-O0nX5vok.js";import{t as ee}from"./react-Bj1aDYRI.js";import{G as te,yt as re}from"./cells-Bg7-G3QJ.js";import{t as V}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-CL2hZzP1.js";import{a as oe,n as ie,o as ce,t as me}from"./tooltip-D9723Brr.js";import{d as de}from"./alert-dialog-9WfvUF7e.js";import{i as B,r as he,t as J}from"./popover-BPGG2gPG.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-Bb5BQ9IQ.js";import{n as ve}from"./focus-DKnBT1ji.js";import{a as Ne,i as ge}from"./renderShortcut-CnD1Dah5.js";var we=ne("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),K=V(),h=G(ee(),1),t=G(le(),1);const L=h.memo(h.forwardRef((r,a)=>{let e=(0,K.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 W=N,D=(0,h.useRef)(null),E=se({cell:m,closePopover:W}).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=M(g),w;e[2]===T?w=e[3]:(w=s=>{I(o=>{let l=typeof s=="function"?s(o):s;return l&&T(),l})},e[2]=T,e[3]=w);let i=M(w),k;e[4]===i?k=e[5]:(k=()=>({toggle:()=>i(Se)}),e[4]=i,e[5]=k),(0,h.useImperativeHandle)(a,k);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)(J,{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)(J,{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})),Q=h.memo(r=>{let a=(0,K.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)(L,{showTooltip:!1,...m,children:e}),a[2]=e,a[3]=m,a[4]=p):p=a[4],p});Q.displayName="ConnectionCellActionsDropdown";function ke(r){return!r.redundant}function Ce(r){return r.filter(ke)}function _e(r){return r.length>0}function Se(r){return!r}var Ie=V();const U=Z("minimap");function De(){let r=(0,Ie.c)(3),[a,e]=Y(U),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(U)}export{we as a,Q as i,Pe as n,L as r,De as t};
1
+ import{s as G}from"./chunk-LvLJmgfZ.js";import{d as X,l as Y,n as M,p as Z,u as $}from"./useEvent-O0nX5vok.js";import{t as ee}from"./react-Bj1aDYRI.js";import{G as te,yt as re}from"./cells-Bg7-G3QJ.js";import{t as V}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-D-FPtHfb.js";import{a as oe,n as ie,o as ce,t as me}from"./tooltip-D9723Brr.js";import{d as de}from"./alert-dialog-9WfvUF7e.js";import{i as B,r as he,t as J}from"./popover-BPGG2gPG.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-Bb5BQ9IQ.js";import{n as ve}from"./focus-DKnBT1ji.js";import{a as Ne,i as ge}from"./renderShortcut-CnD1Dah5.js";var we=ne("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),K=V(),h=G(ee(),1),t=G(le(),1);const L=h.memo(h.forwardRef((r,a)=>{let e=(0,K.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 W=N,D=(0,h.useRef)(null),E=se({cell:m,closePopover:W}).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=M(g),w;e[2]===T?w=e[3]:(w=s=>{I(o=>{let l=typeof s=="function"?s(o):s;return l&&T(),l})},e[2]=T,e[3]=w);let i=M(w),k;e[4]===i?k=e[5]:(k=()=>({toggle:()=>i(Se)}),e[4]=i,e[5]=k),(0,h.useImperativeHandle)(a,k);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)(J,{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)(J,{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})),Q=h.memo(r=>{let a=(0,K.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)(L,{showTooltip:!1,...m,children:e}),a[2]=e,a[3]=m,a[4]=p):p=a[4],p});Q.displayName="ConnectionCellActionsDropdown";function ke(r){return!r.redundant}function Ce(r){return r.filter(ke)}function _e(r){return r.length>0}function Se(r){return!r}var Ie=V();const U=Z("minimap");function De(){let r=(0,Ie.c)(3),[a,e]=Y(U),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(U)}export{we as a,Q as i,Pe as n,L 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 Xe,u as de}from"./useEvent-O0nX5vok.js";import{t as et}from"./react-Bj1aDYRI.js";import{Cr as tt,E as ge,Ft as at,Qn as ot,Yn as nt,_ as it,dn as st,fn as lt,gn as rt,h as je,li as ce,pn as dt,qn as ct,rr as ht,t as pt}from"./cells-Bg7-G3QJ.js";import{t as _}from"./compiler-runtime-B3qBwwSJ.js";import{n as mt}from"./assertNever-DWSyoPEi.js";import{s as ve}from"./useLifecycle-DA9DjSPo.js";import{i as ut,n as Ce}from"./add-connection-dialog-D-YPxf1v.js";import{n as ft,x as yt}from"./ai-model-dropdown-DudGwo8M.js";import{c as ze,m as H}from"./useEventListener-Dy81QR4n.js";import{y as kt}from"./utils-tNbLd14P.js";import{n as A,t as Me}from"./constants-Rz_lD4HK.js";import{S as he,h as bt,x as xt}from"./config-3Aq84phF.js";import{t as wt}from"./jsx-runtime-icT_Ltz2.js";import{r as gt,t as pe}from"./button-Ej3vmCIF.js";import{r as T}from"./requests-Bgjtqo_1.js";import{t as h}from"./createLucideIcon-Cm-Z7dYr.js";import{a as We,f as jt,i as Se,m as vt,p as De,u as _e}from"./layout-BC0sIu2P.js";import{t as Ae}from"./check-BE0hEwVo.js";import{c as Ne,d as me,n as Ct,o as zt,r as ue,t as Mt}from"./download-hacnp18J.js";import{f as Wt}from"./maps-OKerBHH8.js";import{r as St}from"./useCellActionButton-CL2hZzP1.js";import{t as Dt}from"./copy-CkudG0Ej.js";import{t as _t}from"./download-DBW9RXtT.js";import{t as At}from"./eye-off-vwi9L975.js";import{t as Nt}from"./file-plus-corner-lLQw9OnR.js";import{t as J}from"./file-DzHkbIdO.js";import{t as Pt}from"./github-BVtI-3F1.js";import{m as It}from"./form-DRz7hUP9.js";import{n as Et,r as Lt,t as Ht}from"./youtube-DE-Ej6FR.js";import{n as Tt,t as qt}from"./square-CxAsQQ77.js";import{t as Rt}from"./image-DXfkah9d.js";import{t as Bt}from"./link-Cf10mh3t.js";import{r as Ft}from"./input-CUwqpKjd.js";import{t as Vt}from"./settings-CzQUw9rV.js";import{x as Yt}from"./azure-B4I1bDnQ.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as Pe,t as Ot}from"./paths-D2lG83Oh.js";import{o as Kt}from"./session-BrEm7qNv.js";import{a as Ut,c as $t,i as Gt,n as Jt,r as Qt,s as Zt,t as Xt}from"./select-CxT2Geqr.js";import{t as ea}from"./tooltip-D9723Brr.js";import{a as Ie,i as ta,r as aa}from"./mode-CdFYvrq5.js";import{o as oa}from"./alert-dialog-9WfvUF7e.js";import{a as na,c as ia,i as sa,n as la,r as ra}from"./dialog-CVN1lcMF.js";import{n as fe}from"./ImperativeModal-qEtcJ95s.js";import{r as da,t as ca}from"./share-BdH_5I58.js";import{n as Q}from"./copy-YwM0Pd7v.js";import{r as ha}from"./useRunCells-RUEojcb5.js";import{a as pa}from"./cell-link-DFqw-p8a.js";import{a as ma}from"./renderShortcut-CnD1Dah5.js";import{t as ua}from"./icons-CrUXojcA.js";import{t as fa}from"./links-CIQwYQ48.js";import{r as ya,t as Ee}from"./hooks-Dy_0RQ1Z.js";import{t as Le}from"./types-BfP_kuAY.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"}]]),He=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"}]]),Te=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"}]]),Ve=_(),ye=we(et(),1),a=we(wt(),1),Z="https://static.marimo.app";const Wa=e=>{let t=(0,Ve.c)(25),{onClose:n}=e,[o,s]=(0,ye.useState)(""),{exportAsHTML:r}=T(),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:jt.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)(ia,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(na,{children:[m,(0,a.jsxs)(ra,{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)(Ft,{"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 Q(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(sa,{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)(la,{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,Ve.c)(8),[n,o]=ye.useState(!1),s;t[0]===e.text?s=t[1]:(s=gt.stopPropagation(async m=>{m.preventDefault(),await Q(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)(Dt,{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)(ea,{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(Me.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){H.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:ce.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function Aa(e){if(!e){H.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(ce.create(e.cellId));if(!t){H.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${Me.outputArea}`)){H.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ye(){let e=(0,Da.c)(2),t=L(Ie),n;return e[0]===t?n=e[1]:(n=()=>{let o=_a();t(s=>({mode:ta(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Aa(o)})})},e[0]=t,e[1]=n),n}const Oe=Xe(!1);var Na=_();const Pa=()=>{let e=(0,Na.c)(7),{selectedLayout:t}=We(),{setLayoutView:n}=Se();if(he()&&!rt("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)(Zt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)($t,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Jt,{children:(0,a.jsxs)(Qt,{children:[(0,a.jsx)(Ut,{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)(Xt,{"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 Lt;case"slides":return Be;default:return mt(e),qt}}function Ue(e){return ve(e)}function Ea(e){return(0,a.jsx)(Gt,{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 Ha=_();function Ta(e){let t=(0,Ha.c)(5),{openPrompt:n,closeModal:o}=fe(),{sendCopy:s}=T(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=Ot.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Pe.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Pe.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}=T();return(0,ye.useCallback)(async()=>{let n=new at,o=je(),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=ze.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 $e(){let e=(0,Ra.c)(4),{openConfirm:t}=fe(),n=L(bt),{sendRestart:o}=T(),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)(oa,{onClick:async()=>{n({state:xt.CLOSING}),await o(),da()},"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}=st(),{selectedPanel:r}=lt(),[l]=Ze(Ie),i=de(aa),d=qa(),[m]=kt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ge(),b=$e(),x=ha(),j=Ta(t),v=L(Oe),P=L(ft),z=L(yt),{exportAsIPYNB:ee,exportAsMarkdown:te,readCode:I,saveCellConfig:ae,updateCellOutputs:M}=T(),W=ya(),oe=de(it),ne=de(pt),{selectedLayout:q}=We(),{setLayoutView:ie}=Se(),R=Ye(),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",Ge=so,Je=io,V;e[0]!==t||e[1]!==W||e[2]!==M?(V=async c=>{let{preset:p,title:E}=c;if(!t){X();return}await Ne(E,async re=>{await Ee({takeScreenshots:()=>W({progress:re}),updateCellOutputs:M}),await La({filename:t,preset:p,downloadPDF:Ct})})},e[0]=t,e[1]=W,e[2]=M,e[3]=V):V=e[3];let S=V,Y;e[4]===S?Y=e[5]:(Y=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]=Y);let O=Y,K;e[6]!==ee||e[7]!==t||e[8]!==W||e[9]!==M?(K=async()=>{if(!t){X();return}await Ne("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)(_t,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let $;e[12]===Symbol.for("react.memo_cache_sentinel")?($=(0,a.jsx)(De,{size:14,strokeWidth:1.5}),e[12]=$):$=e[12];let D;e[13]===t?D=e[14]:(D=async()=>{if(!t){X();return}await _e({filename:t,includeCode:!0})},e[13]=t,e[14]=D);let G;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]!==O||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?(G=[{icon:U,label:"Download",handle:N,dropdown:[{icon:$,label:"Download as HTML",handle:D},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){X();return}await _e({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)(vt,{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)(Rt,{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:O},{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:O}]},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!B&&!F,dropdown:[{icon:(0,a.jsx)(It,{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)(Bt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await Q(ca({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:dt.flatMap(c=>{let{type:p,Icon:E,hidden:re,additionalKeywords:Qe}=c;return re?[]:{label:ve(p),rightElement:Ge(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:Qe}})},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Yt,{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)(Ae,{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)(He,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await Q((await I()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!oe||i,handle:async()=>{let c=tt(je());await ae({configs:ze.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)(nt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Ce,{onClose:o}))}},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Ce,{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)(ot,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(At,{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)(Te,{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)(Vt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>P(Xa),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(ht,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Za},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Qa},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ja},{icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Ga},{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Changelog",handle:$a}]},{divider:!0,icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ua},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ka}].filter(Oa).map(Va),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]=O,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]=G):G=e[50],G}function Va(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ya)}:e}function Ya(e){return!e.hidden}function Oa(e){return!e.hidden}function Ka(){let e=Kt();window.open(e,"_blank")}function Ua(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function $a(){window.open(A.releasesPage,"_blank")}function Ga(){window.open(A.youtube,"_blank")}function Ja(){window.open(A.discordLink,"_blank")}function Qa(){window.open(A.githubPage,"_blank")}function Za(){window.open(A.docsPage,"_blank")}function Xa(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 zt({element:e,filename:document.title,prepare:Mt})}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)(Ae,{size:14})})}function X(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ye as a,qe as c,Oe as i,Te as l,$e as n,Fe as o,Pa as r,Re as s,Fa as t,He as u};
1
+ import{s as we}from"./chunk-LvLJmgfZ.js";import{d as L,l as Ze,p as Xe,u as de}from"./useEvent-O0nX5vok.js";import{t as et}from"./react-Bj1aDYRI.js";import{Cr as tt,E as ge,Ft as at,Qn as ot,Yn as nt,_ as it,dn as st,fn as lt,gn as rt,h as je,li as ce,pn as dt,qn as ct,rr as ht,t as pt}from"./cells-Bg7-G3QJ.js";import{t as _}from"./compiler-runtime-B3qBwwSJ.js";import{n as mt}from"./assertNever-DWSyoPEi.js";import{s as ve}from"./useLifecycle-DA9DjSPo.js";import{i as ut,n as Ce}from"./add-connection-dialog-D-YPxf1v.js";import{n as ft,x as yt}from"./ai-model-dropdown-aWQwR5QF.js";import{c as ze,m as H}from"./useEventListener-Dy81QR4n.js";import{y as kt}from"./utils-tNbLd14P.js";import{n as A,t as Me}from"./constants-Rz_lD4HK.js";import{S as he,h as bt,x as xt}from"./config-3Aq84phF.js";import{t as wt}from"./jsx-runtime-icT_Ltz2.js";import{r as gt,t as pe}from"./button-Ej3vmCIF.js";import{r as T}from"./requests-Bgjtqo_1.js";import{t as h}from"./createLucideIcon-Cm-Z7dYr.js";import{a as We,f as jt,i as Se,m as vt,p as De,u as _e}from"./layout-fT20kG4_.js";import{t as Ae}from"./check-BE0hEwVo.js";import{c as Ne,d as me,n as Ct,o as zt,r as ue,t as Mt}from"./download-hacnp18J.js";import{f as Wt}from"./maps-OKerBHH8.js";import{r as St}from"./useCellActionButton-D-FPtHfb.js";import{t as Dt}from"./copy-CkudG0Ej.js";import{t as _t}from"./download-DBW9RXtT.js";import{t as At}from"./eye-off-vwi9L975.js";import{t as Nt}from"./file-plus-corner-lLQw9OnR.js";import{t as J}from"./file-DzHkbIdO.js";import{t as Pt}from"./github-BVtI-3F1.js";import{m as It}from"./form-DRz7hUP9.js";import{n as Et,r as Lt,t as Ht}from"./youtube-DE-Ej6FR.js";import{n as Tt,t as qt}from"./square-CxAsQQ77.js";import{t as Rt}from"./image-DXfkah9d.js";import{t as Bt}from"./link-Cf10mh3t.js";import{r as Ft}from"./input-CUwqpKjd.js";import{t as Vt}from"./settings-CzQUw9rV.js";import{x as Yt}from"./azure-B4I1bDnQ.js";import{t as C}from"./use-toast-Hc8CXlvz.js";import{n as Pe,t as Ot}from"./paths-D2lG83Oh.js";import{o as Kt}from"./session-BrEm7qNv.js";import{a as Ut,c as $t,i as Gt,n as Jt,r as Qt,s as Zt,t as Xt}from"./select-CxT2Geqr.js";import{t as ea}from"./tooltip-D9723Brr.js";import{a as Ie,i as ta,r as aa}from"./mode-CdFYvrq5.js";import{o as oa}from"./alert-dialog-9WfvUF7e.js";import{a as na,c as ia,i as sa,n as la,r as ra}from"./dialog-CVN1lcMF.js";import{n as fe}from"./ImperativeModal-qEtcJ95s.js";import{r as da,t as ca}from"./share-BdH_5I58.js";import{n as Q}from"./copy-CA4fP28I.js";import{r as ha}from"./useRunCells-RUEojcb5.js";import{a as pa}from"./cell-link-DFqw-p8a.js";import{a as ma}from"./renderShortcut-CnD1Dah5.js";import{t as ua}from"./icons-CrUXojcA.js";import{t as fa}from"./links-CIQwYQ48.js";import{r as ya,t as Ee}from"./hooks-3nahTPnh.js";import{t as Le}from"./types-BfP_kuAY.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"}]]),He=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"}]]),Te=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"}]]),Ve=_(),ye=we(et(),1),a=we(wt(),1),Z="https://static.marimo.app";const Wa=e=>{let t=(0,Ve.c)(25),{onClose:n}=e,[o,s]=(0,ye.useState)(""),{exportAsHTML:r}=T(),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:jt.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)(ia,{children:"Share static notebook"}),t[4]=m):m=t[4];let w;t[5]===Symbol.for("react.memo_cache_sentinel")?(w=(0,a.jsxs)(na,{children:[m,(0,a.jsxs)(ra,{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)(Ft,{"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 Q(i)},children:"Create"}),t[16]=i,t[17]=b);let x;t[18]!==k||t[19]!==b?(x=(0,a.jsxs)(sa,{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)(la,{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,Ve.c)(8),[n,o]=ye.useState(!1),s;t[0]===e.text?s=t[1]:(s=gt.stopPropagation(async m=>{m.preventDefault(),await Q(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)(Dt,{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)(ea,{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(Me.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){H.warn("Could not find HTMLCellId for visible output area",t);continue}return{cellId:ce.parse(o.id)}}}return H.warn("No visible output area found for scroll anchor"),null}function Aa(e){if(!e){H.warn("No scroll anchor provided to restore scroll position");return}let t=document.getElementById(ce.create(e.cellId));if(!t){H.warn("Could not find cell element to restore scroll position",e.cellId);return}if(!t.querySelector(`.${Me.outputArea}`)){H.warn("Could not find output area to restore scroll position",e.cellId);return}t.scrollIntoView({block:"start",behavior:"auto"})}function Ye(){let e=(0,Da.c)(2),t=L(Ie),n;return e[0]===t?n=e[1]:(n=()=>{let o=_a();t(s=>({mode:ta(s.mode),cellAnchor:(o==null?void 0:o.cellId)??null})),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Aa(o)})})},e[0]=t,e[1]=n),n}const Oe=Xe(!1);var Na=_();const Pa=()=>{let e=(0,Na.c)(7),{selectedLayout:t}=We(),{setLayoutView:n}=Se();if(he()&&!rt("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)(Zt,{className:"min-w-[110px] border-border bg-background","data-testid":"layout-select",children:(0,a.jsx)($t,{placeholder:"Select a view"})}),e[2]=s):s=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,a.jsx)(Jt,{children:(0,a.jsxs)(Qt,{children:[(0,a.jsx)(Ut,{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)(Xt,{"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 Lt;case"slides":return Be;default:return mt(e),qt}}function Ue(e){return ve(e)}function Ea(e){return(0,a.jsx)(Gt,{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 Ha=_();function Ta(e){let t=(0,Ha.c)(5),{openPrompt:n,closeModal:o}=fe(),{sendCopy:s}=T(),r;return t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==e?(r=()=>{if(!e)return null;let l=Ot.guessDeliminator(e);n({title:"Copy notebook",description:"Enter a new filename for the notebook copy.",defaultValue:`_${Pe.basename(e)}`,confirmText:"Copy notebook",spellCheck:!1,onConfirm:i=>{let d=l.join(Pe.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}=T();return(0,ye.useCallback)(async()=>{let n=new at,o=je(),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=ze.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 $e(){let e=(0,Ra.c)(4),{openConfirm:t}=fe(),n=L(bt),{sendRestart:o}=T(),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)(oa,{onClick:async()=>{n({state:xt.CLOSING}),await o(),da()},"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}=st(),{selectedPanel:r}=lt(),[l]=Ze(Ie),i=de(aa),d=qa(),[m]=kt(),{updateCellConfig:w,undoDeleteCell:g,clearAllCellOutputs:u,addSetupCellIfDoesntExist:f,collapseAllCells:y,expandAllCells:k}=ge(),b=$e(),x=ha(),j=Ta(t),v=L(Oe),P=L(ft),z=L(yt),{exportAsIPYNB:ee,exportAsMarkdown:te,readCode:I,saveCellConfig:ae,updateCellOutputs:M}=T(),W=ya(),oe=de(it),ne=de(pt),{selectedLayout:q}=We(),{setLayoutView:ie}=Se(),R=Ye(),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",Ge=so,Je=io,V;e[0]!==t||e[1]!==W||e[2]!==M?(V=async c=>{let{preset:p,title:E}=c;if(!t){X();return}await Ne(E,async re=>{await Ee({takeScreenshots:()=>W({progress:re}),updateCellOutputs:M}),await La({filename:t,preset:p,downloadPDF:Ct})})},e[0]=t,e[1]=W,e[2]=M,e[3]=V):V=e[3];let S=V,Y;e[4]===S?Y=e[5]:(Y=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]=Y);let O=Y,K;e[6]!==ee||e[7]!==t||e[8]!==W||e[9]!==M?(K=async()=>{if(!t){X();return}await Ne("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)(_t,{size:14,strokeWidth:1.5}),e[11]=U):U=e[11];let $;e[12]===Symbol.for("react.memo_cache_sentinel")?($=(0,a.jsx)(De,{size:14,strokeWidth:1.5}),e[12]=$):$=e[12];let D;e[13]===t?D=e[14]:(D=async()=>{if(!t){X();return}await _e({filename:t,includeCode:!0})},e[13]=t,e[14]=D);let G;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]!==O||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?(G=[{icon:U,label:"Download",handle:N,dropdown:[{icon:$,label:"Download as HTML",handle:D},{icon:(0,a.jsx)(De,{size:14,strokeWidth:1.5}),label:"Download as HTML (exclude code)",handle:async()=>{if(!t){X();return}await _e({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)(vt,{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)(Rt,{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:O},{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:O}]},{icon:(0,a.jsx)(za,{size:14,strokeWidth:1.5}),label:"Share",handle:N,hidden:!B&&!F,dropdown:[{icon:(0,a.jsx)(It,{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)(Bt,{size:14,strokeWidth:1.5}),label:"Create WebAssembly link",hidden:!F,handle:async()=>{await Q(ca({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:dt.flatMap(c=>{let{type:p,Icon:E,hidden:re,additionalKeywords:Qe}=c;return re?[]:{label:ve(p),rightElement:Ge(r===p),icon:(0,a.jsx)(E,{size:14,strokeWidth:1.5}),handle:()=>s(p),additionalKeywords:Qe}})},{icon:(0,a.jsx)(Be,{size:14,strokeWidth:1.5}),label:"Present as",handle:N,dropdown:[{icon:l.mode==="present"?(0,a.jsx)(Yt,{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)(Ae,{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)(He,{size:14,strokeWidth:1.5}),label:"Copy code to clipboard",hidden:!t,handle:async()=>{await Q((await I()).contents),C({title:"Copied",description:"Code copied to clipboard."})}},{icon:(0,a.jsx)(St,{size:14,strokeWidth:1.5}),label:"Enable all cells",hidden:!oe||i,handle:async()=>{let c=tt(je());await ae({configs:ze.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)(nt,{size:14,strokeWidth:1.5}),label:"Add database connection",handle:()=>{n((0,a.jsx)(Ce,{onClose:o}))}},{icon:(0,a.jsx)(ut,{size:14,strokeWidth:1.5}),label:"Add remote storage",handle:()=>{n((0,a.jsx)(Ce,{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)(ot,{size:14,strokeWidth:1.5}),label:"Clear all outputs",redundant:!0,handle:()=>{u()}},{icon:(0,a.jsx)(At,{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)(Te,{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)(Vt,{size:14,strokeWidth:1.5}),label:"User settings",handle:()=>P(Xa),redundant:!0,additionalKeywords:["preferences","options","configuration"]},{icon:(0,a.jsx)(Wt,{size:14,strokeWidth:1.5}),label:"Resources",handle:N,dropdown:[{icon:(0,a.jsx)(ht,{size:14,strokeWidth:1.5}),label:"Documentation",handle:Za},{icon:(0,a.jsx)(Pt,{size:14,strokeWidth:1.5}),label:"GitHub",handle:Qa},{icon:(0,a.jsx)(Et,{size:14,strokeWidth:1.5}),label:"Discord Community",handle:Ja},{icon:(0,a.jsx)(Ht,{size:14,strokeWidth:1.5}),label:"YouTube",handle:Ga},{icon:(0,a.jsx)(ct,{size:14,strokeWidth:1.5}),label:"Changelog",handle:$a}]},{divider:!0,icon:(0,a.jsx)(Tt,{size:14,strokeWidth:1.5}),label:"Return home",hidden:!location.search.includes("file"),handle:Ua},{icon:(0,a.jsx)(Nt,{size:14,strokeWidth:1.5}),label:"New notebook",hidden:!location.search.includes("file"),handle:Ka}].filter(Oa).map(Va),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]=O,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]=G):G=e[50],G}function Va(e){return e.dropdown?{...e,dropdown:e.dropdown.filter(Ya)}:e}function Ya(e){return!e.hidden}function Oa(e){return!e.hidden}function Ka(){let e=Kt();window.open(e,"_blank")}function Ua(){let e=document.baseURI.split("?")[0];window.open(e,"_self")}function $a(){window.open(A.releasesPage,"_blank")}function Ga(){window.open(A.youtube,"_blank")}function Ja(){window.open(A.discordLink,"_blank")}function Qa(){window.open(A.githubPage,"_blank")}function Za(){window.open(A.docsPage,"_blank")}function Xa(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 zt({element:e,filename:document.title,prepare:Mt})}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)(Ae,{size:14})})}function X(){C({title:"Error",description:"Notebooks must be named to be exported.",variant:"danger"})}export{Ye as a,qe as c,Oe as i,Te as l,$e as n,Fe as o,Pa as r,Re as s,Fa as t,He 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-D3_EYEUd.js"></script>
69
+ <script type="module" crossorigin src="./assets/index-CIk_2P5O.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">
@@ -163,7 +163,7 @@
163
163
  <link rel="modulepreload" crossorigin href="./assets/useAsyncData-D-4ifFXh.js">
164
164
  <link rel="modulepreload" crossorigin href="./assets/errors-Bfogio62.js">
165
165
  <link rel="modulepreload" crossorigin href="./assets/error-banner-BRG6IPhC.js">
166
- <link rel="modulepreload" crossorigin href="./assets/copy-YwM0Pd7v.js">
166
+ <link rel="modulepreload" crossorigin href="./assets/copy-CA4fP28I.js">
167
167
  <link rel="modulepreload" crossorigin href="./assets/memoize-Bw1ifb7c.js">
168
168
  <link rel="modulepreload" crossorigin href="./assets/get-DBdMgUNq.js">
169
169
  <link rel="modulepreload" crossorigin href="./assets/capitalize-BfkXNxmI.js">
@@ -172,7 +172,7 @@
172
172
  <link rel="modulepreload" crossorigin href="./assets/refresh-cw-CHAHPgkx.js">
173
173
  <link rel="modulepreload" crossorigin href="./assets/trash-2-CAoNMkjq.js">
174
174
  <link rel="modulepreload" crossorigin href="./assets/triangle-alert-qZo1ox6x.js">
175
- <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-DudGwo8M.js">
175
+ <link rel="modulepreload" crossorigin href="./assets/ai-model-dropdown-aWQwR5QF.js">
176
176
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-OkOxlkkM.js">
177
177
  <link rel="modulepreload" crossorigin href="./assets/precisionRound-BOmLQIKI.js">
178
178
  <link rel="modulepreload" crossorigin href="./assets/defaultLocale-DK1MWd7f.js">
@@ -185,17 +185,17 @@
185
185
  <link rel="modulepreload" crossorigin href="./assets/datasource-nFaOdZWT.js">
186
186
  <link rel="modulepreload" crossorigin href="./assets/state-CXu3CC70.js">
187
187
  <link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-CuRqjiUs.js">
188
- <link rel="modulepreload" crossorigin href="./assets/copy-icon-BgmMM9Zg.js">
188
+ <link rel="modulepreload" crossorigin href="./assets/copy-icon-C6n2vWSW.js">
189
189
  <link rel="modulepreload" crossorigin href="./assets/html-to-image-CN0roffg.js">
190
190
  <link rel="modulepreload" crossorigin href="./assets/focus-DKnBT1ji.js">
191
- <link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-m8w66E4s.js">
191
+ <link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-Dmh6kfiy.js">
192
192
  <link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-CM1a_K7I.js">
193
193
  <link rel="modulepreload" crossorigin href="./assets/katex-rvFxOCU-.js">
194
- <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-Cj9ft7VI.js">
194
+ <link rel="modulepreload" crossorigin href="./assets/markdown-renderer-A3Ed0cjI.js">
195
195
  <link rel="modulepreload" crossorigin href="./assets/command-Bb5BQ9IQ.js">
196
196
  <link rel="modulepreload" crossorigin href="./assets/download-hacnp18J.js">
197
197
  <link rel="modulepreload" crossorigin href="./assets/useRunCells-RUEojcb5.js">
198
- <link rel="modulepreload" crossorigin href="./assets/RenderHTML-C_fyTOvC.js">
198
+ <link rel="modulepreload" crossorigin href="./assets/RenderHTML-D_zT74Lq.js">
199
199
  <link rel="modulepreload" crossorigin href="./assets/useIframeCapabilities-DTN9kFDq.js">
200
200
  <link rel="modulepreload" crossorigin href="./assets/formats-rhOJovGE.js">
201
201
  <link rel="modulepreload" crossorigin href="./assets/en-US-BO8E69bZ.js">
@@ -207,7 +207,7 @@
207
207
  <link rel="modulepreload" crossorigin href="./assets/useDateFormatter-CpE7XQLs.js">
208
208
  <link rel="modulepreload" crossorigin href="./assets/range-CJeRXUtp.js">
209
209
  <link rel="modulepreload" crossorigin href="./assets/table-BCnp9gKC.js">
210
- <link rel="modulepreload" crossorigin href="./assets/JsonOutput-BRPU4yqw.js">
210
+ <link rel="modulepreload" crossorigin href="./assets/JsonOutput-BKsCyU13.js">
211
211
  <link rel="modulepreload" crossorigin href="./assets/useDeleteCell-DSrWT4rB.js">
212
212
  <link rel="modulepreload" crossorigin href="./assets/icons-CrUXojcA.js">
213
213
  <link rel="modulepreload" crossorigin href="./assets/process-output-CwDI4Cei.js">
@@ -217,32 +217,32 @@
217
217
  <link rel="modulepreload" crossorigin href="./assets/file-DzHkbIdO.js">
218
218
  <link rel="modulepreload" crossorigin href="./assets/image-DXfkah9d.js">
219
219
  <link rel="modulepreload" crossorigin href="./assets/play-DKSqmedg.js">
220
- <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-BRtYorDJ.js">
220
+ <link rel="modulepreload" crossorigin href="./assets/add-cell-with-ai-mTm-dtan.js">
221
221
  <link rel="modulepreload" crossorigin href="./assets/isEmpty-CfmnKtgL.js">
222
222
  <link rel="modulepreload" crossorigin href="./assets/bot-message-square-CK6eoGWy.js">
223
- <link rel="modulepreload" crossorigin href="./assets/chat-display-CUgnBuwx.js">
223
+ <link rel="modulepreload" crossorigin href="./assets/chat-display-B6a8fK7j.js">
224
224
  <link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-DV8gdCvH.js">
225
225
  <link rel="modulepreload" crossorigin href="./assets/square-function-B006EYFX.js">
226
226
  <link rel="modulepreload" crossorigin href="./assets/spec-DbmSqx09.js">
227
227
  <link rel="modulepreload" crossorigin href="./assets/ellipsis-vertical-CAB7tdza.js">
228
228
  <link rel="modulepreload" crossorigin href="./assets/components-DREyNirk.js">
229
- <link rel="modulepreload" crossorigin href="./assets/column-preview-DxF69H1r.js">
229
+ <link rel="modulepreload" crossorigin href="./assets/column-preview-CtAbPvyW.js">
230
230
  <link rel="modulepreload" crossorigin href="./assets/toggle-RCwU-rnE.js">
231
231
  <link rel="modulepreload" crossorigin href="./assets/globals-ByNi1JTJ.js">
232
232
  <link rel="modulepreload" crossorigin href="./assets/share-BdH_5I58.js">
233
233
  <link rel="modulepreload" crossorigin href="./assets/_baseSet-D5BgdrnX.js">
234
234
  <link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-DDRqG5ui.js">
235
- <link rel="modulepreload" crossorigin href="./assets/context-aware-panel-BvlpddI6.js">
235
+ <link rel="modulepreload" crossorigin href="./assets/context-aware-panel-91O6JrAw.js">
236
236
  <link rel="modulepreload" crossorigin href="./assets/floating-outline-D466s5lB.js">
237
237
  <link rel="modulepreload" crossorigin href="./assets/useAddCell-rz5hgq-s.js">
238
238
  <link rel="modulepreload" crossorigin href="./assets/eye-off-vwi9L975.js">
239
- <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-CKdreYF8.js">
239
+ <link rel="modulepreload" crossorigin href="./assets/readonly-python-code-i_LeNopW.js">
240
240
  <link rel="modulepreload" crossorigin href="./assets/file-headphone-B5q2Ow55.js">
241
241
  <link rel="modulepreload" crossorigin href="./assets/file-icons-DWJwqnd-.js">
242
242
  <link rel="modulepreload" crossorigin href="./assets/refresh-ccw-DLpfIr8v.js">
243
243
  <link rel="modulepreload" crossorigin href="./assets/form-DRz7hUP9.js">
244
244
  <link rel="modulepreload" crossorigin href="./assets/field-B1jGbQlH.js">
245
- <link rel="modulepreload" crossorigin href="./assets/useBoolean-3u0CYJkt.js">
245
+ <link rel="modulepreload" crossorigin href="./assets/useBoolean-BYlCXj8U.js">
246
246
  <link rel="modulepreload" crossorigin href="./assets/useDeepCompareMemoize-yyiB9aJX.js">
247
247
  <link rel="modulepreload" crossorigin href="./assets/types-C1RN112u.js">
248
248
  <link rel="modulepreload" crossorigin href="./assets/prop-types-RrUi-pOT.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/frontend",
3
- "version": "0.21.2-dev27",
3
+ "version": "0.21.2-dev28",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -1,7 +1,13 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
+ import type { Table } from "@tanstack/react-table";
3
4
  import { describe, expect, it } from "vitest";
4
- import { getPageIndexForRow } from "../utils";
5
+ import {
6
+ getClipboardContent,
7
+ getPageIndexForRow,
8
+ getRawValue,
9
+ stringifyUnknownValue,
10
+ } from "../utils";
5
11
 
6
12
  describe("getPageIndexForRow", () => {
7
13
  it("should return null when row is on current page", () => {
@@ -77,3 +83,134 @@ describe("getPageIndexForRow", () => {
77
83
  expect(getPageIndexForRow(999, 100, 10)).toBe(99);
78
84
  });
79
85
  });
86
+
87
+ describe("stringifyUnknownValue", () => {
88
+ it("should stringify primitives", () => {
89
+ expect(stringifyUnknownValue({ value: "hello" })).toBe("hello");
90
+ expect(stringifyUnknownValue({ value: 42 })).toBe("42");
91
+ expect(stringifyUnknownValue({ value: true })).toBe("true");
92
+ expect(stringifyUnknownValue({ value: null })).toBe("null");
93
+ expect(stringifyUnknownValue({ value: undefined })).toBe("undefined");
94
+ });
95
+
96
+ it("should stringify null as empty string when flag is set", () => {
97
+ expect(
98
+ stringifyUnknownValue({ value: null, nullAsEmptyString: true }),
99
+ ).toBe("");
100
+ });
101
+
102
+ it("should JSON-stringify plain objects", () => {
103
+ expect(stringifyUnknownValue({ value: { x: 1 } })).toBe('{"x":1}');
104
+ });
105
+ });
106
+
107
+ describe("getClipboardContent", () => {
108
+ it("should use rawValue for text when it differs from displayedValue", () => {
109
+ const displayed = {
110
+ _serialized_mime_bundle: {
111
+ mimetype: "text/html",
112
+ data: '<a href="https://example.com">42</a>',
113
+ },
114
+ };
115
+ const result = getClipboardContent(42, displayed);
116
+ expect(result.text).toBe("42");
117
+ expect(result.html).toBe('<a href="https://example.com">42</a>');
118
+ });
119
+
120
+ it("should strip html for text when rawValue equals displayedValue", () => {
121
+ const mimeBundle = {
122
+ _serialized_mime_bundle: {
123
+ mimetype: "text/html",
124
+ data: "<b>bold</b>",
125
+ },
126
+ };
127
+ const result = getClipboardContent(mimeBundle, mimeBundle);
128
+ expect(result.text).toBe("bold");
129
+ expect(result.html).toBe("<b>bold</b>");
130
+ });
131
+
132
+ it("should handle undefined rawValue", () => {
133
+ const displayed = {
134
+ _serialized_mime_bundle: {
135
+ mimetype: "text/html",
136
+ data: "<b>hello</b>",
137
+ },
138
+ };
139
+ const result = getClipboardContent(undefined, displayed);
140
+ expect(result.text).toBe("hello");
141
+ expect(result.html).toBe("<b>hello</b>");
142
+ });
143
+
144
+ it("should return no html for plain values", () => {
145
+ const result = getClipboardContent(undefined, "plain text");
146
+ expect(result.text).toBe("plain text");
147
+ expect(result.html).toBeUndefined();
148
+ });
149
+
150
+ it("should treat text/markdown as html since mo.md() data is rendered html", () => {
151
+ const displayed = {
152
+ _serialized_mime_bundle: {
153
+ mimetype: "text/markdown",
154
+ data: '<span class="markdown"><strong>Hello</strong></span>',
155
+ },
156
+ };
157
+ const result = getClipboardContent(undefined, displayed);
158
+ expect(result.text).toBe("Hello");
159
+ expect(result.html).toBe(
160
+ '<span class="markdown"><strong>Hello</strong></span>',
161
+ );
162
+ });
163
+
164
+ it("should return no html for non-html mime bundles", () => {
165
+ const displayed = {
166
+ _serialized_mime_bundle: {
167
+ mimetype: "text/plain",
168
+ data: "just text",
169
+ },
170
+ };
171
+ const result = getClipboardContent(undefined, displayed);
172
+ expect(result.text).toBe("just text");
173
+ expect(result.html).toBeUndefined();
174
+ });
175
+
176
+ it("should handle null rawValue as a real value", () => {
177
+ const displayed = {
178
+ _serialized_mime_bundle: {
179
+ mimetype: "text/html",
180
+ data: "<i>N/A</i>",
181
+ },
182
+ };
183
+ const result = getClipboardContent(null, displayed);
184
+ expect(result.text).toBe("null");
185
+ expect(result.html).toBe("<i>N/A</i>");
186
+ });
187
+ });
188
+
189
+ function createMockTableWithMeta<TData>(rawData?: TData[]): Table<TData> {
190
+ return {
191
+ options: {
192
+ meta: { rawData },
193
+ },
194
+ } as unknown as Table<TData>;
195
+ }
196
+
197
+ describe("getRawValue", () => {
198
+ it("should return raw value when rawData is available", () => {
199
+ const table = createMockTableWithMeta([
200
+ { a: 10, b: 20 },
201
+ { a: 30, b: 40 },
202
+ ]);
203
+ expect(getRawValue(table, 0, "a")).toBe(10);
204
+ expect(getRawValue(table, 1, "b")).toBe(40);
205
+ });
206
+
207
+ it("should return undefined when rawData is not set", () => {
208
+ const table = createMockTableWithMeta(undefined);
209
+ expect(getRawValue(table, 0, "a")).toBeUndefined();
210
+ });
211
+
212
+ it("should return undefined when row index is out of bounds", () => {
213
+ const table = createMockTableWithMeta([{ a: 1 }]);
214
+ expect(getRawValue(table, 5, "a")).toBeUndefined();
215
+ });
216
+ });
@@ -18,7 +18,7 @@ import {
18
18
  import { DATA_CELL_ID } from "./cell-utils";
19
19
  import { Filter } from "./filters";
20
20
  import { selectedCellsAtom } from "./range-focus/atoms";
21
- import { stringifyUnknownValue } from "./utils";
21
+ import { getClipboardContent, getRawValue } from "./utils";
22
22
 
23
23
  export const DataTableContextMenu = <TData,>({
24
24
  contextMenuRef,
@@ -82,11 +82,15 @@ export const CellContextMenu = <TData,>({
82
82
  return;
83
83
  }
84
84
 
85
+ const table = cell.getContext().table;
86
+ const displayedValue = cell.getValue();
87
+ const rawValue =
88
+ getRawValue(table, cell.row.index, cell.column.id) ?? displayedValue;
89
+
85
90
  const handleCopyCell = () => {
86
91
  try {
87
- const value = cell.getValue();
88
- const stringValue = stringifyUnknownValue({ value });
89
- copyToClipboard(stringValue);
92
+ const { text, html } = getClipboardContent(rawValue, displayedValue);
93
+ copyToClipboard(text, html);
90
94
  } catch (error) {
91
95
  Logger.error("Failed to copy context menu cell", error);
92
96
  }
@@ -98,7 +102,7 @@ export const CellContextMenu = <TData,>({
98
102
  const handleFilterCell = (operator: "in" | "not_in") => {
99
103
  column.setFilterValue(
100
104
  Filter.select({
101
- options: [cell.getValue()],
105
+ options: [rawValue],
102
106
  operator,
103
107
  }),
104
108
  );
@@ -52,6 +52,7 @@ interface DataTableProps<TData> extends Partial<DownloadActionProps> {
52
52
  maxHeight?: number;
53
53
  columns: ColumnDef<TData>[];
54
54
  data: TData[];
55
+ rawData?: TData[]; // raw data for filtering/copying (present only if format_mapping is provided)
55
56
  // Sorting
56
57
  manualSorting?: boolean; // server-side sorting
57
58
  sorting?: SortingState; // controlled sorting
@@ -103,6 +104,7 @@ const DataTableInternal = <TData,>({
103
104
  maxHeight,
104
105
  columns,
105
106
  data,
107
+ rawData,
106
108
  selection,
107
109
  totalColumns,
108
110
  totalRows,
@@ -197,6 +199,7 @@ const DataTableInternal = <TData,>({
197
199
  ],
198
200
  data,
199
201
  columns,
202
+ meta: { rawData },
200
203
  getCoreRowModel: getCoreRowModel(),
201
204
  // pagination
202
205
  rowCount: totalRows === "too_many" ? undefined : totalRows,
@@ -403,7 +403,10 @@ describe("cell selection atoms", () => {
403
403
  beforeEach(() => {
404
404
  // Reset mocks before each test
405
405
  vi.mocked(getCellValues).mockClear();
406
- vi.mocked(getCellValues).mockReturnValue("mocked cell values");
406
+ vi.mocked(getCellValues).mockReturnValue({
407
+ text: "mocked cell values",
408
+ html: undefined,
409
+ });
407
410
  });
408
411
 
409
412
  afterEach(() => {
@@ -424,7 +427,10 @@ describe("cell selection atoms", () => {
424
427
  });
425
428
 
426
429
  expect(getCellValues).toHaveBeenCalledWith(mockTable, selectedCells);
427
- expect(copyToClipboard).toHaveBeenCalledWith("mocked cell values");
430
+ expect(copyToClipboard).toHaveBeenCalledWith(
431
+ "mocked cell values",
432
+ undefined,
433
+ );
428
434
  expect(onCopyComplete).toHaveBeenCalledWith();
429
435
  expect(state.copiedCells).toEqual(selectedCells);
430
436
  });
@@ -56,12 +56,14 @@ export function createMockRow(
56
56
  export function createMockTable(
57
57
  rows: Row<unknown>[],
58
58
  columns: Column<unknown>[],
59
+ opts?: { rawData?: unknown[] },
59
60
  ): Table<unknown> {
60
61
  return {
61
62
  getRow: (id: string) => rows.find((row) => row.id === id),
62
63
  getRowModel: () => ({ rows }),
63
64
  getColumn: (columnId: string) => columns.find((col) => col.id === columnId),
64
65
  getAllColumns: () => columns,
66
+ options: { meta: { rawData: opts?.rawData } },
65
67
  } as unknown as Table<unknown>;
66
68
  }
67
69