@marimo-team/frontend 0.21.2-dev64 → 0.21.2-dev70

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 (538) hide show
  1. package/dist/assets/{CellStatus-CSyn_YBv.js → CellStatus-BWh3L8zx.js} +1 -1
  2. package/dist/assets/{ConnectedDataExplorerComponent-Dl5LOVOh.js → ConnectedDataExplorerComponent-BUeDbkXy.js} +1 -1
  3. package/dist/assets/{JsonOutput-C6G83us5.js → JsonOutput-DjRNPaJQ.js} +11 -11
  4. package/dist/assets/LazyAnyLanguageCodeMirror-BTEcIffn.js +2 -0
  5. package/dist/assets/{MarimoErrorOutput-DocWeKjV.js → MarimoErrorOutput-3snr3JrQ.js} +4 -4
  6. package/dist/assets/{RenderHTML-26aAKQ-8.js → RenderHTML-C9ZqxJ8H.js} +1 -1
  7. package/dist/assets/{add-cell-with-ai-BSWYMy0y.js → add-cell-with-ai-u_AX7UAd.js} +9 -9
  8. package/dist/assets/{add-connection-dialog-S-Hiw5Sn.js → add-connection-dialog-COHTxTf9.js} +1 -1
  9. package/dist/assets/{agent-panel-CEBChEgo.js → agent-panel-DRWoQMgB.js} +5 -5
  10. package/dist/assets/{ai-model-dropdown-C_T_oAXa.js → ai-model-dropdown-Dybmv5gR.js} +4 -4
  11. package/dist/assets/{any-language-editor-Dx3VFLbz.js → any-language-editor-DVOJvjS_.js} +1 -1
  12. package/dist/assets/apl-EWXxdJ89.js +1 -0
  13. package/dist/assets/{app-config-button-CEpYCUvC.js → app-config-button-BldM7HZH.js} +1 -1
  14. package/dist/assets/{arc-CFxCF0f6.js → arc-CM3JIGAK.js} +1 -1
  15. package/dist/assets/{architecture-7HQA4BMR-3vsMDKTP.js → architecture-7HQA4BMR-CjBWfzkw.js} +1 -1
  16. package/dist/assets/{architectureDiagram-VXUJARFQ-D9kPM0z9.js → architectureDiagram-VXUJARFQ-Bj7Il1tu.js} +1 -1
  17. package/dist/assets/asciiarmor-DSR32lM3.js +1 -0
  18. package/dist/assets/asn1-CzLTElTA.js +1 -0
  19. package/dist/assets/{blockDiagram-VD42YOAC-BAyg1LmM.js → blockDiagram-VD42YOAC-oQ23Vi0_.js} +1 -1
  20. package/dist/assets/brainfuck-C9KAsPxY.js +1 -0
  21. package/dist/assets/{c4Diagram-YG6GDRKO--4bijtys.js → c4Diagram-YG6GDRKO-BmG_s0MV.js} +1 -1
  22. package/dist/assets/{cache-panel-tss6GZ39.js → cache-panel-CcvLLOUr.js} +1 -1
  23. package/dist/assets/{cell-editor-By2GGVYQ.js → cell-editor-5N9VJYlI.js} +8 -8
  24. package/dist/assets/{cell-link-BgNPg6FR.js → cell-link-DV3G9zVQ.js} +1 -1
  25. package/dist/assets/{cells-BZ2tqr8k.js → cells-B8rT_yJt.js} +54 -54
  26. package/dist/assets/channel-Ce6sVGv4.js +1 -0
  27. package/dist/assets/{chat-display-2RrXeUHQ.js → chat-display-DSlMdLnv.js} +1 -1
  28. package/dist/assets/chat-panel-BhurwxDK.js +3 -0
  29. package/dist/assets/{chat-ui-gqaOvAn5.js → chat-ui-BL1vsaOH.js} +1 -1
  30. package/dist/assets/{chunk-4BX2VUAB-DF0hGcQN.js → chunk-4BX2VUAB-B189RnQe.js} +1 -1
  31. package/dist/assets/chunk-55IACEB6-BKJUfbeh.js +1 -0
  32. package/dist/assets/chunk-5FQGJX7Z-KaqPPQRg.js +113 -0
  33. package/dist/assets/{chunk-ABZYJK2D-YAqD84U8.js → chunk-ABZYJK2D-B25ZPF-K.js} +3 -3
  34. package/dist/assets/{chunk-ATLVNIR6-DbiqnFFy.js → chunk-ATLVNIR6-B45gjfoT.js} +1 -1
  35. package/dist/assets/{chunk-B4BG7PRW-CPghmS_2.js → chunk-B4BG7PRW-uViI8VWN.js} +1 -1
  36. package/dist/assets/{chunk-CVBHYZKI-5HVb4Wim.js → chunk-CVBHYZKI-DDPYtx7T.js} +1 -1
  37. package/dist/assets/{chunk-DI55MBZ5-CfK3aKqu.js → chunk-DI55MBZ5-DLM1fyq0.js} +1 -1
  38. package/dist/assets/{chunk-EXTU4WIE-Ce4YyDo3.js → chunk-EXTU4WIE-se83eFLa.js} +1 -1
  39. package/dist/assets/{chunk-FMBD7UC4-BeZPwy7p.js → chunk-FMBD7UC4-DVUAz4cp.js} +1 -1
  40. package/dist/assets/{chunk-HN2XXSSU-DjhZVPDs.js → chunk-HN2XXSSU-Bm9ByQAV.js} +1 -1
  41. package/dist/assets/{chunk-JA3XYJ7Z-DZPNtCK-.js → chunk-JA3XYJ7Z-Bf9EPUd3.js} +1 -1
  42. package/dist/assets/{chunk-JZLCHNYA-Dpe2M-yf.js → chunk-JZLCHNYA-CgH-oTl4.js} +1 -1
  43. package/dist/assets/{chunk-MI3HLSF2-pZk5-wBb.js → chunk-MI3HLSF2-BjSxv-Tb.js} +1 -1
  44. package/dist/assets/{chunk-N4CR4FBY-DUuhotFe.js → chunk-N4CR4FBY-DggtmLIl.js} +2 -2
  45. package/dist/assets/{chunk-QN33PNHL-DOzVADWo.js → chunk-QN33PNHL-BieKJXyS.js} +1 -1
  46. package/dist/assets/{chunk-QXUST7PY-Bs7vzMFW.js → chunk-QXUST7PY-8icnqUGK.js} +1 -1
  47. package/dist/assets/{chunk-QZHKN3VN-iAvgjPDy.js → chunk-QZHKN3VN-CETeUy72.js} +1 -1
  48. package/dist/assets/{chunk-S3R3BYOJ-CmOcQqk_.js → chunk-S3R3BYOJ-Czh1h7v6.js} +1 -1
  49. package/dist/assets/{chunk-TZMSLE5B-C1A4ubRR.js → chunk-TZMSLE5B-jYelYMXU.js} +1 -1
  50. package/dist/assets/classDiagram-2ON5EDUG-hMIK1Zdj.js +1 -0
  51. package/dist/assets/classDiagram-v2-WZHVMYZB-CoXOcl4J.js +1 -0
  52. package/dist/assets/{clike-BbrvoIeH.js → clike-OJZcTpQL.js} +1 -1
  53. package/dist/assets/clojure-DQhuUUMF.js +1 -0
  54. package/dist/assets/cmake-CH_Sxc86.js +1 -0
  55. package/dist/assets/cobol-CUc3YqiS.js +1 -0
  56. package/dist/assets/{code-block-37QAKDTI-DlumEtkK.js → code-block-37QAKDTI-OmWrUFvA.js} +1 -1
  57. package/dist/assets/coffeescript-jkPo-KDH.js +1 -0
  58. package/dist/assets/{column-preview-Bxza9N1V.js → column-preview-BewMPp25.js} +1 -1
  59. package/dist/assets/{command-BeKqRjOY.js → command-DvKBTmQJ.js} +1 -1
  60. package/dist/assets/command-palette-CEUFGN9t.js +1 -0
  61. package/dist/assets/{common-D8-arIFt.js → common-MJu6yCEK.js} +1 -1
  62. package/dist/assets/commonlisp-Da0K5kk2.js +1 -0
  63. package/dist/assets/{components-4-hSIFip.js → components-CWfQv9p5.js} +1 -1
  64. package/dist/assets/components-fIfcCZSp.js +1 -0
  65. package/dist/assets/context-aware-panel-C2RM-4_S.js +3 -0
  66. package/dist/assets/{cose-bilkent-S5V4N54A-Dc-Xjmtt.js → cose-bilkent-S5V4N54A-Bi0_d7cB.js} +1 -1
  67. package/dist/assets/crystal-BNWfY9C_.js +1 -0
  68. package/dist/assets/{css-D6ibtNcd.js → css-Cupd7xng.js} +1 -1
  69. package/dist/assets/cypher--c26tz0e.js +1 -0
  70. package/dist/assets/d-Byku2dmh.js +1 -0
  71. package/dist/assets/{dagre-6UL2VRFP-CwgYeOyd.js → dagre-6UL2VRFP-Cj7QD8QV.js} +1 -1
  72. package/dist/assets/{data-grid-overlay-editor-DGw11cpx.js → data-grid-overlay-editor-CrDdi6s3.js} +1 -1
  73. package/dist/assets/{datasource-xu50qvjI.js → datasource-xomiPYKd.js} +2 -2
  74. package/dist/assets/{dependency-graph-panel-_khCuhB-.js → dependency-graph-panel-B24Gr6L4.js} +3 -3
  75. package/dist/assets/{diagram-PSM6KHXK-DSWsukz1.js → diagram-PSM6KHXK-f8hiJ27Z.js} +1 -1
  76. package/dist/assets/{diagram-QEK2KX5R-CUGL1lw-.js → diagram-QEK2KX5R-DhD0I0gb.js} +1 -1
  77. package/dist/assets/{diagram-S2PKOQOG-CNDV3U9h.js → diagram-S2PKOQOG-CMxSsKXF.js} +1 -1
  78. package/dist/assets/diff-a9CLcKdR.js +1 -0
  79. package/dist/assets/dist-BBGASQNR.js +1 -0
  80. package/dist/assets/{dist-DoTdV6qI.js → dist-BRCCPMsT.js} +1 -1
  81. package/dist/assets/{dist-BGKOvmq0.js → dist-CJ8RtgvK.js} +1 -1
  82. package/dist/assets/{dist-3Yb9jUpo.js → dist-COABhHhr.js} +1 -1
  83. package/dist/assets/dist-Cp7t_Bws.js +1 -0
  84. package/dist/assets/{dist-CtXmSZyI.js → dist-DROvTz9O.js} +1 -1
  85. package/dist/assets/dist-DWBTB8aa.js +1 -0
  86. package/dist/assets/{dist-DaPIfS-Q.js → dist-DeX768Hg.js} +1 -1
  87. package/dist/assets/{dist-p1_vuZ9R.js → dist-DrDZNjDr.js} +1 -1
  88. package/dist/assets/dist-Hf_DuPpM.js +7 -0
  89. package/dist/assets/{dist-Dhl1En-E.js → dist-LxLdJkvD.js} +1 -1
  90. package/dist/assets/{dist-DMoYJC-G.js → dist-VjWmUZA0.js} +1 -1
  91. package/dist/assets/{dist-Cgj9ydRR.js → dist-X-byYzEZ.js} +1 -1
  92. package/dist/assets/dist-Xnna0a3m.js +1 -0
  93. package/dist/assets/{dist-CgQ63H-M.js → dist-y02bFELW.js} +1 -1
  94. package/dist/assets/{dockerfile-bIFruQXZ.js → dockerfile-Cgz0GlPW.js} +1 -1
  95. package/dist/assets/{documentation-panel-B9z_DT6E.js → documentation-panel-DHLN-LCs.js} +1 -1
  96. package/dist/assets/{download-BX5RBVL8.js → download-CNJtCoWG.js} +4 -4
  97. package/dist/assets/dtd-CmqpGLbC.js +1 -0
  98. package/dist/assets/dylan-Cihtx9iT.js +1 -0
  99. package/dist/assets/ecl-CZoQOU3U.js +1 -0
  100. package/dist/assets/{edit-page-D2jHQ99Z.js → edit-page-DtsC5jKU.js} +7 -7
  101. package/dist/assets/eiffel-Br4OQEbu.js +1 -0
  102. package/dist/assets/elm-BPOnYPcO.js +1 -0
  103. package/dist/assets/{erDiagram-Q2GNP2WA-DfiRRg2v.js → erDiagram-Q2GNP2WA-BZbca8vs.js} +1 -1
  104. package/dist/assets/erlang-DuwMV84m.js +1 -0
  105. package/dist/assets/{error-panel-B-L35J0Q.js → error-panel-BprMlRWd.js} +1 -1
  106. package/dist/assets/{esm-Uis3U2sE.js → esm-BjKAkBIt.js} +1 -1
  107. package/dist/assets/factor-6YAhArFy.js +1 -0
  108. package/dist/assets/{factor-COZKt8xO.js → factor-ByjtQqb6.js} +1 -1
  109. package/dist/assets/{file-explorer-panel-Dxy2wacg.js → file-explorer-panel-5AxbHV_5.js} +2 -2
  110. package/dist/assets/{file-icons-zT5xSrpN.js → file-icons-I3TgHXBH.js} +1 -1
  111. package/dist/assets/{floating-outline-DlCEpJuo.js → floating-outline-BUsBWnrz.js} +1 -1
  112. package/dist/assets/{flowDiagram-NV44I4VS-Dnt7RRaD.js → flowDiagram-NV44I4VS-ffFKaqut.js} +1 -1
  113. package/dist/assets/{focus-CpM6NAz2.js → focus-DWfOBGUg.js} +1 -1
  114. package/dist/assets/{form-DqfJycRl.js → form-DNvI4VkE.js} +1 -1
  115. package/dist/assets/forth-2Nj_EUdH.js +1 -0
  116. package/dist/assets/fortran-CCKPCngf.js +1 -0
  117. package/dist/assets/{gallery-page-plavkcxH.js → gallery-page-C-cbnxxr.js} +1 -1
  118. package/dist/assets/{ganttDiagram-JELNMOA3-DzaeerR-.js → ganttDiagram-JELNMOA3-fI3e8q9G.js} +1 -1
  119. package/dist/assets/gas-DQfJyQA6.js +1 -0
  120. package/dist/assets/gherkin-CtG4Rl1f.js +1 -0
  121. package/dist/assets/{gitGraph-G5XIXVHT-DX1Iaeeg.js → gitGraph-G5XIXVHT-Dr_vttV5.js} +1 -1
  122. package/dist/assets/{gitGraphDiagram-V2S2FVAM-BwL84Mis.js → gitGraphDiagram-V2S2FVAM-B9zkU5OL.js} +1 -1
  123. package/dist/assets/{glide-data-editor-BoppQYWx.js → glide-data-editor-BUABnEhp.js} +4 -4
  124. package/dist/assets/{globals-zG_ueqN3.js → globals-B7uZUVXG.js} +1 -1
  125. package/dist/assets/groovy-DmN1hhD-.js +1 -0
  126. package/dist/assets/haskell-Bv99dcka.js +1 -0
  127. package/dist/assets/haxe-C4SwAtv2.js +1 -0
  128. package/dist/assets/{home-page-CPKakvcY.js → home-page-B1ioyqaQ.js} +2 -2
  129. package/dist/assets/{hooks-DVW0qFsD.js → hooks-DXPGLnG5.js} +1 -1
  130. package/dist/assets/{html-to-image-D_3oFpSp.js → html-to-image-BtnUxAf2.js} +1 -1
  131. package/dist/assets/idl-Cip3qUaw.js +1 -0
  132. package/dist/assets/{index-BUi88mQ-.js → index-C2lbdY5o.js} +7 -7
  133. package/dist/assets/{info-VBDWY6EO-DI87Cx_N.js → info-VBDWY6EO-_MKnIvva.js} +1 -1
  134. package/dist/assets/infoDiagram-HS3SLOUP-DcmWVuHy.js +2 -0
  135. package/dist/assets/javascript-D01OZFLf.js +1 -0
  136. package/dist/assets/{journeyDiagram-XKPGCS4Q-KRjBx01o.js → journeyDiagram-XKPGCS4Q-Bi3SDkGt.js} +1 -1
  137. package/dist/assets/julia-CdUg5Gin.js +1 -0
  138. package/dist/assets/{kanban-definition-3W4ZIXB7-C9LSOY6_.js → kanban-definition-3W4ZIXB7-DHPI88SO.js} +1 -1
  139. package/dist/assets/katex-CKMiPDPy.js +1 -0
  140. package/dist/assets/{kiosk-mode-PvGxCz81.js → kiosk-mode-DvjY7Q8k.js} +1 -1
  141. package/dist/assets/{layout-b4TrkjtJ.js → layout-BNBgAwho.js} +4 -4
  142. package/dist/assets/{line-vDGbKzUj.js → line-BX1v8gkY.js} +1 -1
  143. package/dist/assets/{linear-JR9qrU26.js → linear-_5G-OhLA.js} +1 -1
  144. package/dist/assets/livescript-CmA_pEQi.js +1 -0
  145. package/dist/assets/{logs-panel-CIdtLrmS.js → logs-panel-Iivn5vVF.js} +1 -1
  146. package/dist/assets/{loro_wasm_bg-BYni_6Sh.js → loro_wasm_bg-C9dMIWjp.js} +1 -1
  147. package/dist/assets/lua-BBGGibto.js +1 -0
  148. package/dist/assets/markdown-renderer-f7AvSa1a.js +5 -0
  149. package/dist/assets/mathematica-EVwiHsb7.js +1 -0
  150. package/dist/assets/mbox-f9FpJMps.js +1 -0
  151. package/dist/assets/mermaid-4DMBBIKO-CsD09XZ_.js +1 -0
  152. package/dist/assets/{mermaid-g45SBZs4.js → mermaid-BdekQaCQ.js} +3 -3
  153. package/dist/assets/{mermaid-parser.core-D2CUV57N.js → mermaid-parser.core-hTN4xwYK.js} +2 -2
  154. package/dist/assets/{mhchem-eTdlE0-_.js → mhchem-CgESkxWV.js} +1 -1
  155. package/dist/assets/micromark-factory-space-4isUgE6w.js +1 -0
  156. package/dist/assets/{mindmap-definition-VGOIOE7T-DbAsaD82.js → mindmap-definition-VGOIOE7T-DEN1Ym_B.js} +1 -1
  157. package/dist/assets/mirc-CKQuidRI.js +1 -0
  158. package/dist/assets/mllike-DSE7K0L_.js +1 -0
  159. package/dist/assets/modelica-BLWpmE6J.js +1 -0
  160. package/dist/assets/mscgen-DUGTvav7.js +1 -0
  161. package/dist/assets/mumps-De-aL68G.js +1 -0
  162. package/dist/assets/{name-cell-input-CFXvT7wQ.js → name-cell-input-CzVNuMqK.js} +1 -1
  163. package/dist/assets/{nsis-CQJx4ihu.js → nsis-BKA2hITd.js} +1 -1
  164. package/dist/assets/nsis-GZVZ8s9U.js +1 -0
  165. package/dist/assets/ntriples-8e_qYaH4.js +1 -0
  166. package/dist/assets/{number-overlay-editor-BIXBlRQQ.js → number-overlay-editor-CDWHq1mJ.js} +1 -1
  167. package/dist/assets/octave-BV_-gmS1.js +1 -0
  168. package/dist/assets/{ordinal-vRIIH2-b.js → ordinal-BL0TAfDQ.js} +1 -1
  169. package/dist/assets/{outline-panel-Dbp5O4xk.js → outline-panel-QyE6tr_2.js} +1 -1
  170. package/dist/assets/oz-B0uIrvBT.js +1 -0
  171. package/dist/assets/{packages-panel-C6Cj2Dox.js → packages-panel-D9pbtgFY.js} +1 -1
  172. package/dist/assets/{packet-DYOGHKS2-tVzgtQkA.js → packet-DYOGHKS2-Cr8AvEnH.js} +1 -1
  173. package/dist/assets/panels-Cl3n6YfZ.js +1 -0
  174. package/dist/assets/pascal-P8oljycx.js +1 -0
  175. package/dist/assets/perl-C9B7mnkS.js +1 -0
  176. package/dist/assets/{pie-VRWISCQL-QmTjjdah.js → pie-VRWISCQL-18iiky4b.js} +1 -1
  177. package/dist/assets/{pieDiagram-ADFJNKIX-DPlhC-O4.js → pieDiagram-ADFJNKIX-BY90tkn0.js} +1 -1
  178. package/dist/assets/pig-CrydCWlQ.js +1 -0
  179. package/dist/assets/powershell-BNzz8aRp.js +1 -0
  180. package/dist/assets/{process-output-CgWMJc-C.js → process-output-5fC8hAfT.js} +1 -1
  181. package/dist/assets/properties-C81OZegg.js +1 -0
  182. package/dist/assets/protobuf-DXcVcUng.js +1 -0
  183. package/dist/assets/{pug-Yt6Urxo2.js → pug-Bc3B5zy9.js} +1 -1
  184. package/dist/assets/pug-D2oI7kNu.js +1 -0
  185. package/dist/assets/puppet-DNlzsFMc.js +1 -0
  186. package/dist/assets/python-CdBemvol.js +1 -0
  187. package/dist/assets/q-CB51ViwQ.js +1 -0
  188. package/dist/assets/{quadrantDiagram-AYHSOK5B-jnE3mG3Y.js → quadrantDiagram-AYHSOK5B-DscgxREu.js} +1 -1
  189. package/dist/assets/r-lEjVwdCN.js +1 -0
  190. package/dist/assets/{radar-ZZBFDIW7-2_FgLRzo.js → radar-ZZBFDIW7-DP-828em.js} +1 -1
  191. package/dist/assets/{react-vega-_sDwqIeC.js → react-vega-CFucxlM_.js} +1 -1
  192. package/dist/assets/{react-vega-Bg7wgNWC.js → react-vega-C_nbap4W.js} +1 -1
  193. package/dist/assets/{readonly-python-code-CjHN1YzV.js → readonly-python-code-CvuT43MO.js} +1 -1
  194. package/dist/assets/{requirementDiagram-UZGBJVZJ-BwnFZdZm.js → requirementDiagram-UZGBJVZJ-DuOL6ww3.js} +1 -1
  195. package/dist/assets/rpm-DDM5IEHy.js +1 -0
  196. package/dist/assets/ruby-93dn3nLg.js +1 -0
  197. package/dist/assets/run-page-BtObT9L4.js +1 -0
  198. package/dist/assets/{sankeyDiagram-TZEHDZUN-G8bGgtok.js → sankeyDiagram-TZEHDZUN-CrhC3Xh7.js} +1 -1
  199. package/dist/assets/sas-CbG03D2N.js +1 -0
  200. package/dist/assets/scheme-B2cyUK_0.js +1 -0
  201. package/dist/assets/scratchpad-panel-BKAUdxLJ.js +1 -0
  202. package/dist/assets/{secrets-panel-v_peqjs9.js → secrets-panel-ByDa4skC.js} +1 -1
  203. package/dist/assets/{sequenceDiagram-WL72ISMW-CVokZRk6.js → sequenceDiagram-WL72ISMW-DNBtGacp.js} +1 -1
  204. package/dist/assets/session-panel-CwxYVHIu.js +1 -0
  205. package/dist/assets/shell-BUKevxDL.js +1 -0
  206. package/dist/assets/sieve-DBd5VCju.js +1 -0
  207. package/dist/assets/smalltalk-DEMxPY2H.js +1 -0
  208. package/dist/assets/{snippets-panel-wGOEVyqu.js → snippets-panel-Cn-0B9yk.js} +1 -1
  209. package/dist/assets/sparql-CuX1PPeN.js +1 -0
  210. package/dist/assets/{src-aBHYsoaw.js → src-BNdxo5s1.js} +1 -1
  211. package/dist/assets/{state-CI4FLWoL.js → state-DLmIk5GZ.js} +1 -1
  212. package/dist/assets/{stateDiagram-FKZM4ZOC-M7FBTKFZ.js → stateDiagram-FKZM4ZOC-Krq7gbW2.js} +1 -1
  213. package/dist/assets/stateDiagram-v2-4FDKWEC3-Cw5LDI5M.js +1 -0
  214. package/dist/assets/{step-B_iSQA2q.js → step-OYH2hb7p.js} +1 -1
  215. package/dist/assets/stylus-aDxbv1u4.js +1 -0
  216. package/dist/assets/swift-OTokpssg.js +1 -0
  217. package/dist/assets/{switch-SqaUg_Rv.js → switch-CdyDieX7.js} +1 -1
  218. package/dist/assets/tcl-DJhWqArt.js +1 -0
  219. package/dist/assets/{terminal-C9H1AYRi.js → terminal-Cdh7bzOl.js} +1 -1
  220. package/dist/assets/{textarea-7F6-nuwz.js → textarea-y9GCP54I.js} +1 -1
  221. package/dist/assets/textile-DpS9C_zY.js +1 -0
  222. package/dist/assets/{time-Dl8wmbMf.js → time-LzCXNX8h.js} +1 -1
  223. package/dist/assets/{timeline-definition-IT6M3QCI-CfGh-Wfj.js → timeline-definition-IT6M3QCI-DOl0hCPz.js} +1 -1
  224. package/dist/assets/toml-kj-ibVms.js +1 -0
  225. package/dist/assets/{tracing-DxuknZTG.js → tracing-CggYKKpk.js} +1 -1
  226. package/dist/assets/{tracing-panel-yQoYble5.js → tracing-panel-BYfwYVLg.js} +2 -2
  227. package/dist/assets/{treemap-GDKQZRPO-Cnt0pazm.js → treemap-GDKQZRPO-CWmDSzQU.js} +1 -1
  228. package/dist/assets/troff-DLJL07gk.js +1 -0
  229. package/dist/assets/ttcn-cfg-DuCZQ2Km.js +1 -0
  230. package/dist/assets/ttcn-twc1Q5xq.js +1 -0
  231. package/dist/assets/turtle-BiLqIa2_.js +1 -0
  232. package/dist/assets/{useAddCell-Dluq9z9F.js → useAddCell-BGHDEB1g.js} +1 -1
  233. package/dist/assets/useCellActionButton-BbGQe83V.js +1 -0
  234. package/dist/assets/{useDeleteCell-B-MR7EAI.js → useDeleteCell-DG1VBfwX.js} +1 -1
  235. package/dist/assets/{useDependencyPanelTab-D39ukyvA.js → useDependencyPanelTab-luj9RYTO.js} +1 -1
  236. package/dist/assets/{useNotebookActions-BqjNClzw.js → useNotebookActions-xaTaAoei.js} +1 -1
  237. package/dist/assets/useRunCells--USKPEQy.js +1 -0
  238. package/dist/assets/{useSplitCell-BwJPHVng.js → useSplitCell-DGXfa81A.js} +1 -1
  239. package/dist/assets/vb-BYvNbVBU.js +1 -0
  240. package/dist/assets/vbscript-CE30tjpc.js +1 -0
  241. package/dist/assets/{vega-component-BlvDymW4.js → vega-component-C3vNdTdH.js} +1 -1
  242. package/dist/assets/velocity-k2jshUC1.js +1 -0
  243. package/dist/assets/verilog-D-u-JakI.js +1 -0
  244. package/dist/assets/vhdl-CdNH8uWZ.js +1 -0
  245. package/dist/assets/webidl-CdMZNGiF.js +1 -0
  246. package/dist/assets/{write-secret-modal-xvi72o3J.js → write-secret-modal-BlZo70J1.js} +1 -1
  247. package/dist/assets/xquery-XKE48gN2.js +1 -0
  248. package/dist/assets/{xychartDiagram-PRI3JC2R-BjJjKS-4.js → xychartDiagram-PRI3JC2R-sn3q6uOF.js} +1 -1
  249. package/dist/assets/yacas-DbyKcdb9.js +1 -0
  250. package/dist/assets/z80-F2-i3nLg.js +1 -0
  251. package/dist/index.html +39 -39
  252. package/package.json +1 -1
  253. package/src/__mocks__/requests.ts +1 -0
  254. package/src/components/data-table/range-focus/__tests__/use-cell-range-selection.test.ts +119 -0
  255. package/src/components/data-table/range-focus/use-cell-range-selection.ts +19 -0
  256. package/src/components/datasources/datasources.tsx +45 -0
  257. package/src/components/markdown/markdown-renderer.tsx +18 -2
  258. package/src/core/datasets/__tests__/data-source.test.ts +88 -1
  259. package/src/core/datasets/data-source-connections.ts +44 -0
  260. package/src/core/datasets/request-registry.ts +13 -0
  261. package/src/core/islands/bridge.ts +1 -0
  262. package/src/core/islands/main.ts +1 -0
  263. package/src/core/kernel/messages.ts +2 -0
  264. package/src/core/network/requests-lazy.ts +1 -0
  265. package/src/core/network/requests-network.ts +8 -0
  266. package/src/core/network/requests-static.ts +1 -0
  267. package/src/core/network/requests-toasting.tsx +1 -0
  268. package/src/core/network/types.ts +2 -0
  269. package/src/core/wasm/bridge.ts +10 -0
  270. package/src/core/websocket/useMarimoKernelConnection.tsx +4 -0
  271. package/dist/assets/LazyAnyLanguageCodeMirror-BLyxzRTe.js +0 -2
  272. package/dist/assets/apl-DmIuLoM5.js +0 -1
  273. package/dist/assets/asciiarmor-Dw7r6FD5.js +0 -1
  274. package/dist/assets/asn1-49M6dOZ5.js +0 -1
  275. package/dist/assets/brainfuck-Dzb-bFPz.js +0 -1
  276. package/dist/assets/channel-8md9AqRV.js +0 -1
  277. package/dist/assets/chat-panel-DTfbqRHb.js +0 -3
  278. package/dist/assets/chunk-55IACEB6-DxdbD43d.js +0 -1
  279. package/dist/assets/chunk-5FQGJX7Z-Fb8WLBdo.js +0 -113
  280. package/dist/assets/classDiagram-2ON5EDUG-Ds4AwoP7.js +0 -1
  281. package/dist/assets/classDiagram-v2-WZHVMYZB-BmeOa_lI.js +0 -1
  282. package/dist/assets/clojure-D3f46AOj.js +0 -1
  283. package/dist/assets/cmake-CRns6FWA.js +0 -1
  284. package/dist/assets/cobol-tD7VjYkY.js +0 -1
  285. package/dist/assets/coffeescript-BMoHntr0.js +0 -1
  286. package/dist/assets/command-palette-Dx3dFDHn.js +0 -1
  287. package/dist/assets/commonlisp-tEbZ2txa.js +0 -1
  288. package/dist/assets/components-DlVdNzZL.js +0 -1
  289. package/dist/assets/context-aware-panel-BAsDUfG1.js +0 -3
  290. package/dist/assets/crystal-tXxqRSmg.js +0 -1
  291. package/dist/assets/cypher-Clgr1THu.js +0 -1
  292. package/dist/assets/d-DGpF2gtm.js +0 -1
  293. package/dist/assets/diff-DQ8hzfLT.js +0 -1
  294. package/dist/assets/dist-BqsOX_yK.js +0 -1
  295. package/dist/assets/dist-CBYsx1lD.js +0 -1
  296. package/dist/assets/dist-CkG7HeJJ.js +0 -1
  297. package/dist/assets/dist-DkNQl8fU.js +0 -1
  298. package/dist/assets/dtd-9XKjDaRs.js +0 -1
  299. package/dist/assets/dylan-DQ7WSVaJ.js +0 -1
  300. package/dist/assets/ecl-_b3Ij92M.js +0 -1
  301. package/dist/assets/eiffel-v705-6sV.js +0 -1
  302. package/dist/assets/elm-kOjuB_fu.js +0 -1
  303. package/dist/assets/erlang-BKLrKn97.js +0 -1
  304. package/dist/assets/factor-CKv1cDHM.js +0 -1
  305. package/dist/assets/forth-BeW6w9NP.js +0 -1
  306. package/dist/assets/fortran-B8S6_jJw.js +0 -1
  307. package/dist/assets/gas-T2YF_8DP.js +0 -1
  308. package/dist/assets/gherkin-CCQo3jOa.js +0 -1
  309. package/dist/assets/groovy-D_aCkoaG.js +0 -1
  310. package/dist/assets/haskell-CVb05Hdq.js +0 -1
  311. package/dist/assets/haxe-BETJ4Q1p.js +0 -1
  312. package/dist/assets/idl-C9DSrKQo.js +0 -1
  313. package/dist/assets/infoDiagram-HS3SLOUP-D-RQJqJ1.js +0 -2
  314. package/dist/assets/javascript-kMjsCkN0.js +0 -1
  315. package/dist/assets/julia-BP2iEwTU.js +0 -1
  316. package/dist/assets/katex-BPQZrIDk.js +0 -1
  317. package/dist/assets/livescript-DldCoAUO.js +0 -1
  318. package/dist/assets/lua-CZVER5WL.js +0 -1
  319. package/dist/assets/markdown-renderer-CGLrhCH1.js +0 -10
  320. package/dist/assets/mathematica-CyS1-stp.js +0 -1
  321. package/dist/assets/mbox-m36f2d6F.js +0 -1
  322. package/dist/assets/mermaid-4DMBBIKO-BDW1wyAE.js +0 -1
  323. package/dist/assets/mirc-1VmF-8bO.js +0 -1
  324. package/dist/assets/mllike-C03wQNgL.js +0 -1
  325. package/dist/assets/modelica-DIzukV30.js +0 -1
  326. package/dist/assets/mscgen-DWz8dZ6d.js +0 -1
  327. package/dist/assets/mumps-CYbIrX8J.js +0 -1
  328. package/dist/assets/nsis-CTQ0yRGk.js +0 -1
  329. package/dist/assets/ntriples-DSrrK8pU.js +0 -1
  330. package/dist/assets/octave-DMlW_nfV.js +0 -1
  331. package/dist/assets/oz-D3yFc57L.js +0 -1
  332. package/dist/assets/panels-DxPykKF0.js +0 -1
  333. package/dist/assets/pascal-CQlQ3IN5.js +0 -1
  334. package/dist/assets/perl-DTZU_RzN.js +0 -1
  335. package/dist/assets/pig-Bhpnxpuq.js +0 -1
  336. package/dist/assets/powershell-NPR7ALKW.js +0 -1
  337. package/dist/assets/properties-vlTR87QN.js +0 -1
  338. package/dist/assets/protobuf-ByJ2pOLE.js +0 -1
  339. package/dist/assets/pug-CvW2XR0Z.js +0 -1
  340. package/dist/assets/puppet-Cq5I7FGe.js +0 -1
  341. package/dist/assets/python-BIseM0wl.js +0 -1
  342. package/dist/assets/q-Cxw6-L9w.js +0 -1
  343. package/dist/assets/r-BCPAUffd.js +0 -1
  344. package/dist/assets/rpm-axYHg47r.js +0 -1
  345. package/dist/assets/ruby-C3FVRZdA.js +0 -1
  346. package/dist/assets/run-page-Ce8MQ2gg.js +0 -1
  347. package/dist/assets/sas-CN65u8vG.js +0 -1
  348. package/dist/assets/scheme-CbiUNoDs.js +0 -1
  349. package/dist/assets/scratchpad-panel-OulpXAJO.js +0 -1
  350. package/dist/assets/session-panel-BBXXuMQG.js +0 -1
  351. package/dist/assets/shell-YEnz9M61.js +0 -1
  352. package/dist/assets/sieve-C-HxQpVW.js +0 -1
  353. package/dist/assets/smalltalk-CzvuDqf0.js +0 -1
  354. package/dist/assets/sparql-Djedbp-5.js +0 -1
  355. package/dist/assets/stateDiagram-v2-4FDKWEC3-BKLDpEGo.js +0 -1
  356. package/dist/assets/stylus-BpnZbov-.js +0 -1
  357. package/dist/assets/swift-DAHNa7bf.js +0 -1
  358. package/dist/assets/tcl-DTQfPx3q.js +0 -1
  359. package/dist/assets/textile-DXtfasKT.js +0 -1
  360. package/dist/assets/toml-BjmTwkhj.js +0 -1
  361. package/dist/assets/troff-Bc3qMmWc.js +0 -1
  362. package/dist/assets/ttcn-Bh7caDZp.js +0 -1
  363. package/dist/assets/ttcn-cfg-D18s1FKk.js +0 -1
  364. package/dist/assets/turtle-B1l6GoUm.js +0 -1
  365. package/dist/assets/useCellActionButton-DBXavVBJ.js +0 -1
  366. package/dist/assets/useRunCells-CwObo_j4.js +0 -1
  367. package/dist/assets/vb-OtZQD18A.js +0 -1
  368. package/dist/assets/vbscript-CMGATyY1.js +0 -1
  369. package/dist/assets/velocity-OiAuGLJe.js +0 -1
  370. package/dist/assets/verilog-S0G4VOpd.js +0 -1
  371. package/dist/assets/vhdl-CXVV79Yf.js +0 -1
  372. package/dist/assets/webidl-y1Tmj9tM.js +0 -1
  373. package/dist/assets/xquery-CwVKvibA.js +0 -1
  374. package/dist/assets/yacas-DR-AnMl3.js +0 -1
  375. package/dist/assets/z80-Lzkm5uuH.js +0 -1
  376. /package/dist/assets/{ImageComparisonComponent-B5E3m5MZ.js → ImageComparisonComponent-DxLwmmB2.js} +0 -0
  377. /package/dist/assets/{Inputs-eZfYMYYP.js → Inputs-W60db12_.js} +0 -0
  378. /package/dist/assets/{Plot-Dmxt4wRt.js → Plot-I39ar7fU.js} +0 -0
  379. /package/dist/assets/{apl-BHRaMaxV.js → apl-lvMF4O0c.js} +0 -0
  380. /package/dist/assets/{array-DU5T25JX.js → array-CRE2-wlR.js} +0 -0
  381. /package/dist/assets/{asciiarmor-Drw3Y_jV.js → asciiarmor-NoSIZ2RH.js} +0 -0
  382. /package/dist/assets/{asn1-B3Ivdxp7.js → asn1-Bn2zPmGi.js} +0 -0
  383. /package/dist/assets/{asterisk-GbGHf9GU.js → asterisk-1BK_fEUT.js} +0 -0
  384. /package/dist/assets/{azure-DElN0h0I.js → azure-BMhMRXAG.js} +0 -0
  385. /package/dist/assets/{brainfuck-Bmwix9UB.js → brainfuck-CyXrVlbF.js} +0 -0
  386. /package/dist/assets/{bundle.esm-idScn0w0.js → bundle.esm-_LzfhNmX.js} +0 -0
  387. /package/dist/assets/{card-kQvf6H4E.js → card-CBqenxaU.js} +0 -0
  388. /package/dist/assets/{chunk-4F5CHEZ2-B4VRPZ37.js → chunk-4F5CHEZ2-CvMYQKai.js} +0 -0
  389. /package/dist/assets/{chunk-B2363JML-CjIajB1P.js → chunk-B2363JML-oWpkFXOG.js} +0 -0
  390. /package/dist/assets/{chunk-DR5Q36YT-Bjmp_CNY.js → chunk-DR5Q36YT-DSjZQa_3.js} +0 -0
  391. /package/dist/assets/{chunk-FRFDVMJY-BfDKbo_T.js → chunk-FRFDVMJY-DxIaf4yl.js} +0 -0
  392. /package/dist/assets/{chunk-PL6DKKU2-pYEFWkPZ.js → chunk-PL6DKKU2-DwnNxWA0.js} +0 -0
  393. /package/dist/assets/{chunk-SJTYNZTY-VcrI9yao.js → chunk-SJTYNZTY-DBAl0fNt.js} +0 -0
  394. /package/dist/assets/{chunk-TQ3KTPDO-tIPcwIpX.js → chunk-TQ3KTPDO-B7j-UFPQ.js} +0 -0
  395. /package/dist/assets/{chunk-UMXZTB3W-Cpwtyir-.js → chunk-UMXZTB3W-BGNdYqf-.js} +0 -0
  396. /package/dist/assets/{clear-button-Cw33rRmg.js → clear-button-CuSHRx11.js} +0 -0
  397. /package/dist/assets/{click-outside-container-CsPwIqYr.js → click-outside-container-CiRBqxMF.js} +0 -0
  398. /package/dist/assets/{clike-E6D0qPLZ.js → clike-DKMmTh42.js} +0 -0
  399. /package/dist/assets/{clojure-D2u7A17s.js → clojure-PSUkitBX.js} +0 -0
  400. /package/dist/assets/{cmake-BAcX9pfJ.js → cmake-DzLpRry9.js} +0 -0
  401. /package/dist/assets/{cobol-Blv8cOIQ.js → cobol-DAqlVpNy.js} +0 -0
  402. /package/dist/assets/{coffeescript-Bd0runsx.js → coffeescript-CVRVei5N.js} +0 -0
  403. /package/dist/assets/{colors-Dtrl_rUb.js → colors-k4pzE1JC.js} +0 -0
  404. /package/dist/assets/{common-keywords-DpBQRN1C.js → common-keywords-CL5lDC0w.js} +0 -0
  405. /package/dist/assets/{commonlisp-B_IfCLCi.js → commonlisp-DGLna-nK.js} +0 -0
  406. /package/dist/assets/{crystal-BPH2tGA2.js → crystal-D1je9SnX.js} +0 -0
  407. /package/dist/assets/{css-DWR7mhwJ.js → css-CpgzfyW4.js} +0 -0
  408. /package/dist/assets/{cypher-S-rGklkM.js → cypher-SIaJhgm6.js} +0 -0
  409. /package/dist/assets/{cytoscape.esm-CVhOSlMZ.js → cytoscape.esm-0erX9Txj.js} +0 -0
  410. /package/dist/assets/{d-C128j5m6.js → d-BQbC3v5b.js} +0 -0
  411. /package/dist/assets/{diff-CThVlVra.js → diff-Du4D-Lj4.js} +0 -0
  412. /package/dist/assets/{dist-21ZHvMu-.js → dist-BKkfH6MG.js} +0 -0
  413. /package/dist/assets/{dist-uEEVcSIS.js → dist-BZJrw9vI.js} +0 -0
  414. /package/dist/assets/{dist-DniPQ7Qm.js → dist-BrZ_53nc.js} +0 -0
  415. /package/dist/assets/{dist-Cy2hdQdy.js → dist-C8Dcw0WD.js} +0 -0
  416. /package/dist/assets/{dist-BxyvBCI5.js → dist-C9G2F7Z1.js} +0 -0
  417. /package/dist/assets/{dist-DUGSlPOG.js → dist-CRmIdrta.js} +0 -0
  418. /package/dist/assets/{dist-Rq9HjYxD.js → dist-CTTKEfeu.js} +0 -0
  419. /package/dist/assets/{dist-CIhoH-X1.js → dist-CwHZ5Z_A.js} +0 -0
  420. /package/dist/assets/{dist-C9z0M-mT.js → dist-CwjzLMbM.js} +0 -0
  421. /package/dist/assets/{dist--yGrqaJH.js → dist-D699xT6P.js} +0 -0
  422. /package/dist/assets/{dist-D8g9Gob3.js → dist-DBBqNJ3C.js} +0 -0
  423. /package/dist/assets/{dist-BZXUFc1L.js → dist-DKnn_Tta.js} +0 -0
  424. /package/dist/assets/{dist-DVEj2fgt.js → dist-DbWhwe76.js} +0 -0
  425. /package/dist/assets/{dist-BHxWDjO3.js → dist-DmMcU97h.js} +0 -0
  426. /package/dist/assets/{dist-BbueVrZr.js → dist-DvbdggRI.js} +0 -0
  427. /package/dist/assets/{dist-lnKPBMeZ.js → dist-SDxzhwJU.js} +0 -0
  428. /package/dist/assets/{dist-BmUQz5fw.js → dist-Sjq7q5Ez.js} +0 -0
  429. /package/dist/assets/{dist-CmNOQaWE.js → dist-epQooxQL.js} +0 -0
  430. /package/dist/assets/{dtd-BloyElsS.js → dtd-C8APvYNQ.js} +0 -0
  431. /package/dist/assets/{duckdb-keywords-DrrKcwLz.js → duckdb-keywords-CKBoTxEb.js} +0 -0
  432. /package/dist/assets/{dylan-BpjltVYk.js → dylan-CTr_RHNL.js} +0 -0
  433. /package/dist/assets/{ebnf-DuKzoTsP.js → ebnf-CviyCkP7.js} +0 -0
  434. /package/dist/assets/{ecl-DIGfXI2n.js → ecl-BVnD0OAx.js} +0 -0
  435. /package/dist/assets/{eiffel-Nuvt3i0o.js → eiffel-9mt0KSLh.js} +0 -0
  436. /package/dist/assets/{elm-khTI8oMm.js → elm-CItjDkKL.js} +0 -0
  437. /package/dist/assets/{empty-state-GQ-H0WrT.js → empty-state-DUEogWxf.js} +0 -0
  438. /package/dist/assets/{erlang-Bz0rifYN.js → erlang-D8gZbSC3.js} +0 -0
  439. /package/dist/assets/{esm-DXwI6ZUw.js → esm-BMWduMhT.js} +0 -0
  440. /package/dist/assets/{esm-DZILy413.js → esm-BQO8KtRU.js} +0 -0
  441. /package/dist/assets/{fcl-DopXl_Cb.js → fcl-DjfeL5F6.js} +0 -0
  442. /package/dist/assets/{field-BpgzO1qL.js → field-BEG4O-GE.js} +0 -0
  443. /package/dist/assets/{formatting-D99dzYue.js → formatting-8sgDjIAp.js} +0 -0
  444. /package/dist/assets/{forth-SxB4ZE9Q.js → forth-DgH1dN75.js} +0 -0
  445. /package/dist/assets/{fortran-DzfX8wbd.js → fortran-DueLTtxK.js} +0 -0
  446. /package/dist/assets/{gas-DBFUG9nK.js → gas-BtO1qNqf.js} +0 -0
  447. /package/dist/assets/{gherkin-6FC2E3f3.js → gherkin-Byo7wP7t.js} +0 -0
  448. /package/dist/assets/{groovy-p_lTFq3O.js → groovy-wqVc62K1.js} +0 -0
  449. /package/dist/assets/{haskell-BEXqDWIp.js → haskell-t8q2n4aR.js} +0 -0
  450. /package/dist/assets/{haxe-CzFMbUhy.js → haxe-I2Ep_IKg.js} +0 -0
  451. /package/dist/assets/{http-BxcKXOao.js → http-VleqgIZJ.js} +0 -0
  452. /package/dist/assets/{icons-CIUvkMzI.js → icons-CAcY8GzB.js} +0 -0
  453. /package/dist/assets/{idl-CuZt9Cr8.js → idl-zLnMWGy-.js} +0 -0
  454. /package/dist/assets/{init-_0O8gaZg.js → init-C5GnArQr.js} +0 -0
  455. /package/dist/assets/{javascript-CULX8PvY.js → javascript-Z0GGm0j8.js} +0 -0
  456. /package/dist/assets/{julia-DowlkI_L.js → julia-iSGDYIgg.js} +0 -0
  457. /package/dist/assets/{katex-BrOUG02-.js → katex-BUjpoqH9.js} +0 -0
  458. /package/dist/assets/{label-CNKB6XuV.js → label-KlZhD0Wz.js} +0 -0
  459. /package/dist/assets/{links-BpU-Tgoi.js → links-BwkQr4sn.js} +0 -0
  460. /package/dist/assets/{livescript-DwfI62L3.js → livescript-BFHCYYQr.js} +0 -0
  461. /package/dist/assets/{loro_wasm_bg-G5oJHASf.js → loro_wasm_bg-DbCRx7th.js} +0 -0
  462. /package/dist/assets/{lua-TCNDuI3W.js → lua-CReDSu5T.js} +0 -0
  463. /package/dist/assets/{marimo-icons-xeZXdanj.js → marimo-icons-DyCeIvCg.js} +0 -0
  464. /package/dist/assets/{math-BSPSgcD8.js → math-D5yoTCoa.js} +0 -0
  465. /package/dist/assets/{mathematica-hf3OzlV6.js → mathematica-Zm2C8amS.js} +0 -0
  466. /package/dist/assets/{mbox-CpM9PyZY.js → mbox-WgafSHjo.js} +0 -0
  467. /package/dist/assets/{mirc-CocHA0SZ.js → mirc-BYSZ-Sqw.js} +0 -0
  468. /package/dist/assets/{mllike-CPBcvlCk.js → mllike-oFV79iRi.js} +0 -0
  469. /package/dist/assets/{modelica--OnAmDkI.js → modelica-Kw0oZiZv.js} +0 -0
  470. /package/dist/assets/{mscgen-CtSx20C4.js → mscgen-zIXnH6Xb.js} +0 -0
  471. /package/dist/assets/{multi-icon-DQ0zErpq.js → multi-icon-CDO-SrVQ.js} +0 -0
  472. /package/dist/assets/{mumps-BavaVlaQ.js → mumps-CpHKxUaP.js} +0 -0
  473. /package/dist/assets/{nginx-BFZZWp0k.js → nginx-D7OKXoUe.js} +0 -0
  474. /package/dist/assets/{node-sql-parser-Bb3JynSW.js → node-sql-parser-GMJwIlZ5.js} +0 -0
  475. /package/dist/assets/{ntriples-B5NSxx1D.js → ntriples-CKdsn4A2.js} +0 -0
  476. /package/dist/assets/{octave-jVWS5ZX5.js → octave-C2KzGqDI.js} +0 -0
  477. /package/dist/assets/{oz-Ci6i2p3E.js → oz-DjI17vbg.js} +0 -0
  478. /package/dist/assets/{panel-context--v5sYr8m.js → panel-context-DsLB_70p.js} +0 -0
  479. /package/dist/assets/{pascal-BI-nobSy.js → pascal-DkEHIeYy.js} +0 -0
  480. /package/dist/assets/{path-Bve_rTap.js → path-CK3C5L0Q.js} +0 -0
  481. /package/dist/assets/{perl-DQPnX7YE.js → perl-awUeMoRf.js} +0 -0
  482. /package/dist/assets/{pig-Bh76ij4R.js → pig-4piEzRGm.js} +0 -0
  483. /package/dist/assets/{powershell-uUfnWMx0.js → powershell-BcdXyDpe.js} +0 -0
  484. /package/dist/assets/{properties-Br22JNZV.js → properties-BCPnyAME.js} +0 -0
  485. /package/dist/assets/{protobuf-DaigdXrD.js → protobuf-UUgrcPiO.js} +0 -0
  486. /package/dist/assets/{puppet-BGGCC9ZJ.js → puppet-CK_Jbc3D.js} +0 -0
  487. /package/dist/assets/{python-DuwDWlpq.js → python-87A6eX9C.js} +0 -0
  488. /package/dist/assets/{q-BbDtxSzU.js → q-JHqp7Nwz.js} +0 -0
  489. /package/dist/assets/{r-CB416o25.js → r-c8ebDReJ.js} +0 -0
  490. /package/dist/assets/{react-resizable-panels.browser.esm-CHZt2sgR.js → react-resizable-panels.browser.esm-Dmf4Xg1J.js} +0 -0
  491. /package/dist/assets/{renderShortcut-DKHsNYY8.js → renderShortcut-BcNNtnIV.js} +0 -0
  492. /package/dist/assets/{request-registry-kkWOuc4m.js → request-registry-5S3nI4D-.js} +0 -0
  493. /package/dist/assets/{requests-ELfSRZg2.js → requests-A6SCIaF6.js} +0 -0
  494. /package/dist/assets/{rpm-DgDcBXHy.js → rpm-CHLEEyak.js} +0 -0
  495. /package/dist/assets/{ruby-ASZz88uL.js → ruby-Y-uPbf0g.js} +0 -0
  496. /package/dist/assets/{runs-ClVtrGLV.js → runs-B_mJSod5.js} +0 -0
  497. /package/dist/assets/{sas-r-6e1yzr.js → sas-Mox1fRNZ.js} +0 -0
  498. /package/dist/assets/{scheme-Zi7xVoso.js → scheme-BnTHsLZG.js} +0 -0
  499. /package/dist/assets/{shell-pXDc9W8j.js → shell-C8EAw2yh.js} +0 -0
  500. /package/dist/assets/{sieve-DMn8OnOt.js → sieve-Dd1bnzub.js} +0 -0
  501. /package/dist/assets/{simple-mode-Bcot9qoq.js → simple-mode-BGiIHaLF.js} +0 -0
  502. /package/dist/assets/{slides-component-BhJkZVhE.js → slides-component-Da4ws_2P.js} +0 -0
  503. /package/dist/assets/{smalltalk-kxU8S6r5.js → smalltalk-BUSkf3e4.js} +0 -0
  504. /package/dist/assets/{solr-BCnpA4mK.js → solr-CDPrSrj5.js} +0 -0
  505. /package/dist/assets/{sparql-CA3NQZJW.js → sparql-DeaDxQi8.js} +0 -0
  506. /package/dist/assets/{spreadsheet-C39QEIvH.js → spreadsheet-BsJYzkOI.js} +0 -0
  507. /package/dist/assets/{sql-CE9Btgz4.js → sql-F2Gt8FSJ.js} +0 -0
  508. /package/dist/assets/{src-cSe6DUft.js → src-BgRVyE5A.js} +0 -0
  509. /package/dist/assets/{state-JpzFxtY6.js → state-DnmL6F-D.js} +0 -0
  510. /package/dist/assets/{stylus-DRN2WCqM.js → stylus-DYCEsZr5.js} +0 -0
  511. /package/dist/assets/{swift-BCXokZ3z.js → swift-Duztmfb3.js} +0 -0
  512. /package/dist/assets/{table-BX1kXOsy.js → table-C-4zXNgf.js} +0 -0
  513. /package/dist/assets/{tcl-CHeLjBFR.js → tcl-DI2Tsoc-.js} +0 -0
  514. /package/dist/assets/{textile-B9G88G2h.js → textile-Bu0-gYeb.js} +0 -0
  515. /package/dist/assets/{tiddlywiki-CIp8hgce.js → tiddlywiki-BiVbsin5.js} +0 -0
  516. /package/dist/assets/{tiki-C22wqq7_.js → tiki-BjQr6gnj.js} +0 -0
  517. /package/dist/assets/{timer-DolQqlHY.js → timer-ubTuPSiq.js} +0 -0
  518. /package/dist/assets/{toggle-iY_IwLg6.js → toggle-wwEdkCCQ.js} +0 -0
  519. /package/dist/assets/{toml-C5eRG8KV.js → toml-DS7p65H0.js} +0 -0
  520. /package/dist/assets/{treemap-wGELRPvg.js → treemap-D7anCkBi.js} +0 -0
  521. /package/dist/assets/{troff-CynCaHoK.js → troff-CmiSltql.js} +0 -0
  522. /package/dist/assets/{ttcn-B5PzIipG.js → ttcn-BcG2XAz0.js} +0 -0
  523. /package/dist/assets/{ttcn-cfg-Cboa6Jff.js → ttcn-cfg-rI2k2_Cz.js} +0 -0
  524. /package/dist/assets/{turtle-DqWnTCnP.js → turtle-7DaLnk-7.js} +0 -0
  525. /package/dist/assets/{types-DQ8fCbJK.js → types-CzVV1kKu.js} +0 -0
  526. /package/dist/assets/{useDeepCompareMemoize-BeNvU69i.js → useDeepCompareMemoize-Boltfl1B.js} +0 -0
  527. /package/dist/assets/{useInterval-THXC3A8S.js → useInterval-B8uaa6vj.js} +0 -0
  528. /package/dist/assets/{vb-D8y-MYBx.js → vb-B69cws1B.js} +0 -0
  529. /package/dist/assets/{vbscript-BnxMJuyI.js → vbscript-oR9jLSFn.js} +0 -0
  530. /package/dist/assets/{velocity-BxU4epmQ.js → velocity-CC4QjE_N.js} +0 -0
  531. /package/dist/assets/{verilog-BgK37K4c.js → verilog-DbzXDa_i.js} +0 -0
  532. /package/dist/assets/{vhdl-BV4w9W-F.js → vhdl-qbVPPYo_.js} +0 -0
  533. /package/dist/assets/{web-vitals-Q0-_CtWm.js → web-vitals--izkZsoM.js} +0 -0
  534. /package/dist/assets/{webidl-DaaapXpa.js → webidl-BkN24yvL.js} +0 -0
  535. /package/dist/assets/{ws-CnD6N6WA.js → ws-BYrDQlXa.js} +0 -0
  536. /package/dist/assets/{xquery-CXfthI-4.js → xquery-B3G1Qm2c.js} +0 -0
  537. /package/dist/assets/{yacas-DNslH_e4.js → yacas-DWdEPLXb.js} +0 -0
  538. /package/dist/assets/{z80-BrPJ63JS.js → z80-cCig3JnZ.js} +0 -0
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./any-language-editor-DVOJvjS_.js","./copy-icon-BNQYrUYC.js","./button-Ej3vmCIF.js","./useEventListener-Dy81QR4n.js","./compiler-runtime-B3qBwwSJ.js","./react-Bj1aDYRI.js","./chunk-LvLJmgfZ.js","./cn-BoaCR37F.js","./clsx-BDxNtGmi.js","./jsx-runtime-icT_Ltz2.js","./tooltip-BCGmr4TU.js","./Combination-CXstThSr.js","./react-dom-CSu739Rf.js","./dist-CGECLNMY.js","./use-toast-BhMe50aT.js","./copy-CIPmwSuj.js","./check-DZA_bRpw.js","./createLucideIcon-Cm-Z7dYr.js","./copy-CkudG0Ej.js","./error-banner-D6woGaqN.js","./alert-dialog-BfHy00ko.js","./errors-Bhwg_4_Q.js","./zod-H_cgTO0M.js","./dist-CTTKEfeu.js","./dist-B_cxg-E4.js","./dist-Bh-vrbeU.js","./dist-DbWhwe76.js","./dist-D0Vj4Kqc.js","./dist-DA4gn7fy.js","./dist-4rKUx1vk.js","./dist-DvbdggRI.js","./dist-D699xT6P.js","./dist-1ZGGzJka.js","./dist-BKkfH6MG.js","./dist-BXtR56No.js","./dist-epQooxQL.js","./dist-BrZ_53nc.js","./dist-CwHZ5Z_A.js","./dist-DmMcU97h.js","./esm-BMWduMhT.js","./extends-tyH9bzbk.js","./objectWithoutPropertiesLoose-D67umz3-.js","./dist-CtXb4bUU.js","./esm-BjKAkBIt.js","./dist-C9G2F7Z1.js","./dist-DBBqNJ3C.js","./dist-BZJrw9vI.js","./dist-CEeVCRd_.js","./dist-CwjzLMbM.js","./dist-DKnn_Tta.js","./apl-lvMF4O0c.js","./asciiarmor-NoSIZ2RH.js","./asn1-Bn2zPmGi.js","./brainfuck-CyXrVlbF.js","./clike-DKMmTh42.js","./clojure-PSUkitBX.js","./cmake-DzLpRry9.js","./cobol-DAqlVpNy.js","./coffeescript-CVRVei5N.js","./commonlisp-DGLna-nK.js","./crystal-D1je9SnX.js","./css-CpgzfyW4.js","./cypher-SIaJhgm6.js","./d-BQbC3v5b.js","./diff-Du4D-Lj4.js","./dtd-C8APvYNQ.js","./dylan-CTr_RHNL.js","./ecl-BVnD0OAx.js","./eiffel-9mt0KSLh.js","./elm-CItjDkKL.js","./erlang-D8gZbSC3.js","./factor-ByjtQqb6.js","./simple-mode-BGiIHaLF.js","./forth-DgH1dN75.js","./fortran-DueLTtxK.js","./gas-BtO1qNqf.js","./gherkin-Byo7wP7t.js","./groovy-wqVc62K1.js","./haskell-t8q2n4aR.js","./haxe-I2Ep_IKg.js","./idl-zLnMWGy-.js","./javascript-Z0GGm0j8.js","./julia-iSGDYIgg.js","./livescript-BFHCYYQr.js","./lua-CReDSu5T.js","./mathematica-Zm2C8amS.js","./mbox-WgafSHjo.js","./mirc-BYSZ-Sqw.js","./mllike-oFV79iRi.js","./modelica-Kw0oZiZv.js","./mscgen-zIXnH6Xb.js","./mumps-CpHKxUaP.js","./nsis-BKA2hITd.js","./ntriples-CKdsn4A2.js","./octave-C2KzGqDI.js","./oz-DjI17vbg.js","./pascal-DkEHIeYy.js","./perl-awUeMoRf.js","./pig-4piEzRGm.js","./powershell-BcdXyDpe.js","./properties-BCPnyAME.js","./protobuf-UUgrcPiO.js","./pug-Bc3B5zy9.js","./puppet-CK_Jbc3D.js","./python-87A6eX9C.js","./q-JHqp7Nwz.js","./r-c8ebDReJ.js","./rpm-CHLEEyak.js","./ruby-Y-uPbf0g.js","./sas-Mox1fRNZ.js","./scheme-BnTHsLZG.js","./shell-C8EAw2yh.js","./sieve-Dd1bnzub.js","./smalltalk-BUSkf3e4.js","./sparql-DeaDxQi8.js","./stex-FMMSUPAS.js","./stylus-DYCEsZr5.js","./swift-Duztmfb3.js","./tcl-DI2Tsoc-.js","./textile-Bu0-gYeb.js","./toml-DS7p65H0.js","./troff-CmiSltql.js","./ttcn-cfg-rI2k2_Cz.js","./ttcn-BcG2XAz0.js","./turtle-7DaLnk-7.js","./vb-B69cws1B.js","./vbscript-oR9jLSFn.js","./velocity-CC4QjE_N.js","./verilog-DbzXDa_i.js","./vhdl-qbVPPYo_.js","./webidl-BkN24yvL.js","./xquery-B3G1Qm2c.js","./yacas-DWdEPLXb.js","./z80-cCig3JnZ.js"])))=>i.map(i=>d[i]);
2
+ import{s as e}from"./chunk-LvLJmgfZ.js";import{t as i}from"./react-Bj1aDYRI.js";import{t as o}from"./createLucideIcon-Cm-Z7dYr.js";import{t as m}from"./preload-helper-TXkS1QI3.js";let r,a,s=(async()=>{r=o("between-horizontal-start",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]),a=(0,e(i(),1).lazy)(()=>m(()=>import("./any-language-editor-DVOJvjS_.js").then(async t=>(await t.__tla,t)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133]),import.meta.url))})();export{s as __tla,r as n,a as t};
@@ -1,7 +1,7 @@
1
- import{s as R}from"./chunk-LvLJmgfZ.js";import{d as ye,f as ve,l as Ne,u as be}from"./useEvent-O0nX5vok.js";import{t as ke}from"./react-Bj1aDYRI.js";import{E as we,Tn as Ie,X as $e,Xr as _e,Zn as Fe,Zr as G,_n as Ae,b as Te,li as Ce}from"./cells-BZ2tqr8k.js";import{t as q}from"./compiler-runtime-B3qBwwSJ.js";import{t as Se}from"./invariant-CQUIhlu2.js";import{r as Me}from"./utils-tNbLd14P.js";import{t as ze}from"./jsx-runtime-icT_Ltz2.js";import{r as J,t as $}from"./button-Ej3vmCIF.js";import{t as K}from"./cn-BoaCR37F.js";import{t as H}from"./createLucideIcon-Cm-Z7dYr.js";import{r as Ee}from"./x-CdLP7-v3.js";import{a as qe,p as Pe,r as Le,t as We}from"./dropdown-menu-CA9akLlF.js";import{t as Ve}from"./sparkles-DWCvxqYL.js";import{c as Y,n as Be}from"./datasource-xu50qvjI.js";import{a as Qe}from"./dist-BXtR56No.js";import{t as ee}from"./tooltip-BCGmr4TU.js";import{a as De,i as Oe,n as He,r as Ue}from"./multi-map-1zWiWMZF.js";import{t as te}from"./kbd-DozzbQaK.js";import{t as A}from"./links-DXQarNcJ.js";import{r as Xe,t as Ze}from"./alert-Cv0TRjV-.js";import{o as Re,t as Ge}from"./useInstallPackage-DYIBbH-R.js";import{n as Je}from"./state-CI4FLWoL.js";import{n as b}from"./cell-link-BgNPg6FR.js";var Ke=H("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),T=H("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"}]]),re=H("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);function Ye(r){let e=null,s=r.cursor();do s.name==="ExpressionStatement"&&(e=s.node);while(s.next());return e}function et(r){let e=r.split(`
2
- `),s=" ",n=Ye(Qe.parse(r));if(!n)return["def _():",...U(e,s),`${s}return`,"","","_()"].join(`
1
+ import{s as Z}from"./chunk-LvLJmgfZ.js";import{d as ye,f as ve,l as Ne,u as be}from"./useEvent-O0nX5vok.js";import{t as ke}from"./react-Bj1aDYRI.js";import{E as we,En as Ie,Qn as $e,Qr as G,X as _e,Zr as Fe,b as Ae,ui as Te,vn as Ce}from"./cells-B8rT_yJt.js";import{t as q}from"./compiler-runtime-B3qBwwSJ.js";import{t as Se}from"./invariant-CQUIhlu2.js";import{r as Me}from"./utils-tNbLd14P.js";import{t as Ee}from"./jsx-runtime-icT_Ltz2.js";import{r as J,t as $}from"./button-Ej3vmCIF.js";import{t as K}from"./cn-BoaCR37F.js";import{t as H}from"./createLucideIcon-Cm-Z7dYr.js";import{r as ze}from"./x-CdLP7-v3.js";import{a as qe,p as Pe,r as Le,t as We}from"./dropdown-menu-CA9akLlF.js";import{t as Qe}from"./sparkles-DWCvxqYL.js";import{c as Y,n as Ve}from"./datasource-xomiPYKd.js";import{a as Be}from"./dist-BXtR56No.js";import{t as ee}from"./tooltip-BCGmr4TU.js";import{a as De,i as Oe,n as He,r as Ue}from"./multi-map-1zWiWMZF.js";import{t as te}from"./kbd-DozzbQaK.js";import{t as A}from"./links-DXQarNcJ.js";import{r as Re,t as Xe}from"./alert-Cv0TRjV-.js";import{o as Ze,t as Ge}from"./useInstallPackage-DYIBbH-R.js";import{n as Je}from"./state-DLmIk5GZ.js";import{n as b}from"./cell-link-DV3G9zVQ.js";var Ke=H("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]),T=H("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"}]]),re=H("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);function Ye(r){let e=null,s=r.cursor();do s.name==="ExpressionStatement"&&(e=s.node);while(s.next());return e}function et(r){let e=r.split(`
2
+ `),s=" ",n=Ye(Be.parse(r));if(!n)return["def _():",...U(e,s),`${s}return`,"","","_()"].join(`
3
3
  `);let i=r.slice(0,n.from).trim(),l=r.slice(n.from).trim(),a=i.split(`
4
4
  `),c=l.split(`
5
5
  `);return["def _():",...U(a,s),`${s}return ${c[0]}`,...U(c.slice(1),s),"","","_()"].join(`
6
- `)}function U(r,e){if(r.length===1&&r[0]==="")return[];let s=[];for(let n of r)n===""?s.push(""):s.push(e+n);return s}function tt(r,e){var s;if(r.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 n=>{Se(n.editor,"Editor is null");let i=et(n.editor.state.doc.toString());n.editor.dispatch({changes:{from:0,to:n.editor.state.doc.length,insert:i}})}}];if(r.type==="exception"&&r.exception_type==="NameError"){let n=(s=r.msg.match(/name '(.+)' is not defined/))==null?void 0:s[1];if(!n||!(n in se))return[];let i=rt(n);return[{title:`Fix: Add '${i}'`,description:"Add a new cell for the missing import",fixType:"manual",onFix:async l=>{l.addCodeBelow(i)}}]}return r.type==="sql-error"&&e.aiEnabled?[{title:"Fix with AI",description:"Fix the SQL statement",fixType:"ai",onFix:async n=>{var a;let i=Be(n.cellId),l=`Fix the SQL statement: ${r.msg}.`;i&&(l+=`
7
- Database schema: ${i}`),(a=n.aiFix)==null||a.setAiCompletionCell({cellId:n.cellId,initialPrompt:l,triggerImmediately:n.aiFix.triggerFix})}}]:[]}function rt(r){let e=se[r];return e===r?`import ${e}`:`import ${e} as ${r}`}var se={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"},st=q(),nt=Ce("marimo:ai-autofix-mode","autofix",Ie);function lt(){let r=(0,st.c)(3),[e,s]=Ne(nt),n;return r[0]!==e||r[1]!==s?(n={fixMode:e,setFixMode:s},r[0]=e,r[1]=s,r[2]=n):n=r[2],n}var X=q(),t=R(ze(),1);const N=r=>{let e=(0,X.c)(21),{errors:s,cellId:n,className:i}=r,l=ve(),{createNewCell:a}=we(),c=be(Me),o;if(e[0]!==c||e[1]!==s){let x;e[3]===c?x=e[4]:(x=y=>tt(y,{aiEnabled:c}),e[3]=c,e[4]=x),o=s.flatMap(x),e[0]=c,e[1]=s,e[2]=o}else o=e[2];let m=o,p=ye(Je);if(m.length===0)return null;let d=m[0],f;e[5]!==n||e[6]!==a||e[7]!==d||e[8]!==p||e[9]!==l?(f=x=>{var k;let y=(k=l.get(Te).cellHandles[n].current)==null?void 0:k.editorView;d.onFix({addCodeBelow:_=>{a({cellId:n,autoFocus:!1,before:!1,code:_})},editor:y,cellId:n,aiFix:{setAiCompletionCell:p,triggerFix:x}}),y==null||y.focus()},e[5]=n,e[6]=a,e[7]=d,e[8]=p,e[9]=l,e[10]=f):f=e[10];let u=f,j;e[11]===i?j=e[12]:(j=K("my-2",i),e[11]=i,e[12]=j);let h;e[13]!==d.description||e[14]!==d.fixType||e[15]!==d.title||e[16]!==u?(h=d.fixType==="ai"?(0,t.jsx)(oe,{tooltip:d.description,openPrompt:()=>u(!1),applyAutofix:()=>u(!0)}):(0,t.jsx)(ee,{content:d.description,align:"start",children:(0,t.jsxs)($,{size:"xs",variant:"outline",className:"font-normal",onClick:()=>u(!1),children:[(0,t.jsx)(Y,{className:"h-3 w-3 mr-2"}),d.title]})}),e[13]=d.description,e[14]=d.fixType,e[15]=d.title,e[16]=u,e[17]=h):h=e[17];let g;return e[18]!==j||e[19]!==h?(g=(0,t.jsx)("div",{className:j,children:h}),e[18]=j,e[19]=h,e[20]=g):g=e[20],g};var ne=Ve,le=Y,ie="Suggest a prompt",ae="Fix with AI";const oe=r=>{let e=(0,X.c)(21),{tooltip:s,openPrompt:n,applyAutofix:i}=r,{fixMode:l,setFixMode:a}=lt(),c=l==="prompt"?n:i,o;e[0]===l?o=e[1]:(o=l==="prompt"?(0,t.jsx)(ne,{className:"h-3 w-3 mr-2 mb-0.5"}):(0,t.jsx)(le,{className:"h-3 w-3 mr-2 mb-0.5"}),e[0]=l,e[1]=o);let m=l==="prompt"?ie:ae,p;e[2]!==c||e[3]!==o||e[4]!==m?(p=(0,t.jsxs)($,{size:"xs",variant:"outline",className:"font-normal rounded-r-none border-r-0",onClick:c,children:[o,m]}),e[2]=c,e[3]=o,e[4]=m,e[5]=p):p=e[5];let d;e[6]!==p||e[7]!==s?(d=(0,t.jsx)(ee,{content:s,align:"start",children:p}),e[6]=p,e[7]=s,e[8]=d):d=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)(Pe,{asChild:!0,children:(0,t.jsx)($,{size:"xs",variant:"outline",className:"rounded-l-none px-2","aria-label":"Fix options",children:(0,t.jsx)(Ee,{className:"h-3 w-3"})})}),e[9]=f):f=e[9];let u;e[10]!==l||e[11]!==a?(u=()=>{a(l==="prompt"?"autofix":"prompt")},e[10]=l,e[11]=a,e[12]=u):u=e[12];let j=l==="prompt"?"autofix":"prompt",h;e[13]===j?h=e[14]:(h=(0,t.jsx)(it,{mode:j}),e[13]=j,e[14]=h);let g;e[15]!==u||e[16]!==h?(g=(0,t.jsxs)(We,{children:[f,(0,t.jsx)(Le,{align:"end",className:"w-56",children:(0,t.jsx)(qe,{className:"flex items-center gap-2",onClick:u,children:h})})]}),e[15]=u,e[16]=h,e[17]=g):g=e[17];let x;return e[18]!==g||e[19]!==d?(x=(0,t.jsxs)("div",{className:"flex",children:[d,g]}),e[18]=g,e[19]=d,e[20]=x):x=e[20],x};var it=r=>{let e=(0,X.c)(12),{mode:s}=r,n;e[0]===s?n=e[1]:(n=s==="prompt"?(0,t.jsx)(ne,{className:"h-4 w-4"}):(0,t.jsx)(le,{className:"h-4 w-4"}),e[0]=s,e[1]=n);let i=n,l=s==="prompt"?ie:ae,a=s==="prompt"?"Edit the prompt before applying":"Apply AI fixes automatically",c;e[2]===l?c=e[3]:(c=(0,t.jsx)("span",{className:"font-medium",children:l}),e[2]=l,e[3]=c);let o;e[4]===a?o=e[5]:(o=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:a}),e[4]=a,e[5]=o);let m;e[6]!==c||e[7]!==o?(m=(0,t.jsxs)("div",{className:"flex flex-col",children:[c,o]}),e[6]=c,e[7]=o,e[8]=m):m=e[8];let p;return e[9]!==i||e[10]!==m?(p=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i,m]}),e[9]=i,e[10]=m,e[11]=p):p=e[11],p},ce=/(https?:\/\/\S+)/,at=/\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i,de=/^data:image\//i,ot=["avatars.githubusercontent.com"];function me(r){return de.test(r)?[{type:"image",url:r}]:r.split(ce).filter(e=>e!=="").map(e=>ce.test(e)?at.test(e)||de.test(e)||ot.some(s=>e.includes(s))?{type:"image",url:e}:{type:"url",url:e}:{type:"text",value:e})}var pe=q(),P=R(ke(),1),ct=new $e;const Z=r=>{let e=RegExp("\x1B\\[[0-9;]*m","g");return r.replaceAll(e,"")};var ue=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi;function dt(r){ue.lastIndex=0;let e=ue.exec(r);if(!e)return null;let s=e.index+e[0].length,n=r.slice(s).split(/\s+/),i="",l=0;for(let c of n){let o=c.trim();if(!o)continue;if(o.startsWith("-")){l+=o.length+1;continue}let m=o.match(/^[\w,.[\]-]+/);if(m){i=m[0];break}break}if(!i)return null;let a=s+l+i.length;return{package:i,endIndex:a}}function w(r,e=""){if(!r)return null;if(!/https?:\/\//.test(r))return r;let s=me(r);return s.length===1&&s[0].type==="text"?r:(0,t.jsx)(t.Fragment,{children:s.map((n,i)=>{let l=e?`${e}-${i}`:i;if(n.type==="url"){let a=Z(n.url);return(0,t.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:J.stopPropagation(),className:"text-link hover:underline",children:a},l)}if(n.type==="image"){let a=Z(n.url);return(0,t.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:J.stopPropagation(),className:"text-link hover:underline",children:a},l)}return(0,t.jsx)(P.Fragment,{children:n.value},l)})})}var mt=r=>{let e=(0,pe.c)(6),{packages:s,children:n}=r,{handleInstallPackages:i}=Ge(),l;e[0]!==i||e[1]!==s?(l=c=>{i(s),c.preventDefault()},e[0]=i,e[1]=s,e[2]=l):l=e[2];let a;return e[3]!==n||e[4]!==l?(a=(0,t.jsx)("button",{onClick:l,className:"text-link hover:underline",type:"button",children:n}),e[3]=n,e[4]=l,e[5]=a):a=e[5],a};const pt=r=>{if(!(r instanceof G.Text))return;let e=Z(r.data);if(!/(pip\s+install|uv\s+add|uv\s+pip\s+install)/i.test(e))return;let s=[],n=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi,i;for(;(i=n.exec(e))!==null;){let c=i.index,o=dt(e.slice(c));o&&s.push({match:i,result:o})}if(s.length===0)return;let l=[],a=0;if(s.forEach((c,o)=>{let{match:m,result:p}=c,d=m.index,f=d+p.endIndex;if(a<d){let j=e.slice(a,d);l.push((0,t.jsx)(P.Fragment,{children:w(j,`before-${o}`)},`before-${o}`))}let u=e.slice(d,f);l.push((0,t.jsx)(mt,{packages:[p.package],children:u},`install-${o}`)),a=f}),a<e.length){let c=e.slice(a);l.push((0,t.jsx)(P.Fragment,{children:w(c,"after")},"after"))}return(0,t.jsx)(t.Fragment,{children:l})},ut=r=>{if(!(r instanceof G.Text))return;let e=r.data;if(!/https?:\/\//.test(e))return;let s=w(e);if(typeof s!="string")return(0,t.jsx)(t.Fragment,{children:s})},ht=(...r)=>e=>{for(let s of r){let n=s(e);if(n!==void 0)return n}},xt=(r,e)=>(0,t.jsx)("span",{children:_e(ct.ansi_to_html(r),{replace:s=>e(s)})}),ft=r=>{let e=(0,pe.c)(4),{text:s}=r,n;e[0]===s?n=e[1]:(n=xt(s,ht(pt,ut)),e[0]=s,e[1]=n);let i=n,l;return e[2]===i?l=e[3]:(l=(0,t.jsx)(t.Fragment,{children:i}),e[2]=i,e[3]=l),l};var he=q(),I=r=>{let e=(0,he.c)(10),s=r.title??"Tip",n;e[0]===s?n=e[1]:(n=(0,t.jsx)(De,{className:"pt-2 pb-2 font-normal",children:s}),e[0]=s,e[1]=n);let i;e[2]===r.children?i=e[3]:(i=(0,t.jsx)(Ue,{className:"mr-24 text-[0.84375rem]",children:r.children}),e[2]=r.children,e[3]=i);let l;e[4]!==n||e[5]!==i?(l=(0,t.jsxs)(Oe,{value:"item-1",className:"text-muted-foreground",children:[n,i]}),e[4]=n,e[5]=i,e[6]=l):l=e[6];let a;return e[7]!==r.className||e[8]!==l?(a=(0,t.jsx)(He,{type:"single",collapsible:!0,className:r.className,children:l}),e[7]=r.className,e[8]=l,e[9]=a):a=e[9],a};const jt=r=>{let e=(0,he.c)(31),{errors:s,cellId:n,className:i}=r,l=Ae(),a="This cell wasn't run because it has errors",c="destructive",o="text-error";if(s.some(gt))a="Interrupted";else if(s.some(yt))a="An internal error occurred";else if(s.some(vt))a="Ancestor prevented from running",c="default",o="text-secondary-foreground";else if(s.some(Nt))a="Ancestor stopped",c="default",o="text-secondary-foreground";else if(s.some(bt))a="SQL error";else{let x;e[0]===s?x=e[1]:(x=s.find(kt),e[0]=s,e[1]=x);let y=x;y&&"exception_type"in y&&(a=y.exception_type)}let m,p,d,f,u,j;if(e[2]!==c||e[3]!==n||e[4]!==l||e[5]!==i||e[6]!==s||e[7]!==o||e[8]!==a){let x=s.filter(wt),y=s.filter(It),k=s.filter($t),_=s.filter(_t),L=s.filter(Ft),C=s.filter(At),S=s.filter(Tt),W=s.filter(Ct),V=s.filter(St),B=s.filter(Mt),F=s.filter(zt),Q=s.filter(Et),D=s.filter(qt),M;e[15]===l?M=e[16]:(M=()=>{l.openApplication("scratchpad")},e[15]=l,e[16]=M);let xe=M,fe=()=>{let v=[];if(F.length>0||Q.length>0){let E=F.some(Pt),ge=!E&&F.some(Lt);v.push((0,t.jsxs)("div",{children:[F.map(Wt),Q.map(Vt),E&&(0,t.jsxs)($,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>Re(l),children:[(0,t.jsx)(Ke,{className:"h-3.5 w-3.5 mr-1.5 mb-0.5"}),(0,t.jsx)("span",{children:"Open package manager"})]}),ge&&(0,t.jsxs)($,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>l.openApplication("terminal"),children:[(0,t.jsx)(re,{className:"h-3.5 w-3.5 mr-1.5"}),(0,t.jsx)("span",{children:"Open terminal"})]}),n&&(0,t.jsx)(N,{errors:[...F,...Q],cellId:n})]},"syntax-unknown"))}if(x.length>0&&v.push((0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground font-medium",children:"The setup cell cannot be run because it has references."}),(0,t.jsx)("ul",{className:"list-disc",children:x.flatMap(Bt)}),n&&(0,t.jsx)(N,{errors:x,cellId:n}),(0,t.jsxs)(I,{title:"Why can't the setup cell have references?",className:"mb-2",children:[(0,t.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,t.jsx)("p",{className:"py-2",children:"Try simplifying the setup cell to only contain only necessary variables."}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(A,{href:"https://links.marimo.app/errors-setup",children:["Learn more at our docs"," ",(0,t.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"setup-refs")),y.length>0&&v.push((0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell is in a cycle."}),(0,t.jsx)("ul",{className:"list-disc",children:y.flatMap(Qt)}),n&&(0,t.jsx)(N,{errors:y,cellId:n}),(0,t.jsxs)(I,{title:"What are cycles and how do I resolve them?",className:"mb-2",children:[(0,t.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,t.jsx)("p",{className:"py-2",children:"Try merging these cells into a single cell to eliminate the cycle."}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(A,{href:"https://links.marimo.app/errors-cycles",children:["Learn more at our docs"," ",(0,t.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"cycle")),k.length>0){let E=k[0].name;v.push((0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell redefines variables from other cells."}),k.map(Ot),n&&(0,t.jsx)(N,{errors:k,cellId:n}),(0,t.jsxs)(I,{title:"Why can't I redefine variables?",children:[(0,t.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,t.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,t.jsxs)(te,{className:"inline",children:["_",E]}),"). to make them private to this cell."]}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(A,{href:"https://links.marimo.app/errors-multiple-definitions",children:["Learn more at our docs"," ",(0,t.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]}),(0,t.jsx)(I,{title:"Need a scratchpad?",children:(0,t.jsxs)("div",{className:"flex flex-row gap-2 items-center",children:[(0,t.jsxs)($,{size:"xs",variant:"link",className:"my-2 font-normal mx-0 px-0",onClick:xe,children:[(0,t.jsx)(Fe,{className:"h-3"}),(0,t.jsx)("span",{children:"Try the scratchpad"})]}),(0,t.jsx)("span",{children:"to experiment without restrictions on variable names."})]})})]},"multiple-defs"))}return _.length>0&&v.push((0,t.jsxs)("div",{children:[_.map(Ht),n&&(0,t.jsx)(N,{errors:_,cellId:n}),(0,t.jsxs)(I,{title:"Why can't I use `import *`?",children:[(0,t.jsx)("p",{className:"pb-2",children:"Star imports are incompatible with marimo's git-friendly file format and reproducible reactive execution."}),(0,t.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,t.jsx)("p",{className:"py-2",children:"Star imports would also silently add names to globals, which would be incompatible with reactive execution."}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(A,{href:"https://links.marimo.app/errors-import-star",children:["Learn more at our docs"," ",(0,t.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"import-star")),L.length>0&&v.push((0,t.jsxs)("div",{children:[L.map(Ut),n&&(0,t.jsx)(N,{errors:L,cellId:n})]},"interruption")),C.length>0&&v.push((0,t.jsxs)("ul",{children:[C.map(Xt),C.some(Zt)&&(0,t.jsx)(I,{children:"Fix the error in the mentioned cells, or handle the exceptions with try/except blocks."}),n&&(0,t.jsx)(N,{errors:C,cellId:n})]},"exception")),S.length>0&&v.push((0,t.jsxs)("ul",{children:[S.map(Rt),n&&(0,t.jsx)(N,{errors:S,cellId:n}),(0,t.jsx)(I,{children:S.some(Gt)?"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")),W.length>0&&v.push((0,t.jsxs)("div",{children:[W.map(Jt),n&&(0,t.jsx)(N,{errors:W,cellId:n})]},"internal")),V.length>0&&v.push((0,t.jsxs)("div",{children:[V.map(Kt),n&&(0,t.jsx)(N,{errors:V,cellId:n})]},"ancestor-prevented")),B.length>0&&v.push((0,t.jsxs)("div",{children:[B.map(Yt),n&&(0,t.jsx)(N,{errors:B,cellId:n})]},"ancestor-stopped")),D.length>0&&v.push((0,t.jsxs)("div",{children:[D.map(er),n&&(0,t.jsx)(N,{errors:D,cellId:n,className:"mt-2.5"})]},"sql-errors")),v},O=`font-code font-medium tracking-wide ${o}`,z;e[17]!==O||e[18]!==a?(z=(0,t.jsx)(Xe,{className:O,children:a}),e[17]=O,e[18]=a,e[19]=z):z=e[19];let je=z;m=Ze,f=c,e[20]===i?u=e[21]:(u=K("border-none font-code text-sm text-[0.84375rem] px-0 text-muted-foreground normal [&:has(svg)]:pl-0 space-y-4",i),e[20]=i,e[21]=u),j=je,p="flex flex-col gap-8",d=fe(),e[2]=c,e[3]=n,e[4]=l,e[5]=i,e[6]=s,e[7]=o,e[8]=a,e[9]=m,e[10]=p,e[11]=d,e[12]=f,e[13]=u,e[14]=j}else m=e[9],p=e[10],d=e[11],f=e[12],u=e[13],j=e[14];let h;e[22]!==p||e[23]!==d?(h=(0,t.jsx)("div",{children:(0,t.jsx)("div",{className:p,children:d})}),e[22]=p,e[23]=d,e[24]=h):h=e[24];let g;return e[25]!==m||e[26]!==f||e[27]!==u||e[28]!==j||e[29]!==h?(g=(0,t.jsxs)(m,{variant:f,className:u,children:[j,h]}),e[25]=m,e[26]=f,e[27]=u,e[28]=j,e[29]=h,e[30]=g):g=e[30],g};function gt(r){return r.type==="interruption"}function yt(r){return r.type==="internal"}function vt(r){return r.type==="ancestor-prevented"}function Nt(r){return r.type==="ancestor-stopped"}function bt(r){return r.type==="sql-error"}function kt(r){return r.type==="exception"}function wt(r){return r.type==="setup-refs"}function It(r){return r.type==="cycle"}function $t(r){return r.type==="multiple-defs"}function _t(r){return r.type==="import-star"}function Ft(r){return r.type==="interruption"}function At(r){return r.type==="exception"}function Tt(r){return r.type==="strict-exception"}function Ct(r){return r.type==="internal"}function St(r){return r.type==="ancestor-prevented"}function Mt(r){return r.type==="ancestor-stopped"}function zt(r){return r.type==="syntax"}function Et(r){return r.type==="unknown"}function qt(r){return r.type==="sql-error"}function Pt(r){return r.msg.includes("!pip")}function Lt(r){return r.msg.includes("use os.subprocess")}function Wt(r,e){return(0,t.jsx)("pre",{children:w(r.msg,`syntax-${e}`)},`syntax-${e}`)}function Vt(r,e){return(0,t.jsx)("pre",{children:w(r.msg,`unknown-${e}`)},`unknown-${e}`)}function Bt(r,e){return r.edges_with_vars.map((s,n)=>(0,t.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,t.jsx)(b,{cellId:s[0]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:[": "," ",s[1].length===1?s[1][0]:s[1].join(", ")]})]},`setup-refs-${e}-${n}`))}function Qt(r,e){return r.edges_with_vars.map((s,n)=>(0,t.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,t.jsx)(b,{cellId:s[0]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:[" -> ",s[1].length===1?s[1][0]:s[1].join(", ")," -> "]}),(0,t.jsx)(b,{cellId:s[2]})]},`cycle-${e}-${n}`))}function Dt(r,e){return(0,t.jsx)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:(0,t.jsx)(b,{cellId:r})},`cell-${e}`)}function Ot(r,e){return(0,t.jsxs)(P.Fragment,{children:[(0,t.jsx)("p",{className:"text-muted-foreground mt-2",children:`'${r.name}' was also defined by:`}),(0,t.jsx)("ul",{className:"list-disc",children:r.cells.map(Dt)})]},`multiple-defs-${e}`)}function Ht(r,e){return(0,t.jsx)("p",{className:"text-muted-foreground",children:r.msg},`import-star-${e}`)}function Ut(r,e){return(0,t.jsx)("p",{children:"This cell was interrupted and needs to be re-run."},`interruption-${e}`)}function Xt(r,e){return r.exception_type==="NameError"&&r.msg.startsWith("name 'mo'")?(0,t.jsx)("li",{className:"my-2",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground",children:"name 'mo' is not defined."}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-2",children:["The marimo module (imported as"," ",(0,t.jsx)(te,{className:"inline",children:"mo"}),") is required for Markdown, SQL, and UI elements."]})]})},`exception-${e}`):r.exception_type==="NameError"&&r.msg.startsWith("name '_")?(0,t.jsx)("li",{className:"my-2",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground",children:r.msg}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-2",children:["Variables prefixed with an underscore are local to a cell"," ","(",(0,t.jsxs)(A,{href:"https://links.marimo.app/local-variables",children:["docs"," ",(0,t.jsx)(T,{size:"0.75rem",className:"inline"})]}),")."]}),(0,t.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]})},`exception-${e}`):(0,t.jsx)("li",{className:"my-2",children:r.raising_cell==null?(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground",children:w(r.msg,`exception-${e}`)}),(0,t.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]}):(0,t.jsxs)("div",{children:[w(r.msg,`exception-${e}`),(0,t.jsx)(b,{cellId:r.raising_cell})]})},`exception-${e}`)}function Zt(r){return r.raising_cell!=null}function Rt(r,e){return(0,t.jsx)("li",{className:"my-2",children:r.blamed_cell==null?(0,t.jsx)("p",{children:r.msg}):(0,t.jsxs)("div",{children:[r.msg,(0,t.jsx)(b,{cellId:r.blamed_cell})]})},`strict-exception-${e}`)}function Gt(r){return r.blamed_cell!=null}function Jt(r,e){return(0,t.jsx)("p",{children:r.msg},`internal-${e}`)}function Kt(r,e){return(0,t.jsxs)("div",{children:[r.msg,r.blamed_cell==null?(0,t.jsxs)("span",{children:["(",(0,t.jsx)(b,{cellId:r.raising_cell}),")"]}):(0,t.jsxs)("span",{children:["(",(0,t.jsx)(b,{cellId:r.raising_cell}),"\xA0blames\xA0",(0,t.jsx)(b,{cellId:r.blamed_cell}),")"]})]},`ancestor-prevented-${e}`)}function Yt(r,e){return(0,t.jsxs)("div",{children:[r.msg,(0,t.jsx)(b,{cellId:r.raising_cell})]},`ancestor-stopped-${e}`)}function er(r,e){return(0,t.jsx)("div",{className:"space-y-2 mt-2",children:(0,t.jsx)("p",{className:"text-muted-foreground whitespace-pre-wrap",children:r.msg})},`sql-error-${e}`)}export{re as a,oe as i,ft as n,me as r,jt as t};
6
+ `)}function U(r,e){if(r.length===1&&r[0]==="")return[];let s=[];for(let n of r)n===""?s.push(""):s.push(e+n);return s}function tt(r,e){var s;if(r.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 n=>{Se(n.editor,"Editor is null");let i=et(n.editor.state.doc.toString());n.editor.dispatch({changes:{from:0,to:n.editor.state.doc.length,insert:i}})}}];if(r.type==="exception"&&r.exception_type==="NameError"){let n=(s=r.msg.match(/name '(.+)' is not defined/))==null?void 0:s[1];if(!n||!(n in se))return[];let i=rt(n);return[{title:`Fix: Add '${i}'`,description:"Add a new cell for the missing import",fixType:"manual",onFix:async l=>{l.addCodeBelow(i)}}]}return r.type==="sql-error"&&e.aiEnabled?[{title:"Fix with AI",description:"Fix the SQL statement",fixType:"ai",onFix:async n=>{var a;let i=Ve(n.cellId),l=`Fix the SQL statement: ${r.msg}.`;i&&(l+=`
7
+ Database schema: ${i}`),(a=n.aiFix)==null||a.setAiCompletionCell({cellId:n.cellId,initialPrompt:l,triggerImmediately:n.aiFix.triggerFix})}}]:[]}function rt(r){let e=se[r];return e===r?`import ${e}`:`import ${e} as ${r}`}var se={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"},st=q(),nt=Te("marimo:ai-autofix-mode","autofix",Ie);function lt(){let r=(0,st.c)(3),[e,s]=Ne(nt),n;return r[0]!==e||r[1]!==s?(n={fixMode:e,setFixMode:s},r[0]=e,r[1]=s,r[2]=n):n=r[2],n}var R=q(),t=Z(Ee(),1);const N=r=>{let e=(0,R.c)(21),{errors:s,cellId:n,className:i}=r,l=ve(),{createNewCell:a}=we(),c=be(Me),o;if(e[0]!==c||e[1]!==s){let x;e[3]===c?x=e[4]:(x=y=>tt(y,{aiEnabled:c}),e[3]=c,e[4]=x),o=s.flatMap(x),e[0]=c,e[1]=s,e[2]=o}else o=e[2];let m=o,p=ye(Je);if(m.length===0)return null;let d=m[0],f;e[5]!==n||e[6]!==a||e[7]!==d||e[8]!==p||e[9]!==l?(f=x=>{var k;let y=(k=l.get(Ae).cellHandles[n].current)==null?void 0:k.editorView;d.onFix({addCodeBelow:_=>{a({cellId:n,autoFocus:!1,before:!1,code:_})},editor:y,cellId:n,aiFix:{setAiCompletionCell:p,triggerFix:x}}),y==null||y.focus()},e[5]=n,e[6]=a,e[7]=d,e[8]=p,e[9]=l,e[10]=f):f=e[10];let u=f,j;e[11]===i?j=e[12]:(j=K("my-2",i),e[11]=i,e[12]=j);let h;e[13]!==d.description||e[14]!==d.fixType||e[15]!==d.title||e[16]!==u?(h=d.fixType==="ai"?(0,t.jsx)(oe,{tooltip:d.description,openPrompt:()=>u(!1),applyAutofix:()=>u(!0)}):(0,t.jsx)(ee,{content:d.description,align:"start",children:(0,t.jsxs)($,{size:"xs",variant:"outline",className:"font-normal",onClick:()=>u(!1),children:[(0,t.jsx)(Y,{className:"h-3 w-3 mr-2"}),d.title]})}),e[13]=d.description,e[14]=d.fixType,e[15]=d.title,e[16]=u,e[17]=h):h=e[17];let g;return e[18]!==j||e[19]!==h?(g=(0,t.jsx)("div",{className:j,children:h}),e[18]=j,e[19]=h,e[20]=g):g=e[20],g};var ne=Qe,le=Y,ie="Suggest a prompt",ae="Fix with AI";const oe=r=>{let e=(0,R.c)(21),{tooltip:s,openPrompt:n,applyAutofix:i}=r,{fixMode:l,setFixMode:a}=lt(),c=l==="prompt"?n:i,o;e[0]===l?o=e[1]:(o=l==="prompt"?(0,t.jsx)(ne,{className:"h-3 w-3 mr-2 mb-0.5"}):(0,t.jsx)(le,{className:"h-3 w-3 mr-2 mb-0.5"}),e[0]=l,e[1]=o);let m=l==="prompt"?ie:ae,p;e[2]!==c||e[3]!==o||e[4]!==m?(p=(0,t.jsxs)($,{size:"xs",variant:"outline",className:"font-normal rounded-r-none border-r-0",onClick:c,children:[o,m]}),e[2]=c,e[3]=o,e[4]=m,e[5]=p):p=e[5];let d;e[6]!==p||e[7]!==s?(d=(0,t.jsx)(ee,{content:s,align:"start",children:p}),e[6]=p,e[7]=s,e[8]=d):d=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)(Pe,{asChild:!0,children:(0,t.jsx)($,{size:"xs",variant:"outline",className:"rounded-l-none px-2","aria-label":"Fix options",children:(0,t.jsx)(ze,{className:"h-3 w-3"})})}),e[9]=f):f=e[9];let u;e[10]!==l||e[11]!==a?(u=()=>{a(l==="prompt"?"autofix":"prompt")},e[10]=l,e[11]=a,e[12]=u):u=e[12];let j=l==="prompt"?"autofix":"prompt",h;e[13]===j?h=e[14]:(h=(0,t.jsx)(it,{mode:j}),e[13]=j,e[14]=h);let g;e[15]!==u||e[16]!==h?(g=(0,t.jsxs)(We,{children:[f,(0,t.jsx)(Le,{align:"end",className:"w-56",children:(0,t.jsx)(qe,{className:"flex items-center gap-2",onClick:u,children:h})})]}),e[15]=u,e[16]=h,e[17]=g):g=e[17];let x;return e[18]!==g||e[19]!==d?(x=(0,t.jsxs)("div",{className:"flex",children:[d,g]}),e[18]=g,e[19]=d,e[20]=x):x=e[20],x};var it=r=>{let e=(0,R.c)(12),{mode:s}=r,n;e[0]===s?n=e[1]:(n=s==="prompt"?(0,t.jsx)(ne,{className:"h-4 w-4"}):(0,t.jsx)(le,{className:"h-4 w-4"}),e[0]=s,e[1]=n);let i=n,l=s==="prompt"?ie:ae,a=s==="prompt"?"Edit the prompt before applying":"Apply AI fixes automatically",c;e[2]===l?c=e[3]:(c=(0,t.jsx)("span",{className:"font-medium",children:l}),e[2]=l,e[3]=c);let o;e[4]===a?o=e[5]:(o=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:a}),e[4]=a,e[5]=o);let m;e[6]!==c||e[7]!==o?(m=(0,t.jsxs)("div",{className:"flex flex-col",children:[c,o]}),e[6]=c,e[7]=o,e[8]=m):m=e[8];let p;return e[9]!==i||e[10]!==m?(p=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[i,m]}),e[9]=i,e[10]=m,e[11]=p):p=e[11],p},ce=/(https?:\/\/\S+)/,at=/\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i,de=/^data:image\//i,ot=["avatars.githubusercontent.com"];function me(r){return de.test(r)?[{type:"image",url:r}]:r.split(ce).filter(e=>e!=="").map(e=>ce.test(e)?at.test(e)||de.test(e)||ot.some(s=>e.includes(s))?{type:"image",url:e}:{type:"url",url:e}:{type:"text",value:e})}var pe=q(),P=Z(ke(),1),ct=new _e;const X=r=>{let e=RegExp("\x1B\\[[0-9;]*m","g");return r.replaceAll(e,"")};var ue=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi;function dt(r){ue.lastIndex=0;let e=ue.exec(r);if(!e)return null;let s=e.index+e[0].length,n=r.slice(s).split(/\s+/),i="",l=0;for(let c of n){let o=c.trim();if(!o)continue;if(o.startsWith("-")){l+=o.length+1;continue}let m=o.match(/^[\w,.[\]-]+/);if(m){i=m[0];break}break}if(!i)return null;let a=s+l+i.length;return{package:i,endIndex:a}}function w(r,e=""){if(!r)return null;if(!/https?:\/\//.test(r))return r;let s=me(r);return s.length===1&&s[0].type==="text"?r:(0,t.jsx)(t.Fragment,{children:s.map((n,i)=>{let l=e?`${e}-${i}`:i;if(n.type==="url"){let a=X(n.url);return(0,t.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:J.stopPropagation(),className:"text-link hover:underline",children:a},l)}if(n.type==="image"){let a=X(n.url);return(0,t.jsx)("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:J.stopPropagation(),className:"text-link hover:underline",children:a},l)}return(0,t.jsx)(P.Fragment,{children:n.value},l)})})}var mt=r=>{let e=(0,pe.c)(6),{packages:s,children:n}=r,{handleInstallPackages:i}=Ge(),l;e[0]!==i||e[1]!==s?(l=c=>{i(s),c.preventDefault()},e[0]=i,e[1]=s,e[2]=l):l=e[2];let a;return e[3]!==n||e[4]!==l?(a=(0,t.jsx)("button",{onClick:l,className:"text-link hover:underline",type:"button",children:n}),e[3]=n,e[4]=l,e[5]=a):a=e[5],a};const pt=r=>{if(!(r instanceof G.Text))return;let e=X(r.data);if(!/(pip\s+install|uv\s+add|uv\s+pip\s+install)/i.test(e))return;let s=[],n=/(pip\s+install|uv\s+add|uv\s+pip\s+install)\s+/gi,i;for(;(i=n.exec(e))!==null;){let c=i.index,o=dt(e.slice(c));o&&s.push({match:i,result:o})}if(s.length===0)return;let l=[],a=0;if(s.forEach((c,o)=>{let{match:m,result:p}=c,d=m.index,f=d+p.endIndex;if(a<d){let j=e.slice(a,d);l.push((0,t.jsx)(P.Fragment,{children:w(j,`before-${o}`)},`before-${o}`))}let u=e.slice(d,f);l.push((0,t.jsx)(mt,{packages:[p.package],children:u},`install-${o}`)),a=f}),a<e.length){let c=e.slice(a);l.push((0,t.jsx)(P.Fragment,{children:w(c,"after")},"after"))}return(0,t.jsx)(t.Fragment,{children:l})},ut=r=>{if(!(r instanceof G.Text))return;let e=r.data;if(!/https?:\/\//.test(e))return;let s=w(e);if(typeof s!="string")return(0,t.jsx)(t.Fragment,{children:s})},ht=(...r)=>e=>{for(let s of r){let n=s(e);if(n!==void 0)return n}},xt=(r,e)=>(0,t.jsx)("span",{children:Fe(ct.ansi_to_html(r),{replace:s=>e(s)})}),ft=r=>{let e=(0,pe.c)(4),{text:s}=r,n;e[0]===s?n=e[1]:(n=xt(s,ht(pt,ut)),e[0]=s,e[1]=n);let i=n,l;return e[2]===i?l=e[3]:(l=(0,t.jsx)(t.Fragment,{children:i}),e[2]=i,e[3]=l),l};var he=q(),I=r=>{let e=(0,he.c)(10),s=r.title??"Tip",n;e[0]===s?n=e[1]:(n=(0,t.jsx)(De,{className:"pt-2 pb-2 font-normal",children:s}),e[0]=s,e[1]=n);let i;e[2]===r.children?i=e[3]:(i=(0,t.jsx)(Ue,{className:"mr-24 text-[0.84375rem]",children:r.children}),e[2]=r.children,e[3]=i);let l;e[4]!==n||e[5]!==i?(l=(0,t.jsxs)(Oe,{value:"item-1",className:"text-muted-foreground",children:[n,i]}),e[4]=n,e[5]=i,e[6]=l):l=e[6];let a;return e[7]!==r.className||e[8]!==l?(a=(0,t.jsx)(He,{type:"single",collapsible:!0,className:r.className,children:l}),e[7]=r.className,e[8]=l,e[9]=a):a=e[9],a};const jt=r=>{let e=(0,he.c)(31),{errors:s,cellId:n,className:i}=r,l=Ce(),a="This cell wasn't run because it has errors",c="destructive",o="text-error";if(s.some(gt))a="Interrupted";else if(s.some(yt))a="An internal error occurred";else if(s.some(vt))a="Ancestor prevented from running",c="default",o="text-secondary-foreground";else if(s.some(Nt))a="Ancestor stopped",c="default",o="text-secondary-foreground";else if(s.some(bt))a="SQL error";else{let x;e[0]===s?x=e[1]:(x=s.find(kt),e[0]=s,e[1]=x);let y=x;y&&"exception_type"in y&&(a=y.exception_type)}let m,p,d,f,u,j;if(e[2]!==c||e[3]!==n||e[4]!==l||e[5]!==i||e[6]!==s||e[7]!==o||e[8]!==a){let x=s.filter(wt),y=s.filter(It),k=s.filter($t),_=s.filter(_t),L=s.filter(Ft),C=s.filter(At),S=s.filter(Tt),W=s.filter(Ct),Q=s.filter(St),V=s.filter(Mt),F=s.filter(Et),B=s.filter(zt),D=s.filter(qt),M;e[15]===l?M=e[16]:(M=()=>{l.openApplication("scratchpad")},e[15]=l,e[16]=M);let xe=M,fe=()=>{let v=[];if(F.length>0||B.length>0){let z=F.some(Pt),ge=!z&&F.some(Lt);v.push((0,t.jsxs)("div",{children:[F.map(Wt),B.map(Qt),z&&(0,t.jsxs)($,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>Ze(l),children:[(0,t.jsx)(Ke,{className:"h-3.5 w-3.5 mr-1.5 mb-0.5"}),(0,t.jsx)("span",{children:"Open package manager"})]}),ge&&(0,t.jsxs)($,{size:"xs",variant:"outline",className:"mt-2 font-normal",onClick:()=>l.openApplication("terminal"),children:[(0,t.jsx)(re,{className:"h-3.5 w-3.5 mr-1.5"}),(0,t.jsx)("span",{children:"Open terminal"})]}),n&&(0,t.jsx)(N,{errors:[...F,...B],cellId:n})]},"syntax-unknown"))}if(x.length>0&&v.push((0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground font-medium",children:"The setup cell cannot be run because it has references."}),(0,t.jsx)("ul",{className:"list-disc",children:x.flatMap(Vt)}),n&&(0,t.jsx)(N,{errors:x,cellId:n}),(0,t.jsxs)(I,{title:"Why can't the setup cell have references?",className:"mb-2",children:[(0,t.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,t.jsx)("p",{className:"py-2",children:"Try simplifying the setup cell to only contain only necessary variables."}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(A,{href:"https://links.marimo.app/errors-setup",children:["Learn more at our docs"," ",(0,t.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"setup-refs")),y.length>0&&v.push((0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell is in a cycle."}),(0,t.jsx)("ul",{className:"list-disc",children:y.flatMap(Bt)}),n&&(0,t.jsx)(N,{errors:y,cellId:n}),(0,t.jsxs)(I,{title:"What are cycles and how do I resolve them?",className:"mb-2",children:[(0,t.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,t.jsx)("p",{className:"py-2",children:"Try merging these cells into a single cell to eliminate the cycle."}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(A,{href:"https://links.marimo.app/errors-cycles",children:["Learn more at our docs"," ",(0,t.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"cycle")),k.length>0){let z=k[0].name;v.push((0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground font-medium",children:"This cell redefines variables from other cells."}),k.map(Ot),n&&(0,t.jsx)(N,{errors:k,cellId:n}),(0,t.jsxs)(I,{title:"Why can't I redefine variables?",children:[(0,t.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,t.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,t.jsxs)(te,{className:"inline",children:["_",z]}),"). to make them private to this cell."]}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(A,{href:"https://links.marimo.app/errors-multiple-definitions",children:["Learn more at our docs"," ",(0,t.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]}),(0,t.jsx)(I,{title:"Need a scratchpad?",children:(0,t.jsxs)("div",{className:"flex flex-row gap-2 items-center",children:[(0,t.jsxs)($,{size:"xs",variant:"link",className:"my-2 font-normal mx-0 px-0",onClick:xe,children:[(0,t.jsx)($e,{className:"h-3"}),(0,t.jsx)("span",{children:"Try the scratchpad"})]}),(0,t.jsx)("span",{children:"to experiment without restrictions on variable names."})]})})]},"multiple-defs"))}return _.length>0&&v.push((0,t.jsxs)("div",{children:[_.map(Ht),n&&(0,t.jsx)(N,{errors:_,cellId:n}),(0,t.jsxs)(I,{title:"Why can't I use `import *`?",children:[(0,t.jsx)("p",{className:"pb-2",children:"Star imports are incompatible with marimo's git-friendly file format and reproducible reactive execution."}),(0,t.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,t.jsx)("p",{className:"py-2",children:"Star imports would also silently add names to globals, which would be incompatible with reactive execution."}),(0,t.jsxs)("p",{className:"py-2",children:[(0,t.jsxs)(A,{href:"https://links.marimo.app/errors-import-star",children:["Learn more at our docs"," ",(0,t.jsx)(T,{size:"0.75rem",className:"inline"})]}),"."]})]})]},"import-star")),L.length>0&&v.push((0,t.jsxs)("div",{children:[L.map(Ut),n&&(0,t.jsx)(N,{errors:L,cellId:n})]},"interruption")),C.length>0&&v.push((0,t.jsxs)("ul",{children:[C.map(Rt),C.some(Xt)&&(0,t.jsx)(I,{children:"Fix the error in the mentioned cells, or handle the exceptions with try/except blocks."}),n&&(0,t.jsx)(N,{errors:C,cellId:n})]},"exception")),S.length>0&&v.push((0,t.jsxs)("ul",{children:[S.map(Zt),n&&(0,t.jsx)(N,{errors:S,cellId:n}),(0,t.jsx)(I,{children:S.some(Gt)?"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")),W.length>0&&v.push((0,t.jsxs)("div",{children:[W.map(Jt),n&&(0,t.jsx)(N,{errors:W,cellId:n})]},"internal")),Q.length>0&&v.push((0,t.jsxs)("div",{children:[Q.map(Kt),n&&(0,t.jsx)(N,{errors:Q,cellId:n})]},"ancestor-prevented")),V.length>0&&v.push((0,t.jsxs)("div",{children:[V.map(Yt),n&&(0,t.jsx)(N,{errors:V,cellId:n})]},"ancestor-stopped")),D.length>0&&v.push((0,t.jsxs)("div",{children:[D.map(er),n&&(0,t.jsx)(N,{errors:D,cellId:n,className:"mt-2.5"})]},"sql-errors")),v},O=`font-code font-medium tracking-wide ${o}`,E;e[17]!==O||e[18]!==a?(E=(0,t.jsx)(Re,{className:O,children:a}),e[17]=O,e[18]=a,e[19]=E):E=e[19];let je=E;m=Xe,f=c,e[20]===i?u=e[21]:(u=K("border-none font-code text-sm text-[0.84375rem] px-0 text-muted-foreground normal [&:has(svg)]:pl-0 space-y-4",i),e[20]=i,e[21]=u),j=je,p="flex flex-col gap-8",d=fe(),e[2]=c,e[3]=n,e[4]=l,e[5]=i,e[6]=s,e[7]=o,e[8]=a,e[9]=m,e[10]=p,e[11]=d,e[12]=f,e[13]=u,e[14]=j}else m=e[9],p=e[10],d=e[11],f=e[12],u=e[13],j=e[14];let h;e[22]!==p||e[23]!==d?(h=(0,t.jsx)("div",{children:(0,t.jsx)("div",{className:p,children:d})}),e[22]=p,e[23]=d,e[24]=h):h=e[24];let g;return e[25]!==m||e[26]!==f||e[27]!==u||e[28]!==j||e[29]!==h?(g=(0,t.jsxs)(m,{variant:f,className:u,children:[j,h]}),e[25]=m,e[26]=f,e[27]=u,e[28]=j,e[29]=h,e[30]=g):g=e[30],g};function gt(r){return r.type==="interruption"}function yt(r){return r.type==="internal"}function vt(r){return r.type==="ancestor-prevented"}function Nt(r){return r.type==="ancestor-stopped"}function bt(r){return r.type==="sql-error"}function kt(r){return r.type==="exception"}function wt(r){return r.type==="setup-refs"}function It(r){return r.type==="cycle"}function $t(r){return r.type==="multiple-defs"}function _t(r){return r.type==="import-star"}function Ft(r){return r.type==="interruption"}function At(r){return r.type==="exception"}function Tt(r){return r.type==="strict-exception"}function Ct(r){return r.type==="internal"}function St(r){return r.type==="ancestor-prevented"}function Mt(r){return r.type==="ancestor-stopped"}function Et(r){return r.type==="syntax"}function zt(r){return r.type==="unknown"}function qt(r){return r.type==="sql-error"}function Pt(r){return r.msg.includes("!pip")}function Lt(r){return r.msg.includes("use os.subprocess")}function Wt(r,e){return(0,t.jsx)("pre",{children:w(r.msg,`syntax-${e}`)},`syntax-${e}`)}function Qt(r,e){return(0,t.jsx)("pre",{children:w(r.msg,`unknown-${e}`)},`unknown-${e}`)}function Vt(r,e){return r.edges_with_vars.map((s,n)=>(0,t.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,t.jsx)(b,{cellId:s[0]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:[": "," ",s[1].length===1?s[1][0]:s[1].join(", ")]})]},`setup-refs-${e}-${n}`))}function Bt(r,e){return r.edges_with_vars.map((s,n)=>(0,t.jsxs)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:[(0,t.jsx)(b,{cellId:s[0]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:[" -> ",s[1].length===1?s[1][0]:s[1].join(", ")," -> "]}),(0,t.jsx)(b,{cellId:s[2]})]},`cycle-${e}-${n}`))}function Dt(r,e){return(0,t.jsx)("li",{className:"my-0.5 ml-8 text-muted-foreground/40",children:(0,t.jsx)(b,{cellId:r})},`cell-${e}`)}function Ot(r,e){return(0,t.jsxs)(P.Fragment,{children:[(0,t.jsx)("p",{className:"text-muted-foreground mt-2",children:`'${r.name}' was also defined by:`}),(0,t.jsx)("ul",{className:"list-disc",children:r.cells.map(Dt)})]},`multiple-defs-${e}`)}function Ht(r,e){return(0,t.jsx)("p",{className:"text-muted-foreground",children:r.msg},`import-star-${e}`)}function Ut(r,e){return(0,t.jsx)("p",{children:"This cell was interrupted and needs to be re-run."},`interruption-${e}`)}function Rt(r,e){return r.exception_type==="NameError"&&r.msg.startsWith("name 'mo'")?(0,t.jsx)("li",{className:"my-2",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground",children:"name 'mo' is not defined."}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-2",children:["The marimo module (imported as"," ",(0,t.jsx)(te,{className:"inline",children:"mo"}),") is required for Markdown, SQL, and UI elements."]})]})},`exception-${e}`):r.exception_type==="NameError"&&r.msg.startsWith("name '_")?(0,t.jsx)("li",{className:"my-2",children:(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground",children:r.msg}),(0,t.jsxs)("p",{className:"text-muted-foreground mt-2",children:["Variables prefixed with an underscore are local to a cell"," ","(",(0,t.jsxs)(A,{href:"https://links.marimo.app/local-variables",children:["docs"," ",(0,t.jsx)(T,{size:"0.75rem",className:"inline"})]}),")."]}),(0,t.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]})},`exception-${e}`):(0,t.jsx)("li",{className:"my-2",children:r.raising_cell==null?(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-muted-foreground",children:w(r.msg,`exception-${e}`)}),(0,t.jsx)("div",{className:"text-muted-foreground mt-2",children:"See the console area for a traceback."})]}):(0,t.jsxs)("div",{children:[w(r.msg,`exception-${e}`),(0,t.jsx)(b,{cellId:r.raising_cell})]})},`exception-${e}`)}function Xt(r){return r.raising_cell!=null}function Zt(r,e){return(0,t.jsx)("li",{className:"my-2",children:r.blamed_cell==null?(0,t.jsx)("p",{children:r.msg}):(0,t.jsxs)("div",{children:[r.msg,(0,t.jsx)(b,{cellId:r.blamed_cell})]})},`strict-exception-${e}`)}function Gt(r){return r.blamed_cell!=null}function Jt(r,e){return(0,t.jsx)("p",{children:r.msg},`internal-${e}`)}function Kt(r,e){return(0,t.jsxs)("div",{children:[r.msg,r.blamed_cell==null?(0,t.jsxs)("span",{children:["(",(0,t.jsx)(b,{cellId:r.raising_cell}),")"]}):(0,t.jsxs)("span",{children:["(",(0,t.jsx)(b,{cellId:r.raising_cell}),"\xA0blames\xA0",(0,t.jsx)(b,{cellId:r.blamed_cell}),")"]})]},`ancestor-prevented-${e}`)}function Yt(r,e){return(0,t.jsxs)("div",{children:[r.msg,(0,t.jsx)(b,{cellId:r.raising_cell})]},`ancestor-stopped-${e}`)}function er(r,e){return(0,t.jsx)("div",{className:"space-y-2 mt-2",children:(0,t.jsx)("p",{className:"text-muted-foreground whitespace-pre-wrap",children:r.msg})},`sql-error-${e}`)}export{re as a,oe as i,ft as n,me as r,jt as t};
@@ -1 +1 @@
1
- import{s as v}from"./chunk-LvLJmgfZ.js";import{i as j,p as y,u as w}from"./useEvent-O0nX5vok.js";import{t as R}from"./react-Bj1aDYRI.js";import{Q as S,Xr as H,Zr as c,ft as _,ln as I,m as M,pn as N}from"./cells-BZ2tqr8k.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{m as T}from"./useEventListener-Dy81QR4n.js";import{o as z}from"./utils-tNbLd14P.js";import{t as C}from"./jsx-runtime-icT_Ltz2.js";import{t as F}from"./tooltip-BCGmr4TU.js";import{t as L}from"./usePress-_02M8YzR.js";import{n as V}from"./useDebounce-BvOHu0CE.js";import{t as k}from"./copy-icon-BNQYrUYC.js";import{t as q}from"./useRunCells-CwObo_j4.js";var W=E(),m=v(R(),1),o=v(C(),1);const A=r=>{let t=(0,W.c)(16),e,n,i;t[0]===r?(e=t[1],n=t[2],i=t[3]):({href:n,children:e,...i}=r,t[0]=r,t[1]=e,t[2]=n,t[3]=i);let a=(0,m.useRef)(null),l;t[4]===n?l=t[5]:(l=()=>{let u=new URL(globalThis.location.href);u.hash=n,globalThis.history.pushState({},"",u.toString()),globalThis.dispatchEvent(new HashChangeEvent("hashchange"));let x=n.slice(1),g=document.getElementById(x);g&&g.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=n,t[5]=l);let s=l,f;t[6]===s?f=t[7]:(f={onPress:()=>{s()}},t[6]=s,t[7]=f);let{pressProps:h}=L(f),d;t[8]===s?d=t[9]:(d=u=>{u.preventDefault(),s()},t[8]=s,t[9]=d);let b=d,p;return t[10]!==e||t[11]!==b||t[12]!==n||t[13]!==h||t[14]!==i?(p=(0,o.jsx)("a",{ref:a,href:n,...h,onClick:b,...i,children:e}),t[10]=e,t[11]=b,t[12]=n,t[13]=h,t[14]=i,t[15]=p):p=t[15],p};async function D(r){let t=M().inOrderIds.at(0);if(t)try{let e=await I.request({document:r,cellId:t});if(!e||e.options.length===0)return;let n=r.split(".").pop()??r,i=e.options[0],a=e.options.find(l=>l.name===n)??i;a!=null&&a.completion_info&&j.set(N,{documentation:a.completion_info})}catch(e){T.debug(`Doc lookup failed for "${r}"`,e)}}var O=E();const P=r=>{let t=(0,O.c)(8),{qualifiedName:e,children:n}=r,i;t[0]===e?i=t[1]:(i=()=>{D(e)},t[0]=e,t[1]=i);let a=V(i,100),l;t[2]===a?l=t[3]:(l=()=>a.cancel(),t[2]=a,t[3]=l);let s;return t[4]!==n||t[5]!==a||t[6]!==l?(s=(0,o.jsx)("span",{onMouseEnter:a,onMouseLeave:l,children:n}),t[4]=n,t[5]=a,t[6]=l,t[7]=s):s=t[7],s};var $=y(r=>{let t=r(q),e=r(z);if(t||e)return!1;let n=!0;try{n=S()==="read"}catch{return!0}return!n});function B(){return w($)}var U=E(),Z=r=>{if(r instanceof c.Element&&!/^[A-Za-z][\w-]*$/.test(r.name))return m.createElement(m.Fragment)},Q=(r,t)=>{if(t instanceof c.Element&&t.name==="body"){if((0,m.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},X=(r,t)=>{if(t instanceof c.Element&&t.name==="html"){if((0,m.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},G=r=>{if(r instanceof c.Element&&r.attribs&&r.name==="iframe"){let t=document.createElement("iframe");return Object.entries(r.attribs).forEach(([e,n])=>{e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1)),t.setAttribute(e,n)}),(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},J=r=>{if(r instanceof c.Element&&r.name==="script"){let t=r.attribs.src;if(!t)return;if(!document.querySelector(`script[src="${t}"]`)){let e=document.createElement("script");e.src=t,document.head.append(e)}return(0,o.jsx)(o.Fragment,{})}},K=(r,t)=>{if(t instanceof c.Element&&t.name==="a"){let e=t.attribs.href;if(e!=null&&e.startsWith("#")&&!e.startsWith("#code/")){let n=null;return(0,m.isValidElement)(r)&&"props"in r&&(n=r.props.children),(0,o.jsx)(A,{href:e,...t.attribs,children:n})}}},Y=(r,t,e)=>{var n,i;if(t instanceof c.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,o.jsx)(rt,{children:r},e)},tt=(r,t)=>{var e;if(t instanceof c.Element&&((e=t.attribs)!=null&&e["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,o.jsx)(P,{qualifiedName:n,children:r})}},et=(r,t)=>{var e;if(t instanceof c.Element&&((e=t.attribs)!=null&&e["data-tooltip"])){let n=t.attribs["data-tooltip"];return(0,o.jsx)(F,{content:n,children:r})}},rt=r=>{let t=(0,U.c)(3),{children:e}=r,n=(0,m.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,o.jsx)(k,{tooltip:!1,className:"p-1",value:()=>{var s;let l=(s=n.current)==null?void 0:s.firstChild;return l&&l.textContent||""}})}),t[0]=i):i=t[0];let a;return t[1]===e?a=t[2]:(a=(0,o.jsxs)("div",{className:"relative group codehilite-wrapper",ref:n,children:[e,i]}),t[1]=e,t[2]=a),a};const nt=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e=!0})=>(0,o.jsx)(it,{html:r,alwaysSanitizeHtml:e,additionalReplacements:t});var it=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e})=>{let n=B();return at({html:(0,m.useMemo)(()=>e||n?_(r):r,[r,e,n]),additionalReplacements:t})};function at({html:r,additionalReplacements:t=[]}){let e=[Z,G,J,...t],n=[Y,K,tt,et,Q,X];return H(r,{replace:(i,a)=>{for(let l of e){let s=l(i,a);if(s)return s}return i},transform:(i,a,l)=>{for(let s of n){let f=s(i,a,l);if(f)return f}return i}})}export{nt as t};
1
+ import{s as v}from"./chunk-LvLJmgfZ.js";import{i as j,p as y,u as w}from"./useEvent-O0nX5vok.js";import{t as R}from"./react-Bj1aDYRI.js";import{Q as S,Qr as m,Zr as H,ft as _,m as I,mn as M,un as N}from"./cells-B8rT_yJt.js";import{t as E}from"./compiler-runtime-B3qBwwSJ.js";import{m as T}from"./useEventListener-Dy81QR4n.js";import{o as z}from"./utils-tNbLd14P.js";import{t as C}from"./jsx-runtime-icT_Ltz2.js";import{t as F}from"./tooltip-BCGmr4TU.js";import{t as L}from"./usePress-_02M8YzR.js";import{n as V}from"./useDebounce-BvOHu0CE.js";import{t as k}from"./copy-icon-BNQYrUYC.js";import{t as q}from"./useRunCells--USKPEQy.js";var W=E(),c=v(R(),1),o=v(C(),1);const A=r=>{let t=(0,W.c)(16),e,n,i;t[0]===r?(e=t[1],n=t[2],i=t[3]):({href:n,children:e,...i}=r,t[0]=r,t[1]=e,t[2]=n,t[3]=i);let a=(0,c.useRef)(null),s;t[4]===n?s=t[5]:(s=()=>{let u=new URL(globalThis.location.href);u.hash=n,globalThis.history.pushState({},"",u.toString()),globalThis.dispatchEvent(new HashChangeEvent("hashchange"));let x=n.slice(1),g=document.getElementById(x);g&&g.scrollIntoView({behavior:"smooth",block:"start"})},t[4]=n,t[5]=s);let l=s,f;t[6]===l?f=t[7]:(f={onPress:()=>{l()}},t[6]=l,t[7]=f);let{pressProps:h}=L(f),d;t[8]===l?d=t[9]:(d=u=>{u.preventDefault(),l()},t[8]=l,t[9]=d);let b=d,p;return t[10]!==e||t[11]!==b||t[12]!==n||t[13]!==h||t[14]!==i?(p=(0,o.jsx)("a",{ref:a,href:n,...h,onClick:b,...i,children:e}),t[10]=e,t[11]=b,t[12]=n,t[13]=h,t[14]=i,t[15]=p):p=t[15],p};async function D(r){let t=I().inOrderIds.at(0);if(t)try{let e=await N.request({document:r,cellId:t});if(!e||e.options.length===0)return;let n=r.split(".").pop()??r,i=e.options[0],a=e.options.find(s=>s.name===n)??i;a!=null&&a.completion_info&&j.set(M,{documentation:a.completion_info})}catch(e){T.debug(`Doc lookup failed for "${r}"`,e)}}var O=E();const P=r=>{let t=(0,O.c)(8),{qualifiedName:e,children:n}=r,i;t[0]===e?i=t[1]:(i=()=>{D(e)},t[0]=e,t[1]=i);let a=V(i,100),s;t[2]===a?s=t[3]:(s=()=>a.cancel(),t[2]=a,t[3]=s);let l;return t[4]!==n||t[5]!==a||t[6]!==s?(l=(0,o.jsx)("span",{onMouseEnter:a,onMouseLeave:s,children:n}),t[4]=n,t[5]=a,t[6]=s,t[7]=l):l=t[7],l};var $=y(r=>{let t=r(q),e=r(z);if(t||e)return!1;let n=!0;try{n=S()==="read"}catch{return!0}return!n});function B(){return w($)}var Q=E(),U=r=>{if(r instanceof m.Element&&!/^[A-Za-z][\w-]*$/.test(r.name))return c.createElement(c.Fragment)},Z=(r,t)=>{if(t instanceof m.Element&&t.name==="body"){if((0,c.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},G=(r,t)=>{if(t instanceof m.Element&&t.name==="html"){if((0,c.isValidElement)(r)&&"props"in r){let e=r.props.children;return(0,o.jsx)(o.Fragment,{children:e})}return}},J=r=>{if(r instanceof m.Element&&r.attribs&&r.name==="iframe"){let t=document.createElement("iframe");return Object.entries(r.attribs).forEach(([e,n])=>{e.startsWith('"')&&e.endsWith('"')&&(e=e.slice(1,-1)),t.setAttribute(e,n)}),(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:t.outerHTML}})}},K=r=>{if(r instanceof m.Element&&r.name==="script"){let t=r.attribs.src;if(!t)return;if(!document.querySelector(`script[src="${t}"]`)){let e=document.createElement("script");e.src=t,document.head.append(e)}return(0,o.jsx)(o.Fragment,{})}},X=(r,t)=>{if(t instanceof m.Element&&t.name==="a"){let e=t.attribs.href;if(e!=null&&e.startsWith("#")&&!e.startsWith("#code/")){let n=null;return(0,c.isValidElement)(r)&&"props"in r&&(n=r.props.children),(0,o.jsx)(A,{href:e,...t.attribs,children:n})}}},Y=(r,t,e)=>{var n,i;if(t instanceof m.Element&&t.name==="div"&&((i=(n=t.attribs)==null?void 0:n.class)!=null&&i.includes("codehilite")))return(0,o.jsx)(rt,{children:r},e)},tt=(r,t)=>{var e;if(t instanceof m.Element&&((e=t.attribs)!=null&&e["data-marimo-doc"])){let n=t.attribs["data-marimo-doc"];return(0,o.jsx)(P,{qualifiedName:n,children:r})}},et=(r,t)=>{var e;if(t instanceof m.Element&&((e=t.attribs)!=null&&e["data-tooltip"])){let n=t.attribs["data-tooltip"];return(0,o.jsx)(F,{content:n,children:r})}},rt=r=>{let t=(0,Q.c)(3),{children:e}=r,n=(0,c.useRef)(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,o.jsx)("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:(0,o.jsx)(k,{tooltip:!1,className:"p-1",value:()=>{var l;let s=(l=n.current)==null?void 0:l.firstChild;return s&&s.textContent||""}})}),t[0]=i):i=t[0];let a;return t[1]===e?a=t[2]:(a=(0,o.jsxs)("div",{className:"relative group codehilite-wrapper",ref:n,children:[e,i]}),t[1]=e,t[2]=a),a};const nt=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e=!0})=>(0,o.jsx)(it,{html:r,alwaysSanitizeHtml:e,additionalReplacements:t});var it=({html:r,additionalReplacements:t=[],alwaysSanitizeHtml:e})=>{let n=B();return at({html:(0,c.useMemo)(()=>e||n?_(r):r,[r,e,n]),additionalReplacements:t})};function at({html:r,additionalReplacements:t=[]}){let e=[U,J,K,...t],n=[Y,X,tt,et,Z,G];return H(r,{replace:(i,a)=>{for(let s of e){let l=s(i,a);if(l)return l}return i},transform:(i,a,s)=>{for(let l of n){let f=l(i,a,s);if(f)return f}return i}})}export{nt as t};
@@ -1,4 +1,4 @@
1
- var yi=Object.defineProperty;var vi=(t,e,a)=>e in t?yi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var L=(t,e,a)=>vi(t,typeof e!="symbol"?e+"":e,a);import{s as Da,t as _i}from"./chunk-LvLJmgfZ.js";import{f as Jr,i as Kr,l as bi,n as Yr,o as xi,u as Hr}from"./useEvent-O0nX5vok.js";import{t as wi}from"./react-Bj1aDYRI.js";import{Bn as ki,Dt as Ci,E as Gr,Gt as Ei,Ir as Ti,On as Ii,Tn as Si,b as Ge,f as Ai,gi as Oi,gr as Qr,hi as Xr,hr as Ri,i as Ni,li as ji,mt as Za,ni as Mi,pr as Pi,rr as Li,si as $i,tr as Di,zr as Zi,zt as es}from"./cells-BZ2tqr8k.js";import{B as Ce,D as Fi,E as ts,H as zi,I as Nt,J as as,L as Q,N as rs,O as Ui,P as H,R as E,S as Vi,T as ce,V as Fe,W as ss,b as aa,k as M,w as ze,x as ra}from"./zod-H_cgTO0M.js";import{t as jt}from"./compiler-runtime-B3qBwwSJ.js";import{n as ns}from"./assertNever-DWSyoPEi.js";import{t as Bi,w as qi}from"./ai-model-dropdown-C_T_oAXa.js";import{m as ie,u as Wi}from"./useEventListener-Dy81QR4n.js";import{n as Ji}from"./utils-tNbLd14P.js";import{o as Ki}from"./config-DRN1Q5Ol.js";import{t as Yi}from"./jsx-runtime-icT_Ltz2.js";import{t as Qe}from"./button-Ej3vmCIF.js";import{t as Fa}from"./cn-BoaCR37F.js";import{Ht as Hi,Jt as sa,St as na,Vt as Gi,Wt as is,Yt as ia,Zt as Qi,at as os,ct as Xi,lt as ls,rt as za,xt as eo}from"./dist-B_cxg-E4.js";import{t as to}from"./createReducer-Dvh64vBW.js";import{h as ao,n as ro,o as so,r as no}from"./dist-D0Vj4Kqc.js";import{r as io,t as oo}from"./requests-Bgjtqo_1.js";import{t as Ua}from"./createLucideIcon-Cm-Z7dYr.js";import{r as lo,t as uo}from"./fileToBase64-RxOnBG54.js";import{t as ds}from"./x-CdLP7-v3.js";import{f as co,l as us,n as po}from"./markdown-renderer-CGLrhCH1.js";import{a as cs,c as mo,p as ho,r as fo,t as go}from"./dropdown-menu-CA9akLlF.js";import{t as ps}from"./file-DzHkbIdO.js";import{t as yo}from"./image-DXfkah9d.js";import{t as vo}from"./spinner-C5JoisA7.js";import{t as _o}from"./play-l5KOWsHo.js";import{r as bo}from"./input-6cciao_l.js";import{t as xo}from"./sparkles-DWCvxqYL.js";import{a as Mt,i as wt,o as Pt,r as kt,s as wo,t as ko}from"./datasource-xu50qvjI.js";import{a as Co}from"./dist-1ZGGzJka.js";import{t as Va}from"./use-toast-BhMe50aT.js";import{r as Eo}from"./useTheme-BYu4ZPLV.js";import{t as oa}from"./tooltip-BCGmr4TU.js";import{d as To}from"./popover-C5P0DZBj.js";import{r as Io}from"./errors-Bhwg_4_Q.js";import{t as So}from"./blob-BTrKZERf.js";import{n as Ao}from"./useRunCells-CwObo_j4.js";import{i as Ba}from"./cell-link-BgNPg6FR.js";import{r as Oo,t as Ro}from"./html-to-image-D_3oFpSp.js";import{n as qa}from"./renderShortcut-DKHsNYY8.js";import{n as No}from"./icons-CIUvkMzI.js";import{r as jo,t as Mo}from"./esm-DXwI6ZUw.js";import{t as Po}from"./process-output-CgWMJc-C.js";import{t as Lo}from"./useDeleteCell-B-MR7EAI.js";var ms=Ua("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),hs=Ua("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),fs=Ua("send-horizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]),gs="vercel.ai.error",$o=Symbol.for(gs),ys,vs,Xe=class di extends(vs=Error,ys=$o,vs){constructor({name:e,message:a,cause:r}){super(a),this[ys]=!0,this.name=e,this.cause=r}static isInstance(e){return di.hasMarker(e,gs)}static hasMarker(e,a){let r=Symbol.for(a);return typeof e=="object"&&!!e&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function _s(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var bs="AI_InvalidArgumentError",xs=`vercel.ai.error.${bs}`,Do=Symbol.for(xs),ws,ks,Zo=class extends(ks=Xe,ws=Do,ks){constructor({message:t,cause:e,argument:a}){super({name:bs,message:t,cause:e}),this[ws]=!0,this.argument=a}static isInstance(t){return Xe.hasMarker(t,xs)}},Cs="AI_JSONParseError",Es=`vercel.ai.error.${Cs}`,Fo=Symbol.for(Es),Ts,Is,Ss=class extends(Is=Xe,Ts=Fo,Is){constructor({text:t,cause:e}){super({name:Cs,message:`JSON parsing failed: Text: ${t}.
1
+ var yi=Object.defineProperty;var vi=(t,e,a)=>e in t?yi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var L=(t,e,a)=>vi(t,typeof e!="symbol"?e+"":e,a);import{s as Da,t as _i}from"./chunk-LvLJmgfZ.js";import{f as Jr,i as Kr,l as bi,n as Yr,o as xi,u as Hr}from"./useEvent-O0nX5vok.js";import{t as wi}from"./react-Bj1aDYRI.js";import{Br as ki,Bt as Gr,Dt as Ci,E as Qr,En as Ei,Kt as Ti,Lr as Ii,Vn as Si,_i as Ai,_r as Xr,b as Ge,ci as Oi,f as Ri,gi as es,gr as Ni,i as ji,ir as Mi,kn as Pi,mr as Li,mt as Za,nr as $i,ri as Di,ui as Zi}from"./cells-B8rT_yJt.js";import{B as Ce,D as Fi,E as ts,H as zi,I as Nt,J as as,L as Q,N as rs,O as Ui,P as H,R as E,S as Vi,T as ce,V as Fe,W as ss,b as aa,k as M,w as ze,x as ra}from"./zod-H_cgTO0M.js";import{t as jt}from"./compiler-runtime-B3qBwwSJ.js";import{n as ns}from"./assertNever-DWSyoPEi.js";import{t as Bi,w as qi}from"./ai-model-dropdown-Dybmv5gR.js";import{m as ie,u as Wi}from"./useEventListener-Dy81QR4n.js";import{n as Ji}from"./utils-tNbLd14P.js";import{o as Ki}from"./config-DRN1Q5Ol.js";import{t as Yi}from"./jsx-runtime-icT_Ltz2.js";import{t as Qe}from"./button-Ej3vmCIF.js";import{t as Fa}from"./cn-BoaCR37F.js";import{Ht as Hi,Jt as sa,St as na,Vt as Gi,Wt as is,Yt as ia,Zt as Qi,at as os,ct as Xi,lt as ls,rt as za,xt as eo}from"./dist-B_cxg-E4.js";import{t as to}from"./createReducer-Dvh64vBW.js";import{h as ao,n as ro,o as so,r as no}from"./dist-D0Vj4Kqc.js";import{r as io,t as oo}from"./requests-Bgjtqo_1.js";import{t as Ua}from"./createLucideIcon-Cm-Z7dYr.js";import{r as lo,t as uo}from"./fileToBase64-RxOnBG54.js";import{t as ds}from"./x-CdLP7-v3.js";import{f as co,l as us,n as po}from"./markdown-renderer-f7AvSa1a.js";import{a as cs,c as mo,p as ho,r as fo,t as go}from"./dropdown-menu-CA9akLlF.js";import{t as ps}from"./file-DzHkbIdO.js";import{t as yo}from"./image-DXfkah9d.js";import{t as vo}from"./spinner-C5JoisA7.js";import{t as _o}from"./play-l5KOWsHo.js";import{r as bo}from"./input-6cciao_l.js";import{t as xo}from"./sparkles-DWCvxqYL.js";import{a as Mt,i as wt,o as Pt,r as kt,s as wo,t as ko}from"./datasource-xomiPYKd.js";import{a as Co}from"./dist-1ZGGzJka.js";import{t as Va}from"./use-toast-BhMe50aT.js";import{r as Eo}from"./useTheme-BYu4ZPLV.js";import{t as oa}from"./tooltip-BCGmr4TU.js";import{d as To}from"./popover-C5P0DZBj.js";import{r as Io}from"./errors-Bhwg_4_Q.js";import{t as So}from"./blob-BTrKZERf.js";import{n as Ao}from"./useRunCells--USKPEQy.js";import{i as Ba}from"./cell-link-DV3G9zVQ.js";import{r as Oo,t as Ro}from"./html-to-image-BtnUxAf2.js";import{n as qa}from"./renderShortcut-BcNNtnIV.js";import{n as No}from"./icons-CAcY8GzB.js";import{r as jo,t as Mo}from"./esm-BMWduMhT.js";import{t as Po}from"./process-output-5fC8hAfT.js";import{t as Lo}from"./useDeleteCell-DG1VBfwX.js";var ms=Ua("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]),hs=Ua("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),fs=Ua("send-horizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]),gs="vercel.ai.error",$o=Symbol.for(gs),ys,vs,Xe=class di extends(vs=Error,ys=$o,vs){constructor({name:e,message:a,cause:r}){super(a),this[ys]=!0,this.name=e,this.cause=r}static isInstance(e){return di.hasMarker(e,gs)}static hasMarker(e,a){let r=Symbol.for(a);return typeof e=="object"&&!!e&&r in e&&typeof e[r]=="boolean"&&e[r]===!0}};function _s(t){return t==null?"unknown error":typeof t=="string"?t:t instanceof Error?t.message:JSON.stringify(t)}var bs="AI_InvalidArgumentError",xs=`vercel.ai.error.${bs}`,Do=Symbol.for(xs),ws,ks,Zo=class extends(ks=Xe,ws=Do,ks){constructor({message:t,cause:e,argument:a}){super({name:bs,message:t,cause:e}),this[ws]=!0,this.argument=a}static isInstance(t){return Xe.hasMarker(t,xs)}},Cs="AI_JSONParseError",Es=`vercel.ai.error.${Cs}`,Fo=Symbol.for(Es),Ts,Is,Ss=class extends(Is=Xe,Ts=Fo,Is){constructor({text:t,cause:e}){super({name:Cs,message:`JSON parsing failed: Text: ${t}.
2
2
  Error message: ${_s(e)}`,cause:e}),this[Ts]=!0,this.text=t}static isInstance(t){return Xe.hasMarker(t,Es)}},As="AI_TypeValidationError",Os=`vercel.ai.error.${As}`,zo=Symbol.for(Os),Rs,Ns,la=class Fr extends(Ns=Xe,Rs=zo,Ns){constructor({value:e,cause:a}){super({name:As,message:`Type validation failed: Value: ${JSON.stringify(e)}.
3
3
  Error message: ${_s(a)}`,cause:a}),this[Rs]=!0,this.value=e}static isInstance(e){return Xe.hasMarker(e,Os)}static wrap({value:e,cause:a}){return Fr.isInstance(a)&&a.value===e?a:new Fr({value:e,cause:a})}},js=class extends Error{constructor(t,e){super(t),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}};function Wa(t){}function Uo(t){if(typeof t=="function")throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Wa,onError:a=Wa,onRetry:r=Wa,onComment:s}=t,n="",o=!0,i,l="",d="";function u(f){let p=o?f.replace(/^\xEF\xBB\xBF/,""):f,[h,v]=Vo(`${n}${p}`);for(let T of h)c(T);n=v,o=!1}function c(f){if(f===""){m();return}if(f.startsWith(":")){s&&s(f.slice(f.startsWith(": ")?2:1));return}let p=f.indexOf(":");if(p!==-1){let h=f.slice(0,p),v=f[p+1]===" "?2:1;g(h,f.slice(p+v),f);return}g(f,"",f)}function g(f,p,h){switch(f){case"event":d=p;break;case"data":l=`${l}${p}
4
4
  `;break;case"id":i=p.includes("\0")?void 0:p;break;case"retry":/^\d+$/.test(p)?r(parseInt(p,10)):a(new js(`Invalid \`retry\` value: "${p}"`,{type:"invalid-retry",value:p,line:h}));break;default:a(new js(`Unknown field "${f.length>20?`${f.slice(0,20)}\u2026`:f}"`,{type:"unknown-field",field:f,value:p,line:h}));break}}function m(){l.length>0&&e({id:i,event:d||void 0,data:l.endsWith(`
@@ -17,15 +17,15 @@ ${n}
17
17
 
18
18
  `;return a.outputType==="text"&&a.processedContent?i+=`Output:
19
19
  ${a.processedContent}`:a.outputType==="media"&&(i+=`Media Output: Contains ${a.output.mimetype} content`,a.imageUrl&&(i+=`
20
- Image URL: ${a.imageUrl}`)),Mt({type:this.contextType,data:o,details:i})}async getAttachments(e){let a=e[0].data.cellId,r=e[0].data.cellName;return Tu(e.map(s=>s.data.cellOutput),a,r)}};async function Tu(t,e,a){let r=t.filter(n=>n.shouldDownloadImage&&n.outputType==="media");if(r.length===0)return[];let s=r.flatMap(n=>{let o=document.getElementById(Oi.create(e));return o?{cellId:e,cellName:a,mimetype:n.output.mimetype,element:o}:(ie.warn(`Output element not found for cell ${e}`),[])});try{return await Promise.all(s.map(async n=>({type:"file",filename:`${a}-output-screenshot`,mediaType:"image/png",url:await Ro(n.element)})))}catch(n){return ie.error("Error downloading cell output images:",n),[]}}function jn(t){if(us(t))return null;let e=t.mimetype,a=Cu(e,String(t.data))?"media":"text",r=Po(t),s,n=!1;return a==="media"&&(typeof t.data=="string"&&t.data.startsWith("data:")||typeof t.data=="string"&&t.data.startsWith("http")?s=t.data:n=!0),{processedContent:r,imageUrl:s,shouldDownloadImage:n,outputType:a,output:t}}function Mn(t,e,a){let{includeConsoleOutput:r=!1}=a||{},s=e.cellRuntime[t],n=e.cellData[t],o=e.cellIds.inOrderIds.indexOf(t),i=Ci(n.name,o),l;r&&(l=s.consoleOutputs.map(c=>jn(c)).filter(c=>c!==null));let d,u=s.output;return u&&!us(u)&&(d=jn(u)??void 0),{cellId:t,cellName:i,cellCode:n.code,cellOutput:d,consoleOutputs:l}}function Iu(t){return t.type==="setup-refs"?"The setup cell cannot have references":t.type==="cycle"?"This cell is in a cycle":t.type==="multiple-defs"?`The variable '${t.name}' was defined by another cell`:t.type==="import-star"||t.type==="ancestor-stopped"||t.type==="ancestor-prevented"||t.type==="exception"||t.type==="strict-exception"?t.msg:t.type==="interruption"?"This cell was interrupted and needs to be re-run":t.type==="syntax"||t.type==="unknown"||t.type==="sql-error"?t.msg:t.type==="internal"?t.msg||"An internal error occurred":(ns(t),"Unknown error")}var Pn=new ki("error","errors"),Su=class extends Pt{constructor(e){super();L(this,"title","Errors");L(this,"mentionPrefix","@");L(this,"contextType","error");this.store=e}getItems(){let e=this.store.get(Ni);return e.length===0?[]:[{uri:this.asURI("all"),name:"Errors",type:this.contextType,data:{type:"all-errors",errors:e.map(a=>({cellId:a.cellId,cellName:a.cellName,errorData:a.output.data}))},description:"All errors in the notebook"}]}formatCompletion(e){return e.data.type==="all-errors"?{label:"@Errors",displayLabel:"Errors",detail:`${e.data.errors.length} ${Pn.pluralize(e.data.errors.length)}`,type:"error",apply:"@Errors",section:wt.ERROR,info:()=>{let a=document.createElement("div");a.classList.add("mo-cm-tooltip","docs-documentation","min-w-[200px]","flex","flex-col","gap-1","p-2");let r=document.createElement("div");r.classList.add("flex","flex-col","gap-1");let s=document.createElement("div");s.classList.add("font-bold","text-base"),s.textContent="Errors",r.append(s);let n=document.createElement("div");return n.classList.add("text-sm","text-muted-foreground"),n.textContent=`${e.data.errors.length} ${Pn.pluralize(e.data.errors.length)}`,r.append(n),a.append(r),a}}:{label:"Error",displayLabel:"Error",section:wt.ERROR}}formatContext(e){let{data:a}=e;return a.errors.map(r=>Mt({type:this.contextType,data:{name:r.cellName||`Cell ${r.cellId}`,description:r.errorData.map(s=>Iu(s)).join(`
20
+ Image URL: ${a.imageUrl}`)),Mt({type:this.contextType,data:o,details:i})}async getAttachments(e){let a=e[0].data.cellId,r=e[0].data.cellName;return Tu(e.map(s=>s.data.cellOutput),a,r)}};async function Tu(t,e,a){let r=t.filter(n=>n.shouldDownloadImage&&n.outputType==="media");if(r.length===0)return[];let s=r.flatMap(n=>{let o=document.getElementById(Ai.create(e));return o?{cellId:e,cellName:a,mimetype:n.output.mimetype,element:o}:(ie.warn(`Output element not found for cell ${e}`),[])});try{return await Promise.all(s.map(async n=>({type:"file",filename:`${a}-output-screenshot`,mediaType:"image/png",url:await Ro(n.element)})))}catch(n){return ie.error("Error downloading cell output images:",n),[]}}function jn(t){if(us(t))return null;let e=t.mimetype,a=Cu(e,String(t.data))?"media":"text",r=Po(t),s,n=!1;return a==="media"&&(typeof t.data=="string"&&t.data.startsWith("data:")||typeof t.data=="string"&&t.data.startsWith("http")?s=t.data:n=!0),{processedContent:r,imageUrl:s,shouldDownloadImage:n,outputType:a,output:t}}function Mn(t,e,a){let{includeConsoleOutput:r=!1}=a||{},s=e.cellRuntime[t],n=e.cellData[t],o=e.cellIds.inOrderIds.indexOf(t),i=Ci(n.name,o),l;r&&(l=s.consoleOutputs.map(c=>jn(c)).filter(c=>c!==null));let d,u=s.output;return u&&!us(u)&&(d=jn(u)??void 0),{cellId:t,cellName:i,cellCode:n.code,cellOutput:d,consoleOutputs:l}}function Iu(t){return t.type==="setup-refs"?"The setup cell cannot have references":t.type==="cycle"?"This cell is in a cycle":t.type==="multiple-defs"?`The variable '${t.name}' was defined by another cell`:t.type==="import-star"||t.type==="ancestor-stopped"||t.type==="ancestor-prevented"||t.type==="exception"||t.type==="strict-exception"?t.msg:t.type==="interruption"?"This cell was interrupted and needs to be re-run":t.type==="syntax"||t.type==="unknown"||t.type==="sql-error"?t.msg:t.type==="internal"?t.msg||"An internal error occurred":(ns(t),"Unknown error")}var Pn=new Si("error","errors"),Su=class extends Pt{constructor(e){super();L(this,"title","Errors");L(this,"mentionPrefix","@");L(this,"contextType","error");this.store=e}getItems(){let e=this.store.get(ji);return e.length===0?[]:[{uri:this.asURI("all"),name:"Errors",type:this.contextType,data:{type:"all-errors",errors:e.map(a=>({cellId:a.cellId,cellName:a.cellName,errorData:a.output.data}))},description:"All errors in the notebook"}]}formatCompletion(e){return e.data.type==="all-errors"?{label:"@Errors",displayLabel:"Errors",detail:`${e.data.errors.length} ${Pn.pluralize(e.data.errors.length)}`,type:"error",apply:"@Errors",section:wt.ERROR,info:()=>{let a=document.createElement("div");a.classList.add("mo-cm-tooltip","docs-documentation","min-w-[200px]","flex","flex-col","gap-1","p-2");let r=document.createElement("div");r.classList.add("flex","flex-col","gap-1");let s=document.createElement("div");s.classList.add("font-bold","text-base"),s.textContent="Errors",r.append(s);let n=document.createElement("div");return n.classList.add("text-sm","text-muted-foreground"),n.textContent=`${e.data.errors.length} ${Pn.pluralize(e.data.errors.length)}`,r.append(n),a.append(r),a}}:{label:"Error",displayLabel:"Error",section:wt.ERROR}}formatContext(e){let{data:a}=e;return a.errors.map(r=>Mt({type:this.contextType,data:{name:r.cellName||`Cell ${r.cellId}`,description:r.errorData.map(s=>Iu(s)).join(`
21
21
  `)}})).join(`
22
22
 
23
- `)}};const Ln=Zi();var Au={maxDepth:3,maxResults:20,defaultResultsLimit:5,includeDirectories:!1},Ou=class extends Pt{constructor(e,a=Au){super();L(this,"title","Files");L(this,"mentionPrefix","#");L(this,"contextType","file");L(this,"searchFiles",async(e,a={})=>{let{maxDepth:r,maxResults:s,includeDirectories:n}={...this.config,...a};return(await this.apiRequests.sendSearchFiles({query:e,includeFiles:!0,includeDirectories:n,depth:r,limit:s})).files});this.apiRequests=e,this.config=a}createCompletionSource(){return async e=>{let a=e.matchBefore(/#[^\s#]*/);if(!a)return null;let r=a.text;if(!r.startsWith("#"))return null;let s=r.slice(1);if(s.length===0)return this.getDefaultCompletions(a);try{let n=(await this.searchFiles(s)||[]).map(o=>{let i={uri:this.asURI(o.path),name:o.name,type:this.contextType,description:o.isDirectory?"Directory":"File",data:{path:o.path,isDirectory:o.isDirectory}};return this.formatCompletion(i)});return{from:a.from,options:n}}catch(n){return ie.error("Failed to search files:",n),null}}}async getDefaultCompletions(e){try{for(let a of["py","md","csv"])try{let r=await this.searchFiles(a,{maxDepth:1,maxResults:5});if(r&&r.length>0){let s=r.map(n=>{let o={uri:this.asURI(n.path),name:n.name,type:this.contextType,description:n.isDirectory?"Directory":"File",data:{path:n.path,isDirectory:n.isDirectory}};return this.formatCompletion(o)});return{from:e.from,options:s}}}catch(r){ie.error("Failed to get default file completions:",r)}return{from:e.from,options:[]}}catch(a){return ie.error("Failed to get default file completions:",a),null}}getItems(){return[]}formatCompletion(e){let{data:a,name:r}=e,s=a.isDirectory?"\u{1F4C1}":"\u{1F4C4}";return{...this.createBasicCompletion(e),type:"file",section:wt.FILE,boost:a.isDirectory?kt.MEDIUM:kt.LOW,detail:a.path,displayLabel:`${s} ${r}`,apply:async(n,o,i,l)=>{var m;let d=(m=n.state.facet(Ln))==null?void 0:m.addAttachment;if(!d){ie.warn("No addAttachment callback provided");return}let u=await this.apiRequests.sendFileDetails({path:a.path}).catch(b=>(Va({title:"Failed to get file details",description:b.message}),null));if(!u)return;let c=u.mimeType||"text/plain",g;if(c.startsWith("text/")||c.includes("json")||c.includes("xml"))g=new Blob([u.contents||""],{type:c});else if(u.contents)try{g=So(po(u.contents,c))}catch{g=new Blob([u.contents],{type:c})}else g=new Blob([""],{type:c});d(new File([g],r,{type:c})),n.dispatch({changes:{from:i,to:l,insert:""}}),so(n)},info:()=>{let n=document.createElement("div");n.classList.add("flex","flex-col","gap-1","p-2");let o=document.createElement("div");o.classList.add("font-bold"),o.textContent=r,n.append(o);let i=document.createElement("div");return i.classList.add("text-xs","text-muted-foreground"),i.textContent=a.path,n.append(i),n}}}formatContext(e){let{data:a,name:r}=e;return Mt({type:this.contextType,data:{name:r,path:a.path,isDirectory:a.isDirectory},details:a.isDirectory?"Directory containing files and subdirectories":"File"})}},Ru=class extends Pt{constructor(e){super();L(this,"title","Tables");L(this,"mentionPrefix","@");L(this,"contextType","data");this.tablesMap=e}getItems(){return[...this.tablesMap.entries()].map(([e,a])=>({uri:this.asURI(e),name:e,type:this.contextType,description:a.source==="memory"?"in-memory":a.source,data:a}))}formatContext(e){let{data:a}=e,{columns:r,source:s,num_rows:n,num_columns:o,name:i,variable_name:l}=a,d=[n==null?void 0:`${n} rows`,o==null?void 0:`${o} columns`].filter(Boolean).join(", "),u="";if(d&&(u+=`Shape: ${d}
23
+ `)}};const Ln=ki();var Au={maxDepth:3,maxResults:20,defaultResultsLimit:5,includeDirectories:!1},Ou=class extends Pt{constructor(e,a=Au){super();L(this,"title","Files");L(this,"mentionPrefix","#");L(this,"contextType","file");L(this,"searchFiles",async(e,a={})=>{let{maxDepth:r,maxResults:s,includeDirectories:n}={...this.config,...a};return(await this.apiRequests.sendSearchFiles({query:e,includeFiles:!0,includeDirectories:n,depth:r,limit:s})).files});this.apiRequests=e,this.config=a}createCompletionSource(){return async e=>{let a=e.matchBefore(/#[^\s#]*/);if(!a)return null;let r=a.text;if(!r.startsWith("#"))return null;let s=r.slice(1);if(s.length===0)return this.getDefaultCompletions(a);try{let n=(await this.searchFiles(s)||[]).map(o=>{let i={uri:this.asURI(o.path),name:o.name,type:this.contextType,description:o.isDirectory?"Directory":"File",data:{path:o.path,isDirectory:o.isDirectory}};return this.formatCompletion(i)});return{from:a.from,options:n}}catch(n){return ie.error("Failed to search files:",n),null}}}async getDefaultCompletions(e){try{for(let a of["py","md","csv"])try{let r=await this.searchFiles(a,{maxDepth:1,maxResults:5});if(r&&r.length>0){let s=r.map(n=>{let o={uri:this.asURI(n.path),name:n.name,type:this.contextType,description:n.isDirectory?"Directory":"File",data:{path:n.path,isDirectory:n.isDirectory}};return this.formatCompletion(o)});return{from:e.from,options:s}}}catch(r){ie.error("Failed to get default file completions:",r)}return{from:e.from,options:[]}}catch(a){return ie.error("Failed to get default file completions:",a),null}}getItems(){return[]}formatCompletion(e){let{data:a,name:r}=e,s=a.isDirectory?"\u{1F4C1}":"\u{1F4C4}";return{...this.createBasicCompletion(e),type:"file",section:wt.FILE,boost:a.isDirectory?kt.MEDIUM:kt.LOW,detail:a.path,displayLabel:`${s} ${r}`,apply:async(n,o,i,l)=>{var m;let d=(m=n.state.facet(Ln))==null?void 0:m.addAttachment;if(!d){ie.warn("No addAttachment callback provided");return}let u=await this.apiRequests.sendFileDetails({path:a.path}).catch(b=>(Va({title:"Failed to get file details",description:b.message}),null));if(!u)return;let c=u.mimeType||"text/plain",g;if(c.startsWith("text/")||c.includes("json")||c.includes("xml"))g=new Blob([u.contents||""],{type:c});else if(u.contents)try{g=So(po(u.contents,c))}catch{g=new Blob([u.contents],{type:c})}else g=new Blob([""],{type:c});d(new File([g],r,{type:c})),n.dispatch({changes:{from:i,to:l,insert:""}}),so(n)},info:()=>{let n=document.createElement("div");n.classList.add("flex","flex-col","gap-1","p-2");let o=document.createElement("div");o.classList.add("font-bold"),o.textContent=r,n.append(o);let i=document.createElement("div");return i.classList.add("text-xs","text-muted-foreground"),i.textContent=a.path,n.append(i),n}}}formatContext(e){let{data:a,name:r}=e;return Mt({type:this.contextType,data:{name:r,path:a.path,isDirectory:a.isDirectory},details:a.isDirectory?"Directory containing files and subdirectories":"File"})}},Ru=class extends Pt{constructor(e){super();L(this,"title","Tables");L(this,"mentionPrefix","@");L(this,"contextType","data");this.tablesMap=e}getItems(){return[...this.tablesMap.entries()].map(([e,a])=>({uri:this.asURI(e),name:e,type:this.contextType,description:a.source==="memory"?"in-memory":a.source,data:a}))}formatContext(e){let{data:a}=e,{columns:r,source:s,num_rows:n,num_columns:o,name:i,variable_name:l}=a,d=[n==null?void 0:`${n} rows`,o==null?void 0:`${o} columns`].filter(Boolean).join(", "),u="";if(d&&(u+=`Shape: ${d}
24
24
  `),l&&(u+=`Variable: ${l}
25
25
  `),r&&r.length>0){u+=`Columns:
26
26
  `;for(let c of r){let g=` ${c.name} (${c.type})`;if(c.sample_values&&c.sample_values.length>0){let m=c.sample_values.slice(0,3).map(b=>b===null?"null":String(b)).join(", ");g+=` - samples: [${m}]`}u+=`${g}
27
- `}}return Mt({type:this.contextType,data:{name:i,source:s??"unknown"},details:u.trim()})}formatCompletion(e){let a=e.data.name,r=e.data;return{label:`@${a}`,displayLabel:a,detail:r.source==="memory"?"in-memory":r.source,boost:r.source_type==="local"?kt.LOCAL_TABLE:kt.REMOTE_TABLE,type:Qr(r),apply:`@${a}`,section:{name:Qr(r)==="dataframe"?"Dataframe":"Table",rank:wt.TABLE.rank},info:()=>this.createTableInfoElement(a,r)}}createTableInfoElement(e,a){let r=document.createElement("div");r.classList.add("mo-cm-tooltip","docs-documentation","min-w-[200px]","flex","flex-col","gap-1","p-2");let s=document.createElement("div");s.classList.add("flex","flex-col","gap-1");let n=document.createElement("div");if(n.classList.add("font-bold","text-base"),n.textContent=e,s.append(n),a.source){let i=document.createElement("div");i.classList.add("text-xs","text-muted-foreground"),i.textContent=`Source: ${a.source}`,s.append(i)}r.append(s);let o=[a.num_rows==null?void 0:`${a.num_rows} rows`,a.num_columns==null?void 0:`${a.num_columns} columns`].filter(Boolean).join(", ");if(o){let i=document.createElement("div");i.classList.add("text-xs","bg-muted","px-2","py-1","rounded"),i.textContent=o,r.append(i)}if(a.columns&&a.columns.length>0){let i=document.createElement("div");i.classList.add("overflow-auto","max-h-60");let l=document.createElement("table");l.classList.add("w-full","text-xs","border-collapse");let d=l.insertRow();d.classList.add("bg-muted");let u=d.insertCell();u.classList.add("p-2","font-medium","text-left"),u.textContent="Column";let c=d.insertCell();c.classList.add("p-2","font-medium","text-left"),c.textContent="Type";let g=a.columns.some(b=>this.getItemMetadata(a,b)!==void 0),m;g&&(m=d.insertCell(),m.classList.add("p-2","font-medium","text-left"),m.textContent="Metadata"),a.columns.forEach((b,f)=>{let p=l.insertRow();p.classList.add(f%2==0?"bg-background":"bg-muted/30");let h=p.insertCell();h.classList.add("p-2","font-mono"),h.textContent=b.name;let v=p.insertCell();if(v.classList.add("p-2","text-muted-foreground"),v.textContent=b.type,g){let T=p.insertCell();T.classList.add("p-2");let w=this.getItemMetadata(a,b);w&&T.append(w)}}),i.append(l),r.append(i)}return r}getItemMetadata(e,a){var n,o;let r=(n=e.primary_keys)==null?void 0:n.includes(a.name),s=(o=e.indexes)==null?void 0:o.includes(a.name);if(r||s){let i=document.createElement("span");i.textContent=r?"PK":"IDX";let l=r?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200";return i.classList.add("text-xs","px-1.5","py-0.5","rounded-full","font-medium",...l.split(" ")),i}}},Nu=class extends Pt{constructor(e,a){super();L(this,"title","Variables");L(this,"mentionPrefix","@");L(this,"contextType","variable");this.variables=e,this.tablesMap=a}getItems(){let e=new Set(this.tablesMap.keys());return Object.entries(this.variables).flatMap(([a,r])=>e.has(a)?[]:[{uri:this.asURI(a),name:a,type:this.contextType,description:r.dataType??"",dataType:r.dataType,data:{variable:r}}])}formatCompletion(e){let{data:a}=e,{variable:r}=a;return{label:`@${r.name}`,displayLabel:r.name,detail:r.dataType??"",type:this.contextType,section:wt.VARIABLE,info:()=>Ei(r)}}formatContext(e){let{data:a}=e,{variable:r}=a;return Mt({type:this.contextType,data:{name:r.name,dataType:r.dataType},details:r.value==null?void 0:JSON.stringify(r.value)})}};function pt(t){let e=t.get(Ri),a=t.get(Pi),r=t.get(Ii);return new wo().register(new Ru(a)).register(new Nu(r,a)).register(new Su(t)).register(new Eu(t)).register(new ko(e.connectionsMap,a))}function ju(){return new Ou(oo())}const Mu="@";function Pu({input:t}){let e="";return t.includes("@")&&(e=$u(t),ie.debug("Included context",e)),{includeOtherCode:es(""),context:{plainText:e,schema:[],variables:[]}}}async function Lu({input:t}){let e="",a=[];if(t.includes("@")){let r=pt(Kr),s=r.parseAllContextIds(t);e=r.formatContextForAI(s);try{a=await r.getAttachmentsForContext(s),ie.debug("Included attachments",a.length)}catch(n){ie.error("Error getting attachments:",n)}}return{body:{includeOtherCode:es(""),context:{plainText:e,schema:[],variables:[]}},attachments:a}}function $u(t){let e=pt(Kr),a=e.parseAllContextIds(t);return e.formatContextForAI(a)}function Du(t,e=[]){return a=>{let r=t.map(s=>a.matchBefore(s)).find(Boolean);return!r||r&&r.from===r.to&&!a.explicit?null:{from:r==null?void 0:r.from,options:[...e]}}}function $n(t){var e;if((e=t.current)!=null&&e.view){let a=t.current.view.state.selection.main.from;t.current.view.dispatch({changes:{from:a,to:a,insert:"@"},selection:{anchor:a+1,head:a+1}}),t.current.view.focus(),ao(t.current.view)}}function Zu(t){if(t.trim().length===0)return[];if(!t.includes("```"))return[{language:"python",code:t}];let e=[],a=0,r=t.indexOf("```",a);for(;r!==-1;){let s=t.indexOf(`
28
- `,r);if(s===-1){let d=t.slice(r+3),u=d.indexOf(" "),c=u===-1?d:d.slice(0,u),g=c==="markdown"?"markdown":c==="sql"?"sql":"python",m=u===-1?"":d.slice(u+1);m.trim()&&e.push({language:g,code:m.trim()});break}let n=t.slice(r+3,s).trim()||"";n=n==="markdown"?"markdown":n==="sql"?"sql":"python";let o=s+1,i=t.indexOf("```",o);if(i===-1){let d=t.slice(o).replace(/\n+$/,"");d.trim()&&e.push({language:n,code:d});break}let l=t.slice(o,i).replace(/\n+$/,"");l.trim()&&e.push({language:n,code:l}),a=i+3,r=t.indexOf("```",a)}return e.length===0&&e.push({language:"python",code:t}),e}var Fu=jt(),Dn=()=>new Map,{valueAtom:qt,useActions:Zn,createActions:Np,reducer:jp}=to(Dn,{addStagedCell:(t,e)=>{let{cellId:a,edit:r}=e;return new Map([...t,[a,r]])},removeStagedCell:(t,e)=>{let a=new Map(t);return a.delete(e),a},clearStagedCells:()=>Dn()});function Fn(t){let e=(0,Fu.c)(27),{addStagedCell:a,removeStagedCell:r,clearStagedCells:s}=Zn(),{createNewCell:n,updateCellCode:o}=Gr(),i=Lo(),l=(0,A.useRef)(null),d;e[0]!==a||e[1]!==n?(d=w=>{let S=Xr.create();return a({cellId:S,edit:{type:"add_cell"}}),n({cellId:"__end__",code:w,before:!1,newCellId:S}),S},e[0]=a,e[1]=n,e[2]=d):d=e[2];let u=d,c;e[3]!==t||e[4]!==o?(c=w=>{let{cellId:S,code:P}=w;if(!t.get(qt).has(S)){ie.error("Staged cell not found",{cellId:S});return}let D=Ai(S);D?Za(D,P):o({cellId:S,code:P,formattingChange:!1})},e[3]=t,e[4]=o,e[5]=c):c=e[5];let g=c,m;e[6]!==i||e[7]!==r?(m=w=>{r(w),i({cellId:w})},e[6]=i,e[7]=r,e[8]=m):m=e[8];let b=m,f;e[9]!==s||e[10]!==i||e[11]!==t?(f=()=>{let w=t.get(qt);for(let S of w.keys())i({cellId:S});s()},e[9]=s,e[10]=i,e[11]=t,e[12]=f):f=e[12];let p=f,h;e[13]!==a||e[14]!==n||e[15]!==u||e[16]!==g?(h=w=>{e:switch(w.type){case"text-start":l.current=new zu(u,g,a,n);break e;case"text-delta":if(!l.current){ie.error("Cell creation stream not found");return}l.current.stream(w);break e;case"text-end":case"finish":if(!l.current){ie.error("Cell creation stream not found");return}l.current.stop();break e;case"abort":case"error":case"tool-input-error":case"tool-output-error":ie.error("Error",w.type,{chunk:w});break e;case"start":case"start-step":case"finish-step":case"data-reasoning-signature":break e;case"message-metadata":case"tool-input-available":case"tool-output-available":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"file":case"source-document":case"source-url":case"tool-input-start":case"tool-input-delta":ie.debug(w.type,{chunk:w});break e;default:if(Uu(w)){ie.debug("Data chunk",{chunk:w});break e}ns(w)}},e[13]=a,e[14]=n,e[15]=u,e[16]=g,e[17]=h):h=e[17];let v=h,T;return e[18]!==a||e[19]!==s||e[20]!==u||e[21]!==p||e[22]!==b||e[23]!==v||e[24]!==r||e[25]!==g?(T={createStagedCell:u,updateStagedCell:g,addStagedCell:a,removeStagedCell:r,clearStagedCells:s,deleteStagedCell:b,deleteAllStagedCells:p,onStream:v},e[18]=a,e[19]=s,e[20]=u,e[21]=p,e[22]=b,e[23]=v,e[24]=r,e[25]=g,e[26]=T):T=e[26],T}var zu=class{constructor(t,e,a,r){L(this,"createdCells",[]);L(this,"buffer","");L(this,"hasMarimoImport",!1);this.onCreateCell=t,this.onUpdateCell=e,this.addStagedCell=a,this.createNewCell=r}stream(t){let e=t.delta;this.buffer+=e;let a=Zu(this.buffer);for(let[r,s]of a.entries())if(r<this.createdCells.length){this.addMarimoImport(s.language);let n=this.createdCells[r];this.createdCells[r]={...n,cell:s},this.onUpdateCell({cellId:n.cellId,code:s.code,language:s.language})}else{let n=this.onCreateCell(s.code);this.createdCells.push({cellId:n,cell:s})}}addMarimoImport(t){var a;if(this.hasMarimoImport||t==="python")return;let e=Oo({autoInstantiate:!1,createNewCell:this.createNewCell,fromCellId:(a=this.createdCells[0])==null?void 0:a.cellId,before:!0});e&&this.addStagedCell({cellId:e,edit:{type:"add_cell"}}),this.hasMarimoImport=!0}stop(){this.buffer=""}};function Uu(t){return t.type.startsWith("data-")}var Vu={baseDescription:"Perform editing operations on the current notebook. You should prefer to create new cells unless you need to edit existing cells. Call this tool multiple times to perform multiple edits. Separate code into logical individual cells to take advantage of the notebook's reactive execution model.",prerequisites:["If you are updating existing cells, you need the cellIds. If they are not known, call the lightweight_cell_map_tool to find out."],additionalInfo:`
27
+ `}}return Mt({type:this.contextType,data:{name:i,source:s??"unknown"},details:u.trim()})}formatCompletion(e){let a=e.data.name,r=e.data;return{label:`@${a}`,displayLabel:a,detail:r.source==="memory"?"in-memory":r.source,boost:r.source_type==="local"?kt.LOCAL_TABLE:kt.REMOTE_TABLE,type:Xr(r),apply:`@${a}`,section:{name:Xr(r)==="dataframe"?"Dataframe":"Table",rank:wt.TABLE.rank},info:()=>this.createTableInfoElement(a,r)}}createTableInfoElement(e,a){let r=document.createElement("div");r.classList.add("mo-cm-tooltip","docs-documentation","min-w-[200px]","flex","flex-col","gap-1","p-2");let s=document.createElement("div");s.classList.add("flex","flex-col","gap-1");let n=document.createElement("div");if(n.classList.add("font-bold","text-base"),n.textContent=e,s.append(n),a.source){let i=document.createElement("div");i.classList.add("text-xs","text-muted-foreground"),i.textContent=`Source: ${a.source}`,s.append(i)}r.append(s);let o=[a.num_rows==null?void 0:`${a.num_rows} rows`,a.num_columns==null?void 0:`${a.num_columns} columns`].filter(Boolean).join(", ");if(o){let i=document.createElement("div");i.classList.add("text-xs","bg-muted","px-2","py-1","rounded"),i.textContent=o,r.append(i)}if(a.columns&&a.columns.length>0){let i=document.createElement("div");i.classList.add("overflow-auto","max-h-60");let l=document.createElement("table");l.classList.add("w-full","text-xs","border-collapse");let d=l.insertRow();d.classList.add("bg-muted");let u=d.insertCell();u.classList.add("p-2","font-medium","text-left"),u.textContent="Column";let c=d.insertCell();c.classList.add("p-2","font-medium","text-left"),c.textContent="Type";let g=a.columns.some(b=>this.getItemMetadata(a,b)!==void 0),m;g&&(m=d.insertCell(),m.classList.add("p-2","font-medium","text-left"),m.textContent="Metadata"),a.columns.forEach((b,f)=>{let p=l.insertRow();p.classList.add(f%2==0?"bg-background":"bg-muted/30");let h=p.insertCell();h.classList.add("p-2","font-mono"),h.textContent=b.name;let v=p.insertCell();if(v.classList.add("p-2","text-muted-foreground"),v.textContent=b.type,g){let T=p.insertCell();T.classList.add("p-2");let w=this.getItemMetadata(a,b);w&&T.append(w)}}),i.append(l),r.append(i)}return r}getItemMetadata(e,a){var n,o;let r=(n=e.primary_keys)==null?void 0:n.includes(a.name),s=(o=e.indexes)==null?void 0:o.includes(a.name);if(r||s){let i=document.createElement("span");i.textContent=r?"PK":"IDX";let l=r?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200";return i.classList.add("text-xs","px-1.5","py-0.5","rounded-full","font-medium",...l.split(" ")),i}}},Nu=class extends Pt{constructor(e,a){super();L(this,"title","Variables");L(this,"mentionPrefix","@");L(this,"contextType","variable");this.variables=e,this.tablesMap=a}getItems(){let e=new Set(this.tablesMap.keys());return Object.entries(this.variables).flatMap(([a,r])=>e.has(a)?[]:[{uri:this.asURI(a),name:a,type:this.contextType,description:r.dataType??"",dataType:r.dataType,data:{variable:r}}])}formatCompletion(e){let{data:a}=e,{variable:r}=a;return{label:`@${r.name}`,displayLabel:r.name,detail:r.dataType??"",type:this.contextType,section:wt.VARIABLE,info:()=>Ti(r)}}formatContext(e){let{data:a}=e,{variable:r}=a;return Mt({type:this.contextType,data:{name:r.name,dataType:r.dataType},details:r.value==null?void 0:JSON.stringify(r.value)})}};function pt(t){let e=t.get(Ni),a=t.get(Li),r=t.get(Pi);return new wo().register(new Ru(a)).register(new Nu(r,a)).register(new Su(t)).register(new Eu(t)).register(new ko(e.connectionsMap,a))}function ju(){return new Ou(oo())}const Mu="@";function Pu({input:t}){let e="";return t.includes("@")&&(e=$u(t),ie.debug("Included context",e)),{includeOtherCode:Gr(""),context:{plainText:e,schema:[],variables:[]}}}async function Lu({input:t}){let e="",a=[];if(t.includes("@")){let r=pt(Kr),s=r.parseAllContextIds(t);e=r.formatContextForAI(s);try{a=await r.getAttachmentsForContext(s),ie.debug("Included attachments",a.length)}catch(n){ie.error("Error getting attachments:",n)}}return{body:{includeOtherCode:Gr(""),context:{plainText:e,schema:[],variables:[]}},attachments:a}}function $u(t){let e=pt(Kr),a=e.parseAllContextIds(t);return e.formatContextForAI(a)}function Du(t,e=[]){return a=>{let r=t.map(s=>a.matchBefore(s)).find(Boolean);return!r||r&&r.from===r.to&&!a.explicit?null:{from:r==null?void 0:r.from,options:[...e]}}}function $n(t){var e;if((e=t.current)!=null&&e.view){let a=t.current.view.state.selection.main.from;t.current.view.dispatch({changes:{from:a,to:a,insert:"@"},selection:{anchor:a+1,head:a+1}}),t.current.view.focus(),ao(t.current.view)}}function Zu(t){if(t.trim().length===0)return[];if(!t.includes("```"))return[{language:"python",code:t}];let e=[],a=0,r=t.indexOf("```",a);for(;r!==-1;){let s=t.indexOf(`
28
+ `,r);if(s===-1){let d=t.slice(r+3),u=d.indexOf(" "),c=u===-1?d:d.slice(0,u),g=c==="markdown"?"markdown":c==="sql"?"sql":"python",m=u===-1?"":d.slice(u+1);m.trim()&&e.push({language:g,code:m.trim()});break}let n=t.slice(r+3,s).trim()||"";n=n==="markdown"?"markdown":n==="sql"?"sql":"python";let o=s+1,i=t.indexOf("```",o);if(i===-1){let d=t.slice(o).replace(/\n+$/,"");d.trim()&&e.push({language:n,code:d});break}let l=t.slice(o,i).replace(/\n+$/,"");l.trim()&&e.push({language:n,code:l}),a=i+3,r=t.indexOf("```",a)}return e.length===0&&e.push({language:"python",code:t}),e}var Fu=jt(),Dn=()=>new Map,{valueAtom:qt,useActions:Zn,createActions:Np,reducer:jp}=to(Dn,{addStagedCell:(t,e)=>{let{cellId:a,edit:r}=e;return new Map([...t,[a,r]])},removeStagedCell:(t,e)=>{let a=new Map(t);return a.delete(e),a},clearStagedCells:()=>Dn()});function Fn(t){let e=(0,Fu.c)(27),{addStagedCell:a,removeStagedCell:r,clearStagedCells:s}=Zn(),{createNewCell:n,updateCellCode:o}=Qr(),i=Lo(),l=(0,A.useRef)(null),d;e[0]!==a||e[1]!==n?(d=w=>{let S=es.create();return a({cellId:S,edit:{type:"add_cell"}}),n({cellId:"__end__",code:w,before:!1,newCellId:S}),S},e[0]=a,e[1]=n,e[2]=d):d=e[2];let u=d,c;e[3]!==t||e[4]!==o?(c=w=>{let{cellId:S,code:P}=w;if(!t.get(qt).has(S)){ie.error("Staged cell not found",{cellId:S});return}let D=Ri(S);D?Za(D,P):o({cellId:S,code:P,formattingChange:!1})},e[3]=t,e[4]=o,e[5]=c):c=e[5];let g=c,m;e[6]!==i||e[7]!==r?(m=w=>{r(w),i({cellId:w})},e[6]=i,e[7]=r,e[8]=m):m=e[8];let b=m,f;e[9]!==s||e[10]!==i||e[11]!==t?(f=()=>{let w=t.get(qt);for(let S of w.keys())i({cellId:S});s()},e[9]=s,e[10]=i,e[11]=t,e[12]=f):f=e[12];let p=f,h;e[13]!==a||e[14]!==n||e[15]!==u||e[16]!==g?(h=w=>{e:switch(w.type){case"text-start":l.current=new zu(u,g,a,n);break e;case"text-delta":if(!l.current){ie.error("Cell creation stream not found");return}l.current.stream(w);break e;case"text-end":case"finish":if(!l.current){ie.error("Cell creation stream not found");return}l.current.stop();break e;case"abort":case"error":case"tool-input-error":case"tool-output-error":ie.error("Error",w.type,{chunk:w});break e;case"start":case"start-step":case"finish-step":case"data-reasoning-signature":break e;case"message-metadata":case"tool-input-available":case"tool-output-available":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"file":case"source-document":case"source-url":case"tool-input-start":case"tool-input-delta":ie.debug(w.type,{chunk:w});break e;default:if(Uu(w)){ie.debug("Data chunk",{chunk:w});break e}ns(w)}},e[13]=a,e[14]=n,e[15]=u,e[16]=g,e[17]=h):h=e[17];let v=h,T;return e[18]!==a||e[19]!==s||e[20]!==u||e[21]!==p||e[22]!==b||e[23]!==v||e[24]!==r||e[25]!==g?(T={createStagedCell:u,updateStagedCell:g,addStagedCell:a,removeStagedCell:r,clearStagedCells:s,deleteStagedCell:b,deleteAllStagedCells:p,onStream:v},e[18]=a,e[19]=s,e[20]=u,e[21]=p,e[22]=b,e[23]=v,e[24]=r,e[25]=g,e[26]=T):T=e[26],T}var zu=class{constructor(t,e,a,r){L(this,"createdCells",[]);L(this,"buffer","");L(this,"hasMarimoImport",!1);this.onCreateCell=t,this.onUpdateCell=e,this.addStagedCell=a,this.createNewCell=r}stream(t){let e=t.delta;this.buffer+=e;let a=Zu(this.buffer);for(let[r,s]of a.entries())if(r<this.createdCells.length){this.addMarimoImport(s.language);let n=this.createdCells[r];this.createdCells[r]={...n,cell:s},this.onUpdateCell({cellId:n.cellId,code:s.code,language:s.language})}else{let n=this.onCreateCell(s.code);this.createdCells.push({cellId:n,cell:s})}}addMarimoImport(t){var a;if(this.hasMarimoImport||t==="python")return;let e=Oo({autoInstantiate:!1,createNewCell:this.createNewCell,fromCellId:(a=this.createdCells[0])==null?void 0:a.cellId,before:!0});e&&this.addStagedCell({cellId:e,edit:{type:"add_cell"}}),this.hasMarimoImport=!0}stop(){this.buffer=""}};function Uu(t){return t.type.startsWith("data-")}var Vu={baseDescription:"Perform editing operations on the current notebook. You should prefer to create new cells unless you need to edit existing cells. Call this tool multiple times to perform multiple edits. Separate code into logical individual cells to take advantage of the notebook's reactive execution model.",prerequisites:["If you are updating existing cells, you need the cellIds. If they are not known, call the lightweight_cell_map_tool to find out."],additionalInfo:`
29
29
  Args:
30
30
  edit (object): The editing operation to perform with the following structure:
31
31
  - type: One of "update_cell", "add_cell", or "delete_cell"
@@ -49,7 +49,7 @@ Image URL: ${a.imageUrl}`)),Mt({type:this.contextType,data:o,details:i})}async g
49
49
  - SQL cells: use mo.sql(f"""{content}""") function to insert content. If a database engine is specified, use mo.sql(f"""{content}""", engine=engine) instead.
50
50
 
51
51
  Returns:
52
- - A result object containing standard tool metadata.`},Bu=H({edit:H({type:aa(["update_cell","add_cell","delete_cell"]),code:E().optional(),position:H({type:aa(["relative","column_end","notebook_end"]).optional(),cellId:E().optional(),columnIndex:rs().optional(),before:ce().optional()})})}),qu=class{constructor(){L(this,"name","edit_notebook_tool");L(this,"description",Vu);L(this,"schema",Bu);L(this,"outputSchema",Nn);L(this,"mode",["agent"]);L(this,"handler",async({edit:t},e)=>{let{addStagedCell:a,createNewCell:r,store:s}=e;switch(t.type){case"update_cell":{let{position:n,code:o}=t,i=n.cellId;if(i){if(!o)throw new xe("Code is required for update_cell","CODE_REQUIRED_FOR_UPDATE_CELL",!0,"Provide the new code to update the cell")}else throw new xe("Cell ID is required for update_cell","CELL_ID_REQUIRED_FOR_UPDATE_CELL",!0,"Provide a cell ID to update");let l=s.get(Ge);this.validateCellIdExists(i,l);let d=this.getCellEditorView(i,l);Ba(i);let u=s.get(qt).get(i);if((u==null?void 0:u.type)==="add_cell"){Za(d,o);break}let c=d.state.doc.toString(),g=(u==null?void 0:u.previousCode)??c;if(o===g)break;a({cellId:i,edit:{type:"update_cell",previousCode:g}}),Za(d,o);break}case"add_cell":{let{position:n,code:o}=t,i="__end__",l=!1,d=Xr.create(),u=s.get(Ge);switch(n.type){case"relative":{let c=n.cellId;if(!c)throw new xe("Cell ID is required for add_cell with relative position","TOOL_ERROR",!0,"Provide a cell ID to add the cell before");if(n.before===void 0)throw new xe("Before is required for add_cell with relative position","TOOL_ERROR",!0,`Provide a boolean value for before, true to add before cell ${c}, false to add after the cell`);this.validateCellIdExists(c,u),i=c,l=n.before;break}case"column_end":if(!n.columnIndex)throw new xe("Column index is required for add_cell with column_end position","TOOL_ERROR",!0,"Provide a column index to add the cell at the end of");i={type:"__end__",columnId:this.getColumnId(n.columnIndex,u)};break;case"notebook_end":break}r({cellId:i,before:l,code:o,newCellId:d}),a({cellId:d,edit:{type:"add_cell"}}),Ba(d);break}case"delete_cell":{let{position:n}=t,o=n.cellId;if(!o)throw new xe("Cell ID is required for delete_cell","CELL_ID_REQUIRED_FOR_DELETE_CELL",!0,"Provide a cell ID to delete");let i=s.get(Ge);this.validateCellIdExists(o,i),a({cellId:o,edit:{type:"delete_cell",previousCode:this.getCellEditorView(o,i).state.doc.toString()}}),Ba(o);break}}return{status:"success",next_steps:["If you need to perform more edits, call this tool again.","You should use the lint notebook tool to check for errors and lint issues. Fix them by editing the notebook.","You should use the run stale cells tool to run the cells that have been edited or newly added. This allows you to see the output of the cells and fix any errors."]}})}validateCellIdExists(t,e){if(!e.cellIds.getColumns().some(a=>a.idSet.has(t)))throw new xe("Cell not found","CELL_NOT_FOUND",!1,"Check which cells exist in the notebook")}getColumnId(t,e){let a=e.cellIds.getColumns();if(t<0||t>=a.length)throw new xe("Column index is out of range","COLUMN_INDEX_OUT_OF_RANGE",!0,"Choose a column index between 0 and the number of columns in the notebook (0-based)");return a[t].id}getCellEditorView(t,e){let a=e.cellHandles[t].current;if(!(a!=null&&a.editorView))throw new xe("Cell editor not found","CELL_EDITOR_NOT_FOUND",!1,"Internal error, ask the user to report this error");return a.editorView}},Wu=200,Ju=3e4,zn=2e3,Ku=3e3,Yu=4e4,Hu={baseDescription:"Run cells in the current notebook that are stale. Stale cells are cells that have been edited or newly added. You can run this tool after editing the notebook or when requested. The output of the ran cells will be returned alongside metadata."},Un=H({type:M("file"),url:E(),mediaType:E()}),Gu=class{constructor(t){L(this,"name","run_stale_cells_tool");L(this,"description",Hu);L(this,"schema",H({}));L(this,"outputSchema",Nn.extend({cellsToOutput:Nt(E(),H({consoleOutput:E().optional(),cellOutput:E().optional(),consoleAttachments:ze(Un).optional(),cellAttachments:ze(Un).optional()}).nullable()).optional()}));L(this,"mode",["agent"]);L(this,"handler",async(t,e)=>{let{prepareForRun:a,sendRun:r,store:s}=e,n=s.get(Ge),o=Ti(n);if(o.length===0)return{status:"success",message:"No stale cells found."};if(await Ao({cellIds:o,sendRun:r,prepareForRun:a,notebook:n}),!await this.waitForCellsToFinish(s,o,Ju,this.postExecutionDelay))return{status:"success",message:"No output was returned because some cells have not finished executing"};let i=s.get(Ge),l=new Map,d=!1,u=!1,c=0;for(let m of o){let b=Mn(m,i,{includeConsoleOutput:!0}),f=b.cellOutput,p=b.consoleOutputs,h=p&&p.length>0;if((f&&this.outputHasErrors(f)||h&&p.some(w=>this.outputHasErrors(w)))&&(d=!0),!f&&!h){l.set(m,null);continue}if(c>=Yu){l.set(m,{cellOutput:"Cell executed (output omitted due to context limits)."});continue}let v,T;f&&(v=this.formatOutputString(f),c+=v.length),h&&(u=!0,T=p.map(w=>this.formatOutputString(w)).join(`
52
+ - A result object containing standard tool metadata.`},Bu=H({edit:H({type:aa(["update_cell","add_cell","delete_cell"]),code:E().optional(),position:H({type:aa(["relative","column_end","notebook_end"]).optional(),cellId:E().optional(),columnIndex:rs().optional(),before:ce().optional()})})}),qu=class{constructor(){L(this,"name","edit_notebook_tool");L(this,"description",Vu);L(this,"schema",Bu);L(this,"outputSchema",Nn);L(this,"mode",["agent"]);L(this,"handler",async({edit:t},e)=>{let{addStagedCell:a,createNewCell:r,store:s}=e;switch(t.type){case"update_cell":{let{position:n,code:o}=t,i=n.cellId;if(i){if(!o)throw new xe("Code is required for update_cell","CODE_REQUIRED_FOR_UPDATE_CELL",!0,"Provide the new code to update the cell")}else throw new xe("Cell ID is required for update_cell","CELL_ID_REQUIRED_FOR_UPDATE_CELL",!0,"Provide a cell ID to update");let l=s.get(Ge);this.validateCellIdExists(i,l);let d=this.getCellEditorView(i,l);Ba(i);let u=s.get(qt).get(i);if((u==null?void 0:u.type)==="add_cell"){Za(d,o);break}let c=d.state.doc.toString(),g=(u==null?void 0:u.previousCode)??c;if(o===g)break;a({cellId:i,edit:{type:"update_cell",previousCode:g}}),Za(d,o);break}case"add_cell":{let{position:n,code:o}=t,i="__end__",l=!1,d=es.create(),u=s.get(Ge);switch(n.type){case"relative":{let c=n.cellId;if(!c)throw new xe("Cell ID is required for add_cell with relative position","TOOL_ERROR",!0,"Provide a cell ID to add the cell before");if(n.before===void 0)throw new xe("Before is required for add_cell with relative position","TOOL_ERROR",!0,`Provide a boolean value for before, true to add before cell ${c}, false to add after the cell`);this.validateCellIdExists(c,u),i=c,l=n.before;break}case"column_end":if(!n.columnIndex)throw new xe("Column index is required for add_cell with column_end position","TOOL_ERROR",!0,"Provide a column index to add the cell at the end of");i={type:"__end__",columnId:this.getColumnId(n.columnIndex,u)};break;case"notebook_end":break}r({cellId:i,before:l,code:o,newCellId:d}),a({cellId:d,edit:{type:"add_cell"}}),Ba(d);break}case"delete_cell":{let{position:n}=t,o=n.cellId;if(!o)throw new xe("Cell ID is required for delete_cell","CELL_ID_REQUIRED_FOR_DELETE_CELL",!0,"Provide a cell ID to delete");let i=s.get(Ge);this.validateCellIdExists(o,i),a({cellId:o,edit:{type:"delete_cell",previousCode:this.getCellEditorView(o,i).state.doc.toString()}}),Ba(o);break}}return{status:"success",next_steps:["If you need to perform more edits, call this tool again.","You should use the lint notebook tool to check for errors and lint issues. Fix them by editing the notebook.","You should use the run stale cells tool to run the cells that have been edited or newly added. This allows you to see the output of the cells and fix any errors."]}})}validateCellIdExists(t,e){if(!e.cellIds.getColumns().some(a=>a.idSet.has(t)))throw new xe("Cell not found","CELL_NOT_FOUND",!1,"Check which cells exist in the notebook")}getColumnId(t,e){let a=e.cellIds.getColumns();if(t<0||t>=a.length)throw new xe("Column index is out of range","COLUMN_INDEX_OUT_OF_RANGE",!0,"Choose a column index between 0 and the number of columns in the notebook (0-based)");return a[t].id}getCellEditorView(t,e){let a=e.cellHandles[t].current;if(!(a!=null&&a.editorView))throw new xe("Cell editor not found","CELL_EDITOR_NOT_FOUND",!1,"Internal error, ask the user to report this error");return a.editorView}},Wu=200,Ju=3e4,zn=2e3,Ku=3e3,Yu=4e4,Hu={baseDescription:"Run cells in the current notebook that are stale. Stale cells are cells that have been edited or newly added. You can run this tool after editing the notebook or when requested. The output of the ran cells will be returned alongside metadata."},Un=H({type:M("file"),url:E(),mediaType:E()}),Gu=class{constructor(t){L(this,"name","run_stale_cells_tool");L(this,"description",Hu);L(this,"schema",H({}));L(this,"outputSchema",Nn.extend({cellsToOutput:Nt(E(),H({consoleOutput:E().optional(),cellOutput:E().optional(),consoleAttachments:ze(Un).optional(),cellAttachments:ze(Un).optional()}).nullable()).optional()}));L(this,"mode",["agent"]);L(this,"handler",async(t,e)=>{let{prepareForRun:a,sendRun:r,store:s}=e,n=s.get(Ge),o=Ii(n);if(o.length===0)return{status:"success",message:"No stale cells found."};if(await Ao({cellIds:o,sendRun:r,prepareForRun:a,notebook:n}),!await this.waitForCellsToFinish(s,o,Ju,this.postExecutionDelay))return{status:"success",message:"No output was returned because some cells have not finished executing"};let i=s.get(Ge),l=new Map,d=!1,u=!1,c=0;for(let m of o){let b=Mn(m,i,{includeConsoleOutput:!0}),f=b.cellOutput,p=b.consoleOutputs,h=p&&p.length>0;if((f&&this.outputHasErrors(f)||h&&p.some(w=>this.outputHasErrors(w)))&&(d=!0),!f&&!h){l.set(m,null);continue}if(c>=Yu){l.set(m,{cellOutput:"Cell executed (output omitted due to context limits)."});continue}let v,T;f&&(v=this.formatOutputString(f),c+=v.length),h&&(u=!0,T=p.map(w=>this.formatOutputString(w)).join(`
53
53
  `),T=this.truncateString(T,zn),c+=T.length),l.set(m,{cellOutput:v,consoleOutput:T})}if(l.size===0)return{status:"success",message:"Stale cells have been run. No output was returned."};let g=["Review the output of the cells. The CellId is the key of the result object.",d?"There are errors in the cells. Please fix them by using the edit notebook tool and the given CellIds.":"You may edit the notebook further with the given CellIds."];return{status:"success",cellsToOutput:Object.fromEntries(l),message:u?"Console output represents the stdout or stderr of the cell (eg. print statements).":void 0,next_steps:g}});this.postExecutionDelay=(t==null?void 0:t.postExecutionDelay)??Wu}outputHasErrors(t){return t.output.mimetype==="application/vnd.marimo+error"||t.output.mimetype==="application/vnd.marimo+traceback"}formatOutputString(t){let{outputType:e,processedContent:a,imageUrl:r,output:s}=t;if(e==="media"){let i=`Media Output: Contains ${s.mimetype} content`;return r?`${i}
54
54
  Image URL: ${r}`:i}if(s.mimetype==="text/html")return`HTML Output: text/html content (${(typeof s.data=="string"?s.data.length:JSON.stringify(s.data).length).toLocaleString()} chars). Full output visible in notebook UI.`;let n=this.outputHasErrors(t)?Ku:zn,o=a;return o||(o=typeof s.data=="string"?s.data:JSON.stringify(s.data)),`Output:
55
55
  ${this.truncateString(o,n)}`}truncateString(t,e){return t.length<=e?t:`${t.slice(0,e)}
@@ -73,8 +73,8 @@ ${this.truncateString(o,n)}`}truncateString(t,e){return t.length<=e?t:`${t.slice
73
73
  - `)}`),t.additionalInfo&&(e+=`
74
74
 
75
75
  ## Additional info:
76
- - ${t.additionalInfo}`),e}var Vn,Wt;function Xu(t,e,a,r,s){var n={};return Object.keys(r).forEach(function(o){n[o]=r[o]}),n.enumerable=!!n.enumerable,n.configurable=!!n.configurable,("value"in n||n.initializer)&&(n.writable=!0),n=a.slice().reverse().reduce(function(o,i){return i(t,e,o)||o},n),s&&n.initializer!==void 0&&(n.value=n.initializer?n.initializer.call(s):void 0,n.initializer=void 0),n.initializer===void 0?(Object.defineProperty(t,e,n),null):n}const $r=new(Vn=$i(),Wt=class{constructor(t=[]){L(this,"tools",new Map);this.tools=new Map(t.map(e=>[e.name,e]))}has(t){return this.tools.has(t)}getToolOrThrow(t){let e=this.tools.get(t);if(!e)throw Error(`Tool ${t} not found`);return e}async invoke(t,e,a){var i;let r=this.getToolOrThrow(t),s=r.handler,n=r.schema,o=r.outputSchema;try{let l=await n.safeParseAsync(e);if(l.error)throw new xe(`Tool ${t} returned invalid input: ${as(l.error)}`,"INVALID_ARGUMENTS",!0,"Please check the arguments and try again.");let d=l.data,u=await s(d,a),c=await o.safeParseAsync(u);if(c.error){let g=as(c.error);throw Error(`Tool ${t} returned invalid output: ${g}`)}return{tool_name:t,result:c.data,error:null}}catch(l){return l instanceof xe?{tool_name:t,result:null,error:l.toStructuredString()}:{tool_name:t,result:null,error:new xe(l instanceof Error?l.message:String(l),"TOOL_ERROR",!1,"Check the error message and try again with valid arguments.",{args:e,errorType:((i=l==null?void 0:l.constructor)==null?void 0:i.name)??typeof l}).toStructuredString()}}}getToolSchemas(t){return[...this.tools.values()].filter(e=>e.mode.includes(t)).map(e=>({name:e.name,description:Qu(e.description),parameters:ss(e.schema),source:"frontend",mode:e.mode}))}},Xu(Wt.prototype,"getToolSchemas",[Vn],Object.getOwnPropertyDescriptor(Wt.prototype,"getToolSchemas"),Wt.prototype),Wt)([new qu,new Gu]);var ec=jt();const Bn=new Set(["openai","google","anthropic"]),tc=["image/*","text/*"];var ac=1024*1024*50;function rc(t){return t.length>50?`${t.slice(0,50)}...`:t}async function qn(t){return await Promise.all(t.map(async e=>({type:"file",mediaType:e.type,filename:e.name,url:await uo(e,"dataUrl")})))}function sc(t){if(t.length===0)return!1;let e=t.at(-1);if(!e||e.role!=="assistant"||!e.parts)return!1;let a=e.parts;return a.length===0?!1:a[a.length-1].type==="reasoning"}function nc(t){return t.map(e=>e.type==="text"?e.text:"").join(`
77
- `)}async function Wn(t){let e=await Lu({input:nc(t.flatMap(r=>r.parts))});function a(r,s){return s?{...r,parts:[...r.parts,...e.attachments]}:r}return{...e.body,uiMessages:t.map((r,s)=>a(r,s===t.length-1))}}async function Jn({invokeAiTool:t,addToolOutput:e,toolCall:a,toolContext:r}){try{if($r.has(a.toolName)){let s=await $r.invoke(a.toolName,a.input,r);e({tool:a.toolName,toolCallId:a.toolCallId,output:s.result||s.error})}else{let s=await t({toolName:a.toolName,arguments:a.input??{}});e({tool:a.toolName,toolCallId:a.toolCallId,output:s.result||s.error})}}catch(s){ie.error("Tool call failed:",s),e({tool:a.toolName,toolCallId:a.toolCallId,output:`Error: ${s instanceof Error?s.message:String(s)}`})}}function ic(t){var i;if(t.length===0)return!1;let e=t[t.length-1],a=e.parts;if(a.length===0||e.role!=="assistant")return!1;let r=a.filter(l=>l.type.startsWith("tool-"));if(r.length===0)return!1;let s=r.every(l=>l.state==="output-available"),n=a[a.length-1],o=n.type==="text"&&((i=n.text)==null?void 0:i.trim().length)>0;return ie.warn("All tool calls completed: %s",s),s&&!o}function Kn(){let t=(0,ec.c)(7),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];let[a,r]=(0,A.useState)(e),s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=c=>{if(c.length!==0){if(c.reduce(oc,0)>ac){Va({title:"File size exceeded",description:"Attachments must be under 50 MB",variant:"danger"});return}r(g=>[...g,...c])}},t[1]=s):s=t[1];let n=Yr(s),o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=()=>r([]),t[2]=o):o=t[2];let i=o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=c=>r(g=>g.filter(m=>m!==c)),t[3]=l):l=t[3];let d=l,u;return t[4]!==n||t[5]!==a?(u={files:a,addFiles:n,clearFiles:i,removeFile:d},t[4]=n,t[5]=a,t[6]=u):u=t[6],u}function oc(t,e){return t+e.size}var Jt=jt(),C=Da(Yi(),1);const lc=t=>{var o;let e=(0,Jt.c)(6),{attachment:a}=t;if((o=a.mediaType)!=null&&o.startsWith("image/")){let i=a.filename||"Attachment",l;return e[0]!==a.url||e[1]!==i?(l=(0,C.jsx)("img",{src:a.url,alt:i,className:"max-h-[100px] max-w-[100px] object-contain mb-1.5"}),e[0]=a.url,e[1]=i,e[2]=l):l=e[2],l}let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,C.jsx)(ps,{className:"h-3 w-3 mt-0.5"}),e[3]=r):r=e[3];let s=a.filename||"Attachment",n;return e[4]===s?n=e[5]:(n=(0,C.jsxs)("div",{className:"flex flex-row gap-1 items-center text-xs",children:[r,s]}),e[4]=s,e[5]=n),n},Yn=t=>{let e=(0,Jt.c)(12),{file:a,className:r,onRemove:s}=t,[n,o]=(0,A.useState)(!1),i;e[0]===r?i=e[1]:(i=Fa("py-1 px-1.5 bg-muted rounded-md cursor-pointer flex flex-row gap-1 items-center text-xs",r),e[0]=r,e[1]=i);let l,d;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>o(!0),d=()=>o(!1),e[2]=l,e[3]=d):(l=e[2],d=e[3]);let u;e[4]!==a||e[5]!==n||e[6]!==s?(u=n?(0,C.jsx)(ds,{className:"h-3 w-3 mt-0.5",onClick:s}):dc(a),e[4]=a,e[5]=n,e[6]=s,e[7]=u):u=e[7];let c;return e[8]!==a.name||e[9]!==i||e[10]!==u?(c=(0,C.jsxs)("div",{className:i,onMouseEnter:l,onMouseLeave:d,children:[u,a.name]}),e[8]=a.name,e[9]=i,e[10]=u,e[11]=c):c=e[11],c},Hn=t=>{let e=(0,Jt.c)(12),{isLoading:a,onStop:r,onSendClick:s,isEmpty:n,showStopLabel:o}=t,i=o===void 0?!1:o,l;e[0]===i?l=e[1]:(l=i?(0,C.jsxs)("div",{className:"flex flex-row items-center gap-1 px-1.5",children:[(0,C.jsx)("span",{className:"text-xs text-error",children:"Stop"}),(0,C.jsx)(vo,{size:"small"})]}):(0,C.jsx)(ms,{className:"size-4 text-error"}),e[0]=i,e[1]=l);let d=l,u=a?"Stop":"Submit",c=a?r:s,g=a?!1:n,m;e[2]!==a||e[3]!==d?(m=a?d:(0,C.jsx)(fs,{className:"h-3.5 w-3.5"}),e[2]=a,e[3]=d,e[4]=m):m=e[4];let b;e[5]!==c||e[6]!==g||e[7]!==m?(b=(0,C.jsx)(Qe,{variant:"text",size:"sm",className:"h-6 min-w-6 p-0 hover:bg-muted/30 cursor-pointer",onClick:c,disabled:g,children:m}),e[5]=c,e[6]=g,e[7]=m,e[8]=b):b=e[8];let f;return e[9]!==u||e[10]!==b?(f=(0,C.jsx)(oa,{content:u,children:b}),e[9]=u,e[10]=b,e[11]=f):f=e[11],f},Gn=t=>{let e=(0,Jt.c)(4),{handleAddContext:a,isLoading:r}=t,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,C.jsx)(lo,{className:"h-3.5 w-3.5"}),e[0]=s):s=e[0];let n;return e[1]!==a||e[2]!==r?(n=(0,C.jsx)(oa,{content:"Add context",children:(0,C.jsx)(Qe,{variant:"text",size:"icon",onClick:a,disabled:r,children:s})}),e[1]=a,e[2]=r,e[3]=n):n=e[3],n},Qn=t=>{let e=(0,Jt.c)(15),{fileInputRef:a,isLoading:r,onAddFiles:s}=t,n;e[0]===a?n=e[1]:(n=()=>{var g;return(g=a.current)==null?void 0:g.click()},e[0]=a,e[1]=n);let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,C.jsx)(hs,{className:"h-3.5 w-3.5"}),e[2]=o):o=e[2];let i;e[3]!==r||e[4]!==n?(i=(0,C.jsx)(oa,{content:"Attach a file",children:(0,C.jsx)(Qe,{variant:"text",size:"icon",onClick:n,disabled:r,children:o})}),e[3]=r,e[4]=n,e[5]=i):i=e[5];let l;e[6]===s?l=e[7]:(l=g=>{g.target.files&&s([...g.target.files])},e[6]=s,e[7]=l);let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=tc.join(","),e[8]=d):d=e[8];let u;e[9]!==a||e[10]!==l?(u=(0,C.jsx)(bo,{ref:a,type:"file",multiple:!0,hidden:!0,onChange:l,accept:d}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let c;return e[12]!==i||e[13]!==u?(c=(0,C.jsxs)(C.Fragment,{children:[i,u]}),e[12]=i,e[13]=u,e[14]=c):c=e[14],c};function dc(t){let e="h-3 w-3 mt-0.5";return t.type.startsWith("image/")?(0,C.jsx)(yo,{className:e}):t.type.startsWith("text/")?(0,C.jsx)(Di,{className:e}):(0,C.jsx)(ps,{className:e})}const Dr=sa.define(),We=ia.define({create(){return new Map},update(t,e){let a=!1,r=t;for(let s of e.effects)if(s.is(Dr)){a||(a=(r=new Map(t),!0));for(let[n,o]of s.value)r.set(n,o)}return r}}),uc=ia.define({create(){return{onResourceClick:void 0,onResourceMouseOver:void 0,onResourceMouseOut:void 0,onPromptSubmit:void 0}},update(t){return t}}),cc=sa.define();ia.define({create(){return new Map},update(t,e){let a=!1,r=t;for(let s of e.effects)if(s.is(cc)){a||(a=(r=new Map(t),!0));for(let[n,o]of s.value)r.set(n,o)}return r}});const pc=(t,e)=>async a=>{let r=a.matchBefore(/@(\w+)?/);if(!r||r.from===r.to&&!a.explicit)return null;let s=await t();if(s.length===0)return null;let n=Dr.of(new Map(s.map(i=>[i.uri,i])));a.view&&a.view.dispatch({effects:n});let o=s.map(i=>({label:`@${i.name}`,displayLabel:i.name,detail:i.uri,info:i.description||void 0,type:i.mimeType?"constant":"variable",boost:i.description?100:0,...e==null?void 0:e(i),apply:(l,d,u,c)=>{l.dispatch({changes:{from:u,to:c,insert:`@${i.uri} `}})}}));return{from:r.from,options:o}},mc=/@[\w-]+:\/\/(?!\/)[^\s]+/;function st(t){return t.matchAll(new RegExp(mc.source,"g"))}var hc=class extends ls{constructor(e,a){super();L(this,"resource");L(this,"view");this.resource=e,this.view=a}eq(e){return e.resource.uri===this.resource.uri}toDOM(){let e=document.createElement("span");e.className="cm-resource-widget",e.textContent=`@${this.resource.name}`;let a=this.view.state.field(uc,!1),r=a==null?void 0:a.onResourceClick,s=a==null?void 0:a.onResourceMouseOver,n=a==null?void 0:a.onResourceMouseOut;return r&&(e.style.cursor="pointer",e.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),r(this.resource)})),s&&e.addEventListener("mouseover",o=>{o.preventDefault(),o.stopPropagation(),s(this.resource)}),n&&e.addEventListener("mouseout",o=>{o.preventDefault(),o.stopPropagation(),n(this.resource)}),e}},fc=class extends ls{constructor(e,a){super();L(this,"uri");L(this,"view");this.uri=e,this.view=a}eq(e){return e.uri===this.uri}toDOM(){let e=document.createElement("span");return e.className="cm-not-found-resource-widget",e.textContent=`@${this.uri.split("://")[1]??this.uri}`,e}};function Xn(t){let e=t.state.field(We),a=[];for(let{from:r,to:s}of t.visibleRanges){let n=t.state.doc.sliceString(r,s);for(let o of st(n)){let i=r+o.index,l=o[0].slice(1),d=e.get(l);d?a.push(za.replace({widget:new hc(d,t)}).range(i,i+o[0].length)):a.push(za.replace({widget:new fc(l,t)}).range(i,i+o[0].length))}}return za.set(a)}const gc=Xi.fromClass(class{constructor(t){L(this,"decorations");this.decorations=Xn(t)}update(t){(t.docChanged||t.viewportChanged||t.transactions.some(e=>e.effects.some(a=>a.is(Dr))))&&(this.decorations=Xn(t.view))}},{decorations:t=>t.decorations});function yc(t){let e=document.createElement("div");e.className="cm-tooltip-cursor";let a=document.createElement("div");if(a.className="cm-tooltip-cursor-title",a.textContent=`${t.name} (${t.uri})`,e.appendChild(a),t.description){let r=document.createElement("div");r.className="cm-tooltip-cursor-description",r.textContent=t.description,e.appendChild(r)}if(t.mimeType){let r=document.createElement("div");r.className="cm-tooltip-cursor-mimetype",r.textContent=t.mimeType,e.appendChild(r)}return{dom:e}}function vc(t,e,a,r=0){for(let s of st(t)){let n=r+s.index,o=n+s[0].length;if(e>=n&&e<=o){let i=s[0].slice(1),l=a.get(i);if(l)return{resource:l,start:n,end:o}}}return null}function _c(t){return eo((e,a)=>{let{from:r,text:s}=e.state.doc.lineAt(a),n=vc(s,a,e.state.field(We),r);return n?{pos:n.start,end:n.end,above:!0,create(){return(t.createTooltip??yc)(n.resource)}}:null})}function bc(t,e){let a=t.field(We),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(st(n));if(o.length===0)return null;for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(e===d&&a.has(u))return{from:l,to:d,uri:u}}return null}function xc(t,e){let a=t.field(We),r=t.doc,s=r.lineAt(e).to,n=r.sliceString(e,s),o=Array.from(st(n));if(o.length===0)return null;let i=o[0];if(!i||i.index!==0)return null;let l=e,d=e+i[0].length,u=i[0].slice(1);return a.has(u)?{from:l,to:d,uri:u}:null}function ei(t,e){let a=t.field(We),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(st(n));for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(e>l&&e<d&&a.has(u))return{from:l,to:d,uri:u}}return null}function wc(t,e){let a=t.field(We),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,e),o=Array.from(st(n)),i=null;for(let l of o){let d=s.from+l.index,u=d+l[0].length,c=l[0].slice(1);a.has(c)&&u<=e&&(e>u?i=u:e===u&&(i=d))}return i}function kc(t,e){let a=t.field(We),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(st(n));for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(a.has(u)&&l>=e){if(e<l)return l;if(e===l)return d}}return null}const Cc=Gi.transactionFilter.of(t=>{var r;let e=t.annotation(Qi.userEvent);if(!e)return t;let a=t.startState.selection.main;if(!a.empty)return t;if(e==="input.type"||e.startsWith("input")){if(t.changes.empty)return t;let s=t.startState.field(We),n=t.startState.doc,o=!1,i=0,l=[];if(t.changes.iterChanges((d,u,c,g,m)=>{let b=m.toString(),f=d;if(/^\s+$/.test(b)){l.push({from:d,to:u,insert:b});return}let p=n.lineAt(f),h=n.sliceString(p.from,p.to),v=Array.from(st(h)),T=!1,w=!1;for(let P of v){let D=p.from+P.index,N=D+P[0].length,K=P[0].slice(1);if(s.has(K)){if(f===D){let j=f>0?n.sliceString(f-1,f):"";j!==""&&j!==" "&&j!==`
76
+ - ${t.additionalInfo}`),e}var Vn,Wt;function Xu(t,e,a,r,s){var n={};return Object.keys(r).forEach(function(o){n[o]=r[o]}),n.enumerable=!!n.enumerable,n.configurable=!!n.configurable,("value"in n||n.initializer)&&(n.writable=!0),n=a.slice().reverse().reduce(function(o,i){return i(t,e,o)||o},n),s&&n.initializer!==void 0&&(n.value=n.initializer?n.initializer.call(s):void 0,n.initializer=void 0),n.initializer===void 0?(Object.defineProperty(t,e,n),null):n}const $r=new(Vn=Oi(),Wt=class{constructor(t=[]){L(this,"tools",new Map);this.tools=new Map(t.map(e=>[e.name,e]))}has(t){return this.tools.has(t)}getToolOrThrow(t){let e=this.tools.get(t);if(!e)throw Error(`Tool ${t} not found`);return e}async invoke(t,e,a){var i;let r=this.getToolOrThrow(t),s=r.handler,n=r.schema,o=r.outputSchema;try{let l=await n.safeParseAsync(e);if(l.error)throw new xe(`Tool ${t} returned invalid input: ${as(l.error)}`,"INVALID_ARGUMENTS",!0,"Please check the arguments and try again.");let d=l.data,u=await s(d,a),c=await o.safeParseAsync(u);if(c.error){let g=as(c.error);throw Error(`Tool ${t} returned invalid output: ${g}`)}return{tool_name:t,result:c.data,error:null}}catch(l){return l instanceof xe?{tool_name:t,result:null,error:l.toStructuredString()}:{tool_name:t,result:null,error:new xe(l instanceof Error?l.message:String(l),"TOOL_ERROR",!1,"Check the error message and try again with valid arguments.",{args:e,errorType:((i=l==null?void 0:l.constructor)==null?void 0:i.name)??typeof l}).toStructuredString()}}}getToolSchemas(t){return[...this.tools.values()].filter(e=>e.mode.includes(t)).map(e=>({name:e.name,description:Qu(e.description),parameters:ss(e.schema),source:"frontend",mode:e.mode}))}},Xu(Wt.prototype,"getToolSchemas",[Vn],Object.getOwnPropertyDescriptor(Wt.prototype,"getToolSchemas"),Wt.prototype),Wt)([new qu,new Gu]);var ec=jt();const Bn=new Set(["openai","google","anthropic"]),tc=["image/*","text/*"];var ac=1024*1024*50;function rc(t){return t.length>50?`${t.slice(0,50)}...`:t}async function qn(t){return await Promise.all(t.map(async e=>({type:"file",mediaType:e.type,filename:e.name,url:await uo(e,"dataUrl")})))}function sc(t){if(t.length===0)return!1;let e=t.at(-1);if(!e||e.role!=="assistant"||!e.parts)return!1;let a=e.parts;return a.length===0?!1:a[a.length-1].type==="reasoning"}function nc(t){return t.map(e=>e.type==="text"?e.text:"").join(`
77
+ `)}async function Wn(t){let e=await Lu({input:nc(t.flatMap(r=>r.parts))});function a(r,s){return s?{...r,parts:[...r.parts,...e.attachments]}:r}return{...e.body,uiMessages:t.map((r,s)=>a(r,s===t.length-1))}}async function Jn({invokeAiTool:t,addToolOutput:e,toolCall:a,toolContext:r}){try{if($r.has(a.toolName)){let s=await $r.invoke(a.toolName,a.input,r);e({tool:a.toolName,toolCallId:a.toolCallId,output:s.result||s.error})}else{let s=await t({toolName:a.toolName,arguments:a.input??{}});e({tool:a.toolName,toolCallId:a.toolCallId,output:s.result||s.error})}}catch(s){ie.error("Tool call failed:",s),e({tool:a.toolName,toolCallId:a.toolCallId,output:`Error: ${s instanceof Error?s.message:String(s)}`})}}function ic(t){var i;if(t.length===0)return!1;let e=t[t.length-1],a=e.parts;if(a.length===0||e.role!=="assistant")return!1;let r=a.filter(l=>l.type.startsWith("tool-"));if(r.length===0)return!1;let s=r.every(l=>l.state==="output-available"),n=a[a.length-1],o=n.type==="text"&&((i=n.text)==null?void 0:i.trim().length)>0;return ie.warn("All tool calls completed: %s",s),s&&!o}function Kn(){let t=(0,ec.c)(7),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];let[a,r]=(0,A.useState)(e),s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=c=>{if(c.length!==0){if(c.reduce(oc,0)>ac){Va({title:"File size exceeded",description:"Attachments must be under 50 MB",variant:"danger"});return}r(g=>[...g,...c])}},t[1]=s):s=t[1];let n=Yr(s),o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=()=>r([]),t[2]=o):o=t[2];let i=o,l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=c=>r(g=>g.filter(m=>m!==c)),t[3]=l):l=t[3];let d=l,u;return t[4]!==n||t[5]!==a?(u={files:a,addFiles:n,clearFiles:i,removeFile:d},t[4]=n,t[5]=a,t[6]=u):u=t[6],u}function oc(t,e){return t+e.size}var Jt=jt(),C=Da(Yi(),1);const lc=t=>{var o;let e=(0,Jt.c)(6),{attachment:a}=t;if((o=a.mediaType)!=null&&o.startsWith("image/")){let i=a.filename||"Attachment",l;return e[0]!==a.url||e[1]!==i?(l=(0,C.jsx)("img",{src:a.url,alt:i,className:"max-h-[100px] max-w-[100px] object-contain mb-1.5"}),e[0]=a.url,e[1]=i,e[2]=l):l=e[2],l}let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,C.jsx)(ps,{className:"h-3 w-3 mt-0.5"}),e[3]=r):r=e[3];let s=a.filename||"Attachment",n;return e[4]===s?n=e[5]:(n=(0,C.jsxs)("div",{className:"flex flex-row gap-1 items-center text-xs",children:[r,s]}),e[4]=s,e[5]=n),n},Yn=t=>{let e=(0,Jt.c)(12),{file:a,className:r,onRemove:s}=t,[n,o]=(0,A.useState)(!1),i;e[0]===r?i=e[1]:(i=Fa("py-1 px-1.5 bg-muted rounded-md cursor-pointer flex flex-row gap-1 items-center text-xs",r),e[0]=r,e[1]=i);let l,d;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>o(!0),d=()=>o(!1),e[2]=l,e[3]=d):(l=e[2],d=e[3]);let u;e[4]!==a||e[5]!==n||e[6]!==s?(u=n?(0,C.jsx)(ds,{className:"h-3 w-3 mt-0.5",onClick:s}):dc(a),e[4]=a,e[5]=n,e[6]=s,e[7]=u):u=e[7];let c;return e[8]!==a.name||e[9]!==i||e[10]!==u?(c=(0,C.jsxs)("div",{className:i,onMouseEnter:l,onMouseLeave:d,children:[u,a.name]}),e[8]=a.name,e[9]=i,e[10]=u,e[11]=c):c=e[11],c},Hn=t=>{let e=(0,Jt.c)(12),{isLoading:a,onStop:r,onSendClick:s,isEmpty:n,showStopLabel:o}=t,i=o===void 0?!1:o,l;e[0]===i?l=e[1]:(l=i?(0,C.jsxs)("div",{className:"flex flex-row items-center gap-1 px-1.5",children:[(0,C.jsx)("span",{className:"text-xs text-error",children:"Stop"}),(0,C.jsx)(vo,{size:"small"})]}):(0,C.jsx)(ms,{className:"size-4 text-error"}),e[0]=i,e[1]=l);let d=l,u=a?"Stop":"Submit",c=a?r:s,g=a?!1:n,m;e[2]!==a||e[3]!==d?(m=a?d:(0,C.jsx)(fs,{className:"h-3.5 w-3.5"}),e[2]=a,e[3]=d,e[4]=m):m=e[4];let b;e[5]!==c||e[6]!==g||e[7]!==m?(b=(0,C.jsx)(Qe,{variant:"text",size:"sm",className:"h-6 min-w-6 p-0 hover:bg-muted/30 cursor-pointer",onClick:c,disabled:g,children:m}),e[5]=c,e[6]=g,e[7]=m,e[8]=b):b=e[8];let f;return e[9]!==u||e[10]!==b?(f=(0,C.jsx)(oa,{content:u,children:b}),e[9]=u,e[10]=b,e[11]=f):f=e[11],f},Gn=t=>{let e=(0,Jt.c)(4),{handleAddContext:a,isLoading:r}=t,s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=(0,C.jsx)(lo,{className:"h-3.5 w-3.5"}),e[0]=s):s=e[0];let n;return e[1]!==a||e[2]!==r?(n=(0,C.jsx)(oa,{content:"Add context",children:(0,C.jsx)(Qe,{variant:"text",size:"icon",onClick:a,disabled:r,children:s})}),e[1]=a,e[2]=r,e[3]=n):n=e[3],n},Qn=t=>{let e=(0,Jt.c)(15),{fileInputRef:a,isLoading:r,onAddFiles:s}=t,n;e[0]===a?n=e[1]:(n=()=>{var g;return(g=a.current)==null?void 0:g.click()},e[0]=a,e[1]=n);let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,C.jsx)(hs,{className:"h-3.5 w-3.5"}),e[2]=o):o=e[2];let i;e[3]!==r||e[4]!==n?(i=(0,C.jsx)(oa,{content:"Attach a file",children:(0,C.jsx)(Qe,{variant:"text",size:"icon",onClick:n,disabled:r,children:o})}),e[3]=r,e[4]=n,e[5]=i):i=e[5];let l;e[6]===s?l=e[7]:(l=g=>{g.target.files&&s([...g.target.files])},e[6]=s,e[7]=l);let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=tc.join(","),e[8]=d):d=e[8];let u;e[9]!==a||e[10]!==l?(u=(0,C.jsx)(bo,{ref:a,type:"file",multiple:!0,hidden:!0,onChange:l,accept:d}),e[9]=a,e[10]=l,e[11]=u):u=e[11];let c;return e[12]!==i||e[13]!==u?(c=(0,C.jsxs)(C.Fragment,{children:[i,u]}),e[12]=i,e[13]=u,e[14]=c):c=e[14],c};function dc(t){let e="h-3 w-3 mt-0.5";return t.type.startsWith("image/")?(0,C.jsx)(yo,{className:e}):t.type.startsWith("text/")?(0,C.jsx)($i,{className:e}):(0,C.jsx)(ps,{className:e})}const Dr=sa.define(),We=ia.define({create(){return new Map},update(t,e){let a=!1,r=t;for(let s of e.effects)if(s.is(Dr)){a||(a=(r=new Map(t),!0));for(let[n,o]of s.value)r.set(n,o)}return r}}),uc=ia.define({create(){return{onResourceClick:void 0,onResourceMouseOver:void 0,onResourceMouseOut:void 0,onPromptSubmit:void 0}},update(t){return t}}),cc=sa.define();ia.define({create(){return new Map},update(t,e){let a=!1,r=t;for(let s of e.effects)if(s.is(cc)){a||(a=(r=new Map(t),!0));for(let[n,o]of s.value)r.set(n,o)}return r}});const pc=(t,e)=>async a=>{let r=a.matchBefore(/@(\w+)?/);if(!r||r.from===r.to&&!a.explicit)return null;let s=await t();if(s.length===0)return null;let n=Dr.of(new Map(s.map(i=>[i.uri,i])));a.view&&a.view.dispatch({effects:n});let o=s.map(i=>({label:`@${i.name}`,displayLabel:i.name,detail:i.uri,info:i.description||void 0,type:i.mimeType?"constant":"variable",boost:i.description?100:0,...e==null?void 0:e(i),apply:(l,d,u,c)=>{l.dispatch({changes:{from:u,to:c,insert:`@${i.uri} `}})}}));return{from:r.from,options:o}},mc=/@[\w-]+:\/\/(?!\/)[^\s]+/;function st(t){return t.matchAll(new RegExp(mc.source,"g"))}var hc=class extends ls{constructor(e,a){super();L(this,"resource");L(this,"view");this.resource=e,this.view=a}eq(e){return e.resource.uri===this.resource.uri}toDOM(){let e=document.createElement("span");e.className="cm-resource-widget",e.textContent=`@${this.resource.name}`;let a=this.view.state.field(uc,!1),r=a==null?void 0:a.onResourceClick,s=a==null?void 0:a.onResourceMouseOver,n=a==null?void 0:a.onResourceMouseOut;return r&&(e.style.cursor="pointer",e.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),r(this.resource)})),s&&e.addEventListener("mouseover",o=>{o.preventDefault(),o.stopPropagation(),s(this.resource)}),n&&e.addEventListener("mouseout",o=>{o.preventDefault(),o.stopPropagation(),n(this.resource)}),e}},fc=class extends ls{constructor(e,a){super();L(this,"uri");L(this,"view");this.uri=e,this.view=a}eq(e){return e.uri===this.uri}toDOM(){let e=document.createElement("span");return e.className="cm-not-found-resource-widget",e.textContent=`@${this.uri.split("://")[1]??this.uri}`,e}};function Xn(t){let e=t.state.field(We),a=[];for(let{from:r,to:s}of t.visibleRanges){let n=t.state.doc.sliceString(r,s);for(let o of st(n)){let i=r+o.index,l=o[0].slice(1),d=e.get(l);d?a.push(za.replace({widget:new hc(d,t)}).range(i,i+o[0].length)):a.push(za.replace({widget:new fc(l,t)}).range(i,i+o[0].length))}}return za.set(a)}const gc=Xi.fromClass(class{constructor(t){L(this,"decorations");this.decorations=Xn(t)}update(t){(t.docChanged||t.viewportChanged||t.transactions.some(e=>e.effects.some(a=>a.is(Dr))))&&(this.decorations=Xn(t.view))}},{decorations:t=>t.decorations});function yc(t){let e=document.createElement("div");e.className="cm-tooltip-cursor";let a=document.createElement("div");if(a.className="cm-tooltip-cursor-title",a.textContent=`${t.name} (${t.uri})`,e.appendChild(a),t.description){let r=document.createElement("div");r.className="cm-tooltip-cursor-description",r.textContent=t.description,e.appendChild(r)}if(t.mimeType){let r=document.createElement("div");r.className="cm-tooltip-cursor-mimetype",r.textContent=t.mimeType,e.appendChild(r)}return{dom:e}}function vc(t,e,a,r=0){for(let s of st(t)){let n=r+s.index,o=n+s[0].length;if(e>=n&&e<=o){let i=s[0].slice(1),l=a.get(i);if(l)return{resource:l,start:n,end:o}}}return null}function _c(t){return eo((e,a)=>{let{from:r,text:s}=e.state.doc.lineAt(a),n=vc(s,a,e.state.field(We),r);return n?{pos:n.start,end:n.end,above:!0,create(){return(t.createTooltip??yc)(n.resource)}}:null})}function bc(t,e){let a=t.field(We),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(st(n));if(o.length===0)return null;for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(e===d&&a.has(u))return{from:l,to:d,uri:u}}return null}function xc(t,e){let a=t.field(We),r=t.doc,s=r.lineAt(e).to,n=r.sliceString(e,s),o=Array.from(st(n));if(o.length===0)return null;let i=o[0];if(!i||i.index!==0)return null;let l=e,d=e+i[0].length,u=i[0].slice(1);return a.has(u)?{from:l,to:d,uri:u}:null}function ei(t,e){let a=t.field(We),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(st(n));for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(e>l&&e<d&&a.has(u))return{from:l,to:d,uri:u}}return null}function wc(t,e){let a=t.field(We),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,e),o=Array.from(st(n)),i=null;for(let l of o){let d=s.from+l.index,u=d+l[0].length,c=l[0].slice(1);a.has(c)&&u<=e&&(e>u?i=u:e===u&&(i=d))}return i}function kc(t,e){let a=t.field(We),r=t.doc,s=r.lineAt(e),n=r.sliceString(s.from,s.to),o=Array.from(st(n));for(let i of o){let l=s.from+i.index,d=l+i[0].length,u=i[0].slice(1);if(a.has(u)&&l>=e){if(e<l)return l;if(e===l)return d}}return null}const Cc=Gi.transactionFilter.of(t=>{var r;let e=t.annotation(Qi.userEvent);if(!e)return t;let a=t.startState.selection.main;if(!a.empty)return t;if(e==="input.type"||e.startsWith("input")){if(t.changes.empty)return t;let s=t.startState.field(We),n=t.startState.doc,o=!1,i=0,l=[];if(t.changes.iterChanges((d,u,c,g,m)=>{let b=m.toString(),f=d;if(/^\s+$/.test(b)){l.push({from:d,to:u,insert:b});return}let p=n.lineAt(f),h=n.sliceString(p.from,p.to),v=Array.from(st(h)),T=!1,w=!1;for(let P of v){let D=p.from+P.index,N=D+P[0].length,K=P[0].slice(1);if(s.has(K)){if(f===D){let j=f>0?n.sliceString(f-1,f):"";j!==""&&j!==" "&&j!==`
78
78
  `&&j!==" "&&(T=!0)}if(f===N){let j=f<n.length?n.sliceString(f,f+1):"";(j===""||j!==" "&&j!==`
79
79
  `&&j!==" ")&&(w=!0)}}}let S=b;T&&(S=` ${S}`,i+=1),w&&(S=` ${S}`,i+=1),S!==b&&(o=!0),l.push({from:d,to:u,insert:S})}),o)return[{changes:l,selection:t.selection?{anchor:t.selection.main.anchor+i,head:t.selection.main.head+i}:void 0,scrollIntoView:t.scrollIntoView}]}if(e==="delete.backward"||e==="delete.forward"){let s=null;return e==="delete.backward"?s=bc(t.startState,a.head):e==="delete.forward"&&(s=xc(t.startState,a.head)),s?[{changes:{from:s.from,to:s.to,insert:""},selection:{anchor:s.from},scrollIntoView:!0}]:t}if((r=t.selection)!=null&&r.main.empty&&a.empty&&!e.startsWith("input")&&e!=="input.type"){let s=a.head,n=t.selection.main.head,o=null;if(n<s){let i=ei(t.startState,s);o=i&&s>i.from?i.from:wc(t.startState,s)}else if(n>s){let i=ei(t.startState,s);o=i&&s<i.to?i.to:kc(t.startState,s)}if(o!==null&&o!==n)return[{selection:{anchor:o},scrollIntoView:!0}]}return t}),Ec=os.baseTheme({".cm-resource-widget":{background:"light-dark(rgba(86,156,214,0.08),rgba(86,156,214,0.18))",borderRadius:"4px",padding:"2px 4px",color:"light-dark(#2367a2,#7ecbff)",fontWeight:"500"},".cm-resource-widget:hover":{background:"light-dark(rgba(86,156,214,0.18),rgba(86,156,214,0.28))"},".cm-not-found-resource-widget":{background:"light-dark(rgba(151,151,151,0.08),rgba(151,151,151,0.18))",borderRadius:"4px",padding:"2px 4px",color:"light-dark(#b00020,#ff8080)",fontWeight:"500"}});var ti="_none_",Tc=[{uri:"",name:"No resources",type:ti,data:{}}],Ic={info:"Variables, dataframes, and tables will appear here.",apply:()=>{}};function Sc(t){let{language:e,store:a,onAddFiles:r}=t;return[e.data.of({autocomplete:pc(async()=>{let s=pt(a).getAllItems();return s.length===0?Tc:s},s=>{var n;return s.type===ti?Ic:((n=pt(a).getProvider(s.type))==null?void 0:n.formatCompletion(s))||{}})}),is.high(na.of([{key:"Tab",run:s=>ro(s)}])),Ln.of({addAttachment:s=>r==null?void 0:r([s])}),...r?[e.data.of({autocomplete:ju().createCompletionSource()})]:[],gc,Cc,We.init(()=>{let s=pt(a).getAllItems();return new Map(s.map(n=>[n.uri,n]))}),Ec,_c({createTooltip:s=>{let n=pt(a).getProvider(s.type);if(!n)return ie.warn("No provider found for resource",s),Kt(s.description||s.name);let o=n.formatCompletion(s),i=s.description||s.name;if(!(o!=null&&o.info))return Kt(i);if(typeof o.info=="string")return Kt(o.info);let l=o.info(o);return l?"dom"in l?{dom:l.dom}:"then"in l?(ie.warn("info is a promise. This is not supported",l),Kt(i)):{dom:l}:Kt(i)}})]}function Kt(t){let e=document.createElement("div");return e.innerHTML=t,{dom:e}}var Zr=jt();const ai=t=>{let{handleAcceptCompletion:e,handleDeclineCompletion:a,isLoading:r,hasCompletion:s}=t;return n=>{let o=Wi()?n.metaKey:n.ctrlKey;o&&n.key==="Enter"&&!r&&s&&e(),(n.key==="Delete"||n.key==="Backspace")&&o&&n.shiftKey&&(a(),n.preventDefault(),n.stopPropagation())}},Ac=t=>{let e=(0,Zr.c)(9),{isLoading:a,onAccept:r,onDecline:s,runCell:n}=t,o;e[0]!==a||e[1]!==r||e[2]!==n?(o=(0,C.jsx)(ri,{isLoading:a,onAccept:r,size:"xs",runCell:n}),e[0]=a,e[1]=r,e[2]=n,e[3]=o):o=e[3];let i;e[4]===s?i=e[5]:(i=(0,C.jsx)(si,{onDecline:s,size:"xs"}),e[4]=s,e[5]=i);let l;return e[6]!==o||e[7]!==i?(l=(0,C.jsxs)(C.Fragment,{children:[o,i]}),e[6]=o,e[7]=i,e[8]=l):l=e[8],l},ri=t=>{let e=(0,Zr.c)(33),{isLoading:a,onAccept:r,multipleCompletions:s,size:n,buttonStyles:o,acceptShortcut:i,runCell:l,playButtonStyles:d,borderless:u}=t,c=s===void 0?!1:s,g=n===void 0?"sm":n,m=u===void 0?!1:u,b;e[0]!==r||e[1]!==l?(b=()=>{r(),l&&l()},e[0]=r,e[1]=l,e[2]=b):b=e[2];let f=b,p=c?"Accept all":"Accept";if(l){let w=`h-6 text-(--grass-11) bg-(--grass-3)/60
80
80
  hover:bg-(--grass-3) dark:bg-(--grass-4)/80 dark:hover:bg-(--grass-3) font-semibold
@@ -88,5 +88,5 @@ ${this.truncateString(o,n)}`}truncateString(t,e){return t.length<=e?t:`${t.slice
88
88
  border-(--green-6) border hover:shadow-xs rounded px-3 ${o}`,v;e[24]===i?v=e[25]:(v=i&&(0,C.jsx)(qa,{className:"ml-1 inline",shortcut:i}),e[24]=i,e[25]=v);let T;return e[26]!==a||e[27]!==r||e[28]!==g||e[29]!==h||e[30]!==v||e[31]!==p?(T=(0,C.jsxs)(Qe,{variant:"text",size:g,disabled:a,onClick:r,className:h,children:[p,v]}),e[26]=a,e[27]=r,e[28]=g,e[29]=h,e[30]=v,e[31]=p,e[32]=T):T=e[32],T},si=t=>{let e=(0,Zr.c)(8),{onDecline:a,multipleCompletions:r,size:s,className:n,declineShortcut:o,borderless:i}=t,l=r===void 0?!1:r,d=s===void 0?"sm":s,u=`h-6 text-(--red-10) bg-(--red-3)/60 hover:bg-(--red-3)
89
89
  dark:bg-(--red-4)/80 dark:hover:bg-(--red-3) rounded px-3 font-semibold
90
90
  active:bg-(--red-5) dark:active:bg-(--red-4)
91
- border-(--red-6) border hover:shadow-xs ${(i===void 0?!1:i)&&"border-none rounded-md"} ${n}`,c=l&&" all",g;e[0]===o?g=e[1]:(g=o&&(0,C.jsx)(qa,{className:"ml-1 inline",shortcut:o}),e[0]=o,e[1]=g);let m;return e[2]!==a||e[3]!==d||e[4]!==u||e[5]!==c||e[6]!==g?(m=(0,C.jsxs)(Qe,{variant:"text",size:d,onClick:a,className:u,children:["Reject",c,g]}),e[2]=a,e[3]=d,e[4]=u,e[5]=c,e[6]=g,e[7]=m):m=e[7],m};var Oc=class extends gr{constructor(t,e){super(t),this.onChunkReceived=e}processResponseStream(t){let e=this.onChunkReceived;return super.processResponseStream(t).pipeThrough(new TransformStream({async transform(a,r){e(a),r.enqueue(a)}}))}},ni=jt(),Rc=ji("marimo:ai-language","python",Si),ii="marimo:ai-prompt-history",oi=new Mi(ze(E()),()=>[]);const Nc=t=>{var Wr;let e=(0,ni.c)(95),{onClose:a}=t,r=Jr(),[s,n]=(0,A.useState)(""),{deleteAllStagedCells:o,clearStagedCells:i,onStream:l,addStagedCell:d}=Fn(r),[u,c]=bi(Rc),g=Ki(),{invokeAiTool:m,sendRun:b}=io(),f=Hr(qt),p=(0,A.useRef)(null),h=(0,A.useRef)(null),{files:v,addFiles:T,removeFile:w}=Kn(),S=Hr(Ji),{createNewCell:P,prepareForRun:D}=Gr(),N;e[0]!==d||e[1]!==P||e[2]!==D||e[3]!==b||e[4]!==r?(N={store:r,addStagedCell:d,createNewCell:P,prepareForRun:D,sendRun:b},e[0]=d,e[1]=P,e[2]=D,e[3]=b,e[4]=r,e[5]=N):N=e[5];let K=N,j;if(e[6]!==u||e[7]!==l||e[8]!==g){let de;e[10]===u?de=e[11]:(de=async ta=>{let gi=await Wn(ta.messages);return{body:{...ta,...gi,code:"",prompt:"",language:u}}},e[10]=u,e[11]=de);let Ne;e[12]===l?Ne=e[13]:(Ne=ta=>{l(ta)},e[12]=l,e[13]=Ne),j=new Oc({api:g.getAiURL("completion").toString(),headers:g.headers(),prepareSendMessagesRequest:de},Ne),e[6]=u,e[7]=l,e[8]=g,e[9]=j}else j=e[9];let{sendMessage:W,stop:X,status:te,addToolOutput:ae}=An({experimental_throttle:100,transport:j,onToolCall:async de=>{let{toolCall:Ne}=de;await Jn({invokeAiTool:m,addToolOutput:G,toolCall:{toolName:Ne.toolName,toolCallId:Ne.toolCallId,input:Ne.input},toolContext:K})},onError:jc}),G=ae,Z=te==="streaming"||te==="submitted",oe=f.size>0,ee=((Wr=S==null?void 0:S.models)==null?void 0:Wr.edit_model)||"openai/gpt-4o",Le;if(e[14]!==ee){let de=qi.parse(ee).providerId;Le=Bn.has(de),e[14]=ee,e[15]=Le}else Le=e[15];let Oe=Le,we;e[16]!==o||e[17]!==v||e[18]!==s||e[19]!==Z||e[20]!==W?(we=async()=>{var de;Z||((de=p.current)!=null&&de.view&&Rn(p.current.view),o(),W({text:s,files:v?await qn(v):void 0}))},e[16]=o,e[17]=v,e[18]=s,e[19]=Z,e[20]=W,e[21]=we):we=e[21];let he=we,$e;e[22]===Symbol.for("react.memo_cache_sentinel")?($e=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(No,{className:"size-4 mr-2"}),"Python"]}),e[22]=$e):$e=e[22];let mt=$e,De;e[23]===Symbol.for("react.memo_cache_sentinel")?(De=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Li,{className:"size-4 mr-2"}),"SQL"]}),e[23]=De):De=e[23];let Rt=De,ht=u==="python"?mt:Rt,ft;e[24]===Symbol.for("react.memo_cache_sentinel")?(ft=(0,C.jsx)(co,{className:"ml-1 h-3.5 w-3.5 text-muted-foreground/70"}),e[24]=ft):ft=e[24];let Je;e[25]===ht?Je=e[26]:(Je=(0,C.jsxs)(ho,{className:"flex items-center justify-between h-7 text-xs px-2 py-0.5 border rounded-md hover:text-accent-foreground","data-testid":"language-button",children:[ht,ft]}),e[25]=ht,e[26]=Je);let Re,nt;e[27]===Symbol.for("react.memo_cache_sentinel")?(Re=(0,C.jsx)("div",{className:"px-2 py-1 text-sm text-muted-foreground",children:"Select language"}),nt=(0,C.jsx)(mo,{}),e[27]=Re,e[28]=nt):(Re=e[27],nt=e[28]);let U;e[29]===c?U=e[30]:(U=(0,C.jsx)(cs,{onClick:()=>c("python"),children:mt}),e[29]=c,e[30]=U);let V;e[31]===c?V=e[32]:(V=(0,C.jsx)(cs,{onClick:()=>c("sql"),children:Rt}),e[31]=c,e[32]=V);let Y;e[33]!==U||e[34]!==V?(Y=(0,C.jsxs)(fo,{align:"center",children:[Re,nt,U,V]}),e[33]=U,e[34]=V,e[35]=Y):Y=e[35];let B;e[36]!==Je||e[37]!==Y?(B=(0,C.jsxs)(go,{modal:!1,children:[Je,Y]}),e[36]=Je,e[37]=Y,e[38]=B):B=e[38];let ke=B,ve;e[39]!==i||e[40]!==a?(ve=()=>{i(),a()},e[39]=i,e[40]=a,e[41]=ve):ve=e[41];let le=ve,se;e[42]===o?se=e[43]:(se=()=>{o()},e[42]=o,e[43]=se);let _e=se,it;e[44]===Symbol.for("react.memo_cache_sentinel")?(it=(0,C.jsx)(xo,{className:"size-4 text-(--blue-11) mr-2"}),e[44]=it):it=e[44];let Ze;e[45]!==o||e[46]!==a?(Ze=()=>{o(),a()},e[45]=o,e[46]=a,e[47]=Ze):Ze=e[47];let ot;e[48]===Symbol.for("react.memo_cache_sentinel")?(ot=de=>{n(de)},e[48]=ot):ot=e[48];let ne;e[49]!==le||e[50]!==_e||e[51]!==oe||e[52]!==Z?(ne=ai({handleAcceptCompletion:le,handleDeclineCompletion:_e,isLoading:Z,hasCompletion:oe}),e[49]=le,e[50]=_e,e[51]=oe,e[52]=Z,e[53]=ne):ne=e[53];let ue;e[54]!==s||e[55]!==he||e[56]!==Ze||e[57]!==ne?(ue=(0,C.jsx)(li,{inputRef:p,onClose:Ze,value:s,onChange:ot,onSubmit:he,onKeyDown:ne}),e[54]=s,e[55]=he,e[56]=Ze,e[57]=ne,e[58]=ue):ue=e[58];let Ke;e[59]===Symbol.for("react.memo_cache_sentinel")?(Ke=(0,C.jsx)(ds,{className:"size-4"}),e[59]=Ke):Ke=e[59];let Ye;e[60]===a?Ye=e[61]:(Ye=(0,C.jsx)(Qe,{variant:"text",size:"sm",className:"mb-0 px-1",onClick:a,children:Ke}),e[60]=a,e[61]=Ye);let He;e[62]!==ue||e[63]!==Ye?(He=(0,C.jsxs)("div",{className:"flex items-center px-3",children:[it,ue,Ye]}),e[62]=ue,e[63]=Ye,e[64]=He):He=e[64];let Pa=He,Ht;e[65]===Symbol.for("react.memo_cache_sentinel")?(Ht=(0,C.jsx)(Bi,{triggerClassName:"h-7 text-xs max-w-64",iconSize:"small",forRole:"edit",showAddCustomModelDocs:!0}),e[65]=Ht):Ht=e[65];let gt;e[66]===ke?gt=e[67]:(gt=(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[Ht,ke]}),e[66]=ke,e[67]=gt);let yt;e[68]!==v||e[69]!==w?(yt=v.length>0&&(0,C.jsx)("div",{className:"flex flex-row gap-1 flex-wrap pr-1",children:v==null?void 0:v.map((de,Ne)=>(0,C.jsx)(Yn,{file:de,onRemove:()=>w(de)},`${de.name}-${Ne}`))}),e[68]=v,e[69]=w,e[70]=yt):yt=e[70];let Gt;e[71]===Symbol.for("react.memo_cache_sentinel")?(Gt=()=>$n(p),e[71]=Gt):Gt=e[71];let vt;e[72]===Z?vt=e[73]:(vt=(0,C.jsx)(Gn,{handleAddContext:Gt,isLoading:Z}),e[72]=Z,e[73]=vt);let _t;e[74]!==T||e[75]!==Oe||e[76]!==Z?(_t=Oe&&(0,C.jsx)(Qn,{fileInputRef:h,isLoading:Z,onAddFiles:T}),e[74]=T,e[75]=Oe,e[76]=Z,e[77]=_t):_t=e[77];let La=!s.trim(),bt;e[78]!==Z||e[79]!==X||e[80]!==he||e[81]!==La?(bt=(0,C.jsx)(Hn,{isLoading:Z,onStop:X,onSendClick:he,isEmpty:La,showStopLabel:!0}),e[78]=Z,e[79]=X,e[80]=he,e[81]=La,e[82]=bt):bt=e[82];let xt;e[83]!==yt||e[84]!==vt||e[85]!==_t||e[86]!==bt?(xt=(0,C.jsxs)("div",{className:"flex flex-row items-center",children:[yt,vt,_t,bt]}),e[83]=yt,e[84]=vt,e[85]=_t,e[86]=bt,e[87]=xt):xt=e[87];let Qt;e[88]!==gt||e[89]!==xt?(Qt=(0,C.jsxs)("div",{className:"px-3 pt-1 flex flex-row items-center justify-between",children:[gt,xt]}),e[88]=gt,e[89]=xt,e[90]=Qt):Qt=e[90];let $a=Qt,Xt;e[91]===Symbol.for("react.memo_cache_sentinel")?(Xt=Fa("flex flex-col w-full py-2"),e[91]=Xt):Xt=e[91];let ea;return e[92]!==$a||e[93]!==Pa?(ea=(0,C.jsxs)("div",{className:Xt,children:[Pa,$a]}),e[92]=$a,e[93]=Pa,e[94]=ea):ea=e[94],ea},li=t=>{let e=(0,ni.c)(35),{value:a,placeholder:r,inputRef:s,className:n,onChange:o,onSubmit:i,onKeyDown:l,onClose:d,onAddFiles:u,additionalCompletions:c,maxHeight:g}=t,m=i,b=d,f=Jr(),{theme:p}=Eo(),h;e[0]===c?h=e[1]:(h=oe=>c?Du([c.triggerCompletionRegex],c.completions)(oe):null,e[0]=c,e[1]=h);let v=Yr(h),T,w,S,P;if(e[2]!==v||e[3]!==u||e[4]!==f){let oe=Co();e[9]===Symbol.for("react.memo_cache_sentinel")?(T=no({}),e[9]=T):T=e[9],w=oe,S=Sc({language:oe.language,store:f,onAddFiles:u}),P=oe.language.data.of({autocomplete:v}),e[2]=v,e[3]=u,e[4]=f,e[5]=T,e[6]=w,e[7]=S,e[8]=P}else T=e[5],w=e[6],S=e[7],P=e[8];let D;e[10]===Symbol.for("react.memo_cache_sentinel")?(D=ku({storage:{load:Mc,save:Pc}}),e[10]=D):D=e[10];let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N=jo(),e[11]=N):N=e[11];let K;e[12]===m?K=e[13]:(K=is.highest(na.of([{preventDefault:!0,stopPropagation:!0,any:(oe,ee)=>{let Le=ee.metaKey||ee.ctrlKey||ee.shiftKey;if(ee.key==="Enter"&&!Le)return m(ee,oe.state.doc.toString()),ee.preventDefault(),ee.stopPropagation(),!0;if(ee.key==="Enter"&&ee.shiftKey){let Oe=oe.state.selection.main.from;return oe.dispatch({changes:{from:Oe,to:Oe,insert:`
91
+ border-(--red-6) border hover:shadow-xs ${(i===void 0?!1:i)&&"border-none rounded-md"} ${n}`,c=l&&" all",g;e[0]===o?g=e[1]:(g=o&&(0,C.jsx)(qa,{className:"ml-1 inline",shortcut:o}),e[0]=o,e[1]=g);let m;return e[2]!==a||e[3]!==d||e[4]!==u||e[5]!==c||e[6]!==g?(m=(0,C.jsxs)(Qe,{variant:"text",size:d,onClick:a,className:u,children:["Reject",c,g]}),e[2]=a,e[3]=d,e[4]=u,e[5]=c,e[6]=g,e[7]=m):m=e[7],m};var Oc=class extends gr{constructor(t,e){super(t),this.onChunkReceived=e}processResponseStream(t){let e=this.onChunkReceived;return super.processResponseStream(t).pipeThrough(new TransformStream({async transform(a,r){e(a),r.enqueue(a)}}))}},ni=jt(),Rc=Zi("marimo:ai-language","python",Ei),ii="marimo:ai-prompt-history",oi=new Di(ze(E()),()=>[]);const Nc=t=>{var Wr;let e=(0,ni.c)(95),{onClose:a}=t,r=Jr(),[s,n]=(0,A.useState)(""),{deleteAllStagedCells:o,clearStagedCells:i,onStream:l,addStagedCell:d}=Fn(r),[u,c]=bi(Rc),g=Ki(),{invokeAiTool:m,sendRun:b}=io(),f=Hr(qt),p=(0,A.useRef)(null),h=(0,A.useRef)(null),{files:v,addFiles:T,removeFile:w}=Kn(),S=Hr(Ji),{createNewCell:P,prepareForRun:D}=Qr(),N;e[0]!==d||e[1]!==P||e[2]!==D||e[3]!==b||e[4]!==r?(N={store:r,addStagedCell:d,createNewCell:P,prepareForRun:D,sendRun:b},e[0]=d,e[1]=P,e[2]=D,e[3]=b,e[4]=r,e[5]=N):N=e[5];let K=N,j;if(e[6]!==u||e[7]!==l||e[8]!==g){let de;e[10]===u?de=e[11]:(de=async ta=>{let gi=await Wn(ta.messages);return{body:{...ta,...gi,code:"",prompt:"",language:u}}},e[10]=u,e[11]=de);let Ne;e[12]===l?Ne=e[13]:(Ne=ta=>{l(ta)},e[12]=l,e[13]=Ne),j=new Oc({api:g.getAiURL("completion").toString(),headers:g.headers(),prepareSendMessagesRequest:de},Ne),e[6]=u,e[7]=l,e[8]=g,e[9]=j}else j=e[9];let{sendMessage:W,stop:X,status:te,addToolOutput:ae}=An({experimental_throttle:100,transport:j,onToolCall:async de=>{let{toolCall:Ne}=de;await Jn({invokeAiTool:m,addToolOutput:G,toolCall:{toolName:Ne.toolName,toolCallId:Ne.toolCallId,input:Ne.input},toolContext:K})},onError:jc}),G=ae,Z=te==="streaming"||te==="submitted",oe=f.size>0,ee=((Wr=S==null?void 0:S.models)==null?void 0:Wr.edit_model)||"openai/gpt-4o",Le;if(e[14]!==ee){let de=qi.parse(ee).providerId;Le=Bn.has(de),e[14]=ee,e[15]=Le}else Le=e[15];let Oe=Le,we;e[16]!==o||e[17]!==v||e[18]!==s||e[19]!==Z||e[20]!==W?(we=async()=>{var de;Z||((de=p.current)!=null&&de.view&&Rn(p.current.view),o(),W({text:s,files:v?await qn(v):void 0}))},e[16]=o,e[17]=v,e[18]=s,e[19]=Z,e[20]=W,e[21]=we):we=e[21];let he=we,$e;e[22]===Symbol.for("react.memo_cache_sentinel")?($e=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(No,{className:"size-4 mr-2"}),"Python"]}),e[22]=$e):$e=e[22];let mt=$e,De;e[23]===Symbol.for("react.memo_cache_sentinel")?(De=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Mi,{className:"size-4 mr-2"}),"SQL"]}),e[23]=De):De=e[23];let Rt=De,ht=u==="python"?mt:Rt,ft;e[24]===Symbol.for("react.memo_cache_sentinel")?(ft=(0,C.jsx)(co,{className:"ml-1 h-3.5 w-3.5 text-muted-foreground/70"}),e[24]=ft):ft=e[24];let Je;e[25]===ht?Je=e[26]:(Je=(0,C.jsxs)(ho,{className:"flex items-center justify-between h-7 text-xs px-2 py-0.5 border rounded-md hover:text-accent-foreground","data-testid":"language-button",children:[ht,ft]}),e[25]=ht,e[26]=Je);let Re,nt;e[27]===Symbol.for("react.memo_cache_sentinel")?(Re=(0,C.jsx)("div",{className:"px-2 py-1 text-sm text-muted-foreground",children:"Select language"}),nt=(0,C.jsx)(mo,{}),e[27]=Re,e[28]=nt):(Re=e[27],nt=e[28]);let U;e[29]===c?U=e[30]:(U=(0,C.jsx)(cs,{onClick:()=>c("python"),children:mt}),e[29]=c,e[30]=U);let V;e[31]===c?V=e[32]:(V=(0,C.jsx)(cs,{onClick:()=>c("sql"),children:Rt}),e[31]=c,e[32]=V);let Y;e[33]!==U||e[34]!==V?(Y=(0,C.jsxs)(fo,{align:"center",children:[Re,nt,U,V]}),e[33]=U,e[34]=V,e[35]=Y):Y=e[35];let B;e[36]!==Je||e[37]!==Y?(B=(0,C.jsxs)(go,{modal:!1,children:[Je,Y]}),e[36]=Je,e[37]=Y,e[38]=B):B=e[38];let ke=B,ve;e[39]!==i||e[40]!==a?(ve=()=>{i(),a()},e[39]=i,e[40]=a,e[41]=ve):ve=e[41];let le=ve,se;e[42]===o?se=e[43]:(se=()=>{o()},e[42]=o,e[43]=se);let _e=se,it;e[44]===Symbol.for("react.memo_cache_sentinel")?(it=(0,C.jsx)(xo,{className:"size-4 text-(--blue-11) mr-2"}),e[44]=it):it=e[44];let Ze;e[45]!==o||e[46]!==a?(Ze=()=>{o(),a()},e[45]=o,e[46]=a,e[47]=Ze):Ze=e[47];let ot;e[48]===Symbol.for("react.memo_cache_sentinel")?(ot=de=>{n(de)},e[48]=ot):ot=e[48];let ne;e[49]!==le||e[50]!==_e||e[51]!==oe||e[52]!==Z?(ne=ai({handleAcceptCompletion:le,handleDeclineCompletion:_e,isLoading:Z,hasCompletion:oe}),e[49]=le,e[50]=_e,e[51]=oe,e[52]=Z,e[53]=ne):ne=e[53];let ue;e[54]!==s||e[55]!==he||e[56]!==Ze||e[57]!==ne?(ue=(0,C.jsx)(li,{inputRef:p,onClose:Ze,value:s,onChange:ot,onSubmit:he,onKeyDown:ne}),e[54]=s,e[55]=he,e[56]=Ze,e[57]=ne,e[58]=ue):ue=e[58];let Ke;e[59]===Symbol.for("react.memo_cache_sentinel")?(Ke=(0,C.jsx)(ds,{className:"size-4"}),e[59]=Ke):Ke=e[59];let Ye;e[60]===a?Ye=e[61]:(Ye=(0,C.jsx)(Qe,{variant:"text",size:"sm",className:"mb-0 px-1",onClick:a,children:Ke}),e[60]=a,e[61]=Ye);let He;e[62]!==ue||e[63]!==Ye?(He=(0,C.jsxs)("div",{className:"flex items-center px-3",children:[it,ue,Ye]}),e[62]=ue,e[63]=Ye,e[64]=He):He=e[64];let Pa=He,Ht;e[65]===Symbol.for("react.memo_cache_sentinel")?(Ht=(0,C.jsx)(Bi,{triggerClassName:"h-7 text-xs max-w-64",iconSize:"small",forRole:"edit",showAddCustomModelDocs:!0}),e[65]=Ht):Ht=e[65];let gt;e[66]===ke?gt=e[67]:(gt=(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[Ht,ke]}),e[66]=ke,e[67]=gt);let yt;e[68]!==v||e[69]!==w?(yt=v.length>0&&(0,C.jsx)("div",{className:"flex flex-row gap-1 flex-wrap pr-1",children:v==null?void 0:v.map((de,Ne)=>(0,C.jsx)(Yn,{file:de,onRemove:()=>w(de)},`${de.name}-${Ne}`))}),e[68]=v,e[69]=w,e[70]=yt):yt=e[70];let Gt;e[71]===Symbol.for("react.memo_cache_sentinel")?(Gt=()=>$n(p),e[71]=Gt):Gt=e[71];let vt;e[72]===Z?vt=e[73]:(vt=(0,C.jsx)(Gn,{handleAddContext:Gt,isLoading:Z}),e[72]=Z,e[73]=vt);let _t;e[74]!==T||e[75]!==Oe||e[76]!==Z?(_t=Oe&&(0,C.jsx)(Qn,{fileInputRef:h,isLoading:Z,onAddFiles:T}),e[74]=T,e[75]=Oe,e[76]=Z,e[77]=_t):_t=e[77];let La=!s.trim(),bt;e[78]!==Z||e[79]!==X||e[80]!==he||e[81]!==La?(bt=(0,C.jsx)(Hn,{isLoading:Z,onStop:X,onSendClick:he,isEmpty:La,showStopLabel:!0}),e[78]=Z,e[79]=X,e[80]=he,e[81]=La,e[82]=bt):bt=e[82];let xt;e[83]!==yt||e[84]!==vt||e[85]!==_t||e[86]!==bt?(xt=(0,C.jsxs)("div",{className:"flex flex-row items-center",children:[yt,vt,_t,bt]}),e[83]=yt,e[84]=vt,e[85]=_t,e[86]=bt,e[87]=xt):xt=e[87];let Qt;e[88]!==gt||e[89]!==xt?(Qt=(0,C.jsxs)("div",{className:"px-3 pt-1 flex flex-row items-center justify-between",children:[gt,xt]}),e[88]=gt,e[89]=xt,e[90]=Qt):Qt=e[90];let $a=Qt,Xt;e[91]===Symbol.for("react.memo_cache_sentinel")?(Xt=Fa("flex flex-col w-full py-2"),e[91]=Xt):Xt=e[91];let ea;return e[92]!==$a||e[93]!==Pa?(ea=(0,C.jsxs)("div",{className:Xt,children:[Pa,$a]}),e[92]=$a,e[93]=Pa,e[94]=ea):ea=e[94],ea},li=t=>{let e=(0,ni.c)(35),{value:a,placeholder:r,inputRef:s,className:n,onChange:o,onSubmit:i,onKeyDown:l,onClose:d,onAddFiles:u,additionalCompletions:c,maxHeight:g}=t,m=i,b=d,f=Jr(),{theme:p}=Eo(),h;e[0]===c?h=e[1]:(h=oe=>c?Du([c.triggerCompletionRegex],c.completions)(oe):null,e[0]=c,e[1]=h);let v=Yr(h),T,w,S,P;if(e[2]!==v||e[3]!==u||e[4]!==f){let oe=Co();e[9]===Symbol.for("react.memo_cache_sentinel")?(T=no({}),e[9]=T):T=e[9],w=oe,S=Sc({language:oe.language,store:f,onAddFiles:u}),P=oe.language.data.of({autocomplete:v}),e[2]=v,e[3]=u,e[4]=f,e[5]=T,e[6]=w,e[7]=S,e[8]=P}else T=e[5],w=e[6],S=e[7],P=e[8];let D;e[10]===Symbol.for("react.memo_cache_sentinel")?(D=ku({storage:{load:Mc,save:Pc}}),e[10]=D):D=e[10];let N;e[11]===Symbol.for("react.memo_cache_sentinel")?(N=jo(),e[11]=N):N=e[11];let K;e[12]===m?K=e[13]:(K=is.highest(na.of([{preventDefault:!0,stopPropagation:!0,any:(oe,ee)=>{let Le=ee.metaKey||ee.ctrlKey||ee.shiftKey;if(ee.key==="Enter"&&!Le)return m(ee,oe.state.doc.toString()),ee.preventDefault(),ee.stopPropagation(),!0;if(ee.key==="Enter"&&ee.shiftKey){let Oe=oe.state.selection.main.from;return oe.dispatch({changes:{from:Oe,to:Oe,insert:`
92
92
  `},selection:{anchor:Oe+1,head:Oe+1}}),ee.preventDefault(),ee.stopPropagation(),!0}return!1}}])),e[12]=m,e[13]=K);let j;e[14]===b?j=e[15]:(j=na.of([{key:"Escape",preventDefault:!0,stopPropagation:!0,run:()=>(b(),!0)}]),e[14]=b,e[15]=j);let W;e[16]!==T||e[17]!==w||e[18]!==S||e[19]!==P||e[20]!==K||e[21]!==j?(W=[T,w,S,P,D,os.lineWrapping,N,K,j],e[16]=T,e[17]=w,e[18]=S,e[19]=P,e[20]=K,e[21]=j,e[22]=W):W=e[22];let X=W,te;e[23]===n?te=e[24]:(te=Fa("flex-1 font-sans overflow-auto my-1",n),e[23]=n,e[24]=te);let ae=p==="dark"?"dark":"light",G=r||"Generate with AI, @ to include context",Z;return e[25]!==X||e[26]!==s||e[27]!==g||e[28]!==o||e[29]!==l||e[30]!==te||e[31]!==ae||e[32]!==G||e[33]!==a?(Z=(0,C.jsx)(Mo,{ref:s,className:te,width:"100%",maxHeight:g,value:a,basicSetup:!1,extensions:X,onChange:o,onKeyDown:l,theme:ae,placeholder:G}),e[25]=X,e[26]=s,e[27]=g,e[28]=o,e[29]=l,e[30]=te,e[31]=ae,e[32]=G,e[33]=a,e[34]=Z):Z=e[34],Z};function jc(t){Va({title:"Generate with AI failed",description:Io(t)})}function Mc(){return oi.get(ii)}function Pc(t){return oi.set(ii,t)}export{vu as A,Fn as C,pt as D,Pu as E,ms as F,Ad as M,fs as N,Rn as O,hs as P,Zn as S,$n as T,ic as _,si as a,$r as b,Qn as c,Hn as d,Bn as f,Jn as g,rc as h,Ac as i,gr as j,An as k,lc as l,qn as m,li as n,ai as o,Wn as p,ri as r,Gn as s,Nc as t,Yn as u,sc as v,Mu as w,qt as x,Kn as y};