@marimo-team/frontend 0.25.3-dev80 → 0.25.3-dev82

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 (106) hide show
  1. package/dist/assets/{CellStatus-cD3S0wEA.js → CellStatus-DXroYLOP.js} +1 -1
  2. package/dist/assets/{ErrorBoundary-DJhsFCsX.js → ErrorBoundary-DaQ9THH_.js} +2 -2
  3. package/dist/assets/{JsonOutput-Pm6OCP3J.js → JsonOutput-VxzHyItt.js} +1 -1
  4. package/dist/assets/{MarimoErrorOutput-DlEjLCZ-.js → MarimoErrorOutput-D-hLaDA-.js} +1 -1
  5. package/dist/assets/{RenderHTML-CfQ6i3QV.js → RenderHTML-DjOEZL25.js} +1 -1
  6. package/dist/assets/{RunButton-DvuvkgrG.js → RunButton-CuhNTo5_.js} +1 -1
  7. package/dist/assets/{add-cell-with-ai-By51zSlC.js → add-cell-with-ai-BbVntTh7.js} +1 -1
  8. package/dist/assets/{add-connection-dialog-D7EYSraq.js → add-connection-dialog-Qf63aKV6.js} +1 -1
  9. package/dist/assets/{agent-panel-aCWa3Yai.js → agent-panel-DMOfF3qF.js} +1 -1
  10. package/dist/assets/{ai-model-dropdown-bwTRyFn4.js → ai-model-dropdown-B15l0R62.js} +2 -2
  11. package/dist/assets/{app-config-button-DGhsM0xw.js → app-config-button-BIMB8qjD.js} +1 -1
  12. package/dist/assets/{blob-e6VlOmQP.js → blob-De9GR2s6.js} +1 -1
  13. package/dist/assets/{cell-editor-M8dEnDzk.js → cell-editor-Di0cSFhC.js} +32 -11
  14. package/dist/assets/{cell-link-DFqfW-Ym.js → cell-link-DR3W2HC7.js} +1 -1
  15. package/dist/assets/{cells-T9_Y4Jlv.js → cells-styV7IX8.js} +6 -6
  16. package/dist/assets/{chat-display-DXn2Yrjr.js → chat-display-BzdYdN39.js} +1 -1
  17. package/dist/assets/{chat-panel-D3iUyZId.js → chat-panel-De3YzkSF.js} +1 -1
  18. package/dist/assets/{chat-ui-YuJtv3UJ.js → chat-ui-NTNapdtP.js} +1 -1
  19. package/dist/assets/{code-visibility-CV3S4xuf.js → code-visibility-csc3tgA0.js} +1 -1
  20. package/dist/assets/{column-preview-C6uXRJry.js → column-preview-DkH-oD8f.js} +1 -1
  21. package/dist/assets/{command-palette-CGNUQdgW.js → command-palette-Dg_xstl0.js} +1 -1
  22. package/dist/assets/{common-DeeLgjWQ.js → common-D7VAS6rd.js} +1 -1
  23. package/dist/assets/{components-DyAF3_Nf.js → components-CNmvC781.js} +1 -1
  24. package/dist/assets/config-BQT0uYUo.js +1 -0
  25. package/dist/assets/{config-CjQ4WJnJ.js → config-BbRbT9Ww.js} +1 -1
  26. package/dist/assets/{datasource-gqFgG9Qd.js → datasource-C3yfeDa2.js} +1 -1
  27. package/dist/assets/{dependency-graph-panel-B3T9kSTs.js → dependency-graph-panel-CjoA6L0w.js} +1 -1
  28. package/dist/assets/{documentation-panel-BBpGbT-f.js → documentation-panel-DHWFOiG1.js} +1 -1
  29. package/dist/assets/{download-C8Gw-D0Y.js → download-BrCpRZKN.js} +1 -1
  30. package/dist/assets/{edit-page-CBftLPze.js → edit-page-BPMo_x-T.js} +4 -4
  31. package/dist/assets/{error-entries-uyqOG5tg.js → error-entries-BkEAmmnD.js} +1 -1
  32. package/dist/assets/{error-panel-Cli5zPWi.js → error-panel-BhTfPA_i.js} +1 -1
  33. package/dist/assets/feedback-button-BAcClv7c.js +1 -0
  34. package/dist/assets/{feedback-button-CvrwBGr7.js → feedback-button-D9InK87G.js} +1 -1
  35. package/dist/assets/{file-explorer-panel-BSU5ultY.js → file-explorer-panel-BSd_ZbUC.js} +1 -1
  36. package/dist/assets/{file-name-input-CDrRlIiX.js → file-name-input-RHURglL_.js} +1 -1
  37. package/dist/assets/{floating-outline-GQD9km0W.js → floating-outline-Cm49rYYe.js} +1 -1
  38. package/dist/assets/{gallery-page-B-5H1fEt.js → gallery-page-DdMdOtdv.js} +1 -1
  39. package/dist/assets/{glide-data-editor-B1kpoetH.js → glide-data-editor-eiSlEUyR.js} +1 -1
  40. package/dist/assets/{home-page-3qsPTb4v.js → home-page-DwWvBB0R.js} +1 -1
  41. package/dist/assets/{hooks-BrFYiTJS.js → hooks-CHeUZHPp.js} +1 -1
  42. package/dist/assets/{index-D0IWODMU.js → index-DckSn2w6.js} +8 -8
  43. package/dist/assets/{layout-CGC8ajpe.js → layout-_lp06T0C.js} +3 -3
  44. package/dist/assets/{logs-panel-CdUc5vtA.js → logs-panel-CAAk72Gb.js} +1 -1
  45. package/dist/assets/{markdown-renderer-pKc_bFac.js → markdown-renderer-CAyCgogC.js} +1 -1
  46. package/dist/assets/{name-cell-input-csH3Cy54.js → name-cell-input-DA8hU9XT.js} +1 -1
  47. package/dist/assets/{outline-panel-DhsHYTuo.js → outline-panel-Cc5oQ4LL.js} +1 -1
  48. package/dist/assets/{packages-panel-BtkXVz3L.js → packages-panel-DTfKez6I.js} +1 -1
  49. package/dist/assets/{panel-accordion-state-Bco6nsUI.js → panel-accordion-state-BZHex38W.js} +1 -1
  50. package/dist/assets/panels-DU-SaRHy.js +105 -0
  51. package/dist/assets/{process-output-B2-bT4cq.js → process-output-CrDc_O1D.js} +1 -1
  52. package/dist/assets/{readonly-code-display-Dsp6vWPh.js → readonly-code-display-BR-_jUj8.js} +1 -1
  53. package/dist/assets/{readonly-python-code-B81AjzXM.js → readonly-python-code-D7jcy9ds.js} +1 -1
  54. package/dist/assets/{reveal-component-Cxo3hLGA.js → reveal-component-eLftBwOe.js} +1 -1
  55. package/dist/assets/{run-page-CLP1s8uX.js → run-page-mURyATDJ.js} +1 -1
  56. package/dist/assets/{runtime-details-state-CznIe40L.js → runtime-details-state-hb7A1jgR.js} +1 -1
  57. package/dist/assets/{scratchpad-panel-yHIW63VQ.js → scratchpad-panel-B_gEnoqj.js} +1 -1
  58. package/dist/assets/{session-panel-C7-wmZhc.js → session-panel-DmDjaPsN.js} +1 -1
  59. package/dist/assets/{snippets-panel-BARpOPyS.js → snippets-panel-o9KL5jMi.js} +1 -1
  60. package/dist/assets/state-BkAqJoW7.js +3 -0
  61. package/dist/assets/{state-Bye6rCo4.js → state-Os7LSUUZ.js} +1 -1
  62. package/dist/assets/{terminal-Bhcn_y1N.js → terminal-BI85khrS.js} +1 -1
  63. package/dist/assets/{tracing-DDohxo24.js → tracing-AsNGuDsh.js} +1 -1
  64. package/dist/assets/{tracing-panel-DYhGDAo5.js → tracing-panel-CBcmea6L.js} +2 -2
  65. package/dist/assets/{tree-actions-Cb-nUK1F.js → tree-actions-Cx5EDpA6.js} +1 -1
  66. package/dist/assets/{useAddCell-Bielffe0.js → useAddCell-uJJYtgwa.js} +1 -1
  67. package/dist/assets/{useBoolean-CMgj9hnq.js → useBoolean-8wlrTeus.js} +1 -1
  68. package/dist/assets/{useCellActionButton-DAcQhse_.js → useCellActionButton-CmQ-OcPa.js} +1 -1
  69. package/dist/assets/{useDeleteCell-BV4VemCv.js → useDeleteCell-CXgOCDqY.js} +1 -1
  70. package/dist/assets/{useDependencyPanelTab-PtXIVh53.js → useDependencyPanelTab-Ch6gm7uM.js} +1 -1
  71. package/dist/assets/{useInstallPackage-C7neMPwh.js → useInstallPackage-CYQoMdMQ.js} +1 -1
  72. package/dist/assets/{useNotebookActions-DZBB98fP.js → useNotebookActions-DGShHZ_1.js} +1 -1
  73. package/dist/assets/{useRunCells-BFeZMi7f.js → useRunCells-DAfDmOMC.js} +1 -1
  74. package/dist/assets/{useSplitCell-DllkNFke.js → useSplitCell-NLULgcq7.js} +1 -1
  75. package/dist/assets/{vega-component-D7JFthDD.js → vega-component-BKJU3uaB.js} +1 -1
  76. package/dist/index.html +24 -24
  77. package/package.json +1 -1
  78. package/src/core/host/AGENTS.md +6 -5
  79. package/src/core/host/__tests__/notebook-client.test.ts +368 -350
  80. package/src/core/host/connection.ts +1 -40
  81. package/src/core/host/notebook-client.ts +129 -186
  82. package/src/core/wasm/bridge.ts +0 -8
  83. package/src/core/websocket/__tests__/connection-state.test.ts +0 -12
  84. package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +133 -59
  85. package/src/core/websocket/__tests__/useNotebookSession.hook.test.tsx +152 -250
  86. package/src/core/websocket/connection-state.ts +0 -10
  87. package/src/core/websocket/transports/__tests__/notebook.test.ts +502 -0
  88. package/src/core/websocket/transports/notebook.ts +213 -0
  89. package/src/core/websocket/useNotebookClient.ts +28 -17
  90. package/dist/assets/config-DzdxZb17.js +0 -1
  91. package/dist/assets/feedback-button-DknbRCN_.js +0 -1
  92. package/dist/assets/panels-D1i80TGn.js +0 -107
  93. package/dist/assets/state-BRYi026f.js +0 -3
  94. package/dist/assets/ws-BXWY541V.js +0 -22
  95. package/src/core/host/__tests__/events.test.ts +0 -49
  96. package/src/core/host/events.ts +0 -68
  97. package/src/core/websocket/__tests__/createConnectionTransport.test.ts +0 -49
  98. package/src/core/websocket/transports/__tests__/basic.test.ts +0 -275
  99. package/src/core/websocket/transports/__tests__/sse.test.ts +0 -352
  100. package/src/core/websocket/transports/__tests__/transport.test.ts +0 -308
  101. package/src/core/websocket/transports/__tests__/ws.test.ts +0 -125
  102. package/src/core/websocket/transports/basic.ts +0 -102
  103. package/src/core/websocket/transports/create.ts +0 -31
  104. package/src/core/websocket/transports/sse.ts +0 -320
  105. package/src/core/websocket/transports/transport.ts +0 -50
  106. package/src/core/websocket/transports/ws.ts +0 -98
@@ -1 +1 @@
1
- import"./rolldown-runtime-B0Z9INg1.js";import{t as e}from"./react-DVplv7_D.js";import{D as t,J as n,N as r,q as i}from"./cells-T9_Y4Jlv.js";import{t as a}from"./compiler-runtime-BrajqUja.js";import{t as o}from"./cn-ldLVeaqm.js";import{t as s}from"./jsx-runtime-B74pBk57.js";import{r as c}from"./paths-bkIFVj8h.js";import{t as l}from"./cell-link-DFqfW-Ym.js";import{t as u}from"./empty-state-BaCKb7o3.js";import{t as d}from"./clear-button-p6YcvzLy.js";var f=a();e();var p=s(),m=()=>{let e=(0,f.c)(9),n=r(),{clearLogs:i}=t();if(n.length===0){let t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,p.jsx)(`code`,{className:`border rounded px-1`,children:`stdout`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,p.jsx)(u,{title:`No logs`,description:(0,p.jsxs)(`span`,{children:[t,` and`,` `,(0,p.jsx)(`code`,{className:`border rounded px-1`,children:`stderr`}),` logs will appear here.`]}),icon:(0,p.jsx)(c,{})}),e[1]=n):n=e[1],n}let a;e[2]===i?a=e[3]:(a=(0,p.jsx)(`div`,{className:`flex flex-row justify-start px-2 py-1`,children:(0,p.jsx)(d,{dataTestId:`clear-logs-button`,onClick:i})}),e[2]=i,e[3]=a);let o;e[4]===n?o=e[5]:(o=(0,p.jsx)(h,{logs:n,className:`min-w-[300px]`}),e[4]=n,e[5]=o);let s;return e[6]!==a||e[7]!==o?(s=(0,p.jsxs)(`div`,{className:`flex flex-col h-full overflow-auto`,children:[a,o]}),e[6]=a,e[7]=o,e[8]=s):s=e[8],s},h=e=>{let t=(0,f.c)(10),{logs:n,className:r}=e,i;t[0]===r?i=t[1]:(i=o(`flex flex-col`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={whiteSpace:`pre-wrap`},t[2]=a):a=t[2];let s;t[3]===n?s=t[4]:(s=n.map(v),t[3]=n,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,p.jsx)(`pre`,{className:`grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left`,children:(0,p.jsx)(`div`,{className:`grid grid-cols-[30px_1fr]`,style:a,children:s})}),t[5]=s,t[6]=c);let l;return t[7]!==i||t[8]!==c?(l=(0,p.jsx)(`div`,{className:i,children:c}),t[7]=i,t[8]=c,t[9]=l):l=t[9],l};function g(e){let t=i(e.timestamp),r=_[e.level],a=e.level.toUpperCase();return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`span`,{className:`shrink-0 text-(--gray-10) dark:text-(--gray-11)`,children:[`[`,t,`]`]}),(0,p.jsx)(`span`,{className:o(`shrink-0`,r),children:a}),(0,p.jsxs)(`span`,{className:`shrink-0 text-(--gray-10)`,children:[`(`,e.source.type===`cell`?(0,p.jsx)(l,{cellId:e.source.cellId}):n(e.source),`)`]}),e.message]})}var _={stdout:`text-(--grass-9)`,stderr:`text-(--red-9)`};function v(e,t){return(0,p.jsxs)(`div`,{className:`contents group`,children:[(0,p.jsx)(`span`,{className:o(`opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100`,`text-right col-span-1 py-1 pr-1`),children:t+1}),(0,p.jsx)(`span`,{className:o(`opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100`,`px-2 flex gap-x-1.5 py-1 flex-wrap`),children:g(e)})]},t)}export{h as LogViewer,m as default};
1
+ import"./rolldown-runtime-B0Z9INg1.js";import{t as e}from"./react-DVplv7_D.js";import{D as t,J as n,N as r,q as i}from"./cells-styV7IX8.js";import{t as a}from"./compiler-runtime-BrajqUja.js";import{t as o}from"./cn-ldLVeaqm.js";import{t as s}from"./jsx-runtime-B74pBk57.js";import{r as c}from"./paths-bkIFVj8h.js";import{t as l}from"./cell-link-DR3W2HC7.js";import{t as u}from"./empty-state-BaCKb7o3.js";import{t as d}from"./clear-button-p6YcvzLy.js";var f=a();e();var p=s(),m=()=>{let e=(0,f.c)(9),n=r(),{clearLogs:i}=t();if(n.length===0){let t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,p.jsx)(`code`,{className:`border rounded px-1`,children:`stdout`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,p.jsx)(u,{title:`No logs`,description:(0,p.jsxs)(`span`,{children:[t,` and`,` `,(0,p.jsx)(`code`,{className:`border rounded px-1`,children:`stderr`}),` logs will appear here.`]}),icon:(0,p.jsx)(c,{})}),e[1]=n):n=e[1],n}let a;e[2]===i?a=e[3]:(a=(0,p.jsx)(`div`,{className:`flex flex-row justify-start px-2 py-1`,children:(0,p.jsx)(d,{dataTestId:`clear-logs-button`,onClick:i})}),e[2]=i,e[3]=a);let o;e[4]===n?o=e[5]:(o=(0,p.jsx)(h,{logs:n,className:`min-w-[300px]`}),e[4]=n,e[5]=o);let s;return e[6]!==a||e[7]!==o?(s=(0,p.jsxs)(`div`,{className:`flex flex-col h-full overflow-auto`,children:[a,o]}),e[6]=a,e[7]=o,e[8]=s):s=e[8],s},h=e=>{let t=(0,f.c)(10),{logs:n,className:r}=e,i;t[0]===r?i=t[1]:(i=o(`flex flex-col`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={whiteSpace:`pre-wrap`},t[2]=a):a=t[2];let s;t[3]===n?s=t[4]:(s=n.map(v),t[3]=n,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,p.jsx)(`pre`,{className:`grid text-xs font-mono gap-1 whitespace-break-spaces font-semibold align-left`,children:(0,p.jsx)(`div`,{className:`grid grid-cols-[30px_1fr]`,style:a,children:s})}),t[5]=s,t[6]=c);let l;return t[7]!==i||t[8]!==c?(l=(0,p.jsx)(`div`,{className:i,children:c}),t[7]=i,t[8]=c,t[9]=l):l=t[9],l};function g(e){let t=i(e.timestamp),r=_[e.level],a=e.level.toUpperCase();return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`span`,{className:`shrink-0 text-(--gray-10) dark:text-(--gray-11)`,children:[`[`,t,`]`]}),(0,p.jsx)(`span`,{className:o(`shrink-0`,r),children:a}),(0,p.jsxs)(`span`,{className:`shrink-0 text-(--gray-10)`,children:[`(`,e.source.type===`cell`?(0,p.jsx)(l,{cellId:e.source.cellId}):n(e.source),`)`]}),e.message]})}var _={stdout:`text-(--grass-9)`,stderr:`text-(--red-9)`};function v(e,t){return(0,p.jsxs)(`div`,{className:`contents group`,children:[(0,p.jsx)(`span`,{className:o(`opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100`,`text-right col-span-1 py-1 pr-1`),children:t+1}),(0,p.jsx)(`span`,{className:o(`opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100`,`px-2 flex gap-x-1.5 py-1 flex-wrap`),children:g(e)})]},t)}export{h as LogViewer,m as default};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-DR-Kwzb9.js","./micromark-factory-space-D9Dr-k4J.js","./rolldown-runtime-B0Z9INg1.js","./katex-CF1UBJcr.js"])))=>i.map(i=>d[i]);
2
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,t as n}from"./useEvent-Dfcbgjhg.js";import{t as r}from"./react-DVplv7_D.js";import{Bt as i,D as a,Hn as o,Rt as s,er as c,n as l}from"./cells-T9_Y4Jlv.js";import{t as u}from"./compiler-runtime-BrajqUja.js";import{s as d}from"./config-DGX7JYor.js";import{g as f}from"./useEventListener-CjDeLqFC.js";import{v as p}from"./session-B8Y-GJnS.js";import{j as m}from"./config-DzdxZb17.js";import{t as h}from"./jsx-runtime-B74pBk57.js";import{t as g}from"./button-D8gVKwe-.js";import{t as _}from"./createLucideIcon-DfJ2oMlA.js";import{n as v,t as y}from"./LazyAnyLanguageCodeMirror-BPYE76jR.js";import{n as b}from"./copy-KlhazlhB.js";import{t as x}from"./preload-helper-uBIymjUX.js";import{st as S}from"./dist-Cny7_yZb.js";import{t as C}from"./requests-lt0JK8Jt.js";import{r as w}from"./useTheme-DLtPc-39.js";import{n as T}from"./useAsyncData-DhhdOGGd.js";import{a as E,c as D,s as O,t as k}from"./chunk-YOKDWASO-BIpRENEC.js";var A=_(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);function ee(e,t){return`data:${t};base64,${e}`}function te(e){return e.startsWith(`data:`)&&e.includes(`;base64,`)}function j(e){return e.split(`,`)[1]}function M(e){let t=globalThis.atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r}var N=Uint8Array.fromBase64??M;function P(e){let t=N(e);return new DataView(t.buffer)}function F(e){let t=``,n=e.length;for(let r=0;r<n;r++)t+=String.fromCharCode(e[r]);return globalThis.btoa(t)}var I=`toBase64`in Uint8Array.prototype?e=>e.toBase64():F;function L(e){return I(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function R(e){return(e.buffers??[]).map(P)}var z=u(),B=e(r(),1),V={},H={};function U(e){let r=(0,z.c)(16),{mode:i}=t(p),{updateCellConfig:o}=a(),s;r[0]===e?s=r[1]:(s=m(l(e),G,Object.is),r[0]=e,r[1]=s);let c=t(s),u;r[2]!==e||r[3]!==c?(u=()=>V[e]??c,r[2]=e,r[3]=c,r[4]=u):u=r[4];let[d,f]=(0,B.useState)(u),h,g;r[5]!==e||r[6]!==d?(h=()=>{V[e]=d},g=[e,d],r[5]=e,r[6]=d,r[7]=h,r[8]=g):(h=r[7],g=r[8]),(0,B.useEffect)(h,g);let _=i===`edit`,v=_?c:d,y;r[9]!==e||r[10]!==_||r[11]!==o?(y=t=>{if(f(t),!_)return;let n={expand_output:t};o({cellId:e,config:n}),C().saveCellConfig({configs:{[e]:n}}).catch(W)},r[9]=e,r[10]=_,r[11]=o,r[12]=y):y=r[12];let b=n(y),x;return r[13]!==v||r[14]!==b?(x=[v,b],r[13]=v,r[14]=b,r[15]=x):x=r[15],x}function W(e){f.error(`Failed to save expand_output config`,e)}function G(e){return e?.config.expand_output??!1}function K(e){let t=(0,z.c)(6),[n,r]=(0,B.useState)(H[e]??!1),i,a;t[0]!==e||t[1]!==n?(i=()=>{H[e]=n},a=[e,n],t[0]=e,t[1]=n,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,B.useEffect)(i,a);let o;return t[4]===n?o=t[5]:(o=[n,r],t[4]=n,t[5]=o),o}function q(e){return e==null||e.data==null||e.data===``}var J=h(),Y=[S.lineWrapping];function X(e,t){return e?e===`python`?{language:e,code:t}:e===`sql`?{language:`python`,code:o.fromQuery(t)}:e===`markdown`?{language:`python`,code:c.fromMarkdown(t)}:e===`shell`||e===`bash`?{language:`python`,code:`import subprocess\nsubprocess.run("${t}")`}:{language:`python`,code:`_${e} = """\n${t}\n"""`}:{language:`python`,code:t}}var Z=e=>{let n=(0,z.c)(9),{code:r,language:o}=e,{createNewCell:c}=a(),l=s(),u=t(d),f;n[0]!==u||n[1]!==r||n[2]!==c||n[3]!==o||n[4]!==l?(f=()=>{let e=X(o,r);o===`sql`&&i({autoInstantiate:u,createNewCell:c,fromCellId:l}),c({code:e.code,before:!1,cellId:l??`__end__`})},n[0]=u,n[1]=r,n[2]=c,n[3]=o,n[4]=l,n[5]=f):f=n[5];let p=f,m;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,J.jsx)(v,{className:`ml-2 h-4 w-4`}),n[6]=m):m=n[6];let h;return n[7]===p?h=n[8]:(h=(0,J.jsxs)(g,{size:`xs`,variant:`outline`,onClick:p,children:[`Add to Notebook`,m]}),n[7]=p,n[8]=h),h},ne=e=>{let t=(0,z.c)(17),{code:n,language:r}=e,{theme:i}=w(),[a,o]=(0,B.useState)(n);a!==n&&o(n);let s;t[0]===a?s=t[1]:(s=async()=>{await b(a)},t[0]=a,t[1]=s);let c=s,l=i===`dark`?`dark`:`light`,u;t[2]!==r||t[3]!==l||t[4]!==a?(u=(0,J.jsx)(B.Suspense,{children:(0,J.jsx)(y,{theme:l,language:r,hideUnsupportedLanguageErrors:!0,className:`cm border rounded overflow-hidden`,extensions:Y,value:a,onChange:o})}),t[2]=r,t[3]=l,t[4]=a,t[5]=u):u=t[5];let d;t[6]===c?d=t[7]:(d=(0,J.jsx)(re,{size:`xs`,variant:`outline`,onClick:c,children:`Copy`}),t[6]=c,t[7]=d);let f;t[8]!==r||t[9]!==a?(f=(0,J.jsx)(Z,{code:a,language:r}),t[8]=r,t[9]=a,t[10]=f):f=t[10];let p;t[11]!==d||t[12]!==f?(p=(0,J.jsxs)(`div`,{className:`flex justify-end mt-2 space-x-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==u||t[15]!==p?(m=(0,J.jsxs)(`div`,{className:`relative`,children:[u,p]}),t[14]=u,t[15]=p,t[16]=m):m=t[16],m},re=e=>{let t=(0,z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({onClick:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let[i,a]=(0,B.useState)(!1),o;t[3]===n?o=t[4]:(o=e=>{n?.(e),a(!0),setTimeout(()=>a(!1),1e3)},t[3]=n,t[4]=o);let s=i?`Copied`:`Copy`,c;return t[5]!==r||t[6]!==o||t[7]!==s?(c=(0,J.jsx)(g,{...r,onClick:o,children:s}),t[5]=r,t[6]=o,t[7]=s,t[8]=c):c=t[8],c},ie={...D,attributes:{...D.attributes,"*":[...D.attributes?.[`*`]??[],`className`]}},ae=Object.values({...k,sanitize:[O,ie]}),oe={code:({children:e,className:t})=>{let n=t?.replace(`language-`,``);if(n&&typeof e==`string`){let t=e.trim();return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground pl-1`,children:n}),(0,J.jsx)(ne,{code:t,language:n})]})}return(0,J.jsx)(`code`,{className:t,children:e})}},Q,se=()=>{let{data:e}=T(async()=>Q||(Q={math:(await x(()=>import(`./dist-DR-Kwzb9.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).math},Q),[]);return e},$=(0,B.memo)(e=>{let t=(0,z.c)(3),{content:n}=e,r=se(),i;return t[0]!==n||t[1]!==r?(i=(0,J.jsx)(E,{components:oe,plugins:r,rehypePlugins:ae,className:`mo-markdown-renderer`,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i});$.displayName=`MarkdownRenderer`;export{ee as a,L as c,R as d,A as f,U as i,j as l,q as n,P as o,K as r,N as s,$ as t,te as u};
2
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t,t as n}from"./useEvent-Dfcbgjhg.js";import{t as r}from"./react-DVplv7_D.js";import{Bt as i,D as a,Hn as o,Rt as s,er as c,n as l}from"./cells-styV7IX8.js";import{t as u}from"./compiler-runtime-BrajqUja.js";import{s as d}from"./config-DGX7JYor.js";import{g as f}from"./useEventListener-CjDeLqFC.js";import{v as p}from"./session-B8Y-GJnS.js";import{A as m}from"./config-BQT0uYUo.js";import{t as h}from"./jsx-runtime-B74pBk57.js";import{t as g}from"./button-D8gVKwe-.js";import{t as _}from"./createLucideIcon-DfJ2oMlA.js";import{n as v,t as y}from"./LazyAnyLanguageCodeMirror-BPYE76jR.js";import{n as b}from"./copy-KlhazlhB.js";import{t as x}from"./preload-helper-uBIymjUX.js";import{st as S}from"./dist-Cny7_yZb.js";import{t as C}from"./requests-lt0JK8Jt.js";import{r as w}from"./useTheme-DLtPc-39.js";import{n as T}from"./useAsyncData-DhhdOGGd.js";import{a as E,c as D,s as O,t as k}from"./chunk-YOKDWASO-BIpRENEC.js";var A=_(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]);function ee(e,t){return`data:${t};base64,${e}`}function te(e){return e.startsWith(`data:`)&&e.includes(`;base64,`)}function j(e){return e.split(`,`)[1]}function M(e){let t=globalThis.atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r}var N=Uint8Array.fromBase64??M;function P(e){let t=N(e);return new DataView(t.buffer)}function F(e){let t=``,n=e.length;for(let r=0;r<n;r++)t+=String.fromCharCode(e[r]);return globalThis.btoa(t)}var I=`toBase64`in Uint8Array.prototype?e=>e.toBase64():F;function L(e){return I(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function R(e){return(e.buffers??[]).map(P)}var z=u(),B=e(r(),1),V={},H={};function U(e){let r=(0,z.c)(16),{mode:i}=t(p),{updateCellConfig:o}=a(),s;r[0]===e?s=r[1]:(s=m(l(e),G,Object.is),r[0]=e,r[1]=s);let c=t(s),u;r[2]!==e||r[3]!==c?(u=()=>V[e]??c,r[2]=e,r[3]=c,r[4]=u):u=r[4];let[d,f]=(0,B.useState)(u),h,g;r[5]!==e||r[6]!==d?(h=()=>{V[e]=d},g=[e,d],r[5]=e,r[6]=d,r[7]=h,r[8]=g):(h=r[7],g=r[8]),(0,B.useEffect)(h,g);let _=i===`edit`,v=_?c:d,y;r[9]!==e||r[10]!==_||r[11]!==o?(y=t=>{if(f(t),!_)return;let n={expand_output:t};o({cellId:e,config:n}),C().saveCellConfig({configs:{[e]:n}}).catch(W)},r[9]=e,r[10]=_,r[11]=o,r[12]=y):y=r[12];let b=n(y),x;return r[13]!==v||r[14]!==b?(x=[v,b],r[13]=v,r[14]=b,r[15]=x):x=r[15],x}function W(e){f.error(`Failed to save expand_output config`,e)}function G(e){return e?.config.expand_output??!1}function K(e){let t=(0,z.c)(6),[n,r]=(0,B.useState)(H[e]??!1),i,a;t[0]!==e||t[1]!==n?(i=()=>{H[e]=n},a=[e,n],t[0]=e,t[1]=n,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,B.useEffect)(i,a);let o;return t[4]===n?o=t[5]:(o=[n,r],t[4]=n,t[5]=o),o}function q(e){return e==null||e.data==null||e.data===``}var J=h(),Y=[S.lineWrapping];function X(e,t){return e?e===`python`?{language:e,code:t}:e===`sql`?{language:`python`,code:o.fromQuery(t)}:e===`markdown`?{language:`python`,code:c.fromMarkdown(t)}:e===`shell`||e===`bash`?{language:`python`,code:`import subprocess\nsubprocess.run("${t}")`}:{language:`python`,code:`_${e} = """\n${t}\n"""`}:{language:`python`,code:t}}var Z=e=>{let n=(0,z.c)(9),{code:r,language:o}=e,{createNewCell:c}=a(),l=s(),u=t(d),f;n[0]!==u||n[1]!==r||n[2]!==c||n[3]!==o||n[4]!==l?(f=()=>{let e=X(o,r);o===`sql`&&i({autoInstantiate:u,createNewCell:c,fromCellId:l}),c({code:e.code,before:!1,cellId:l??`__end__`})},n[0]=u,n[1]=r,n[2]=c,n[3]=o,n[4]=l,n[5]=f):f=n[5];let p=f,m;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,J.jsx)(v,{className:`ml-2 h-4 w-4`}),n[6]=m):m=n[6];let h;return n[7]===p?h=n[8]:(h=(0,J.jsxs)(g,{size:`xs`,variant:`outline`,onClick:p,children:[`Add to Notebook`,m]}),n[7]=p,n[8]=h),h},ne=e=>{let t=(0,z.c)(17),{code:n,language:r}=e,{theme:i}=w(),[a,o]=(0,B.useState)(n);a!==n&&o(n);let s;t[0]===a?s=t[1]:(s=async()=>{await b(a)},t[0]=a,t[1]=s);let c=s,l=i===`dark`?`dark`:`light`,u;t[2]!==r||t[3]!==l||t[4]!==a?(u=(0,J.jsx)(B.Suspense,{children:(0,J.jsx)(y,{theme:l,language:r,hideUnsupportedLanguageErrors:!0,className:`cm border rounded overflow-hidden`,extensions:Y,value:a,onChange:o})}),t[2]=r,t[3]=l,t[4]=a,t[5]=u):u=t[5];let d;t[6]===c?d=t[7]:(d=(0,J.jsx)(re,{size:`xs`,variant:`outline`,onClick:c,children:`Copy`}),t[6]=c,t[7]=d);let f;t[8]!==r||t[9]!==a?(f=(0,J.jsx)(Z,{code:a,language:r}),t[8]=r,t[9]=a,t[10]=f):f=t[10];let p;t[11]!==d||t[12]!==f?(p=(0,J.jsxs)(`div`,{className:`flex justify-end mt-2 space-x-2`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==u||t[15]!==p?(m=(0,J.jsxs)(`div`,{className:`relative`,children:[u,p]}),t[14]=u,t[15]=p,t[16]=m):m=t[16],m},re=e=>{let t=(0,z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({onClick:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let[i,a]=(0,B.useState)(!1),o;t[3]===n?o=t[4]:(o=e=>{n?.(e),a(!0),setTimeout(()=>a(!1),1e3)},t[3]=n,t[4]=o);let s=i?`Copied`:`Copy`,c;return t[5]!==r||t[6]!==o||t[7]!==s?(c=(0,J.jsx)(g,{...r,onClick:o,children:s}),t[5]=r,t[6]=o,t[7]=s,t[8]=c):c=t[8],c},ie={...D,attributes:{...D.attributes,"*":[...D.attributes?.[`*`]??[],`className`]}},ae=Object.values({...k,sanitize:[O,ie]}),oe={code:({children:e,className:t})=>{let n=t?.replace(`language-`,``);if(n&&typeof e==`string`){let t=e.trim();return(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`div`,{className:`text-xs text-muted-foreground pl-1`,children:n}),(0,J.jsx)(ne,{code:t,language:n})]})}return(0,J.jsx)(`code`,{className:t,children:e})}},Q,se=()=>{let{data:e}=T(async()=>Q||(Q={math:(await x(()=>import(`./dist-DR-Kwzb9.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).math},Q),[]);return e},$=(0,B.memo)(e=>{let t=(0,z.c)(3),{content:n}=e,r=se(),i;return t[0]!==n||t[1]!==r?(i=(0,J.jsx)(E,{components:oe,plugins:r,rehypePlugins:ae,className:`mo-markdown-renderer`,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i});$.displayName=`MarkdownRenderer`;export{ee as a,L as c,R as d,A as f,U as i,j as l,q as n,P as o,K as r,N as s,$ as t,te as u};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{D as n,Ln as r,Rn as i,p as a,zn as o}from"./cells-T9_Y4Jlv.js";import{t as s}from"./compiler-runtime-BrajqUja.js";import{t as c}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{t as u}from"./tooltip-CkGm8X7m.js";import{r as d}from"./button-D8gVKwe-.js";import{t as f}from"./useLifecycle-Mq4gc5kS.js";import{r as p}from"./input-BZdRe7pb.js";import{r as m}from"./dist-DusFODSa.js";import{r as h}from"./useTheme-DLtPc-39.js";import{r as g,t as _}from"./esm-CI_o7NhW.js";var v=e(t(),1),y=s(),b=l(),x=[m(),g({syntaxHighlighting:!0,highlightSpecialChars:!1,history:!1,drawSelection:!1,defaultKeymap:!1,historyKeymap:!1})],S=(0,v.memo)(e=>{let t=(0,y.c)(8),{code:n,className:r}=e,{theme:i}=h(),a;t[0]===r?a=t[1]:(a=c(r,`text-muted-foreground flex flex-col overflow-hidden`),t[0]=r,t[1]=a);let o=i===`dark`?`dark`:`light`,s;t[2]!==n||t[3]!==o?(s=(0,b.jsx)(_,{minHeight:`10px`,theme:o,height:`100%`,className:`tiny-code`,editable:!1,basicSetup:!1,extensions:x,value:n}),t[2]=n,t[3]=o,t[4]=s):s=t[4];let l;return t[5]!==a||t[6]!==s?(l=(0,b.jsx)(`div`,{className:a,children:s}),t[5]=a,t[6]=s,t[7]=l):l=t[7],l});S.displayName=`TinyCode`;var C=e=>{let t=(0,y.c)(16),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({value:o,onChange:n,placeholder:i,onEnterKey:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=(0,v.useRef)(null),c=T(o,n),l;t[6]===c.onBlur?l=t[7]:(l=()=>{let e=c.onBlur,t=s.current;if(t)return t.addEventListener(`blur`,e),()=>{t.removeEventListener(`blur`,e)}},t[6]=c.onBlur,t[7]=l),f(l);let u=c.value,m=c.onChange,h;t[8]===r?h=t[9]:(h=d.onEnter(e=>{d.stopPropagation()(e),r?.()}),t[8]=r,t[9]=h);let g;return t[10]!==c.onChange||t[11]!==c.value||t[12]!==i||t[13]!==a||t[14]!==h?(g=(0,b.jsx)(p,{"data-testid":`cell-name-input`,value:u,onChange:m,ref:s,placeholder:i,className:`shadow-none! hover:shadow-none focus:shadow-none focus-visible:shadow-none`,onKeyDown:h,...a}),t[10]=c.onChange,t[11]=c.value,t[12]=i,t[13]=a,t[14]=h,t[15]=g):g=t[15],g},w=e=>{let t=(0,y.c)(12),{value:r,cellId:a,className:o}=e,{updateCellName:s}=n(),l;t[0]!==a||t[1]!==s?(l=e=>s({cellId:a,name:e}),t[0]=a,t[1]=s,t[2]=l):l=t[2];let d=T(r,l);if(i(r))return null;let f=d.focusing?``:`text-ellipsis`,p;t[3]!==o||t[4]!==f?(p=c(`outline-hidden border hover:border-cyan-500/40 focus:border-cyan-500/40`,f,o),t[3]=o,t[4]=f,t[5]=p):p=t[5];let m;return t[6]!==d.onBlur||t[7]!==d.onChange||t[8]!==d.onFocus||t[9]!==p||t[10]!==r?(m=(0,b.jsx)(u,{content:`Click to rename`,children:(0,b.jsx)(`span`,{className:p,contentEditable:!0,suppressContentEditableWarning:!0,onChange:d.onChange,onBlur:d.onBlur,onFocus:d.onFocus,onKeyDown:E,children:r})}),t[6]=d.onBlur,t[7]=d.onChange,t[8]=d.onFocus,t[9]=p,t[10]=r,t[11]=m):m=t[11],m};function T(e,t){let n=(0,y.c)(13),[s,c]=(0,v.useState)(e),[l,u]=(0,v.useState)(!1),d;n[0]!==t||n[1]!==e?(d=n=>{if(n!==e){if(!n||i(n)){t(n);return}t(r(n,a()))}},n[0]=t,n[1]=e,n[2]=d):d=n[2];let f=d,p;n[3]===s?p=n[4]:(p=i(s)?``:s,n[3]=s,n[4]=p);let m;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>{let t=e.target.value,n=o(t);c(n)},n[5]=m):m=n[5];let h;n[6]===f?h=n[7]:(h=e=>{if(e.target instanceof HTMLInputElement){let t=e.target.value;f(o(t))}else if(e.target instanceof HTMLSpanElement){let t=e.target.innerText.trim();f(o(t)),e.target.scrollLeft=0,u(!1)}},n[6]=f,n[7]=h);let g;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{u(!0)},n[8]=g):g=n[8];let _;return n[9]!==l||n[10]!==p||n[11]!==h?(_={value:p,focusing:l,onChange:m,onBlur:h,onFocus:g},n[9]=l,n[10]=p,n[11]=h,n[12]=_):_=n[12],_}function E(e){e.stopPropagation(),e.key===`Enter`&&e.target instanceof HTMLElement&&e.target.blur()}export{C as n,S as r,w as t};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-DVplv7_D.js";import{D as n,Ln as r,Rn as i,p as a,zn as o}from"./cells-styV7IX8.js";import{t as s}from"./compiler-runtime-BrajqUja.js";import{t as c}from"./cn-ldLVeaqm.js";import{t as l}from"./jsx-runtime-B74pBk57.js";import{t as u}from"./tooltip-CkGm8X7m.js";import{r as d}from"./button-D8gVKwe-.js";import{t as f}from"./useLifecycle-Mq4gc5kS.js";import{r as p}from"./input-BZdRe7pb.js";import{r as m}from"./dist-DusFODSa.js";import{r as h}from"./useTheme-DLtPc-39.js";import{r as g,t as _}from"./esm-CI_o7NhW.js";var v=e(t(),1),y=s(),b=l(),x=[m(),g({syntaxHighlighting:!0,highlightSpecialChars:!1,history:!1,drawSelection:!1,defaultKeymap:!1,historyKeymap:!1})],S=(0,v.memo)(e=>{let t=(0,y.c)(8),{code:n,className:r}=e,{theme:i}=h(),a;t[0]===r?a=t[1]:(a=c(r,`text-muted-foreground flex flex-col overflow-hidden`),t[0]=r,t[1]=a);let o=i===`dark`?`dark`:`light`,s;t[2]!==n||t[3]!==o?(s=(0,b.jsx)(_,{minHeight:`10px`,theme:o,height:`100%`,className:`tiny-code`,editable:!1,basicSetup:!1,extensions:x,value:n}),t[2]=n,t[3]=o,t[4]=s):s=t[4];let l;return t[5]!==a||t[6]!==s?(l=(0,b.jsx)(`div`,{className:a,children:s}),t[5]=a,t[6]=s,t[7]=l):l=t[7],l});S.displayName=`TinyCode`;var C=e=>{let t=(0,y.c)(16),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({value:o,onChange:n,placeholder:i,onEnterKey:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=(0,v.useRef)(null),c=T(o,n),l;t[6]===c.onBlur?l=t[7]:(l=()=>{let e=c.onBlur,t=s.current;if(t)return t.addEventListener(`blur`,e),()=>{t.removeEventListener(`blur`,e)}},t[6]=c.onBlur,t[7]=l),f(l);let u=c.value,m=c.onChange,h;t[8]===r?h=t[9]:(h=d.onEnter(e=>{d.stopPropagation()(e),r?.()}),t[8]=r,t[9]=h);let g;return t[10]!==c.onChange||t[11]!==c.value||t[12]!==i||t[13]!==a||t[14]!==h?(g=(0,b.jsx)(p,{"data-testid":`cell-name-input`,value:u,onChange:m,ref:s,placeholder:i,className:`shadow-none! hover:shadow-none focus:shadow-none focus-visible:shadow-none`,onKeyDown:h,...a}),t[10]=c.onChange,t[11]=c.value,t[12]=i,t[13]=a,t[14]=h,t[15]=g):g=t[15],g},w=e=>{let t=(0,y.c)(12),{value:r,cellId:a,className:o}=e,{updateCellName:s}=n(),l;t[0]!==a||t[1]!==s?(l=e=>s({cellId:a,name:e}),t[0]=a,t[1]=s,t[2]=l):l=t[2];let d=T(r,l);if(i(r))return null;let f=d.focusing?``:`text-ellipsis`,p;t[3]!==o||t[4]!==f?(p=c(`outline-hidden border hover:border-cyan-500/40 focus:border-cyan-500/40`,f,o),t[3]=o,t[4]=f,t[5]=p):p=t[5];let m;return t[6]!==d.onBlur||t[7]!==d.onChange||t[8]!==d.onFocus||t[9]!==p||t[10]!==r?(m=(0,b.jsx)(u,{content:`Click to rename`,children:(0,b.jsx)(`span`,{className:p,contentEditable:!0,suppressContentEditableWarning:!0,onChange:d.onChange,onBlur:d.onBlur,onFocus:d.onFocus,onKeyDown:E,children:r})}),t[6]=d.onBlur,t[7]=d.onChange,t[8]=d.onFocus,t[9]=p,t[10]=r,t[11]=m):m=t[11],m};function T(e,t){let n=(0,y.c)(13),[s,c]=(0,v.useState)(e),[l,u]=(0,v.useState)(!1),d;n[0]!==t||n[1]!==e?(d=n=>{if(n!==e){if(!n||i(n)){t(n);return}t(r(n,a()))}},n[0]=t,n[1]=e,n[2]=d):d=n[2];let f=d,p;n[3]===s?p=n[4]:(p=i(s)?``:s,n[3]=s,n[4]=p);let m;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>{let t=e.target.value,n=o(t);c(n)},n[5]=m):m=n[5];let h;n[6]===f?h=n[7]:(h=e=>{if(e.target instanceof HTMLInputElement){let t=e.target.value;f(o(t))}else if(e.target instanceof HTMLSpanElement){let t=e.target.innerText.trim();f(o(t)),e.target.scrollLeft=0,u(!1)}},n[6]=f,n[7]=h);let g;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{u(!0)},n[8]=g):g=n[8];let _;return n[9]!==l||n[10]!==p||n[11]!==h?(_={value:p,focusing:l,onChange:m,onBlur:h,onFocus:g},n[9]=l,n[10]=p,n[11]=h,n[12]=_):_=n[12],_}function E(e){e.stopPropagation(),e.key===`Enter`&&e.target instanceof HTMLElement&&e.target.blur()}export{C as n,S as r,w as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-B0Z9INg1.js";import{l as e}from"./useEvent-Dfcbgjhg.js";import{t}from"./react-DVplv7_D.js";import{Ja as n,S as r}from"./cells-T9_Y4Jlv.js";import{t as i}from"./compiler-runtime-BrajqUja.js";import{t as a}from"./jsx-runtime-B74pBk57.js";import{i as o,n as s,r as c}from"./floating-outline-GQD9km0W.js";import{t as l}from"./empty-state-BaCKb7o3.js";t();var u=i(),d=a(),f=()=>{let t=(0,u.c)(7),{items:i}=e(r),a;t[0]===i?a=t[1]:(a=c(i),t[0]=i,t[1]=a);let{activeHeaderId:f,activeOccurrences:p}=o(a);if(i.length===0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,d.jsx)(l,{title:`No outline found`,description:`Add markdown headings to your notebook to create an outline.`,icon:(0,d.jsx)(n,{})}),t[2]=e):e=t[2],e}let m;return t[3]!==f||t[4]!==p||t[5]!==i?(m=(0,d.jsx)(s,{items:i,activeHeaderId:f,activeOccurrences:p}),t[3]=f,t[4]=p,t[5]=i,t[6]=m):m=t[6],m};export{f as default};
1
+ import"./rolldown-runtime-B0Z9INg1.js";import{l as e}from"./useEvent-Dfcbgjhg.js";import{t}from"./react-DVplv7_D.js";import{Ja as n,S as r}from"./cells-styV7IX8.js";import{t as i}from"./compiler-runtime-BrajqUja.js";import{t as a}from"./jsx-runtime-B74pBk57.js";import{i as o,n as s,r as c}from"./floating-outline-Cm49rYYe.js";import{t as l}from"./empty-state-BaCKb7o3.js";t();var u=i(),d=a(),f=()=>{let t=(0,u.c)(7),{items:i}=e(r),a;t[0]===i?a=t[1]:(a=c(i),t[0]=i,t[1]=a);let{activeHeaderId:f,activeOccurrences:p}=o(a);if(i.length===0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,d.jsx)(l,{title:`No outline found`,description:`Add markdown headings to your notebook to create an outline.`,icon:(0,d.jsx)(n,{})}),t[2]=e):e=t[2],e}let m;return t[3]!==f||t[4]!==p||t[5]!==i?(m=(0,d.jsx)(s,{items:i,activeHeaderId:f,activeOccurrences:p}),t[3]=f,t[4]=p,t[5]=i,t[6]=m):m=t[6],m};export{f as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,l as n,t as r,u as i}from"./useEvent-Dfcbgjhg.js";import{t as a}from"./react-DVplv7_D.js";import{uo as o}from"./cells-T9_Y4Jlv.js";import{t as s}from"./compiler-runtime-BrajqUja.js";import{C as c}from"./config-DGX7JYor.js";import{N as l,v as u,x as d}from"./config-DzdxZb17.js";import{t as f}from"./cn-ldLVeaqm.js";import{t as p}from"./jsx-runtime-B74pBk57.js";import{t as m}from"./tooltip-CkGm8X7m.js";import{r as h,t as g}from"./button-D8gVKwe-.js";import{r as _}from"./ai-model-dropdown-bwTRyFn4.js";import{a as v}from"./useNumberFormatter-D7O_26UI.js";import{t as y}from"./chevron-right-eAtVhbNZ.js";import{s as b}from"./toDate-DOj9Q6uC.js";import{t as x}from"./spinner-DyNE-o8o.js";import{t as S}from"./refresh-cw-Qw1f8Jhy.js";import{a as C}from"./input-BZdRe7pb.js";import{n as w}from"./copy-KlhazlhB.js";import{t as T}from"./use-toast-Wu434mLr.js";import{r as E}from"./requests-lt0JK8Jt.js";import{n as D}from"./useAsyncData-DhhdOGGd.js";import{n as O}from"./package-data-dv4FBHxR.js";import{c as k,d as A,i as j,o as M,r as N,s as P,t as ee}from"./useInstallPackage-C7neMPwh.js";import{a as F}from"./errors-CNsgAw6m.js";import{n as I}from"./error-banner-B5kzVf_0.js";import{a as te,i as L,n as R,o as z,r as B,t as V}from"./table-vrvqpuKJ.js";import{t as H}from"./useStateForKey-CGMJQT8x.js";import{t as U}from"./empty-state-BaCKb7o3.js";import{r as W}from"./panel-context-C2QXpKfx.js";import{c as G,d as K,f as q,l as ne,n as J,p as re,s as Y,t as X,u as ie}from"./runtime-details-state-CznIe40L.js";var Z=e(a(),1),Q=s();function ae(e){let t=e.trim();for(let e of[`pip install`,`pip3 install`,`uv add`,`uv pip install`,`poetry add`,`conda install`,`pipenv install`])if(t.toLowerCase().startsWith(e.toLowerCase()))return t.slice(e.length).trim();return t}function oe(e,t,n){let{addPackage:i,removePackage:a}=E(),[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(!1);return{loading:o,run:r(async()=>{if(c.current)return;c.current=!0,s(!0);let r=e===`upgrade`?M:j;try{let o={package:t,group:n?.find(e=>e.kind===`group`)?.value},s=await(e===`upgrade`?i({...o,upgrade:!0}):a(o));s.restartRequired?N():s.success?r(t):r(t,s.error||`Package operation failed.`)}catch(e){r(t,F(e))}finally{c.current=!1,s(!1)}})}}function se(){let e=(0,Q.c)(8),t=n(O),[r]=c(),i=r.package_management.manager,{getDependencyTree:a,getPackageList:o}=E(),s;e[0]!==a||e[1]!==o?(s=async()=>{let{context:e,tree:t}=await a();return{list:e.kind===`sandbox`?[]:(await o()).packages,context:e,tree:t}},e[0]=a,e[1]=o,e[2]=s):s=e[2];let l;return e[3]!==a||e[4]!==o||e[5]!==t||e[6]!==i?(l=[a,o,i,t],e[3]=a,e[4]=o,e[5]=t,e[6]=i,e[7]=l):l=e[7],D(s,l)}var $=p();function ce(e){let t=(0,Q.c)(17),{notice:r}=e,i=n(K),a=n(ie),o=n(q);if(r.pending||r.ready)return null;let s=!a||i?.manifest==null,c;t[0]===a?c=t[1]:(c=()=>a?.editManifest(),t[0]=a,t[1]=c);let l;t[2]!==s||t[3]!==c?(l=(0,$.jsx)(g,{variant:`outline`,size:`xs`,disabled:s,onClick:c,children:`Edit manifest…`}),t[2]=s,t[3]=c,t[4]=l):l=t[4];let u;t[5]!==a||t[6]!==r.kind||t[7]!==o?(u=r.kind===`sync`&&o.kind===`restart-required`?(0,$.jsx)(le,{}):(0,$.jsx)(g,{variant:`text`,size:`xs`,disabled:!a,onClick:()=>a?.sync(),children:`Retry sync`}),t[5]=a,t[6]=r.kind,t[7]=o,t[8]=u):u=t[8];let d;t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]===i?.manifest?f=t[13]:(f=i?.manifest==null&&(0,$.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`A manifest will be available once this new notebook starts.`}),t[12]=i?.manifest,t[13]=f);let p;return t[14]!==d||t[15]!==f?(p=(0,$.jsxs)($.Fragment,{children:[d,f]}),t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function le(){let e=(0,Q.c)(2),t=P(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(g,{variant:`text`,size:`xs`,onClick:t,children:`Restart Kernel`}),e[0]=t,e[1]=n),n}function ue(e){let t=(0,Q.c)(5),{notice:n}=e,r;t[0]===n?r=t[1]:(r=n.sandbox&&(0,$.jsx)(ce,{notice:n}),t[0]=n,t[1]=r);let i;return t[2]!==n||t[3]!==r?(i=(0,$.jsx)(J,{notice:n,children:r}),t[2]=n,t[3]=r,t[4]=i):i=t[4],i}function de(e){let t=(0,Q.c)(9),{notice:r}=e,i=n(re);if(!i&&!r)return null;let a;t[0]===r?a=t[1]:(a=r?(0,$.jsx)(`div`,{className:`mb-5`,children:(0,$.jsx)(ue,{notice:r})}):(0,$.jsx)(`p`,{className:`text-sm`,children:`Environment synced`}),t[0]=r,t[1]=a);let o=i?.operation_id,s=i?.logs.environment??``,c=i?.status.kind===`running`?`running`:i?.status.kind===`succeeded`?`succeeded`:`failed`,l;t[2]!==o||t[3]!==s||t[4]!==c?(l=(0,$.jsx)(Y,{logs:s,state:c,label:`sandbox sync output`},o),t[2]=o,t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;return t[6]!==a||t[7]!==l?(u=(0,$.jsxs)(`div`,{className:`mt-5 min-w-0`,children:[a,l]}),t[6]=a,t[7]=l,t[8]=u):u=t[8],u}function fe(){let e=(0,Q.c)(41),r=W(),i=!!n(K)?.backend,a=n(u),o=n(G),s;e[0]===o?s=e[1]:(s=o&&{...o,ready:!1},e[0]=o,e[1]=s);let c=s,l=n(ne),p=n(d),[m,h]=t(X),g;e[2]!==a||e[3]!==c||e[4]!==l||e[5]!==p||e[6]!==i?(g=c?.kind===`startup`?c:l||p||a&&!i?{kind:`startup`,sandbox:i,title:`Notebook started`,description:`The notebook is ready to run.`,pending:!1,ready:!0,error:null}:null,e[2]=a,e[3]=c,e[4]=l,e[5]=p,e[6]=i,e[7]=g):g=e[7];let _=g,v=`runtime-details-${r}`,y=i?`Sandbox details`:`Runtime details`,b=!m,x=a?`shrink-0 max-h-[65%] border-b`:`flex-1`,S;e[8]===x?S=e[9]:(S=f(`min-w-0 overflow-auto p-4`,x),e[8]=x,e[9]=S);let C,w;e[10]===h?(C=e[11],w=e[12]):(C=()=>h(!0),w=()=>h(!0),e[10]=h,e[11]=C,e[12]=w);let T;e[13]===c?T=e[14]:(T=c?.kind===`connection`&&(0,$.jsx)(`div`,{className:`mb-5`,children:(0,$.jsx)(ue,{notice:c})}),e[13]=c,e[14]=T);let E;e[15]===_?E=e[16]:(E=_&&(0,$.jsx)(ue,{notice:_}),e[15]=_,e[16]=E);let D;e[17]!==a||e[18]!==c||e[19]!==i?(D=i&&a&&(0,$.jsx)(de,{notice:c?.kind===`sync`?c:null}),e[17]=a,e[18]=c,e[19]=i,e[20]=D):D=e[20];let O;e[21]!==a||e[22]!==c||e[23]!==i?(O=i&&a&&(!c||c.pending)&&(0,$.jsx)(pe,{}),e[21]=a,e[22]=c,e[23]=i,e[24]=O):O=e[24];let k;e[25]!==c||e[26]!==i||e[27]!==_?(k=!c&&!_&&!i&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Not connected to a runtime.`}),e[25]=c,e[26]=i,e[27]=_,e[28]=k):k=e[28];let A;return e[29]!==E||e[30]!==D||e[31]!==O||e[32]!==k||e[33]!==v||e[34]!==y||e[35]!==b||e[36]!==S||e[37]!==C||e[38]!==w||e[39]!==T?(A=(0,$.jsxs)(`section`,{id:v,"aria-label":y,hidden:b,className:S,onPointerDownCapture:C,onFocusCapture:w,children:[T,E,D,O,k]}),e[29]=E,e[30]=D,e[31]=O,e[32]=k,e[33]=v,e[34]=y,e[35]=b,e[36]=S,e[37]=C,e[38]=w,e[39]=T,e[40]=A):A=e[40],A}function pe(){let e=(0,Q.c)(14),t=n(K),r=n(ie),i=n(q).kind===`running`||!r,a;e[0]===r?a=e[1]:(a=()=>r?.sync(),e[0]=r,e[1]=a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(S,{className:`size-3`,"aria-hidden":!0}),e[2]=o):o=e[2];let s;e[3]!==i||e[4]!==a?(s=(0,$.jsxs)(g,{variant:`text`,size:`xs`,className:`text-muted-foreground gap-1.5 p-0`,disabled:i,onClick:a,children:[o,`Sync`]}),e[3]=i,e[4]=a,e[5]=s):s=e[5];let c=!r||t?.manifest==null,l;e[6]===r?l=e[7]:(l=()=>r?.editManifest(),e[6]=r,e[7]=l);let u;e[8]!==c||e[9]!==l?(u=(0,$.jsx)(g,{variant:`text`,size:`xs`,className:`text-muted-foreground p-0`,disabled:c,onClick:l,children:`Edit manifest…`}),e[8]=c,e[9]=l,e[10]=u):u=e[10];let d;return e[11]!==s||e[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center gap-4 mt-5 border-t pt-3`,children:[s,u]}),e[11]=s,e[12]=u,e[13]=d):d=e[13],d}var me=e=>{let t=(0,Q.c)(9),{onClick:n,loading:r,children:i,className:a}=e;if(r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(x,{size:`small`,className:`h-4 w-4 shrink-0 opacity-50`}),t[0]=e):e=t[0],e}let o;t[1]===a?o=t[2]:(o=f(`px-2 h-full text-xs text-muted-foreground hover:text-foreground`,`invisible group-hover:visible`,a),t[1]=a,t[2]=o);let s;t[3]===n?s=t[4]:(s=h.stopPropagation(n),t[3]=n,t[4]=s);let c;return t[5]!==i||t[6]!==o||t[7]!==s?(c=(0,$.jsx)(`button`,{type:`button`,className:o,onClick:s,children:i}),t[5]=i,t[6]=o,t[7]=s,t[8]=c):c=t[8],c},he=()=>{let e=(0,Q.c)(5),t=n(u),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(fe,{}),e[0]=r):r=e[0];let i;e[1]===t?i=e[2]:(i=t&&(0,$.jsx)(ge,{}),e[1]=t,e[2]=i);let a;return e[3]===i?a=e[4]:(a=(0,$.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 overflow-hidden`,children:[r,i]}),e[3]=i,e[4]=a),a},ge=()=>{let e=(0,Q.c)(35),t=n(q).kind===`running`,[r,i]=Z.useState(null),{data:a,error:o,isPending:s}=se();if(s){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`output`,{className:`flex flex-1 items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(x,{className:`size-4`}),`Loading installed packages…`]}),e[0]=t):t=e[0],t}if(o){let t;return e[1]===o?t=e[2]:(t=(0,$.jsx)(I,{error:o}),e[1]=o,e[2]=t),t}let c=a.tree!=null,l=a.tree?.name,u=a?.tree?.version,d=a.context.kind===`sandbox`?a.context.backend:null,p=d!==null,m;e[3]!==p||e[4]!==c||e[5]!==r?(m=p?`tree`:Ce(r,c),e[3]=p,e[4]=c,e[5]=r,e[6]=m):m=e[6];let h=m,g=l&&l!==`<root>`?`project`:`environment`,_;e[7]===a.context?_=e[8]:(_=(0,$.jsx)(_e,{context:a.context}),e[7]=a.context,e[8]=_);let v;e[9]!==t||e[10]!==_?(v=(0,$.jsx)(`fieldset`,{disabled:t,className:`contents`,children:_}),e[9]=t,e[10]=_,e[11]=v):v=e[11];let y;e[12]!==p||e[13]!==c||e[14]!==l||e[15]!==g||e[16]!==u||e[17]!==h?(y=c&&!p&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-2 py-1 border-b`,children:[(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:f(`px-2 py-1 text-xs rounded`,h===`list`?`bg-accent text-accent-foreground`:`text-muted-foreground hover:text-foreground`),onClick:()=>i(`list`),children:`List`}),(0,$.jsx)(`button`,{type:`button`,className:f(`px-2 py-1 text-xs rounded`,h===`tree`?`bg-accent text-accent-foreground`:`text-muted-foreground hover:text-foreground`),onClick:()=>i(`tree`),children:`Tree`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium`,title:g,children:g}),l&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[l,u&&` v${u}`]})]})]}),e[12]=p,e[13]=c,e[14]=l,e[15]=g,e[16]=u,e[17]=h,e[18]=y):y=e[18];let b;e[19]===t?b=e[20]:(b=t&&(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:`Showing packages from the last sync.`}),e[19]=t,e[20]=b);let S;e[21]!==a.list||e[22]!==a.tree||e[23]!==o||e[24]!==d||e[25]!==h?(S=h===`list`?(0,$.jsx)(ve,{packages:a.list}):(0,$.jsx)(xe,{tree:a.tree,error:o,sandboxBackend:d}),e[21]=a.list,e[22]=a.tree,e[23]=o,e[24]=d,e[25]=h,e[26]=S):S=e[26];let C;e[27]!==t||e[28]!==b||e[29]!==S?(C=(0,$.jsxs)(`fieldset`,{disabled:t,className:`flex flex-col flex-1 min-h-0`,"aria-busy":t,children:[b,S]}),e[27]=t,e[28]=b,e[29]=S,e[30]=C):C=e[30];let w;return e[31]!==v||e[32]!==y||e[33]!==C?(w=(0,$.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[v,y,C]}),e[31]=v,e[32]=y,e[33]=C,e[34]=w):w=e[34],w},_e=e=>{let t=(0,Q.c)(50),{context:r}=e,[a,s]=Z.useState(``),{handleClick:c}=_(),l=r.kind===`sandbox`,u=l?r.backend:r.name,d=n(A),p=i(A),h,g;t[0]!==d||t[1]!==p?(h=()=>{d&&(s(d),p(null))},g=[d,p],t[0]=d,t[1]=p,t[2]=h,t[3]=g):(h=t[2],g=t[3]),Z.useEffect(h,g);let{loading:v,handleInstallPackages:y}=ee(),S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{s(``)},t[4]=S):S=t[4];let w=S,T;t[5]!==y||t[6]!==a?(T=()=>{let e=ae(a);y([e],w)},t[5]=y,t[6]=a,t[7]=T):T=t[7];let E=T,D=l?`Add packages to ${u} sandbox...`:`Install packages with ${u}...`,O;t[8]!==l||t[9]!==v||t[10]!==c||t[11]!==u?(O=v?(0,$.jsx)(x,{size:`small`,className:`mr-2 h-4 w-4 shrink-0 opacity-50`}):l?(0,$.jsx)(o,{"aria-hidden":`true`,className:`mr-2 h-4 w-4 shrink-0 opacity-50`}):(0,$.jsx)(m,{content:`Change package manager (currently ${u})`,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":`Change package manager`,onClick:()=>c(`packageManagementAndData`),className:`pointer-events-auto mr-2 rounded-sm opacity-50 hover:opacity-80 focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring`,children:(0,$.jsx)(o,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0`})})}),t[8]=l,t[9]=v,t[10]=c,t[11]=u,t[12]=O):O=t[12];let j;t[13]===E?j=t[14]:(j=e=>{e.key===`Enter`&&(e.preventDefault(),E())},t[13]=E,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>s(e.target.value),t[15]=M):M=t[15];let N;t[16]!==a||t[17]!==D||t[18]!==O||t[19]!==j?(N=(0,$.jsx)(C,{placeholder:D,id:k,icon:O,rootClassName:`flex-1 border-none`,value:a,onKeyDown:j,onChange:M}),t[16]=a,t[17]=D,t[18]=O,t[19]=j,t[20]=N):N=t[20];let P;t[21]!==l||t[22]!==u?(P=l?(0,$.jsxs)(`span`,{children:[`Packages are recorded in this notebook's inline metadata and synchronized with its `,u,` sandbox. To switch backends, restart marimo with a different --sandbox option.`]}):(0,$.jsxs)(`span`,{children:[`Packages are installed using `,u,`, selected in your user configuration.`]}),t[21]=l,t[22]=u,t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(`span`,{className:`mt-2`,children:`You can install packages with various formats:`}),t[24]=F):F=t[24];let I;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(`span`,{className:`font-bold tracking-wide`,children:`Package name:`}),t[25]=I):I=t[25];let te,L;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsxs)(`div`,{children:[I,` A package name; this will install the latest version.`,(0,$.jsx)(`div`,{className:`text-muted-foreground`,children:`Example: httpx`})]}),L=(0,$.jsx)(`span`,{className:`font-bold tracking-wide`,children:`Package and version:`}),t[26]=te,t[27]=L):(te=t[26],L=t[27]);let R,z;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsxs)(`div`,{children:[L,` `,`A package with a specific version or version range.`,(0,$.jsx)(`div`,{className:`text-muted-foreground`,children:`Examples: httpx==0.27.0, httpx>=0.27.0`})]}),z=(0,$.jsx)(`span`,{className:`font-bold tracking-wide`,children:`Git:`}),t[28]=R,t[29]=z):(R=t[28],z=t[29]);let B,V;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsxs)(`div`,{children:[z,` A Git repository`,(0,$.jsx)(`div`,{className:`text-muted-foreground`,children:`Example: git+https://github.com/encode/httpx`})]}),V=(0,$.jsx)(`span`,{className:`font-bold tracking-wide`,children:`URL:`}),t[30]=B,t[31]=V):(B=t[30],V=t[31]);let H,U;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsxs)(`div`,{children:[V,` A remote wheel or source distribution.`,(0,$.jsx)(`div`,{className:`text-muted-foreground`,children:`Example: https://example.com/httpx-0.27.0.tar.gz`})]}),U=(0,$.jsx)(`span`,{className:`font-bold tracking-wide`,children:`Path:`}),t[32]=H,t[33]=U):(H=t[32],U=t[33]);let W;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 mt-2`,children:[te,R,B,H,(0,$.jsxs)(`div`,{children:[U,` A local wheel, source distribution, or project directory.`,(0,$.jsx)(`div`,{className:`text-muted-foreground`,children:`Example: /example/foo-0.1.0-py3-none-any.whl`})]})]}),t[34]=W):W=t[34];let G;t[35]===P?G=t[36]:(G=(0,$.jsxs)(`div`,{className:`text-sm flex flex-col w-full max-w-[360px]`,children:[P,F,W]}),t[35]=P,t[36]=G);let K;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(b,{className:`h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent`}),t[37]=K):K=t[37];let q;t[38]===G?q=t[39]:(q=(0,$.jsx)(m,{delayDuration:300,side:`left`,align:`start`,content:G,children:K}),t[38]=G,t[39]=q);let ne=a&&`bg-accent text-accent-foreground`,J;t[40]===ne?J=t[41]:(J=f(`float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2`,ne,`disabled:cursor-not-allowed disabled:opacity-50`),t[40]=ne,t[41]=J);let re=!a,Y;t[42]!==E||t[43]!==J||t[44]!==re?(Y=(0,$.jsx)(`button`,{type:`button`,className:J,onClick:E,disabled:re,children:`Add`}),t[42]=E,t[43]=J,t[44]=re,t[45]=Y):Y=t[45];let X;return t[46]!==q||t[47]!==Y||t[48]!==N?(X=(0,$.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[N,q,Y]}),t[46]=q,t[47]=Y,t[48]=N,t[49]=X):X=t[49],X},ve=e=>{let t=(0,Q.c)(8),{packages:n}=e,r;t[0]===n?r=t[1]:(r=n.toSorted(we),t[0]=n,t[1]=r);let i=r;if(n.length===0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{title:`No packages`,description:`No packages are installed in this environment.`,icon:(0,$.jsx)(o,{})}),t[2]=e):e=t[2],e}let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(te,{children:(0,$.jsxs)(z,{children:[(0,$.jsx)(L,{children:`Name`}),(0,$.jsx)(L,{children:`Version`}),(0,$.jsx)(L,{})]})}),t[3]=a):a=t[3];let s;t[4]===i?s=t[5]:(s=i.map(Te),t[4]=i,t[5]=s);let c;return t[6]===s?c=t[7]:(c=(0,$.jsxs)(V,{className:`overflow-auto flex-1`,children:[a,(0,$.jsx)(R,{children:s})]}),t[6]=s,t[7]=c),c},ye=e=>{let t=(0,Q.c)(3),{packageName:n,tags:r}=e,{loading:i,run:a}=oe(`upgrade`,n,r);if(l())return null;let o;return t[0]!==i||t[1]!==a?(o=(0,$.jsx)(me,{onClick:a,loading:i,children:`Upgrade`}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o},be=e=>{let t=(0,Q.c)(3),{packageName:n,tags:r}=e,{loading:i,run:a}=oe(`remove`,n,r);if(n.toLowerCase()===`marimo`)return null;let o;return t[0]!==i||t[1]!==a?(o=(0,$.jsx)(me,{onClick:a,loading:i,children:`Remove`}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o},xe=e=>{let t=(0,Q.c)(16),{tree:n,error:r,sandboxBackend:i}=e,[a,s]=H(n,Ee);if(r){let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(I,{error:r}),t[0]=r,t[1]=e),e}if(!n){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{title:`Dependency tree unavailable`,description:`The sandbox did not return a dependency tree.`,icon:(0,$.jsx)(o,{})}),t[2]=e):e=t[2],e}if(n.dependencies.length===0){if(i===`pixi`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{title:`No PyPI dependencies`,description:`Conda dependencies are not shown in this panel.`,icon:(0,$.jsx)(o,{})}),t[3]=e):e=t[3],e}let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{title:`No dependencies`,description:`No package dependencies found in this environment.`,icon:(0,$.jsx)(o,{})}),t[4]=e):e=t[4],e}let c;t[5]===s?c=t[6]:(c=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=s,t[6]=c);let l=c,u;if(t[7]!==a||t[8]!==l||t[9]!==n.dependencies){let e;t[11]!==a||t[12]!==l?(e=(e,t)=>(0,$.jsx)(`div`,{className:`border-b`,children:(0,$.jsx)(Se,{nodeId:`root-${t}`,node:e,level:0,isTopLevel:!0,expandedNodes:a,onToggle:l})},`${e.name}-${t}`),t[11]=a,t[12]=l,t[13]=e):e=t[13],u=n.dependencies.map(e),t[7]=a,t[8]=l,t[9]=n.dependencies,t[10]=u}else u=t[10];let d;return t[14]===u?d=t[15]:(d=(0,$.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,$.jsx)(`div`,{children:u})}),t[14]=u,t[15]=d),d},Se=e=>{let t=(0,Q.c)(56),{nodeId:n,node:r,level:i,isTopLevel:a,expandedNodes:o,onToggle:s}=e,c=a!==void 0&&a,l=r.dependencies.length>0,u;t[0]!==o||t[1]!==n?(u=o.has(n),t[0]=o,t[1]=n,t[2]=u):u=t[2];let d=u,p=c?0:16+i*16,m;t[3]!==l||t[4]!==n||t[5]!==s?(m=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l&&s(n))},t[3]=l,t[4]=n,t[5]=s,t[6]=m):m=t[6];let h=m,g;t[7]!==l||t[8]!==n||t[9]!==s?(g=e=>{e.stopPropagation(),l&&s(n)},t[7]=l,t[8]=n,t[9]=s,t[10]=g):g=t[10];let _=g,b=l&&`select-none`,x=c?`px-2 py-0.5`:``,S;t[11]!==b||t[12]!==x?(S=f(`flex items-center group cursor-pointer text-sm whitespace-nowrap`,`hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden`,b,x),t[11]=b,t[12]=x,t[13]=S):S=t[13];let C;t[14]!==p||t[15]!==c?(C=c?{}:{paddingLeft:`${p}px`},t[14]=p,t[15]=c,t[16]=C):C=t[16];let w=l?d:void 0,T;t[17]!==l||t[18]!==d?(T=l?d?(0,$.jsx)(v,{className:`w-4 h-4 mr-2 shrink-0`}):(0,$.jsx)(y,{className:`w-4 h-4 mr-2 shrink-0`}):(0,$.jsx)(`div`,{className:`w-4 mr-2 shrink-0`}),t[17]=l,t[18]=d,t[19]=T):T=t[19];let E;t[20]===r.name?E=t[21]:(E=(0,$.jsx)(`span`,{className:`font-medium truncate`,children:r.name}),t[20]=r.name,t[21]=E);let D;t[22]===r.version?D=t[23]:(D=r.version&&(0,$.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`v`,r.version]}),t[22]=r.version,t[23]=D);let O;t[24]!==E||t[25]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0 py-1.5`,children:[E,D]}),t[24]=E,t[25]=D,t[26]=O):O=t[26];let k;t[27]===r.tags?k=t[28]:(k=r.tags.map(De),t[27]=r.tags,t[28]=k);let A;t[29]===k?A=t[30]:(A=(0,$.jsx)(`div`,{className:`flex items-center gap-1 ml-2`,children:k}),t[29]=k,t[30]=A);let j;t[31]!==c||t[32]!==r.name||t[33]!==r.tags?(j=c&&(0,$.jsxs)(`div`,{className:`flex gap-1 invisible group-hover:visible`,children:[(0,$.jsx)(ye,{packageName:r.name,tags:r.tags}),(0,$.jsx)(be,{packageName:r.name,tags:r.tags})]}),t[31]=c,t[32]=r.name,t[33]=r.tags,t[34]=j):j=t[34];let M;t[35]!==_||t[36]!==h||t[37]!==T||t[38]!==O||t[39]!==A||t[40]!==j||t[41]!==S||t[42]!==C||t[43]!==w?(M=(0,$.jsxs)(`div`,{className:S,style:C,onClick:_,onKeyDown:h,tabIndex:0,role:`treeitem`,"aria-selected":!1,"aria-expanded":w,children:[T,O,A,j]}),t[35]=_,t[36]=h,t[37]=T,t[38]=O,t[39]=A,t[40]=j,t[41]=S,t[42]=C,t[43]=w,t[44]=M):M=t[44];let N;t[45]!==o||t[46]!==l||t[47]!==d||t[48]!==i||t[49]!==r.dependencies||t[50]!==n||t[51]!==s?(N=l&&d&&(0,$.jsx)(`div`,{role:`group`,children:r.dependencies.map((e,t)=>(0,$.jsx)(Se,{nodeId:`${n}-${t}`,node:e,level:i+1,isTopLevel:!1,expandedNodes:o,onToggle:s},`${e.name}-${t}`))}),t[45]=o,t[46]=l,t[47]=d,t[48]=i,t[49]=r.dependencies,t[50]=n,t[51]=s,t[52]=N):N=t[52];let P;return t[53]!==M||t[54]!==N?(P=(0,$.jsxs)(`div`,{children:[M,N]}),t[53]=M,t[54]=N,t[55]=P):P=t[55],P};function Ce(e,t){return e===`list`?`list`:t?e||`tree`:`list`}function we(e,t){return e.name.localeCompare(t.name,void 0,{sensitivity:`base`})}function Te(e){return(0,$.jsxs)(z,{className:`group`,onClick:async()=>{await w(`${e.name}==${e.version}`),T({title:`Copied to clipboard`})},children:[(0,$.jsx)(B,{children:e.name}),(0,$.jsx)(B,{children:e.version}),(0,$.jsxs)(B,{className:`flex justify-end`,children:[(0,$.jsx)(ye,{packageName:e.name}),(0,$.jsx)(be,{packageName:e.name})]})]},e.name)}function Ee(){return new Set}function De(e,t){return e.kind===`dedupe`?(0,$.jsx)(`div`,{className:`items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-muted-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium`,title:`Package tree already displayed`,children:`already in tree`},t):e.kind===`cycle`?(0,$.jsx)(`div`,{className:`items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300`,title:`cycle`,children:`cycle`},t):e.kind===`extra`?(0,$.jsx)(`div`,{className:`items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300`,title:e.value,children:e.value},t):e.kind===`group`?(0,$.jsx)(`div`,{className:`items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300`,title:e.value,children:e.value},t):null}export{he as default};
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,l as n,t as r,u as i}from"./useEvent-Dfcbgjhg.js";import{t as a}from"./react-DVplv7_D.js";import{uo as o}from"./cells-styV7IX8.js";import{t as s}from"./compiler-runtime-BrajqUja.js";import{C as c}from"./config-DGX7JYor.js";import{M as l,v as u,x as d}from"./config-BQT0uYUo.js";import{t as f}from"./cn-ldLVeaqm.js";import{t as p}from"./jsx-runtime-B74pBk57.js";import{t as m}from"./tooltip-CkGm8X7m.js";import{r as h,t as g}from"./button-D8gVKwe-.js";import{r as _}from"./ai-model-dropdown-B15l0R62.js";import{a as v}from"./useNumberFormatter-D7O_26UI.js";import{t as y}from"./chevron-right-eAtVhbNZ.js";import{s as b}from"./toDate-DOj9Q6uC.js";import{t as x}from"./spinner-DyNE-o8o.js";import{t as S}from"./refresh-cw-Qw1f8Jhy.js";import{a as C}from"./input-BZdRe7pb.js";import{n as w}from"./copy-KlhazlhB.js";import{t as T}from"./use-toast-Wu434mLr.js";import{r as E}from"./requests-lt0JK8Jt.js";import{n as D}from"./useAsyncData-DhhdOGGd.js";import{n as O}from"./package-data-dv4FBHxR.js";import{c as k,d as A,i as j,o as M,r as N,s as P,t as ee}from"./useInstallPackage-CYQoMdMQ.js";import{a as F}from"./errors-CNsgAw6m.js";import{n as I}from"./error-banner-B5kzVf_0.js";import{a as te,i as L,n as R,o as z,r as B,t as V}from"./table-vrvqpuKJ.js";import{t as H}from"./useStateForKey-CGMJQT8x.js";import{t as U}from"./empty-state-BaCKb7o3.js";import{r as W}from"./panel-context-C2QXpKfx.js";import{c as G,d as K,f as q,l as ne,n as J,p as re,s as Y,t as X,u as ie}from"./runtime-details-state-hb7A1jgR.js";var Z=e(a(),1),Q=s();function ae(e){let t=e.trim();for(let e of[`pip install`,`pip3 install`,`uv add`,`uv pip install`,`poetry add`,`conda install`,`pipenv install`])if(t.toLowerCase().startsWith(e.toLowerCase()))return t.slice(e.length).trim();return t}function oe(e,t,n){let{addPackage:i,removePackage:a}=E(),[o,s]=(0,Z.useState)(!1),c=(0,Z.useRef)(!1);return{loading:o,run:r(async()=>{if(c.current)return;c.current=!0,s(!0);let r=e===`upgrade`?M:j;try{let o={package:t,group:n?.find(e=>e.kind===`group`)?.value},s=await(e===`upgrade`?i({...o,upgrade:!0}):a(o));s.restartRequired?N():s.success?r(t):r(t,s.error||`Package operation failed.`)}catch(e){r(t,F(e))}finally{c.current=!1,s(!1)}})}}function se(){let e=(0,Q.c)(8),t=n(O),[r]=c(),i=r.package_management.manager,{getDependencyTree:a,getPackageList:o}=E(),s;e[0]!==a||e[1]!==o?(s=async()=>{let{context:e,tree:t}=await a();return{list:e.kind===`sandbox`?[]:(await o()).packages,context:e,tree:t}},e[0]=a,e[1]=o,e[2]=s):s=e[2];let l;return e[3]!==a||e[4]!==o||e[5]!==t||e[6]!==i?(l=[a,o,i,t],e[3]=a,e[4]=o,e[5]=t,e[6]=i,e[7]=l):l=e[7],D(s,l)}var $=p();function ce(e){let t=(0,Q.c)(17),{notice:r}=e,i=n(K),a=n(ie),o=n(q);if(r.pending||r.ready)return null;let s=!a||i?.manifest==null,c;t[0]===a?c=t[1]:(c=()=>a?.editManifest(),t[0]=a,t[1]=c);let l;t[2]!==s||t[3]!==c?(l=(0,$.jsx)(g,{variant:`outline`,size:`xs`,disabled:s,onClick:c,children:`Edit manifest…`}),t[2]=s,t[3]=c,t[4]=l):l=t[4];let u;t[5]!==a||t[6]!==r.kind||t[7]!==o?(u=r.kind===`sync`&&o.kind===`restart-required`?(0,$.jsx)(le,{}):(0,$.jsx)(g,{variant:`text`,size:`xs`,disabled:!a,onClick:()=>a?.sync(),children:`Retry sync`}),t[5]=a,t[6]=r.kind,t[7]=o,t[8]=u):u=t[8];let d;t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]===i?.manifest?f=t[13]:(f=i?.manifest==null&&(0,$.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`A manifest will be available once this new notebook starts.`}),t[12]=i?.manifest,t[13]=f);let p;return t[14]!==d||t[15]!==f?(p=(0,$.jsxs)($.Fragment,{children:[d,f]}),t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function le(){let e=(0,Q.c)(2),t=P(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(g,{variant:`text`,size:`xs`,onClick:t,children:`Restart Kernel`}),e[0]=t,e[1]=n),n}function ue(e){let t=(0,Q.c)(5),{notice:n}=e,r;t[0]===n?r=t[1]:(r=n.sandbox&&(0,$.jsx)(ce,{notice:n}),t[0]=n,t[1]=r);let i;return t[2]!==n||t[3]!==r?(i=(0,$.jsx)(J,{notice:n,children:r}),t[2]=n,t[3]=r,t[4]=i):i=t[4],i}function de(e){let t=(0,Q.c)(9),{notice:r}=e,i=n(re);if(!i&&!r)return null;let a;t[0]===r?a=t[1]:(a=r?(0,$.jsx)(`div`,{className:`mb-5`,children:(0,$.jsx)(ue,{notice:r})}):(0,$.jsx)(`p`,{className:`text-sm`,children:`Environment synced`}),t[0]=r,t[1]=a);let o=i?.operation_id,s=i?.logs.environment??``,c=i?.status.kind===`running`?`running`:i?.status.kind===`succeeded`?`succeeded`:`failed`,l;t[2]!==o||t[3]!==s||t[4]!==c?(l=(0,$.jsx)(Y,{logs:s,state:c,label:`sandbox sync output`},o),t[2]=o,t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;return t[6]!==a||t[7]!==l?(u=(0,$.jsxs)(`div`,{className:`mt-5 min-w-0`,children:[a,l]}),t[6]=a,t[7]=l,t[8]=u):u=t[8],u}function fe(){let e=(0,Q.c)(41),r=W(),i=!!n(K)?.backend,a=n(u),o=n(G),s;e[0]===o?s=e[1]:(s=o&&{...o,ready:!1},e[0]=o,e[1]=s);let c=s,l=n(ne),p=n(d),[m,h]=t(X),g;e[2]!==a||e[3]!==c||e[4]!==l||e[5]!==p||e[6]!==i?(g=c?.kind===`startup`?c:l||p||a&&!i?{kind:`startup`,sandbox:i,title:`Notebook started`,description:`The notebook is ready to run.`,pending:!1,ready:!0,error:null}:null,e[2]=a,e[3]=c,e[4]=l,e[5]=p,e[6]=i,e[7]=g):g=e[7];let _=g,v=`runtime-details-${r}`,y=i?`Sandbox details`:`Runtime details`,b=!m,x=a?`shrink-0 max-h-[65%] border-b`:`flex-1`,S;e[8]===x?S=e[9]:(S=f(`min-w-0 overflow-auto p-4`,x),e[8]=x,e[9]=S);let C,w;e[10]===h?(C=e[11],w=e[12]):(C=()=>h(!0),w=()=>h(!0),e[10]=h,e[11]=C,e[12]=w);let T;e[13]===c?T=e[14]:(T=c?.kind===`connection`&&(0,$.jsx)(`div`,{className:`mb-5`,children:(0,$.jsx)(ue,{notice:c})}),e[13]=c,e[14]=T);let E;e[15]===_?E=e[16]:(E=_&&(0,$.jsx)(ue,{notice:_}),e[15]=_,e[16]=E);let D;e[17]!==a||e[18]!==c||e[19]!==i?(D=i&&a&&(0,$.jsx)(de,{notice:c?.kind===`sync`?c:null}),e[17]=a,e[18]=c,e[19]=i,e[20]=D):D=e[20];let O;e[21]!==a||e[22]!==c||e[23]!==i?(O=i&&a&&(!c||c.pending)&&(0,$.jsx)(pe,{}),e[21]=a,e[22]=c,e[23]=i,e[24]=O):O=e[24];let k;e[25]!==c||e[26]!==i||e[27]!==_?(k=!c&&!_&&!i&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Not connected to a runtime.`}),e[25]=c,e[26]=i,e[27]=_,e[28]=k):k=e[28];let A;return e[29]!==E||e[30]!==D||e[31]!==O||e[32]!==k||e[33]!==v||e[34]!==y||e[35]!==b||e[36]!==S||e[37]!==C||e[38]!==w||e[39]!==T?(A=(0,$.jsxs)(`section`,{id:v,"aria-label":y,hidden:b,className:S,onPointerDownCapture:C,onFocusCapture:w,children:[T,E,D,O,k]}),e[29]=E,e[30]=D,e[31]=O,e[32]=k,e[33]=v,e[34]=y,e[35]=b,e[36]=S,e[37]=C,e[38]=w,e[39]=T,e[40]=A):A=e[40],A}function pe(){let e=(0,Q.c)(14),t=n(K),r=n(ie),i=n(q).kind===`running`||!r,a;e[0]===r?a=e[1]:(a=()=>r?.sync(),e[0]=r,e[1]=a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(S,{className:`size-3`,"aria-hidden":!0}),e[2]=o):o=e[2];let s;e[3]!==i||e[4]!==a?(s=(0,$.jsxs)(g,{variant:`text`,size:`xs`,className:`text-muted-foreground gap-1.5 p-0`,disabled:i,onClick:a,children:[o,`Sync`]}),e[3]=i,e[4]=a,e[5]=s):s=e[5];let c=!r||t?.manifest==null,l;e[6]===r?l=e[7]:(l=()=>r?.editManifest(),e[6]=r,e[7]=l);let u;e[8]!==c||e[9]!==l?(u=(0,$.jsx)(g,{variant:`text`,size:`xs`,className:`text-muted-foreground p-0`,disabled:c,onClick:l,children:`Edit manifest…`}),e[8]=c,e[9]=l,e[10]=u):u=e[10];let d;return e[11]!==s||e[12]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center gap-4 mt-5 border-t pt-3`,children:[s,u]}),e[11]=s,e[12]=u,e[13]=d):d=e[13],d}var me=e=>{let t=(0,Q.c)(9),{onClick:n,loading:r,children:i,className:a}=e;if(r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(x,{size:`small`,className:`h-4 w-4 shrink-0 opacity-50`}),t[0]=e):e=t[0],e}let o;t[1]===a?o=t[2]:(o=f(`px-2 h-full text-xs text-muted-foreground hover:text-foreground`,`invisible group-hover:visible`,a),t[1]=a,t[2]=o);let s;t[3]===n?s=t[4]:(s=h.stopPropagation(n),t[3]=n,t[4]=s);let c;return t[5]!==i||t[6]!==o||t[7]!==s?(c=(0,$.jsx)(`button`,{type:`button`,className:o,onClick:s,children:i}),t[5]=i,t[6]=o,t[7]=s,t[8]=c):c=t[8],c},he=()=>{let e=(0,Q.c)(5),t=n(u),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(fe,{}),e[0]=r):r=e[0];let i;e[1]===t?i=e[2]:(i=t&&(0,$.jsx)(ge,{}),e[1]=t,e[2]=i);let a;return e[3]===i?a=e[4]:(a=(0,$.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 overflow-hidden`,children:[r,i]}),e[3]=i,e[4]=a),a},ge=()=>{let e=(0,Q.c)(35),t=n(q).kind===`running`,[r,i]=Z.useState(null),{data:a,error:o,isPending:s}=se();if(s){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`output`,{className:`flex flex-1 items-center justify-center gap-2 text-xs text-muted-foreground`,children:[(0,$.jsx)(x,{className:`size-4`}),`Loading installed packages…`]}),e[0]=t):t=e[0],t}if(o){let t;return e[1]===o?t=e[2]:(t=(0,$.jsx)(I,{error:o}),e[1]=o,e[2]=t),t}let c=a.tree!=null,l=a.tree?.name,u=a?.tree?.version,d=a.context.kind===`sandbox`?a.context.backend:null,p=d!==null,m;e[3]!==p||e[4]!==c||e[5]!==r?(m=p?`tree`:Ce(r,c),e[3]=p,e[4]=c,e[5]=r,e[6]=m):m=e[6];let h=m,g=l&&l!==`<root>`?`project`:`environment`,_;e[7]===a.context?_=e[8]:(_=(0,$.jsx)(_e,{context:a.context}),e[7]=a.context,e[8]=_);let v;e[9]!==t||e[10]!==_?(v=(0,$.jsx)(`fieldset`,{disabled:t,className:`contents`,children:_}),e[9]=t,e[10]=_,e[11]=v):v=e[11];let y;e[12]!==p||e[13]!==c||e[14]!==l||e[15]!==g||e[16]!==u||e[17]!==h?(y=c&&!p&&(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-2 py-1 border-b`,children:[(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,className:f(`px-2 py-1 text-xs rounded`,h===`list`?`bg-accent text-accent-foreground`:`text-muted-foreground hover:text-foreground`),onClick:()=>i(`list`),children:`List`}),(0,$.jsx)(`button`,{type:`button`,className:f(`px-2 py-1 text-xs rounded`,h===`tree`?`bg-accent text-accent-foreground`:`text-muted-foreground hover:text-foreground`),onClick:()=>i(`tree`),children:`Tree`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium`,title:g,children:g}),l&&(0,$.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[l,u&&` v${u}`]})]})]}),e[12]=p,e[13]=c,e[14]=l,e[15]=g,e[16]=u,e[17]=h,e[18]=y):y=e[18];let b;e[19]===t?b=e[20]:(b=t&&(0,$.jsx)(`p`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:`Showing packages from the last sync.`}),e[19]=t,e[20]=b);let S;e[21]!==a.list||e[22]!==a.tree||e[23]!==o||e[24]!==d||e[25]!==h?(S=h===`list`?(0,$.jsx)(ve,{packages:a.list}):(0,$.jsx)(xe,{tree:a.tree,error:o,sandboxBackend:d}),e[21]=a.list,e[22]=a.tree,e[23]=o,e[24]=d,e[25]=h,e[26]=S):S=e[26];let C;e[27]!==t||e[28]!==b||e[29]!==S?(C=(0,$.jsxs)(`fieldset`,{disabled:t,className:`flex flex-col flex-1 min-h-0`,"aria-busy":t,children:[b,S]}),e[27]=t,e[28]=b,e[29]=S,e[30]=C):C=e[30];let w;return e[31]!==v||e[32]!==y||e[33]!==C?(w=(0,$.jsxs)(`div`,{className:`flex-1 flex flex-col overflow-hidden`,children:[v,y,C]}),e[31]=v,e[32]=y,e[33]=C,e[34]=w):w=e[34],w},_e=e=>{let t=(0,Q.c)(50),{context:r}=e,[a,s]=Z.useState(``),{handleClick:c}=_(),l=r.kind===`sandbox`,u=l?r.backend:r.name,d=n(A),p=i(A),h,g;t[0]!==d||t[1]!==p?(h=()=>{d&&(s(d),p(null))},g=[d,p],t[0]=d,t[1]=p,t[2]=h,t[3]=g):(h=t[2],g=t[3]),Z.useEffect(h,g);let{loading:v,handleInstallPackages:y}=ee(),S;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{s(``)},t[4]=S):S=t[4];let w=S,T;t[5]!==y||t[6]!==a?(T=()=>{let e=ae(a);y([e],w)},t[5]=y,t[6]=a,t[7]=T):T=t[7];let E=T,D=l?`Add packages to ${u} sandbox...`:`Install packages with ${u}...`,O;t[8]!==l||t[9]!==v||t[10]!==c||t[11]!==u?(O=v?(0,$.jsx)(x,{size:`small`,className:`mr-2 h-4 w-4 shrink-0 opacity-50`}):l?(0,$.jsx)(o,{"aria-hidden":`true`,className:`mr-2 h-4 w-4 shrink-0 opacity-50`}):(0,$.jsx)(m,{content:`Change package manager (currently ${u})`,children:(0,$.jsx)(`button`,{type:`button`,"aria-label":`Change package manager`,onClick:()=>c(`packageManagementAndData`),className:`pointer-events-auto mr-2 rounded-sm opacity-50 hover:opacity-80 focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring`,children:(0,$.jsx)(o,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0`})})}),t[8]=l,t[9]=v,t[10]=c,t[11]=u,t[12]=O):O=t[12];let j;t[13]===E?j=t[14]:(j=e=>{e.key===`Enter`&&(e.preventDefault(),E())},t[13]=E,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>s(e.target.value),t[15]=M):M=t[15];let N;t[16]!==a||t[17]!==D||t[18]!==O||t[19]!==j?(N=(0,$.jsx)(C,{placeholder:D,id:k,icon:O,rootClassName:`flex-1 border-none`,value:a,onKeyDown:j,onChange:M}),t[16]=a,t[17]=D,t[18]=O,t[19]=j,t[20]=N):N=t[20];let P;t[21]!==l||t[22]!==u?(P=l?(0,$.jsxs)(`span`,{children:[`Packages are recorded in this notebook's inline metadata and synchronized with its `,u,` sandbox. To switch backends, restart marimo with a different --sandbox option.`]}):(0,$.jsxs)(`span`,{children:[`Packages are installed using `,u,`, selected in your user configuration.`]}),t[21]=l,t[22]=u,t[23]=P):P=t[23];let F;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(`span`,{className:`mt-2`,children:`You can install packages with various formats:`}),t[24]=F):F=t[24];let I;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(`span`,{className:`font-bold tracking-wide`,children:`Package name:`}),t[25]=I):I=t[25];let te,L;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsxs)(`div`,{children:[I,` A package name; this will install the latest version.`,(0,$.jsx)(`div`,{className:`text-muted-foreground`,children:`Example: httpx`})]}),L=(0,$.jsx)(`span`,{className:`font-bold tracking-wide`,children:`Package and version:`}),t[26]=te,t[27]=L):(te=t[26],L=t[27]);let R,z;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsxs)(`div`,{children:[L,` `,`A package with a specific version or version range.`,(0,$.jsx)(`div`,{className:`text-muted-foreground`,children:`Examples: httpx==0.27.0, httpx>=0.27.0`})]}),z=(0,$.jsx)(`span`,{className:`font-bold tracking-wide`,children:`Git:`}),t[28]=R,t[29]=z):(R=t[28],z=t[29]);let B,V;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsxs)(`div`,{children:[z,` A Git repository`,(0,$.jsx)(`div`,{className:`text-muted-foreground`,children:`Example: git+https://github.com/encode/httpx`})]}),V=(0,$.jsx)(`span`,{className:`font-bold tracking-wide`,children:`URL:`}),t[30]=B,t[31]=V):(B=t[30],V=t[31]);let H,U;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsxs)(`div`,{children:[V,` A remote wheel or source distribution.`,(0,$.jsx)(`div`,{className:`text-muted-foreground`,children:`Example: https://example.com/httpx-0.27.0.tar.gz`})]}),U=(0,$.jsx)(`span`,{className:`font-bold tracking-wide`,children:`Path:`}),t[32]=H,t[33]=U):(H=t[32],U=t[33]);let W;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 mt-2`,children:[te,R,B,H,(0,$.jsxs)(`div`,{children:[U,` A local wheel, source distribution, or project directory.`,(0,$.jsx)(`div`,{className:`text-muted-foreground`,children:`Example: /example/foo-0.1.0-py3-none-any.whl`})]})]}),t[34]=W):W=t[34];let G;t[35]===P?G=t[36]:(G=(0,$.jsxs)(`div`,{className:`text-sm flex flex-col w-full max-w-[360px]`,children:[P,F,W]}),t[35]=P,t[36]=G);let K;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(b,{className:`h-4 w-4 cursor-help text-muted-foreground hover:text-foreground bg-transparent`}),t[37]=K):K=t[37];let q;t[38]===G?q=t[39]:(q=(0,$.jsx)(m,{delayDuration:300,side:`left`,align:`start`,content:G,children:K}),t[38]=G,t[39]=q);let ne=a&&`bg-accent text-accent-foreground`,J;t[40]===ne?J=t[41]:(J=f(`float-right px-2 m-0 h-full text-sm text-secondary-foreground ml-2`,ne,`disabled:cursor-not-allowed disabled:opacity-50`),t[40]=ne,t[41]=J);let re=!a,Y;t[42]!==E||t[43]!==J||t[44]!==re?(Y=(0,$.jsx)(`button`,{type:`button`,className:J,onClick:E,disabled:re,children:`Add`}),t[42]=E,t[43]=J,t[44]=re,t[45]=Y):Y=t[45];let X;return t[46]!==q||t[47]!==Y||t[48]!==N?(X=(0,$.jsxs)(`div`,{className:`flex items-center w-full border-b`,children:[N,q,Y]}),t[46]=q,t[47]=Y,t[48]=N,t[49]=X):X=t[49],X},ve=e=>{let t=(0,Q.c)(8),{packages:n}=e,r;t[0]===n?r=t[1]:(r=n.toSorted(we),t[0]=n,t[1]=r);let i=r;if(n.length===0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{title:`No packages`,description:`No packages are installed in this environment.`,icon:(0,$.jsx)(o,{})}),t[2]=e):e=t[2],e}let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(te,{children:(0,$.jsxs)(z,{children:[(0,$.jsx)(L,{children:`Name`}),(0,$.jsx)(L,{children:`Version`}),(0,$.jsx)(L,{})]})}),t[3]=a):a=t[3];let s;t[4]===i?s=t[5]:(s=i.map(Te),t[4]=i,t[5]=s);let c;return t[6]===s?c=t[7]:(c=(0,$.jsxs)(V,{className:`overflow-auto flex-1`,children:[a,(0,$.jsx)(R,{children:s})]}),t[6]=s,t[7]=c),c},ye=e=>{let t=(0,Q.c)(3),{packageName:n,tags:r}=e,{loading:i,run:a}=oe(`upgrade`,n,r);if(l())return null;let o;return t[0]!==i||t[1]!==a?(o=(0,$.jsx)(me,{onClick:a,loading:i,children:`Upgrade`}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o},be=e=>{let t=(0,Q.c)(3),{packageName:n,tags:r}=e,{loading:i,run:a}=oe(`remove`,n,r);if(n.toLowerCase()===`marimo`)return null;let o;return t[0]!==i||t[1]!==a?(o=(0,$.jsx)(me,{onClick:a,loading:i,children:`Remove`}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o},xe=e=>{let t=(0,Q.c)(16),{tree:n,error:r,sandboxBackend:i}=e,[a,s]=H(n,Ee);if(r){let e;return t[0]===r?e=t[1]:(e=(0,$.jsx)(I,{error:r}),t[0]=r,t[1]=e),e}if(!n){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{title:`Dependency tree unavailable`,description:`The sandbox did not return a dependency tree.`,icon:(0,$.jsx)(o,{})}),t[2]=e):e=t[2],e}if(n.dependencies.length===0){if(i===`pixi`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{title:`No PyPI dependencies`,description:`Conda dependencies are not shown in this panel.`,icon:(0,$.jsx)(o,{})}),t[3]=e):e=t[3],e}let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(U,{title:`No dependencies`,description:`No package dependencies found in this environment.`,icon:(0,$.jsx)(o,{})}),t[4]=e):e=t[4],e}let c;t[5]===s?c=t[6]:(c=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[5]=s,t[6]=c);let l=c,u;if(t[7]!==a||t[8]!==l||t[9]!==n.dependencies){let e;t[11]!==a||t[12]!==l?(e=(e,t)=>(0,$.jsx)(`div`,{className:`border-b`,children:(0,$.jsx)(Se,{nodeId:`root-${t}`,node:e,level:0,isTopLevel:!0,expandedNodes:a,onToggle:l})},`${e.name}-${t}`),t[11]=a,t[12]=l,t[13]=e):e=t[13],u=n.dependencies.map(e),t[7]=a,t[8]=l,t[9]=n.dependencies,t[10]=u}else u=t[10];let d;return t[14]===u?d=t[15]:(d=(0,$.jsx)(`div`,{className:`flex-1 overflow-auto`,children:(0,$.jsx)(`div`,{children:u})}),t[14]=u,t[15]=d),d},Se=e=>{let t=(0,Q.c)(56),{nodeId:n,node:r,level:i,isTopLevel:a,expandedNodes:o,onToggle:s}=e,c=a!==void 0&&a,l=r.dependencies.length>0,u;t[0]!==o||t[1]!==n?(u=o.has(n),t[0]=o,t[1]=n,t[2]=u):u=t[2];let d=u,p=c?0:16+i*16,m;t[3]!==l||t[4]!==n||t[5]!==s?(m=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),l&&s(n))},t[3]=l,t[4]=n,t[5]=s,t[6]=m):m=t[6];let h=m,g;t[7]!==l||t[8]!==n||t[9]!==s?(g=e=>{e.stopPropagation(),l&&s(n)},t[7]=l,t[8]=n,t[9]=s,t[10]=g):g=t[10];let _=g,b=l&&`select-none`,x=c?`px-2 py-0.5`:``,S;t[11]!==b||t[12]!==x?(S=f(`flex items-center group cursor-pointer text-sm whitespace-nowrap`,`hover:bg-(--slate-2) focus:bg-(--slate-2) focus:outline-hidden`,b,x),t[11]=b,t[12]=x,t[13]=S):S=t[13];let C;t[14]!==p||t[15]!==c?(C=c?{}:{paddingLeft:`${p}px`},t[14]=p,t[15]=c,t[16]=C):C=t[16];let w=l?d:void 0,T;t[17]!==l||t[18]!==d?(T=l?d?(0,$.jsx)(v,{className:`w-4 h-4 mr-2 shrink-0`}):(0,$.jsx)(y,{className:`w-4 h-4 mr-2 shrink-0`}):(0,$.jsx)(`div`,{className:`w-4 mr-2 shrink-0`}),t[17]=l,t[18]=d,t[19]=T):T=t[19];let E;t[20]===r.name?E=t[21]:(E=(0,$.jsx)(`span`,{className:`font-medium truncate`,children:r.name}),t[20]=r.name,t[21]=E);let D;t[22]===r.version?D=t[23]:(D=r.version&&(0,$.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`v`,r.version]}),t[22]=r.version,t[23]=D);let O;t[24]!==E||t[25]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0 py-1.5`,children:[E,D]}),t[24]=E,t[25]=D,t[26]=O):O=t[26];let k;t[27]===r.tags?k=t[28]:(k=r.tags.map(De),t[27]=r.tags,t[28]=k);let A;t[29]===k?A=t[30]:(A=(0,$.jsx)(`div`,{className:`flex items-center gap-1 ml-2`,children:k}),t[29]=k,t[30]=A);let j;t[31]!==c||t[32]!==r.name||t[33]!==r.tags?(j=c&&(0,$.jsxs)(`div`,{className:`flex gap-1 invisible group-hover:visible`,children:[(0,$.jsx)(ye,{packageName:r.name,tags:r.tags}),(0,$.jsx)(be,{packageName:r.name,tags:r.tags})]}),t[31]=c,t[32]=r.name,t[33]=r.tags,t[34]=j):j=t[34];let M;t[35]!==_||t[36]!==h||t[37]!==T||t[38]!==O||t[39]!==A||t[40]!==j||t[41]!==S||t[42]!==C||t[43]!==w?(M=(0,$.jsxs)(`div`,{className:S,style:C,onClick:_,onKeyDown:h,tabIndex:0,role:`treeitem`,"aria-selected":!1,"aria-expanded":w,children:[T,O,A,j]}),t[35]=_,t[36]=h,t[37]=T,t[38]=O,t[39]=A,t[40]=j,t[41]=S,t[42]=C,t[43]=w,t[44]=M):M=t[44];let N;t[45]!==o||t[46]!==l||t[47]!==d||t[48]!==i||t[49]!==r.dependencies||t[50]!==n||t[51]!==s?(N=l&&d&&(0,$.jsx)(`div`,{role:`group`,children:r.dependencies.map((e,t)=>(0,$.jsx)(Se,{nodeId:`${n}-${t}`,node:e,level:i+1,isTopLevel:!1,expandedNodes:o,onToggle:s},`${e.name}-${t}`))}),t[45]=o,t[46]=l,t[47]=d,t[48]=i,t[49]=r.dependencies,t[50]=n,t[51]=s,t[52]=N):N=t[52];let P;return t[53]!==M||t[54]!==N?(P=(0,$.jsxs)(`div`,{children:[M,N]}),t[53]=M,t[54]=N,t[55]=P):P=t[55],P};function Ce(e,t){return e===`list`?`list`:t?e||`tree`:`list`}function we(e,t){return e.name.localeCompare(t.name,void 0,{sensitivity:`base`})}function Te(e){return(0,$.jsxs)(z,{className:`group`,onClick:async()=>{await w(`${e.name}==${e.version}`),T({title:`Copied to clipboard`})},children:[(0,$.jsx)(B,{children:e.name}),(0,$.jsx)(B,{children:e.version}),(0,$.jsxs)(B,{className:`flex justify-end`,children:[(0,$.jsx)(ye,{packageName:e.name}),(0,$.jsx)(be,{packageName:e.name})]})]},e.name)}function Ee(){return new Set}function De(e,t){return e.kind===`dedupe`?(0,$.jsx)(`div`,{className:`items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-muted-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium`,title:`Package tree already displayed`,children:`already in tree`},t):e.kind===`cycle`?(0,$.jsx)(`div`,{className:`items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-orange-300 dark:border-orange-700 text-orange-700 dark:text-orange-300`,title:`cycle`,children:`cycle`},t):e.kind===`extra`?(0,$.jsx)(`div`,{className:`items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-blue-300 dark:border-blue-700 text-blue-700 dark:text-blue-300`,title:e.value,children:e.value},t):e.kind===`group`?(0,$.jsx)(`div`,{className:`items-center border px-2 py-0.5 text-xs transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 text-foreground rounded-sm text-ellipsis block overflow-hidden max-w-fit font-medium border-green-300 dark:border-green-700 text-green-700 dark:text-green-300`,title:e.value,children:e.value},t):null}export{he as default};
@@ -1 +1 @@
1
- import{r as e}from"./useEvent-Dfcbgjhg.js";import{Qr as t}from"./cells-T9_Y4Jlv.js";import{k as n}from"./config-DzdxZb17.js";var r=n(`marimo:session-panel:state`,{openSections:[`variables`],hasUserInteracted:!1},t,{getOnInit:!0}),i=n(`marimo:file-explorer-panel:state`,{openSections:[`files`],hasUserInteracted:!1},t,{getOnInit:!0});function a(t,n){e.set(t,e=>e.openSections.includes(n)?e:{...e,openSections:[...e.openSections,n]})}export{i as n,r,a as t};
1
+ import{r as e}from"./useEvent-Dfcbgjhg.js";import{Qr as t}from"./cells-styV7IX8.js";import{O as n}from"./config-BQT0uYUo.js";var r=n(`marimo:session-panel:state`,{openSections:[`variables`],hasUserInteracted:!1},t,{getOnInit:!0}),i=n(`marimo:file-explorer-panel:state`,{openSections:[`files`],hasUserInteracted:!1},t,{getOnInit:!0});function a(t,n){e.set(t,e=>e.openSections.includes(n)?e:{...e,openSections:[...e.openSections,n]})}export{i as n,r,a as t};
@@ -0,0 +1,105 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,d as n,f as r,l as i,r as a,t as o,u as s}from"./useEvent-Dfcbgjhg.js";import{t as c}from"./react-DVplv7_D.js";import{$ as l,B as u,D as d,Dt as f,Et as p,Gn as m,Hr as h,I as g,Ii as ee,Jn as te,Kn as ne,Mr as re,Oo as ie,Ot as ae,R as oe,So as se,St as ce,T as le,Vi as ue,Wn as de,b as fe,ei as pe,g as me,h as he,l as ge,mr as _e,pr as ve,qn as ye,r as be}from"./cells-styV7IX8.js";import{C as _,E as v,F as y,I as b,K as xe,N as x,O as Se,R as S,S as C,V as Ce,b as w,c as T,v as E,z as D}from"./schemas-ChRqMOTL.js";import{t as we}from"./compiler-runtime-BrajqUja.js";import{D as Te,d as Ee,w as De}from"./config-DGX7JYor.js";import{c as Oe,i as ke,n as Ae,o as je,p as O,r as Me,s as Ne,t as Pe}from"./state-BkAqJoW7.js";import{g as k,t as A}from"./useEventListener-CjDeLqFC.js";import{t as j}from"./objects-rLPlQ3X_.js";import{i as Fe}from"./utils-B4K466FK.js";import{a as M,f as Ie,m as Le,r as Re,v as ze}from"./session-B8Y-GJnS.js";import{M as Be,T as N,_ as Ve,l as He,o as Ue,w as P,x as We}from"./config-BQT0uYUo.js";import{r as Ge}from"./state-C0irhlOZ.js";import{i as Ke,o as qe,r as Je}from"./state-DaWgt-rn.js";import{r as Ye}from"./ErrorBoundary-DaQ9THH_.js";import{n as F,t as I}from"./cn-ldLVeaqm.js";import{t as Xe}from"./jsx-runtime-B74pBk57.js";import{i as L,s as R}from"./fullscreen-BWTs8pYZ.js";import{a as z,c as B,i as V,l as Ze,n as H,o as U,r as Qe,s as $e}from"./use-restore-focus-DdS7Tl0F.js";import{Dt as et,Et as tt,xt as nt}from"./JsonOutput-VxzHyItt.js";import{p as rt}from"./download-BrCpRZKN.js";import{t as it}from"./tooltip-CkGm8X7m.js";import{t as at}from"./button-D8gVKwe-.js";import{t as ot}from"./createLucideIcon-DfJ2oMlA.js";import{P as st,a as ct,c as lt,i as ut,n as dt}from"./layout-_lp06T0C.js";import{d as ft,n as pt}from"./markdown-renderer-CAyCgogC.js";import{v as mt}from"./write-secret-modal-7DzehGyr.js";import{n as ht}from"./spinner-DyNE-o8o.js";import{c as gt,l as _t,s as vt}from"./readonly-python-code-D7jcy9ds.js";import{s as yt}from"./MarimoErrorOutput-D-hLaDA-.js";import{t as bt}from"./use-toast-Wu434mLr.js";import{i as xt}from"./strings-C25fhMR_.js";import{t as St}from"./requests-lt0JK8Jt.js";import{t as Ct}from"./useDebounce-k9QTpQ9-.js";import{n as wt}from"./useAsyncData-DhhdOGGd.js";import{t as Tt}from"./RenderHTML-DjOEZL25.js";import{t as Et}from"./package-data-dv4FBHxR.js";import{f as Dt}from"./useInstallPackage-CYQoMdMQ.js";import{a as Ot}from"./errors-CNsgAw6m.js";import{s as kt}from"./react-icons.esm-D6tfmvq8.js";import{r as At}from"./events-CbeVJ6OD.js";import{i as jt}from"./cell-link-DR3W2HC7.js";import{t as Mt}from"./useDelayElapsed-BlsDT4TV.js";import{t as Nt}from"./requests-CgSY1X4a.js";import{r as Pt,s as Ft,t as It}from"./state-Ck7FMD5A.js";import{n as Lt}from"./runs-6lJxKV1w.js";function W(e){return xe(T,e)}var Rt=ot(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),zt=ot(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Bt=ot(`unlink`,[[`path`,{d:`m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71`,key:`yqzxt4`}],[`path`,{d:`m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71`,key:`4qinb0`}],[`line`,{x1:`8`,x2:`8`,y1:`2`,y2:`5`,key:`1041cp`}],[`line`,{x1:`2`,x2:`5`,y1:`8`,y2:`8`,key:`14m1p5`}],[`line`,{x1:`16`,x2:`16`,y1:`19`,y2:`22`,key:`rzdirn`}],[`line`,{x1:`19`,x2:`22`,y1:`16`,y2:`16`,key:`ox905f`}]]),G=e(c(),1),K=we(),q=Xe(),Vt=e=>{let{requires:t,fallback:n,delay:r,children:a}=e,o=n===void 0?null:n,s=r===void 0?0:r,c=i(t),l=Mt(c?0:s);return c?a:l?o:null},Ht=e=>{let t=(0,K.c)(6),{title:n}=e,r=Ct(n,300),i=n===r,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(ht,{className:`size-20 animate-spin text-primary`,"data-testid":`large-spinner`,strokeWidth:1}),t[0]=a):a=t[0];let o=i?`opacity-100`:`opacity-0`,s;t[1]===o?s=t[2]:(s=I(`mt-2 text-muted-foreground font-semibold text-lg transition-opacity duration-300`,o),t[1]=o,t[2]=s);let c;return t[3]!==r||t[4]!==s?(c=(0,q.jsxs)(`div`,{className:`flex flex-col h-full flex-1 items-center justify-center p-4`,children:[a,(0,q.jsx)(`div`,{className:s,children:r})]}),t[3]=r,t[4]=s,t[5]=c):c=t[5],c};function Ut(e,t){return e===`edit`||e===`home`||e===`gallery`?!0:e===`present`||M(Fe.includeCode,`false`)||M(Fe.showCode,`false`)?!1:M(Fe.showCode,`true`)?!0:t}function Wt(e){let t=Ut(e.mode,e.showAppCode),n=e.hasCells&&e.hasCachedOutputs;return{showCode:t,showCachedOutputs:n,canPaint:e.hasCells&&(t||n||e.allCellsIdle)}}var Gt=r(e=>{let t=!1,n=!0;for(let r of Object.values(e(fe).cellRuntime))pt(r.output)||(t=!0),r.status!==`idle`&&(n=!1);return{hasCachedOutputs:t,allCellsIdle:n}}),Kt=r(e=>e(Gt).hasCachedOutputs),qt=r(e=>e(Gt).allCellsIdle),Jt=r(e=>Wt({mode:e(Ie),showAppCode:e(Ge),hasCells:e(me),hasCachedOutputs:e(Kt),allCellsIdle:e(qt)})),Yt=r(e=>e(Jt).canPaint),Xt=e=>{let t=(0,K.c)(2),{children:n}=e;if(!Be())return n;let r;return t[0]===n?r=t[1]:(r=(0,q.jsx)(Zt,{children:n}),t[0]=n,t[1]=r),r},Zt=e=>{let t=(0,K.c)(8),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=[],t[0]=r):r=t[0];let{error:a}=wt($t,r),o=i(Yt),s=(0,G.useRef)(!1),c,l;if(t[1]!==o||t[2]!==a?(c=()=>{a&&o&&!s.current&&(s.current=!0,k.error(`Pyodide failed to initialize`,a),bt({title:`Failed to start the notebook runtime`,description:Ot(a),variant:`danger`}))},l=[a,o],t[1]=o,t[2]=a,t[3]=c,t[4]=l):(c=t[3],l=t[4]),(0,G.useEffect)(c,l),a&&!o)throw a;let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(Qt,{}),t[5]=u):u=t[5];let d;return t[6]===n?d=t[7]:(d=(0,q.jsx)(Vt,{requires:Yt,fallback:u,children:n}),t[6]=n,t[7]=d),d},Qt=()=>{let e=(0,K.c)(2),t=i(qe),n=t.kind===`loading`?t.message:`Loading…`,r;return e[0]===n?r=e[1]:(r=(0,q.jsx)(Ht,{title:n}),e[0]=n,e[1]=r),r};async function $t(){return await O.INSTANCE.initialized.promise,!0}var en={idle:`./favicon.ico`,success:`data:image/x-icon;base64,AAABAAEAMDAAAAEACACoDgAAFgAAACgAAAAwAAAAYAAAAAEACAAAAAAAAAkAAAAAAAAAAAAAAAEAAAABAAAAAAAAXXQAAFd3AwBWeAQAVngEAFd4AwBXeAQAVnkEAFh3AwBXdwQAVXcGAFd4BQBXeAQAWHgEAFd6AwBXeAMAVnkEAFZ5AwBXdwQAV3cFAFd4BABYeAQAV3gEAFh4BABXeAQA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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ECgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgJGRkZGRkZGRkZGRkZGRkZGRkZCQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgcZGRkZGRkZGRkZGRkZGQcCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAgMEBQYZGQYFBAMCAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////AAD///////8AAP//gAH//wAA//4AAH//AAD/+AAAH/8AAP/gAAAH/wAA/8AAAAP/AAD/gAAAAf8AAP8AAAAA/wAA/gAAAAB/AAD8AAAAAD8AAPgAAAAAHwAA+AAAAAAfAADwAAAAAA8AAPAAAAAADwAA4AAAAAAHAADgAAAAAAcAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADAAAAAAAMAAMAAAAAAAwAAwAAAAAADAADgAAAAAAcAAOAAAAAABwAA8AAAAAAPAADwAAAAAA8AAPgAAAAAHwAA+AAAAAAfAAD8AAAAAD8AAP4AAAAAfwAA/wAAAAD/AAD/gAAAAf8AAP/AAAAD/wAA/+AAAAf/AAD/+AAAH/8AAP/+AAB//wAA//+AAf//AAD///////8AAP///////wAA`};function tn(){let e=document.querySelector(`link[rel~='icon']`);if(e)return e;let t=document.createElement(`link`);return t.rel=`icon`,document.head.append(t),t}function nn(e){if(document.visibilityState===`visible`)return;let t=()=>{e===0?new Notification(`Execution completed`,{body:`Your notebook run completed successfully.`,icon:en.success}):new Notification(`Execution failed`,{body:`Your notebook run encountered ${e} error(s).`,icon:en.error})};!(`Notification`in window)||Notification.permission===`denied`||(Notification.permission===`granted`?t():Notification.permission==="default"&&Notification.requestPermission().then(e=>{e===`granted`&&t()}))}var rn=e=>{let t=(0,K.c)(11),{isRunning:n}=e,r=i(be),a,o;t[0]!==n||t[1]!==r?(a=()=>{let e=tn();if(!n&&e.href.includes(`favicon`)||(e.href=en[n?`running`:r===0?`success`:`error`],!document.hasFocus()))return;let t=setTimeout(()=>{e.href=en.idle},3e3);return()=>clearTimeout(t)},o=[n,r],t[0]=n,t[1]=r,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,G.useEffect)(a,o);let s=st(n)??n,c,l;t[4]!==n||t[5]!==r||t[6]!==s?(c=()=>{s&&!n&&nn(r)},l=[r,s,n],t[4]=n,t[5]=r,t[6]=s,t[7]=c,t[8]=l):(c=t[7],l=t[8]),(0,G.useEffect)(c,l);let u;return t[9]===n?u=t[10]:(u=()=>{if(!n){let e=tn();e.href=en.idle}},t[9]=n,t[10]=u),A(window,`focus`,u),null};function an(){let{cellIds:e,cellRuntime:t}=a.get(fe),n=e.inOrderIds.find(e=>t[e]?.status===`running`);n&&jt(n,`focus`)}var on=e=>{let t=(0,K.c)(18),{connection:n,isRunning:r,onReconnect:a}=e,{mode:o}=i(ze),s=n.state===N.CLOSED&&(o===`read`||n.code!==P.KERNEL_STARTUP_ERROR),c=n.state===N.OPEN,l=s&&n.code===P.KERNEL_DISCONNECTED,u;t[0]===s?u=t[1]:(u=s&&(0,q.jsx)(un,{}),t[0]=s,t[1]=u);let d=o===`read`?`fixed`:`absolute`,f;t[2]===d?f=t[3]:(f=I(`z-50 top-4 left-4`,d),t[2]=d,t[3]=f);let p;t[4]!==c||t[5]!==r?(p=c&&r&&(0,q.jsx)(ln,{}),t[4]=c,t[5]=r,t[6]=p):p=t[6];let m;t[7]!==l||t[8]!==s||t[9]!==a?(m=s&&(0,q.jsx)(cn,{onReconnect:l?a:void 0}),t[7]=l,t[8]=s,t[9]=a,t[10]=m):m=t[10];let h;t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,q.jsxs)(`div`,{className:f,children:[p,m]}),t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;return t[15]!==u||t[16]!==h?(g=(0,q.jsxs)(q.Fragment,{children:[u,h]}),t[15]=u,t[16]=h,t[17]=g):g=t[17],g},sn=`print:hidden pointer-events-auto hover:cursor-pointer`,cn=e=>{let t=(0,K.c)(12),{onReconnect:n}=e,r=!n,i=r?`App disconnected`:`App disconnected — click to reconnect`,a=r?0:-1,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=I(sn,`bg-transparent border-0 p-0`),t[0]=o):o=t[0];let s=r?`App disconnected`:`Reconnect to app`,c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,q.jsx)(Bt,{className:`w-[25px] h-[25px] text-(--red-11)`}),t[1]=c):c=t[1];let l;t[2]!==r||t[3]!==n||t[4]!==s?(l=(0,q.jsx)(`button`,{type:`button`,className:o,"aria-label":s,"data-testid":`disconnected-indicator`,onClick:n,disabled:r,children:c}),t[2]=r,t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]!==a||t[7]!==l?(u=(0,q.jsx)(`span`,{tabIndex:a,children:l}),t[6]=a,t[7]=l,t[8]=u):u=t[8];let d;return t[9]!==i||t[10]!==u?(d=(0,q.jsx)(it,{content:i,children:u}),t[9]=i,t[10]=u,t[11]=d):d=t[11],d},ln=()=>{let e=(0,K.c)(6),t=i(le),n=t?`Scratchpad is running`:`Jump to running cell`,r=t?void 0:an,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(Rt,{className:`running-app-icon`,size:30,strokeWidth:1}),e[0]=a):a=e[0];let o;e[1]===r?o=e[2]:(o=(0,q.jsx)(`div`,{className:sn,"data-testid":`loading-indicator`,onClick:r,children:a}),e[1]=r,e[2]=o);let s;return e[3]!==o||e[4]!==n?(s=(0,q.jsx)(it,{content:n,side:`right`,children:o}),e[3]=o,e[4]=n,e[5]=s):s=e[5],s},un=()=>{let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`noise`}),(0,q.jsx)(`div`,{className:`disconnected-gradient`})]}),e[0]=t):t=e[0],t},dn=H,fn=Ze,pn=L($e),mn=G.forwardRef((e,t)=>{let n=(0,K.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=I(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(U,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});mn.displayName=U.displayName;var hn=F(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),gn=G.forwardRef((e,t)=>{let n=(0,K.c)(15),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({side:o,className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?`right`:o,c;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,q.jsx)(mn,{}),n[5]=c):c=n[5];let l;n[6]!==i||n[7]!==s?(l=I(hn({side:s}),i),n[6]=i,n[7]=s,n[8]=l):l=n[8];let u;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsxs)(Qe,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,q.jsx)(kt,{className:`h-4 w-4`}),(0,q.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),n[9]=u):u=n[9];let d;return n[10]!==r||n[11]!==a||n[12]!==t||n[13]!==l?(d=(0,q.jsx)(pn,{children:(0,q.jsxs)(R,{children:[c,(0,q.jsxs)(V,{ref:t,className:l,...a,children:[r,u]})]})}),n[10]=r,n[11]=a,n[12]=t,n[13]=l,n[14]=d):d=n[14],d});gn.displayName=V.displayName;var _n=G.forwardRef((e,t)=>{let n=(0,K.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=I(`text-lg font-semibold text-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(B,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});_n.displayName=B.displayName;var vn=G.forwardRef((e,t)=>{let n=(0,K.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=I(`text-sm text-muted-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,q.jsx)(z,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});vn.displayName=z.displayName;var yn=(0,G.memo)(()=>{let e=(0,K.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsx)(tt,{name:nt.SIDEBAR}),e[0]=t):t=e[0],t});yn.displayName=`SidebarSlot`;var bn=e=>{let t=(0,K.c)(6),{openWidth:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsx)(fn,{className:`lg:hidden`,asChild:!0,children:(0,q.jsx)(at,{variant:`ghost`,className:`bg-background`,children:(0,q.jsx)(zt,{className:`w-5 h-5`})})}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i={maxWidth:n},t[1]=n,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(yn,{}),t[3]=a):a=t[3];let o;return t[4]===i?o=t[5]:(o=(0,q.jsxs)(dn,{children:[r,(0,q.jsx)(gn,{className:`w-full px-3 h-full flex flex-col overflow-y-auto`,style:i,side:`left`,children:a})]}),t[4]=i,t[5]=o),o},xn=e=>{let t=(0,K.c)(7),{isOpen:n,toggle:r}=e,i=n?`rotate-0`:`rotate-180`,a;t[0]===i?a=t[1]:(a=I(`h-5 w-5 transition-transform ease-in-out duration-700`,i),t[0]=i,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,q.jsx)(rt,{className:a}),t[2]=a,t[3]=o);let s;return t[4]!==o||t[5]!==r?(s=(0,q.jsx)(`div`,{className:`invisible lg:visible absolute top-[12px] right-[16px] z-20`,children:(0,q.jsx)(at,{onClick:r,className:`w-10 h-8`,variant:`ghost`,size:`icon`,children:o})}),t[4]=o,t[5]=r,t[6]=s):s=t[6],s},Sn=e=>{let t=(0,K.c)(11),{isOpen:n,toggle:r,width:i}=e,a=n?i:Pe,o;t[0]===a?o=t[1]:(o={width:a},t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=I(`app-sidebar auto-collapse-nav`,`top-0 left-0 z-20 h-full hidden lg:block relative transition-[width] ease-in-out duration-300`),t[2]=s):s=t[2];let c;t[3]!==n||t[4]!==r?(c=(0,q.jsx)(xn,{isOpen:n,toggle:r}),t[3]=n,t[4]=r,t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,q.jsx)(`div`,{className:`relative h-full flex flex-col px-3 pb-16 pt-14 overflow-y-auto shadow-sm border-l`,children:(0,q.jsx)(yn,{})}),t[6]=l):l=t[6];let u;return t[7]!==n||t[8]!==o||t[9]!==c?(u=(0,q.jsxs)(`aside`,{"data-expanded":n,style:o,className:s,children:[c,l]}),t[7]=n,t[8]=o,t[9]=c,t[10]=u):u=t[10],u},Cn=e=>{let n=(0,K.c)(15),{children:r}=e,[i,a]=t(Me),{isOpen:o,width:s}=i;if(et(nt.SIDEBAR).length===0)return r;let c;n[0]===s?c=n[1]:(c=Ae(s),n[0]=s,n[1]=c);let l=c,u;n[2]!==a||n[3]!==o?(u=()=>a({type:`toggle`,isOpen:!o}),n[2]=a,n[3]=o,n[4]=u):u=n[4];let d;n[5]!==o||n[6]!==l||n[7]!==u?(d=(0,q.jsx)(Sn,{isOpen:o,width:l,toggle:u}),n[5]=o,n[6]=l,n[7]=u,n[8]=d):d=n[8];let f;n[9]===l?f=n[10]:(f=(0,q.jsx)(`div`,{className:`absolute top-3 left-4 flex items-center z-50`,children:(0,q.jsx)(bn,{openWidth:l})}),n[9]=l,n[10]=f);let p;return n[11]!==r||n[12]!==d||n[13]!==f?(p=(0,q.jsxs)(`div`,{className:`inset-0 absolute flex`,children:[d,f,r]}),n[11]=r,n[12]=d,n[13]=f,n[14]=p):p=n[14],p},wn=e=>{let t=(0,K.c)(19),{width:n,connection:r,isRunning:i,children:a,onReconnect:o}=e,s=r.state,c;t[0]===i?c=t[1]:(c=(0,q.jsx)(rn,{isRunning:i}),t[0]=i,t[1]=c);let l;t[2]!==r||t[3]!==i||t[4]!==o?(l=(0,q.jsx)(on,{connection:r,isRunning:i,onReconnect:o}),t[2]=r,t[3]=i,t[4]=o,t[5]=l):l=t[5];let u=r.state===N.CLOSED&&r.code!==P.KERNEL_STARTUP_ERROR&&`disconnected`,d=n===`full`&&`config-width-full`,f=n===`columns`?`overflow-x-auto`:`overflow-x-auto sm:overflow-x-hidden`,p;t[6]!==u||t[7]!==d||t[8]!==f?(p=I(`mathjax_ignore`,u,`bg-background w-full h-full text-textColor`,`flex flex-col overflow-y-auto`,d,f,`print:height-fit`),t[6]=u,t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==a||t[11]!==s||t[12]!==p||t[13]!==n?(m=(0,q.jsx)(Xt,{children:(0,q.jsx)(Cn,{children:(0,q.jsx)(`div`,{id:`App`,"data-config-width":n,"data-connection-state":s,className:p,children:a})})}),t[10]=a,t[11]=s,t[12]=p,t[13]=n,t[14]=m):m=t[14];let h;return t[15]!==c||t[16]!==l||t[17]!==m?(h=(0,q.jsxs)(q.Fragment,{children:[c,l,m]}),t[15]=c,t[16]=l,t[17]=m,t[18]=h):h=t[18],h},Tn=(0,G.memo)(e=>{let t=(0,K.c)(9),{appConfig:n,mode:r,children:a}=e,{selectedLayout:o}=_t();if(!i(Le)&&(r===`edit`||r===`present`&&o===`vertical`))return a;let s=r===`read`,c;t[0]!==o||t[1]!==s?(c=vt({selectedLayout:o,isReading:s,searchParams:new URLSearchParams(window.location.search)}),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]===l?u=t[4]:(u=ct.find(e=>e.type===l),t[3]=l,t[4]=u);let d=u;if(!d)return a;let f;return t[5]!==n||t[6]!==r||t[7]!==d?(f=(0,q.jsx)(En,{appConfig:n,mode:r,plugin:d}),t[5]=n,t[6]=r,t[7]=d,t[8]=f):f=t[8],f});Tn.displayName=`CellsRenderer`;var En=e=>{let t=(0,K.c)(12),{appConfig:n,mode:r,plugin:i}=e,a=_t(),o=g(),{setCurrentLayoutData:s}=gt(),c,l;t[0]!==a||t[1]!==o||t[2]!==i?(c=ge(o),l=ut({state:a,plugin:i,cells:c}),t[0]=a,t[1]=o,t[2]=i,t[3]=c,t[4]=l):(c=t[3],l=t[4]);let u=l,d=i.Component,f;return t[5]!==d||t[6]!==n||t[7]!==c||t[8]!==u||t[9]!==r||t[10]!==s?(f=(0,q.jsx)(d,{appConfig:n,mode:r,cells:c,layout:u,setLayout:s}),t[5]=d,t[6]=n,t[7]=c,t[8]=u,t[9]=r,t[10]=s,t[11]=f):f=t[11],f},Dn=class e{hasStarted=!1;static get INSTANCE(){let t=`_marimo_private_RuntimeState`;return window[t]||(window[t]=new e(je)),window[t]}_sendComponentValues;uiElementRegistry;constructor(e){this.uiElementRegistry=e}get sendComponentValues(){if(!this._sendComponentValues)throw Error(`sendComponentValues is not set`);return this._sendComponentValues}start(e){if(this.hasStarted){k.warn(`RuntimeState already started`);return}this._sendComponentValues=e,document.addEventListener(At.TYPE,this.handleReadyEvent),this.hasStarted=!0}stop(){if(!this.hasStarted){k.warn(`RuntimeState already stopped`);return}document.removeEventListener(At.TYPE,this.handleReadyEvent),this.hasStarted=!1}handleReadyEvent=e=>{let t=e.detail.objectId;if(!this.uiElementRegistry.has(t))return;let n=this.uiElementRegistry.lookupValue(t);n!==void 0&&this.sendComponentValues({objectIds:[t],values:[n]}).catch(e=>{k.warn(e)})}},On=b().min(1).describe(`Identifies a project. Unique within the host and unchanged while the project exists.`),J=b().min(1).describe(`Identifies a notebook. Unique within the host and unchanged while the notebook exists.`),kn=b().min(1).describe(`Identifies a runtime. Unique within the host; every start and restart creates a new id.`),An=b().min(1).describe(`Identifies an attachment. Unique within the host.`),jn=b().min(1).describe("Identifies a run independently of the request's `Idempotency-Key`. Events carry the key in `request_id`."),Y=b().min(1).describe(`Identifies an execution. Unique within the host.`),Mn=b().min(1).describe(`Identifies a console, display, or variable item. Unique within the host; sending an item again with the same id replaces it.`),X=b().min(1).describe("Identifies a cell within its notebook. Stable while the host serves the notebook; whether it survives a reload of the store depends on the format. `setup` is the setup cell."),Nn=x({pid:v().min(1).describe(`The process id.`),started_at:W({offset:!0}).describe(`When the process started.`)}).describe("The process that wrote a record. A client checks that a process\nwith this `pid` that started at `started_at` still exists. If it\ndoes not, the record is stale and may be removed.\n");x({version:Se(1).describe(`The version of this record's format. This document describes version 1.`),process:Nn,name:b().describe("A label for the host to show people, such as `VS Code` or `marimo`. Two hosts can share a name; the filename is the identity."),url:b().describe("Where the host's API is. The scheme is `http`, and the host part is `127.0.0.1` or `[::1]`, written exactly that way."),token:b().min(1).describe(`The secret a client sends to prove it read the record.`)}).describe(`A host record is the file a host writes so that clients can find
2
+ it. A host writes \`<marimo-state-dir>/hosts-v1/<id>.json\` once its API
3
+ is serving at \`url\`, where \`<id>\` is an identifier the host makes
4
+ up each time it starts. The record does not change while the host
5
+ runs, and the host removes it when it stops.
6
+
7
+ A client reads \`version\` before anything else and skips any record
8
+ it cannot parse or whose version it does not support. It also
9
+ checks that the file and its directory belong to the current user
10
+ and cannot be read by others, and that \`url\` points at this
11
+ machine.
12
+ `);var Pn=E([`host`,`project`,`notebook`,`document`,`cell`,`runtime`,`attachment`,`run`,`execution`,`console`,`display`,`variable`,`custom`,`analysis`]).describe(`The kinds a stream carries, and the values \`types\` accepts. The
13
+ catalog stream carries host, project, notebook, runtime, and
14
+ attachment. A notebook's stream carries notebook, document,
15
+ cell, runtime, attachment, run, execution, console,
16
+ display, variable, and custom. Custom events describe occurrences
17
+ rather than object state.
18
+ `),Fn=x({type:b().min(1).describe("A namespaced event type under a namespace the producer controls, such as `marimo.pair.agent-message`. Clients ignore types they do not recognize while retaining the stream cursor."),data:D().describe(`Any JSON value, including null. The producer defines its schema and consumers of the type validate it.`)}).describe(`A notebook occurrence with a producer-defined payload. It is replayed
19
+ while event history is retained, but is never included in snapshots
20
+ and does not belong to a run. The notebook is identified by the stream.
21
+ `),In=x({operations:C(b()).describe("The operations this host implements, such as `runtime.start`. Whether a client may call one on a given project or notebook is that object's `operations`. Clients accept names they do not recognize.")}).describe(`What the host can do. There is exactly one host object, and it is
22
+ the first object in a snapshot when the filter includes \`host\`.
23
+ A resumed stream only sends it if its operations changed since
24
+ the cursor. The host sends it again if its operations change.
25
+ `),Ln=E([`indexing`,`indexed`,`partial`]).describe("How far a host has gotten finding the notebooks in a project.\nWhile it is `indexing`, more notebooks are coming. Once it is\n`indexed`, the host believes it has found every notebook under the\nroot. A `partial` project is one the host stopped scanning on\npurpose, or one with something it could not read.\n"),Rn=x({id:On,name:b().describe(`A label to show people, usually the name of the root directory.`),root:b().nullable().describe(`The absolute path of the project's directory, written the way the host's operating system writes paths. Null when the project has no directory.`),status:Ln,message:b().nullable().describe("Why the host stopped scanning. Null unless `status` is `partial`."),operations:C(b()).describe("Operations this client may call on the project, today `notebook.create`. A subset of `host.operations`, narrowed by permission and never by state. The host sends the project again when it changes.")}).describe(`A project is a group of notebooks that the host presents together, usually a directory.`),zn=x({id:J,project_id:On,path:b().nullable().describe(`The file's path relative to the project root, written the way the host's operating system writes paths. Null when the notebook has no file, such as one not yet saved, or one deleted while a runtime still refers to it.`),name:b().describe(`A label to show people. Derived from the filename when the host has nothing better.`),operations:C(b()).describe("Operations this client may call on the notebook, such as `notebook.edit` or `runtime.start`. A subset of `host.operations`, narrowed by permission and never by state; whether a runtime is attached shows in the `runtime` object, and preconditions still apply when an operation is called. The host sends the notebook again when it changes."),updated_at:W({offset:!0}).nullable().describe(`When the file was last modified, as of the host's last look at it. Null when the host does not know.`)}).describe(`A notebook is a document and its results as the host knows them,
26
+ usually backed by a file. Its kernel, when it has one, is a
27
+ separate object, the runtime. A host sends at most one \`notebook\`
28
+ event per second for the same notebook, since \`updated_at\`
29
+ changes on every save.
30
+ `),Bn=E([`starting`,`running`,`terminating`,`failed`]).describe("Where a runtime is in its life. A `starting` runtime is bringing\nits kernel up. A `running` runtime accepts work. A `terminating`\nruntime is shutting its kernel down. A `failed` runtime could not\nstart, or its kernel exited unexpectedly. A runtime that has\nended is removed rather than given a status.\n"),Vn=x({id:kn,notebook_id:J,status:Bn,message:b().nullable().describe("A note about the current status, such as progress while `starting` or the reason when `failed`. Null otherwise."),marimo_version:b().nullable().describe(`The version of marimo running the kernel. Null until the host knows it.`),started_at:W({offset:!0}).describe(`When this runtime started.`)}).describe(`A runtime is a kernel attached to one notebook, and a notebook has
31
+ at most one. It ends when a client or the host stops it or its
32
+ process exits, and the host then sends \`runtime.removed\`. Every start and restart creates
33
+ a new runtime with a new id. Results carry their producer's runtime
34
+ id so clients can tell which are live.
35
+ `),Hn=RegExp(`^[!-~]+$`),Un=RegExp(`^[a-z0-9-]+$`),Wn=x({id:An,notebook_id:J,identity:b().min(1).max(128).regex(Hn).optional().describe(`The opaque client identity supplied by \`Marimo-Attachment-Identity\`.
36
+ Omitted when none was supplied. Consumers can group attachments
37
+ with the same identity within a host. It does not identify an
38
+ individual connection or change its lifetime.
39
+ `),kind:b().regex(Un).describe("What kind of thing is attached, supplied by `Marimo-Attachment-Kind`, such as `browser`, `editor`, or `agent`. Defaults to `client` when the header is omitted. Clients accept kinds they do not recognize."),name:b().max(256).nullable().describe("A label to show people, supplied by `Marimo-Attachment-Name`, such as the browser or editor's name. Null when the header is omitted or empty."),since:W({offset:!0}).describe(`When it attached.`)}).describe(`An attachment is a consumer connected to a notebook, such as a
40
+ browser tab, an editor, or an agent. Opening the notebook's stream
41
+ creates one. It is removed when that connection closes, and not
42
+ when the notebook's runtime stops or restarts. Each stream has its
43
+ own attachment, even when several share a client identity.
44
+ `),Gn=E([`queued`,`running`,`completed`]).describe("Where a run or execution is in its lifecycle. An execution is\n`queued` until it starts, `running` while code executes, and\n`completed` once it has ended. How it ended is its `outcome`.\n"),Kn=E([`succeeded`,`failed`,`interrupted`]).describe("How a run ended. `succeeded` means its work settled without an\nexecution error or interruption. `failed` means an execution\nfailed or the host could not finish the cycle. `interrupted`\nmeans the cycle was cut short by interruption, even if an earlier\nexecution failed. Execution outcomes retain their individual results.\n"),qn=x({id:jn,notebook_id:J,caused_by:S([Y,w()]).describe(`The execution that caused this runtime-scheduled run. This records provenance, not membership in that execution's run, and does not extend the earlier run's lifetime. Null for a client request or when the runtime does not know the source.`),status:Gn.describe(`Queued until the first execution starts, running until the cycle has settled or been terminated, and completed once all member executions are terminal and no more can be scheduled in this run. A run can complete with no executions.`),outcome:S([Kn,w()]).describe(`Null until completed, then final. Published with the terminal status and completed_at. An execution failure does not complete a run while other work remains. Interruption must have taken effect, not merely been requested.`),started_at:W({offset:!0}).nullable().describe(`When the first execution started. Null if none has started.`),completed_at:W({offset:!0}).nullable().describe("When the run ended. Null until the run is `completed`.")}).describe(`One bounded cycle of notebook work initiated by an action. It
45
+ includes synchronous callbacks and reactive work owned and awaited
46
+ by the runtime's scheduler. Context inherited by an independent task
47
+ records provenance, not ownership of the cycle. The host completes it
48
+ only after all member executions have ended and scheduling for the
49
+ cycle has finished. It never reopens or acquires new executions.
50
+ Independently triggered later work starts another run, even when
51
+ its cause belongs to an earlier run. Every consumer attached to
52
+ the notebook sees it.
53
+
54
+ Retention is up to the host and independent of replay history.
55
+ Hosts SHOULD retain ephemeral results briefly after completion to
56
+ allow reconnection. Runs, executions, and items each have removal
57
+ events; a cell result may outlive its run.
58
+ `),Jn=x({mimetype:b().describe("The format of `data`, such as `text/html` or `image/png`."),data:b().describe(`The rendered value. JSON mimetypes are encoded as text; binary mimetypes are base64. Never a URL only the runtime can serve.`)}).describe(`A rendered value.`),Yn=x({execution:Y.describe("The execution whose evaluation produced the value. Usually the variable's `execution_id`, and earlier when the runtime carried the value forward."),update:v().min(0).describe(`How many times the value has been updated since it was produced. Zero at binding.`)}).describe("A variable's value at a point in time. Two revisions are equal\nwhen `execution` and `update` are equal. Clients compare\nrevisions for equality.\n"),Xn=x({id:Mn,execution_id:Y.describe(`The execution that bound the name.`),name:b().describe(`The name in the namespace.`),revision:Yn,type:b().nullable().describe(`The runtime's label for the value's type. A host may leave it null.`),preview:b().nullable().describe(`A short rendering of the value. A host may leave it null.`)}).describe(`A name a cell's execution bound in the notebook's namespace, with
59
+ the revision of its value. The execution binds it as it ends, and
60
+ the item is removed with the execution. An update, as when a
61
+ state setter runs or a client sets a value, advances the revision
62
+ without binding again, and the producer sends the item again with
63
+ the same id. Hosts publish a cell execution's variables before its
64
+ \`completed\` status, and remove a cell's previous execution and
65
+ its items before publishing the next one. A scratch execution's
66
+ names live only while it runs, so it publishes no variables.
67
+ `),Zn=x({line:v().min(0).describe(`Zero-based line within the code.`),character:v().min(0).describe(`Zero-based offset in the line, in UTF-16 code units.`)}).describe(`A position within code, using LSP coordinates.`),Qn=x({start:Zn,end:Zn.describe(`Exclusive end. Equal to start when only a point is known.`)}).describe(`A span within code.`),$n=x({cell_id:X,range:S([Qn,w()]).describe(`Where in that cell, when known.`),message:b().describe("What that cell contributes, such as `reads x from C`.")}).describe(`A cell involved in an error, possibly the one carrying it.`),er=x({kind:b().describe("The producer's identifier, scoped by source. Open; this protocol defines `exception`, `interrupted`, and `internal` for executions. Clients show unrecognized kinds as plain errors."),message:b().describe(`A description of the error to show people.`),source:b().nullable().describe("Who produced it, such as `marimo` or a SQL analyzer. Scopes kind."),severity:E([`error`,`warning`,`information`,`hint`]).describe(`Error unless the producer says otherwise. Only error affects scheduling.`),range:S([Qn,w()]).describe(`Where in the code, when known.`),name:b().nullable().describe("The exception class, such as `ZeroDivisionError`. Set when kind is exception, null otherwise."),traceback:S([Jn,w()]).describe(`The traceback as rendered by the runtime, plain text or HTML by its mimetype. Null when unavailable or not shown.`),related:C($n).describe(`Every involved cell, including this one, in canonical order. Each copy of a cross-cell error carries the same list; clients deduplicate on kind and related cell ids. Empty when the error involves this code alone.`)}).describe(`A problem shaped like an LSP diagnostic. Further members are
68
+ kind-specific, as in Problem Details, and a client ignores
69
+ members it does not know.
70
+ `),tr=x({kind:E([`value`]),display:S([Jn,w()]).describe(`The value as last rendered. Replaced as it grows. Null when the code produced no value.`)}),nr=x({kind:E([`error`]),error:er}),rr=x({kind:E([`interrupted`])}),ir=S([tr,nr,rr]).describe("How an execution ended, tagged on `kind`. A `value` carries the\nexecution's value as last rendered; while the execution is\nrunning it is the value so far, and it is final once the\nexecution is `completed`. An `error` carries the error that ended it.\nAn `interrupted` execution was cancelled before or during execution. Other\nkinds are defined by later versions of this protocol.\n"),Z=b().describe(`An identifier derived from content, so that every host, kernel,
71
+ and store computes the same value for the same state. It is the
72
+ first 16 hexadecimal characters, in lower case, of SHA-256 over
73
+ the UTF-8 encoding of a canonical text. Each etag says what its
74
+ text is; a text made of several values is those values joined by
75
+ newlines. Clients do not compute etags. They read them from the
76
+ stream and from responses, and send them back as preconditions.
77
+ `),ar=x({id:Y,run_id:S([jn,w()]).describe(`The run that owns this execution. Every live execution belongs to exactly one run. May name a run the host has dropped. Null only for a restored result whose run is unknown.`),runtime_id:S([kn,w()]).describe(`The runtime that produced this execution. Live when it equals the current runtime's id. Null when the producer is unknown.`),caused_by:S([Y,w()]).describe(`The execution in the same run that caused this one. Null for executions requested directly.`),cell_id:S([X,w()]).describe(`The cell this execution belongs to. Null for scratch code, a cell outside the document.`),code:b().nullable().describe(`The submitted code for an execution with no cell. Null for a cell's execution; its source is available through the cell when the host exposes it.`),code_hash:Z.describe("The `code_hash` of the code that was evaluated, computed as a cell's is."),depends_on:y(b(),S([Yn,w()])).describe(`The variables the execution used, by name, each at the revision the runtime holds its result valid against. Null for a name no retained cell execution had bound. Empty while queued, stamped as the execution ends, and final from then on.`),status:Gn,outcome:S([ir,w()]).describe(`How the execution ended. Null while queued; while running, a value carries the display so far; final once completed.`),started_at:W({offset:!0}).nullable().describe(`When the code started executing. Null while queued and for an execution that never ran.`),completed_at:W({offset:!0}).nullable().describe(`When the execution ended. Null until it is completed.`)}).describe("One cell evaluated within a run, or scratch code evaluated once.\nIt moves through `queued`, `running`, and `completed`, and ends with\none outcome. Side effects belong to the execution whose context\nproduced them; items can arrive after the execution is completed\nwhile it remains retained.\n"),or=x({id:Mn,execution_id:Y,seq:v().min(0).describe(`Position among the execution's items, increasing in the order they were produced.`),name:E([`stdout`,`stderr`]).describe(`Which stream the text went to.`),text:b().describe(`The text, exactly as written.`)}).describe(`Text an execution wrote to stdout or stderr. Items are ordinary
78
+ objects: a producer replaces one by sending it again with the
79
+ same id, and items are removed with their execution.
80
+ `),sr=x({id:Mn,execution_id:Y,seq:v().min(0).describe(`Position among the execution's items, increasing in the order they were produced.`),mimetype:b().describe("The format of `data`, such as `image/png`."),data:b().describe(`The rendered value. JSON mimetypes are encoded as text; binary mimetypes are base64. Never a URL only the runtime can serve.`)}).describe(`A value an execution showed as a side effect, such as a figure
81
+ from \`plt.show()\`. A producer replaces one by sending it again
82
+ with the same id, which is how a progress bar updates in place.
83
+ `),cr=x({column:v().nullable().describe(`The column the cell sits in, for multi-column layouts. Null in a single column.`),disabled:_().describe(`Whether the cell is kept from running.`),hide_code:_().describe("Whether clients hide the code by default. This is a presentation preference; source availability is represented by `Cell.code`."),expand_output:_().describe(`Whether clients show the full output rather than a scrolled box.`)}).describe(`How a cell is laid out and whether it runs. Every field is always present, so a cell's etag is well defined.`),lr=x({id:X,notebook_id:J,code:b().nullable().describe(`The cell's source code, with newline line endings, or null when the host does not expose source to this client. An empty string is an empty cell. A host normalizes other line endings when it loads a file. Source availability does not grant editing permission; see the notebook's operations.`),name:b().describe("The cell's name. `_` for an anonymous cell; otherwise a Python identifier, unique within the notebook."),config:cr,etag:Z.describe("Identifies code, name, and config together, and is the precondition for editing the cell. Its text is `code_hash`, `name`, and the config values `column`, `disabled`, `hide_code`, and `expand_output` in that order, each written as a JSON scalar such as `null`, `0`, or `true`."),code_hash:Z.describe("Identifies the code alone. Its text is the actual source, even when `code` is null. Withholding source does not change this hash, the cell or document etags, or their versions. Unchanged by renaming the cell or editing its config. Compare with an execution's `code_hash` to tell whether a result came from the current code without needing the source."),version:v().min(1).describe(`The document version at which the cell was created or last changed.`)}).describe(`A unit of code and configuration in the document. A cell event
84
+ fires when its code, name, or config changes. Markdown and SQL
85
+ cells are code that calls \`mo.md\` or \`mo.sql\`; a client chooses
86
+ the editor to show.
87
+ `),ur=x({notebook_id:J.describe(`The notebook this document belongs to.`),order:C(X).describe(`Cell ids in display order. A permutation of the notebook's cells, each appearing exactly once.`),app_config:y(b(),D()).describe("Notebook-level settings, the keyword arguments to `marimo.App` such as `width` and `app_title`. Informational for now; no change sets it over this protocol."),etag:Z.describe("Identifies the document as currently applied. Its text is `order_etag`, `app_config_etag`, and every cell's `etag` in order, so it changes when any of them does."),saved_etag:S([Z,w()]).describe("Identifies the document as last written to the host's store, computed the same way over that state. Equal to `etag` when every accepted change has been persisted. Null when nothing has been persisted, which is the case for a scratch copy."),order_etag:Z.describe(`Identifies the order alone. Its text is the cell IDs in order as a JSON array, with no whitespace and strings carrying only the escapes JSON requires. Editing a cell does not change it.`),app_config_etag:Z.describe(`Identifies the app config alone. Its text is the app config as canonical JSON, with keys sorted by code point, no whitespace, and strings carrying only the escapes JSON requires.`),version:v().min(1).describe(`Counts changes to the cells, the order, or the app config. A save does not advance it. Comparable only within one notebook while it is in the catalog.`)}).describe(`The document as a whole, without its cells, which are their own
88
+ objects: the cell order and app config. One per notebook,
89
+ and removed with it. The order and the app
90
+ config carry their own etags, so an edit to one does not conflict
91
+ with an edit to the other, or with edits to cells.
92
+ `),dr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),host:In}).describe("The data of a `host` event. The host object, plus which request caused the event and when."),fr=x({event:E([`host`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:dr}).describe("A `host` event from a host stream."),pr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),project:Rn}).describe("The data of a `project` event. The project as it now is."),mr=x({event:E([`project`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:pr}).describe("A `project` event from a host stream."),hr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),notebook:zn}).describe("The data of a `notebook` event. The notebook as it now is."),gr=x({event:E([`notebook`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:hr}).describe("A `notebook` event from a host stream."),_r=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),document:ur}).describe("The data of a `document` event. The document as it now is."),vr=x({event:E([`document`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:_r}).describe("A `document` event from a host stream."),yr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),cell:lr}).describe("The data of a `cell` event. The cell as it now is."),br=x({event:E([`cell`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:yr}).describe("A `cell` event from a host stream."),xr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),runtime:Vn}).describe("The data of a `runtime` event. The runtime as it now is."),Sr=x({event:E([`runtime`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:xr}).describe("A `runtime` event from a host stream."),Cr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),attachment:Wn}).describe("The data of an `attachment` event. The attachment as it now is."),wr=x({event:E([`attachment`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Cr}).describe("A `attachment` event from a host stream."),Tr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),run:qn}).describe("The data of a `run` event. The run as it now is."),Er=x({event:E([`run`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Tr}).describe("A `run` event from a host stream."),Dr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),execution:ar}).describe("The data of an `execution` event. The execution as it now is."),Or=x({event:E([`execution`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Dr}).describe("A `execution` event from a host stream."),kr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),console:or}).describe("The data of a `console` event. The item as it now is."),Ar=x({event:E([`console`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:kr}).describe("A `console` event from a host stream."),jr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),display:sr}).describe("The data of a `display` event. The item as it now is."),Mr=x({event:E([`display`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:jr}).describe("A `display` event from a host stream."),Nr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),variable:Xn}).describe("The data of a `variable` event. The item as it now is."),Pr=x({event:E([`variable`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Nr}).describe("A `variable` event from a host stream."),Fr=x({custom:Fn,request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).describe(`When the host emitted this event. Preserved on replay.`)}).describe("The data of a `custom` event. This envelope is standardized; the custom type and payload are defined by their producer."),Ir=x({event:E([`custom`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Fr}).describe("A `custom` event from a host stream."),Q=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),id:b().describe(`The id of the object that was removed.`)}).describe("The data of a `project.removed`, `notebook.removed`,\n`cell.removed`, `runtime.removed`, `attachment.removed`,\n`run.removed`, `execution.removed`, `console.removed`,\n`display.removed`, or `variable.removed` event. The client deletes the object with this\nid; the event name says which kind it is. Removing a notebook\nremoves its document and cells with it, without events of their\nown; the document never has one.\n"),Lr=x({event:E([`project.removed`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Q}).describe("A `project.removed` event from a host stream."),Rr=x({event:E([`notebook.removed`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Q}).describe("A `notebook.removed` event from a host stream."),zr=x({event:E([`cell.removed`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Q}).describe("A `cell.removed` event from a host stream."),Br=x({event:E([`runtime.removed`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Q}).describe("A `runtime.removed` event from a host stream."),Vr=x({event:E([`attachment.removed`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Q}).describe("A `attachment.removed` event from a host stream."),Hr=x({event:E([`run.removed`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Q}).describe("A `run.removed` event from a host stream."),Ur=x({event:E([`execution.removed`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Q}).describe("A `execution.removed` event from a host stream."),Wr=x({event:E([`console.removed`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Q}).describe("A `console.removed` event from a host stream."),Gr=x({event:E([`display.removed`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Q}).describe("A `display.removed` event from a host stream."),Kr=x({event:E([`variable.removed`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Q}).describe("A `variable.removed` event from a host stream."),qr=x({event:E([`reset`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:x({})}).describe("A `reset` event from a host stream."),Jr=x({event:E([`ready`]),id:b().min(1).describe(`The resume cursor. Omitted on snapshot and reset events.`),data:x({})}).describe("A `ready` event from a host stream."),Yr=x({defs:C(b()).describe(`Names this cell defines.`),refs:C(b()).describe(`Names this cell reads from other cells.`),errors:C(er).describe("Diagnostics about the code. Only an `error` affects scheduling. `multiple-definitions` lists the definers in `related`, each `range` at its definition; `cycle-dependencies` lists the cycle. Both are reported on every cell involved, differing only in `range`. Every other kind belongs to the analyzer named in `source`.")}).describe(`Experimental (analysis). What a cell's text implies: the names it defines and reads, which
93
+ are the edges of the dependency graph, and the errors found in the
94
+ text alone or across the set of cells. A pure function of the
95
+ code, so two producers compute the same values.
96
+ `),Xr=x({notebook_id:J.describe(`The notebook this analysis belongs to.`),document_etag:Z.describe("The document revision this analysis describes. Equal to the document's `etag` while the analysis is current."),cells:y(b(),Yr).describe(`Every cell of that revision, by id.`)}).describe(`Experimental (analysis). What a document's cells imply, computed together over one
97
+ revision of the document so that cross-cell errors agree. One
98
+ per notebook, and removed with it. It follows the document it
99
+ describes, and \`document_etag\` says which revision that is.
100
+ `),Zr=x({request_id:b().optional().describe("The `Idempotency-Key` of the request that caused this event. Omitted when no request did, and on snapshots unless that request's work is still in progress."),time:W({offset:!0}).optional().describe(`When the host made this change. Present on live and replayed events; omitted on snapshots.`),analysis:Xr}).describe("Experimental (analysis). The data of an `analysis` event. The analysis as it now is."),Qr=x({event:E([`analysis`]),id:b().min(1).optional().describe(`The resume cursor. Omitted on snapshot and reset events.`),data:Zr}).describe("Experimental (analysis). A `analysis` event from a host stream."),$r=S([fr,mr,gr,vr,br,Sr,wr,Er,Or,Ar,Mr,Pr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Qr]).describe(`A record, removal, or control message from a host stream.
101
+ The data is decoded JSON. Snapshot records and reset events omit
102
+ the cursor; ready and live events carry it. Unknown event names
103
+ belong to later versions or host extensions.
104
+ `),ei=x({id:b().describe(`Identifies this answer.`),label:b().describe(`Text to show a person.`)}).describe(`One possible answer to a decision.`),ti=x({id:b().describe(`Identifies the question when the client answers it.`),prompt:b().describe(`The question, worded for a person.`),options:C(ei).describe(`The possible answers.`)}).describe("A question the host needs answered before it can carry out a\nrequest. The client answers by repeating the request with\n`decisions` in the body, mapping this `id` to the `id` of an\noption.\n"),ni=x({change:v().min(0).describe("The index of the stale change in the request's `changes`, or of the stale cell in a run's `cells`. `0` for a save with a stale `If-Match`."),cell:S([lr,w()]).describe(`The cell the change named, as it now is. Null when the document does not have it, or when the change named the order.`),document:ur}).describe(`The first stale change of an edit or run, and the state the host holds.`),ri=x({type:b().describe("What kind of problem this is, as a URI. The kinds this\nprotocol defines all start with `tag:marimo.io,2026:host/` and\nend with one of `invalid-request` (400), `unauthorized` (401),\n`forbidden` (403), `not-found` (404), `method-not-allowed`\n(405), `not-acceptable` (406), `conflict` (409), `no-runtime`\n(409), `decision-required` (409), `internal` (500), or\n`unsupported-operation` (501). A client that sees a kind it\ndoes not recognize falls back to `status`.\n"),title:b().describe(`A short, human-readable name for the kind of problem.`),status:v().min(400).max(599).describe(`The HTTP status code of the response.`),detail:b().optional().describe(`A human-readable explanation of what went wrong this time.`),decisions:C(ti).optional().describe("The choices the client has to make before the host can carry out the request. Only present for `decision-required`."),edit:ni.optional().describe("Which change was stale and what the host holds instead. Only present for a `conflict` answering an edit, a save, or a run of cells.")}).describe("An error. Every error response has this one shape, following RFC\n9457, and is served as `application/problem+json`. `status`\nrepeats the HTTP status, and `type` says more precisely what went\nwrong. `decisions` appears only when `type` is\n`tag:marimo.io,2026:host/decision-required`. A client ignores\nmembers it does not recognize. An error never contains a token.\n");x({project_id:On,path:b().optional().describe(`Where to put the file, relative to the project root and written the way the host's operating system writes paths.`),name:b().optional().describe(`A label to show people. In a project with a root it defaults to the filename.`)}).describe("The notebook's own fields, minus what the host assigns. A project with a root requires `path`; one without requires `name`."),x({path:b().optional().describe(`The new location, relative to the project root and written the way the host's operating system writes paths.`),name:b().optional().describe(`The new label to show people.`)}).describe(`The fields to change. At least one is present.`),x({url:b().describe(`The URL the host used to show the notebook. It never contains the host's token.`)}),x({decisions:y(b(),b()).optional().describe("Answers to the questions in a `decision-required` problem.\nEach key is a decision's `id` and each value is the `id` of\nthe chosen option. A client that already knows its choices can\nsend them the first time.\n")});var ii=x({column:v().nullish().default(null),disabled:_().default(!1),hide_code:_().default(!1),expand_output:_().default(!1)}).describe(`A cell's settings as a client writes them. A field left out takes its default.`),ai=x({id:X.describe(`The cell's id. A client chooses the id of a cell it creates.`),code:b().describe(`The cell's source code.`),name:b().default(`_`).describe("The cell's name. `_` for an anonymous cell."),config:ii.optional()}).describe(`A cell as a client writes it. Code must be a string, even when the host withholds source in cell records. Null is not an edit or a request to preserve existing source. The host derives the etags.`),oi=x({kind:E([`put_cell`]),base_etag:b().nullable().describe("The cell's etag as last read, `*` to skip the check, or null to create the cell. Null when the cell exists, or an etag when it does not, is a `conflict`."),cell:ai,after:X.optional().describe(`The cell a created cell goes after. Ignored for an existing cell.`),before:X.optional().describe("The cell a created cell goes before. Ignored for an existing cell. With neither `after` nor `before`, a created cell goes at the end.")}).describe(`Replaces a whole cell, or creates one.`),si=x({kind:E([`delete_cell`]),id:X.describe(`The cell to remove.`),base_etag:b().describe("The cell's etag as last read, or `*`.")}).describe(`Removes a cell.`),ci=x({kind:E([`set_order`]),base_etag:b().describe("The document's `order_etag` as last read, or `*`."),order:C(X).describe(`Every cell id exactly once, in the new order, counting cells this edit creates and leaving out cells it deletes.`)}).describe(`Replaces the cell order.`),li=S([oi,si,ci]).describe("One change to the document, tagged on `kind`.");x({changes:C(li).describe(`The changes, applied in order as one unit.`)});var ui=x({etag:Z,code_hash:Z,version:v().min(1).describe(`The cell's version after the edit.`)}).describe(`A cell's etags and version after an edit.`);x({document:ur,cells:y(b(),S([ui,w()])).describe(`The version of each cell the request created or changed, by id, and null for each cell it deleted.`)}).describe(`The document as an edit or save left it, or at a later revision, and the cells it touched.`),x({decisions:y(b(),b()).optional().describe("Answers to the questions in a `decision-required` problem, as for `runtime.start`.")}).describe("What a save needs from the client, which is nothing until the host asks a question. `{}` is the usual body.");var di=x({id:X,code_hash:Z.optional().describe("The cell's `code_hash` as last read. A cell whose code differs is a `conflict`. Absent, the cell runs as it is.")});x({code:b().optional().describe(`Python code to run as scratch code.`),cells:C(di).min(1).optional().describe(`Cells of the document to run, in no particular order. The runtime's execution configuration determines whether dependent cells run too.`)}).describe("What to run, exactly one of `code` and `cells`.");var fi=Pn.options.filter(e=>e!==`host`&&e!==`project`),$=class extends Error{name=`StreamStopped`};function pi(e,t){return e?.split(`;`,1)[0].trim().toLowerCase()===t}var mi=45e3,hi=class extends TransformStream{constructor(e=JSON.parse){let t=``,n=``,r=[],i,a=t=>{if(r.length>0){let a=r.join(`
105
+ `),o=a;try{o=e(a)}catch{}t.enqueue({event:n||`message`,data:o,...i===void 0?{}:{id:i}})}n=``,r=[],i=void 0};super({transform(e,o){t+=e;let s=t.endsWith(`\r`)?`\r`:``,c=t.slice(0,t.length-s.length).split(/\r\n|\r|\n/);t=(c.pop()??``)+s;for(let e of c){if(e===``){a(o);continue}if(e.startsWith(`:`))continue;let t=e.indexOf(`:`),s=t===-1?e:e.slice(0,t),c=t===-1?``:e.slice(t+1);c.startsWith(` `)&&(c=c.slice(1)),s===`event`?n=c:s===`data`?r.push(c):s===`id`&&!c.includes(`\0`)&&(i=c)}}})}},gi=new Set([408,429]);function _i(e,t={}){return async({cursor:n,signal:r},{open:i,message:a})=>{let o=new Headers;o.set(`Accept`,`text/event-stream`),t.token!==void 0&&o.set(`Authorization`,`Bearer ${t.token}`),n!==null&&o.set(`Last-Event-ID`,n);let s=new AbortController,c=()=>s.abort();r.addEventListener(`abort`,c,{once:!0});let l,u,d=()=>{clearTimeout(l),l=setTimeout(c,mi)};try{let n=new URL(typeof e==`function`?await e():e),r=t.fetch??globalThis.fetch;d();let c=await r(n,{headers:o,signal:s.signal}),{status:l}=c;if(l>=400&&l<500&&!gi.has(l)){let e=ri.safeParse(await c.json().catch(()=>void 0));throw new $(`The host refused the stream (${l})`,{cause:e.success?e.data:void 0})}if(!c.ok||c.body===null){await c.body?.cancel();return}if(!pi(c.headers.get(`Content-Type`),`text/event-stream`))throw await c.body.cancel(),new $(`The host did not answer with an event stream`);i();let f=new TransformStream({transform(e,t){d(),t.enqueue(e)}}),p=c.body.pipeThrough(f).pipeThrough(new TextDecoderStream).pipeThrough(new hi(t.parseData)).getReader();for(s.signal.addEventListener(`abort`,()=>void p.cancel(),{once:!0});;){let{done:e,value:n}=await p.read();if(e)return;if(u=t.stop?.(n),u!==void 0)throw u;a(n)}}catch(e){if(e instanceof $||e===u)throw e}finally{clearTimeout(l),r.removeEventListener(`abort`,c)}}}var vi=new Set($r.options.flatMap(e=>e.shape.event.options)),yi=x({event:b().min(1),data:D(),id:b().optional()});function bi(e){queueMicrotask(()=>{throw e})}var xi=class{#e;#t=!1;#n;#r=new Set;constructor(e,t){this.#e=e.cursor??null,this.#n=new Set([`ready`,`reset`,...(e.types??t).flatMap(e=>{let t=`${e}.removed`;return vi.has(t)?[e,t]:[e]})])}get cursor(){return this.#e}subscribe(e){return this.#r.add(e),()=>this.#r.delete(e)}resume(){return this.#e===null&&this.#t&&this.#i({event:`reset`,data:{}}),this.#e}receive(e){let t=yi.safeParse(e);if(!t.success)throw new $(`The host sent a message that is not an event`,{cause:t.error});this.#i(t.data)}#i(e){let t;if(vi.has(e.event)){let n=$r.safeParse(e);if(!n.success)throw new $(`The host sent an invalid ${e.event} event`,{cause:n.error});t=n.data}else t=e;if(e.id!==void 0&&(this.#e=e.id),t.event===`reset`?(this.#e=null,this.#t=!1):this.#e===null&&(this.#t=!0),this.#n.has(t.event))for(let e of this.#r)try{e(t)}catch(e){bi(e)}}},Si=10,Ci=5e3;function wi(e){return Math.min(1e3*1.5**(e-1),15e3)*(.75+Math.random()/2)}function Ti(e,t){return new Promise(n=>{let r=setTimeout(i,e);t.addEventListener(`abort`,i,{once:!0});function i(){clearTimeout(r),t.removeEventListener(`abort`,i),n()}})}var Ei=class{closed;#e;#t=`connecting`;#n=new AbortController;#r;#i;#a;#o=new Set;constructor(e,t,n){let r;if(typeof e==`function`)r=e;else{let n=new URL(e);t.types!==void 0&&n.searchParams.set(`types`,t.types.join(`,`)),r=_i(n,t)}if(this.#e=new xi({types:t.types,cursor:t.cursor},n),this.#r=t.onStatus,this.closed=new Promise((e,t)=>{this.#i={resolve:e,reject:t}}),this.closed.catch(()=>void 0),t.signal?.aborted){this.close();return}let i=t.signal;if(i!==void 0){let e=()=>this.close();i.addEventListener(`abort`,e,{once:!0}),this.#a=()=>i.removeEventListener(`abort`,e)}this.#s(r)}get status(){return this.#t}get cursor(){return this.#e.cursor}subscribe(e,t){let n=!0,r=this.#e.subscribe(t=>{n&&e(t)}),i=e=>{n&&t?.(e)};return t!==void 0&&this.#i!==void 0&&this.#o.add(i),()=>{n=!1,this.#o.delete(i),r()}}close(){this.#l()?.resolve()}[Symbol.asyncIterator](){let e=[],t=[],n=()=>t.splice(0).forEach(e=>e()),r,i=this.subscribe(t=>{e.push(t),n()});this.closed.then(()=>{r={},n()},e=>{r={error:e},n()});let a=()=>(i(),this.close(),{done:!0,value:void 0});return{next:async()=>{for(;;){let n=e.shift();if(n!==void 0)return{done:!1,value:n};if(r!==void 0){if(r.error!==void 0)throw i(),r.error;return a()}await new Promise(e=>t.push(e))}},return:async()=>a()}}async#s(e){await Promise.resolve();let{signal:t}=this.#n,n=0;for(;!t.aborted;){let r=!0,i=!1,a;try{await e({cursor:this.#e.resume(),signal:t},{open:()=>{r&&this.#i!==void 0&&this.#c(`connected`)},message:e=>{if(!(!r||this.#i===void 0)){a??=setTimeout(()=>{i=!0},Ci);try{this.#e.receive(e)}catch(e){this.#l()?.reject(e)}}}})}catch(e){this.#l()?.reject(e);return}finally{r=!1,clearTimeout(a)}if(t.aborted)return;if(this.#c(`connecting`),n=i?1:n+1,n>Si){this.#l()?.reject(new $(`The host could not be reached`));return}await Ti(wi(n),t)}}#c(e){if(this.#t!==e){this.#t=e;try{this.#r?.(e)}catch(e){bi(e)}}}#l(){let e=this.#i;if(e===void 0)return;this.#i=void 0;let t=[...this.#o];return this.#o.clear(),this.#a?.(),this.#n.abort(),this.#c(`closed`),{resolve:e.resolve,reject:n=>{e.reject(n);for(let e of t)try{e(n)}catch(e){bi(e)}}}}},Di=class extends Ei{constructor(e,t={}){typeof e!=`function`&&t.runId!==void 0&&(e=new URL(e),e.searchParams.set(`run_id`,t.runId)),super(e,t,fi)}};function Oi(e){let t=Object.keys(e);return{initial:Object.fromEntries(t.map(t=>[t,e[t].initial])),reduce(n,r,i){let a=n;for(let n of t){let t=e[n].on[r.event];if(t===void 0)continue;let o=a[n],s=t(o,r,i);s!==o&&(a={...a,[n]:s})}return a}}}function ki(e){switch(e.event){case`document`:return e.data.document.notebook_id;case`cell`:return e.data.cell.notebook_id;case`analysis`:return e.data.analysis.notebook_id;case`runtime`:return e.data.runtime.notebook_id;case`attachment`:return e.data.attachment.notebook_id;case`run`:return e.data.run.notebook_id;default:return}}function Ai(e){let t=Oi(e),n=t.initial,r={phase:`snapshot`,notebookId:null,notebook:null,resources:n};function i(e,t){if(e.notebookId===t)return e;if(e.notebookId!==null)throw Error(`Notebook stream changed identity`);return{...e,notebookId:t}}function a(e){return e.resources===n&&e.notebook===null?e:{...e,notebook:null,resources:n}}function o(e,n){let r=t.reduce(e.resources,n,{phase:e.phase});return r===e.resources?e:{...e,resources:r}}return{initial:r,reduce(e,t){switch(t.event){case`reset`:return r;case`ready`:return{...o(e,t),phase:`live`};case`notebook`:return{...i(e,t.data.notebook.id),notebook:t.data.notebook};case`host`:case`project`:case`project.removed`:return e;case`notebook.removed`:return e.notebookId!==null&&t.data.id!==e.notebookId?e:a(e);default:{let n=ki(t);return o(n===void 0?e:i(e,n),t)}}}}}var ji={initial:[],on:{attachment:(e,{data:{attachment:t}})=>e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t],"attachment.removed":(e,{data:t})=>e.some(e=>e.id===t.id)?e.filter(e=>e.id!==t.id):e}};function Mi(e){return e.pending??{revision:e.current?.revision??null,cells:e.current?.cells??new Map}}function Ni(e,t){let n=new Set(e.order);if(n.size!==e.order.length||n.size!==t.size||[...n].some(e=>!t.has(e))||[...t.values()].some(t=>t.version>e.version))throw Error(`Document records do not match its revision and order`);return{current:{revision:e,cells:t},pending:null}}var Pi={initial:{current:null,pending:null},on:{cell:(e,{data:t})=>{let n=Mi(e);return{...e,pending:{revision:n.revision,cells:new Map(n.cells).set(t.cell.id,t.cell)}}},"cell.removed":(e,{data:t})=>{let n=Mi(e);if(!n.cells.has(t.id))return e;let r=new Map(n.cells);return r.delete(t.id),{...e,pending:{...n,cells:r}}},document:(e,{data:t},{phase:n})=>{let{cells:r}=Mi(e);return n===`snapshot`?{...e,pending:{revision:t.document,cells:r}}:Ni(t.document,r)},ready:(e,t,{phase:n})=>{if(e.pending===null)return e;if(n===`live`)throw Error(`Stream ended with an incomplete document update`);return e.pending.revision===null?{current:null,pending:null}:Ni(e.pending.revision,e.pending.cells)}}},Fi=[`notebook`,`cell`,`document`,`attachment`,`marimo`],Ii=x({marimo:D()}),Li={state:N.CLOSED,code:P.KERNEL_DISCONNECTED,reason:`kernel not found`},Ri={...Li,reason:`Failed to decode notebook message`};function zi(e){return typeof e==`object`&&!!e&&`state`in e}function Bi(e){return e instanceof $&&zi(e.cause)?e.cause:e instanceof $&&e.cause instanceof Ce?Ri:Li}function Vi(e){let t=r({state:N.NOT_STARTED}),n=Ai({document:Pi,attachments:ji}),i=r(n.initial),a=r(!1),o=r(e=>e(a)&&e(t).state===N.OPEN),s=r(e=>e(o)?e(i).notebook:null),c=r(e=>e(i).resources.document.current),l=r(e=>e(o)?e(i).resources.attachments:ji.initial),u,d={connectionAtom:t,notebookAtom:s,documentAtom:c,attachmentsAtom:l,reconnect:async()=>u?.()};function f(n){e.set(a,!1),e.set(t,n)}function p({transport:t,signal:r,checkHealth:o,onNotification:s}){if(r.aborted)return;let c,l=!1,d=!0;function p(a){a===void 0&&e.set(i,n.initial),d=!0;let o=new Di(t,{types:Fi,cursor:a,signal:r,onStatus:e=>{e===`connecting`?f({state:N.CONNECTING}):e===`connected`&&f({state:N.OPEN})}});o.subscribe(e=>h(o,e),e=>{if(!r.aborted&&o===c){k.warn(`Notebook stream stopped`,e);let t=Bi(e);t===Ri?m(o):f(t)}}),c=o}function m(t){t.close(),d=!1,e.set(i,n.initial),f(Ri)}function h(t,r){if(r.event===`marimo`){let e=Ii.safeParse(r.data);e.success?s(e.data.marimo):(k.error(`Failed to decode notebook message`,r),m(t));return}try{e.set(i,n.reduce(e.get(i),r))}catch(e){k.error(`Failed to apply notebook event`,e),m(t);return}(r.event===`ready`||r.event===`reset`)&&e.set(a,r.event===`ready`)}u=async()=>{if(!(r.aborted||l||c?.status!==`closed`)){l=!0,f({state:N.CONNECTING});try{let e=await o();if(r.aborted)return;if(!e){f(Li);return}p(d?c.cursor??void 0:void 0)}catch(e){r.aborted||(k.error(`Notebook health check failed`,e),f(Li))}finally{l=!1}}},r.addEventListener(`abort`,()=>{u=void 0,e.set(i,n.initial),f({state:N.NOT_STARTED})},{once:!0}),f({state:N.CONNECTING}),p()}return{client:d,connect:p}}function Hi(e){switch(e.reason){case`MARIMO_NO_FILE_KEY`:case`MARIMO_NO_SESSION_ID`:case`MARIMO_NO_SESSION`:case`MARIMO_SHUTDOWN`:return{kind:`terminal`,status:{state:N.CLOSED,code:P.KERNEL_DISCONNECTED,reason:`kernel not found`}};case`MARIMO_UNAUTHORIZED`:return{kind:`terminal`,status:{state:N.CLOSED,code:P.KERNEL_DISCONNECTED,reason:`not authorized`}};case`MARIMO_KIOSK_NOT_ALLOWED`:return{kind:`terminal`,status:{state:N.CLOSED,code:P.KERNEL_DISCONNECTED,reason:`kiosk mode is not available for this session`}};case`MARIMO_KERNEL_STARTUP_ERROR`:return{kind:`terminal`,status:{state:N.CLOSED,code:P.KERNEL_STARTUP_ERROR,reason:`Failed to start kernel sandbox`}};default:e.reason&&k.warn(`Unrecognized connection close reason`,e.reason)}return{kind:`retry`,status:{state:N.CONNECTING}}}var Ui=1e4;function Wi(e){let t=Hi(e);return t.kind===`retry`?void 0:new $(`reason`in t.status?t.status.reason:``,{cause:t.status})}async function Gi(e){try{return new URL(typeof e==`function`?await e():e)}catch(e){if(e instanceof $)throw e;return}}function Ki(e,t){let n;return async(r,i)=>{let a=await Gi(e);if(a===void 0||r.signal.aborted)return;a.searchParams.delete(`cursor`);let o=new URL(a);o.searchParams.delete(`access_token`),o.searchParams.sort(),o.hash=``;let s=o.toString(),{cursor:c}=r;if(n!==void 0&&n!==s&&(i.message({event:`reset`,data:{}}),c=null),n=s,!r.signal.aborted)return t(a)({...r,cursor:c},i)}}function qi(e){return Ki(e,e=>async({cursor:t,signal:n},{open:r,message:i})=>{t!==null&&e.searchParams.set(`cursor`,t),await new Promise((t,a)=>{let o=new WebSocket(e),s=setTimeout(()=>o.close(),Ui),c=()=>o.close();n.addEventListener(`abort`,c,{once:!0}),o.addEventListener(`open`,()=>{clearTimeout(s),r()}),o.addEventListener(`message`,({data:e})=>i(ie(String(e)))),o.addEventListener(`close`,e=>{clearTimeout(s),n.removeEventListener(`abort`,c);let r=n.aborted?void 0:Wi(e);r===void 0?t():a(r)})})})}function Ji(e,t){return Ki(e,e=>_i(e,{parseData:ie,fetch:(e,n)=>{let r=new Headers(n?.headers);for(let[e,n]of Object.entries(t()))r.set(e,n);return globalThis.fetch(e,{...n,headers:r})},stop:e=>e.event===`close`?Wi(e.data):void 0}))}var Yi=({signal:e},{open:t})=>new Promise(n=>{t(),e.addEventListener(`abort`,()=>n(),{once:!0})});function Xi(e){return({signal:t},{open:n,message:r})=>new Promise(i=>{n(),e(({data:e})=>{if(t.aborted)return;let n=ie(e);r(typeof n==`object`&&n&&!(`event`in n)&&`data`in n?{event:`marimo`,data:{marimo:n.data}}:n)}),t.addEventListener(`abort`,()=>i(),{once:!0})})}function Zi(e){return e.static?Yi:Be()?Xi(e=>O.INSTANCE.attachMessageConsumer(e)):e.transportType===`sse`?Ji(e.url,e.headers):qi(e.url)}function Qi(e){let t=(0,K.c)(13),r=n(),{static:i,transportType:a}=e,s;t[0]===r?s=t[1]:(s=Vi(r),t[0]=r,t[1]=s);let c=s,l=o(e.url),u=o(e.headers),d=o(e.waitUntilReady),f=o(e.checkHealth),p=o(e.onNotification),m,h;return t[2]!==f||t[3]!==c||t[4]!==u||t[5]!==i||t[6]!==p||t[7]!==r||t[8]!==a||t[9]!==l||t[10]!==d?(m=()=>{let e=new AbortController,t=!0;return r.set(yt,c.client),c.connect({transport:Zi({static:i,transportType:a,url:async()=>{if(t){t=!1;try{await d()}catch(e){throw new $(`Healthy connection never made`,{cause:e})}}return l()},headers:u}),signal:e.signal,checkHealth:f,onNotification:e=>p({data:e})}),()=>{e.abort(),r.get(yt)===c.client&&r.set(yt,null)}},h=[c,r,i,a,l,u,d,f,p],t[2]=f,t[3]=c,t[4]=u,t[5]=i,t[6]=p,t[7]=r,t[8]=a,t[9]=l,t[10]=d,t[11]=m,t[12]=h):(m=t[11],h=t[12]),(0,G.useEffect)(m,h),c.client}function $i(e){let{codes:t,names:n,configs:r,cell_ids:i,last_executed_code:a,last_execution_time:o}=e,s=a||{},c=o||{};return t.map((e,t)=>{let a=i[t],o=s[a];return oe({id:a,code:e,edited:o?o!==e:!1,name:n[t],lastCodeRun:s[a]??null,lastExecutionTime:c[a]??null,config:r[t]})})}function ea(e,t,n){let{layout:r}=e,i=dt(r,t);return r&&r.type===i.selectedLayout&&n({layoutView:i.selectedLayout,data:i.layoutData[i.selectedLayout]}),i}function ta(){let e=[],t=[];return je.entries.forEach((n,r)=>{e.push(r),t.push(n.value)}),{objectIds:e,values:t}}function na(e,t){let{existingCells:n,autoInstantiate:r,setCells:i,setLayoutData:a,setAppConfig:o,setCapabilities:s,setKernelState:c,onError:l}=t,{resumed:u,ui_values:d,app_config:f,capabilities:p,auto_instantiated:m}=e,h=n&&n.length>0,g=h&&!u?n:$i(e);i(g,ea(e,g,a));let ee=Te.safeParse(f);if(ee.success?o(ee.data):k.error(`Failed to parse app config`,ee.error),s(p),m)return;if(u){for(let[e,t]of j.entries(d||{})){let n=e;je.set(n,t)}return}let{objectIds:te,values:ne}=ta(),re=h?Object.fromEntries(n.map(e=>[e.id,e.code])):void 0;St().sendInstantiate({objectIds:te,values:ne,autoRun:r,codes:re}).then(()=>{c({isInstantiated:!0,error:null})}).catch(e=>{c({isInstantiated:!1,error:e}),l(Error(`Failed to instantiate`,{cause:e}))})}function ra(e){let t=e.cell_id;je.removeElementsByCell(t),lt.INSTANCE.removeForCellId(t)}function ia(e,t){t(e),lt.INSTANCE.track(e)}var aa={append:e=>{let t=new URL(window.location.href);t.searchParams.append(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},set:e=>{let t=new URL(window.location.href);Array.isArray(e.value)?(t.searchParams.delete(e.key),e.value.forEach(n=>t.searchParams.append(e.key,n))):t.searchParams.set(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},delete:e=>{let t=new URL(window.location.href);e.value==null?t.searchParams.delete(e.key):t.searchParams.delete(e.key,e.value),window.history.pushState({},``,`${t.pathname}${t.search}`)},clear:()=>{let e=new URL(window.location.href);e.search=``,window.history.pushState({},``,`${e.pathname}${e.search}`)}};function oa(){return Object.values(he().cellData).filter(e=>e.id!==se)}function sa(e){let r=(0,K.c)(68),{autoInstantiate:a,sessionId:o,setCells:c}=e,{showBoundary:g}=Ye(),{handleCellMessage:ie}=d(),oe;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(oe={skipMiddleware:!0},r[0]=oe):oe=r[0];let se=d(oe),le;r[1]===se?le=r[2]:(le=e=>{l(e.changes,se,pa)},r[1]=se,r[2]=le);let fe=le,{addCellNotification:me}=Lt(),ge=s(Ke),be=s(Je),_=De(),{setVariables:v,setMetadata:y}=pe(),{addColumnPreview:b}=ue(),{addDatasets:xe,filterDatasetsFromVariables:x}=ue(),{addDataSourceConnection:Se,filterDataSourcesFromVariables:S}=ee(),{setLayoutData:C}=gt(),[Ce,w]=t(Ve),T=s(We),{addBanner:E}=Pt(),{addMissingPackageAlert:D,updateEnvironment:we,setEnvironment:Te,addStartupLog:Ae}=Ft(),O=s(Le),Me=s(Re),Pe=s(h),A=Ue(),j=i(Ee),Fe=s(Nt),M=s(It),{setNamespaces:Ie,filterFromVariables:ze}=ce(),Ge;r[3]!==E||r[4]!==me||r[5]!==b||r[6]!==Se||r[7]!==xe||r[8]!==D||r[9]!==Ae||r[10]!==a||r[11]!==S||r[12]!==x||r[13]!==ze||r[14]!==ie||r[15]!==fe||r[16]!==_||r[17]!==Fe||r[18]!==Pe||r[19]!==c||r[20]!==w||r[21]!==Te||r[22]!==be||r[23]!==M||r[24]!==ge||r[25]!==O||r[26]!==C||r[27]!==y||r[28]!==Me||r[29]!==Ie||r[30]!==v||r[31]!==g||r[32]!==we||r[33]!==T?(Ge=e=>{switch(e.data.op){case`reload`:Dt();return;case`startup-progress`:{let{phase:t}=e.data;T(e.data),w(e=>e.state===N.OPEN||e.state===N.CONNECTING&&e.phase===t?e:{state:N.CONNECTING,phase:t});return}case`kernel-ready`:{M(null),w({state:N.OPEN}),be(!!(e.data.resumed||e.data.auto_instantiated));let t=oa();na(e.data,{autoInstantiate:a,setCells:c,setLayoutData:C,setAppConfig:_,setCapabilities:Pe,setKernelState:ge,onError:g,existingCells:t}),e.data.resumed||ae(),O(e.data.kiosk),Me(e.data.stable_session_id??null),_e(null),ve();return}case`completed-run`:be(!0);return;case`execution`:return;case`interrupted`:return;case`kernel-startup-error`:M(e.data.error);return;case`send-ui-element-message`:{let t=e.data.ui_element;if(t){let n=ft(e.data);je.broadcastMessage(t,e.data.message,n)}return}case`model-lifecycle`:Oe(Ne,e.data);return;case`remove-ui-elements`:ra(e.data);return;case`completion-result`:re.resolve(e.data.completion_id,e.data);return;case`function-call-result`:ke.resolve(e.data.function_call_id,e.data);return;case`cell-op`:{ia(e.data,ie);let t=he().cellData[e.data.cell_id];if(!t)return;me({cellNotification:e.data,code:t.code});return}case`variables`:{let t=e.data.variables.map(fa);v(e.data.variables.map(da)),x(t),S(t),ze(t);return}case`variable-values`:y(e.data.variables.map(ua));return;case`alert`:bt({title:e.data.title,description:Tt({html:e.data.description}),variant:e.data.variant});return;case`banner`:E(e.data);return;case`missing-package-alert`:D({...e.data,kind:`missing`});return;case`environment-operation`:e.data.source===`kernel`&&e.data.status.kind!==`running`&&Et(),we(e.data);return;case`environment-state`:Te(e.data),e.data.source===`kernel`&&Et();return;case`startup-logs`:Ae({content:e.data.content,status:e.data.status});return;case`query-params-append`:aa.append(e.data);return;case`query-params-set`:aa.set(e.data);return;case`query-params-delete`:aa.delete(e.data);return;case`query-params-clear`:aa.clear();return;case`datasets`:xe(e.data);return;case`data-column-preview`:b(e.data);return;case`sql-table-preview`:ne.resolve(e.data.request_id,e.data);return;case`sql-table-list-preview`:ye.resolve(e.data.request_id,e.data);return;case`sql-schema-list-preview`:m.resolve(e.data.request_id,e.data);return;case`validate-sql-result`:te.resolve(e.data.request_id,e.data);return;case`data-source-discovery-result`:de.resolve(e.data.request_id,e.data);return;case`secret-keys-result`:mt.resolve(e.data.request_id,e.data);return;case`cache-info`:Fe(e.data);return;case`cache-cleared`:return;case`data-source-connections`:Se({connections:e.data.connections.map(la)});return;case`storage-namespaces`:Ie(e.data);return;case`storage-entries`:f.resolve(e.data.request_id,e.data);return;case`storage-download-ready`:p.resolve(e.data.request_id,e.data);return;case`reconnected`:M(null),w({state:N.OPEN});return;case`focus-cell`:u(e.data.cell_id);return;case`active-line`:_e(e.data.line==null?null:{cellId:e.data.cell_id,line:e.data.line});return;case`notebook-document-transaction`:fe(e.data.transaction);return;case`consumer-capabilities`:O(!e.data.consumer_capabilities.edit);return;default:xt(e.data)}},r[3]=E,r[4]=me,r[5]=b,r[6]=Se,r[7]=xe,r[8]=D,r[9]=Ae,r[10]=a,r[11]=S,r[12]=x,r[13]=ze,r[14]=ie,r[15]=fe,r[16]=_,r[17]=Fe,r[18]=Pe,r[19]=c,r[20]=w,r[21]=Te,r[22]=be,r[23]=M,r[24]=ge,r[25]=O,r[26]=C,r[27]=y,r[28]=Me,r[29]=Ie,r[30]=v,r[31]=g,r[32]=we,r[33]=T,r[34]=Ge):Ge=r[34];let qe=Ge,F=n(),I=ca,Xe;r[35]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=He(),r[35]=Xe):Xe=r[35];let L;r[36]!==A||r[37]!==o||r[38]!==j?(L=()=>j===`sse`?A.getSseURL(o).toString():A.getWsURL(o).toString(),r[36]=A,r[37]=o,r[38]=j,r[39]=L):L=r[39];let R,z,B;r[40]===A?(R=r[41],z=r[42],B=r[43]):(R=()=>A.headers(),z=async()=>{!He()&&!Be()&&!A.isSameOrigin&&await A.waitForHealthy()},B=()=>A.reconcileFromHealth(),r[40]=A,r[41]=R,r[42]=z,r[43]=B);let V;r[44]===qe?V=r[45]:(V=e=>{try{qe(e)}catch(t){let n=t;k.error(`Failed to handle notification`,e,n),I(n)}},r[44]=qe,r[45]=V);let Ze;r[46]!==L||r[47]!==R||r[48]!==z||r[49]!==B||r[50]!==V||r[51]!==j?(Ze={static:Xe,transportType:j,url:L,headers:R,waitUntilReady:z,checkHealth:B,onNotification:V},r[46]=L,r[47]=R,r[48]=z,r[49]=B,r[50]=V,r[51]=j,r[52]=Ze):Ze=r[52];let H=Qi(Ze),U;r[53]!==H.connectionAtom||r[54]!==w||r[55]!==M||r[56]!==F||r[57]!==T?(U=()=>{let e=()=>{let e=F.get(H.connectionAtom);if(e.state!==N.NOT_STARTED){if(e.state===N.OPEN){T(null);return}e.state===N.CONNECTING&&M(null),w(t=>e.state===N.CLOSED&&e.code===P.KERNEL_STARTUP_ERROR&&(t.state===N.CONNECTING||t.state===N.CLOSED)?{...e,phase:t.phase}:e.state===N.CONNECTING&&(t.state===N.OPEN||t.state===N.CONNECTING&&t.phase===`reconnecting`)?{...e,phase:`reconnecting`}:e)}},t=F.sub(H.connectionAtom,e);return e(),t},r[53]=H.connectionAtom,r[54]=w,r[55]=M,r[56]=F,r[57]=T,r[58]=U):U=r[58];let Qe;r[59]!==H||r[60]!==w||r[61]!==M||r[62]!==F||r[63]!==T?(Qe=[H,F,w,M,T],r[59]=H,r[60]=w,r[61]=M,r[62]=F,r[63]=T,r[64]=Qe):Qe=r[64],(0,G.useLayoutEffect)(U,Qe);let $e;return r[65]!==Ce||r[66]!==H?($e={notebook:H,connection:Ce,reconnect:H.reconnect},r[65]=Ce,r[66]=H,r[67]=$e):$e=r[67],$e}function ca(e){bt({title:`Failed to handle message`,description:Ot(e),variant:`danger`})}function la(e){return{...e,name:e.name}}function ua(e){return{name:e.name,dataType:e.datatype,value:e.value}}function da(e){return{name:e.name,declaredBy:e.declared_by,usedBy:e.used_by}}function fa(e){return e.name}function pa(){return he().cellIds.inOrderIds}var ma=e=>{let t=(0,K.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,q.jsx)(`div`,{"data-testid":`chrome-wrapper`,className:`flex flex-col flex-1 overflow-hidden absolute inset-0 print:relative`,children:n}),t[0]=n,t[1]=r),r};export{wn as a,Tn as i,sa as n,Vt as o,Dn as r,zt as s,ma as t};
@@ -1 +1 @@
1
- import{X as e,Z as t}from"./cells-T9_Y4Jlv.js";import{t as n}from"./strings-C25fhMR_.js";function r(r){return r.mimetype.startsWith(`application/vnd.marimo`)||r.mimetype===`text/html`?t(n.asString(r.data)):e(n.asString(r.data))}export{r as t};
1
+ import{X as e,Z as t}from"./cells-styV7IX8.js";import{t as n}from"./strings-C25fhMR_.js";function r(r){return r.mimetype.startsWith(`application/vnd.marimo`)||r.mimetype===`text/html`?t(n.asString(r.data)):e(n.asString(r.data))}export{r as t};
@@ -1 +1 @@
1
- import{hi as e,mi as t}from"./cells-T9_Y4Jlv.js";var n=new e,r=new t;function i(e){let t=e.trim();return t?n.isSupported(t)?{code:n.transformIn(t).code,language:`markdown`}:r.isSupported(t)?{code:r.transformIn(t).code,language:`sql`}:{code:e,language:`python`}:{code:e,language:`python`}}export{i as t};
1
+ import{hi as e,mi as t}from"./cells-styV7IX8.js";var n=new e,r=new t;function i(e){let t=e.trim();return t?n.isSupported(t)?{code:n.transformIn(t).code,language:`markdown`}:r.isSupported(t)?{code:r.transformIn(t).code,language:`sql`}:{code:e,language:`python`}:{code:e,language:`python`}}export{i as t};