@marimo-team/islands 0.25.3-dev4 → 0.25.3-dev402

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 (1090) hide show
  1. package/dist/{ConnectedDataExplorerComponent-CNSxdKyJ.js → ConnectedDataExplorerComponent-1DGGwl88.js} +188 -212
  2. package/dist/{ErrorBoundary-CuU5CuVr.js → ErrorBoundary-DfbzIKA3.js} +79 -85
  3. package/dist/{ImageComparisonComponent-uU8FSKZE.js → ImageComparisonComponent-CoiwlCwG.js} +20 -20
  4. package/dist/{Plot-DdYOe1UK.js → Plot-BHJLG4xm.js} +2474 -3107
  5. package/dist/_baseSet-Bd5zh2yg.js +327 -0
  6. package/dist/{abnfDiagram-VCTEODGH-DQDjNXt3.js → abnfDiagram-VCTEODGH-l39MiVXs.js} +5 -5
  7. package/dist/any-language-editor-DQDRMEv4.js +75 -0
  8. package/dist/{apl-GEW9-ZP1.js → apl-stFrI2NB.js} +1 -1
  9. package/dist/{arc-7ra3iNdN.js → arc-4W6H62B5.js} +1 -1
  10. package/dist/architecture-7GRP2DOG-GlkXha5_.js +2 -0
  11. package/dist/{architectureDiagram-5GKGNRK7-Nmls7Wxn.js → architectureDiagram-5GKGNRK7-BFUiBUSa.js} +48 -64
  12. package/dist/{arrays-CN1djC4k.js → arrays-DoQ-AILx.js} +15 -27
  13. package/dist/{asciiarmor-BWNxzkG7.js → asciiarmor-DHwFuaIC.js} +1 -1
  14. package/dist/{asn1-Bcn2QutK.js → asn1-KIH4fwAq.js} +1 -1
  15. package/dist/assertNever-DXGfUmPW.js +507 -0
  16. package/dist/assets/__vite-browser-external-C9HF3uHE.js +1 -0
  17. package/dist/assets/worker-B4Cpvr8b.js +171 -0
  18. package/dist/{blockDiagram-I7D4REHJ-Cg25UrxT.js → blockDiagram-I7D4REHJ-BoCyD5KO.js} +28 -39
  19. package/dist/{brainfuck-BQCYDheZ.js → brainfuck-UPAij4U9.js} +1 -1
  20. package/dist/{button-CvjkwdSk.js → button-qQhINE7z.js} +64 -64
  21. package/dist/{c4Diagram-7LVT6UL2-BxFgrnNV.js → c4Diagram-7LVT6UL2-DmcTtm4p.js} +8 -8
  22. package/dist/{capabilities-CQ5IjhzL.js → capabilities-DKqMqBzm.js} +2 -2
  23. package/dist/{channel-CPObtJXj.js → channel-B9eaiezW.js} +1 -1
  24. package/dist/{chat-ui-BDpymeoe.js → chat-ui-r3PPIMn0.js} +2524 -2363
  25. package/dist/{check-EDwSwP89.js → check-ywinAQy6.js} +1 -1
  26. package/dist/{chunk-4HAMMTFA-D4eFPyFh.js → chunk-4HAMMTFA-qKgadZwy.js} +6 -6
  27. package/dist/{chunk-75Z2AOVW-D7gxIs2Q.js → chunk-75Z2AOVW-76L6My3P.js} +4 -4
  28. package/dist/{chunk-YOKDWASO-DPZk8vhS.js → chunk-7TTQLYRW-DBSfUUe5.js} +6270 -5852
  29. package/dist/{chunk-DU6HZSFF-BwiyaNpg.js → chunk-DU6HZSFF-4SDIhUTY.js} +14 -22
  30. package/dist/{chunk-F27PBJKO-ufseIn5y.js → chunk-F27PBJKO-COH2t-FO.js} +3 -3
  31. package/dist/{chunk-FOHPRMQF-BpYR8RqP.js → chunk-FOHPRMQF-ezmr_yWy.js} +49 -58
  32. package/dist/{chunk-GMAD6QVW-BhaJx0X3.js → chunk-GMAD6QVW-BJGF8QZL.js} +16 -75
  33. package/dist/{chunk-GVQU2GXP-Cwbt-lF0.js → chunk-GVQU2GXP-BkolpSXU.js} +3 -3
  34. package/dist/{chunk-IMKFNOWR-CoIFEo-1.js → chunk-IMKFNOWR-k1HEOYUA.js} +8 -8
  35. package/dist/{chunk-L3NEJ4N5-n-zgIVSy.js → chunk-L3NEJ4N5-B-BFQp9t.js} +6 -6
  36. package/dist/{chunk-OSK3NFVY-DXa-Cxbn.js → chunk-OSK3NFVY-BzfZ4VBG.js} +8 -8
  37. package/dist/{chunk-P2QGCYS3-B_Zd3-X0.js → chunk-P2QGCYS3-DJApLVdt.js} +1 -1
  38. package/dist/{chunk-POPQ4Y6H-hYOXbYH_.js → chunk-POPQ4Y6H-BFSZel4w.js} +2 -2
  39. package/dist/{chunk-PWAF6VOD-CQw5qATZ.js → chunk-PWAF6VOD-CRu_RGP2.js} +2 -2
  40. package/dist/{chunk-SHT3W25Y-lHiGx3ZC.js → chunk-SHT3W25Y-CweI43DY.js} +10 -10
  41. package/dist/{chunk-SVP7TREG-BvsHIrY_.js → chunk-SVP7TREG-BJ_CiOqc.js} +3 -3
  42. package/dist/{chunk-TICWLB2K-BC8YIm_n.js → chunk-TICWLB2K-CftJEXJk.js} +10 -10
  43. package/dist/{chunk-XXDRQBXY-Dnl5VBqG.js → chunk-XXDRQBXY-BM-YIt-_.js} +1 -1
  44. package/dist/classDiagram-ZZMXUADV-DRtsA53t.js +30 -0
  45. package/dist/classDiagram-v2-VYDZK3BY-B-un7YsQ.js +30 -0
  46. package/dist/{clike-CxK9W55Z.js → clike-xU8sCVU1.js} +2 -6
  47. package/dist/{clojure-Dzcvwpxk.js → clojure-psoSEo36.js} +1 -1
  48. package/dist/{cmake-DYr-71zp.js → cmake-DDHBwlE7.js} +1 -1
  49. package/dist/{cobol-DC3g37Kq.js → cobol-C4qjDcIq.js} +1 -1
  50. package/dist/code-visibility-CXijswY7.js +130 -0
  51. package/dist/{coffeescript-C-eFwH5N.js → coffeescript-D6UgrGgo.js} +1 -1
  52. package/dist/{common-DiWGWDIM.js → common-Cm5ENbUw.js} +12213 -11268
  53. package/dist/{commonlisp-CyaNXrJR.js → commonlisp-B0ChVjnu.js} +1 -1
  54. package/dist/{compiler-runtime-CldRdSsv.js → compiler-runtime-C5KHtL5D.js} +3 -3
  55. package/dist/{toDate-BNJf01u1.js → config-DOwBtRkI.js} +99 -184
  56. package/dist/{copy-icon-Ft7t9bqz.js → copy-icon-BKcX0ltw.js} +21 -22
  57. package/dist/{cose-bilkent-JH36ORCC-_LyRKVqm.js → cose-bilkent-JH36ORCC-B_Oz4vMP.js} +58 -71
  58. package/dist/createReducer-Bjx6kuxh.js +67 -0
  59. package/dist/{crystal-ih5ax5tQ.js → crystal-DZsc9Ue0.js} +1 -1
  60. package/dist/{css-CN_wP7_R.js → css-DkYRnQ9U.js} +1 -1
  61. package/dist/{cubic-OaEBhQPK.js → cubic-CA80xY_e.js} +6 -7
  62. package/dist/cynefin-OW5HDTMX-0-HehVvH.js +2 -0
  63. package/dist/{cynefinDiagram-5FMLGOSQ-CgWra7wt.js → cynefinDiagram-5FMLGOSQ-3YzyEvsv.js} +5 -5
  64. package/dist/{cypher-CqGRcmZo.js → cypher-CpWPqgvy.js} +1 -1
  65. package/dist/{cytoscape.esm-jJhXJpLB.js → cytoscape.esm-BbeMznK5.js} +411 -512
  66. package/dist/{d-Cj0sOW2z.js → d-Bx2ggfYO.js} +1 -1
  67. package/dist/{dagre-BGSfXNEb.js → dagre-CpjuekF1.js} +550 -700
  68. package/dist/{dagre-GXQ25YYZ-CFZ8-35c.js → dagre-GXQ25YYZ-esvnOmLF.js} +14 -16
  69. package/dist/{data-grid-overlay-editor-ga7ytgbj.js → data-grid-overlay-editor-Dv0TkGKt.js} +8 -8
  70. package/dist/{data-grid-types-BH_r7g7l.js → data-grid-types-DIX_pCco.js} +2 -2
  71. package/dist/{debounce-C3jyATpc.js → debounce-DrhhziJv.js} +2 -2
  72. package/dist/{diagram-S7CK7UJ4-lCNQrW7d.js → diagram-S7CK7UJ4-CX97G4Gc.js} +7 -15
  73. package/dist/{diagram-UQ7AKVKN-CQPQ6pP_.js → diagram-UQ7AKVKN-BL-50b0n.js} +5 -5
  74. package/dist/{diagram-VSXAHHWV-BJWcVVJY.js → diagram-VSXAHHWV-LXjisZoM.js} +6 -6
  75. package/dist/{diagram-VX7I27RA-Cf3b0llz.js → diagram-VX7I27RA-BsjelzlB.js} +7 -7
  76. package/dist/{diagram-Z3DM3KII-Bt4QLrpn.js → diagram-Z3DM3KII-BB9bWIyB.js} +5 -5
  77. package/dist/{dialog-CEBFZNyc.js → dialog-mwa6XN15.js} +30 -30
  78. package/dist/{diff-B_hUkiat.js → diff-DNXaJS8v.js} +1 -1
  79. package/dist/{dist-Bvs24R_E.js → dist-B1qu3Bez.js} +55 -54
  80. package/dist/{dist-D-wwqlzJ.js → dist-BEcpQbZa.js} +78 -77
  81. package/dist/{dist-CrSP_H1M.js → dist-BMz__bo5.js} +317 -317
  82. package/dist/{dist-Cg7gzw-a.js → dist-BagHbFqG.js} +70 -69
  83. package/dist/{dist-C8fAKSH1.js → dist-BdUitvVW.js} +65 -64
  84. package/dist/{dist-BuaRHxOc.js → dist-BfrgytDR.js} +45 -44
  85. package/dist/{dist-CSJ0MDRw.js → dist-BozTF_gH.js} +56 -55
  86. package/dist/{dist-DiDibOYr.js → dist-BreKIQqQ.js} +149 -148
  87. package/dist/{dist-CN8zI-XC.js → dist-BsE4gQHj.js} +555 -555
  88. package/dist/{dist-F8Ep36rk.js → dist-BunZKA_9.js} +60 -59
  89. package/dist/dist-BvZpdAuG.js +850 -0
  90. package/dist/{dist-DUAh96QY.js → dist-CB9MzCXv.js} +1 -1
  91. package/dist/{dist-BK4Oj99o.js → dist-CDVvitRS.js} +18 -17
  92. package/dist/{dist-CN_BeG2I.js → dist-CEomphG1.js} +59 -58
  93. package/dist/{dist-BMQf5zIS.js → dist-ChcBm3jk.js} +166 -165
  94. package/dist/{dist-DpBpA_n1.js → dist-CiSkXlAO.js} +5 -5
  95. package/dist/{dist-D6d86eNJ.js → dist-Cshl6jBw.js} +46 -45
  96. package/dist/{dist-DBtSl3sf.js → dist-D1D56-GS.js} +54 -56
  97. package/dist/{dist-DoE4XJBC.js → dist-D92tYjLc.js} +9845 -10688
  98. package/dist/{dist-OR1OnN-y.js → dist-D95Cd4xm.js} +53 -52
  99. package/dist/{dist-BorMD-uX.js → dist-DNkrY12t.js} +94 -93
  100. package/dist/{dist-BLfKmR-l.js → dist-DneeBk3K.js} +18 -17
  101. package/dist/{dist-diIx5qJW.js → dist-DpYpG8Yc.js} +37 -36
  102. package/dist/{dist-CkTTIdBe.js → dist-MggMo7OR.js} +243 -243
  103. package/dist/{dist-PXYI_yuP.js → dist-ObeTgSmf.js} +27 -26
  104. package/dist/{dist-CLdpGQVr.js → dist-OmeAz0fR.js} +114 -116
  105. package/dist/{dist-CSbh1PNP.js → dist-TGSwzj8a.js} +26 -25
  106. package/dist/dropdown-menu-CmgUseHo.js +5982 -0
  107. package/dist/{dtd-B8FGSWWe.js → dtd-D1YZQCVT.js} +1 -1
  108. package/dist/duckdb-keywords-CdzX4o33.js +3 -0
  109. package/dist/{dylan-DbIBYIrw.js → dylan-CxbG-PUm.js} +2 -2
  110. package/dist/{ebnfDiagram-PWID7BFC-D3NAyPFY.js → ebnfDiagram-PWID7BFC-Lfkf8Ayx.js} +5 -5
  111. package/dist/{ecl-DBmkdWAd.js → ecl-DIXH6vul.js} +1 -1
  112. package/dist/{eiffel-CcWSDDzK.js → eiffel-D0de-eQr.js} +1 -1
  113. package/dist/{elm-MC-b8a6C.js → elm-DrQrn4VD.js} +1 -1
  114. package/dist/{erDiagram-RLTQ6QDP-Tlu09_Nm.js → erDiagram-RLTQ6QDP-DkF2kv2C.js} +14 -14
  115. package/dist/{erlang-AdO1-xtV.js → erlang-2KpKpfC7.js} +1 -1
  116. package/dist/{error-banner-Da600cwz.js → error-banner-CHPLqogX.js} +147 -142
  117. package/dist/error-entries-5kRrE4vX.js +2788 -0
  118. package/dist/{esm-D2gTsXEV.js → esm-B9n0caHs.js} +643 -644
  119. package/dist/{esm-AMFssoNp.js → esm-Bwp_FHP0.js} +331 -331
  120. package/dist/{esm-G4Fhsgng.js → esm-DQtHTnHn.js} +640 -660
  121. package/dist/eventmodeling-NTZA5JFV-DoBvB4Lj.js +2 -0
  122. package/dist/{factor-Ys-13HOP.js → factor-Bwu3ZGOk.js} +1 -1
  123. package/dist/feedback-button-Xk-mOev4.js +371 -0
  124. package/dist/flowDiagram-HODETNUW-CB8xo8zB.js +15 -0
  125. package/dist/{formats-BGh2thRc.js → formats-BDqe9cfr.js} +9 -9
  126. package/dist/{forth-DiMuIXFe.js → forth-DYatDpr6.js} +2 -3
  127. package/dist/{fortran-hkrF2eM4.js → fortran-n8mcQPkL.js} +1 -1
  128. package/dist/{ganttDiagram-EL5Y4UJY-BQT16JSc.js → ganttDiagram-EL5Y4UJY-YzTghq1V.js} +17 -17
  129. package/dist/{gas-DlhqN9k8.js → gas-BUZOHBVw.js} +1 -1
  130. package/dist/{gherkin-0SlhEZ3t.js → gherkin-CrSjX26K.js} +1 -1
  131. package/dist/gitGraph-4MIJSDKK-Ch7kj-d2.js +2 -0
  132. package/dist/{gitGraphDiagram-WWUBYQGX-D5nSIzdE.js → gitGraphDiagram-WWUBYQGX-CK66dT35.js} +4 -4
  133. package/dist/{glide-data-editor-Bv75MH6g.js → glide-data-editor-DdxBDWAj.js} +6732 -2978
  134. package/dist/{glide-utils-DJyqh0EM.js → glide-utils-DYKWS2YV.js} +109 -78
  135. package/dist/{globals-EDQGFIvi.js → globals-DR3VVkF6.js} +3 -3
  136. package/dist/{graphlib-BmY_CCV9.js → graphlib-nlwT3Wvy.js} +177 -220
  137. package/dist/{groovy-YhcTMyvX.js → groovy-IgGNjeU9.js} +1 -1
  138. package/dist/hasIn-C20JsQ2m.js +28 -0
  139. package/dist/{haskell-CodLxrtT.js → haskell-Bs1k3a9s.js} +1 -1
  140. package/dist/{haxe-CiRWNFkH.js → haxe-CQ8Yb3XF.js} +1 -1
  141. package/dist/highlighted-body-JLMTFACH-yt0ZZn80.js +42 -0
  142. package/dist/{cells-C8iCYvLU.js → html-to-image-Bor20n8N.js} +26205 -26250
  143. package/dist/{idl-DZgBq75I.js → idl-DjnxoAWx.js} +1 -1
  144. package/dist/info-A6RAGUB7-DCz_Egh9.js +2 -0
  145. package/dist/{infoDiagram-27XIBGKW-XrDxhr0x.js → infoDiagram-27XIBGKW-BGBIoY6a.js} +4 -4
  146. package/dist/isArrayLikeObject-B-HXCsex.js +626 -0
  147. package/dist/isEmpty-CdX7MTE1.js +14 -0
  148. package/dist/{ishikawaDiagram-5VMMS53U-CD1muzov.js → ishikawaDiagram-5VMMS53U-C3Q5F0f2.js} +5 -7
  149. package/dist/{javascript-BfNytHiM.js → javascript-BQtCoAFy.js} +2 -2
  150. package/dist/{journeyDiagram-3NMN7TZE-BaLqn-dZ.js → journeyDiagram-3NMN7TZE-CYXsL3IE.js} +4 -4
  151. package/dist/{jsx-runtime-3BD1kT0s.js → jsx-runtime-D8btoEHk.js} +2 -2
  152. package/dist/{julia--tLIAG7q.js → julia-BfgtHJE5.js} +1 -1
  153. package/dist/{kanban-definition-UXKFOSKX-Dg9W142_.js → kanban-definition-UXKFOSKX-goBRs99g.js} +10 -10
  154. package/dist/{katex-BIdZGsyO.js → katex-wAapZGrX.js} +793 -724
  155. package/dist/{linear-Cnaq3Tfb.js → linear-TJTTbHM9.js} +2 -3
  156. package/dist/{livescript-CVPfYnY_.js → livescript-gIdRPKtg.js} +1 -1
  157. package/dist/{loader-BQOfjTIJ.js → loader-Bin_dutt.js} +9 -9
  158. package/dist/lru-0OWJJMrW.js +41 -0
  159. package/dist/{lua-4Fa-T-qq.js → lua-CxFpWvnv.js} +2 -2
  160. package/dist/main.js +11073 -8518
  161. package/dist/{mathematica-CtYAy6GG.js → mathematica-QSveeEoW.js} +1 -1
  162. package/dist/{mbox-D0w9Ah1C.js → mbox-2JtaCPNT.js} +1 -1
  163. package/dist/{mermaid-CiAXjLpA.js → mermaid-CssvwR1C.js} +1195 -1182
  164. package/dist/mermaid-WFAXDIZX-DHB2z13u.js +1 -0
  165. package/dist/{mermaid-parser.core-DxuSfYwJ.js → mermaid-parser.core-DtOnl7m4.js} +19 -25
  166. package/dist/{mhchem-CdWPJK6g.js → mhchem-CX8M7Ktl.js} +1 -1
  167. package/dist/{micromark-factory-space-DGxAzmw8.js → micromark-factory-space-C5soVmaM.js} +1 -1
  168. package/dist/{mindmap-definition-YA3MSWOX-DgCidgYJ.js → mindmap-definition-YA3MSWOX-Do2TY53l.js} +13 -13
  169. package/dist/{mirc-De9aSAZM.js → mirc-BqD6ade4.js} +1 -1
  170. package/dist/{mllike-BbugeaY_.js → mllike-CT0hgEOO.js} +1 -1
  171. package/dist/{modelica-BjJwWw1F.js → modelica-DKKebcvq.js} +1 -1
  172. package/dist/{mscgen-DwiRH5ma.js → mscgen-BJCCsWjR.js} +1 -1
  173. package/dist/{mumps--plbDM9o.js → mumps-DVQAXZkU.js} +1 -1
  174. package/dist/{nginx-C4Df7REc.js → nginx-AP4LH2NN.js} +1 -1
  175. package/dist/{node-sql-parser-BiZOJ-FS.js → node-sql-parser-C9dndbfr.js} +7184 -7195
  176. package/dist/{now-jM8-M7IR.js → now-BKZCLE5P.js} +12 -13
  177. package/dist/{nsis-fiiOqLc3.js → nsis-Cah9xkdT.js} +1 -1
  178. package/dist/{ntriples-jV77I4k8.js → ntriples-CQoaLOV6.js} +2 -2
  179. package/dist/{number-overlay-editor-BCP3MxhC.js → number-overlay-editor-Cc5gJryh.js} +17 -22
  180. package/dist/{objects-CzUgoMIF.js → objects-DCmMvZtn.js} +1 -3
  181. package/dist/{octave-Cztd01tF.js → octave-CeDj2bTn.js} +1 -1
  182. package/dist/{once-BtE-wKRL.js → once-NnpX_HnX.js} +1 -1
  183. package/dist/{oz-Bl8o3BDl.js → oz-BksQrg3k.js} +1 -1
  184. package/dist/packet-AYTQ26CC-DEMHgLPq.js +2 -0
  185. package/dist/{pascal-BO5JqysR.js → pascal-BKL17mpl.js} +1 -1
  186. package/dist/{pegDiagram-XKGWAZYB-coOYYKB6.js → pegDiagram-XKGWAZYB-sUp3JNDF.js} +5 -5
  187. package/dist/pencil-CijoRsa3.js +10 -0
  188. package/dist/{perl-Drlh9s6m.js → perl-CacqJ-Ss.js} +1 -1
  189. package/dist/pick-DgpAbcwP.js +35 -0
  190. package/dist/pie-WAS4IAKB-DMjTEeHd.js +2 -0
  191. package/dist/{pieDiagram-E7YTZNPT-BnXTc3bj.js → pieDiagram-E7YTZNPT-C2S9T2yS.js} +7 -7
  192. package/dist/{pig-BWGR8wZw.js → pig-CXSGZ_K9.js} +1 -1
  193. package/dist/{powershell-DT99xlz_.js → powershell-DY_yIxBM.js} +3 -6
  194. package/dist/{process-output-e4jj9Ijt.js → process-output-39KkAXSF.js} +5 -5
  195. package/dist/{properties-Q-rkxld0.js → properties-Om0IDE07.js} +1 -1
  196. package/dist/{protobuf-DKyWZbs7.js → protobuf-B8nxxb4Q.js} +1 -1
  197. package/dist/{pug-42ZJUbEC.js → pug-lkUBPvVS.js} +3 -7
  198. package/dist/{puppet-B4UozHhh.js → puppet-DMkXsi4d.js} +1 -1
  199. package/dist/purify.es-DmnrIjg4.js +877 -0
  200. package/dist/{python-DREjAV__.js → python-JQVycMgr.js} +1 -1
  201. package/dist/{q-Bi63IpBO.js → q-DqE__nNB.js} +1 -1
  202. package/dist/{quadrantDiagram-AXDQQJYC-Ccw0xMjN.js → quadrantDiagram-AXDQQJYC-nGFBFig7.js} +3 -3
  203. package/dist/{r-DSwXWKMR.js → r-Cbliap7Q.js} +1 -1
  204. package/dist/radar-RG4KPBEZ-9PwdCvai.js +2 -0
  205. package/dist/railroad-74A4TZTK-8N9kF5jl.js +2 -0
  206. package/dist/railroad-abnf-HS5TGJTU-Sg6YmzlR.js +2 -0
  207. package/dist/railroad-ebnf-LZEXJU2U-CYwp2Oee.js +2 -0
  208. package/dist/railroad-peg-WCYAUIDC-BfDkAuQ3.js +2 -0
  209. package/dist/{railroadDiagram-O6MQD6OU-B28-u83n.js → railroadDiagram-O6MQD6OU-PldgXn-D.js} +5 -5
  210. package/dist/{react-sHtZdjeP.js → react-Bgs_wQh3.js} +3 -3
  211. package/dist/{react-dom-DUmH0GXv.js → react-dom-DdqGVp5N.js} +5 -5
  212. package/dist/{react-vega-BED0DjiB.js → react-vega-CGgQEf0O.js} +12303 -15725
  213. package/dist/{requirementDiagram-BXWQKSXE-CdYCTMu0.js → requirementDiagram-BXWQKSXE-CoVxzaFy.js} +13 -13
  214. package/dist/{reveal-component-DO5BJB9l.js → reveal-component-Dm5K9KPi.js} +1175 -1288
  215. package/dist/{rolldown-runtime-Cb76FRpK.js → rolldown-runtime-BPCzCO3I.js} +1 -1
  216. package/dist/{rpm-DPb1DeKM.js → rpm-DmT_LNpE.js} +1 -1
  217. package/dist/{ruby-U7fZA4DP.js → ruby-BHVZTtLW.js} +1 -1
  218. package/dist/{sankeyDiagram-P5KCCOFB-ELvOcnZH.js → sankeyDiagram-P5KCCOFB-CrOfyc2n.js} +2 -2
  219. package/dist/{sas-CLk1JpTn.js → sas-CrG5N1he.js} +1 -1
  220. package/dist/{scheme-CT-2k2Tl.js → scheme-BHUnz-IB.js} +1 -1
  221. package/dist/select-DW32QOzC.js +1200 -0
  222. package/dist/{semaphore-89jsoHtS.js → semaphore-8KhQouXt.js} +4 -5
  223. package/dist/{sequenceDiagram-WJ2MYXX4-CM3aRAe_.js → sequenceDiagram-WJ2MYXX4-CRUI6aLG.js} +6 -6
  224. package/dist/{shell-BLO7fcsk.js → shell-C5IBmRU5.js} +1 -1
  225. package/dist/{sieve-nG3C7WNH.js → sieve-BzCnt_E6.js} +2 -2
  226. package/dist/{sizeCapture-INFHLROL-Dx5SpkQF.js → sizeCapture-INFHLROL-DBeZ20mI.js} +1 -1
  227. package/dist/{smalltalk-BROcZybA.js → smalltalk-DQFAQul3.js} +1 -1
  228. package/dist/{solr-mVltHNc5.js → solr-BiapYPCk.js} +1 -1
  229. package/dist/{sparql-Cv1Ksr4v.js → sparql-BcUKO1is.js} +1 -1
  230. package/dist/{spec-BwarBpUJ.js → spec-Ww0JjShW.js} +42 -12
  231. package/dist/{src-CA_m4ONl.js → src-D5uZaZib.js} +8 -14
  232. package/dist/{stateDiagram-D77RDMKH-DOZUMVj8.js → stateDiagram-D77RDMKH-IJFKm2ah.js} +18 -18
  233. package/dist/stateDiagram-v2-MP3YSRHH-sHwmL1Cd.js +30 -0
  234. package/dist/static-state-CnQdTBTW.js +90 -0
  235. package/dist/{stex-Btf3omL8.js → stex-CQ_aCGTF.js} +1 -1
  236. package/dist/style.css +1 -1
  237. package/dist/{stylus-Dt4VvLXL.js → stylus-D4gHF5lg.js} +1 -1
  238. package/dist/{swift-DHsn_CVI.js → swift-CnvIBnbt.js} +1 -1
  239. package/dist/{swimlanes-42K2YHIH-BkSppxp8.js → swimlanes-42K2YHIH-DqInQL7n.js} +37 -59
  240. package/dist/swimlanesDiagram-VR7AAH4N-BiJSxYhi.js +30 -0
  241. package/dist/{swiper-component-DKntyn8p.js → swiper-component-DTdNB9wg.js} +45 -78
  242. package/dist/{tcl-CV0OLBOl.js → tcl-DkOjjZYO.js} +1 -1
  243. package/dist/{textile-D320oKVM.js → textile-DgzBVSEW.js} +1 -1
  244. package/dist/{tiki-BF2aDPlB.js → tiki-MighF8A_.js} +1 -1
  245. package/dist/{time-BieKwdYS.js → time-BlOl70lB.js} +2 -2
  246. package/dist/{timeline-definition-24CTP7MA-CaMQayqK.js → timeline-definition-24CTP7MA-CqGAO7Po.js} +5 -5
  247. package/dist/toast-Crofa36R.js +491 -0
  248. package/dist/{toml-CaUN7UHo.js → toml-B0B7UAba.js} +1 -1
  249. package/dist/{tooltip-BO1REbqs.js → tooltip-Bg-SDCwa.js} +327 -303
  250. package/dist/treeView-Q6P3EWNA-BQywp0E1.js +2 -0
  251. package/dist/treemap-WGGIJYW6-P2ZJnldw.js +2 -0
  252. package/dist/{troff-DQUFcClZ.js → troff-B4IRX71y.js} +1 -1
  253. package/dist/{ttcn-CQL1duJS.js → ttcn-B4tpvdJD.js} +1 -1
  254. package/dist/{ttcn-cfg-BMmEFJPu.js → ttcn-cfg-pfE-1FV8.js} +1 -1
  255. package/dist/{turtle-C3esgsRr.js → turtle-Bc97ufp6.js} +1 -1
  256. package/dist/use-restore-focus-CE9Sflmg.js +7621 -0
  257. package/dist/{use-vega-container-remeasure-Bz4PZMtt.js → use-vega-container-remeasure-BrUpWQfF.js} +4 -8
  258. package/dist/{useAsyncData-Deh5kszT.js → useAsyncData-P5-Oovhq.js} +21 -20
  259. package/dist/{useDateFormatter-D8XruNGG.js → useDateFormatter-D5fsC9ot.js} +5 -5
  260. package/dist/{useDeepCompareMemoize-DXwzRINI.js → useDeepCompareMemoize-Bvrue1iy.js} +3 -3
  261. package/dist/useEvent-BoN7U38T.js +19 -0
  262. package/dist/{useIframeCapabilities-DBETvvPl.js → useIframeCapabilities-HTZiVlGV.js} +2 -2
  263. package/dist/useLifecycle-Ctr5lECo.js +112 -0
  264. package/dist/{vb-RK1eDXRl.js → vb-C5kpOY_q.js} +1 -1
  265. package/dist/{vbscript-BCOeM0de.js → vbscript-Ck0hgOg5.js} +1 -1
  266. package/dist/{vega-component-DG29TAB7.js → vega-component-DQZhTzVQ.js} +167 -172
  267. package/dist/{vega-embed-container-BNHE18G9.js → vega-embed-container-DgpACsCB.js} +7 -7
  268. package/dist/{vega-loader.browser-DNST6uVf.js → vega-loader.browser-Co9gYE8Z.js} +242 -108
  269. package/dist/{velocity-CZKOFbOI.js → velocity-2Doc6dgJ.js} +1 -1
  270. package/dist/{vennDiagram-4TSXK5OY-CF8pfaK3.js → vennDiagram-4TSXK5OY-CsvJDV8r.js} +4 -4
  271. package/dist/{verilog-DqQTzVn8.js → verilog-CmZmYe4R.js} +2 -2
  272. package/dist/{vhdl-vQr2bfmi.js → vhdl-esMnUHZm.js} +1 -1
  273. package/dist/wardley-WFR3VGLG-CIBJ6O2G.js +2 -0
  274. package/dist/{wardleyDiagram-VM6X3IG4-dGPu39d-.js → wardleyDiagram-VM6X3IG4-DeT0PuM9.js} +5 -5
  275. package/dist/{webidl-DzX7N40e.js → webidl-G_RlXG7G.js} +1 -1
  276. package/dist/{xquery-Cw_Q_hGR.js → xquery-IUQpMoMl.js} +1 -1
  277. package/dist/{xychartDiagram-S5SC5T6Z-CP6-9q56.js → xychartDiagram-S5SC5T6Z-C15EKY66.js} +8 -8
  278. package/dist/{yacas-DiC4jJBE.js → yacas-ObL0t2h9.js} +1 -1
  279. package/dist/{z80-CUOQDEJO.js → z80-jyuJhy0k.js} +1 -1
  280. package/package.json +41 -45
  281. package/src/__mocks__/document.tsx +64 -0
  282. package/src/__mocks__/executions.ts +262 -0
  283. package/src/__mocks__/notebook.ts +22 -48
  284. package/src/__mocks__/partial.ts +26 -0
  285. package/src/__mocks__/requests.ts +1 -7
  286. package/src/__tests__/CellStatus.test.tsx +25 -26
  287. package/src/__tests__/fixtures/{pair-preview.ts → pair-config.ts} +4 -3
  288. package/src/__tests__/main.test.tsx +24 -1
  289. package/src/__tests__/module-entry.test.ts +44 -0
  290. package/src/__tests__/mount.test.ts +25 -66
  291. package/src/__tests__/{host-imports.test.ts → replica-imports.test.ts} +12 -11
  292. package/src/components/ai/__tests__/ai-model-dropdown.test.tsx +63 -0
  293. package/src/components/ai/__tests__/ai-utils.test.ts +8 -0
  294. package/src/components/ai/ai-model-dropdown.tsx +11 -6
  295. package/src/components/app-config/__tests__/add-model-discovery.test.tsx +255 -0
  296. package/src/components/app-config/__tests__/model-discovery.test.tsx +183 -0
  297. package/src/components/app-config/__tests__/state.test.tsx +50 -0
  298. package/src/components/app-config/ai-config.tsx +206 -188
  299. package/src/components/app-config/app-config-button.tsx +6 -5
  300. package/src/components/app-config/app-config-form.tsx +5 -9
  301. package/src/components/app-config/common.tsx +7 -9
  302. package/src/components/app-config/data-form.tsx +113 -116
  303. package/src/components/app-config/get-dirty-values.ts +4 -4
  304. package/src/components/app-config/mcp-config.tsx +30 -53
  305. package/src/components/app-config/model-discovery.tsx +157 -0
  306. package/src/components/app-config/model-provider-config.ts +25 -0
  307. package/src/components/app-config/state.ts +2 -0
  308. package/src/components/app-config/user-config-form.css +91 -0
  309. package/src/components/app-config/user-config-form.tsx +278 -350
  310. package/src/components/chat/__tests__/capabilities-popover.test.tsx +0 -1
  311. package/src/components/chat/__tests__/chat-display.test.tsx +196 -0
  312. package/src/components/chat/__tests__/chat-markdown.test.tsx +43 -0
  313. package/src/components/chat/__tests__/chat-utils.test.ts +93 -1
  314. package/src/components/chat/__tests__/message-queue.test.tsx +17 -0
  315. package/src/components/chat/__tests__/notebook-access-selector.test.tsx +64 -0
  316. package/src/components/chat/__tests__/notebook-context.test.ts +199 -0
  317. package/src/components/chat/__tests__/turn-timing.test.ts +84 -0
  318. package/src/components/chat/__tests__/use-assistant-turn.test.ts +95 -0
  319. package/src/components/chat/__tests__/user-message.test.tsx +27 -0
  320. package/src/components/chat/acp/__tests__/agent-panel-initialization.test.tsx +1 -1
  321. package/src/components/chat/acp/__tests__/agent-panel.test.tsx +22 -17
  322. package/src/components/chat/acp/__tests__/session-tabs.test.tsx +43 -0
  323. package/src/components/chat/acp/__tests__/state.test.ts +2 -2
  324. package/src/components/chat/acp/agent-panel.tsx +6 -3
  325. package/src/components/chat/acp/blocks.tsx +13 -12
  326. package/src/components/chat/acp/common.tsx +4 -5
  327. package/src/components/chat/acp/model-selector.tsx +1 -1
  328. package/src/components/chat/acp/session-tabs.tsx +8 -3
  329. package/src/components/chat/agent-activity.tsx +132 -0
  330. package/src/components/chat/capabilities-popover.tsx +2 -11
  331. package/src/components/chat/chat-components.tsx +9 -4
  332. package/src/components/chat/chat-display.tsx +131 -57
  333. package/src/components/chat/chat-empty-state.tsx +55 -0
  334. package/src/components/chat/chat-history-popover.tsx +6 -1
  335. package/src/components/chat/chat-markdown.tsx +15 -0
  336. package/src/components/chat/chat-panel.tsx +241 -311
  337. package/src/components/chat/chat-typography.css +108 -0
  338. package/src/components/chat/chat-utils.ts +24 -35
  339. package/src/components/chat/notebook-access-selector.stories.tsx +22 -0
  340. package/src/components/chat/notebook-access-selector.tsx +100 -0
  341. package/src/components/chat/notebook-context.ts +80 -0
  342. package/src/components/chat/tool-call/__tests__/tool-labels.test.ts +76 -0
  343. package/src/components/chat/tool-call/__tests__/tool-step.test.tsx +57 -0
  344. package/src/components/chat/tool-call/shared.ts +6 -0
  345. package/src/components/chat/tool-call/tool-call-view.tsx +22 -76
  346. package/src/components/chat/tool-call/tool-labels.ts +172 -0
  347. package/src/components/chat/tool-call/tool-result.tsx +1 -1
  348. package/src/components/chat/tool-call/tool-step.tsx +145 -0
  349. package/src/components/chat/turn-timing.ts +73 -0
  350. package/src/components/chat/use-assistant-turn.ts +65 -0
  351. package/src/components/chat/use-chat-generation.ts +20 -0
  352. package/src/components/chat/user-message.tsx +145 -0
  353. package/src/components/data-table/TableBottomBar.tsx +4 -1
  354. package/src/components/data-table/TableTopBar.tsx +2 -0
  355. package/src/components/data-table/__tests__/chart-spec-model.test.ts +195 -195
  356. package/src/components/data-table/__tests__/column-explorer.test.tsx +27 -1
  357. package/src/components/data-table/__tests__/columns.test.tsx +105 -0
  358. package/src/components/data-table/__tests__/context-menu-interaction.test.tsx +130 -0
  359. package/src/components/data-table/__tests__/data-table.test.tsx +1 -0
  360. package/src/components/data-table/__tests__/date-popover.test.tsx +72 -0
  361. package/src/components/data-table/__tests__/export-actions.test.tsx +434 -6
  362. package/src/components/data-table/__tests__/keyboard-selection.test.tsx +188 -0
  363. package/src/components/data-table/__tests__/pagination.test.tsx +28 -1
  364. package/src/components/data-table/__tests__/search-highlight.test.tsx +109 -0
  365. package/src/components/data-table/__tests__/url-detector.test.tsx +74 -0
  366. package/src/components/data-table/cell-selection/feature.ts +2 -2
  367. package/src/components/data-table/cell-selection/types.ts +2 -2
  368. package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +74 -1
  369. package/src/components/data-table/charts/__tests__/spec-snapshot.test.ts +20 -20
  370. package/src/components/data-table/charts/__tests__/spec.test.ts +78 -52
  371. package/src/components/data-table/charts/__tests__/storage.test.ts +4 -1
  372. package/src/components/data-table/charts/chart-spec/spec.ts +68 -43
  373. package/src/components/data-table/charts/charts.tsx +40 -30
  374. package/src/components/data-table/charts/storage.ts +16 -5
  375. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +1 -1
  376. package/src/components/data-table/column-formatting/types.ts +1 -2
  377. package/src/components/data-table/column-summary/chart-spec-model.tsx +23 -16
  378. package/src/components/data-table/column-summary/column-summary.tsx +2 -4
  379. package/src/components/data-table/column-visibility-dropdown.tsx +8 -13
  380. package/src/components/data-table/columns.tsx +45 -46
  381. package/src/components/data-table/context-menu.tsx +36 -20
  382. package/src/components/data-table/data-table.tsx +17 -1
  383. package/src/components/data-table/date-popover.tsx +6 -4
  384. package/src/components/data-table/export-actions.tsx +267 -163
  385. package/src/components/data-table/pagination.tsx +44 -33
  386. package/src/components/data-table/range-focus/atoms.ts +4 -6
  387. package/src/components/data-table/range-focus/use-cell-range-selection.ts +65 -38
  388. package/src/components/data-table/range-focus/use-scroll-into-view.ts +21 -2
  389. package/src/components/data-table/renderers.tsx +16 -7
  390. package/src/components/data-table/row-viewer-panel/__tests__/row-viewer.test.tsx +24 -1
  391. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +4 -4
  392. package/src/components/data-table/schemas.ts +14 -36
  393. package/src/components/data-table/search-highlight.tsx +79 -0
  394. package/src/components/data-table/types.ts +1 -0
  395. package/src/components/data-table/url-detector.tsx +49 -9
  396. package/src/components/datasources/__tests__/column-actions.test.tsx +97 -0
  397. package/src/components/datasources/__tests__/column-preview.test.tsx +96 -5
  398. package/src/components/datasources/__tests__/datasources-interactions.test.tsx +295 -0
  399. package/src/components/datasources/__tests__/table-list.test.tsx +118 -0
  400. package/src/components/datasources/__tests__/utils.test.ts +117 -7
  401. package/src/components/datasources/column-preview.tsx +17 -12
  402. package/src/components/datasources/datasources.tsx +58 -44
  403. package/src/components/datasources/utils.ts +41 -27
  404. package/src/components/debugger/debugger-code.tsx +5 -0
  405. package/src/components/dependency-graph/custom-node.tsx +1 -1
  406. package/src/components/dependency-graph/dependency-graph-tree.tsx +8 -8
  407. package/src/components/dependency-graph/elements.ts +24 -21
  408. package/src/components/dependency-graph/minimap-content.tsx +15 -20
  409. package/src/components/dependency-graph/panels.tsx +4 -2
  410. package/src/components/dependency-graph/utils/__tests__/layout.test.ts +18 -11
  411. package/src/components/editor/Output.tsx +13 -5
  412. package/src/components/editor/SortableCell.tsx +1 -3
  413. package/src/components/editor/__tests__/Output.test.tsx +50 -32
  414. package/src/components/editor/__tests__/agent-toast.test.tsx +58 -0
  415. package/src/components/editor/__tests__/data-attributes.test.tsx +39 -32
  416. package/src/components/editor/__tests__/dynamic-favicon.test.tsx +106 -18
  417. package/src/components/editor/__tests__/output-persistence.test.tsx +33 -32
  418. package/src/components/editor/__tests__/package-alert.test.tsx +22 -1
  419. package/src/components/editor/actions/__tests__/name-cell-input.test.tsx +70 -0
  420. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +69 -260
  421. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +222 -43
  422. package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +6 -24
  423. package/src/components/editor/actions/__tests__/useCellActionButton.test.tsx +132 -0
  424. package/src/components/editor/actions/__tests__/useSetOutputsExpanded.test.ts +8 -9
  425. package/src/components/editor/actions/name-cell-input.tsx +4 -3
  426. package/src/components/editor/actions/pair-with-agent-commands.ts +48 -54
  427. package/src/components/editor/actions/pair-with-agent-modal.tsx +102 -43
  428. package/src/components/editor/actions/pair-with-agent.tsx +16 -39
  429. package/src/components/editor/actions/useCellActionButton.tsx +47 -35
  430. package/src/components/editor/actions/useConfigActions.tsx +3 -4
  431. package/src/components/editor/actions/useNotebookActions.tsx +25 -29
  432. package/src/components/editor/actions/useRestartKernel.tsx +0 -5
  433. package/src/components/editor/actions/useSetCodeVisibility.ts +11 -12
  434. package/src/components/editor/actions/useSetOutputsExpanded.ts +24 -24
  435. package/src/components/editor/agent-toast.ts +15 -0
  436. package/src/components/editor/ai/ai-completion-editor.tsx +2 -1
  437. package/src/components/editor/ai/completion-handlers.tsx +0 -37
  438. package/src/components/editor/ai/prompt-input.tsx +179 -0
  439. package/src/components/editor/alerts/__tests__/connection-notice.test.tsx +1 -1
  440. package/src/components/editor/alerts/connection-notice.tsx +1 -1
  441. package/src/components/editor/alerts/startup-logs-alert.tsx +1 -0
  442. package/src/components/editor/alerts/stdin-blocking-alert.tsx +4 -2
  443. package/src/components/editor/app-container.tsx +1 -1
  444. package/src/components/editor/boundary/__tests__/ErrorBoundary.test.tsx +1 -1
  445. package/src/components/editor/cell/CellStatus.tsx +28 -23
  446. package/src/components/editor/cell/CreateCellButton.tsx +15 -21
  447. package/src/components/editor/cell/DeleteButton.tsx +3 -2
  448. package/src/components/editor/cell/RunButton.tsx +18 -8
  449. package/src/components/editor/cell/StagedAICell.tsx +52 -137
  450. package/src/components/editor/cell/StopButton.tsx +5 -5
  451. package/src/components/editor/cell/__tests__/useRunCells.test.tsx +151 -0
  452. package/src/components/editor/cell/__tests__/useShouldShowInterrupt.test.ts +39 -0
  453. package/src/components/editor/cell/cell-actions.tsx +12 -1
  454. package/src/components/editor/cell/cell-context-menu.tsx +24 -4
  455. package/src/components/editor/cell/code/__tests__/language-toggle.test.tsx +91 -0
  456. package/src/components/editor/cell/code/cell-editor.tsx +67 -170
  457. package/src/components/editor/cell/code/language-toggle.tsx +14 -11
  458. package/src/components/editor/cell/collapse.tsx +16 -6
  459. package/src/components/editor/cell/useAddCell.ts +4 -8
  460. package/src/components/editor/cell/useDeleteCell.tsx +10 -36
  461. package/src/components/editor/cell/useRunCells.ts +72 -58
  462. package/src/components/editor/cell/useShouldShowInterrupt.ts +2 -12
  463. package/src/components/editor/cell/useSplitCell.tsx +10 -6
  464. package/src/components/editor/chrome/components/__tests__/feedback-button.test.tsx +1 -1
  465. package/src/components/editor/chrome/components/feedback-button.tsx +2 -8
  466. package/src/components/editor/chrome/panels/__tests__/packages-panel.test.tsx +31 -2
  467. package/src/components/editor/chrome/panels/__tests__/runtime-details.test.tsx +1 -1
  468. package/src/components/editor/chrome/panels/__tests__/sandbox-recovery.test.tsx +1 -1
  469. package/src/components/editor/chrome/panels/cache-panel.tsx +1 -0
  470. package/src/components/editor/chrome/panels/dependency-graph-panel.tsx +1 -1
  471. package/src/components/editor/chrome/panels/error-panel.tsx +1 -0
  472. package/src/components/editor/chrome/panels/logs-panel.tsx +2 -1
  473. package/src/components/editor/chrome/panels/outline/__tests__/outline-keyboard.test.tsx +84 -0
  474. package/src/components/editor/chrome/panels/outline/floating-outline.tsx +39 -14
  475. package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +3 -2
  476. package/src/components/editor/chrome/panels/packages-panel.tsx +4 -7
  477. package/src/components/editor/chrome/panels/panel-header.tsx +13 -0
  478. package/src/components/editor/chrome/panels/secrets-panel.tsx +1 -0
  479. package/src/components/editor/chrome/panels/session-panel.tsx +1 -1
  480. package/src/components/editor/chrome/panels/snippets-panel.tsx +10 -12
  481. package/src/components/editor/chrome/panels/variable-panel.tsx +1 -5
  482. package/src/components/editor/chrome/types.ts +1 -1
  483. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +364 -0
  484. package/src/components/editor/chrome/wrapper/__tests__/document-sync-status.test.tsx +97 -0
  485. package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +265 -37
  486. package/src/components/editor/chrome/wrapper/__tests__/useAskAiAboutCell.test.tsx +58 -0
  487. package/src/components/editor/chrome/wrapper/app-chrome.tsx +91 -74
  488. package/src/components/editor/chrome/wrapper/footer-item.tsx +32 -24
  489. package/src/components/editor/chrome/wrapper/footer-items/attachment-status.tsx +237 -0
  490. package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +3 -17
  491. package/src/components/editor/chrome/wrapper/footer-items/document-sync-status.tsx +54 -0
  492. package/src/components/editor/chrome/wrapper/footer-items/lsp-status.tsx +1 -1
  493. package/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx +1 -1
  494. package/src/components/editor/chrome/wrapper/footer-items/runtime-settings.tsx +1 -7
  495. package/src/components/editor/chrome/wrapper/footer.tsx +4 -2
  496. package/src/components/editor/chrome/wrapper/minimap-state.ts +1 -1
  497. package/src/components/editor/chrome/wrapper/pending-ai-cells.tsx +143 -72
  498. package/src/components/editor/chrome/wrapper/pending-ai-changes-badge.tsx +25 -0
  499. package/src/components/editor/chrome/wrapper/sidebar.tsx +8 -4
  500. package/src/components/editor/chrome/wrapper/storage.ts +1 -1
  501. package/src/components/editor/chrome/wrapper/useAskAiAboutCell.ts +36 -0
  502. package/src/components/editor/columns/__tests__/cell-column.test.tsx +1 -1
  503. package/src/components/editor/columns/cell-column.tsx +1 -1
  504. package/src/components/editor/columns/sortable-column.tsx +2 -2
  505. package/src/components/editor/connections/components.tsx +5 -10
  506. package/src/components/editor/controls/Controls.tsx +4 -4
  507. package/src/components/editor/controls/__tests__/command-palette.test.tsx +53 -0
  508. package/src/components/editor/controls/__tests__/keyboard-shortcuts.test.tsx +61 -0
  509. package/src/components/editor/controls/__tests__/notebook-menu-dropdown.test.tsx +10 -4
  510. package/src/components/editor/controls/command-palette.tsx +22 -10
  511. package/src/components/editor/controls/keyboard-shortcuts.tsx +14 -5
  512. package/src/components/editor/documentation.css +34 -11
  513. package/src/components/editor/dynamic-favicon.tsx +21 -40
  514. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +558 -0
  515. package/src/components/editor/errors/auto-fix.tsx +4 -8
  516. package/src/components/editor/errors/send-error-report-button.tsx +66 -0
  517. package/src/components/editor/file-tree/__tests__/file-explorer-interactions.test.tsx +6 -0
  518. package/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx +47 -0
  519. package/src/components/editor/file-tree/__tests__/use-file-search.test.tsx +91 -0
  520. package/src/components/editor/file-tree/file-explorer.tsx +48 -15
  521. package/src/components/editor/file-tree/file-name-input.tsx +1 -0
  522. package/src/components/editor/file-tree/file-viewer.tsx +4 -2
  523. package/src/components/editor/file-tree/use-file-search.ts +35 -21
  524. package/src/components/editor/header/__tests__/filename-form.test.tsx +1 -4
  525. package/src/components/editor/header/__tests__/status.test.tsx +5 -3
  526. package/src/components/editor/header/app-header.tsx +1 -1
  527. package/src/components/editor/header/filename-form.tsx +1 -1
  528. package/src/components/editor/header/status.tsx +44 -22
  529. package/src/components/editor/links/__tests__/cell-link.test.tsx +148 -0
  530. package/src/components/editor/links/cell-link-list.tsx +1 -1
  531. package/src/components/editor/links/cell-link.tsx +21 -11
  532. package/src/components/editor/navigation/__tests__/clipboard.test.ts +60 -38
  533. package/src/components/editor/navigation/__tests__/navigation.test.ts +109 -85
  534. package/src/components/editor/navigation/__tests__/selection.test.ts +43 -21
  535. package/src/components/editor/navigation/clipboard.ts +17 -14
  536. package/src/components/editor/navigation/focus-utils.ts +23 -4
  537. package/src/components/editor/navigation/multi-cell-action-toolbar.tsx +17 -33
  538. package/src/components/editor/navigation/navigation.ts +74 -72
  539. package/src/components/editor/navigation/selection.ts +30 -29
  540. package/src/components/editor/notebook-banner.tsx +1 -0
  541. package/src/components/editor/notebook-cell.tsx +173 -182
  542. package/src/components/editor/output/MarimoErrorOutput.tsx +60 -7
  543. package/src/components/editor/output/MarimoTracebackOutput.tsx +54 -37
  544. package/src/components/editor/output/Outputs.css +8 -0
  545. package/src/components/editor/output/VideoOutput.tsx +6 -0
  546. package/src/components/editor/output/__tests__/VideoOutput.test.tsx +131 -0
  547. package/src/components/editor/output/__tests__/ansi-reduce.test.ts +18 -0
  548. package/src/components/editor/output/__tests__/traceback.test.tsx +27 -1
  549. package/src/components/editor/output/ansi-reduce.ts +43 -17
  550. package/src/components/editor/output/console/ConsoleOutput.tsx +19 -25
  551. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +125 -69
  552. package/src/components/editor/output/console/process-output.ts +4 -2
  553. package/src/components/editor/package-alert.tsx +14 -7
  554. package/src/components/editor/renderers/__tests__/add-cell-buttons.test.tsx +18 -0
  555. package/src/components/editor/renderers/cell-array.tsx +31 -102
  556. package/src/components/editor/renderers/cells-renderer.tsx +3 -1
  557. package/src/components/editor/renderers/grid-layout/__tests__/grid-layout.test.tsx +69 -0
  558. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +35 -28
  559. package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -4
  560. package/src/components/editor/renderers/slides-layout/slides-layout.tsx +1 -1
  561. package/src/components/editor/renderers/types.ts +2 -2
  562. package/src/components/editor/renderers/vertical-layout/__tests__/useFocusFirstEditor.test.ts +47 -4
  563. package/src/components/editor/renderers/vertical-layout/sidebar/toggle.tsx +7 -1
  564. package/src/components/editor/renderers/vertical-layout/useFocusFirstEditor.ts +9 -1
  565. package/src/components/editor/renderers/vertical-layout/utils.ts +4 -4
  566. package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +23 -44
  567. package/src/components/editor/stdin-blocking-alert.tsx +4 -2
  568. package/src/components/home/components.tsx +17 -31
  569. package/src/components/icons/__tests__/large-spinner.test.tsx +39 -0
  570. package/src/components/icons/large-spinner.tsx +3 -14
  571. package/src/components/icons/spinner.tsx +1 -1
  572. package/src/components/markdown/__tests__/markdown-renderer.test.tsx +32 -2
  573. package/src/components/markdown/markdown-renderer.tsx +43 -28
  574. package/src/components/mcp/mcp-status-indicator.tsx +18 -14
  575. package/src/components/pages/__tests__/home-page.test.tsx +116 -0
  576. package/src/components/pages/edit-page.tsx +19 -17
  577. package/src/components/pages/home-page.tsx +164 -91
  578. package/src/components/scratchpad/scratchpad.test.tsx +89 -0
  579. package/src/components/scratchpad/scratchpad.tsx +52 -34
  580. package/src/components/scratchpad/state.ts +7 -0
  581. package/src/components/slides/__tests__/cell-output-block.test.tsx +7 -8
  582. package/src/components/slides/__tests__/minimap-actions.test.tsx +25 -32
  583. package/src/components/slides/__tests__/minimap.test.ts +38 -19
  584. package/src/components/slides/__tests__/slide-cell-view.test.tsx +1 -0
  585. package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +37 -0
  586. package/src/components/slides/minimap.tsx +22 -14
  587. package/src/components/slides/reveal-component.tsx +73 -36
  588. package/src/components/slides/reveal-slides.css +5 -4
  589. package/src/components/slides/slide-cell-view.tsx +40 -38
  590. package/src/components/slides/slide-form.tsx +1 -0
  591. package/src/components/slides/slide-scroll-hint.tsx +3 -1
  592. package/src/components/slides/slide.tsx +4 -5
  593. package/src/components/sort/SortableCellsProvider.tsx +8 -25
  594. package/src/components/static-html/__tests__/static-banner.test.tsx +1 -1
  595. package/src/components/tracing/tracing-keyboard.test.tsx +85 -0
  596. package/src/components/tracing/tracing.tsx +46 -42
  597. package/src/components/ui/__tests__/draggable-popover.test.tsx +24 -0
  598. package/src/components/ui/__tests__/fullscreen.test.tsx +99 -2
  599. package/src/components/ui/__tests__/range-slider.test.tsx +165 -0
  600. package/src/components/ui/alert-dialog.tsx +1 -1
  601. package/src/components/ui/draggable-popover.tsx +24 -2
  602. package/src/components/ui/fullscreen.tsx +43 -3
  603. package/src/components/ui/range-slider.tsx +22 -9
  604. package/src/components/ui/slider.tsx +6 -2
  605. package/src/components/ui/toast.tsx +1 -1
  606. package/src/core/MarimoApp.tsx +3 -1
  607. package/src/core/ai/__tests__/staged-cells.test.ts +90 -609
  608. package/src/core/ai/context/__tests__/registry.test.ts +7 -11
  609. package/src/core/ai/context/context.ts +2 -0
  610. package/src/core/ai/context/providers/__tests__/cell-output.test.ts +121 -47
  611. package/src/core/ai/context/providers/__tests__/cell.test.ts +49 -0
  612. package/src/core/ai/context/providers/__tests__/error.test.ts +74 -191
  613. package/src/core/ai/context/providers/cell-output.ts +13 -8
  614. package/src/core/ai/context/providers/cell.ts +54 -0
  615. package/src/core/ai/context/providers/datasource.ts +6 -2
  616. package/src/core/ai/staged-cells.ts +56 -323
  617. package/src/core/ai/state.ts +3 -0
  618. package/src/core/ai/tools/__tests__/edit-notebook-tool.test.ts +47 -93
  619. package/src/core/ai/tools/__tests__/registry.test.ts +17 -0
  620. package/src/core/ai/tools/base.ts +18 -15
  621. package/src/core/ai/tools/edit-notebook-tool.ts +86 -80
  622. package/src/core/ai/tools/registry.ts +13 -10
  623. package/src/core/ai/tools/sample-tool.ts +6 -7
  624. package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +14 -632
  625. package/src/core/cells/__tests__/actions.test.ts +623 -35
  626. package/src/core/cells/__tests__/add-missing-import.test.ts +7 -8
  627. package/src/core/cells/__tests__/arrange.test.ts +432 -0
  628. package/src/core/cells/__tests__/cell.test.ts +148 -150
  629. package/src/core/cells/__tests__/cells.test.ts +758 -3505
  630. package/src/core/cells/__tests__/clear-outputs.test.ts +151 -0
  631. package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +69 -0
  632. package/src/core/cells/__tests__/document.test.ts +158 -0
  633. package/src/core/cells/__tests__/editor.test.ts +57 -0
  634. package/src/core/cells/__tests__/error-report.test.ts +139 -0
  635. package/src/core/cells/__tests__/flush-document.test.ts +42 -0
  636. package/src/core/cells/__tests__/harness.ts +110 -0
  637. package/src/core/cells/__tests__/layout.test.ts +170 -0
  638. package/src/core/cells/__tests__/logs.test.ts +0 -13
  639. package/src/core/cells/__tests__/notebook-outline.test.ts +128 -0
  640. package/src/core/cells/__tests__/outputs.test.tsx +71 -53
  641. package/src/core/cells/__tests__/pending-delete-service.test.tsx +11 -20
  642. package/src/core/cells/__tests__/session.test.ts +578 -314
  643. package/src/core/cells/__tests__/utils.test.ts +156 -337
  644. package/src/core/cells/actions.ts +717 -6
  645. package/src/core/cells/add-missing-import.ts +48 -47
  646. package/src/core/cells/arrange.ts +529 -0
  647. package/src/core/cells/cell.ts +71 -151
  648. package/src/core/cells/cells.ts +146 -1507
  649. package/src/core/cells/columns.ts +38 -0
  650. package/src/core/cells/document.ts +167 -0
  651. package/src/core/cells/edit.ts +30 -0
  652. package/src/core/cells/editor.ts +82 -0
  653. package/src/core/cells/error-report.ts +63 -0
  654. package/src/core/cells/focus.ts +33 -7
  655. package/src/core/cells/layout.ts +220 -0
  656. package/src/core/cells/outputs.ts +14 -30
  657. package/src/core/cells/pending-delete-service.ts +8 -14
  658. package/src/core/cells/scrollCellIntoView.ts +6 -0
  659. package/src/core/cells/session.ts +176 -86
  660. package/src/core/cells/types.ts +25 -57
  661. package/src/core/cells/utils.ts +93 -88
  662. package/src/core/codemirror/__tests__/format.test.ts +4 -36
  663. package/src/core/codemirror/__tests__/setup.test.ts +67 -34
  664. package/src/core/codemirror/ai/__tests__/resources.test.ts +113 -0
  665. package/src/core/codemirror/ai/resources.ts +1 -1
  666. package/src/core/codemirror/cells/__tests__/extensions.test.ts +2 -6
  667. package/src/core/codemirror/cells/extensions.ts +18 -30
  668. package/src/core/codemirror/cells/state.ts +2 -6
  669. package/src/core/codemirror/cm.ts +5 -1
  670. package/src/core/codemirror/config/types.ts +1 -1
  671. package/src/core/codemirror/copilot/__tests__/completion-integration.test.ts +4 -0
  672. package/src/core/codemirror/copilot/__tests__/getCodes.test.ts +13 -12
  673. package/src/core/codemirror/copilot/extension.ts +0 -26
  674. package/src/core/codemirror/copilot/getCodes.ts +3 -3
  675. package/src/core/codemirror/format.ts +6 -23
  676. package/src/core/codemirror/keymaps/vim.ts +4 -8
  677. package/src/core/codemirror/language/__tests__/extension.test.ts +9 -7
  678. package/src/core/codemirror/language/__tests__/sql-literals.test.ts +588 -0
  679. package/src/core/codemirror/language/__tests__/sql.test.ts +123 -28
  680. package/src/core/codemirror/language/__tests__/utils.test.ts +194 -19
  681. package/src/core/codemirror/language/cell-code.ts +114 -0
  682. package/src/core/codemirror/language/extension.ts +52 -35
  683. package/src/core/codemirror/language/languages/markdown.ts +8 -6
  684. package/src/core/codemirror/language/languages/python.ts +19 -13
  685. package/src/core/codemirror/language/languages/sql/completion-builder.ts +31 -14
  686. package/src/core/codemirror/language/languages/sql/completion-context.ts +197 -0
  687. package/src/core/codemirror/language/languages/sql/completion-sources.tsx +109 -0
  688. package/src/core/codemirror/language/languages/sql/sql.ts +21 -28
  689. package/src/core/codemirror/language/panel/panel.tsx +1 -0
  690. package/src/core/codemirror/language/types.ts +7 -7
  691. package/src/core/codemirror/language/utils.ts +9 -39
  692. package/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts +1 -2
  693. package/src/core/codemirror/lsp/notebook-lsp.ts +6 -5
  694. package/src/core/codemirror/lsp/utils.ts +1 -1
  695. package/src/core/codemirror/misc/__tests__/paste.test.ts +3 -1
  696. package/src/core/codemirror/misc/paste.ts +1 -1
  697. package/src/core/codemirror/placeholder/__tests__/extensions.test.ts +75 -0
  698. package/src/core/codemirror/placeholder/extensions.ts +80 -19
  699. package/src/core/codemirror/readonly/__tests__/extension.test.ts +1 -1
  700. package/src/core/codemirror/readonly/extension.ts +2 -2
  701. package/src/core/codemirror/utils.ts +1 -0
  702. package/src/core/config/__tests__/app-config.test.ts +64 -0
  703. package/src/core/config/__tests__/config-schema.test.ts +195 -17
  704. package/src/core/config/config-schema.ts +137 -20
  705. package/src/core/config/config.ts +65 -20
  706. package/src/core/config/feature-flag.tsx +0 -2
  707. package/src/core/config/pair.ts +5 -3
  708. package/src/core/constants.ts +0 -6
  709. package/src/core/datasets/__tests__/data-source-discovery.test.ts +5 -5
  710. package/src/core/datasets/data-source-discovery.ts +4 -6
  711. package/src/core/documentation/doc-lookup.ts +1 -1
  712. package/src/core/dom/outline.ts +4 -1
  713. package/src/core/edit-app.tsx +28 -38
  714. package/src/core/errors/__tests__/error-entries.test.ts +74 -1
  715. package/src/core/errors/error-entries.ts +26 -14
  716. package/src/core/executions/__tests__/atoms.test.ts +282 -0
  717. package/src/core/executions/__tests__/freshness.test.ts +485 -0
  718. package/src/core/executions/__tests__/hooks.test.tsx +154 -0
  719. package/src/core/executions/__tests__/input.test.ts +86 -0
  720. package/src/core/executions/__tests__/interrupt.test.ts +202 -0
  721. package/src/core/executions/__tests__/output-lifecycle.test.ts +201 -0
  722. package/src/core/executions/__tests__/output.test.ts +350 -0
  723. package/src/core/executions/__tests__/run.test.ts +387 -0
  724. package/src/core/executions/__tests__/select.test.ts +379 -0
  725. package/src/core/executions/atoms.ts +437 -0
  726. package/src/core/executions/freshness.ts +171 -0
  727. package/src/core/executions/hooks.ts +96 -0
  728. package/src/core/executions/index.ts +56 -0
  729. package/src/core/executions/input.ts +55 -0
  730. package/src/core/executions/interrupt.ts +49 -0
  731. package/src/core/executions/output.ts +326 -0
  732. package/src/core/executions/run.ts +107 -0
  733. package/src/core/executions/select.ts +225 -0
  734. package/src/core/export/__tests__/hooks.test.ts +20 -34
  735. package/src/core/export/hooks.ts +8 -10
  736. package/src/core/export/layout.ts +2 -2
  737. package/src/core/hotkeys/actions.ts +2 -4
  738. package/src/core/hotkeys/hotkeys.ts +2 -1
  739. package/src/core/islands/__tests__/bootstrap.test.ts +69 -17
  740. package/src/core/islands/__tests__/bridge.test.ts +104 -65
  741. package/src/core/islands/__tests__/iframe-resizer.test.ts +91 -0
  742. package/src/core/islands/__tests__/main.test.ts +17 -0
  743. package/src/core/islands/bootstrap.ts +54 -55
  744. package/src/core/islands/bridge.ts +88 -43
  745. package/src/core/islands/components/IslandControls.tsx +15 -7
  746. package/src/core/islands/components/__tests__/IslandControls.test.tsx +36 -51
  747. package/src/core/islands/components/__tests__/web-components.test.tsx +76 -15
  748. package/src/core/islands/components/output-wrapper.tsx +19 -24
  749. package/src/core/islands/components/web-components.tsx +12 -1
  750. package/src/core/islands/iframe-resizer.ts +38 -0
  751. package/src/core/islands/main.ts +3 -0
  752. package/src/core/islands/stubs/slide-cell-view.tsx +2 -5
  753. package/src/core/islands/worker/__tests__/controller.test.ts +62 -4
  754. package/src/core/islands/worker/controller.ts +4 -10
  755. package/src/core/islands/worker/worker.tsx +78 -52
  756. package/src/core/kernel/__tests__/RuntimeState.test.ts +1 -1
  757. package/src/core/kernel/__tests__/handlers.test.ts +7 -157
  758. package/src/core/kernel/handlers.ts +13 -79
  759. package/src/core/kernel/state.ts +0 -15
  760. package/src/core/lifecycle/render-policy.ts +16 -27
  761. package/src/core/meta/__tests__/code-visibility.test.tsx +78 -70
  762. package/src/core/meta/code-visibility.ts +18 -9
  763. package/src/core/network/__tests__/ai.test.ts +41 -0
  764. package/src/core/network/__tests__/connection.test.ts +1 -1
  765. package/src/core/network/__tests__/requests-network.test.ts +0 -16
  766. package/src/core/network/__tests__/requests-toasting.test.tsx +7 -7
  767. package/src/core/network/ai.ts +12 -0
  768. package/src/core/network/connection-notice.ts +1 -1
  769. package/src/core/network/connection.ts +5 -8
  770. package/src/core/network/requests-network.ts +5 -55
  771. package/src/core/network/requests-static.ts +1 -7
  772. package/src/core/network/requests-toasting.tsx +2 -56
  773. package/src/core/network/resolve.ts +1 -5
  774. package/src/core/network/types.ts +6 -19
  775. package/src/core/network/useConnectionNotice.ts +8 -2
  776. package/src/core/notebook/__tests__/operations.test.ts +51 -0
  777. package/src/core/notebook/attachments.ts +38 -0
  778. package/src/core/notebook/document/__tests__/codemirror.test.ts +767 -0
  779. package/src/core/notebook/document/__tests__/draft.test.ts +363 -0
  780. package/src/core/notebook/document/__tests__/fixtures.ts +92 -0
  781. package/src/core/notebook/document/__tests__/hooks.test.tsx +392 -0
  782. package/src/core/notebook/document/__tests__/lifecycle-scenarios.test.ts +61 -0
  783. package/src/core/notebook/document/__tests__/model.test.ts +252 -0
  784. package/src/core/notebook/document/__tests__/protocol-fixtures.ts +38 -0
  785. package/src/core/notebook/document/__tests__/recovery-scenarios.test.ts +230 -0
  786. package/src/core/notebook/document/__tests__/scenario-fixture.ts +44 -0
  787. package/src/core/notebook/document/__tests__/scenarios.test.ts +266 -0
  788. package/src/core/notebook/document/__tests__/state.test.ts +460 -0
  789. package/src/core/notebook/document/__tests__/submission.test.ts +204 -0
  790. package/src/core/notebook/document/__tests__/test-host.test.ts +92 -0
  791. package/src/core/notebook/document/__tests__/test-host.ts +243 -0
  792. package/src/core/notebook/document/__tests__/test-notebook.ts +162 -0
  793. package/src/core/notebook/document/__tests__/user.ts +61 -0
  794. package/src/core/notebook/document/codemirror.ts +216 -0
  795. package/src/core/notebook/document/draft.ts +502 -0
  796. package/src/core/notebook/document/hooks.tsx +118 -0
  797. package/src/core/notebook/document/index.ts +24 -0
  798. package/src/core/notebook/document/model.ts +105 -0
  799. package/src/core/notebook/document/select.ts +41 -0
  800. package/src/core/notebook/document/state.ts +401 -0
  801. package/src/core/notebook/document/sync.ts +376 -0
  802. package/src/core/notebook/index.ts +19 -0
  803. package/src/core/notebook/operations.ts +30 -0
  804. package/src/core/notebook/replica/AGENTS.md +11 -0
  805. package/src/core/notebook/replica/__tests__/attachments.test.ts +56 -0
  806. package/src/core/notebook/replica/__tests__/document.test.ts +131 -0
  807. package/src/core/notebook/replica/__tests__/executions.test.ts +200 -0
  808. package/src/core/notebook/replica/__tests__/fixtures.ts +103 -0
  809. package/src/core/notebook/replica/__tests__/replica.test.ts +642 -0
  810. package/src/core/notebook/replica/__tests__/results.test.ts +222 -0
  811. package/src/core/notebook/replica/__tests__/runtime.test.ts +78 -0
  812. package/src/core/notebook/replica/backend.ts +21 -0
  813. package/src/core/notebook/replica/connection.ts +38 -0
  814. package/src/core/notebook/replica/index.ts +20 -0
  815. package/src/core/notebook/replica/replica.ts +398 -0
  816. package/src/core/notebook/replica/resources/attachments.ts +22 -0
  817. package/src/core/notebook/replica/resources/document.ts +101 -0
  818. package/src/core/notebook/replica/resources/executions.ts +248 -0
  819. package/src/core/notebook/replica/resources/results.ts +63 -0
  820. package/src/core/notebook/replica/resources/runtime.ts +14 -0
  821. package/src/core/packages/__tests__/useSandboxController.test.tsx +1 -1
  822. package/src/core/packages/useSandboxController.ts +1 -1
  823. package/src/core/run-app.tsx +49 -51
  824. package/src/core/runtime/__tests__/adapter.test.ts +4 -4
  825. package/src/core/runtime/__tests__/createWsUrl.test.ts +70 -12
  826. package/src/core/runtime/__tests__/runtime.test.ts +83 -157
  827. package/src/core/runtime/adapter.ts +6 -13
  828. package/src/core/runtime/config.ts +4 -24
  829. package/src/core/runtime/runtime.ts +35 -44
  830. package/src/core/runtime/types.ts +0 -5
  831. package/src/core/saving/__tests__/document.test.tsx +123 -0
  832. package/src/core/saving/__tests__/state.test.ts +111 -0
  833. package/src/core/saving/__tests__/useAutoSave.test.tsx +67 -0
  834. package/src/core/saving/document.ts +33 -0
  835. package/src/core/saving/filename.ts +1 -1
  836. package/src/core/saving/save-component.tsx +39 -60
  837. package/src/core/saving/state.ts +38 -39
  838. package/src/core/saving/useAutoSave.ts +17 -53
  839. package/src/core/session/__tests__/backend.test.ts +236 -0
  840. package/src/core/session/__tests__/useNotebookReplica.hook.test.tsx +186 -0
  841. package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +791 -0
  842. package/src/core/session/active-notebook.ts +29 -0
  843. package/src/core/session/backend.ts +123 -0
  844. package/src/core/{websocket → session}/connection-utils.ts +2 -14
  845. package/src/core/session/embedded.ts +7 -0
  846. package/src/core/session/types.ts +17 -0
  847. package/src/core/session/useNotebookReplica.ts +74 -0
  848. package/src/core/{websocket/useMarimoKernelConnection.tsx → session/useNotebookSession.tsx} +138 -283
  849. package/src/core/state/__tests__/jotai.test.tsx +108 -0
  850. package/src/core/state/jotai.ts +1 -1
  851. package/src/core/static/__tests__/files.test.ts +38 -10
  852. package/src/core/static/files.ts +2 -0
  853. package/src/core/{websocket/__tests__/useMarimoKernelConnection.test.ts → transports/__tests__/connection-state.test.ts} +16 -30
  854. package/src/core/transports/__tests__/server.test.ts +412 -0
  855. package/src/core/transports/__tests__/static.test.ts +342 -0
  856. package/src/core/transports/__tests__/wasm.test.ts +166 -0
  857. package/src/core/transports/connection-state.ts +63 -0
  858. package/src/core/transports/server.ts +152 -0
  859. package/src/core/transports/static.ts +180 -0
  860. package/src/core/transports/wasm.ts +95 -0
  861. package/src/core/vscode/__tests__/vscode-bindings.test.ts +125 -0
  862. package/src/core/vscode/vscode-bindings.ts +14 -2
  863. package/src/core/wasm/__tests__/bridge.test.ts +354 -64
  864. package/src/core/wasm/__tests__/worker.test.ts +191 -0
  865. package/src/core/wasm/bridge.ts +167 -92
  866. package/src/core/wasm/rpc.ts +15 -3
  867. package/src/core/wasm/store.ts +3 -3
  868. package/src/core/wasm/worker/bootstrap.ts +55 -51
  869. package/src/core/wasm/worker/getMarimoWheel.ts +1 -1
  870. package/src/core/wasm/worker/save-worker.ts +9 -10
  871. package/src/core/wasm/worker/types.ts +31 -19
  872. package/src/core/wasm/worker/worker.ts +120 -72
  873. package/src/css/app/Cell.css +7 -36
  874. package/src/css/app/codemirror.css +1 -32
  875. package/src/css/common.css +1 -1
  876. package/src/css/globals.css +72 -24
  877. package/src/css/katex.min.css +1 -1
  878. package/src/hooks/__tests__/useAsyncData.test.tsx +148 -0
  879. package/src/hooks/__tests__/useDebounce.test.tsx +51 -0
  880. package/src/hooks/__tests__/useDeepCompareMemoize.test.tsx +39 -0
  881. package/src/hooks/__tests__/useDelayElapsed.test.tsx +28 -0
  882. package/src/hooks/__tests__/useInternalStateWithSync.test.tsx +20 -0
  883. package/src/hooks/__tests__/useScript.test.tsx +77 -0
  884. package/src/hooks/__tests__/useStateForKey.test.tsx +257 -0
  885. package/src/hooks/useAsyncData.ts +3 -3
  886. package/src/hooks/useDataSourceDiscovery.ts +6 -4
  887. package/src/hooks/useDebounce.ts +6 -10
  888. package/src/hooks/useDeepCompareMemoize.ts +1 -1
  889. package/src/hooks/useDelayElapsed.ts +14 -10
  890. package/src/hooks/useElapsedTime.ts +3 -3
  891. package/src/hooks/useEventListener.ts +1 -2
  892. package/src/hooks/useInputHistory.ts +4 -7
  893. package/src/hooks/useInternalStateWithSync.ts +6 -6
  894. package/src/hooks/useResizeObserver.ts +4 -7
  895. package/src/hooks/useScript.ts +67 -70
  896. package/src/hooks/useStateForKey.ts +93 -0
  897. package/src/mount.tsx +25 -22
  898. package/src/plugins/__tests__/plugin-object-schemas.test.ts +104 -0
  899. package/src/plugins/core/RenderHTML.tsx +3 -5
  900. package/src/plugins/core/__test__/PluginSlot.test.tsx +202 -0
  901. package/src/plugins/core/__test__/RenderHTML-copy.test.tsx +60 -0
  902. package/src/plugins/core/__test__/registerReactComponent.test.ts +45 -0
  903. package/src/plugins/core/__test__/sanitize.test.ts +8 -0
  904. package/src/plugins/core/registerReactComponent.tsx +29 -29
  905. package/src/plugins/core/sanitize-html.ts +6 -0
  906. package/src/plugins/impl/CodeEditorPlugin.tsx +1 -1
  907. package/src/plugins/impl/DataEditorPlugin.tsx +60 -28
  908. package/src/plugins/impl/DataTablePlugin.tsx +69 -37
  909. package/src/plugins/impl/DropdownPlugin.tsx +2 -6
  910. package/src/plugins/impl/FileBrowserPlugin.tsx +4 -16
  911. package/src/plugins/impl/FormPlugin.tsx +1 -1
  912. package/src/plugins/impl/RangeSliderPlugin.tsx +16 -2
  913. package/src/plugins/impl/RefreshPlugin.tsx +1 -0
  914. package/src/plugins/impl/SliderPlugin.tsx +41 -11
  915. package/src/plugins/impl/__test__/slider-labels.test.tsx +30 -0
  916. package/src/plugins/impl/__tests__/DataEditorPlugin.test.ts +190 -10
  917. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +471 -1
  918. package/src/plugins/impl/__tests__/FileBrowserPlugin.test.tsx +45 -0
  919. package/src/plugins/impl/__tests__/RangeSliderPlugin.test.tsx +109 -0
  920. package/src/plugins/impl/__tests__/SliderPlugin.test.tsx +64 -3
  921. package/src/plugins/impl/anywidget/__tests__/registry.test.ts +153 -0
  922. package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +241 -2
  923. package/src/plugins/impl/anywidget/model.ts +3 -1
  924. package/src/plugins/impl/anywidget/registry.ts +18 -14
  925. package/src/plugins/impl/anywidget/runtime.ts +21 -9
  926. package/src/plugins/impl/anywidget/widget-binding.ts +160 -82
  927. package/src/plugins/impl/chat/__tests__/chat-prompts.test.tsx +93 -0
  928. package/src/plugins/impl/chat/chat-ui.tsx +17 -15
  929. package/src/plugins/impl/code/any-language-editor.tsx +2 -2
  930. package/src/plugins/impl/common/error-banner.tsx +5 -3
  931. package/src/plugins/impl/data-editor/__tests__/column-types.test.ts +42 -0
  932. package/src/plugins/impl/data-editor/__tests__/editor-state.test.ts +52 -1
  933. package/src/plugins/impl/data-editor/__tests__/glide-data-editor.test.tsx +278 -7
  934. package/src/plugins/impl/data-editor/__tests__/glide-utils.test.ts +116 -0
  935. package/src/plugins/impl/data-editor/column-types.ts +55 -0
  936. package/src/plugins/impl/data-editor/editor-state.ts +18 -2
  937. package/src/plugins/impl/data-editor/glide-data-editor.tsx +104 -22
  938. package/src/plugins/impl/data-editor/glide-portal.tsx +5 -3
  939. package/src/plugins/impl/data-editor/glide-utils.ts +39 -38
  940. package/src/plugins/impl/data-editor/types.ts +5 -0
  941. package/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx +1 -1
  942. package/src/plugins/impl/data-explorer/components/column-summary.tsx +4 -2
  943. package/src/plugins/impl/data-explorer/functions/types.ts +1 -5
  944. package/src/plugins/impl/data-explorer/state/reducer.ts +1 -1
  945. package/src/plugins/impl/data-frames/DataFramePlugin.tsx +1 -2
  946. package/src/plugins/impl/data-frames/__tests__/sidebar.test.tsx +160 -0
  947. package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +66 -66
  948. package/src/plugins/impl/data-frames/panel.tsx +44 -16
  949. package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +5 -3
  950. package/src/plugins/impl/panel/PanelPlugin.tsx +16 -17
  951. package/src/plugins/impl/panel/__tests__/utils.test.ts +39 -1
  952. package/src/plugins/impl/panel/utils.ts +17 -0
  953. package/src/plugins/impl/plotly/PlotlyPlugin.tsx +2 -5
  954. package/src/plugins/impl/plotly/selection.ts +25 -19
  955. package/src/plugins/impl/vega/VegaPlugin.tsx +2 -3
  956. package/src/plugins/impl/vega/make-selectable.ts +4 -7
  957. package/src/plugins/layout/AccordionPlugin.tsx +2 -1
  958. package/src/plugins/layout/DownloadPlugin.tsx +7 -11
  959. package/src/plugins/layout/LazyPlugin.tsx +7 -4
  960. package/src/plugins/layout/RoutesPlugin.tsx +1 -1
  961. package/src/plugins/layout/TexPlugin.tsx +0 -1
  962. package/src/plugins/layout/__test__/DownloadPlugin.test.tsx +205 -0
  963. package/src/plugins/layout/__test__/mermaid.test.tsx +256 -0
  964. package/src/plugins/layout/__tests__/AccordionPlugin.test.tsx +21 -0
  965. package/src/plugins/layout/__tests__/LazyPlugin.test.tsx +98 -0
  966. package/src/plugins/layout/mermaid/mermaid.tsx +63 -17
  967. package/src/stories/__tests__/editor-story.test.tsx +33 -0
  968. package/src/stories/button.stories.tsx +1 -0
  969. package/src/stories/cell-status.stories.tsx +29 -24
  970. package/src/stories/cell.stories.tsx +67 -57
  971. package/src/stories/data-table.stories.tsx +31 -0
  972. package/src/stories/editor.stories.tsx +28 -18
  973. package/src/stories/form-wrapper.stories.tsx +2 -2
  974. package/src/stories/layout/vertical/one-column.stories.tsx +43 -49
  975. package/src/stories/runtime-story.tsx +23 -17
  976. package/src/stories/select.stories.tsx +2 -2
  977. package/src/stories/switchable-multi-select.stories.tsx +1 -1
  978. package/src/stories/theme.stories.tsx +4 -2
  979. package/src/theme/__tests__/islands-theme.test.tsx +276 -0
  980. package/src/theme/__tests__/useTheme.test.ts +9 -38
  981. package/src/theme/namespace.tsx +4 -3
  982. package/src/theme/useTheme.ts +70 -55
  983. package/src/utils/__tests__/arrays.test.ts +35 -0
  984. package/src/utils/__tests__/batch-requests.test.ts +3 -3
  985. package/src/utils/__tests__/{createReducer.test.ts → createReducer.test.tsx} +127 -1
  986. package/src/utils/__tests__/download.test.tsx +183 -23
  987. package/src/utils/__tests__/numbers.test.ts +105 -1
  988. package/src/utils/__tests__/objects.test.ts +21 -0
  989. package/src/utils/arrays.ts +11 -2
  990. package/src/utils/blob.ts +1 -1
  991. package/src/utils/createReducer.ts +115 -79
  992. package/src/utils/download.ts +67 -6
  993. package/src/utils/errors.ts +0 -7
  994. package/src/utils/maps.ts +0 -3
  995. package/src/utils/numbers.ts +79 -18
  996. package/src/utils/objects.ts +4 -9
  997. package/src/utils/once.ts +19 -19
  998. package/src/utils/time.ts +10 -0
  999. package/src/utils/tracer.ts +9 -5
  1000. package/src/utils/zod-utils.ts +1 -3
  1001. package/dist/_baseMerge-BiGRwuqv.js +0 -165
  1002. package/dist/any-language-editor-B9REGlD9.js +0 -76
  1003. package/dist/architecture-7GRP2DOG-BWLylgiA.js +0 -3
  1004. package/dist/assets/__vite-browser-external-BXYkiFsk.js +0 -1
  1005. package/dist/assets/worker-HPY9fbhz.js +0 -114
  1006. package/dist/classDiagram-ZZMXUADV-Bt98lkkv.js +0 -30
  1007. package/dist/classDiagram-v2-VYDZK3BY-D9bfbcC3.js +0 -30
  1008. package/dist/code-visibility-Lu0dkrFO.js +0 -138
  1009. package/dist/cynefin-OW5HDTMX-obq-i80l.js +0 -3
  1010. package/dist/dropdown-menu-CP_qCYHC.js +0 -4678
  1011. package/dist/duckdb-keywords-BGArYVVK.js +0 -3
  1012. package/dist/error-entries-CzoYkIQZ.js +0 -56
  1013. package/dist/eventmodeling-NTZA5JFV-D7nP7Uyu.js +0 -3
  1014. package/dist/feedback-button-DQA-pzxi.js +0 -380
  1015. package/dist/flowDiagram-HODETNUW-CAYbpJmV.js +0 -16
  1016. package/dist/gitGraph-4MIJSDKK-Dy9uQXGh.js +0 -3
  1017. package/dist/hasIn-o2Us0uVx.js +0 -132
  1018. package/dist/highlighted-body-KPVGNVTW-zwjq21tf.js +0 -38
  1019. package/dist/html-to-image-CZY1pIZH.js +0 -3251
  1020. package/dist/info-A6RAGUB7-DKoayiHY.js +0 -3
  1021. package/dist/isArrayLikeObject-BZl-15ir.js +0 -450
  1022. package/dist/isEmpty-BSZ1LaUo.js +0 -35
  1023. package/dist/isSymbol-kQcfYbNX.js +0 -8
  1024. package/dist/label-BDKF3Afc.js +0 -281
  1025. package/dist/mermaid-HWGCJPDP-ByCsZnYF.js +0 -2
  1026. package/dist/packet-AYTQ26CC-Yw7ajchJ.js +0 -3
  1027. package/dist/pick-CJeoxYOS.js +0 -51
  1028. package/dist/pie-WAS4IAKB-BKdKOAkL.js +0 -3
  1029. package/dist/purify.es-DMv5zIkJ.js +0 -866
  1030. package/dist/radar-RG4KPBEZ-ScR_D_Ts.js +0 -3
  1031. package/dist/railroad-74A4TZTK-DQvPSdo5.js +0 -3
  1032. package/dist/railroad-abnf-HS5TGJTU-CsJQG2O8.js +0 -3
  1033. package/dist/railroad-ebnf-LZEXJU2U-BgEobkSn.js +0 -3
  1034. package/dist/railroad-peg-WCYAUIDC-DjLAjofI.js +0 -3
  1035. package/dist/select-BButFi-d.js +0 -1344
  1036. package/dist/stateDiagram-v2-MP3YSRHH-CISYxma6.js +0 -30
  1037. package/dist/swimlanesDiagram-VR7AAH4N-c8G5pGxC.js +0 -30
  1038. package/dist/toast-B9UMEi8u.js +0 -1830
  1039. package/dist/treeView-Q6P3EWNA-DuRV97YF.js +0 -3
  1040. package/dist/treemap-WGGIJYW6-AsLq-uwC.js +0 -3
  1041. package/dist/use-restore-focus-BEM7sFWl.js +0 -6369
  1042. package/dist/useLifecycle-j7D9uD1o.js +0 -169
  1043. package/dist/useTheme-CRnjkku0.js +0 -904
  1044. package/dist/wardley-WFR3VGLG-Na-tFhQJ.js +0 -3
  1045. package/src/components/chat/reasoning-accordion.tsx +0 -61
  1046. package/src/components/chat/tool-call/tool-error-card.tsx +0 -81
  1047. package/src/components/chat/tool-call/tool-history-row.tsx +0 -174
  1048. package/src/components/editor/ai/__tests__/staged-cell-submission.test.ts +0 -106
  1049. package/src/components/editor/ai/add-cell-with-ai.tsx +0 -506
  1050. package/src/components/editor/ai/staged-cell-submission.ts +0 -46
  1051. package/src/components/editor/alerts/connecting-alert.tsx +0 -27
  1052. package/src/components/editor/cell/__tests__/StagedAICell.test.tsx +0 -64
  1053. package/src/components/editor/cell/code/__tests__/rtc-editor-config.test.ts +0 -50
  1054. package/src/components/editor/chrome/wrapper/footer-items/rtc-status.tsx +0 -65
  1055. package/src/components/editor/navigation/__tests__/state.test.ts +0 -81
  1056. package/src/components/editor/navigation/state.ts +0 -65
  1057. package/src/components/icons/loading-ellipsis.tsx +0 -46
  1058. package/src/core/ai/tools/__tests__/run-cells-tool.test.ts +0 -656
  1059. package/src/core/ai/tools/run-cells-tool.ts +0 -303
  1060. package/src/core/cells/__tests__/apply-transaction.test.ts +0 -991
  1061. package/src/core/cells/__tests__/document-changes.test.ts +0 -1140
  1062. package/src/core/cells/__tests__/document-roundtrip.test.ts +0 -392
  1063. package/src/core/cells/document-changes.ts +0 -944
  1064. package/src/core/codemirror/rtc/extension.ts +0 -453
  1065. package/src/core/codemirror/rtc/loro/__tests__/sync.test.ts +0 -52
  1066. package/src/core/codemirror/rtc/loro/awareness.ts +0 -531
  1067. package/src/core/codemirror/rtc/loro/colors.ts +0 -38
  1068. package/src/core/codemirror/rtc/loro/sync.ts +0 -168
  1069. package/src/core/host/AGENTS.md +0 -6
  1070. package/src/core/host/__tests__/protocol.test.ts +0 -214
  1071. package/src/core/host/protocol.ts +0 -1943
  1072. package/src/core/network/__tests__/requests-lazy.test.ts +0 -334
  1073. package/src/core/network/requests-lazy.ts +0 -226
  1074. package/src/core/rtc/state.ts +0 -34
  1075. package/src/core/state/__tests__/jotai.test.ts +0 -25
  1076. package/src/core/wasm/worker/message-buffer.ts +0 -33
  1077. package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +0 -596
  1078. package/src/core/websocket/__tests__/useWebSocket.test.ts +0 -49
  1079. package/src/core/websocket/transports/__tests__/basic.test.ts +0 -275
  1080. package/src/core/websocket/transports/__tests__/sse.test.ts +0 -338
  1081. package/src/core/websocket/transports/__tests__/transport.test.ts +0 -308
  1082. package/src/core/websocket/transports/__tests__/ws.test.ts +0 -125
  1083. package/src/core/websocket/transports/basic.ts +0 -102
  1084. package/src/core/websocket/transports/sse.ts +0 -308
  1085. package/src/core/websocket/transports/transport.ts +0 -61
  1086. package/src/core/websocket/transports/ws.ts +0 -98
  1087. package/src/core/websocket/types.ts +0 -47
  1088. package/src/core/websocket/useWebSocket.tsx +0 -88
  1089. package/src/utils/__tests__/id-tree.test.ts +0 -2145
  1090. package/src/utils/id-tree.tsx +0 -1134
@@ -0,0 +1,2788 @@
1
+ import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
+ import { g as t, h as n, p as r } from "./button-qQhINE7z.js";
3
+ import { t as i } from "./react-Bgs_wQh3.js";
4
+ import { t as a } from "./compiler-runtime-C5KHtL5D.js";
5
+ import { i as o } from "./copy-icon-BKcX0ltw.js";
6
+ import { f as s, h as c } from "./tooltip-Bg-SDCwa.js";
7
+ import { t as l } from "./check-ywinAQy6.js";
8
+ import { n as u, r as d } from "./assertNever-DXGfUmPW.js";
9
+ import { t as f } from "./jsx-runtime-D8btoEHk.js";
10
+ import { At as p, Et as m, Lt as h, Pt as g, St as _, Tt as v, _t as y, bt as b, cn as x, f as S, fn as ee, jt as te, kt as ne, ln as re, pn as ie, un as ae, vt as C, xt as oe } from "./use-restore-focus-CE9Sflmg.js";
11
+ import { n as se } from "./toast-Crofa36R.js";
12
+ import { t as ce } from "./objects-DCmMvZtn.js";
13
+ import { t as w } from "./invariant-DLmrl-hA.js";
14
+ import { t as le } from "./purify.es-DmnrIjg4.js";
15
+ import { t as ue } from "./createReducer-Bjx6kuxh.js";
16
+ import { H as de, N as fe, P as pe, _ as me } from "./dist-D92tYjLc.js";
17
+ import { _ as he, a as ge, i as _e, l as ve, p as ye } from "./static-state-CnQdTBTW.js";
18
+ import { t as be } from "./capabilities-DKqMqBzm.js";
19
+ var xe = c("external-link", [
20
+ ["path", {
21
+ d: "M15 3h6v6",
22
+ key: "1q9fwt"
23
+ }],
24
+ ["path", {
25
+ d: "M10 14 21 3",
26
+ key: "gplh6r"
27
+ }],
28
+ ["path", {
29
+ d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",
30
+ key: "a6xqqp"
31
+ }]
32
+ ]), Se = c("minus", [["path", {
33
+ d: "M5 12h14",
34
+ key: "1ays0h"
35
+ }]]), T = /* @__PURE__ */ e(i(), 1), E = f(), Ce = Object.defineProperty, D = (e, t) => Ce(e, "name", {
36
+ value: t,
37
+ configurable: !0
38
+ }), we = "Checkbox", [Te, Ee] = ee(we), [De, Oe] = Te(we);
39
+ function ke(e) {
40
+ let { __scopeCheckbox: t, checked: n, children: r, defaultChecked: i, disabled: a, form: o, name: s, onCheckedChange: c, required: l, value: u = "on", internal_do_not_use_render: d } = e, [f, p] = re({
41
+ prop: n,
42
+ defaultProp: i ?? !1,
43
+ onChange: c,
44
+ caller: we
45
+ }), [m, h] = T.useState(null), [g, _] = T.useState(null), [v, y] = T.useState(null), b = !m || !!o || !!m.closest("form"), x = {
46
+ checked: f,
47
+ disabled: a,
48
+ setChecked: p,
49
+ control: m,
50
+ setControl: h,
51
+ name: s,
52
+ form: o,
53
+ value: u,
54
+ userClick: v,
55
+ onUserClick: y,
56
+ required: l,
57
+ defaultChecked: !O(i) && i,
58
+ isFormControl: b,
59
+ bubbleInput: g,
60
+ setBubbleInput: _
61
+ };
62
+ return /* @__PURE__ */ (0, E.jsx)(De, {
63
+ scope: t,
64
+ ...x,
65
+ children: Le(d) ? d(x) : r
66
+ });
67
+ }
68
+ D(ke, "CheckboxProvider");
69
+ var Ae = "CheckboxTrigger", je = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...i }, a) {
70
+ let { control: o, value: s, disabled: c, checked: l, required: u, setControl: d, setChecked: f, onUserClick: p, isFormControl: m, bubbleInput: h } = Oe(Ae, e), g = r(a, d), _ = T.useRef(l);
71
+ return T.useEffect(() => {
72
+ let e = o?.form;
73
+ if (e) {
74
+ let t = /* @__PURE__ */ D(() => f(_.current), "reset");
75
+ return e.addEventListener("reset", t), () => e.removeEventListener("reset", t);
76
+ }
77
+ }, [o, f]), /* @__PURE__ */ (0, E.jsx)(ie.button, {
78
+ type: "button",
79
+ role: "checkbox",
80
+ "aria-checked": O(l) ? "mixed" : l,
81
+ "aria-required": u,
82
+ "data-state": Re(l),
83
+ "data-disabled": c ? "" : void 0,
84
+ disabled: c,
85
+ value: s,
86
+ ...i,
87
+ ref: g,
88
+ onKeyDown: ae(t, (e) => {
89
+ e.key === "Enter" && e.preventDefault();
90
+ }),
91
+ onClick: ae(n, (e) => {
92
+ let t = e.isPropagationStopped();
93
+ p({
94
+ requestedChecked: O(l) ? !0 : !l,
95
+ hasConsumerStoppedPropagation: t
96
+ }), f((e) => O(e) ? !0 : !e), h && m && (t || e.stopPropagation());
97
+ })
98
+ });
99
+ }, "CheckboxTrigger")), Me = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function(e, t) {
100
+ let { __scopeCheckbox: n, name: r, checked: i, defaultChecked: a, required: o, disabled: s, value: c, onCheckedChange: l, form: u, ...d } = e;
101
+ return /* @__PURE__ */ (0, E.jsx)(ke, {
102
+ __scopeCheckbox: n,
103
+ checked: i,
104
+ defaultChecked: a,
105
+ disabled: s,
106
+ required: o,
107
+ onCheckedChange: l,
108
+ name: r,
109
+ form: u,
110
+ value: c,
111
+ internal_do_not_use_render: ({ isFormControl: e }) => /* @__PURE__ */ (0, E.jsxs)(E.Fragment, { children: [/* @__PURE__ */ (0, E.jsx)(je, {
112
+ ...d,
113
+ ref: t,
114
+ __scopeCheckbox: n
115
+ }), e && /* @__PURE__ */ (0, E.jsx)(Ie, { __scopeCheckbox: n })] })
116
+ });
117
+ }, "Checkbox")), Ne = "CheckboxIndicator", Pe = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function(e, t) {
118
+ let { __scopeCheckbox: n, forceMount: r, ...i } = e, a = Oe(Ne, n);
119
+ return /* @__PURE__ */ (0, E.jsx)(x, {
120
+ present: r || O(a.checked) || a.checked === !0,
121
+ children: /* @__PURE__ */ (0, E.jsx)(ie.span, {
122
+ "data-state": Re(a.checked),
123
+ "data-disabled": a.disabled ? "" : void 0,
124
+ ...i,
125
+ ref: t,
126
+ style: {
127
+ pointerEvents: "none",
128
+ ...e.style
129
+ }
130
+ })
131
+ });
132
+ }, "CheckboxIndicator")), Fe = "CheckboxBubbleInput", Ie = /* @__PURE__ */ T.forwardRef(/* @__PURE__ */ D(function({ __scopeCheckbox: e, onClick: t, ...n }, i) {
133
+ let { control: a, userClick: o, checked: c, defaultChecked: l, required: u, disabled: d, name: f, value: p, form: m, bubbleInput: h, setBubbleInput: g } = Oe(Fe, e), _ = r(i, g), v = s(a), y = T.useRef(!1), b = T.useRef(c), x = T.useRef(o), S = T.useRef(null);
134
+ T.useEffect(() => {
135
+ let e = h;
136
+ if (!e) return;
137
+ let t = window.HTMLInputElement.prototype, n = Object.getOwnPropertyDescriptor(t, "checked").set;
138
+ if (!n) return;
139
+ let r = b.current !== c;
140
+ b.current = c;
141
+ let i = o !== null && o !== x.current;
142
+ if (x.current = o, i) S.current = r ? null : o, r && (e.indeterminate = O(c), n.call(e, !O(c) && c)), e.dispatchEvent(new Event("click", { bubbles: !o.hasConsumerStoppedPropagation }));
143
+ else if (r) {
144
+ let t = S.current;
145
+ S.current = null;
146
+ let r = t?.requestedChecked === c;
147
+ y.current = !0, e.indeterminate = O(c), n.call(e, !O(c) && c), e.dispatchEvent(new Event("click", { bubbles: !(r && t.hasConsumerStoppedPropagation) })), y.current = !1;
148
+ }
149
+ }, [
150
+ h,
151
+ c,
152
+ o
153
+ ]);
154
+ let ee = T.useRef(!O(c) && c);
155
+ return /* @__PURE__ */ (0, E.jsx)(ie.input, {
156
+ type: "checkbox",
157
+ "aria-hidden": !0,
158
+ defaultChecked: l ?? ee.current,
159
+ required: u,
160
+ disabled: d,
161
+ name: f,
162
+ value: p,
163
+ form: m,
164
+ ...n,
165
+ tabIndex: -1,
166
+ ref: _,
167
+ onClick: ae(t, (e) => {
168
+ y.current && e.stopPropagation();
169
+ }),
170
+ style: {
171
+ ...n.style,
172
+ ...v,
173
+ position: "absolute",
174
+ pointerEvents: "none",
175
+ opacity: 0,
176
+ margin: 0,
177
+ transform: "translateX(-100%)"
178
+ }
179
+ });
180
+ }, "CheckboxBubbleInput"));
181
+ function Le(e) {
182
+ return typeof e == "function";
183
+ }
184
+ D(Le, "isFunction");
185
+ function O(e) {
186
+ return e === "indeterminate";
187
+ }
188
+ D(O, "isIndeterminate");
189
+ function Re(e) {
190
+ return O(e) ? "indeterminate" : e ? "checked" : "unchecked";
191
+ }
192
+ D(Re, "getState");
193
+ //#endregion
194
+ //#region src/plugins/core/sanitize-html.ts
195
+ var ze = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix|zotero):|[^a-z]|[-a-z+.]+(?:[^-a-z+.:]|$))/i;
196
+ if (typeof document < "u") {
197
+ let e = "data-temp-href-target";
198
+ le.addHook("beforeSanitizeAttributes", (t) => {
199
+ t.tagName === "A" && (t.hasAttribute("target") || t.setAttribute("target", "_self"), t.hasAttribute("target") && t.setAttribute(e, t.getAttribute("target") || ""));
200
+ }), le.addHook("afterSanitizeAttributes", (t) => {
201
+ t.tagName === "A" && t.hasAttribute(e) && (t.setAttribute("target", t.getAttribute(e) || ""), t.removeAttribute(e), t.getAttribute("target") === "_blank" && t.setAttribute("rel", "noopener noreferrer"));
202
+ });
203
+ }
204
+ function Be(e) {
205
+ let t = {
206
+ USE_PROFILES: {
207
+ html: !0,
208
+ svg: !0,
209
+ mathMl: !0
210
+ },
211
+ ADD_TAGS: ["use"],
212
+ ADD_ATTR: ["href", "xlink:href"],
213
+ ALLOWED_URI_REGEXP: ze,
214
+ FORCE_BODY: !0,
215
+ CUSTOM_ELEMENT_HANDLING: {
216
+ tagNameCheck: /^(marimo-[A-Za-z][\w-]*|iconify-icon)$/,
217
+ attributeNameCheck: /^[A-Za-z][\w-]*$/
218
+ },
219
+ SAFE_FOR_XML: !e.includes("marimo-mermaid")
220
+ };
221
+ return le.sanitize(e, t);
222
+ }
223
+ //#endregion
224
+ //#region src/core/dom/outline.ts
225
+ var Ve = [
226
+ "marimo-carousel",
227
+ "marimo-tabs",
228
+ "marimo-accordion",
229
+ "marimo-sidebar"
230
+ ], He = "h1, h2, h3, h4, h5, h6";
231
+ function Ue(e) {
232
+ if (typeof DOMParser > "u") return null;
233
+ let t = [], n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(He);
234
+ for (let e of Array.from(n)) {
235
+ let n = e.textContent;
236
+ if (Ve.some((t) => e.closest(t)) || !n) continue;
237
+ let r = Number.parseInt(e.tagName[1], 10), i = e.innerHTML, a = {
238
+ name: n,
239
+ level: r,
240
+ by: Ge(e)
241
+ };
242
+ i !== n && (a.html = Be(i)), t.push(a);
243
+ }
244
+ return { items: t };
245
+ }
246
+ function We(e) {
247
+ if (!e.includes("\"")) return `"${e}"`;
248
+ if (!e.includes("'")) return `'${e}'`;
249
+ let t = e.split("\""), n = [];
250
+ for (let [e, r] of t.entries()) r && n.push(`"${r}"`), e < t.length - 1 && n.push("'\"'");
251
+ return `concat(${n.join(", ")})`;
252
+ }
253
+ function Ge(e) {
254
+ let t = e.id;
255
+ if (t) return { id: t };
256
+ let n = e.textContent ?? "";
257
+ return { path: `//${e.tagName}[contains(., ${We(n)})]` };
258
+ }
259
+ function Ke(e) {
260
+ return { items: e.filter(Boolean).flatMap((e) => e.items) };
261
+ }
262
+ function qe(e) {
263
+ if (e == null || e.mimetype !== "text/html" && e.mimetype !== "text/markdown" || e.data == null) return null;
264
+ try {
265
+ return w(typeof e.data == "string", "expected string"), Ue(e.data);
266
+ } catch {
267
+ return t.error("Failed to parse outline"), null;
268
+ }
269
+ }
270
+ function Je(e) {
271
+ return e != null && e.items.some((e) => e.level <= 3);
272
+ }
273
+ function Ye(e, n) {
274
+ let r = (e) => e.items.length === 0 ? 7 : Math.min(...e.items.map((e) => e.level)), i = n[e];
275
+ if (i == null || i.items.length === 0) return t.warn("Failed to find a starting outline"), null;
276
+ let a = r(i), o = e + 1;
277
+ for (; o < n.length;) {
278
+ let t = n[o];
279
+ if (t && r(t) <= a) return [e, o - 1];
280
+ o++;
281
+ }
282
+ return [e, n.length - 1];
283
+ }
284
+ //#endregion
285
+ //#region src/core/notebook/replica/connection.ts
286
+ var k = {
287
+ NOT_STARTED: "NOT_STARTED",
288
+ CONNECTING: "CONNECTING",
289
+ OPEN: "OPEN",
290
+ CLOSED: "CLOSED"
291
+ }, Xe = {
292
+ KERNEL_DISCONNECTED: "KERNEL_DISCONNECTED",
293
+ KERNEL_STARTUP_ERROR: "KERNEL_STARTUP_ERROR"
294
+ }, Ze = {
295
+ sourceChanged: !1,
296
+ inputsChanged: !1
297
+ };
298
+ function Qe(e) {
299
+ let t = /* @__PURE__ */ new Map();
300
+ for (let n of e.executions.values()) for (let e of n.variables.values()) {
301
+ let n = t.get(e.name);
302
+ n === void 0 ? t.set(e.name, [e]) : n.push(e);
303
+ }
304
+ return t;
305
+ }
306
+ function $e(e) {
307
+ let t = Qe(e.executions), n = /* @__PURE__ */ new Map(), r = (t) => e.executions.executions.get(t)?.record;
308
+ function i(e, n) {
309
+ let i = new Set(n).add(e.id);
310
+ for (let [n, a] of Object.entries(e.depends_on)) {
311
+ let s = t.get(n) ?? [];
312
+ if (a === null) {
313
+ if (s.some((t) => {
314
+ let n = r(t.execution_id);
315
+ if (n === void 0) return !1;
316
+ if (n.runtime_id === e.runtime_id) return !0;
317
+ let i = n.completed_at ?? n.started_at;
318
+ return i !== null && e.completed_at !== null && Date.parse(i) > Date.parse(e.completed_at);
319
+ })) return !0;
320
+ continue;
321
+ }
322
+ let c = s.find((e) => e.revision.execution === a.execution);
323
+ if (c === void 0 || c.revision.update !== a.update) return !0;
324
+ let l = r(c.execution_id);
325
+ if (l === void 0 || !i.has(l.id) && o(l, i).inputsChanged) return !0;
326
+ }
327
+ return !1;
328
+ }
329
+ function a(t, n) {
330
+ let i = e.executions.latest.get(t.id), a = i === void 0 ? void 0 : r(i), o = a !== void 0 && a.status !== "completed" ? a : n;
331
+ return t.code_fingerprint !== o.code_fingerprint;
332
+ }
333
+ function o(t, r) {
334
+ let o = n.get(t.id);
335
+ if (o !== void 0) return o;
336
+ let s = t.cell_id === null ? void 0 : e.cells.get(t.cell_id), c = {
337
+ sourceChanged: s === void 0 || a(s, t),
338
+ inputsChanged: i(t, r)
339
+ };
340
+ return n.set(t.id, c), c;
341
+ }
342
+ return (t) => {
343
+ let n = e.results.get(t)?.record;
344
+ return n == null ? Ze : o(n, /* @__PURE__ */ new Set());
345
+ };
346
+ }
347
+ //#endregion
348
+ //#region src/core/executions/output.ts
349
+ var et = /* @__PURE__ */ new Map(), tt = "application/vnd.marimo+error";
350
+ function A(e) {
351
+ return e;
352
+ }
353
+ function nt(e) {
354
+ return e.map(({ cell_id: e, message: t }) => ({
355
+ cell_id: A(e),
356
+ message: t
357
+ }));
358
+ }
359
+ function rt(e) {
360
+ return e === null ? 0 : Date.parse(e) / 1e3;
361
+ }
362
+ function it(e) {
363
+ return rt(e.completed_at ?? e.started_at);
364
+ }
365
+ function at(e, t) {
366
+ return {
367
+ channel: "output",
368
+ mimetype: t.mimetype,
369
+ data: t.data,
370
+ timestamp: it(e)
371
+ };
372
+ }
373
+ function j(e, t) {
374
+ return {
375
+ channel: "marimo-error",
376
+ mimetype: tt,
377
+ data: t,
378
+ timestamp: it(e)
379
+ };
380
+ }
381
+ function ot(e) {
382
+ let t = e.related.at(0);
383
+ return t === void 0 ? null : A(t.cell_id);
384
+ }
385
+ function st(e) {
386
+ switch (e.kind) {
387
+ case "exception": return {
388
+ type: "exception",
389
+ exception_type: e.name ?? "Exception",
390
+ msg: e.message,
391
+ raising_cell: ot(e),
392
+ traceback: e.traceback?.data ?? null
393
+ };
394
+ case "invalid-syntax": return {
395
+ type: "syntax",
396
+ msg: e.message,
397
+ lineno: e.range === null ? null : e.range.start.line + 1
398
+ };
399
+ case "internal": return {
400
+ type: "unknown",
401
+ msg: e.message,
402
+ error_type: e.name
403
+ };
404
+ case "interrupted": return { type: "interruption" };
405
+ default: return {
406
+ type: "diagnostic",
407
+ kind: e.kind,
408
+ msg: e.message,
409
+ related: nt(e.related)
410
+ };
411
+ }
412
+ }
413
+ function ct(e, t) {
414
+ let n = t.related[0];
415
+ if (n !== void 0 && t.reason === "upstream-stopped") return j(e, [{
416
+ type: "ancestor-stopped",
417
+ msg: t.message,
418
+ raising_cell: A(n.cell_id)
419
+ }]);
420
+ if (n !== void 0 && t.reason === "upstream-failed") {
421
+ let r = t.related.slice(1).find((t) => t.cell_id !== e.cell_id);
422
+ return j(e, [{
423
+ type: "ancestor-prevented",
424
+ msg: t.message,
425
+ raising_cell: A(n.cell_id),
426
+ blamed_cell: r === void 0 ? null : A(r.cell_id)
427
+ }]);
428
+ }
429
+ return j(e, [{
430
+ type: "diagnostic",
431
+ kind: t.reason,
432
+ msg: t.message,
433
+ related: nt(t.related)
434
+ }]);
435
+ }
436
+ function lt(e, t) {
437
+ let n = e.cell_id === null ? void 0 : t.get(e.cell_id);
438
+ return n !== void 0 && n.code !== null && n.code_fingerprint === e.code_fingerprint ? n.code : void 0;
439
+ }
440
+ function ut(e, t = et) {
441
+ let n = dt(e), r = lt(e, t);
442
+ return n === null || r === void 0 ? n : {
443
+ ...n,
444
+ code: r
445
+ };
446
+ }
447
+ function dt(e) {
448
+ let t = e.outcome;
449
+ if (t === null) return null;
450
+ switch (t.kind) {
451
+ case "value": return t.display === null ? null : at(e, t.display);
452
+ case "error": return j(e, [st(t.error)]);
453
+ case "interrupted": return j(e, [{ type: "interruption" }]);
454
+ case "skipped": return ct(e, t);
455
+ }
456
+ }
457
+ function ft(e, t) {
458
+ let n = e.executions.latest.get(t), r = n === void 0 ? void 0 : e.executions.executions.get(n);
459
+ if (r !== void 0 && r.record.outcome !== null && r.record.status !== "completed") return r;
460
+ let i = e.results.get(t) ?? null;
461
+ return r?.record.status === "running" && i?.record.outcome?.kind === "skipped" ? null : i;
462
+ }
463
+ function pt(e, t) {
464
+ return e?.execution === t.record.id && e.version === t.outputVersion;
465
+ }
466
+ function mt(e, t) {
467
+ let n = ft(e, t);
468
+ return n === null || pt(e.cleared.get(t), n) ? null : ut(n.record, e.cells);
469
+ }
470
+ function ht(e) {
471
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set([...e.results.keys(), ...e.executions.latest.keys()]);
472
+ for (let r of n) {
473
+ let n = mt(e, r);
474
+ n !== null && t.set(A(r), n);
475
+ }
476
+ return t;
477
+ }
478
+ //#endregion
479
+ //#region src/utils/time.ts
480
+ var gt = class e {
481
+ ms;
482
+ static fromMilliseconds(t) {
483
+ return t == null ? null : new e(t);
484
+ }
485
+ static fromSeconds(t) {
486
+ return t == null ? null : new e(t * 1e3);
487
+ }
488
+ static now() {
489
+ return new e(Date.now());
490
+ }
491
+ static parse(t) {
492
+ return new e(Date.parse(t));
493
+ }
494
+ constructor(e) {
495
+ this.ms = e;
496
+ }
497
+ toMilliseconds() {
498
+ return this.ms;
499
+ }
500
+ since(e) {
501
+ return this.ms - e.ms;
502
+ }
503
+ toSeconds() {
504
+ return this.ms / 1e3;
505
+ }
506
+ };
507
+ //#endregion
508
+ //#region src/core/executions/select.ts
509
+ function _t(e) {
510
+ let t = e.outcome;
511
+ return t === null ? null : t.kind;
512
+ }
513
+ function vt(e) {
514
+ return e === null ? null : gt.parse(e).toMilliseconds();
515
+ }
516
+ function yt(e, t) {
517
+ let n = e.latest.get(t);
518
+ return n === void 0 ? null : e.executions.get(n) ?? null;
519
+ }
520
+ function bt(e, t) {
521
+ let n = e.cells.get(t);
522
+ return n !== void 0 && !n.config.disabled && !e.blocked.has(t);
523
+ }
524
+ function xt(e, t) {
525
+ if (!bt(e, t)) return !1;
526
+ if (e.requested.has(t)) return !0;
527
+ let n = yt(e.executions, t)?.record.run_id ?? e.results.get(t)?.record.run_id;
528
+ for (let r of e.executions.runs.values()) if (r.status !== "completed" && r.id !== n && r.cells.includes(t)) return !0;
529
+ return !1;
530
+ }
531
+ function St(e, t) {
532
+ let n = yt(e.executions, t), r = e.results.get(t)?.record ?? null, i = "idle", a = r === null ? null : vt(r.started_at), o = !1;
533
+ n !== null && n.record.status !== "completed" ? (i = n.record.status, a = vt(n.record.started_at) ?? a, o = n.record.outcome !== null) : xt(e, t) && (i = "queued");
534
+ let s = i === "idle", c = s && r !== null && r.started_at !== null && r.completed_at !== null ? gt.parse(r.completed_at).since(gt.parse(r.started_at)) : null;
535
+ return {
536
+ status: i,
537
+ blocked: e.blocked.has(t),
538
+ outcome: s && r !== null ? _t(r) : null,
539
+ live: r === null || e.runtimeId === null || r.runtime_id === e.runtimeId,
540
+ startedAt: a,
541
+ duration: c,
542
+ rendered: o
543
+ };
544
+ }
545
+ function Ct(e) {
546
+ return [...e.executions.values()].filter((e) => e.record.status !== "completed");
547
+ }
548
+ function wt(e) {
549
+ return Ct(e).some((e) => e.record.status === "running");
550
+ }
551
+ function Tt(e) {
552
+ let t = Ct(e.executions), n = new Set(t.flatMap((e) => e.record.cell_id === null ? [] : [e.record.cell_id])), r = new Set(e.requested);
553
+ for (let t of e.executions.runs.values()) if (t.status !== "completed") for (let e of t.cells) r.add(e);
554
+ let i = 0;
555
+ for (let t of r) !n.has(t) && xt(e, t) && (i += 1);
556
+ return t.length + i;
557
+ }
558
+ //#endregion
559
+ //#region src/core/executions/atoms.ts
560
+ var M = {
561
+ runs: /* @__PURE__ */ new Map(),
562
+ executions: /* @__PURE__ */ new Map(),
563
+ latest: /* @__PURE__ */ new Map(),
564
+ results: /* @__PURE__ */ new Map(),
565
+ scratch: null
566
+ }, Et = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), Dt = /* @__PURE__ */ new Set(), Ot = /* @__PURE__ */ new Set(), kt = /* @__PURE__ */ new Set(), At = /* @__PURE__ */ new Map(), P = h(null), jt = h(null);
567
+ function Mt(e, t, n, r) {
568
+ return e !== null && e.notebook.replica === t && e.notebook.id === n ? e.value : r;
569
+ }
570
+ function Nt(e) {
571
+ let t = e.get(_), n = t === null ? null : e.get(t.notebookAtom);
572
+ return t === null || n === null ? null : {
573
+ replica: t,
574
+ id: n.id
575
+ };
576
+ }
577
+ function Pt(e, t) {
578
+ let n = Nt(e);
579
+ return n === null ? null : {
580
+ notebook: n,
581
+ value: t
582
+ };
583
+ }
584
+ function Ft(e, t) {
585
+ let n = e.get(_);
586
+ if (n !== t.notebook.replica) return !1;
587
+ let r = e.get(n.notebookAtom);
588
+ return r === null || r.id === t.notebook.id;
589
+ }
590
+ var It = h((e) => {
591
+ let t = e(_), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r = Mt(e(P), t, n, Dt);
592
+ return r.size === 0 ? Ot : new Set([...r].flatMap((e) => e.cells));
593
+ }), F = h((e) => {
594
+ let t = e(_), n = t === null ? null : e(t.notebookAtom)?.id ?? null, r = t === null ? null : e(t.shownDocumentAtom);
595
+ return {
596
+ executions: t === null ? M : e(t.executionsAtom),
597
+ results: t === null ? Et : e(t.resultsAtom),
598
+ cells: r?.cells ?? N,
599
+ requested: e(It),
600
+ blocked: Mt(e(jt), t, n, kt),
601
+ runtimeId: t === null ? null : e(t.runtimeAtom)?.id ?? null
602
+ };
603
+ }), Lt = h((e) => {
604
+ let t = e(_), n = t === null ? null : e(t.shownDocumentAtom);
605
+ return t === null || n === null ? {
606
+ cells: N,
607
+ executions: M,
608
+ results: Et
609
+ } : {
610
+ cells: n.cells,
611
+ executions: e(t.executionsAtom),
612
+ results: e(t.resultsAtom)
613
+ };
614
+ }), Rt = h((e) => $e(e(Lt))), zt = h(null), Bt = h((e) => {
615
+ let t = e(_), n = t === null ? null : e(t.shownDocumentAtom);
616
+ return t === null || n === null ? null : {
617
+ replica: t,
618
+ id: n.revision.notebook_id
619
+ };
620
+ }), Vt = h((e) => {
621
+ let t = e(_), n = e(Bt)?.id ?? null;
622
+ return {
623
+ executions: t === null ? M : e(t.executionsAtom),
624
+ results: t === null ? Et : e(t.resultsAtom),
625
+ cleared: Mt(e(zt), t, n, At),
626
+ cells: t === null ? N : e(t.documentAtom)?.cells ?? N
627
+ };
628
+ }), Ht = h((e) => ht(e(Vt))), I = v((e) => ne(Ht, (t) => t.get(e) ?? null, te)), L = v((e) => h((t) => qe(t(I(e)))));
629
+ function Ut(e) {
630
+ I.remove(e), L.remove(e);
631
+ }
632
+ function Wt(e, t) {
633
+ let n = e.get(Vt), r = new Map(n.cleared);
634
+ for (let e of t) {
635
+ let t = ft(n, e);
636
+ t?.record.outcome != null && r.set(e, {
637
+ execution: t.record.id,
638
+ version: t.outputVersion
639
+ });
640
+ }
641
+ let i = e.get(Bt);
642
+ e.set(zt, i === null ? null : {
643
+ notebook: i,
644
+ value: r
645
+ });
646
+ }
647
+ var Gt = h((e) => {
648
+ let t = e(_);
649
+ return t === null ? null : e(t.runtimeAtom)?.status ?? null;
650
+ });
651
+ h((e) => wt(e(F).executions)), h((e) => Tt(e(F)));
652
+ var Kt = h((e) => {
653
+ let t = e(_);
654
+ if (t === null) return { refused: "No notebook is connected" };
655
+ if (e(t.connectionAtom).state === k.CLOSED) return { refused: "The notebook is disconnected" };
656
+ if (e(t.notebookAtom) === null) return "waiting";
657
+ let n = e(t.runtimeAtom);
658
+ if (n === null) return { refused: "The notebook has no runtime" };
659
+ switch (n.status) {
660
+ case "running": return "running";
661
+ case "failed": return { refused: n.message ?? "The runtime failed" };
662
+ default: return "waiting";
663
+ }
664
+ });
665
+ function qt(e) {
666
+ return new Promise((t, n) => {
667
+ let r = e.sub(Kt, i);
668
+ function i() {
669
+ let i = e.get(Kt);
670
+ i !== "waiting" && (r(), i === "running" ? t() : n(Error(i.refused)));
671
+ }
672
+ i();
673
+ });
674
+ }
675
+ function Jt(e, t) {
676
+ let n = Nt(e);
677
+ if (n === null) return null;
678
+ let r = {
679
+ notebook: n,
680
+ cells: [...t]
681
+ }, i = e.get(P), a = i !== null && i.notebook.replica === n.replica && i.notebook.id === n.id ? i.value : Dt;
682
+ return e.set(P, {
683
+ notebook: n,
684
+ value: new Set(a).add(r)
685
+ }), r;
686
+ }
687
+ function Yt(e, t) {
688
+ let n = e.get(P);
689
+ if (n === null || !n.value.has(t)) return;
690
+ let r = new Set(n.value);
691
+ r.delete(t), e.set(P, {
692
+ notebook: n.notebook,
693
+ value: r
694
+ });
695
+ }
696
+ function Xt(e, t, n) {
697
+ let { replica: r } = t.notebook, i = e.sub(r.executionsAtom, a);
698
+ function a() {
699
+ (!Ft(e, t) || e.get(r.executionsAtom).runs.has(n.id)) && (i(), Yt(e, t));
700
+ }
701
+ a();
702
+ }
703
+ function Zt(e, t, n) {
704
+ let r = e.get(F).blocked;
705
+ if (r.has(t) === n) return;
706
+ let i = new Set(r);
707
+ n ? i.add(t) : i.delete(t), e.set(jt, Pt(e, i));
708
+ }
709
+ function Qt(e, t) {
710
+ t.status != null && Zt(e, t.cell_id, t.status === "disabled-transitively");
711
+ }
712
+ //#endregion
713
+ //#region src/core/codemirror/editing/commands.ts
714
+ var $t = a();
715
+ function en(e) {
716
+ return (t) => {
717
+ let n = !1;
718
+ for (let r of t) r && (n = e(r) || n);
719
+ return n;
720
+ };
721
+ }
722
+ var tn = en(me), nn = en(pe);
723
+ //#endregion
724
+ //#region src/utils/schedule-task.ts
725
+ function rn() {
726
+ let e = globalThis.scheduler;
727
+ if (typeof e?.postTask == "function") return (t) => {
728
+ e.postTask(t, { priority: "user-visible" }).catch((e) => {
729
+ setTimeout(() => {
730
+ throw e;
731
+ });
732
+ });
733
+ };
734
+ if (typeof MessageChannel == "function") {
735
+ let e = [], t = new MessageChannel();
736
+ return t.port1.onmessage = () => {
737
+ e.shift()?.();
738
+ }, (n) => {
739
+ e.push(n), t.port2.postMessage(null);
740
+ };
741
+ }
742
+ return (e) => {
743
+ setTimeout(e, 0);
744
+ };
745
+ }
746
+ var an = rn();
747
+ //#endregion
748
+ //#region src/core/codemirror/editor-mount-scheduler.ts
749
+ function on(e = an) {
750
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = !1;
751
+ function i() {
752
+ r || t.size === 0 || (r = !0, e(o));
753
+ }
754
+ function a() {
755
+ for (let e of n) {
756
+ if (t.has(e)) return e;
757
+ n.delete(e);
758
+ }
759
+ return t.keys().next().value;
760
+ }
761
+ function o() {
762
+ r = !1;
763
+ try {
764
+ let e = a();
765
+ if (e !== void 0) {
766
+ let r = t.get(e);
767
+ t.delete(e), n.delete(e), r?.();
768
+ }
769
+ } finally {
770
+ i();
771
+ }
772
+ }
773
+ return {
774
+ request(e, n) {
775
+ t.set(e, n), i();
776
+ },
777
+ promote(e) {
778
+ let r = t.get(e);
779
+ r && (t.delete(e), n.delete(e), r());
780
+ },
781
+ prioritize(e) {
782
+ t.has(e) && n.add(e);
783
+ },
784
+ deprioritize(e) {
785
+ n.delete(e);
786
+ },
787
+ cancel(e) {
788
+ t.delete(e), n.delete(e);
789
+ }
790
+ };
791
+ }
792
+ var sn = on();
793
+ //#endregion
794
+ //#region src/core/mime.ts
795
+ function cn(e) {
796
+ return e === "application/vnd.marimo+error";
797
+ }
798
+ function ln(e) {
799
+ return e === "application/vnd.marimo+traceback";
800
+ }
801
+ function R(e) {
802
+ return cn(e) || ln(e);
803
+ }
804
+ //#endregion
805
+ //#region src/components/editor/output/ansi-reduce.ts
806
+ var un = class e {
807
+ lines = [""];
808
+ cursor = {
809
+ row: 0,
810
+ col: 0
811
+ };
812
+ static ESCAPE_REGEX = new RegExp(String.raw`\u001B\[([0-9;]*)([A-DJKH])`, "u");
813
+ ensureLine(e) {
814
+ for (; this.lines.length <= e;) this.lines.push("");
815
+ }
816
+ moveCursor(e, t) {
817
+ this.cursor.row = Math.max(0, this.cursor.row + e), this.cursor.col = Math.max(0, this.cursor.col + t), this.ensureLine(this.cursor.row);
818
+ }
819
+ setCursor(e, t) {
820
+ this.cursor.row = Math.max(0, e), this.cursor.col = Math.max(0, t), this.ensureLine(this.cursor.row);
821
+ }
822
+ writeChar(e) {
823
+ this.ensureLine(this.cursor.row);
824
+ let t = this.lines[this.cursor.row].padEnd(this.cursor.col, " ");
825
+ this.lines[this.cursor.row] = t.slice(0, this.cursor.col) + e + t.slice(this.cursor.col + 1), this.cursor.col++;
826
+ }
827
+ writeString(e) {
828
+ if (e.length === 0) return;
829
+ this.ensureLine(this.cursor.row);
830
+ let t = this.lines[this.cursor.row].padEnd(this.cursor.col, " ");
831
+ this.lines[this.cursor.row] = t.slice(0, this.cursor.col) + e + t.slice(this.cursor.col + e.length), this.cursor.col += e.length;
832
+ }
833
+ control(e) {
834
+ switch (e) {
835
+ case "\n":
836
+ this.cursor.row++, this.cursor.col = 0, this.ensureLine(this.cursor.row);
837
+ break;
838
+ case "\r":
839
+ this.cursor.col = 0;
840
+ break;
841
+ case " ":
842
+ this.writeChar(" ");
843
+ break;
844
+ case "\b":
845
+ this.cursor.col = Math.max(0, this.cursor.col - 1);
846
+ break;
847
+ case "\v": this.cursor.row++, this.ensureLine(this.cursor.row);
848
+ }
849
+ }
850
+ handleEscape(t) {
851
+ let n = e.ESCAPE_REGEX.exec(t);
852
+ if (!n) {
853
+ this.writeString(t);
854
+ return;
855
+ }
856
+ let r = n[1].split(";").map((e) => e === "" ? 1 : Number.parseInt(e, 10));
857
+ switch (n[2]) {
858
+ case "A":
859
+ this.moveCursor(-r[0], 0);
860
+ break;
861
+ case "B":
862
+ this.moveCursor(r[0], 0);
863
+ break;
864
+ case "C":
865
+ this.moveCursor(0, r[0]);
866
+ break;
867
+ case "D":
868
+ this.moveCursor(0, -r[0]);
869
+ break;
870
+ case "H":
871
+ this.setCursor(r[0] - 1 || 0, r[1] - 1 || 0);
872
+ break;
873
+ case "J":
874
+ r[0] === 2 && (this.lines = [""], this.setCursor(0, 0));
875
+ break;
876
+ case "K":
877
+ switch (this.ensureLine(this.cursor.row), r[0]) {
878
+ case 0:
879
+ this.lines[this.cursor.row] = this.lines[this.cursor.row].slice(0, this.cursor.col);
880
+ break;
881
+ case 1: {
882
+ let e = this.lines[this.cursor.row].length;
883
+ this.lines[this.cursor.row] = " ".repeat(this.cursor.col) + this.lines[this.cursor.row].slice(this.cursor.col, e);
884
+ break;
885
+ }
886
+ case 2: this.lines[this.cursor.row] = "";
887
+ }
888
+ break;
889
+ default: this.writeString(t);
890
+ }
891
+ }
892
+ render() {
893
+ return this.lines.join("\n");
894
+ }
895
+ }, dn = class {
896
+ ESC_REGEX = new RegExp(String.raw`\u001B(?:\[[0-9;]*[A-Za-z]|\([0-9A-Za-z])`, "gu");
897
+ parse(e) {
898
+ let t = [], n = 0;
899
+ for (let r of e.matchAll(this.ESC_REGEX)) {
900
+ let i = r.index ?? 0;
901
+ i > n && t.push({
902
+ type: "text",
903
+ value: e.slice(n, i)
904
+ }), t.push({
905
+ type: "escape",
906
+ value: r[0]
907
+ }), n = i + r[0].length;
908
+ }
909
+ return n < e.length && t.push({
910
+ type: "text",
911
+ value: e.slice(n)
912
+ }), t;
913
+ }
914
+ }, fn = class {
915
+ parser = new dn();
916
+ buffer = new un();
917
+ reduce(e) {
918
+ return this.reset(), this.append(e), this.render();
919
+ }
920
+ append(e) {
921
+ let t = this.parser.parse(e);
922
+ if (t.length === 1 && t[0].type === "text") {
923
+ let e = t[0].value;
924
+ if (!this.hasControlChars(e)) {
925
+ this.buffer.writeString(e);
926
+ return;
927
+ }
928
+ }
929
+ for (let e of t) e.type === "text" ? this.processText(e.value) : this.buffer.handleEscape(e.value);
930
+ }
931
+ reset() {
932
+ this.buffer = new un();
933
+ }
934
+ render() {
935
+ return this.buffer.render();
936
+ }
937
+ hasControlChars(e) {
938
+ for (let t of e) if (t < " ") return !0;
939
+ return !1;
940
+ }
941
+ processText(e) {
942
+ let t = 0, n = e.length;
943
+ for (let r = 0; r < n; r++) {
944
+ let n = e[r];
945
+ if (n === "\n" || n === "\r" || n === " " || n === "\b" || n === "\v") {
946
+ if (r > t) {
947
+ let n = e.slice(t, r), i = this.filterControlChars(n);
948
+ i.length > 0 && this.buffer.writeString(i);
949
+ }
950
+ this.buffer.control(n), t = r + 1;
951
+ } else if (n < " ") {
952
+ if (r > t) {
953
+ let n = e.slice(t, r);
954
+ n.length > 0 && this.buffer.writeString(n);
955
+ }
956
+ t = r + 1;
957
+ }
958
+ }
959
+ if (t < n) {
960
+ let n = e.slice(t), r = this.filterControlChars(n);
961
+ r.length > 0 && this.buffer.writeString(r);
962
+ }
963
+ }
964
+ filterControlChars(e) {
965
+ let t = !1;
966
+ for (let n of e) if (n < " ") {
967
+ t = !0;
968
+ break;
969
+ }
970
+ if (!t) return e;
971
+ let n = "";
972
+ for (let t of e) t >= " " && (n += t);
973
+ return n;
974
+ }
975
+ }, z = class e {
976
+ mimetype;
977
+ channel;
978
+ timestamp;
979
+ code;
980
+ id;
981
+ input_id;
982
+ ansiReducer = new fn();
983
+ _data;
984
+ get data() {
985
+ return this._data;
986
+ }
987
+ static create(t) {
988
+ let n = new fn();
989
+ return n.append(t.data), new e({
990
+ mimetype: t.mimetype,
991
+ channel: t.channel,
992
+ timestamp: t.timestamp,
993
+ ansiReducer: n,
994
+ code: t.code,
995
+ id: t.id,
996
+ input_id: t.input_id
997
+ });
998
+ }
999
+ constructor({ mimetype: e, channel: t, timestamp: n, ansiReducer: r, code: i, id: a, input_id: o }) {
1000
+ this.mimetype = e, this.channel = t, this.timestamp = n, this.code = i, this.id = a, this.input_id = o, this.ansiReducer = r, this._data = this.ansiReducer.render();
1001
+ }
1002
+ appendData(t) {
1003
+ return this.ansiReducer.append(t), new e({
1004
+ mimetype: this.mimetype,
1005
+ channel: this.channel,
1006
+ timestamp: this.timestamp,
1007
+ ansiReducer: this.ansiReducer,
1008
+ code: this.code,
1009
+ id: this.id,
1010
+ input_id: this.input_id
1011
+ });
1012
+ }
1013
+ toJSON() {
1014
+ return {
1015
+ mimetype: this.mimetype,
1016
+ channel: this.channel,
1017
+ timestamp: this.timestamp,
1018
+ data: this.data,
1019
+ ...this.code === void 0 ? {} : { code: this.code }
1020
+ };
1021
+ }
1022
+ };
1023
+ //#endregion
1024
+ //#region src/core/cells/collapseConsoleOutputs.tsx
1025
+ function pn(e, t = 5e3) {
1026
+ let n = [...e];
1027
+ if (n.length < 2) return vn(n.map(hn), t);
1028
+ let r = n[n.length - 1], i = n[n.length - 2];
1029
+ return mn(r, i) && (_n(r), _n(i), n[n.length - 2] = gn(i, r), n.pop()), vn(n, t);
1030
+ }
1031
+ function mn(e, t) {
1032
+ let n = e.mimetype === "text/plain" && t.mimetype === "text/plain";
1033
+ if (!n) return !1;
1034
+ let r = e.channel === t.channel, i = e.channel !== "stdin";
1035
+ return n && r && i;
1036
+ }
1037
+ function hn(e) {
1038
+ return e instanceof z ? e : typeof e.data == "string" ? z.create(e) : e;
1039
+ }
1040
+ function gn(e, t) {
1041
+ return e instanceof z ? e.appendData(t.data) : z.create(e).appendData(t.data);
1042
+ }
1043
+ function _n(e) {
1044
+ w(typeof e.data == "string", "expected string output");
1045
+ }
1046
+ function vn(e, t) {
1047
+ let n = 0, r;
1048
+ for (r = e.length - 1; r >= 0 && n < t; r--) {
1049
+ let t = e[r];
1050
+ t.mimetype === "text/plain" ? (w(typeof t.data == "string", "expected string"), n += t.data.split("\n").length) : n++;
1051
+ }
1052
+ if (n < t) return e;
1053
+ let i = r + 1, a = {
1054
+ channel: "stderr",
1055
+ mimetype: "text/html",
1056
+ data: `<pre>Streaming output truncated to last ${t} lines.\n</pre>`,
1057
+ timestamp: -1
1058
+ }, o = e[i];
1059
+ if (o == null) return [a, ...e.slice(i + 1)];
1060
+ if (o.mimetype === "text/plain") {
1061
+ w(typeof o.data == "string", "expected string");
1062
+ let r = o.data.split("\n"), s = t - (n - r.length);
1063
+ return [
1064
+ a,
1065
+ {
1066
+ ...o,
1067
+ data: r.slice(-s).join("\n")
1068
+ },
1069
+ ...e.slice(i + 1)
1070
+ ];
1071
+ }
1072
+ return [a, ...e.slice(i + 1)];
1073
+ }
1074
+ //#endregion
1075
+ //#region src/core/cells/cell.ts
1076
+ function yn(e) {
1077
+ return (e.at(-1)?.id ?? 0) + 1;
1078
+ }
1079
+ function bn(e) {
1080
+ return e == null || e.mimetype !== "application/vnd.marimo+error" || !Array.isArray(e.data) ? [] : e.data.map((e) => e.type);
1081
+ }
1082
+ function xn(e, t) {
1083
+ let n = { ...e };
1084
+ t.status === "queued" && (n.debuggerActive = !1), t.serialization !== void 0 && (n.serialization = t.serialization);
1085
+ let r = bn(t.output).includes("interruption"), i = e.consoleOutputs;
1086
+ (r || t.status === "idle") && (n.debuggerActive = !1, i = i.map((e) => e.channel === "stdin" ? {
1087
+ channel: e.channel,
1088
+ mimetype: e.mimetype,
1089
+ data: e.data,
1090
+ timestamp: e.timestamp,
1091
+ id: e.id,
1092
+ input_id: e.input_id,
1093
+ response: e.response ?? ""
1094
+ } : e));
1095
+ let a = t.console;
1096
+ a != null && (i = pn(Array.isArray(a) ? a.map((e, t) => ({
1097
+ ...e,
1098
+ id: t + 1
1099
+ })) : [...i, {
1100
+ ...a,
1101
+ id: yn(i)
1102
+ }])), n.consoleOutputs = i;
1103
+ let o = [t.console].flat().filter(Boolean).filter((e) => e.channel === "pdb");
1104
+ return o.length > 0 && o.some((e) => e.data === "start") && (n.debuggerActive = !0), n;
1105
+ }
1106
+ function Sn(e) {
1107
+ return e === "running" || e === "queued";
1108
+ }
1109
+ function Cn(e, t, n) {
1110
+ let { status: r, outcome: i, rendered: a } = e;
1111
+ return Sn(r) ? !(r === "running" && a) : n && t.sourceChanged ? !0 : i !== "interrupted" && t.inputsChanged;
1112
+ }
1113
+ //#endregion
1114
+ //#region src/core/cells/columns.ts
1115
+ function wn(e) {
1116
+ let t = /* @__PURE__ */ new Map(), n = 0;
1117
+ for (let r of e.order) {
1118
+ let i = e.cells.get(r)?.config.column;
1119
+ i != null && i >= 0 && (n = i), t.set(r, n);
1120
+ }
1121
+ return t;
1122
+ }
1123
+ function Tn(e) {
1124
+ let t = [[]];
1125
+ for (let [n, r] of wn(e)) {
1126
+ for (; t.length <= r;) t.push([]);
1127
+ t[r].push(n);
1128
+ }
1129
+ return t;
1130
+ }
1131
+ //#endregion
1132
+ //#region src/core/dom/ui-element-constants.ts
1133
+ var En = "object-id", Dn = "random-id", On = "abcdefghijklmnopqrstuvwxyz", kn = On + On.toUpperCase(), An = /* @__PURE__ */ new Set(), B = "__scratch__", jn = "setup", Mn = { create() {
1134
+ let e = 0, t;
1135
+ do {
1136
+ let n = "";
1137
+ for (let e = 0; e < 4; e++) n += kn[Math.floor(Math.random() * 52)];
1138
+ t = n, e++;
1139
+ } while (An.has(t) && e < 100);
1140
+ if (e >= 100) throw Error("Failed to generate unique CellId after 100 attempts");
1141
+ return An.add(t), t;
1142
+ } }, V = {
1143
+ create(e) {
1144
+ return w(e != null, "cellId is required"), `cell-${e}`;
1145
+ },
1146
+ parse(e) {
1147
+ return e.slice(5);
1148
+ },
1149
+ findElement(e) {
1150
+ return e.closest("div[id^=\"cell-\"]");
1151
+ },
1152
+ findElementThroughShadowDOMs(e) {
1153
+ let t = e;
1154
+ for (; t;) {
1155
+ let e = V.findElement(t);
1156
+ if (e) return e;
1157
+ let n = t.getRootNode();
1158
+ if (t = n instanceof ShadowRoot ? n.host : t.parentElement, t === n) break;
1159
+ }
1160
+ return null;
1161
+ }
1162
+ };
1163
+ function Nn(e) {
1164
+ let t = null, n = V.findElementThroughShadowDOMs(e);
1165
+ return n && (t = V.parse(n.id)), t;
1166
+ }
1167
+ var Pn = {
1168
+ parse(e) {
1169
+ return e.getAttribute(En);
1170
+ },
1171
+ parseOrThrow(e) {
1172
+ let t = Pn.parse(e);
1173
+ return w(t, "<marimo-ui-element/> missing object-id attribute"), t;
1174
+ }
1175
+ }, Fn = { create(e) {
1176
+ return `output-${e}`;
1177
+ } }, In = h(/* @__PURE__ */ new Set()), H = h([]), U = h([]);
1178
+ function Ln() {
1179
+ return `column-${Mn.create()}`;
1180
+ }
1181
+ var Rn = h(null, (e, t, n) => {
1182
+ let r = Tn(n).length, i = e(H);
1183
+ if (i.length === r) return;
1184
+ let a = e(U), o = [...i, ...a].slice(0, r);
1185
+ for (; o.length < r;) o.push(Ln());
1186
+ t(H, o), t(U, a.slice(Math.max(0, r - i.length)));
1187
+ });
1188
+ function zn(e, t, n) {
1189
+ return [...(e === null ? [[]] : Tn(e)).map((e, n) => ({
1190
+ id: t[n] ?? `column-${n}`,
1191
+ ids: e
1192
+ })), ...n.map((e) => ({
1193
+ id: e,
1194
+ ids: []
1195
+ }))];
1196
+ }
1197
+ function Bn(e, t, n) {
1198
+ let r = /* @__PURE__ */ new Map();
1199
+ return e.forEach((i, a) => {
1200
+ let o = t[a];
1201
+ if (!n.has(i) || !o || o.items.length === 0) return;
1202
+ let s = Ye(a, t);
1203
+ s !== null && r.set(i, e.slice(a + 1, s[1] + 1));
1204
+ }), r;
1205
+ }
1206
+ function Vn(e, t, n) {
1207
+ return { columns: e.map(({ id: e, ids: r }) => {
1208
+ let i = Bn(r, r.map(t), n), a = new Set([...i.values()].flat());
1209
+ return {
1210
+ id: e,
1211
+ ids: r,
1212
+ visible: r.filter((e) => !a.has(e)),
1213
+ folds: i
1214
+ };
1215
+ }) };
1216
+ }
1217
+ var Hn = h((e) => {
1218
+ let t = e(oe), n = t === null ? null : e(t.documentAtom), r = e(Gi);
1219
+ return Vn(zn(n, e(H), e(U)), (e) => r[e] ?? null, e(In));
1220
+ }), Un = () => g(Hn), Wn = h((e) => e(Hn).columns.length);
1221
+ function Gn(e, t) {
1222
+ return e.columns.find((e) => e.id === t);
1223
+ }
1224
+ function Kn(e, t) {
1225
+ let n = e.columns.find((e) => e.ids.includes(t));
1226
+ if (n === void 0) throw Error(`Cell ${t} is not in the layout`);
1227
+ return n;
1228
+ }
1229
+ function qn(e, t) {
1230
+ for (let n of e.columns) {
1231
+ let e = n.folds.get(t);
1232
+ if (e !== void 0) return e;
1233
+ }
1234
+ }
1235
+ function Jn(e, t) {
1236
+ let n = e.columns.find((e) => e.ids.includes(t));
1237
+ return n === void 0 ? [] : [...n.folds].filter(([, e]) => e.includes(t)).map(([e]) => e);
1238
+ }
1239
+ function Yn(e, t) {
1240
+ let n = Jn(e, t);
1241
+ return qn(e, t) === void 0 ? n : [...n, t];
1242
+ }
1243
+ var Xn = /* @__PURE__ */ new Set(/* @__PURE__ */ "__*.marimo.app.False.None.True.__peg_parser__.and.as.assert.async.await.break.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.nonlocal.not.or.pass.raise.return.try.while.with.yield.None.setup".split("."));
1244
+ function Zn(e, t = !0) {
1245
+ return e = e.trim(), e ? (/^\d/.test(e) && (e = `_${e}`), e = e.replaceAll(/\W/g, "_"), t ? e.toLowerCase() : e) : "_";
1246
+ }
1247
+ function Qn(e, t) {
1248
+ let n = new Set(t), r = e, i = (e) => !n.has(e) && !Xn.has(e);
1249
+ if (i(e)) return e;
1250
+ let a = 1;
1251
+ for (; !i(r);) r = `${e}_${a}`, a++;
1252
+ return r;
1253
+ }
1254
+ function $n(e, t) {
1255
+ return er(e) ? `cell-${t}` : e;
1256
+ }
1257
+ function er(e) {
1258
+ return !e || e === "_" || e === "__";
1259
+ }
1260
+ //#endregion
1261
+ //#region src/core/cells/types.ts
1262
+ function tr({ id: e, name: t = "_", code: n = "", config: r }) {
1263
+ return {
1264
+ id: e,
1265
+ config: r || {
1266
+ hide_code: !1,
1267
+ disabled: !1,
1268
+ column: null,
1269
+ expand_output: !1
1270
+ },
1271
+ name: t,
1272
+ code: n
1273
+ };
1274
+ }
1275
+ function nr(e) {
1276
+ return {
1277
+ hide_code: !1,
1278
+ disabled: !1,
1279
+ column: null,
1280
+ expand_output: !1,
1281
+ ...e
1282
+ };
1283
+ }
1284
+ function rr(e) {
1285
+ return {
1286
+ consoleOutputs: [],
1287
+ debuggerActive: !1,
1288
+ ...e
1289
+ };
1290
+ }
1291
+ //#endregion
1292
+ //#region src/core/cells/document.ts
1293
+ function ir(e, t) {
1294
+ let n = t.code ?? e.code, r = te(e.config, t.config) ? e.config : nr(t.config);
1295
+ return n === e.code && t.name === e.name && r === e.config ? e : n === e.code ? {
1296
+ ...e,
1297
+ name: t.name,
1298
+ config: r
1299
+ } : {
1300
+ ...e,
1301
+ code: n,
1302
+ name: t.name,
1303
+ config: r
1304
+ };
1305
+ }
1306
+ function ar(e, t) {
1307
+ let n = te(t.order, e.cellIds) ? e.cellIds : [...t.order], { cellData: r, cellRuntime: i, cellHandles: a } = e;
1308
+ for (let o of n) {
1309
+ let n = t.cells.get(o), s = e.cellData[o];
1310
+ if (n === void 0) continue;
1311
+ if (s === void 0) {
1312
+ r = {
1313
+ ...r,
1314
+ [o]: tr({
1315
+ id: o,
1316
+ code: n.code ?? "",
1317
+ name: n.name,
1318
+ config: nr(n.config)
1319
+ })
1320
+ }, i = {
1321
+ ...i,
1322
+ [o]: i[o] ?? rr()
1323
+ }, a = {
1324
+ ...a,
1325
+ [o]: (0, T.createRef)()
1326
+ };
1327
+ continue;
1328
+ }
1329
+ let c = ir(s, n);
1330
+ c !== s && (r = {
1331
+ ...r,
1332
+ [o]: c
1333
+ });
1334
+ }
1335
+ let o = new Set(n), s = e.cellIds.filter((e) => !o.has(e));
1336
+ if (s.length > 0) {
1337
+ let e = new Set(s), t = (t) => Object.fromEntries(Object.entries(t).filter(([t]) => !e.has(t)));
1338
+ r = t(r), i = t(i), a = t(a);
1339
+ }
1340
+ return n === e.cellIds && r === e.cellData && s.length === 0 ? e : {
1341
+ ...e,
1342
+ cellIds: n,
1343
+ cellData: r,
1344
+ cellRuntime: i,
1345
+ cellHandles: a
1346
+ };
1347
+ }
1348
+ function or({ store: e, model: t, reconcile: n, signal: r }) {
1349
+ let i = () => {
1350
+ let r = e.get(t.documentAtom);
1351
+ r !== null && (n(r), e.set(Rn, r));
1352
+ }, a = e.sub(t.documentAtom, i);
1353
+ r.addEventListener("abort", a, { once: !0 }), i();
1354
+ }
1355
+ async function sr() {
1356
+ let e = C.get(oe);
1357
+ e !== null && C.get(e.syncStatusAtom).status !== "unavailable" && await e.flush();
1358
+ }
1359
+ //#endregion
1360
+ //#region src/core/cells/editor.ts
1361
+ var W = h(/* @__PURE__ */ new Set());
1362
+ function cr(e, t, n) {
1363
+ return !!e && !t.has(n);
1364
+ }
1365
+ h(null, (e, t, { cellId: n }) => {
1366
+ t(W, (e) => /* @__PURE__ */ new Set([...e, n]));
1367
+ }), h(null, (e, t, { cellId: n }) => e(W).has(n) ? (t(W, (e) => {
1368
+ let t = new Set(e);
1369
+ return t.delete(n), t;
1370
+ }), !0) : !1);
1371
+ var lr = h(/* @__PURE__ */ new Map());
1372
+ h(null, (e, t, { cellId: n }) => {
1373
+ t(lr, (e) => {
1374
+ let t = new Map(e);
1375
+ return t.delete(n), t;
1376
+ });
1377
+ });
1378
+ //#endregion
1379
+ //#region ../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/fromUnixTime.js
1380
+ function ur(e, t) {
1381
+ return ye(e * 1e3, t?.in);
1382
+ }
1383
+ //#endregion
1384
+ //#region ../node_modules/.pnpm/ansi_up@6.0.6/node_modules/ansi_up/ansi_up.js
1385
+ var dr = function(e, t) {
1386
+ return Object.defineProperty ? Object.defineProperty(e, "raw", { value: t }) : e.raw = t, e;
1387
+ }, G;
1388
+ (function(e) {
1389
+ e[e.EOS = 0] = "EOS", e[e.Text = 1] = "Text", e[e.Incomplete = 2] = "Incomplete", e[e.ESC = 3] = "ESC", e[e.Unknown = 4] = "Unknown", e[e.SGR = 5] = "SGR", e[e.OSCURL = 6] = "OSCURL";
1390
+ })(G ||= {});
1391
+ var fr = class {
1392
+ constructor() {
1393
+ this.VERSION = "6.0.6", this.setup_palettes(), this._use_classes = !1, this.bold = !1, this.faint = !1, this.italic = !1, this.underline = !1, this.fg = this.bg = null, this._buffer = "", this._url_allowlist = {
1394
+ http: 1,
1395
+ https: 1
1396
+ }, this._escape_html = !0, this.boldStyle = "font-weight:bold", this.faintStyle = "opacity:0.7", this.italicStyle = "font-style:italic", this.underlineStyle = "text-decoration:underline";
1397
+ }
1398
+ set use_classes(e) {
1399
+ this._use_classes = e;
1400
+ }
1401
+ get use_classes() {
1402
+ return this._use_classes;
1403
+ }
1404
+ set url_allowlist(e) {
1405
+ this._url_allowlist = e;
1406
+ }
1407
+ get url_allowlist() {
1408
+ return this._url_allowlist;
1409
+ }
1410
+ set escape_html(e) {
1411
+ this._escape_html = e;
1412
+ }
1413
+ get escape_html() {
1414
+ return this._escape_html;
1415
+ }
1416
+ set boldStyle(e) {
1417
+ this._boldStyle = e;
1418
+ }
1419
+ get boldStyle() {
1420
+ return this._boldStyle;
1421
+ }
1422
+ set faintStyle(e) {
1423
+ this._faintStyle = e;
1424
+ }
1425
+ get faintStyle() {
1426
+ return this._faintStyle;
1427
+ }
1428
+ set italicStyle(e) {
1429
+ this._italicStyle = e;
1430
+ }
1431
+ get italicStyle() {
1432
+ return this._italicStyle;
1433
+ }
1434
+ set underlineStyle(e) {
1435
+ this._underlineStyle = e;
1436
+ }
1437
+ get underlineStyle() {
1438
+ return this._underlineStyle;
1439
+ }
1440
+ setup_palettes() {
1441
+ this.ansi_colors = [[
1442
+ {
1443
+ rgb: [
1444
+ 0,
1445
+ 0,
1446
+ 0
1447
+ ],
1448
+ class_name: "ansi-black"
1449
+ },
1450
+ {
1451
+ rgb: [
1452
+ 187,
1453
+ 0,
1454
+ 0
1455
+ ],
1456
+ class_name: "ansi-red"
1457
+ },
1458
+ {
1459
+ rgb: [
1460
+ 0,
1461
+ 187,
1462
+ 0
1463
+ ],
1464
+ class_name: "ansi-green"
1465
+ },
1466
+ {
1467
+ rgb: [
1468
+ 187,
1469
+ 187,
1470
+ 0
1471
+ ],
1472
+ class_name: "ansi-yellow"
1473
+ },
1474
+ {
1475
+ rgb: [
1476
+ 0,
1477
+ 0,
1478
+ 187
1479
+ ],
1480
+ class_name: "ansi-blue"
1481
+ },
1482
+ {
1483
+ rgb: [
1484
+ 187,
1485
+ 0,
1486
+ 187
1487
+ ],
1488
+ class_name: "ansi-magenta"
1489
+ },
1490
+ {
1491
+ rgb: [
1492
+ 0,
1493
+ 187,
1494
+ 187
1495
+ ],
1496
+ class_name: "ansi-cyan"
1497
+ },
1498
+ {
1499
+ rgb: [
1500
+ 255,
1501
+ 255,
1502
+ 255
1503
+ ],
1504
+ class_name: "ansi-white"
1505
+ }
1506
+ ], [
1507
+ {
1508
+ rgb: [
1509
+ 85,
1510
+ 85,
1511
+ 85
1512
+ ],
1513
+ class_name: "ansi-bright-black"
1514
+ },
1515
+ {
1516
+ rgb: [
1517
+ 255,
1518
+ 85,
1519
+ 85
1520
+ ],
1521
+ class_name: "ansi-bright-red"
1522
+ },
1523
+ {
1524
+ rgb: [
1525
+ 0,
1526
+ 255,
1527
+ 0
1528
+ ],
1529
+ class_name: "ansi-bright-green"
1530
+ },
1531
+ {
1532
+ rgb: [
1533
+ 255,
1534
+ 255,
1535
+ 85
1536
+ ],
1537
+ class_name: "ansi-bright-yellow"
1538
+ },
1539
+ {
1540
+ rgb: [
1541
+ 85,
1542
+ 85,
1543
+ 255
1544
+ ],
1545
+ class_name: "ansi-bright-blue"
1546
+ },
1547
+ {
1548
+ rgb: [
1549
+ 255,
1550
+ 85,
1551
+ 255
1552
+ ],
1553
+ class_name: "ansi-bright-magenta"
1554
+ },
1555
+ {
1556
+ rgb: [
1557
+ 85,
1558
+ 255,
1559
+ 255
1560
+ ],
1561
+ class_name: "ansi-bright-cyan"
1562
+ },
1563
+ {
1564
+ rgb: [
1565
+ 255,
1566
+ 255,
1567
+ 255
1568
+ ],
1569
+ class_name: "ansi-bright-white"
1570
+ }
1571
+ ]], this.palette_256 = [], this.ansi_colors.forEach((e) => {
1572
+ e.forEach((e) => {
1573
+ this.palette_256.push(e);
1574
+ });
1575
+ });
1576
+ let e = [
1577
+ 0,
1578
+ 95,
1579
+ 135,
1580
+ 175,
1581
+ 215,
1582
+ 255
1583
+ ];
1584
+ for (let t = 0; t < 6; ++t) for (let n = 0; n < 6; ++n) for (let r = 0; r < 6; ++r) {
1585
+ let i = {
1586
+ rgb: [
1587
+ e[t],
1588
+ e[n],
1589
+ e[r]
1590
+ ],
1591
+ class_name: "truecolor"
1592
+ };
1593
+ this.palette_256.push(i);
1594
+ }
1595
+ let t = 8;
1596
+ for (let e = 0; e < 24; ++e, t += 10) {
1597
+ let e = {
1598
+ rgb: [
1599
+ t,
1600
+ t,
1601
+ t
1602
+ ],
1603
+ class_name: "truecolor"
1604
+ };
1605
+ this.palette_256.push(e);
1606
+ }
1607
+ }
1608
+ escape_txt_for_html(e) {
1609
+ return this._escape_html ? e.replace(/[&<>"']/gm, (e) => {
1610
+ if (e === "&") return "&amp;";
1611
+ if (e === "<") return "&lt;";
1612
+ if (e === ">") return "&gt;";
1613
+ if (e === "\"") return "&quot;";
1614
+ if (e === "'") return "&#x27;";
1615
+ }) : e;
1616
+ }
1617
+ append_buffer(e) {
1618
+ var t = this._buffer + e;
1619
+ this._buffer = t;
1620
+ }
1621
+ get_next_packet() {
1622
+ var e = {
1623
+ kind: G.EOS,
1624
+ text: "",
1625
+ url: ""
1626
+ }, t = this._buffer.length;
1627
+ if (t == 0) return e;
1628
+ var n = this._buffer.indexOf("\x1B");
1629
+ if (n == -1) return e.kind = G.Text, e.text = this._buffer, this._buffer = "", e;
1630
+ if (n > 0) return e.kind = G.Text, e.text = this._buffer.slice(0, n), this._buffer = this._buffer.slice(n), e;
1631
+ if (n == 0) {
1632
+ if (t < 3) return e.kind = G.Incomplete, e;
1633
+ var r = this._buffer.charAt(1);
1634
+ if (r != "[" && r != "]" && r != "(") return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1635
+ if (r == "[") {
1636
+ this._csi_regex ||= pr(hr ||= dr(["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \x1B[ # CSI\n ([<-?]?) # private-mode char\n ([d;]*) # any digits or semicolons\n ([ -/]? # an intermediate modifier\n [@-~]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \x1B[ # CSI\n [ -~]* # anything legal\n ([\0-:]) # anything illegal\n )\n "], ["\n ^ # beginning of line\n #\n # First attempt\n (?: # legal sequence\n \\x1b\\[ # CSI\n ([\\x3c-\\x3f]?) # private-mode char\n ([\\d;]*) # any digits or semicolons\n ([\\x20-\\x2f]? # an intermediate modifier\n [\\x40-\\x7e]) # the command\n )\n | # alternate (second attempt)\n (?: # illegal sequence\n \\x1b\\[ # CSI\n [\\x20-\\x7e]* # anything legal\n ([\\x00-\\x1f:]) # anything illegal\n )\n "]));
1637
+ let t = this._buffer.match(this._csi_regex);
1638
+ if (t === null) return e.kind = G.Incomplete, e;
1639
+ if (t[4]) return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1640
+ e.kind = t[1] != "" || t[3] != "m" ? G.Unknown : G.SGR, e.text = t[2];
1641
+ var i = t[0].length;
1642
+ return this._buffer = this._buffer.slice(i), e;
1643
+ }
1644
+ if (r == "]") {
1645
+ if (t < 4) return e.kind = G.Incomplete, e;
1646
+ if (this._buffer.charAt(2) != "8" || this._buffer.charAt(3) != ";") return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1647
+ this._osc_st ||= mr(gr ||= dr(["\n (?: # legal sequence\n (\x1B\\) # ESC | # alternate\n (\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\0-] # anything illegal\n | # alternate\n [\b-] # anything illegal\n | # alternate\n [-] # anything illegal\n )\n "], ["\n (?: # legal sequence\n (\\x1b\\\\) # ESC \\\n | # alternate\n (\\x07) # BEL (what xterm did)\n )\n | # alternate (second attempt)\n ( # illegal sequence\n [\\x00-\\x06] # anything illegal\n | # alternate\n [\\x08-\\x1a] # anything illegal\n | # alternate\n [\\x1c-\\x1f] # anything illegal\n )\n "])), this._osc_st.lastIndex = 0;
1648
+ {
1649
+ let t = this._osc_st.exec(this._buffer);
1650
+ if (t === null) return e.kind = G.Incomplete, e;
1651
+ if (t[3]) return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1652
+ }
1653
+ {
1654
+ let t = this._osc_st.exec(this._buffer);
1655
+ if (t === null) return e.kind = G.Incomplete, e;
1656
+ if (t[3]) return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1657
+ }
1658
+ this._osc_regex ||= pr(_r ||= dr(["\n ^ # beginning of line\n #\n \x1B]8; # OSC Hyperlink\n [ -:<-~]* # params (excluding ;)\n ; # end of params\n ([!-~]{0,512}) # URL capture\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n ([ -~]+) # TEXT capture\n \x1B]8;; # OSC Hyperlink End\n (?: # ST\n (?:\x1B\\) # ESC | # alternate\n (?:\x07) # BEL (what xterm did)\n )\n "], ["\n ^ # beginning of line\n #\n \\x1b\\]8; # OSC Hyperlink\n [\\x20-\\x3a\\x3c-\\x7e]* # params (excluding ;)\n ; # end of params\n ([\\x21-\\x7e]{0,512}) # URL capture\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n ([\\x20-\\x7e]+) # TEXT capture\n \\x1b\\]8;; # OSC Hyperlink End\n (?: # ST\n (?:\\x1b\\\\) # ESC \\\n | # alternate\n (?:\\x07) # BEL (what xterm did)\n )\n "]));
1659
+ let n = this._buffer.match(this._osc_regex);
1660
+ if (n === null) return e.kind = G.ESC, e.text = this._buffer.slice(0, 1), this._buffer = this._buffer.slice(1), e;
1661
+ e.kind = G.OSCURL, e.url = n[1], e.text = n[2];
1662
+ var i = n[0].length;
1663
+ return this._buffer = this._buffer.slice(i), e;
1664
+ }
1665
+ if (r == "(") return e.kind = G.Unknown, this._buffer = this._buffer.slice(3), e;
1666
+ }
1667
+ }
1668
+ ansi_to_html(e) {
1669
+ this.append_buffer(e);
1670
+ for (var t = [];;) {
1671
+ var n = this.get_next_packet();
1672
+ if (n.kind == G.EOS || n.kind == G.Incomplete) break;
1673
+ n.kind != G.ESC && n.kind != G.Unknown && (n.kind == G.Text ? t.push(this.transform_to_html(this.with_state(n))) : n.kind == G.SGR ? this.process_ansi(n) : n.kind == G.OSCURL && t.push(this.process_hyperlink(n)));
1674
+ }
1675
+ return t.join("");
1676
+ }
1677
+ with_state(e) {
1678
+ return {
1679
+ bold: this.bold,
1680
+ faint: this.faint,
1681
+ italic: this.italic,
1682
+ underline: this.underline,
1683
+ fg: this.fg,
1684
+ bg: this.bg,
1685
+ text: e.text
1686
+ };
1687
+ }
1688
+ process_ansi(e) {
1689
+ let t = e.text.split(";");
1690
+ for (; t.length > 0;) {
1691
+ let e = t.shift(), n = parseInt(e, 10);
1692
+ if (isNaN(n) || n === 0) this.fg = null, this.bg = null, this.bold = !1, this.faint = !1, this.italic = !1, this.underline = !1;
1693
+ else if (n === 1) this.bold = !0;
1694
+ else if (n === 2) this.faint = !0;
1695
+ else if (n === 3) this.italic = !0;
1696
+ else if (n === 4) this.underline = !0;
1697
+ else if (n === 21) this.bold = !1;
1698
+ else if (n === 22) this.faint = !1, this.bold = !1;
1699
+ else if (n === 23) this.italic = !1;
1700
+ else if (n === 24) this.underline = !1;
1701
+ else if (n === 39) this.fg = null;
1702
+ else if (n === 49) this.bg = null;
1703
+ else if (n >= 30 && n < 38) this.fg = this.ansi_colors[0][n - 30];
1704
+ else if (n >= 40 && n < 48) this.bg = this.ansi_colors[0][n - 40];
1705
+ else if (n >= 90 && n < 98) this.fg = this.ansi_colors[1][n - 90];
1706
+ else if (n >= 100 && n < 108) this.bg = this.ansi_colors[1][n - 100];
1707
+ else if ((n === 38 || n === 48) && t.length > 0) {
1708
+ let e = n === 38, r = t.shift();
1709
+ if (r === "5" && t.length > 0) {
1710
+ let n = parseInt(t.shift(), 10);
1711
+ n >= 0 && n <= 255 && (e ? this.fg = this.palette_256[n] : this.bg = this.palette_256[n]);
1712
+ }
1713
+ if (r === "2" && t.length > 2) {
1714
+ let n = parseInt(t.shift(), 10), r = parseInt(t.shift(), 10), i = parseInt(t.shift(), 10);
1715
+ if (n >= 0 && n <= 255 && r >= 0 && r <= 255 && i >= 0 && i <= 255) {
1716
+ let t = {
1717
+ rgb: [
1718
+ n,
1719
+ r,
1720
+ i
1721
+ ],
1722
+ class_name: "truecolor"
1723
+ };
1724
+ e ? this.fg = t : this.bg = t;
1725
+ }
1726
+ }
1727
+ }
1728
+ }
1729
+ }
1730
+ transform_to_html(e) {
1731
+ let t = e.text;
1732
+ if (t.length === 0 || (t = this.escape_txt_for_html(t), !e.bold && !e.italic && !e.faint && !e.underline && e.fg === null && e.bg === null)) return t;
1733
+ let n = [], r = [], i = e.fg, a = e.bg;
1734
+ e.bold && n.push(this._boldStyle), e.faint && n.push(this._faintStyle), e.italic && n.push(this._italicStyle), e.underline && n.push(this._underlineStyle), this._use_classes ? (i && (i.class_name === "truecolor" ? n.push(`color:rgb(${i.rgb.join(",")})`) : r.push(`${i.class_name}-fg`)), a && (a.class_name === "truecolor" ? n.push(`background-color:rgb(${a.rgb.join(",")})`) : r.push(`${a.class_name}-bg`))) : (i && n.push(`color:rgb(${i.rgb.join(",")})`), a && n.push(`background-color:rgb(${a.rgb})`));
1735
+ let o = "", s = "";
1736
+ return r.length && (o = ` class="${r.join(" ")}"`), n.length && (s = ` style="${n.join(";")}"`), `<span${s}${o}>${t}</span>`;
1737
+ }
1738
+ process_hyperlink(e) {
1739
+ let t = e.url.split(":");
1740
+ return t.length < 1 || !this._url_allowlist[t[0]] ? "" : `<a href="${this.escape_txt_for_html(e.url)}">${this.escape_txt_for_html(e.text)}</a>`;
1741
+ }
1742
+ };
1743
+ function pr(e, ...t) {
1744
+ let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
1745
+ return new RegExp(n);
1746
+ }
1747
+ function mr(e, ...t) {
1748
+ let n = e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm, "");
1749
+ return new RegExp(n, "g");
1750
+ }
1751
+ var hr, gr, _r, vr = new fr();
1752
+ function K(e) {
1753
+ try {
1754
+ let t = document.createElement("div");
1755
+ return t.innerHTML = e, (t.textContent || t.innerText || "").split("\n").map((e) => e.trimEnd()).join("\n");
1756
+ } catch (n) {
1757
+ return t.error("Error parsing HTML content:", n), e;
1758
+ }
1759
+ }
1760
+ function yr(e) {
1761
+ if (!e) return "";
1762
+ try {
1763
+ return K(vr.ansi_to_html(e));
1764
+ } catch (n) {
1765
+ return t.error("Error converting ANSI to plain text:", n), e;
1766
+ }
1767
+ }
1768
+ //#endregion
1769
+ //#region src/core/errors/traceback-atom.ts
1770
+ var br = h(null);
1771
+ //#endregion
1772
+ //#region src/core/cells/logs.ts
1773
+ function xr(e) {
1774
+ return e.type === "cell" ? e.cellId : `lsp:${e.name}`;
1775
+ }
1776
+ var Sr = !1;
1777
+ function Cr(e) {
1778
+ let t = [], n = [e.console].filter(Boolean).flat();
1779
+ for (let r of n) {
1780
+ let n = r.mimetype === "text/plain", i = r.mimetype === "text/html" || r.mimetype === "application/vnd.marimo+traceback";
1781
+ if (n || i) {
1782
+ let n = r.channel === "stderr" || r.channel === "marimo-error";
1783
+ switch (r.channel) {
1784
+ case "stdout":
1785
+ case "stderr":
1786
+ case "marimo-error": {
1787
+ let a = d.asString(r.data), o = i ? K(a) : a;
1788
+ t.push({
1789
+ timestamp: r.timestamp || Date.now(),
1790
+ level: n ? "stderr" : "stdout",
1791
+ message: o,
1792
+ source: {
1793
+ type: "cell",
1794
+ cellId: e.cell_id
1795
+ }
1796
+ });
1797
+ break;
1798
+ }
1799
+ }
1800
+ }
1801
+ }
1802
+ if (t.forEach(wr.log), n.length === 0 && R(e.output?.mimetype) && Array.isArray(e.output.data)) {
1803
+ e.output.data.forEach((t) => {
1804
+ wr.log({
1805
+ level: "stderr",
1806
+ source: {
1807
+ type: "cell",
1808
+ cellId: e.cell_id
1809
+ },
1810
+ timestamp: e.timestamp ?? 0,
1811
+ message: JSON.stringify(t)
1812
+ });
1813
+ });
1814
+ let t = e.output.data.filter((e) => "type" in e && e.type === "exception" || e.type === "internal"), n = C.get(_e) === "read";
1815
+ if (t.length > 0 && !Sr && n) {
1816
+ Sr = !0;
1817
+ let e = t.find((e) => e.traceback);
1818
+ o(e ? {
1819
+ title: "An internal error occurred",
1820
+ description: e.msg || "Click 'View' to see traceback",
1821
+ variant: "danger",
1822
+ action: T.createElement(se, {
1823
+ altText: "View traceback",
1824
+ onClick: () => {
1825
+ C.set(br, {
1826
+ traceback: e.traceback,
1827
+ errorMessage: e.msg || "An internal error occurred"
1828
+ });
1829
+ }
1830
+ }, "View")
1831
+ } : {
1832
+ title: "An internal error occurred",
1833
+ description: "See console for details.",
1834
+ variant: "danger"
1835
+ });
1836
+ }
1837
+ }
1838
+ return t;
1839
+ }
1840
+ var wr = { log: (e) => {
1841
+ let t = e.level === "stdout" ? "gray" : e.level === "stderr" ? "red" : "orange", n = e.level.toUpperCase();
1842
+ console.log(`%c[${n}]`, `color:${t}; padding:2px 0; border-radius:2px; font-weight:bold`, `[${Tr(e.timestamp)}]`, `(${xr(e.source)}) ${e.message}`);
1843
+ } };
1844
+ function Tr(e) {
1845
+ try {
1846
+ return ur(e).toLocaleTimeString(void 0, {
1847
+ hour12: !0,
1848
+ hour: "numeric",
1849
+ minute: "numeric",
1850
+ second: "numeric"
1851
+ });
1852
+ } catch {
1853
+ return "";
1854
+ }
1855
+ }
1856
+ //#endregion
1857
+ //#region src/components/editor/navigation/focus-utils.ts
1858
+ function Er(e, n) {
1859
+ let r = document.getElementById(V.create(e));
1860
+ r ? Or(r, n) : t.warn(`[CellFocusManager] focusCell: element not found: ${e}`);
1861
+ }
1862
+ function Dr() {
1863
+ return document.activeElement instanceof HTMLElement && document.activeElement.classList.contains("marimo-cell");
1864
+ }
1865
+ function Or(e, n) {
1866
+ try {
1867
+ e.focus(n);
1868
+ } catch {
1869
+ t.warn("[CellFocusManager] element may not be focusable", e);
1870
+ }
1871
+ }
1872
+ //#endregion
1873
+ //#region src/utils/timeout.ts
1874
+ function kr(e, n) {
1875
+ let { retries: r, delay: i, initialDelay: a = 0 } = n, o = 0, s = () => {
1876
+ if (o < r) {
1877
+ try {
1878
+ if (e()) return;
1879
+ } catch (e) {
1880
+ t.error(`Error executing function on attempt ${o + 1}, retrying`, { error: e });
1881
+ }
1882
+ o++, setTimeout(s, i);
1883
+ }
1884
+ };
1885
+ a > 0 ? setTimeout(s, a) : s();
1886
+ }
1887
+ //#endregion
1888
+ //#region src/core/cells/utils.ts
1889
+ function Ar(e, t, n) {
1890
+ return Ir(e, t, n).length > 0;
1891
+ }
1892
+ function jr(e) {
1893
+ return e.cellIds.map((t) => e.cellData[t]);
1894
+ }
1895
+ function Mr(e) {
1896
+ let { cellIds: t, cellData: n } = e, r = [];
1897
+ for (let e of t) n[e].config.disabled && r.push(e);
1898
+ return r;
1899
+ }
1900
+ function Nr(e) {
1901
+ let { cellIds: t, cellData: n } = e, r = [];
1902
+ for (let e of t) n[e].config.disabled || r.push(e);
1903
+ return r;
1904
+ }
1905
+ function Pr(e) {
1906
+ return e.history.length > 0;
1907
+ }
1908
+ function Fr(e) {
1909
+ let t = e.history[e.history.length - 1];
1910
+ return t && t.type === "move" ? "Undo move" : "Undo cell deletion";
1911
+ }
1912
+ function Ir(e, t, n) {
1913
+ let { cellIds: r, cellData: i } = e;
1914
+ return r.filter((e) => {
1915
+ let r = St(t, e);
1916
+ return r.status === "idle" ? Rr(r) || zr({
1917
+ freshness: n(e),
1918
+ interrupted: r.outcome === "interrupted",
1919
+ disabled: i[e].config.disabled,
1920
+ blocked: r.blocked
1921
+ }) : Lr(t.executions, e) && n(e).sourceChanged;
1922
+ });
1923
+ }
1924
+ function Lr(e, t) {
1925
+ let n = e.latest.get(t), r = n === void 0 ? void 0 : e.executions.get(n)?.record;
1926
+ return r !== void 0 && r.status !== "completed";
1927
+ }
1928
+ function Rr({ status: e, outcome: t, live: n }) {
1929
+ return (t === null || !n) && e !== "queued" && e !== "running";
1930
+ }
1931
+ function zr({ freshness: e, interrupted: t, disabled: n, blocked: r }) {
1932
+ return e.sourceChanged || t || e.inputsChanged && !(n || r);
1933
+ }
1934
+ function Br({ errored: e, stopped: t }) {
1935
+ return {
1936
+ published: !0,
1937
+ "has-error": e,
1938
+ stopped: t
1939
+ };
1940
+ }
1941
+ function Vr({ errored: e, interrupted: t, stopped: n, output: r, showErrorTracebacks: i }) {
1942
+ let a = R(r?.mimetype), o = i && a && Array.isArray(r?.data) && r.data.some((e) => e.type === "exception" && "traceback" in e && e.traceback);
1943
+ return (e || t || n || a) && !o;
1944
+ }
1945
+ //#endregion
1946
+ //#region src/core/network/requests.ts
1947
+ var Hr = h(null);
1948
+ function Ur() {
1949
+ let e = g(Hr);
1950
+ return w(e, "useRequestClient() requires setting requestClientAtom."), e;
1951
+ }
1952
+ function Wr() {
1953
+ let e = C.get(Hr);
1954
+ return w(e, "getRequestClient() requires requestClientAtom to be set."), e;
1955
+ }
1956
+ //#endregion
1957
+ //#region src/utils/storage/storage.ts
1958
+ var Gr = class {
1959
+ store = /* @__PURE__ */ new Map();
1960
+ get length() {
1961
+ return this.store.size;
1962
+ }
1963
+ clear() {
1964
+ this.store.clear();
1965
+ }
1966
+ getItem(e) {
1967
+ return this.store.get(e) || null;
1968
+ }
1969
+ key(e) {
1970
+ return [...this.store.keys()][e] || null;
1971
+ }
1972
+ removeItem(e) {
1973
+ this.store.delete(e);
1974
+ }
1975
+ setItem(e, t) {
1976
+ this.store.set(e, t);
1977
+ }
1978
+ };
1979
+ function Kr() {
1980
+ let { hasLocalStorage: e, hasSessionStorage: t } = be();
1981
+ return e ? window.localStorage : t ? window.sessionStorage : new Gr();
1982
+ }
1983
+ var qr = Kr(), Jr = /(https?:\/\/[^\s"<>`{}|\\^]+)/, Yr = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i, Xr = /^data:image\//i, Zr = ["avatars.githubusercontent.com"];
1984
+ function Qr(e) {
1985
+ return Xr.test(e) ? [{
1986
+ type: "image",
1987
+ url: e
1988
+ }] : e.split(Jr).filter((e) => e !== "").map((e) => Jr.test(e) ? Yr.test(e) || Xr.test(e) || Zr.some((t) => e.includes(t)) ? {
1989
+ type: "image",
1990
+ url: e
1991
+ } : {
1992
+ type: "url",
1993
+ url: e
1994
+ } : {
1995
+ type: "text",
1996
+ value: e
1997
+ });
1998
+ }
1999
+ //#endregion
2000
+ //#region src/utils/json/json-parser.ts
2001
+ var $r = new RegExp(Jr.source, "g");
2002
+ BigInt.prototype.toJSON = function() {
2003
+ return JSON.rawJSON(this.toString());
2004
+ };
2005
+ function ei(e) {
2006
+ try {
2007
+ return JSON.parse(e, (e, t) => ii(t));
2008
+ } catch {}
2009
+ if (e == null || e === "") return {};
2010
+ try {
2011
+ return e ??= "", e = e.replaceAll(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g, "\"◐$1◐\""), JSON.parse(e, (e, t) => typeof t == "string" ? t === "◐NaN◐" ? NaN : t === "◐Infinity◐" ? Infinity : t === "◐-Infinity◐" ? -Infinity : ii(t) : ii(t));
2012
+ } catch {
2013
+ return {};
2014
+ }
2015
+ }
2016
+ function ti(e) {
2017
+ if (e.length === 0) return "";
2018
+ let t = Object.keys(e[0]);
2019
+ return [
2020
+ `| ${t.join(" | ")} |`,
2021
+ `|${t.map(() => "---").join("|")}|`,
2022
+ ...e.map((e) => `| ${t.map((t) => ni(e[t])).join(" | ")} |`)
2023
+ ].join("\n");
2024
+ }
2025
+ function ni(e) {
2026
+ if (e == null) return "";
2027
+ if (Array.isArray(e) || typeof e == "object") return ri(JSON.stringify(e));
2028
+ let t = String(e), n = /\[([^\]]+)]\((https?:\/\/[^)]+)\)/g, r = /* @__PURE__ */ new Map(), i = 0;
2029
+ t = t.replaceAll(n, (e) => {
2030
+ let t = `__MDLINK_${i++}__`;
2031
+ return r.set(t, e), t;
2032
+ }), t = t.replaceAll($r, "[$1]($1)");
2033
+ for (let [e, n] of r) t = t.replace(e, n);
2034
+ return ri(t);
2035
+ }
2036
+ function ri(e) {
2037
+ return e.replaceAll("\\", "\\\\").replaceAll("|", "\\|").replaceAll("\n", " ").replaceAll("\r", "");
2038
+ }
2039
+ function ii(e) {
2040
+ return typeof e == "object" && e && "$bigint" in e && typeof e.$bigint == "string" ? BigInt(e.$bigint) : e;
2041
+ }
2042
+ var ai = new class {
2043
+ getFilename() {
2044
+ return this.getSearchParam("filename");
2045
+ }
2046
+ setFilename(e) {
2047
+ this.setSearchParam("filename", e);
2048
+ }
2049
+ getCodeFromSearchParam() {
2050
+ return this.getSearchParam("code");
2051
+ }
2052
+ getCodeFromHash() {
2053
+ let e = window.location.hash;
2054
+ return e.startsWith("#code/") ? e.slice(6) : null;
2055
+ }
2056
+ setCodeForHash(e) {
2057
+ window.location.hash = `#code/${e}`;
2058
+ }
2059
+ setSearchParam(e, t) {
2060
+ let n = new URL(window.location.href);
2061
+ n.searchParams.set(e, t), window.history.replaceState({}, "", n.toString());
2062
+ }
2063
+ getSearchParam(e) {
2064
+ return new URL(window.location.href).searchParams.get(e);
2065
+ }
2066
+ }();
2067
+ //#endregion
2068
+ //#region src/core/dom/htmlUtils.ts
2069
+ function oi(e) {
2070
+ return ei(e ?? "");
2071
+ }
2072
+ function si(e) {
2073
+ return ce.mapValues(e.dataset, (e) => typeof e == "string" ? oi(e) : e);
2074
+ }
2075
+ function ci(e, t) {
2076
+ let n = e.parentElement ? Pn.parse(e.parentElement) : void 0;
2077
+ return n && t.has(n) ? t.lookupValue(n) : oi(e.dataset.initialValue);
2078
+ }
2079
+ function li() {
2080
+ if (S()) return document.title || null;
2081
+ if (he()) {
2082
+ let e = ai.getFilename();
2083
+ if (e) return e;
2084
+ }
2085
+ let e = document.querySelector("marimo-filename");
2086
+ ve(e, "marimo-filename tag not found");
2087
+ let t = e.innerHTML;
2088
+ return t.length === 0 ? null : t;
2089
+ }
2090
+ //#endregion
2091
+ //#region src/core/saving/file-state.ts
2092
+ var q = h(li());
2093
+ h(null);
2094
+ var ui = h(null);
2095
+ h(void 0);
2096
+ //#endregion
2097
+ //#region src/utils/storage/typed.ts
2098
+ var di = class {
2099
+ defaultValue;
2100
+ storage;
2101
+ constructor(e, t = qr) {
2102
+ this.defaultValue = e, this.storage = t;
2103
+ }
2104
+ get(e) {
2105
+ try {
2106
+ let t = this.storage.getItem(e);
2107
+ return t ? JSON.parse(t) : this.defaultValue;
2108
+ } catch {
2109
+ return this.defaultValue;
2110
+ }
2111
+ }
2112
+ set(e, t) {
2113
+ this.storage.setItem(e, JSON.stringify(t));
2114
+ }
2115
+ remove(e) {
2116
+ this.storage.removeItem(e);
2117
+ }
2118
+ }, fi = class {
2119
+ schema;
2120
+ getDefaultValue;
2121
+ storage;
2122
+ constructor(e, t, n = qr) {
2123
+ this.schema = e, this.getDefaultValue = t, this.storage = n;
2124
+ }
2125
+ get(e) {
2126
+ try {
2127
+ let n = this.storage.getItem(e);
2128
+ if (n == null) return this.getDefaultValue();
2129
+ let r = this.schema.safeParse(JSON.parse(n));
2130
+ return r.success ? r.data : (t.warn("Error parsing zod local storage", r.error), this.getDefaultValue());
2131
+ } catch (e) {
2132
+ return t.warn("Error getting zod local storage", e), this.getDefaultValue();
2133
+ }
2134
+ }
2135
+ set(e, t) {
2136
+ this.storage.setItem(e, JSON.stringify(t));
2137
+ }
2138
+ remove(e) {
2139
+ this.storage.removeItem(e);
2140
+ }
2141
+ }, pi = class extends fi {
2142
+ filename;
2143
+ unsubscribeFromFilename;
2144
+ constructor(e, t, n) {
2145
+ let r = C.get(q);
2146
+ super(t, n), this.filename = r;
2147
+ try {
2148
+ this.unsubscribeFromFilename = C.sub(q, () => {
2149
+ let t = C.get(q);
2150
+ this.handleFilenameChange(e, t);
2151
+ });
2152
+ } catch {
2153
+ this.unsubscribeFromFilename = null;
2154
+ }
2155
+ }
2156
+ get(e) {
2157
+ return super.get(this.createScopedKey(e, this.filename));
2158
+ }
2159
+ set(e, t) {
2160
+ super.set(this.createScopedKey(e, this.filename), t);
2161
+ }
2162
+ remove(e) {
2163
+ super.remove(this.createScopedKey(e, this.filename));
2164
+ }
2165
+ createScopedKey(e, t) {
2166
+ return t ? `${e}:${t}` : e;
2167
+ }
2168
+ handleFilenameChange(e, t) {
2169
+ if (t && t !== this.filename) {
2170
+ let n = this.get(e);
2171
+ this.remove(e), this.filename = t, this.set(e, n);
2172
+ }
2173
+ }
2174
+ dispose() {
2175
+ this.unsubscribeFromFilename &&= (this.unsubscribeFromFilename(), null);
2176
+ }
2177
+ }, J = {
2178
+ VariableName: "VariableName",
2179
+ FunctionDefinition: "FunctionDefinition",
2180
+ ClassDefinition: "ClassDefinition",
2181
+ LambdaExpression: "LambdaExpression",
2182
+ ParamList: "ParamList",
2183
+ Decorator: "Decorator",
2184
+ AssignStatement: "AssignStatement",
2185
+ ForStatement: "ForStatement",
2186
+ ImportStatement: "ImportStatement",
2187
+ TryStatement: "TryStatement",
2188
+ WithStatement: "WithStatement",
2189
+ TupleExpression: "TupleExpression",
2190
+ ArrayExpression: "ArrayExpression",
2191
+ ParenthesizedExpression: "ParenthesizedExpression",
2192
+ CallExpression: "CallExpression",
2193
+ ArgList: "ArgList",
2194
+ AssignOp: "AssignOp",
2195
+ ArrayComprehensionExpression: "ArrayComprehensionExpression",
2196
+ SetComprehensionExpression: "SetComprehensionExpression",
2197
+ DictionaryComprehensionExpression: "DictionaryComprehensionExpression",
2198
+ ComprehensionExpression: "ComprehensionExpression",
2199
+ Comment: "Comment",
2200
+ String: "String",
2201
+ FormatString: "FormatString"
2202
+ }, Y = {
2203
+ For: "for",
2204
+ In: "in",
2205
+ As: "as",
2206
+ Import: "import"
2207
+ }, mi = /* @__PURE__ */ new Set([
2208
+ J.FunctionDefinition,
2209
+ J.LambdaExpression,
2210
+ J.ArrayComprehensionExpression,
2211
+ J.SetComprehensionExpression,
2212
+ J.DictionaryComprehensionExpression,
2213
+ J.ComprehensionExpression,
2214
+ J.ClassDefinition
2215
+ ]);
2216
+ J.Comment, J.String, J.FormatString;
2217
+ //#endregion
2218
+ //#region src/core/codemirror/utils.ts
2219
+ function hi(e) {
2220
+ e && e.dispatch({ selection: {
2221
+ anchor: e.state.doc.length,
2222
+ head: e.state.doc.length
2223
+ } });
2224
+ }
2225
+ function gi(e) {
2226
+ let t = e.dom.closest(".marimo-cell");
2227
+ t && requestAnimationFrame(() => {
2228
+ t.scrollIntoView({
2229
+ behavior: "instant",
2230
+ block: "nearest",
2231
+ inline: "nearest"
2232
+ });
2233
+ });
2234
+ }
2235
+ //#endregion
2236
+ //#region src/core/codemirror/go-to-definition/commands.ts
2237
+ var _i = /* @__PURE__ */ new Set([J.ClassDefinition]);
2238
+ function vi(e, t) {
2239
+ requestAnimationFrame(() => {
2240
+ e.focus(), e.dispatch({
2241
+ selection: {
2242
+ anchor: t,
2243
+ head: t
2244
+ },
2245
+ effects: de.scrollIntoView(t, { y: "center" })
2246
+ });
2247
+ }), gi(e);
2248
+ }
2249
+ function yi(e, t) {
2250
+ let n = fe(e), r = null;
2251
+ return n.iterate({ enter: (n) => {
2252
+ if (r !== null) return !1;
2253
+ if (n.name === J.VariableName && e.doc.sliceString(n.from, n.to) === t) return r = n.from, !1;
2254
+ if (n.name === J.Comment || n.name === J.String) return !1;
2255
+ } }), r;
2256
+ }
2257
+ function bi(e, t) {
2258
+ let n = [], r = e.resolveInner(t, 0);
2259
+ for (; r;) mi.has(r.name) && (n.some((e) => e.type === J.FunctionDefinition || e.type === J.LambdaExpression) && r.name === J.ClassDefinition || n.push({
2260
+ id: r.from,
2261
+ type: r.name
2262
+ })), r = r.parent;
2263
+ return n.push({
2264
+ id: -1,
2265
+ type: "global"
2266
+ }), n;
2267
+ }
2268
+ function X(e, t, n) {
2269
+ e.push({
2270
+ scopeId: t,
2271
+ from: n
2272
+ });
2273
+ }
2274
+ function xi(e, t) {
2275
+ if (e.firstChild()) do
2276
+ t(e.node);
2277
+ while (e.nextSibling());
2278
+ }
2279
+ function Si(e, t) {
2280
+ let { state: n, variableName: r, scopeId: i, declarations: a } = t;
2281
+ switch (e.name) {
2282
+ case J.VariableName:
2283
+ n.doc.sliceString(e.from, e.to) === r && X(a, i, e.from);
2284
+ break;
2285
+ case J.TupleExpression:
2286
+ case J.ArrayExpression: {
2287
+ let n = e.node.cursor();
2288
+ n.firstChild();
2289
+ do
2290
+ Si(n, t);
2291
+ while (n.nextSibling());
2292
+ break;
2293
+ }
2294
+ }
2295
+ }
2296
+ function Ci(e, t) {
2297
+ let { state: n, variableName: r, scopeId: i, declarations: a } = t, o = e.cursor();
2298
+ o.firstChild();
2299
+ do {
2300
+ if (o.name !== J.ParamList) continue;
2301
+ let e = o.node.cursor();
2302
+ e.firstChild();
2303
+ do
2304
+ e.name === J.VariableName && n.doc.sliceString(e.from, e.to) === r && X(a, i, e.from);
2305
+ while (e.nextSibling());
2306
+ } while (o.nextSibling());
2307
+ }
2308
+ function wi(e, t) {
2309
+ let n = e.cursor();
2310
+ n.firstChild();
2311
+ let r = !1;
2312
+ do
2313
+ if (n.name === Y.For) r = !0;
2314
+ else if (r && n.name === Y.In) break;
2315
+ else r && Si(n, t);
2316
+ while (n.nextSibling());
2317
+ }
2318
+ function Ti(e, t) {
2319
+ let { state: n, variableName: r, scopeStack: i, declarations: a } = t, o = e.cursor(), s = o.name, c = o.from, l = mi.has(s) ? [...i, c] : i, u = l[l.length - 1] ?? -1;
2320
+ switch (s) {
2321
+ case J.FunctionDefinition:
2322
+ case J.ClassDefinition: {
2323
+ let t = e.cursor();
2324
+ t.firstChild();
2325
+ do
2326
+ if (t.name === J.VariableName && n.doc.sliceString(t.from, t.to) === r) {
2327
+ X(a, i[i.length - 1] ?? -1, t.from);
2328
+ break;
2329
+ }
2330
+ while (t.nextSibling());
2331
+ s === J.FunctionDefinition && Ci(e, {
2332
+ state: n,
2333
+ variableName: r,
2334
+ scopeId: c,
2335
+ declarations: a
2336
+ });
2337
+ break;
2338
+ }
2339
+ case J.LambdaExpression:
2340
+ Ci(e, {
2341
+ state: n,
2342
+ variableName: r,
2343
+ scopeId: c,
2344
+ declarations: a
2345
+ });
2346
+ break;
2347
+ case J.ArrayComprehensionExpression:
2348
+ case J.DictionaryComprehensionExpression:
2349
+ case J.SetComprehensionExpression:
2350
+ case J.ComprehensionExpression:
2351
+ case J.ForStatement:
2352
+ wi(e, {
2353
+ state: n,
2354
+ variableName: r,
2355
+ scopeId: u,
2356
+ declarations: a
2357
+ });
2358
+ break;
2359
+ case J.AssignStatement: {
2360
+ let t = [], i = e.cursor();
2361
+ i.firstChild();
2362
+ do
2363
+ i.name === J.AssignOp && t.push(i.from);
2364
+ while (i.nextSibling());
2365
+ let o = t[t.length - 1];
2366
+ if (o === void 0) break;
2367
+ let s = e.cursor();
2368
+ s.firstChild();
2369
+ do
2370
+ s.from < o && Si(s, {
2371
+ state: n,
2372
+ variableName: r,
2373
+ scopeId: u,
2374
+ declarations: a
2375
+ });
2376
+ while (s.nextSibling());
2377
+ break;
2378
+ }
2379
+ case J.ImportStatement: {
2380
+ let t = e.cursor();
2381
+ t.firstChild();
2382
+ let i = !1, o = null, s = () => {
2383
+ o?.matches && X(a, u, o.from), o = null;
2384
+ };
2385
+ do
2386
+ t.name === Y.Import ? i = !0 : i && (t.name === Y.As ? o = null : t.name === J.VariableName ? (s(), o = {
2387
+ from: t.from,
2388
+ matches: n.doc.sliceString(t.from, t.to) === r
2389
+ }) : t.name === "," && s());
2390
+ while (t.nextSibling());
2391
+ s();
2392
+ break;
2393
+ }
2394
+ case J.TryStatement:
2395
+ case J.WithStatement: {
2396
+ let t = e.cursor();
2397
+ t.firstChild();
2398
+ let i = !1;
2399
+ do
2400
+ t.name === Y.As ? i = !0 : i && t.name === J.VariableName && n.doc.sliceString(t.from, t.to) === r && (X(a, u, t.from), i = !1);
2401
+ while (t.nextSibling());
2402
+ break;
2403
+ }
2404
+ }
2405
+ xi(o, (e) => {
2406
+ Ti(e, {
2407
+ state: n,
2408
+ variableName: r,
2409
+ scopeStack: l,
2410
+ declarations: a
2411
+ });
2412
+ });
2413
+ }
2414
+ function Ei(e, t, n) {
2415
+ let r = fe(e), i = [];
2416
+ Ti(r, {
2417
+ state: e,
2418
+ variableName: t,
2419
+ scopeStack: [],
2420
+ declarations: i
2421
+ });
2422
+ let a = Math.max(0, Math.min(n, e.doc.length));
2423
+ for (let e of bi(r, a)) {
2424
+ let t = i.filter((t) => t.scopeId === e.id).filter((t) => !_i.has(e.type) || t.from <= a).toSorted((e, t) => e.from - t.from)[0];
2425
+ if (t) return t.from;
2426
+ }
2427
+ return null;
2428
+ }
2429
+ function Di(e, t, n) {
2430
+ let { state: r } = e, i = n === void 0 ? yi(r, t) : Ei(r, t, n);
2431
+ return i !== null && (vi(e, i), !0);
2432
+ }
2433
+ function Oi(e, t) {
2434
+ return vi(e, e.state.doc.line(t).from), !0;
2435
+ }
2436
+ //#endregion
2437
+ //#region src/core/network/connection.ts
2438
+ var Z = h({ state: k.NOT_STARTED });
2439
+ m(null, (e, t) => t === null ? null : {
2440
+ phase: t.phase,
2441
+ logs: t.log_mode === "append" && e?.phase === t.phase ? e.logs + t.logs : t.logs
2442
+ });
2443
+ function ki() {
2444
+ return b(Z, (e) => e.state === k.OPEN);
2445
+ }
2446
+ function Ai() {
2447
+ return ge() ? ki() : Promise.resolve();
2448
+ }
2449
+ h((e) => e(Z).state === k.CONNECTING), h((e) => e(Z).state === k.OPEN), h((e) => {
2450
+ let t = e(Z);
2451
+ return t.state === k.OPEN || t.state === k.NOT_STARTED;
2452
+ }), h((e) => e(Z).state === k.CLOSED);
2453
+ //#endregion
2454
+ //#region src/components/ui/checkbox.tsx
2455
+ var ji = T.forwardRef((e, t) => {
2456
+ let r = (0, $t.c)(13), i, a;
2457
+ r[0] === e ? (i = r[1], a = r[2]) : ({className: i, ...a} = e, r[0] = e, r[1] = i, r[2] = a);
2458
+ let o;
2459
+ r[3] === i ? o = r[4] : (o = n("flex items-center justify-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground", i), r[3] = i, r[4] = o);
2460
+ let s;
2461
+ r[5] === Symbol.for("react.memo_cache_sentinel") ? (s = n("flex items-center justify-center text-current max-h-[14px] overflow-hidden"), r[5] = s) : s = r[5];
2462
+ let c;
2463
+ r[6] === a.checked ? c = r[7] : (c = /* @__PURE__ */ (0, E.jsx)(Pe, {
2464
+ className: s,
2465
+ children: a.checked === "indeterminate" ? /* @__PURE__ */ (0, E.jsx)(Se, { className: "h-4 w-4" }) : /* @__PURE__ */ (0, E.jsx)(l, { className: "h-4 w-4" })
2466
+ }), r[6] = a.checked, r[7] = c);
2467
+ let u;
2468
+ return r[8] !== a || r[9] !== t || r[10] !== o || r[11] !== c ? (u = /* @__PURE__ */ (0, E.jsx)(Me, {
2469
+ ref: t,
2470
+ className: o,
2471
+ ...a,
2472
+ children: c
2473
+ }), r[8] = a, r[9] = t, r[10] = o, r[11] = c, r[12] = u) : u = r[12], u;
2474
+ });
2475
+ ji.displayName = Me.displayName;
2476
+ //#endregion
2477
+ //#region src/core/cells/scrollCellIntoView.ts
2478
+ function Mi({ cellId: e, cell: n, isCodeHidden: r, codeFocus: i, variableName: a }) {
2479
+ if (!n) return;
2480
+ let o = document.getElementById(V.create(e));
2481
+ if (!o) t.warn("scrollCellIntoView: element not found");
2482
+ else if (Dr()) Or(o);
2483
+ else {
2484
+ if (r) Or(o);
2485
+ else {
2486
+ sn.promote(e);
2487
+ let r = n.current?.editorView;
2488
+ if (!r) {
2489
+ t.warn("scrollCellIntoView: editor not found", e);
2490
+ return;
2491
+ }
2492
+ if (r.hasFocus || !document.hasFocus()) return;
2493
+ if (kr(() => (r.focus(), r.hasFocus), {
2494
+ retries: 5,
2495
+ delay: 20
2496
+ }), i === "top") r.dispatch({ selection: {
2497
+ anchor: 0,
2498
+ head: 0
2499
+ } });
2500
+ else if (i === "bottom") {
2501
+ let e = r.state.doc.line(r.state.doc.lines);
2502
+ r.dispatch({ selection: {
2503
+ anchor: e.from,
2504
+ head: e.from
2505
+ } });
2506
+ } else a && Di(r, a);
2507
+ }
2508
+ o.scrollIntoView({
2509
+ behavior: "smooth",
2510
+ block: "nearest"
2511
+ });
2512
+ }
2513
+ }
2514
+ function Ni() {
2515
+ let e = document.getElementById("App");
2516
+ e?.scrollTo({
2517
+ top: e.scrollHeight,
2518
+ behavior: "smooth"
2519
+ });
2520
+ }
2521
+ function Pi() {
2522
+ document.getElementById("App")?.scrollTo({
2523
+ top: 0,
2524
+ behavior: "smooth"
2525
+ });
2526
+ }
2527
+ function Fi(e) {
2528
+ let t = document.getElementById(V.create(e));
2529
+ return t?.scrollIntoView({
2530
+ behavior: "smooth",
2531
+ block: "center"
2532
+ }), t;
2533
+ }
2534
+ //#endregion
2535
+ //#region src/core/cells/cells.ts
2536
+ function Ii(e) {
2537
+ let t = {
2538
+ column: 0,
2539
+ hide_code: !1,
2540
+ disabled: !1,
2541
+ expand_output: !1
2542
+ };
2543
+ return {
2544
+ ...e,
2545
+ cellData: {
2546
+ [B]: tr({
2547
+ id: B,
2548
+ config: t
2549
+ }),
2550
+ ...e.cellData
2551
+ },
2552
+ cellRuntime: {
2553
+ [B]: rr(),
2554
+ ...e.cellRuntime
2555
+ },
2556
+ cellHandles: {
2557
+ [B]: (0, T.createRef)(),
2558
+ ...e.cellHandles
2559
+ }
2560
+ };
2561
+ }
2562
+ function Li() {
2563
+ return Ii({
2564
+ cellIds: [],
2565
+ cellData: {},
2566
+ cellRuntime: {},
2567
+ cellHandles: {},
2568
+ history: [],
2569
+ scrollKey: null,
2570
+ cellLogs: []
2571
+ });
2572
+ }
2573
+ var { reducer: Ri, createActions: zi, useActions: Bi, valueAtom: Q } = ue(Li, {
2574
+ prepareForRun: (e, t) => Hi({
2575
+ state: e,
2576
+ cellId: t.cellId,
2577
+ cellReducer: (e) => ({
2578
+ ...e,
2579
+ debuggerActive: !1
2580
+ })
2581
+ }),
2582
+ handleCellMessage: (e, t) => {
2583
+ let n = t.cell_id, r = Hi({
2584
+ state: e,
2585
+ cellId: n,
2586
+ cellReducer: (e) => xn(e, t)
2587
+ });
2588
+ return {
2589
+ ...r,
2590
+ cellLogs: [...r.cellLogs, ...Cr(t)]
2591
+ };
2592
+ },
2593
+ addLogs: (e, t) => ({
2594
+ ...e,
2595
+ cellLogs: [...e.cellLogs, ...t.logs]
2596
+ }),
2597
+ reconcileDocument: (e, t) => {
2598
+ let n = ar(e, t);
2599
+ for (let t of e.cellIds) t in n.cellData || na(t);
2600
+ return n;
2601
+ },
2602
+ setStdinResponse: (e, n) => {
2603
+ let { cellId: r, response: i, outputIndex: a } = n;
2604
+ return Hi({
2605
+ state: e,
2606
+ cellId: r,
2607
+ cellReducer: (e) => {
2608
+ let n = [...e.consoleOutputs], r = n[a];
2609
+ return r == null || r.channel !== "stdin" ? (t.warn("Expected stdin output"), e) : (n[a] = {
2610
+ channel: "stdin",
2611
+ mimetype: r.mimetype,
2612
+ data: r.data,
2613
+ timestamp: r.timestamp,
2614
+ id: r.id,
2615
+ input_id: r.input_id,
2616
+ response: r.mimetype === "text/password" ? "" : i
2617
+ }, {
2618
+ ...e,
2619
+ consoleOutputs: n
2620
+ });
2621
+ }
2622
+ });
2623
+ },
2624
+ resetCellRuntimes: (e) => {
2625
+ let t = he(), n = { ...e.cellRuntime };
2626
+ for (let r of [...e.cellIds, B]) {
2627
+ let i = e.cellRuntime[r];
2628
+ n[r] = t && i !== void 0 && i.consoleOutputs.length > 0 ? i : rr();
2629
+ }
2630
+ return {
2631
+ ...e,
2632
+ cellRuntime: n
2633
+ };
2634
+ },
2635
+ scrollToTarget: (e) => {
2636
+ let t = e.scrollKey;
2637
+ if (t === null) return e;
2638
+ let n = t;
2639
+ return Mi({
2640
+ cellId: n,
2641
+ cell: e.cellHandles[n],
2642
+ isCodeHidden: cr(e.cellData[n]?.config.hide_code, C.get(W), n),
2643
+ codeFocus: void 0,
2644
+ variableName: void 0
2645
+ }), {
2646
+ ...e,
2647
+ scrollKey: null
2648
+ };
2649
+ },
2650
+ foldAll: (e) => (tn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
2651
+ unfoldAll: (e) => (nn(Object.values(e.cellHandles).map((e) => e.current?.editorView)), e),
2652
+ clearLogs: (e) => ({
2653
+ ...e,
2654
+ cellLogs: []
2655
+ }),
2656
+ clearCellConsoleOutput: (e, t) => Vi(e, [t.cellId]),
2657
+ clearCellConsoleOutputs: (e, t) => Vi(e, t.cellIds)
2658
+ });
2659
+ function Vi(e, n) {
2660
+ let r = { ...e.cellRuntime };
2661
+ for (let e of n) {
2662
+ let n = r[e];
2663
+ n === void 0 ? t.warn(`Cell ${e} not found in state`) : r[e] = {
2664
+ ...n,
2665
+ consoleOutputs: n.consoleOutputs.filter((e) => e.channel === "stdin" && e.response == null)
2666
+ };
2667
+ }
2668
+ return {
2669
+ ...e,
2670
+ cellRuntime: r
2671
+ };
2672
+ }
2673
+ function Hi({ state: e, cellId: n, cellReducer: r }) {
2674
+ return n in e.cellRuntime ? {
2675
+ ...e,
2676
+ cellRuntime: {
2677
+ ...e.cellRuntime,
2678
+ [n]: r(e.cellRuntime[n])
2679
+ }
2680
+ } : (t.warn(`Cell ${n} not found in state`), e);
2681
+ }
2682
+ var Ui = zi((e) => {
2683
+ C.set(Q, (t) => Ri(t, e));
2684
+ }).addLogs, $ = h((e) => e(Q).cellIds);
2685
+ h((e) => e($).length === 1), h((e) => Mr(e(Q)).length > 0), h((e) => Nr(e(Q)).length > 0), h((e) => Pr(e(Q))), h((e) => Fr(e(Q))), h((e) => Ar(e(Q), e(F), e(Rt)));
2686
+ var Wi = h((e) => {
2687
+ let { cellIds: t, cellData: n } = e(Q);
2688
+ return t.map((t) => {
2689
+ let r = e(I(t)), { name: i } = n[t];
2690
+ if (r !== null && R(r.mimetype)) {
2691
+ w(Array.isArray(r.data), "Expected array data");
2692
+ let e = r.data.filter((e) => !e.type.includes("ancestor"));
2693
+ if (e.length > 0) return {
2694
+ output: {
2695
+ ...r,
2696
+ data: e
2697
+ },
2698
+ cellId: t,
2699
+ cellName: i
2700
+ };
2701
+ }
2702
+ return null;
2703
+ }).filter(Boolean);
2704
+ }), Gi = y(h((e) => {
2705
+ let t = {};
2706
+ for (let n of e($)) {
2707
+ let r = e(L(n));
2708
+ r !== null && r.items.length > 0 && (t[n] = r);
2709
+ }
2710
+ return t;
2711
+ })), Ki = h((e) => Ke(e($).map((t) => e(L(t)))));
2712
+ h((e) => e(Wi).length);
2713
+ var qi = y(h((e) => {
2714
+ let { cellIds: t, cellData: n } = e(Q);
2715
+ return ce.fromEntries(t.map((e) => [e, n[e]?.name]));
2716
+ }));
2717
+ h((e) => e(Q).scrollKey);
2718
+ var Ji = () => g($), Yi = () => g(qi), Xi = () => C.get(Q), Zi = () => C.get(Q).cellIds, Qi = () => {
2719
+ let { cellIds: e, cellData: t } = C.get(Q);
2720
+ return e.map((e) => t[e]?.name).filter(Boolean);
2721
+ };
2722
+ p(ne(Q, (e) => e.cellIds.map((t) => e.cellData[t]))), h((e) => e(Q).cellIds.length > 0);
2723
+ var $i = v((e) => h((t) => t(Q).cellData[e])), ea = v((e) => h((t) => t(Q).cellRuntime[e])), ta = v((e) => h((t) => t(Q).cellHandles[e]));
2724
+ function na(e) {
2725
+ $i.remove(e), ea.remove(e), ta.remove(e), Ut(e);
2726
+ }
2727
+ var ra = (e) => {
2728
+ let { cellHandles: t } = C.get(Q);
2729
+ return t[e].current?.editorView;
2730
+ }, ia = (e) => (sn.promote(e), ra(e));
2731
+ function aa() {
2732
+ return Bi();
2733
+ }
2734
+ //#endregion
2735
+ //#region src/core/errors/error-entries.ts
2736
+ function oa(e) {
2737
+ if (cn(e.mimetype)) {
2738
+ if (!Array.isArray(e.data)) return null;
2739
+ let t = e.data.filter((e) => !e.type.includes("ancestor"));
2740
+ return t.length === 0 ? null : { errorData: t };
2741
+ }
2742
+ return ln(e.mimetype) ? typeof e.data != "string" || e.data.length === 0 ? null : {
2743
+ errorData: [],
2744
+ tracebackHtml: e.data
2745
+ } : null;
2746
+ }
2747
+ function sa(e) {
2748
+ return e.some((e) => "traceback" in e && e.traceback);
2749
+ }
2750
+ function ca(e) {
2751
+ let t = e?.find((e) => ln(e.mimetype));
2752
+ if (t && typeof t.data == "string" && t.data.length !== 0) return t.data;
2753
+ }
2754
+ function la(e, t) {
2755
+ if (e.tracebackHtml) return e.tracebackHtml;
2756
+ if (!sa(e.errorData)) return ca(t);
2757
+ }
2758
+ function ua(e) {
2759
+ let { cellIds: t, cellRuntime: n, cellData: r } = e.get(Q), i = [];
2760
+ for (let [a, o] of t.entries()) {
2761
+ let t = e.get(I(o));
2762
+ if (t === null || !R(t.mimetype)) continue;
2763
+ let s = oa(t);
2764
+ if (!s) continue;
2765
+ let c = $n(r[o].name, a), l = t.code ?? r[o].code;
2766
+ i.push({
2767
+ cellId: o,
2768
+ cellName: c,
2769
+ cellCode: l,
2770
+ errorData: s.errorData,
2771
+ tracebackHtml: la(s, n[o].consoleOutputs)
2772
+ });
2773
+ }
2774
+ return i;
2775
+ }
2776
+ function da(e) {
2777
+ return e.type === "diagnostic" ? e.msg : e.type === "setup-refs" ? "The setup cell cannot have references" : e.type === "cycle" ? "This cell is in a cycle" : e.type === "multiple-defs" ? `The variable '${e.name}' was defined by another cell` : e.type === "import-star" || e.type === "lazy-import" || e.type === "ancestor-stopped" || e.type === "ancestor-prevented" || e.type === "exception" || e.type === "strict-exception" ? e.msg : e.type === "interruption" ? "This cell was interrupted and needs to be re-run" : e.type === "syntax" || e.type === "unknown" || e.type === "sql-error" ? e.msg : e.type === "internal" ? e.msg || "An internal error occurred" : (u(e), "Unknown error");
2778
+ }
2779
+ function fa(e) {
2780
+ let t = da(e);
2781
+ return "traceback" in e && e.traceback && (t += `\n\nTraceback:\n${K(e.traceback)}`), t;
2782
+ }
2783
+ function pa(e) {
2784
+ let t = [e.cellName];
2785
+ return e.tracebackHtml && t.push(K(e.tracebackHtml)), e.errorData.length > 0 && t.push(e.errorData.map(fa).join("\n\n")), t.join("\n\n");
2786
+ }
2787
+ //#endregion
2788
+ export { K as $, Se as $t, Oi as A, Dn as At, ei as B, Wt as Bt, Ni as C, Fn as Ct, Z as D, Pn as Dt, ji as E, jn as Et, q as F, F as Ft, Hr as G, qt as Gt, Qr as H, Qt as Ht, ui as I, Rt as It, jr as J, Xe as Jt, Ur as K, Yt as Kt, oi as L, L as Lt, pi as M, Sn as Mt, di as N, Cn as Nt, ki as O, Nn as Ot, fi as P, Xt as Pt, yr as Q, Be as Qt, si as R, I as Rt, Mi as S, Mn as St, Pi as T, B as Tt, qr as U, Jt as Ut, ti as V, Ft as Vt, Wr as W, Gt as Wt, Vr as X, Je as Xt, Br as Y, k as Yt, Er as Z, Ge as Zt, Ri as _, Jn as _t, Ui as a, or as at, Yi as b, Wn as bt, zi as c, er as ct, Qi as d, H as dt, xe as en, fr as et, Zi as f, Kn as ft, Ki as g, Yn as gt, Q as h, qn as ht, ua as i, sr as it, hi as j, wn as jt, Ai as k, En as kt, ia as l, Zn as lt, Li as m, Gn as mt, pa as n, lr as nt, $i as o, $n as ot, Xi as p, U as pt, Rr as q, St as qt, fa as r, W as rt, $ as s, Qn as st, da as t, cr as tt, ra as u, In as ut, na as v, Hn as vt, Fi as w, V as wt, aa as x, Un as xt, Ji as y, Ln as yt, ci as z, Vt as zt };