@marimo-team/frontend 0.24.1-dev42 → 0.24.1-dev44

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 (174) hide show
  1. package/dist/assets/{CellStatus-CfNQG_fZ.js → CellStatus-B6CWKORY.js} +1 -1
  2. package/dist/assets/ConnectedDataExplorerComponent-DZnvpjue.js +1 -0
  3. package/dist/assets/JsonOutput-BI2qFHVr.js +50 -0
  4. package/dist/assets/MarimoErrorOutput-BXh29HCp.js +6 -0
  5. package/dist/assets/RenderHTML-COTZYPO7.js +1 -0
  6. package/dist/assets/RunButton-DTUzITFm.js +1 -0
  7. package/dist/assets/VisuallyHidden-DurJ_JBW.js +1 -0
  8. package/dist/assets/{add-cell-with-ai-CGBEoX6T.js → add-cell-with-ai-B0RdHenk.js} +19 -19
  9. package/dist/assets/add-connection-dialog-CcnJ2LkX.js +166 -0
  10. package/dist/assets/agent-panel-PB0I1dIC.js +286 -0
  11. package/dist/assets/ai-model-dropdown-DjQy2bo-.js +3 -0
  12. package/dist/assets/app-config-button-COFLeJCU.js +1 -0
  13. package/dist/assets/{blob-ChElOQvm.js → blob-BBiZd3vX.js} +1 -1
  14. package/dist/assets/{cache-panel-CLfGxru6.js → cache-panel-MAXVmKkG.js} +1 -1
  15. package/dist/assets/cell-editor-5wcJHF0s.js +24 -0
  16. package/dist/assets/cell-link-BbAJokoX.js +1 -0
  17. package/dist/assets/cells-B1S_6FG3.js +227 -0
  18. package/dist/assets/chat-display-ClG9MRI_.js +1 -0
  19. package/dist/assets/chat-panel-BRoqCSCR.js +4 -0
  20. package/dist/assets/chat-ui-CNvkb287.js +4 -0
  21. package/dist/assets/circle--ysFeW9z.js +1 -0
  22. package/dist/assets/column-preview-D6cIOnWQ.js +1 -0
  23. package/dist/assets/command-palette-DtZy0Am-.js +1 -0
  24. package/dist/assets/common-BGLbVHCS.js +1 -0
  25. package/dist/assets/components-BAvTsivu.js +1 -0
  26. package/dist/assets/config-DcB2swfZ.js +1 -0
  27. package/dist/assets/context-Do8M9TDF.js +1 -0
  28. package/dist/assets/{datasource-C0_eJO-0.js → datasource-BrSYgi6C.js} +2 -2
  29. package/dist/assets/dependency-graph-panel-C13q-nga.js +5 -0
  30. package/dist/assets/{documentation-panel-CxjnCPq6.js → documentation-panel-CtQqNEQw.js} +1 -1
  31. package/dist/assets/{download-CxzOE8FX.js → download-CIdXYNHv.js} +1 -1
  32. package/dist/assets/dropdown-menu-CqNabM1f.js +1 -0
  33. package/dist/assets/edit-page-jAyDC21z.js +9 -0
  34. package/dist/assets/{error-entries-DCRQWi_N.js → error-entries-DEjvzkum.js} +1 -1
  35. package/dist/assets/{error-panel-Bx5cPw6N.js → error-panel-BvrDwUv8.js} +1 -1
  36. package/dist/assets/file-explorer-panel-DYujxxK-.js +1 -0
  37. package/dist/assets/{file-icons-DxXY84Jn.js → file-icons-Bo1Ewf1W.js} +1 -1
  38. package/dist/assets/file-name-input-BDGq0-ac.js +3 -0
  39. package/dist/assets/{floating-outline-gjfcwmyU.js → floating-outline-CNsG18LK.js} +1 -1
  40. package/dist/assets/{gallery-page-BI3aTl8u.js → gallery-page-4dZlIWMe.js} +1 -1
  41. package/dist/assets/{glide-data-editor-CrWGp7DP.js → glide-data-editor-BQNVc0zc.js} +2 -2
  42. package/dist/assets/home-page-CFAldshJ.js +4 -0
  43. package/dist/assets/html-to-image-DMn_7CCA.js +2 -0
  44. package/dist/assets/index-0VrRpta0.css +2 -0
  45. package/dist/assets/index-BBPHmHdW.js +29 -0
  46. package/dist/assets/input-DeyycFtq.js +7 -0
  47. package/dist/assets/{layout-BQjGHHu-.js → layout-Ddsz1eHh.js} +5 -5
  48. package/dist/assets/{logs-panel-D1RUMXL1.js → logs-panel-BSD1GETR.js} +1 -1
  49. package/dist/assets/markdown-renderer-DIXiKP4m.js +2 -0
  50. package/dist/assets/{mermaid-DtNubw9S.js → mermaid-CwvTqKGz.js} +2 -2
  51. package/dist/assets/{name-cell-input-DSKoNRk3.js → name-cell-input-zqypwqoZ.js} +1 -1
  52. package/dist/assets/{outline-panel-UIygpaO3.js → outline-panel-C5GAyqII.js} +1 -1
  53. package/dist/assets/packages-panel-CYLyGihe.js +1 -0
  54. package/dist/assets/{pair-with-agent-modal-Pl5cv7Gv.js → pair-with-agent-modal-CBIL9_6g.js} +2 -2
  55. package/dist/assets/panel-accordion-state-DmV3OgfX.js +1 -0
  56. package/dist/assets/panels-D53vWR00.js +4 -0
  57. package/dist/assets/{process-output-BWDSbk5d.js → process-output-DNhz9LLW.js} +1 -1
  58. package/dist/assets/{readonly-code-display-Bbnq-khe.js → readonly-code-display-CKT-gv1m.js} +1 -1
  59. package/dist/assets/readonly-python-code-De0vvuWh.js +1 -0
  60. package/dist/assets/{renderShortcut-Dj3NbkoC.js → renderShortcut-D9XYVNe3.js} +1 -1
  61. package/dist/assets/{reveal-component-Bgmfon3f.js → reveal-component-C0L5MU2W.js} +4 -4
  62. package/dist/assets/run-page-DXZapRtY.js +1 -0
  63. package/dist/assets/scratchpad-panel-ja6doGoa.js +1 -0
  64. package/dist/assets/secrets-panel-B7Rcwc2I.js +1 -0
  65. package/dist/assets/select-BUEX2Vfl.js +1 -0
  66. package/dist/assets/session-panel-ftyqfsYy.js +1 -0
  67. package/dist/assets/{skeleton-DGs-LrlZ.js → skeleton-CxFczTPo.js} +1 -1
  68. package/dist/assets/snippets-panel-BZ254lxN.js +1 -0
  69. package/dist/assets/{state-WVnIPIsw.js → state-MlBpc9qi.js} +3 -3
  70. package/dist/assets/{state-N_csMEH1.js → state-llVv0lIh.js} +1 -1
  71. package/dist/assets/switch-CBR-ykv3.js +1 -0
  72. package/dist/assets/tabs-c6mpccpH.js +1 -0
  73. package/dist/assets/{terminal-aLrVlOf6.js → terminal-OC_FnEas.js} +3 -3
  74. package/dist/assets/tracing-C0FGWieO.js +1 -0
  75. package/dist/assets/tracing-panel-LeIOi1Tv.js +2 -0
  76. package/dist/assets/{tree-actions-Ctf5W0DR.js → tree-actions-CrWpuExP.js} +1 -1
  77. package/dist/assets/useAddCell-DIdbaU70.js +1 -0
  78. package/dist/assets/useCellActionButton-DXyUqFdJ.js +1 -0
  79. package/dist/assets/{useDateFormatter-CfPcCT-J.js → useDateFormatter-BiqAQ-zI.js} +1 -1
  80. package/dist/assets/{useDeleteCell-6wcjnAMK.js → useDeleteCell-CSCMg7Up.js} +1 -1
  81. package/dist/assets/useDependencyPanelTab-Bt7aBDpS.js +1 -0
  82. package/dist/assets/useNotebookActions-ClT4GmnB.js +10 -0
  83. package/dist/assets/useNumberFormatter-DHJ9s6Vk.js +1 -0
  84. package/dist/assets/useRunCells-DHnbXALT.js +1 -0
  85. package/dist/assets/{useSplitCell-oIRu7Qlj.js → useSplitCell-CxlsGCB_.js} +1 -1
  86. package/dist/assets/{vega-component-D4OKyVdb.js → vega-component-CzgE5HEs.js} +1 -1
  87. package/dist/assets/write-secret-modal-BG_B6y1P.js +2 -0
  88. package/dist/index.html +57 -71
  89. package/package.json +1 -1
  90. package/src/components/datasources/datasources.tsx +16 -17
  91. package/src/components/editor/actions/useNotebookActions.tsx +50 -0
  92. package/src/components/editor/chrome/panels/components.tsx +1 -1
  93. package/src/components/editor/connections/__tests__/add-connection-button.test.tsx +129 -0
  94. package/src/components/editor/connections/add-connection-button.tsx +132 -0
  95. package/src/components/editor/connections/components.tsx +11 -0
  96. package/src/components/editor/connections/quick-add-data-sources.tsx +11 -11
  97. package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +109 -1
  98. package/src/components/storage/storage-inspector.tsx +15 -17
  99. package/src/core/codemirror/language/panel/sql.test.tsx +69 -0
  100. package/src/core/codemirror/language/panel/sql.tsx +81 -4
  101. package/dist/assets/ConnectedDataExplorerComponent-88Ojqyhx.js +0 -1
  102. package/dist/assets/DeferredRequestRegistry-C-SpvRCH.js +0 -1
  103. package/dist/assets/ImperativeModal-68zj0lxy.js +0 -1
  104. package/dist/assets/JsonOutput-pCdkYz4X.js +0 -50
  105. package/dist/assets/MarimoErrorOutput-b7bFhjgD.js +0 -6
  106. package/dist/assets/RSPContexts-D2JcYZo2.js +0 -1
  107. package/dist/assets/RenderHTML-BUuDW4yZ.js +0 -1
  108. package/dist/assets/RunButton-4MKgVYXU.js +0 -1
  109. package/dist/assets/SSRProvider-C_WMmqnS.js +0 -1
  110. package/dist/assets/add-connection-dialog-BcLKuMHt.js +0 -166
  111. package/dist/assets/agent-panel-BVyaNGyG.js +0 -286
  112. package/dist/assets/ai-model-dropdown-C_IoSmhR.js +0 -3
  113. package/dist/assets/app-config-button-BvpunAmJ.js +0 -1
  114. package/dist/assets/cell-editor-pKuytlrm.js +0 -24
  115. package/dist/assets/cell-link-D9d1y67_.js +0 -1
  116. package/dist/assets/cells-BdoPd1mK.js +0 -226
  117. package/dist/assets/chat-display-CbsB82vm.js +0 -1
  118. package/dist/assets/chat-panel-DCPKH1gP.js +0 -4
  119. package/dist/assets/chat-ui-BwLG6iSS.js +0 -4
  120. package/dist/assets/circle-plus-cm-FRu9O.js +0 -1
  121. package/dist/assets/column-preview-fku2dKeP.js +0 -1
  122. package/dist/assets/command-Cvmdzx0n.js +0 -1
  123. package/dist/assets/command-palette-BJFR8wKv.js +0 -1
  124. package/dist/assets/common-CQ9OqrFS.js +0 -1
  125. package/dist/assets/components-CaOG3LOY.js +0 -1
  126. package/dist/assets/config-xlrIxOZJ.js +0 -1
  127. package/dist/assets/context-Bf2wPdef.js +0 -1
  128. package/dist/assets/data-source-discovery-BsrDlL04.js +0 -1
  129. package/dist/assets/dependency-graph-panel-CxZJ5e7D.js +0 -5
  130. package/dist/assets/dialog-EjSc4yoH.js +0 -1
  131. package/dist/assets/dropdown-menu-BpI5klSq.js +0 -1
  132. package/dist/assets/edit-page-DwKN7vIP.js +0 -9
  133. package/dist/assets/field-YoG_gQAY.js +0 -1
  134. package/dist/assets/file-explorer-panel-CRrPqu3s.js +0 -1
  135. package/dist/assets/file-name-input-uFNWUWCc.js +0 -3
  136. package/dist/assets/focus-DgNLvj0o.js +0 -1
  137. package/dist/assets/form-CD2uATFu.js +0 -2
  138. package/dist/assets/form-GIq5QCAI.js +0 -1
  139. package/dist/assets/home-page-CYg3rQCB.js +0 -4
  140. package/dist/assets/html-to-image-Bt7Ld74W.js +0 -2
  141. package/dist/assets/index-CrsPwq0f.js +0 -29
  142. package/dist/assets/index-H2TMW127.css +0 -2
  143. package/dist/assets/input-BuOxQ3Wy.js +0 -1
  144. package/dist/assets/label-B67m1YH7.js +0 -1
  145. package/dist/assets/links-C7oaxPJK.js +0 -1
  146. package/dist/assets/markdown-renderer-C8IbrNw3.js +0 -2
  147. package/dist/assets/packages-panel-CIwyYf45.js +0 -1
  148. package/dist/assets/panel-accordion-state-DAAi8MPY.js +0 -1
  149. package/dist/assets/panels-DcguQKjE.js +0 -4
  150. package/dist/assets/popover-CgOo22ko.js +0 -1
  151. package/dist/assets/radio-group-DZoEgN7k.js +0 -1
  152. package/dist/assets/readonly-python-code-CyfabMFb.js +0 -1
  153. package/dist/assets/refresh-ccw-DrVG5f2L.js +0 -1
  154. package/dist/assets/request-registry-mNu7sXOU.js +0 -1
  155. package/dist/assets/run-page-Buh6gERG.js +0 -1
  156. package/dist/assets/scratchpad-panel-soCf5igY.js +0 -1
  157. package/dist/assets/secrets-panel-CCb8F6PC.js +0 -1
  158. package/dist/assets/select-DwqnFsyg.js +0 -1
  159. package/dist/assets/session-panel-BO4lOJc-.js +0 -1
  160. package/dist/assets/snippets-panel-CulFiQ0V.js +0 -1
  161. package/dist/assets/sparkles-30wHhAF5.js +0 -1
  162. package/dist/assets/state-B-K0k6lb.js +0 -1
  163. package/dist/assets/switch-VzdUoXkf.js +0 -1
  164. package/dist/assets/textarea-mD3C73jw.js +0 -1
  165. package/dist/assets/tracing-B_Qlv38-.js +0 -1
  166. package/dist/assets/tracing-panel--KVMPYqh.js +0 -2
  167. package/dist/assets/useCellActionButton-BDVM-sW-.js +0 -1
  168. package/dist/assets/useDependencyPanelTab-D4TnSeLa.js +0 -1
  169. package/dist/assets/useNotebookActions-gEpi1TfO.js +0 -10
  170. package/dist/assets/useNumberFormatter-BmUQe2Pf.js +0 -1
  171. package/dist/assets/usePress-CwOqeEX3.js +0 -7
  172. package/dist/assets/useRunCells-DP6cAHq0.js +0 -1
  173. package/dist/assets/write-secret-modal-dplU5PG8.js +0 -2
  174. package/dist/assets/x-BgkoSHM-.js +0 -1
@@ -0,0 +1,6 @@
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-xfs0Sn4r.js";import{t as c}from"./react-CBDbhulC.js";import{Bi as l,E as u,Wi as d,Xr as f,Yi as p,ao as m,bo as h,it as g,li as _,ni as v,oo as y,y as b,zo as x}from"./cells-B1S_6FG3.js";import{t as S}from"./compiler-runtime-CYIjoINj.js";import{g as C,p as w}from"./useEventListener-D27Dii_l.js";import{t as T}from"./invariant-Ci2dTZ72.js";import{a as E,i as D,x as O}from"./utils-R_pHe-RB.js";import{t as ee}from"./cn-ldLVeaqm.js";import{t as k}from"./jsx-runtime-B74pBk57.js";import{a as A,i as j,o as te,r as ne,t as M}from"./config-DcB2swfZ.js";import{a as N,p as P,r as re,t as ie}from"./dropdown-menu-CqNabM1f.js";import{t as F}from"./tooltip-D7dq6bnc.js";import{r as ae,t as I}from"./button-BMBznEru.js";import{n as oe}from"./strings-CpYReX2Q.js";import{t as se}from"./createLucideIcon-B7HeEoG2.js";import{t as ce}from"./check-BoA6XBpj.js";import{a as le}from"./useNumberFormatter-DHJ9s6Vk.js";import{t as ue}from"./chevron-right-CKA5zVsM.js";import{t as de}from"./hat-glasses-C8LSY3HT.js";import{p as L}from"./write-secret-modal-BG_B6y1P.js";import{t as fe}from"./package-DPlscLzt.js";import{l as R,r as pe}from"./datasource-BrSYgi6C.js";import{a as me}from"./dist-DzAWvPVK.js";import{t as he}from"./uuid-k9DpjH68.js";import{t as ge}from"./use-toast-DpWHUGuF.js";import{t as _e}from"./RenderHTML-COTZYPO7.js";import{t as z}from"./kbd-Cwh96ZBE.js";import{r as ve,t as ye}from"./alert-dmKwNsrp.js";import{o as be,t as xe}from"./useInstallPackage-Bq7SlWgN.js";import{n as Se,o as Ce}from"./state-llVv0lIh.js";import{n as B}from"./cell-link-BbAJokoX.js";var V=se(`square-arrow-out-up-right`,[[`path`,{d:`M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6`,key:`y09zxi`}],[`path`,{d:`m21 3-9 9`,key:`mpx6sq`}],[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}]]),we=se(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),H=e(c(),1),U=S(),Te=String.raw`_cell_([^\W_][\w-]*?)(_\w*)`,Ee=String.raw`(?<!_)${Te}`;RegExp(`^${Te}$`);var De=new RegExp(Ee),W=new RegExp(Ee,`g`);function Oe(e){let t=[];W.lastIndex=0;let n=0,r=W.exec(e);for(;r!==null;)r.index>n&&t.push(e.slice(n,r.index)),t.push({cellId:r[1],name:r[2]}),n=r.index+r[0].length,r=W.exec(e);return n<e.length&&t.push(e.slice(n)),t}function ke(e){return De.test(e)}function Ae(e){let t=null,n=e.cursor();do n.name===`ExpressionStatement`&&(t=n.node);while(n.next());return t}function je(e){let t=e.split(`
2
+ `),n=` `,r=Ae(me.parse(e));if(!r)return[`def _():`,...G(t,n),`${n}return`,``,``,`_()`].join(`
3
+ `);let i=e.slice(0,r.from).trim(),a=e.slice(r.from).trim(),o=i.split(`
4
+ `),s=a.split(`
5
+ `);return[`def _():`,...G(o,n),`${n}return ${s[0]}`,...G(s.slice(1),n),``,``,`_()`].join(`
6
+ `)}function G(e,t){if(e.length===1&&e[0]===``)return[];let n=[];for(let r of e)r===``?n.push(``):n.push(t+r);return n}function Me(e,t){if(e.type===`multiple-defs`)return[{title:`Fix: Wrap in a function`,description:`Make this cell's variables local by wrapping the cell in a function.`,fixType:`manual`,onFix:async e=>{T(e.editor,`Editor is null`);let t=je(e.editor.state.doc.toString());e.editor.dispatch({changes:{from:0,to:e.editor.state.doc.length,insert:t}})}}];if(e.type===`exception`&&e.exception_type===`NameError`){let t=e.msg.match(/name '(.+)' is not defined/)?.[1];if(!t||!(t in K))return[];let n=Ne(t);return[{title:`Fix: Add '${n}'`,description:`Add a new cell for the missing import`,fixType:`manual`,onFix:async e=>{e.addCodeBelow(n)}}]}return e.type===`sql-error`&&t.aiEnabled?[{title:`Fix with AI`,description:`Fix the SQL statement`,fixType:`ai`,onFix:async t=>{let n=pe(t.cellId,a),r=`Fix the SQL statement: ${e.msg}.`;n&&(r+=`\nDatabase schema: ${n}`),t.aiFix?.setAiCompletionCell({cellId:t.cellId,initialPrompt:r,triggerImmediately:t.aiFix.triggerFix})}}]:[]}function Ne(e){let t=K[e];return t===e?`import ${t}`:`import ${t} as ${e}`}var K={mo:`marimo`,alt:`altair`,bokeh:`bokeh`,dask:`dask`,np:`numpy`,pd:`pandas`,pl:`polars`,plotly:`plotly`,plt:`matplotlib.pyplot`,px:`plotly.express`,scipy:`scipy`,sk:`sklearn`,sns:`seaborn`,stats:`scipy.stats`,tf:`tensorflow`,torch:`torch`,xr:`xarray`,dt:`datetime`,json:`json`,math:`math`,os:`os`,re:`re`,sys:`sys`},q=h(`marimo:acp:sessions:v1`,{sessions:[],activeTabId:null},v),Pe=r(e=>{let t=e(q);return t.activeTabId&&t.sessions.find(e=>e.tabId===t.activeTabId)||null},(e,t,n)=>{t(q,e=>({...e,activeTabId:n}))});function Fe(){return`tab_${he()}`}function Ie(e,t=20){return e.length<=t?e:`${e.slice(0,t-3)}...`}function Le(e,t){let n=Ge(t.agentId),r=Date.now(),i=t.firstMessage?Ie(t.firstMessage.trim()):`New ${t.agentId} session`,a=Fe();if(n===`single`){let n=e.sessions.filter(e=>e.agentId===t.agentId),a=e.sessions.filter(e=>e.agentId!==t.agentId);if(n.length>0){let o=n[0],s={agentId:t.agentId,title:i,createdAt:r,lastUsedAt:r,tabId:o.tabId,externalAgentSessionId:null,selectedModel:t.model??o.selectedModel??null};return{...e,sessions:[...a.slice(0,0),s],activeTabId:s.tabId}}}return{...e,sessions:[...e.sessions.slice(0,0),{agentId:t.agentId,tabId:a,title:i,createdAt:r,lastUsedAt:r,externalAgentSessionId:null,selectedModel:t.model??null}],activeTabId:a}}function Re(e,t){let n=e.sessions.filter(e=>e.tabId!==t);return{sessions:n,activeTabId:e.activeTabId===t?n.length>0?n[n.length-1].tabId:null:e.activeTabId}}function ze(e,t){let n=e.activeTabId;return n?{...e,sessions:e.sessions.map(e=>e.tabId===n?{...e,title:Ie(t)}:e)}:e}function Be(e,t){return{...e,sessions:e.sessions.map(e=>e.tabId===t?{...e,lastUsedAt:Date.now()}:e)}}function Ve(e,t){let n=e.activeTabId;return n?{...e,sessions:e.sessions.map(e=>e.tabId===n?{...e,externalAgentSessionId:t,lastUsedAt:Date.now()}:e)}:e}function He(){return[`claude`,`gemini`,`codex`,`opencode`,`cursor`]}function Ue(e){return oe(e)}function We(e){let t=J[e].port,n=window.location.hostname;return`${window.location.protocol===`https:`?`wss:`:`ws:`}//${n}:${t}/message`}var J={claude:{port:3017,command:`npx @zed-industries/claude-code-acp`,sessionSupport:`single`},gemini:{port:3019,command:`npx @google/gemini-cli --experimental-acp`,sessionSupport:`single`},codex:{port:3021,command:`npx @zed-industries/codex-acp`,sessionSupport:`single`},opencode:{port:3023,command:`npx opencode-ai acp`,sessionSupport:`single`},cursor:{port:3025,command:`agent acp`,sessionSupport:`single`}};function Ge(e){return J[e].sessionSupport}function Ke(e){let t=J[e].port,n=J[e].command;return`npx stdio-to-ws "${w()?`cmd /c ${n}`:n}" --port ${t}`}var qe=h(`marimo:chrome:ai-panel-tab`,`chat`,v);function Je(){let e=(0,U.c)(3),[n,r]=t(qe),i;return e[0]!==n||e[1]!==r?(i={aiPanelTab:n,setAiPanelTab:r},e[0]=n,e[1]=r,e[2]=i):i=e[2],i}var Ye=`code_mode`;function Xe(e,t){return e||(_(`external_agents`)?t:`chat`)}function Ze(){let e=(0,U.c)(6),{openApplication:t}=f(),{setAiPanelTab:r}=Je(),{saveModeChange:i}=M(),a=s(Ce),c=n(),l;return e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==a||e[4]!==c?(l=async e=>{let n=Xe(e.panel,c.get(qe)),o=c.get(E),s=_(`external_agents`)&&c.get(q).sessions.length>0;if(!(n===`agents`?s:o)){ge({title:n===`agents`?`No agent session`:`AI not configured`,description:n===`agents`?`Start an agent session or switch to the chat panel.`:`Configure an AI provider and chat model to fix with AI.`,variant:`danger`});return}e.panel&&r(e.panel),n===`chat`&&await i(Ye).catch(Qe),a({prompt:e.prompt,submit:e.submit??!1}),t(`ai`)},e[0]=t,e[1]=i,e[2]=r,e[3]=a,e[4]=c,e[5]=l):l=e[5],o(l)}function Qe(){return C.error(`Failed to save mode change`)}var $e=h(`marimo:ai-autofix-mode`,`autofix`,v);function et(){let e=(0,U.c)(3),[n,r]=t($e),i;return e[0]!==n||e[1]!==r?(i={fixMode:n,setFixMode:r},e[0]=n,e[1]=r,e[2]=i):i=e[2],i}var Y=k();function tt(e,t){if(e!=null)return`@error://${e}\n\nPlease fix this error.`;let n=t?.trim();return n?`My code gives the following error. Please fix it:\n\n${n}`:`Please fix this error.`}var X=e=>{let t=(0,U.c)(25),{errors:r,cellId:a,className:o}=e,c=n(),{createNewCell:l}=u(),d=i(D),f;if(t[0]!==d||t[1]!==r){let e;t[3]===d?e=t[4]:(e=e=>Me(e,{aiEnabled:d}),t[3]=d,t[4]=e),f=r.flatMap(e),t[0]=d,t[1]=r,t[2]=f}else f=t[2];let p=f,m=s(Se),h=Ze();if(p.length===0)return null;let g=p[0],_;t[5]!==a||t[6]!==l||t[7]!==g||t[8]!==m||t[9]!==c?(_=e=>{let t=c.get(b).cellHandles[a].current?.editorView;g.onFix({addCodeBelow:e=>{l({cellId:a,autoFocus:!1,before:!1,code:e})},editor:t,cellId:a,aiFix:{setAiCompletionCell:m,triggerFix:e}}),t?.focus()},t[5]=a,t[6]=l,t[7]=g,t[8]=m,t[9]=c,t[10]=_):_=t[10];let v=_,y;t[11]!==a||t[12]!==h?(y=()=>{h({prompt:tt(a)})},t[11]=a,t[12]=h,t[13]=y):y=t[13];let x=y,S;t[14]===o?S=t[15]:(S=ee(`my-2`,o),t[14]=o,t[15]=S);let C;t[16]!==g.description||t[17]!==g.fixType||t[18]!==g.title||t[19]!==v||t[20]!==x?(C=g.fixType===`ai`?(0,Y.jsx)(it,{tooltip:g.description,openPrompt:()=>v(!1),applyAutofix:()=>v(!0),openChat:x}):(0,Y.jsx)(F,{content:g.description,align:`start`,children:(0,Y.jsxs)(I,{size:`xs`,variant:`outline`,className:`font-normal`,onClick:()=>v(!1),children:[(0,Y.jsx)(R,{className:`h-3 w-3 mr-2`}),g.title]})}),t[16]=g.description,t[17]=g.fixType,t[18]=g.title,t[19]=v,t[20]=x,t[21]=C):C=t[21];let w;return t[22]!==S||t[23]!==C?(w=(0,Y.jsx)(`div`,{className:S,children:C}),t[22]=S,t[23]=C,t[24]=w):w=t[24],w},nt={autofix:{Icon:R,title:`Inline AI Fix`,description:`Apply AI fixes inline in the cell`},chat:{Icon:de,title:`Fix with AI assistant`,description:`Open the AI sidebar to fix`},prompt:{Icon:l,title:`Suggest a prompt`,description:`Edit the prompt before applying`}},rt=[`autofix`,`prompt`,`chat`],it=e=>{let t=(0,U.c)(18),{tooltip:n,openPrompt:r,applyAutofix:i,openChat:a}=e,{fixMode:o,setFixMode:s}=et(),c=r;o===`chat`?c=a:o===`autofix`&&(c=i);let{Icon:l,title:u}=nt[o],d;t[0]===l?d=t[1]:(d=(0,Y.jsx)(l,{className:`h-3 w-3 mr-2 mb-0.5`}),t[0]=l,t[1]=d);let f;t[2]!==c||t[3]!==d||t[4]!==u?(f=(0,Y.jsxs)(I,{size:`xs`,variant:`outline`,className:`font-normal rounded-r-none border-r-0`,onClick:c,children:[d,u]}),t[2]=c,t[3]=d,t[4]=u,t[5]=f):f=t[5];let p;t[6]!==f||t[7]!==n?(p=(0,Y.jsx)(F,{content:n,align:`start`,children:f}),t[6]=f,t[7]=n,t[8]=p):p=t[8];let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Y.jsx)(P,{asChild:!0,children:(0,Y.jsx)(I,{size:`xs`,variant:`outline`,className:`rounded-l-none px-2`,"aria-label":`Fix options`,children:(0,Y.jsx)(le,{className:`h-3 w-3`})})}),t[9]=m):m=t[9];let h;t[10]!==o||t[11]!==s?(h=rt.map(e=>(0,Y.jsx)(N,{className:`flex items-center gap-2`,onClick:()=>s(e),children:(0,Y.jsx)(at,{mode:e,selected:e===o})},e)),t[10]=o,t[11]=s,t[12]=h):h=t[12];let g;t[13]===h?g=t[14]:(g=(0,Y.jsxs)(ie,{children:[m,(0,Y.jsx)(re,{align:`end`,className:`w-56`,children:h})]}),t[13]=h,t[14]=g);let _;return t[15]!==p||t[16]!==g?(_=(0,Y.jsxs)(`div`,{className:`flex`,children:[p,g]}),t[15]=p,t[16]=g,t[17]=_):_=t[17],_},at=e=>{let t=(0,U.c)(15),{mode:n,selected:r}=e,{Icon:i,title:a,description:o}=nt[n],s;t[0]===i?s=t[1]:(s=(0,Y.jsx)(i,{className:`h-4 w-4 shrink-0`}),t[0]=i,t[1]=s);let c;t[2]===a?c=t[3]:(c=(0,Y.jsx)(`span`,{className:`font-medium`,children:a}),t[2]=a,t[3]=c);let l;t[4]===o?l=t[5]:(l=(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o}),t[4]=o,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Y.jsxs)(`div`,{className:`flex flex-col`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===r?d=t[10]:(d=r&&(0,Y.jsx)(ce,{className:`h-4 w-4 ml-auto shrink-0`}),t[9]=r,t[10]=d);let f;return t[11]!==s||t[12]!==u||t[13]!==d?(f=(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 w-full`,children:[s,u,d]}),t[11]=s,t[12]=u,t[13]=d,t[14]=f):f=t[14],f},ot=e=>{let t=(0,U.c)(12),{local:n}=e,r;t[0]===n.name?r=t[1]:(r=(0,Y.jsx)(`span`,{className:`font-code`,children:n.name}),t[0]=n.name,t[1]=r);let i;t[2]===n.cellId?i=t[3]:(i=(0,Y.jsx)(B,{cellId:n.cellId}),t[2]=n.cellId,t[3]=i);let a;t[4]!==r||t[5]!==i?(a=(0,Y.jsxs)(`div`,{className:`max-w-xs`,children:[`Local variable `,r,` in cell`,` `,i,`.`]}),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o=a,s;t[7]===n.name?s=t[8]:(s=(0,Y.jsx)(`span`,{className:`font-code cursor-help`,children:n.name}),t[7]=n.name,t[8]=s);let c;return t[9]!==s||t[10]!==o?(c=(0,Y.jsx)(F,{content:o,children:s}),t[9]=s,t[10]=o,t[11]=c):c=t[11],c},st=e=>{let t=(0,U.c)(4),{segments:n}=e,r;t[0]===n?r=t[1]:(r=n.map(ct),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Y.jsx)(Y.Fragment,{children:r}),t[2]=r,t[3]=i),i};function ct(e,t){return typeof e==`string`?(0,Y.jsx)(`span`,{children:e},t):(0,Y.jsx)(ot,{local:e},t)}var lt=new g,Z=e=>{let t=RegExp(`\x1B\\[[0-9;]*m`,`g`);return e.replaceAll(t,``)},ut=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi;function dt(e){ut.lastIndex=0;let t=ut.exec(e);if(!t)return null;let n=t.index+t[0].length,r=e.slice(n).split(/\s+/),i=``,a=0;for(let e of r){let t=e.trim();if(!t)continue;if(t.startsWith(`-`)){a+=t.length+1;continue}let n=t.match(/^[\w,.[\]-]+/);if(n){i=n[0];break}break}if(!i)return null;let o=n+a+i.length;return{package:i,endIndex:o}}function Q(e,t=``){if(!e)return null;if(!/https?:\/\//.test(e))return e;let n=x(e);return n.length===1&&n[0].type===`text`?e:(0,Y.jsx)(Y.Fragment,{children:n.map((e,n)=>{let r=t?`${t}-${n}`:n;if(e.type===`url`){let t=Z(e.url);return(0,Y.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:ae.stopPropagation(),className:`text-link hover:underline`,children:t},r)}if(e.type===`image`){let t=Z(e.url);return(0,Y.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:ae.stopPropagation(),className:`text-link hover:underline`,children:t},r)}return(0,Y.jsx)(H.Fragment,{children:e.value},r)})})}var ft=e=>{let t=(0,U.c)(6),{packages:n,children:r}=e,{handleInstallPackages:i}=xe(),a;t[0]!==i||t[1]!==n?(a=e=>{i(n),e.preventDefault()},t[0]=i,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==r||t[4]!==a?(o=(0,Y.jsx)(`button`,{onClick:a,className:`text-link hover:underline`,type:`button`,children:r}),t[3]=r,t[4]=a,t[5]=o):o=t[5],o},pt=e=>{if(!(e instanceof y.Text))return;let t=Z(e.data);if(!/(pip\s+install|uv\s+add|uv\s+pip\s+install)/i.test(t))return;let n=[],r=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi,i;for(;(i=r.exec(t))!==null;){let e=i.index,r=dt(t.slice(e));r&&n.push({match:i,result:r})}if(n.length===0)return;let a=[],o=0;if(n.forEach((e,n)=>{let{match:r,result:i}=e,s=r.index,c=s+i.endIndex;if(o<s){let e=t.slice(o,s);a.push((0,Y.jsx)(H.Fragment,{children:Q(e,`before-${n}`)},`before-${n}`))}let l=t.slice(s,c);a.push((0,Y.jsx)(ft,{packages:[i.package],children:l},`install-${n}`)),o=c}),o<t.length){let e=t.slice(o);a.push((0,Y.jsx)(H.Fragment,{children:Q(e,`after`)},`after`))}return(0,Y.jsx)(Y.Fragment,{children:a})},mt=e=>{if(!(e instanceof y.Text))return;let t=e.data;if(!/https?:\/\//.test(t))return;let n=Q(t);if(typeof n!=`string`)return(0,Y.jsx)(Y.Fragment,{children:n})},ht=(...e)=>t=>{for(let n of e){let e=n(t);if(e!==void 0)return e}},gt=(e,t)=>{let n=lt.ansi_to_html(e),r=m(n,{replace:e=>t(e)});return(0,Y.jsx)(`span`,{children:r})},_t=e=>{let t=(0,U.c)(4),{text:n}=e,r;t[0]===n?r=t[1]:(r=gt(n,ht(pt,mt)),t[0]=n,t[1]=r);let i=r,a;return t[2]===i?a=t[3]:(a=(0,Y.jsx)(Y.Fragment,{children:i}),t[2]=i,t[3]=a),a},vt=e=>{let t=(0,U.c)(16),{traceback:n}=e,[r,i]=(0,H.useState)(!0),a;t[0]===r?a=t[1]:(a=()=>i(!r),t[0]=r,t[1]=a);let o=r?`Collapse traceback`:`Expand traceback`,s;t[2]===r?s=t[3]:(s=r?(0,Y.jsx)(le,{className:`h-3 w-3`}):(0,Y.jsx)(ue,{className:`h-3 w-3`}),t[2]=r,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(`span`,{className:`text-[0.6875rem] uppercase tracking-wider`,children:`Traceback`}),t[4]=c):c=t[4];let l;t[5]!==r||t[6]!==a||t[7]!==o||t[8]!==s?(l=(0,Y.jsxs)(`button`,{type:`button`,onClick:a,"aria-expanded":r,"aria-label":o,className:`flex items-center gap-1 text-muted-foreground/70 hover:text-muted-foreground transition-colors`,children:[s,c]}),t[5]=r,t[6]=a,t[7]=o,t[8]=s,t[9]=l):l=t[9];let u;t[10]!==r||t[11]!==n?(u=r&&(0,Y.jsx)(`div`,{className:`font-code text-sm mt-1 p-3 bg-muted rounded border overflow-auto max-h-[50vh] cursor-text select-text`,children:_e({html:n})}),t[10]=r,t[11]=n,t[12]=u):u=t[12];let d;return t[13]!==l||t[14]!==u?(d=(0,Y.jsxs)(`div`,{className:`mt-2`,children:[l,u]}),t[13]=l,t[14]=u,t[15]=d):d=t[15],d},$=e=>{let t=(0,U.c)(10),n=e.title??`Tip`,r;t[0]===n?r=t[1]:(r=(0,Y.jsx)(te,{className:`pt-2 pb-0 font-normal`,children:n}),t[0]=n,t[1]=r);let i;t[2]===e.children?i=t[3]:(i=(0,Y.jsx)(j,{className:`mr-24 text-[0.84375rem]`,wrapperClassName:`pt-0 pb-2`,children:e.children}),t[2]=e.children,t[3]=i);let a;t[4]!==r||t[5]!==i?(a=(0,Y.jsxs)(A,{value:`item-1`,className:`text-muted-foreground`,children:[r,i]}),t[4]=r,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==e.className||t[8]!==a?(o=(0,Y.jsx)(ne,{type:`single`,collapsible:!0,className:e.className,children:a}),t[7]=e.className,t[8]=a,t[9]=o):o=t[9],o},yt=e=>{let t=(0,U.c)(38),{errors:n,cellId:r,className:a}=e,o=f(),s=i(O).display.cell_output===`above`,c=`This cell wasn't run because it has errors`,l=`destructive`,u=`text-error`,m=null;if(n.some(bt))c=`Interrupted`;else if(n.some(xt))c=`An internal error occurred`;else if(n.some(St))c=`Ancestor prevented from running`,l=`default`,u=`text-secondary-foreground`;else if(n.some(Ct))c=`Ancestor stopped`,l=`default`,u=`text-secondary-foreground`;else if(n.some(wt))c=`SQL error`;else if(n.some(Tt))c=null,m=`Cell not run`;else{let e;t[0]===n?e=t[1]:(e=n.find(Et),t[0]=n,t[1]=e);let r=e;r&&`exception_type`in r&&(c=r.exception_type)}let h,g,_,v,y,b;if(t[2]!==l||t[3]!==r||t[4]!==o||t[5]!==a||t[6]!==n||t[7]!==s||t[8]!==m||t[9]!==u||t[10]!==c){let e=n.filter(Dt),i=n.filter(Ot),f=n.filter(kt),x=n.filter(At),S=n.filter(jt),C=n.filter(Mt),w=n.filter(Nt),T=n.filter(Pt),E=n.filter(Ft),D=n.filter(It),O=n.filter(Lt),k=n.filter(Rt),A=n.filter(zt),j;t[17]===o?j=t[18]:(j=()=>{o.openApplication(`scratchpad`)},t[17]=o,t[18]=j);let te=j,ne=()=>{let t=[];if(O.length>0||k.length>0){let e=O.some(Bt),n=!e&&O.some(Vt);t.push((0,Y.jsxs)(`div`,{children:[O.map(Ht),k.map(Ut),e&&(0,Y.jsxs)(I,{size:`xs`,variant:`outline`,className:`mt-2 font-normal`,onClick:()=>be(o),children:[(0,Y.jsx)(fe,{className:`h-3.5 w-3.5 mr-1.5 mb-0.5`}),(0,Y.jsx)(`span`,{children:`Open package manager`})]}),n&&(0,Y.jsxs)(I,{size:`xs`,variant:`outline`,className:`mt-2 font-normal`,onClick:()=>o.openApplication(`terminal`),children:[(0,Y.jsx)(we,{className:`h-3.5 w-3.5 mr-1.5`}),(0,Y.jsx)(`span`,{children:`Open terminal`})]}),r&&(0,Y.jsx)(X,{errors:[...O,...k],cellId:r})]},`syntax-unknown`))}if(e.length>0&&t.push((0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground font-medium`,children:`The setup cell cannot be run because it has references.`}),(0,Y.jsx)(`ul`,{className:`list-disc`,children:e.flatMap(Wt)}),r&&(0,Y.jsx)(X,{errors:e,cellId:r}),(0,Y.jsxs)($,{title:`Why can't the setup cell have references?`,className:`mb-2`,children:[(0,Y.jsx)(`p`,{className:`pb-2`,children:`The setup cell contains logic that must be run before any other cell runs, including top-level imports used by top-level functions. For this reason, it can't refer to other cells' variables.`}),(0,Y.jsx)(`p`,{className:`py-2`,children:`Try simplifying the setup cell to only contain only necessary variables.`}),(0,Y.jsxs)(`p`,{className:`py-2`,children:[(0,Y.jsxs)(L,{href:`https://links.marimo.app/errors-setup`,children:[`Learn more at our docs`,` `,(0,Y.jsx)(V,{size:`0.75rem`,className:`inline`})]}),`.`]})]})]},`setup-refs`)),i.length>0&&t.push((0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground font-medium`,children:`This cell is in a cycle.`}),(0,Y.jsx)(`ul`,{className:`list-disc`,children:i.flatMap(Gt)}),r&&(0,Y.jsx)(X,{errors:i,cellId:r}),(0,Y.jsxs)($,{title:`What are cycles and how do I resolve them?`,className:`mb-2`,children:[(0,Y.jsx)(`p`,{className:`pb-2`,children:`An example of a cycle is if one cell declares a variable 'a' and reads 'b', and another cell declares 'b' and and reads 'a'. Cycles like this make it impossible for marimo to know how to run your cells, and generally suggest that your code has a bug.`}),(0,Y.jsx)(`p`,{className:`py-2`,children:`Try merging these cells into a single cell to eliminate the cycle.`}),(0,Y.jsxs)(`p`,{className:`py-2`,children:[(0,Y.jsxs)(L,{href:`https://links.marimo.app/errors-cycles`,children:[`Learn more at our docs`,` `,(0,Y.jsx)(V,{size:`0.75rem`,className:`inline`})]}),`.`]})]})]},`cycle`)),f.length>0){let e=f[0].name;t.push((0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground font-medium`,children:`This cell redefines variables from other cells.`}),f.map(qt),r&&(0,Y.jsx)(X,{errors:f,cellId:r}),(0,Y.jsxs)($,{title:`Why can't I redefine variables?`,children:[(0,Y.jsx)(`p`,{className:`pb-2`,children:`marimo requires that each variable is defined in just one cell. This constraint enables reactive and reproducible execution, arbitrary cell reordering, seamless UI elements, execution as a script, and more.`}),(0,Y.jsxs)(`p`,{className:`py-2`,children:[`Try merging this cell with the mentioned cells or wrapping it in a function. Alternatively, prefix variables with an underscore (e.g., `,(0,Y.jsxs)(z,{className:`inline`,children:[`_`,e]}),`). to make them private to this cell.`]}),(0,Y.jsxs)(`p`,{className:`py-2`,children:[(0,Y.jsxs)(L,{href:`https://links.marimo.app/errors-multiple-definitions`,children:[`Learn more at our docs`,` `,(0,Y.jsx)(V,{size:`0.75rem`,className:`inline`})]}),`.`]})]}),(0,Y.jsx)($,{title:`Need a scratchpad?`,children:(0,Y.jsxs)(`div`,{className:`flex flex-row gap-2 items-center`,children:[(0,Y.jsxs)(I,{size:`xs`,variant:`link`,className:`my-2 font-normal mx-0 px-0`,onClick:te,children:[(0,Y.jsx)(d,{className:`h-3`}),(0,Y.jsx)(`span`,{children:`Try the scratchpad`})]}),(0,Y.jsx)(`span`,{children:`to experiment without restrictions on variable names.`})]})})]},`multiple-defs`))}return x.length>0&&t.push((0,Y.jsxs)(`div`,{children:[x.map(Jt),r&&(0,Y.jsx)(X,{errors:x,cellId:r}),(0,Y.jsxs)($,{title:"Why can't I use `import *`?",children:[(0,Y.jsx)(`p`,{className:`pb-2`,children:`Star imports are incompatible with marimo's git-friendly file format and reproducible reactive execution.`}),(0,Y.jsx)(`p`,{className:`py-2`,children:"marimo's Python file format stores code in functions, so notebooks can be imported as regular Python modules without executing all their code. But Python disallows `import *` everywhere except at the top-level of a module."}),(0,Y.jsx)(`p`,{className:`py-2`,children:`Star imports would also silently add names to globals, which would be incompatible with reactive execution.`}),(0,Y.jsxs)(`p`,{className:`py-2`,children:[(0,Y.jsxs)(L,{href:`https://links.marimo.app/errors-import-star`,children:[`Learn more at our docs`,` `,(0,Y.jsx)(V,{size:`0.75rem`,className:`inline`})]}),`.`]})]})]},`import-star`)),S.length>0&&t.push((0,Y.jsxs)(`div`,{children:[S.map(Yt),r&&(0,Y.jsx)(X,{errors:S,cellId:r})]},`interruption`)),C.length>0&&t.push((0,Y.jsxs)(`ul`,{children:[C.map((e,t)=>{if(e.exception_type===`NameError`&&e.msg.startsWith(`name 'mo'`))return(0,Y.jsx)(`li`,{className:`my-2`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:`name 'mo' is not defined.`}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground mt-2`,children:[`The marimo module (imported as`,` `,(0,Y.jsx)(z,{className:`inline`,children:`mo`}),`) is required for Markdown, SQL, and UI elements.`]})]})},`exception-${t}`);if(e.exception_type===`NameError`&&e.msg.startsWith(`name '_`)){let n=Oe(e.msg);return(0,Y.jsx)(`li`,{className:`my-2`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:(0,Y.jsx)(st,{segments:n})}),(0,Y.jsxs)(`p`,{className:`text-muted-foreground mt-2`,children:[`Variables prefixed with an underscore are local to a cell`,` `,`(`,(0,Y.jsxs)(L,{href:`https://links.marimo.app/local-variables`,children:[`docs`,` `,(0,Y.jsx)(V,{size:`0.75rem`,className:`inline`})]}),`).`]}),s&&(0,Y.jsx)(`div`,{className:`text-muted-foreground mt-2`,children:`See the console area for a traceback.`})]})},`exception-${t}`)}return(0,Y.jsx)(`li`,{className:`my-2`,children:e.raising_cell==null?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:Q(e.msg,`exception-${t}`)}),`traceback`in e&&e.traceback?(0,Y.jsx)(vt,{traceback:e.traceback}):s&&(0,Y.jsx)(`div`,{className:`text-muted-foreground mt-2`,children:`See the console area for a traceback.`})]}):(0,Y.jsxs)(`div`,{children:[Q(e.msg,`exception-${t}`),(0,Y.jsx)(B,{cellId:e.raising_cell}),`traceback`in e&&e.traceback&&(0,Y.jsx)(vt,{traceback:e.traceback})]})},`exception-${t}`)}),C.some(Xt)&&(0,Y.jsx)($,{children:`Fix the error in the mentioned cells, or handle the exceptions with try/except blocks.`}),r&&(0,Y.jsx)(X,{errors:C,cellId:r})]},`exception`)),w.length>0&&t.push((0,Y.jsxs)(`ul`,{children:[w.map(Zt),r&&(0,Y.jsx)(X,{errors:w,cellId:r}),(0,Y.jsx)($,{children:w.some(Qt)?`Ensure that the referenced cells define the required variables, or turn off strict execution.`:`Something is wrong with your declarations. Fix any discrepancies, or turn off strict execution.`})]},`strict-exception`)),T.length>0&&t.push((0,Y.jsxs)(`div`,{children:[T.map($t),r&&(0,Y.jsx)(X,{errors:T,cellId:r})]},`internal`)),E.length>0&&t.push((0,Y.jsxs)(`div`,{children:[E.map(en),r&&(0,Y.jsx)(X,{errors:E,cellId:r})]},`ancestor-prevented`)),D.length>0&&t.push((0,Y.jsxs)(`div`,{children:[D.map(tn),r&&(0,Y.jsx)(X,{errors:D,cellId:r})]},`ancestor-stopped`)),A.length>0&&t.push((0,Y.jsxs)(`div`,{children:[A.map(nn),r&&(0,Y.jsx)(X,{errors:A,cellId:r,className:`mt-2.5`})]},`sql-errors`)),t},M;t[19]===m?M=t[20]:(M=m&&(0,Y.jsxs)(`div`,{className:`flex items-center gap-1 font-code text-[0.6875rem] uppercase tracking-wider text-muted-foreground/70`,children:[m,(0,Y.jsx)(F,{content:`marimo didn't run this cell because it detected an error.`,delayDuration:200,children:(0,Y.jsx)(p,{className:`size-3 cursor-help`})})]}),t[19]=m,t[20]=M);let N;t[21]!==u||t[22]!==c?(N=c&&(0,Y.jsx)(ve,{className:`font-code font-medium ${u}`,children:c}),t[21]=u,t[22]=c,t[23]=N):N=t[23];let P;t[24]!==M||t[25]!==N?(P=(0,Y.jsxs)(`div`,{className:`space-y-0.5`,children:[M,N]}),t[24]=M,t[25]=N,t[26]=P):P=t[26];let re=P;h=ye,v=l,t[27]===a?y=t[28]:(y=ee(`border-none font-code text-sm text-[0.84375rem] p-0 text-muted-foreground normal has-[svg]:pl-0 space-y-2`,a),t[27]=a,t[28]=y),b=re,g=`flex flex-col gap-4`,_=ne(),t[2]=l,t[3]=r,t[4]=o,t[5]=a,t[6]=n,t[7]=s,t[8]=m,t[9]=u,t[10]=c,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b}else h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16];let x;t[29]!==g||t[30]!==_?(x=(0,Y.jsx)(`div`,{className:g,children:_}),t[29]=g,t[30]=_,t[31]=x):x=t[31];let S;return t[32]!==h||t[33]!==v||t[34]!==y||t[35]!==b||t[36]!==x?(S=(0,Y.jsxs)(h,{variant:v,className:y,children:[b,x]}),t[32]=h,t[33]=v,t[34]=y,t[35]=b,t[36]=x,t[37]=S):S=t[37],S};function bt(e){return e.type===`interruption`}function xt(e){return e.type===`internal`}function St(e){return e.type===`ancestor-prevented`}function Ct(e){return e.type===`ancestor-stopped`}function wt(e){return e.type===`sql-error`}function Tt(e){return e.type===`multiple-defs`||e.type===`cycle`||e.type===`setup-refs`||e.type===`import-star`}function Et(e){return e.type===`exception`}function Dt(e){return e.type===`setup-refs`}function Ot(e){return e.type===`cycle`}function kt(e){return e.type===`multiple-defs`}function At(e){return e.type===`import-star`}function jt(e){return e.type===`interruption`}function Mt(e){return e.type===`exception`}function Nt(e){return e.type===`strict-exception`}function Pt(e){return e.type===`internal`}function Ft(e){return e.type===`ancestor-prevented`}function It(e){return e.type===`ancestor-stopped`}function Lt(e){return e.type===`syntax`}function Rt(e){return e.type===`unknown`}function zt(e){return e.type===`sql-error`}function Bt(e){return e.msg.includes(`!pip`)}function Vt(e){return e.msg.includes(`use os.subprocess`)}function Ht(e,t){return(0,Y.jsx)(`pre`,{children:Q(e.msg,`syntax-${t}`)},`syntax-${t}`)}function Ut(e,t){return(0,Y.jsx)(`pre`,{children:Q(e.msg,`unknown-${t}`)},`unknown-${t}`)}function Wt(e,t){return e.edges_with_vars.map((e,n)=>(0,Y.jsxs)(`li`,{className:`my-0.5 ml-8 text-muted-foreground/40`,children:[(0,Y.jsx)(B,{cellId:e[0]}),(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[`: `,` `,e[1].length===1?e[1][0]:e[1].join(`, `)]})]},`setup-refs-${t}-${n}`))}function Gt(e,t){return e.edges_with_vars.map((e,n)=>(0,Y.jsxs)(`li`,{className:`my-0.5 ml-8 text-muted-foreground/40`,children:[(0,Y.jsx)(B,{cellId:e[0]}),(0,Y.jsxs)(`span`,{className:`text-muted-foreground`,children:[` -> `,e[1].length===1?e[1][0]:e[1].join(`, `),` -> `]}),(0,Y.jsx)(B,{cellId:e[2]})]},`cycle-${t}-${n}`))}function Kt(e,t){return(0,Y.jsx)(`li`,{className:`my-0.5 ml-8 text-muted-foreground/40`,children:(0,Y.jsx)(B,{cellId:e})},`cell-${t}`)}function qt(e,t){return(0,Y.jsxs)(H.Fragment,{children:[(0,Y.jsx)(`p`,{className:`text-muted-foreground mt-2`,children:`'${e.name}' was also defined by:`}),(0,Y.jsx)(`ul`,{className:`list-disc`,children:e.cells.map(Kt)})]},`multiple-defs-${t}`)}function Jt(e,t){return(0,Y.jsx)(`p`,{className:`text-muted-foreground`,children:e.msg},`import-star-${t}`)}function Yt(e,t){return(0,Y.jsx)(`p`,{children:`This cell was interrupted and needs to be re-run.`},`interruption-${t}`)}function Xt(e){return e.raising_cell!=null}function Zt(e,t){return(0,Y.jsx)(`li`,{className:`my-2`,children:e.blamed_cell==null?(0,Y.jsx)(`p`,{children:e.msg}):(0,Y.jsxs)(`div`,{children:[e.msg,(0,Y.jsx)(B,{cellId:e.blamed_cell})]})},`strict-exception-${t}`)}function Qt(e){return e.blamed_cell!=null}function $t(e,t){return(0,Y.jsx)(`p`,{children:e.msg},`internal-${t}`)}function en(e,t){return(0,Y.jsxs)(`div`,{children:[e.msg,e.blamed_cell==null?(0,Y.jsxs)(`span`,{children:[`(`,(0,Y.jsx)(B,{cellId:e.raising_cell}),`)`]}):(0,Y.jsxs)(`span`,{children:[`(`,(0,Y.jsx)(B,{cellId:e.raising_cell}),`\xA0blames\xA0`,(0,Y.jsx)(B,{cellId:e.blamed_cell}),`)`]})]},`ancestor-prevented-${t}`)}function tn(e,t){return(0,Y.jsxs)(`div`,{children:[e.msg,(0,Y.jsx)(B,{cellId:e.raising_cell})]},`ancestor-stopped-${t}`)}function nn(e,t){return(0,Y.jsx)(`div`,{className:`space-y-2 mt-2`,children:(0,Y.jsx)(`p`,{className:`text-muted-foreground whitespace-pre-wrap`,children:e.msg})},`sql-error-${t}`)}export{we as S,Ve as _,tt as a,ke as b,Le as c,Ue as d,Ge as f,Pe as g,Re as h,it as i,q as l,He as m,_t as n,Ze as o,We as p,st as r,Je as s,yt as t,Ke as u,Be as v,Oe as x,ze as y};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{f as t,l as n,r}from"./useEvent-xfs0Sn4r.js";import{t as i}from"./react-CBDbhulC.js";import{Gr as a,Ir as o,ao as s,mt as c,oo as l,p as u}from"./cells-B1S_6FG3.js";import{t as d}from"./compiler-runtime-CYIjoINj.js";import{g as f}from"./useEventListener-D27Dii_l.js";import{c as p}from"./utils-R_pHe-RB.js";import{E as m}from"./config-CUBl5qBg.js";import{t as h}from"./jsx-runtime-B74pBk57.js";import{t as g}from"./tooltip-D7dq6bnc.js";import{U as _}from"./input-DeyycFtq.js";import{n as v}from"./useDebounce-Dulm61-t.js";import{t as y}from"./copy-icon-LPQzn7_f.js";import{t as b}from"./useRunCells-DHnbXALT.js";var x=d(),S=e(i(),1),C=h(),w=e=>{let t=(0,x.c)(16),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({href:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=(0,S.useRef)(null),o;t[4]===r?o=t[5]:(o=()=>{let e=new URL(globalThis.location.href);e.hash=r,globalThis.history.pushState({},``,e.toString()),globalThis.dispatchEvent(new HashChangeEvent(`hashchange`));let t=r.slice(1),n=document.getElementById(t);n&&n.scrollIntoView({behavior:`smooth`,block:`start`})},t[4]=r,t[5]=o);let s=o,c;t[6]===s?c=t[7]:(c={onPress:()=>{s()}},t[6]=s,t[7]=c);let{pressProps:l}=_(c),u;t[8]===s?u=t[9]:(u=e=>{e.preventDefault(),s()},t[8]=s,t[9]=u);let d=u,f;return t[10]!==n||t[11]!==d||t[12]!==r||t[13]!==l||t[14]!==i?(f=(0,C.jsx)(`a`,{ref:a,href:r,...l,onClick:d,...i,children:n}),t[10]=n,t[11]=d,t[12]=r,t[13]=l,t[14]=i,t[15]=f):f=t[15],f};async function T(e){let t=u().inOrderIds.at(0);if(t)try{let n=await o.request({document:e,cellId:t});if(!n||n.options.length===0)return;let i=e.split(`.`).pop()??e,s=n.options[0],c=n.options.find(e=>e.name===i)??s;c?.completion_info&&r.set(a,{documentation:c.completion_info})}catch(t){f.debug(`Doc lookup failed for "${e}"`,t)}}var E=e=>{let t=(0,x.c)(8),{qualifiedName:n,children:r}=e,i;t[0]===n?i=t[1]:(i=()=>{T(n)},t[0]=n,t[1]=i);let a=v(i,100),o;t[2]===a?o=t[3]:(o=()=>a.cancel(),t[2]=a,t[3]=o);let s;return t[4]!==r||t[5]!==a||t[6]!==o?(s=(0,C.jsx)(`span`,{onMouseEnter:a,onMouseLeave:o,children:r}),t[4]=r,t[5]=a,t[6]=o,t[7]=s):s=t[7],s};function D(e){if(typeof e!=`object`||!e)return!1;let t=e;return!(t.trusted!==!0||t.notebookCode!==void 0&&typeof t.notebookCode!=`string`)}function O(){let e=window?.__MARIMO_EXPORT_CONTEXT__;return D(e)?e:void 0}function k(){return O()?.trusted===!0}function A(){if(r.get(b)||k()||r.get(p))return!0;try{if(m()===`read`)return!0}catch{}return!1}var j=t(e=>{let t=e(b),n=e(p);if(t||n||k())return!1;let r=!0;try{r=m()===`read`}catch{return!0}return!r});function M(){return n(j)}var N=e=>{if(e instanceof l.Element&&!/^[A-Za-z][\w-]*$/.test(e.name))return S.createElement(S.Fragment)},P=(e,t)=>{if(t instanceof l.Element&&t.name===`body`){if((0,S.isValidElement)(e)&&`props`in e){let t=e.props.children;return(0,C.jsx)(C.Fragment,{children:t})}return}},F=(e,t)=>{if(t instanceof l.Element&&t.name===`html`){if((0,S.isValidElement)(e)&&`props`in e){let t=e.props.children;return(0,C.jsx)(C.Fragment,{children:t})}return}},I=e=>{if(e instanceof l.Element&&e.attribs&&e.name===`iframe`){let t=document.createElement(`iframe`);return Object.entries(e.attribs).forEach(([e,n])=>{e.startsWith(`"`)&&e.endsWith(`"`)&&(e=e.slice(1,-1)),t.setAttribute(e,n)}),(0,C.jsx)(`div`,{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},L=e=>{if(e instanceof l.Element&&e.name===`script`){let t=e.attribs.src;if(!t)return;if(!A())return f.warn(`[RenderHTML] refusing <script src> in untrusted context: ${t}`),(0,C.jsx)(C.Fragment,{});if(![...document.querySelectorAll(`script[src]`)].some(e=>e.getAttribute(`src`)===t)){let e=document.createElement(`script`);e.src=t,document.head.append(e)}return(0,C.jsx)(C.Fragment,{})}},R=(e,t)=>{if(t instanceof l.Element&&t.name===`a`){let n=t.attribs.href;if(n?.startsWith(`#`)&&!n.startsWith(`#code/`)){let r=null;return(0,S.isValidElement)(e)&&`props`in e&&(r=e.props.children),(0,C.jsx)(w,{href:n,...t.attribs,children:r})}}},z=(e,t,n)=>{if(t instanceof l.Element&&t.name===`div`&&t.attribs?.class?.includes(`codehilite`))return(0,C.jsx)(W,{children:e},n)},B=(e,t,n)=>{if(!(t instanceof l.Element)||t.name!==`img`)return;let r=t.attribs?.src;if(!(!r||!(0,S.isValidElement)(e))&&!/^data:/i.test(r))return(0,S.cloneElement)(e,{key:`${r}-${n}`})},V=(e,t,n)=>{if(!(t instanceof l.Element)||t.name!==`input`||t.attribs?.type!==`checkbox`||!(0,S.isValidElement)(e))return;let r=`checked`in t.attribs;return(0,S.cloneElement)(e,{key:`checkbox-${n}-${r}`})},H=(e,t)=>{if(t instanceof l.Element&&t.attribs?.[`data-marimo-doc`]){let n=t.attribs[`data-marimo-doc`];return(0,C.jsx)(E,{qualifiedName:n,children:e})}},U=(e,t)=>{if(t instanceof l.Element&&t.attribs?.[`data-tooltip`]){if((t.name?.toLowerCase()??``).startsWith(`marimo-`))return;let n=t.attribs[`data-tooltip`];return(0,C.jsx)(g,{content:n,children:e})}},W=e=>{let t=(0,x.c)(3),{children:n}=e,r=(0,S.useRef)(null),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,C.jsx)(`div`,{className:`absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity`,children:(0,C.jsx)(y,{tooltip:!1,className:`p-1`,value:()=>{let e=r.current?.firstChild;return e&&e.textContent||``}})}),t[0]=i):i=t[0];let a;return t[1]===n?a=t[2]:(a=(0,C.jsxs)(`div`,{className:`relative group codehilite-wrapper`,ref:r,children:[n,i]}),t[1]=n,t[2]=a),a},G=({html:e,additionalReplacements:t=[],alwaysSanitizeHtml:n=!0})=>(0,C.jsx)(K,{html:e,alwaysSanitizeHtml:n,additionalReplacements:t}),K=e=>{let t=(0,x.c)(7),{html:n,additionalReplacements:r,alwaysSanitizeHtml:i}=e,a;t[0]===r?a=t[1]:(a=r===void 0?[]:r,t[0]=r,t[1]=a);let o=a,s=M(),l;bb0:{if(i||s){let e;t[2]===n?e=t[3]:(e=c(n),t[2]=n,t[3]=e),l=e;break bb0}l=n}let u=l,d;return t[4]!==o||t[5]!==u?(d=q({html:u,additionalReplacements:o}),t[4]=o,t[5]=u,t[6]=d):d=t[6],d};function q({html:e,additionalReplacements:t=[]}){let n=[N,I,L,...t],r=[z,R,H,U,P,F],i=[B,V];return s(e,{replace:(e,t)=>{for(let r of n){let n=r(e,t);if(n)return n}return e},transform:(e,t,n)=>{let a=e;for(let e of r){let r=e(a,t,n);if(r){a=r;break}}for(let e of i){let r=e(a,t,n);r&&(a=r)}return a}})}export{k as n,G as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-CBDbhulC.js";import{t as n}from"./compiler-runtime-CYIjoINj.js";import{_ as r}from"./useEventListener-D27Dii_l.js";import{h as i,u as a}from"./config-CUBl5qBg.js";import{n as o,t as s}from"./cn-ldLVeaqm.js";import{t as c}from"./jsx-runtime-B74pBk57.js";import{t as l}from"./tooltip-D7dq6bnc.js";import{r as u}from"./button-BMBznEru.js";import{r as d}from"./requests-C6_IaFh7.js";import{t as f}from"./createLucideIcon-B7HeEoG2.js";import{i as p}from"./useDeleteCell-CSCMg7Up.js";import{$ as m,Ft as h,It as g,Mt as _,Nt as v,Ut as y,et as b,it as x,jt as S}from"./input-DeyycFtq.js";import{t as C}from"./square-B58Ib8Ir.js";import{o as w}from"./VisuallyHidden-DurJ_JBW.js";import{t as T}from"./context-Do8M9TDF.js";import{a as E}from"./renderShortcut-D9XYVNe3.js";var D=f(`hard-drive-download`,[[`path`,{d:`M12 2v8`,key:`1q4o3n`}],[`path`,{d:`m16 6-4 4-4-4`,key:`6wukr`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M10 18h.01`,key:`h775k`}]]),O=e(t(),1);function k(e,t){let{"aria-label":n,"aria-labelledby":r,orientation:i=`horizontal`}=e,[a,o]=(0,O.useState)(!1);y(()=>{o(!!(t.current&&t.current.parentElement?.closest(`[role="toolbar"]`)))});let{direction:s}=T(),c=s===`rtl`&&i===`horizontal`,l=w(t),u=e=>{if(v(e.currentTarget,g(e))){if(i===`horizontal`&&e.key===`ArrowRight`||i===`vertical`&&e.key===`ArrowDown`)c?l.focusPrevious():l.focusNext();else if(i===`horizontal`&&e.key===`ArrowLeft`||i===`vertical`&&e.key===`ArrowUp`)c?l.focusNext():l.focusPrevious();else if(e.key===`Tab`){e.stopPropagation(),d.current=h(),e.shiftKey?l.focusFirst():l.focusLast();return}else return;e.stopPropagation(),e.preventDefault()}},d=(0,O.useRef)(null),f=e=>{!v(e.currentTarget,e.relatedTarget)&&!d.current&&(d.current=g(e))},p=e=>{if(d.current&&!v(e.currentTarget,e.relatedTarget)&&v(t.current,g(e))){var n;(n=d.current)==null||n.focus(),d.current=null}};return{toolbarProps:{...S(e,{labelable:!0}),role:a?`group`:`toolbar`,"aria-orientation":i,"aria-label":n,"aria-labelledby":n==null?r:void 0,onKeyDownCapture:a?void 0:u,onFocusCapture:a?void 0:p,onBlurCapture:a?void 0:f}}}var A=(0,O.createContext)({}),j=(0,O.forwardRef)(function(e,t){[e,t]=m(e,t,A);let{toolbarProps:n}=k(e,t),r=b({...e,values:{orientation:e.orientation||`horizontal`},defaultClassName:`react-aria-Toolbar`}),i=S(e,{global:!0});return delete i.id,O.createElement(x.div,{..._(i,r,n),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`horizontal`},r.children)}),M=c(),N=n(),P=200;function F(e){let t=(0,N.c)(3),[n,r]=(0,O.useState)(!1),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;r(!1);let t=setTimeout(()=>{r(!0)},P);return()=>clearTimeout(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,O.useEffect)(i,a),e&&n}var I=o(`rounded-full shadow-xs-solid border p-[5px] transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>svg]:size-3 active:shadow-none bg-background`,{variants:{variant:{default:`hover:bg-accent hover:text-accent-foreground`,stale:`bg-(--yellow-3) hover:bg-(--yellow-4) text-(--yellow-11)`,green:`hover:bg-(--grass-2) hover:text-(--grass-11) hover:border-[var(--grass-7)],`,disabled:`opacity-50 cursor-not-allowed`,danger:`hover:bg-(--red-3) hover:text-(--red-11)`}},defaultVariants:{variant:`default`}}),L=e=>{let t=(0,N.c)(18),n,r,i,a,o,c,d;if(t[0]!==e){let{children:l,tooltip:f,disabled:p,variant:m,...h}=e;n=l,d=f;let g=p!==void 0&&p;r=g,i=h,a=e=>{g||h.onClick?.(e)},o=u.preventFocus,c=s(I({variant:m}),h.className),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=d}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],d=t[7];let f;t[8]!==n||t[9]!==r||t[10]!==i||t[11]!==a||t[12]!==o||t[13]!==c?(f=(0,M.jsx)(`button`,{disabled:r,...i,onClick:a,onMouseDown:o,className:c,children:n}),t[8]=n,t[9]=r,t[10]=i,t[11]=a,t[12]=o,t[13]=c,t[14]=f):f=t[14];let p=f;if(d){let e;return t[15]!==p||t[16]!==d?(e=(0,M.jsx)(l,{content:d,side:`top`,delayDuration:200,usePortal:!1,children:p}),t[15]=p,t[16]=d,t[17]=e):e=t[17],e}return p},R=e=>{let t=(0,N.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=s(`flex items-center gap-1 bg-background m-[2px] rounded-full`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,M.jsx)(j,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},z=e=>{let t=(0,N.c)(9),{connectionState:n,status:a}=e,{sendInterrupt:o}=d(),s=F(a===`running`),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=E(`global.interrupt`),t[0]=c):c=t[0];let l;t[1]!==n||t[2]!==s?(l=i(n)||!s,t[1]=n,t[2]=s,t[3]=l):l=t[3];let u=s?o:r.NOOP,f=s?`stale`:`disabled`,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,M.jsx)(C,{strokeWidth:1.5}),t[4]=p):p=t[4];let m;return t[5]!==l||t[6]!==u||t[7]!==f?(m=(0,M.jsx)(L,{tooltip:c,disabled:l,onClick:u,variant:f,"data-testid":`run-button`,children:p}),t[5]=l,t[6]=u,t[7]=f,t[8]=m):m=t[8],m};function B({connectionState:e,needsRun:t,loading:n,inactive:r}){return i(e)?`disabled`:t&&!n?`stale`:n||r?`disabled`:`green`}var V=e=>{let t=(0,N.c)(27),{onClick:n,connectionState:r,needsRun:o,status:s,config:c,edited:l}=e,u=s===`disabled-transitively`,d=s===`running`||s===`queued`,f,m;t[0]!==u||t[1]!==c.disabled||t[2]!==r||t[3]!==l||t[4]!==d||t[5]!==o?(f=i(r)||d||!c.disabled&&u&&!l,m=B({connectionState:r,needsRun:o,loading:d,inactive:f}),t[0]=u,t[1]=c.disabled,t[2]=r,t[3]=l,t[4]=d,t[5]=o,t[6]=f,t[7]=m):(f=t[6],m=t[7]);let h=m;if(c.disabled){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,M.jsx)(D,{}),t[8]=e):e=t[8];let r;return t[9]!==f||t[10]!==n||t[11]!==h?(r=(0,M.jsx)(L,{tooltip:`Add code to notebook`,disabled:f,onClick:n,variant:h,"data-testid":`run-button`,children:e}),t[9]=f,t[10]=n,t[11]=h,t[12]=r):r=t[12],r}if(!c.disabled&&u&&!l){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,M.jsx)(p,{strokeWidth:1.2}),t[13]=e):e=t[13];let r;return t[14]!==f||t[15]!==n||t[16]!==h?(r=(0,M.jsx)(L,{disabled:f,tooltip:`This cell can't be run because it has a disabled ancestor`,onClick:n,variant:h,"data-testid":`run-button`,children:e}),t[14]=f,t[15]=n,t[16]=h,t[17]=r):r=t[17],r}let g;if(i(r)){let e;t[18]===r?e=t[19]:(e=a(r),t[18]=r,t[19]=e),g=e}else if(s===`queued`)g=`This cell is already queued to run`;else if(s===`running`)g=`This cell is already running.`;else{let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=E(`cell.run`),t[20]=e):e=t[20],g=e}let _;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,M.jsx)(p,{strokeWidth:1.2}),t[21]=_):_=t[21];let v;return t[22]!==f||t[23]!==n||t[24]!==g||t[25]!==h?(v=(0,M.jsx)(L,{tooltip:g,disabled:f,onClick:n,variant:h,"data-testid":`run-button`,children:_}),t[22]=f,t[23]=n,t[24]=g,t[25]=h,t[26]=v):v=t[26],v};export{F as a,L as i,z as n,R as r,V as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{t}from"./react-CBDbhulC.js";import{Ct as n,Dt as r,Et as i,Ft as a,It as o,Lt as s,Mt as c,Nt as l,P as u,R as d,Rt as f,Ut as p,ht as m,kt as ee,lt as h,ut as g,z as te,zt as ne}from"./input-DeyycFtq.js";import{t as _}from"./context-Do8M9TDF.js";var v=e(t(),1),y=(0,v.createContext)(null);(0,v.createContext)(null),(0,v.createContext)(null),(0,v.createContext)(null),(0,v.createContext)(null);var b=(0,v.createContext)({}),re=(0,v.createContext)(null);(0,v.createContext)(null);var x=class{get currentNode(){return this._currentNode}set currentNode(e){if(!l(this.root,e))throw Error(`Cannot set currentNode to a node that is not contained by the root node.`);let t=[],n=e,r=e;for(this._currentNode=e;n&&n!==this.root;)if(n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let e=n,i=this._doc.createTreeWalker(e,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),n=r=e.host}else n=n.parentNode;let i=this._doc.createTreeWalker(this.root,this.whatToShow,{acceptNode:this._acceptNode});t.push(i),i.currentNode=r,this._currentSetFor.add(i),this._walkerStack=t}get doc(){return this._doc}firstChild(){let e=this.currentNode,t=this.nextNode();return l(e,t)?(t&&(this.currentNode=t),t):(this.currentNode=e,null)}lastChild(){let e=this._walkerStack[0].lastChild();return e&&(this.currentNode=e),e}nextNode(){let e=this._walkerStack[0].nextNode();if(e){if(e.shadowRoot){let t;if(typeof this.filter==`function`?t=this.filter(e):this.filter?.acceptNode&&(t=this.filter.acceptNode(e)),t===NodeFilter.FILTER_ACCEPT)return this.currentNode=e,e;let n=this.nextNode();return n&&(this.currentNode=n),n}return e&&(this.currentNode=e),e}if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.nextNode();return e&&(this.currentNode=e),e}return null}previousNode(){let e=this._walkerStack[0];if(e.currentNode===e.root){if(this._currentSetFor.has(e)){if(this._currentSetFor.delete(e),this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}return null}return null}let t=e.previousNode();if(t){if(t.shadowRoot){let e;if(typeof this.filter==`function`?e=this.filter(t):this.filter?.acceptNode&&(e=this.filter.acceptNode(t)),e===NodeFilter.FILTER_ACCEPT)return t&&(this.currentNode=t),t;let n=this.lastChild();return n&&(this.currentNode=n),n}return t&&(this.currentNode=t),t}if(this._walkerStack.length>1){this._walkerStack.shift();let e=this.previousNode();return e&&(this.currentNode=e),e}return null}nextSibling(){return null}previousSibling(){return null}parentNode(){return null}constructor(e,t,n,r){this._walkerStack=[],this._currentSetFor=new Set,this._acceptNode=e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e.shadowRoot;if(t){let e=this._doc.createTreeWalker(t,this.whatToShow,{acceptNode:this._acceptNode});return this._walkerStack.unshift(e),NodeFilter.FILTER_ACCEPT}if(typeof this.filter==`function`)return this.filter(e);if(this.filter?.acceptNode)return this.filter.acceptNode(e);if(this.filter===null)return NodeFilter.FILTER_ACCEPT}return NodeFilter.FILTER_SKIP},this._doc=e,this.root=t,this.filter=r??null,this.whatToShow=n??NodeFilter.SHOW_ALL,this._currentNode=t,this._walkerStack.unshift(e.createTreeWalker(t,n,this._acceptNode));let i=t.shadowRoot;if(i){let e=this._doc.createTreeWalker(i,this.whatToShow,{acceptNode:this._acceptNode});this._walkerStack.unshift(e)}}};function S(e,t,n,r){return s()?new x(e,t,n,r):e.createTreeWalker(t,n,r)}function C(e,t){let n=(0,v.useRef)(!0),r=(0,v.useRef)(null),i=m(e);(0,v.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]),(0,v.useEffect)(()=>{let e=r.current;n.current?n.current=!1:(!e||t.some((t,n)=>!Object.is(t,e[n])))&&i(),r.current=t},t)}function w(e,t){if(!e)return!1;let n=window.getComputedStyle(e),r=document.scrollingElement||document.documentElement,i=/(auto|scroll)/.test(n.overflow+n.overflowX+n.overflowY);return e===r&&n.overflow!==`hidden`&&(i=!0),i&&t&&(i=e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth),i}function T(e,t){let n=e;for(w(n,t)&&(n=n.parentElement);n&&!w(n,t);)n=n.parentElement;return n||document.scrollingElement||document.documentElement}function E(e,t){let n=[],r=document.scrollingElement||document.documentElement;do w(e,t)&&n.push(e),e=e.parentElement;while(e&&e!==r);return n}function D(e){return i()?e.metaKey:e.ctrlKey}var O=new Set([`checkbox`,`radio`,`range`,`color`,`file`,`image`,`button`,`submit`,`reset`]);function ie(e){return e instanceof HTMLInputElement&&!O.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}var k=0,A=new Map;function j(e){let[t,n]=(0,v.useState)();return p(()=>{if(!e)return;let t=A.get(e);if(t)n(t.element.id);else{let r=`react-aria-description-${k++}`;n(r);let i=document.createElement(`div`);i.id=r,i.style.display=`none`,i.textContent=e,document.body.appendChild(i),t={refCount:0,element:i},A.set(e,t)}return t.refCount++,()=>{t&&--t.refCount===0&&(t.element.remove(),A.delete(e))}},[e]),{"aria-describedby":e?t:void 0}}function M(e,t,n={}){let{block:r=`nearest`,inline:i=`nearest`}=n;if(e===t)return;let a=e.scrollTop,o=e.scrollLeft,s=t.getBoundingClientRect(),c=e.getBoundingClientRect(),l=window.getComputedStyle(t),u=window.getComputedStyle(e),d=document.scrollingElement||document.documentElement,f=e===d?0:c.top,p=e===d?e.clientHeight:c.bottom,m=e===d?0:c.left,h=e===d?e.clientWidth:c.right,g=parseInt(l.scrollMarginTop,10)||0,te=parseInt(l.scrollMarginBottom,10)||0,ne=parseInt(l.scrollMarginLeft,10)||0,_=parseInt(l.scrollMarginRight,10)||0,v=parseInt(u.scrollPaddingTop,10)||0,y=parseInt(u.scrollPaddingBottom,10)||0,b=parseInt(u.scrollPaddingLeft,10)||0,re=parseInt(u.scrollPaddingRight,10)||0,x=parseInt(u.borderTopWidth,10)||0,S=parseInt(u.borderBottomWidth,10)||0,C=parseInt(u.borderLeftWidth,10)||0,w=parseInt(u.borderRightWidth,10)||0,T=s.top-g,E=s.bottom+te,D=s.left-ne,O=s.right+_,ie=e===d?0:C+w,k=e===d?0:x+S,A=e.offsetWidth-e.clientWidth-ie,j=e.offsetHeight-e.clientHeight-k,M=f+x+v,N=p-S-y-j,P=m+C+b,F=h-w-re;u.direction===`rtl`&&!ee()?P+=A:F-=A;let I=T<M||E>N,L=D<P||O>F;if(I&&r===`start`)a+=T-M;else if(I&&r===`center`)a+=(T+E)/2-(M+N)/2;else if(I&&r===`end`)a+=E-N;else if(I&&r===`nearest`){let e=T-M,t=E-N;a+=Math.abs(e)<=Math.abs(t)?e:t}if(L&&i===`start`)o+=D-P;else if(L&&i===`center`)o+=(D+O)/2-(P+F)/2;else if(L&&i===`end`)o+=O-F;else if(L&&i===`nearest`){let e=D-P,t=O-F;o+=Math.abs(e)<=Math.abs(t)?e:t}e.scrollTo({left:o,top:a})}function N(e,t={}){let{containingElement:r}=t;if(e&&e.isConnected){let t=document.scrollingElement||document.documentElement;if(window.getComputedStyle(t).overflow!==`hidden`&&!n()){var i;let{left:t,top:n}=e.getBoundingClientRect();e==null||(i=e.scrollIntoView)==null||i.call(e,{block:`nearest`});let{left:s,top:c}=e.getBoundingClientRect();if(Math.abs(t-s)>1||Math.abs(n-c)>1){var a,o;r==null||(a=r.scrollIntoView)==null||a.call(r,{block:`center`,inline:`center`}),(o=e.scrollIntoView)==null||o.call(e,{block:`nearest`})}}else{let{left:t,top:n}=e.getBoundingClientRect(),i=E(e,!0);for(let t of i)M(t,e);let{left:a,top:o}=e.getBoundingClientRect();if(Math.abs(t-a)>1||Math.abs(n-o)>1){i=r?E(r,!0):[];for(let e of i)M(e,r,{block:`center`,inline:`center`})}}}}var P=new Map;function F(e){let{locale:t}=_(),n=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():``);if(P.has(n))return P.get(n);let r=new Intl.Collator(t,e);return P.set(n,r),r}var I=v.createContext(null),L=`react-aria-focus-scope-restore`,R=null;function ae(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,o=(0,v.useRef)(null),s=(0,v.useRef)(null),c=(0,v.useRef)([]),{parentNode:l}=(0,v.useContext)(I)||{},u=(0,v.useMemo)(()=>new Q({scopeRef:c}),[c]);p(()=>{let e=l||$.root;if($.getTreeNode(e.scopeRef)&&R&&!W(R,e.scopeRef)){let t=$.getTreeNode(R);t&&(e=t)}e.addChild(u),$.addNode(u)},[u,l]),p(()=>{let e=$.getTreeNode(c);e&&(e.contain=!!n)},[n]),p(()=>{let e=o.current?.nextSibling,t=[],n=e=>e.stopPropagation();for(;e&&e!==s.current;)t.push(e),e.addEventListener(L,n),e=e.nextSibling;return c.current=t,()=>{for(let e of t)e.removeEventListener(L,n)}},[t]),fe(c,r,n),le(c,n),pe(c,r,n),de(c,i),(0,v.useEffect)(()=>{let e=a(f(c.current?c.current[0]:void 0)),t=null;if(H(e,c.current)){for(let n of $.traverse())n.scopeRef&&H(e,n.scopeRef.current)&&(t=n);t===$.getTreeNode(c)&&(R=t.scopeRef)}},[c]),p(()=>()=>{let e=$.getTreeNode(c)?.parent?.scopeRef??null;(c===R||W(c,R))&&(!e||$.getTreeNode(e))&&(R=e),$.removeTreeNode(c)},[c]);let d=(0,v.useMemo)(()=>oe(c),[]),m=(0,v.useMemo)(()=>({focusManager:d,parentNode:u}),[u,d]);return v.createElement(I.Provider,{value:m},v.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:o}),t,v.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:s}))}function oe(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||a(f(n[0]??void 0)),l=n[0].previousElementSibling,u=X(z(n),{tabbable:i,accept:s},n);u.currentNode=H(c,n)?c:l;let d=u.nextNode();return!d&&o&&(u.currentNode=l,d=u.nextNode()),d&&G(d,!0),d},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:o,accept:s}=t,c=r||a(f(n[0]??void 0)),l=n[n.length-1].nextElementSibling,u=X(z(n),{tabbable:i,accept:s},n);u.currentNode=H(c,n)?c:l;let d=u.previousNode();return!d&&o&&(u.currentNode=l,d=u.previousNode()),d&&G(d,!0),d},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=X(z(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&G(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=X(z(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&G(o,!0),o}}}function z(e){return e[0].parentElement}function B(e){let t=$.getTreeNode(R);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function se(e){if(!e.form)return Array.from(f(e).querySelectorAll(`input[type="radio"][name="${CSS.escape(e.name)}"]`)).filter(e=>!e.form);let t=e.form.elements.namedItem(e.name),n=ne(e);return t instanceof n.RadioNodeList?Array.from(t).filter(e=>e instanceof n.HTMLInputElement):t instanceof n.HTMLInputElement?[t]:[]}function ce(e){if(e.checked)return!0;let t=se(e);return t.length>0&&!t.some(e=>e.checked)}function le(e,t){let i=(0,v.useRef)(void 0),s=(0,v.useRef)(void 0);p(()=>{let c=e.current;if(!t){s.current&&=(cancelAnimationFrame(s.current),void 0);return}let l=f(c?c[0]:void 0),u=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!B(e)||t.isComposing)return;let n=a(l),r=e.current;if(!r||!H(n,r))return;let i=X(z(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let o=t.shiftKey?i.previousNode():i.nextNode();o||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),o&&G(o,!0)},d=t=>{(!R||W(R,e))&&H(o(t),e.current)?(R=e,i.current=o(t)):B(e)&&!U(o(t),e)?i.current?i.current.focus():R&&R.current&&q(R.current):B(e)&&(i.current=o(t))},p=t=>{s.current&&cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{let s=te(),c=(s===`virtual`||s===null)&&r()&&n(),u=a(l);if(!c&&u&&B(e)&&!U(u,e)){R=e;let n=o(t);if(n&&n.isConnected){var d;i.current=n,(d=i.current)==null||d.focus()}else R.current&&q(R.current)}})};return l.addEventListener(`keydown`,u,!1),l.addEventListener(`focusin`,d,!1),c?.forEach(e=>e.addEventListener(`focusin`,d,!1)),c?.forEach(e=>e.addEventListener(`focusout`,p,!1)),()=>{l.removeEventListener(`keydown`,u,!1),l.removeEventListener(`focusin`,d,!1),c?.forEach(e=>e.removeEventListener(`focusin`,d,!1)),c?.forEach(e=>e.removeEventListener(`focusout`,p,!1))}},[e,t]),p(()=>()=>{s.current&&cancelAnimationFrame(s.current)},[s])}function V(e){return U(e)}function H(e,t){return!e||!t?!1:t.some(t=>l(t,e))}function U(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of $.traverse($.getTreeNode(t)))if(n&&H(e,n.current))return!0;return!1}function ue(e){return U(e,R)}function W(e,t){let n=$.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function G(e,t=!1){if(e!=null&&!t)try{d(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function K(e,t=!0){let n=e[0].previousElementSibling,r=z(e),i=X(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();return t&&!a&&(r=z(e),i=X(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),a}function q(e,t=!0){G(K(e,t))}function de(e,t){let n=v.useRef(t);(0,v.useEffect)(()=>{if(n.current){R=e;let t=f(e.current?e.current[0]:void 0);!H(a(t),R.current)&&e.current&&q(e.current)}n.current=!1},[e])}function fe(e,t,n){p(()=>{if(t||n)return;let r=e.current,i=f(r?r[0]:void 0),a=t=>{let n=o(t);H(n,e.current)?R=e:V(n)||(R=null)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,t,n])}function J(e){let t=$.getTreeNode(R);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function pe(e,t,n){let r=(0,v.useRef)(typeof document<`u`?a(f(e.current?e.current[0]:void 0)):null);p(()=>{let r=e.current,i=f(r?r[0]:void 0);if(!t||n)return;let o=()=>{(!R||W(R,e))&&H(a(i),e.current)&&(R=e)};return i.addEventListener(`focusin`,o,!1),r?.forEach(e=>e.addEventListener(`focusin`,o,!1)),()=>{i.removeEventListener(`focusin`,o,!1),r?.forEach(e=>e.removeEventListener(`focusin`,o,!1))}},[e,n]),p(()=>{let r=f(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!B(e)||t.isComposing)return;let n=r.activeElement;if(!U(n,e)||!J(e))return;let i=$.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=X(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!a.isConnected||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!U(s,e))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(U(s,e));t.preventDefault(),t.stopPropagation(),s?G(s,!0):V(a)?G(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),p(()=>{let n=f(e.current?e.current[0]:void 0);if(!t)return;let i=$.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=$.getTreeNode(e);if(!r)return;let i=r.nodeToRestore,o=a(n);if(t&&i&&(o&&U(o,e)||o===n.body&&J(e))){let t=$.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){Y(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&$.getTreeNode(n.scopeRef)){Y(K(n.scopeRef.current,!0));return}n=n.parent}}})}}},[e,t])}function Y(e){e.dispatchEvent(new CustomEvent(L,{bubbles:!0,cancelable:!0}))&&G(e)}function X(e,t,n){let r=t?.tabbable?g:h,i=e?.nodeType===Node.ELEMENT_NODE?e:null,a=f(i),o=S(a,e||a,NodeFilter.SHOW_ELEMENT,{acceptNode(e){return l(t?.from,e)||t?.tabbable&&e.tagName===`INPUT`&&e.getAttribute(`type`)===`radio`&&(!ce(e)||o.currentNode.tagName===`INPUT`&&o.currentNode.type===`radio`&&o.currentNode.name===e.name)?NodeFilter.FILTER_REJECT:r(e)&&(!n||H(e,n))&&(!t?.accept||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t?.from&&(o.currentNode=t.from),o}function me(e,t={}){return{focusNext(n={}){let r=e.current;if(!r)return null;let{from:i,tabbable:o=t.tabbable,wrap:s=t.wrap,accept:c=t.accept}=n,u=i||a(f(r)),d=X(r,{tabbable:o,accept:c});l(r,u)&&(d.currentNode=u);let p=d.nextNode();return!p&&s&&(d.currentNode=r,p=d.nextNode()),p&&G(p,!0),p},focusPrevious(n=t){let r=e.current;if(!r)return null;let{from:i,tabbable:o=t.tabbable,wrap:s=t.wrap,accept:c=t.accept}=n,u=i||a(f(r)),d=X(r,{tabbable:o,accept:c});if(l(r,u))d.currentNode=u;else{let e=Z(d);return e&&G(e,!0),e??null}let p=d.previousNode();if(!p&&s){d.currentNode=r;let e=Z(d);if(!e)return null;p=e}return p&&G(p,!0),p??null},focusFirst(n=t){let r=e.current;if(!r)return null;let{tabbable:i=t.tabbable,accept:a=t.accept}=n,o=X(r,{tabbable:i,accept:a}).nextNode();return o&&G(o,!0),o},focusLast(n=t){let r=e.current;if(!r)return null;let{tabbable:i=t.tabbable,accept:a=t.accept}=n,o=Z(X(r,{tabbable:i,accept:a}));return o&&G(o,!0),o??null}}}function Z(e){let t,n;do n=e.lastChild(),n&&(t=n);while(n);return t}var he=class e{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new Q({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&H(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}constructor(){this.fastMap=new Map,this.root=new Q({scopeRef:null}),this.fastMap.set(null,this.root)}},Q=class{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}},$=new he,ge={border:0,clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,margin:`-1px`,overflow:`hidden`,padding:0,position:`absolute`,width:`1px`,whiteSpace:`nowrap`};function _e(e={}){let{style:t,isFocusable:n}=e,[r,i]=(0,v.useState)(!1),{focusWithinProps:a}=u({isDisabled:!n,onFocusWithinChange:e=>i(e)}),o=(0,v.useMemo)(()=>r?t:t?{...ge,...t}:ge,[r]);return{visuallyHiddenProps:{...a,style:o}}}function ve(e){let{children:t,elementType:n=`div`,isFocusable:r,style:i,...a}=e,{visuallyHiddenProps:o}=_e(e);return v.createElement(n,c(a,o),t)}export{y as _,X as a,M as c,D as d,ie as f,S as g,C as h,ae as i,N as l,w as m,_e as n,me as o,T as p,ue as r,F as s,ve as t,j as u,re as v,b as y};