@datalayer/agent-runtimes 1.5.0 → 1.5.2

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 (304) hide show
  1. package/dist-embed/chunks/{AgentDetails-Bo0dD1KS.js → AgentDetails-KezohVQI.js} +1 -1
  2. package/dist-embed/chunks/{AgentDetailsDialog-JjCHYxMG.js → AgentDetailsDialog-CklhMnk7.js} +1 -1
  3. package/dist-embed/chunks/{AgentInspector-37Onz4of.js → AgentInspector-CtCaRc1L.js} +1 -1
  4. package/dist-embed/chunks/{AgentInspectorDialog-CCzGVAtX.js → AgentInspectorDialog-DB9cx3Gd.js} +1 -1
  5. package/dist-embed/chunks/Avatar-9MpXENSs.js +1 -0
  6. package/dist-embed/chunks/{CellSidebarExtension-CQlXdanG.js → CellSidebarExtension-CfaJL6DQ.js} +6 -6
  7. package/dist-embed/chunks/{ChatView-CaBuPTyG.js → ChatView-B3QqHhAP.js} +4 -4
  8. package/dist-embed/chunks/{ContextPie-DBIUoPrq.js → ContextPie-1vP4f-3N.js} +1 -1
  9. package/dist-embed/chunks/DatalayerAgentBridge-D54Z9BZ3.js +1 -0
  10. package/dist-embed/chunks/{DeckComponent-cRJJMGgt.js → DeckComponent-82GVdsoi.js} +2 -2
  11. package/dist-embed/chunks/{DocumentView-CiqN9ze6.js → DocumentView-SrJloJDo.js} +2 -2
  12. package/dist-embed/chunks/{EphemeralDocument-BjJfn7J-.js → EphemeralDocument-t1KulOH8.js} +1 -1
  13. package/dist-embed/chunks/{EphemeralNotebook-DbS4f6yr.js → EphemeralNotebook-Co-WQWCc.js} +2 -2
  14. package/dist-embed/chunks/{ExcalidrawComponent-BtNXWUN8.js → ExcalidrawComponent-5NeLUYVB.js} +1 -1
  15. package/dist-embed/chunks/{ExcalidrawModal-C6SEKFlD.js → ExcalidrawModal-9ZnOB03n.js} +1 -1
  16. package/dist-embed/chunks/{JupyterLexicalExtension-BuRLImy5.js → JupyterLexicalExtension-Cize8RXy.js} +29 -29
  17. package/dist-embed/chunks/{KernelVariables-KCUfxhF4.js → KernelVariables-Cl57Zze1.js} +2 -2
  18. package/dist-embed/chunks/{LexicalToolRegistry-CXLITkMD.js → LexicalToolRegistry-CoM9ROsx.js} +3 -3
  19. package/dist-embed/chunks/{NotebookSkeleton-HdM76lOj.js → NotebookSkeleton-CI7ovjNW.js} +1 -1
  20. package/dist-embed/chunks/{NotebookToolSurfaces-ktcGRm7d.js → NotebookToolSurfaces-CWfppxBN.js} +1 -1
  21. package/dist-embed/chunks/{NotebookToolbar-DMKCe3c2.js → NotebookToolbar-rtMQZWHQ.js} +1 -1
  22. package/dist-embed/chunks/{NotebookView-Pps9dPZ7.js → NotebookView-DOf_K74b.js} +1 -1
  23. package/dist-embed/chunks/{Output-BscOPLqE.js → Output-9DKTscSv.js} +1 -1
  24. package/dist-embed/chunks/{SandboxDetailsDialog-pkvlbdM2.js → SandboxDetailsDialog-BCfDm6MB.js} +1 -1
  25. package/dist-embed/chunks/{SchemaForm-Bqor7hh8.js → SchemaForm-BOYPrvf8.js} +1 -1
  26. package/dist-embed/chunks/{Toolbar-6Hdi_m3T.js → Toolbar-CGQDY041.js} +1 -1
  27. package/dist-embed/chunks/{WidgetVariableView-CJTAKqh1.js → WidgetVariableView-BTOwHP78.js} +1 -1
  28. package/dist-embed/chunks/YouTubePlugin-Bs4zZIB1.js +1 -0
  29. package/dist-embed/chunks/{abnfDiagram-VCTEODGH-CWj4pFxo.js → abnfDiagram-VCTEODGH-D5p59vS_.js} +1 -1
  30. package/dist-embed/chunks/{abnfDiagram-VCTEODGH-B4x7mfou.js → abnfDiagram-VCTEODGH-DRYbUvhc.js} +1 -1
  31. package/dist-embed/chunks/{ar-SA-G6X2FPQ2-BB82iKLz.js → ar-SA-G6X2FPQ2-D6XRzkBS.js} +1 -1
  32. package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-CRIN999O.js → architectureDiagram-5GKGNRK7-B7ITKDup.js} +1 -1
  33. package/dist-embed/chunks/{architectureDiagram-5GKGNRK7-B2D6lZbf.js → architectureDiagram-5GKGNRK7-DQGv0imf.js} +1 -1
  34. package/dist-embed/chunks/{az-AZ-76LH7QW2-DsMRKXlw.js → az-AZ-76LH7QW2-DBTdUiqp.js} +1 -1
  35. package/dist-embed/chunks/{bg-BG-XCXSNQG7-43Y1kPxa.js → bg-BG-XCXSNQG7-DuhcsaSL.js} +1 -1
  36. package/dist-embed/chunks/{blockDiagram-868be97b-bBp9uGVj.js → blockDiagram-868be97b-DYe-XTjy.js} +1 -1
  37. package/dist-embed/chunks/{blockDiagram-I7D4REHJ-DNdo_mUi.js → blockDiagram-I7D4REHJ-IltJXCd6.js} +1 -1
  38. package/dist-embed/chunks/{blockDiagram-I7D4REHJ-CPHEppLa.js → blockDiagram-I7D4REHJ-y7tEFo3j.js} +1 -1
  39. package/dist-embed/chunks/{bn-BD-2XOGV67Q-CLqPJBll.js → bn-BD-2XOGV67Q-CPFeLVSN.js} +1 -1
  40. package/dist-embed/chunks/{c4Diagram-3f4bdde3-cYZlcE7E.js → c4Diagram-3f4bdde3-Bybp0wky.js} +1 -1
  41. package/dist-embed/chunks/{c4Diagram-7LVT6UL2-DTmVwmmb.js → c4Diagram-7LVT6UL2-CizxVqqX.js} +1 -1
  42. package/dist-embed/chunks/{c4Diagram-7LVT6UL2-BM2g5U7R.js → c4Diagram-7LVT6UL2-DpaHndz8.js} +1 -1
  43. package/dist-embed/chunks/{ca-ES-6MX7JW3Y-CDFGSEh3.js → ca-ES-6MX7JW3Y-gDR_kEC6.js} +1 -1
  44. package/dist-embed/chunks/{celltoolbartracker-D67W4XWx.js → celltoolbartracker-DLF4PWyW.js} +1 -1
  45. package/dist-embed/chunks/{chunk-2Q5K7J3B-CsB-r261.js → chunk-2Q5K7J3B-BI6lURun.js} +1 -1
  46. package/dist-embed/chunks/{chunk-2Q5K7J3B-CuegvedF.js → chunk-2Q5K7J3B-DWoLSrj9.js} +1 -1
  47. package/dist-embed/chunks/{chunk-5VM5RSS4-D4Ed2_vW.js → chunk-5VM5RSS4-CDh4wYym.js} +1 -1
  48. package/dist-embed/chunks/{chunk-5VM5RSS4-MJQ9uhYe.js → chunk-5VM5RSS4-SleuNqDC.js} +1 -1
  49. package/dist-embed/chunks/{chunk-F27PBJKO-DnjXjdOV.js → chunk-F27PBJKO-AvWsNGYY.js} +1 -1
  50. package/dist-embed/chunks/{chunk-F27PBJKO-BKTrewOm.js → chunk-F27PBJKO-h_FwJMTr.js} +1 -1
  51. package/dist-embed/chunks/{chunk-IMKFNOWR-Bf7PlvQM.js → chunk-IMKFNOWR-DGRceKiU.js} +1 -1
  52. package/dist-embed/chunks/{chunk-IMKFNOWR-BiXdYxxk.js → chunk-IMKFNOWR-Hx4a5yny.js} +1 -1
  53. package/dist-embed/chunks/{chunk-JWPE2WC7-DcVyhh3j.js → chunk-JWPE2WC7-A4gy2qc4.js} +1 -1
  54. package/dist-embed/chunks/{chunk-JWPE2WC7-DmWR08qa.js → chunk-JWPE2WC7-BuJactJo.js} +1 -1
  55. package/dist-embed/chunks/{chunk-POPQ4Y6H-Bw6JH9TT.js → chunk-POPQ4Y6H-CFM-817s.js} +1 -1
  56. package/dist-embed/chunks/{chunk-POPQ4Y6H-snvBGTqY.js → chunk-POPQ4Y6H-CmRF80iG.js} +1 -1
  57. package/dist-embed/chunks/{chunk-SVP7TREG-DLZdx--b.js → chunk-SVP7TREG-CryZx9JE.js} +1 -1
  58. package/dist-embed/chunks/{chunk-SVP7TREG-dE58fUkJ.js → chunk-SVP7TREG-DSNzmytH.js} +1 -1
  59. package/dist-embed/chunks/{chunk-TICWLB2K-DNXzQOV5.js → chunk-TICWLB2K-CEaDF8ZJ.js} +1 -1
  60. package/dist-embed/chunks/{chunk-TICWLB2K-4NdGhPfF.js → chunk-TICWLB2K-DyGS3fIj.js} +1 -1
  61. package/dist-embed/chunks/{chunk-XXDRQBXY-OKsVfhjO.js → chunk-XXDRQBXY-8Cnzpdjz.js} +1 -1
  62. package/dist-embed/chunks/{chunk-XXDRQBXY-D57w8SHP.js → chunk-XXDRQBXY-DxQBcVOz.js} +1 -1
  63. package/dist-embed/chunks/{classDiagram-ZZMXUADV-oYXGLbJe.js → classDiagram-ZZMXUADV-BQkO1UYr.js} +1 -1
  64. package/dist-embed/chunks/{classDiagram-ZZMXUADV-D35oEC_r.js → classDiagram-ZZMXUADV-yvP3zMO3.js} +1 -1
  65. package/dist-embed/chunks/{classDiagram-f62afe4f-DWY2Ws4r.js → classDiagram-f62afe4f-AYfpYKtp.js} +1 -1
  66. package/dist-embed/chunks/{classDiagram-v2-604399ef-By5ijR28.js → classDiagram-v2-604399ef-BWyNcT_y.js} +1 -1
  67. package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-oYXGLbJe.js → classDiagram-v2-VYDZK3BY-BQkO1UYr.js} +1 -1
  68. package/dist-embed/chunks/{classDiagram-v2-VYDZK3BY-D35oEC_r.js → classDiagram-v2-VYDZK3BY-yvP3zMO3.js} +1 -1
  69. package/dist-embed/chunks/{code-block-IT6T5CEO-DvUhQbDq.js → code-block-IT6T5CEO-F4BSIGY6.js} +1 -1
  70. package/dist-embed/chunks/{component-DquJEKgN.js → component-DMQ8W8n1.js} +3 -3
  71. package/dist-embed/chunks/{cose-bilkent-JH36ORCC-j33onHvG.js → cose-bilkent-JH36ORCC-C3HC0XIY.js} +1 -1
  72. package/dist-embed/chunks/{cose-bilkent-JH36ORCC-CfuJvtzg.js → cose-bilkent-JH36ORCC-MVxlcfpd.js} +1 -1
  73. package/dist-embed/chunks/{createText-aed3d8b3-DvlG46OI.js → createText-aed3d8b3-CEJODAXJ.js} +1 -1
  74. package/dist-embed/chunks/{cs-CZ-2BRQDIVT-ByNB8eZd.js → cs-CZ-2BRQDIVT-BXQxcYp6.js} +1 -1
  75. package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-YhGHtmc4.js → cynefinDiagram-5FMLGOSQ-D87ENxS0.js} +1 -1
  76. package/dist-embed/chunks/{cynefinDiagram-5FMLGOSQ-CPb2yRsU.js → cynefinDiagram-5FMLGOSQ-DNRKTIHx.js} +1 -1
  77. package/dist-embed/chunks/{da-DK-5WZEPLOC-B7MrVwy8.js → da-DK-5WZEPLOC-Ck3vidj3.js} +1 -1
  78. package/dist-embed/chunks/{dagre-GXQ25YYZ-CSSSVwOB.js → dagre-GXQ25YYZ-BOhThFKd.js} +1 -1
  79. package/dist-embed/chunks/{dagre-GXQ25YYZ-bjTeZGWE.js → dagre-GXQ25YYZ-DscCD5Uq.js} +1 -1
  80. package/dist-embed/chunks/{de-DE-XR44H4JA-CN1cdk94.js → de-DE-XR44H4JA-CPZgrOuc.js} +1 -1
  81. package/dist-embed/chunks/{diagram-S7CK7UJ4-CFdSwdyc.js → diagram-S7CK7UJ4-CUhme3Bl.js} +1 -1
  82. package/dist-embed/chunks/{diagram-S7CK7UJ4-CFDVHfda.js → diagram-S7CK7UJ4-zDQduoQy.js} +1 -1
  83. package/dist-embed/chunks/{diagram-UQ7AKVKN-DDaeau23.js → diagram-UQ7AKVKN-BxhQPjAM.js} +1 -1
  84. package/dist-embed/chunks/{diagram-UQ7AKVKN-GZbDy6ob.js → diagram-UQ7AKVKN-Byi-v8UN.js} +1 -1
  85. package/dist-embed/chunks/{diagram-VSXAHHWV-nXDiS81a.js → diagram-VSXAHHWV-CqihYkDH.js} +1 -1
  86. package/dist-embed/chunks/{diagram-VSXAHHWV-C6q67wko.js → diagram-VSXAHHWV-au-v2v9D.js} +1 -1
  87. package/dist-embed/chunks/{diagram-VX7I27RA-DQUkfMrD.js → diagram-VX7I27RA-Cd5PaF_n.js} +1 -1
  88. package/dist-embed/chunks/{diagram-VX7I27RA-CYLfpYa4.js → diagram-VX7I27RA-ETzwrw79.js} +1 -1
  89. package/dist-embed/chunks/{diagram-Z3DM3KII-DZziYptV.js → diagram-Z3DM3KII-AcMuRFo5.js} +1 -1
  90. package/dist-embed/chunks/{diagram-Z3DM3KII-v-9naUk_.js → diagram-Z3DM3KII-DkbsvY2A.js} +1 -1
  91. package/dist-embed/chunks/{document-BpXPH_dr.js → document-Dluvp7zl.js} +1 -1
  92. package/dist-embed/chunks/{drivecontents-Bg9_6Kmo.js → drivecontents-CxwZz_5W.js} +1 -1
  93. package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-EvDUmZgJ.js → ebnfDiagram-PWID7BFC-BrEs-SB2.js} +1 -1
  94. package/dist-embed/chunks/{ebnfDiagram-PWID7BFC-CDmryeYY.js → ebnfDiagram-PWID7BFC-DuWfMZcD.js} +1 -1
  95. package/dist-embed/chunks/{edges-b2856ca0-CTakYT6h.js → edges-b2856ca0-Czd3-xvj.js} +1 -1
  96. package/dist-embed/chunks/{el-GR-BZB4AONW-DnaGhWD1.js → el-GR-BZB4AONW-CjQSkw0P.js} +1 -1
  97. package/dist-embed/chunks/{erDiagram-5d81789a-CpiBBm7t.js → erDiagram-5d81789a-JegaF4gy.js} +1 -1
  98. package/dist-embed/chunks/{erDiagram-RLTQ6QDP-B2QZDDaO.js → erDiagram-RLTQ6QDP-Cpn6_cd1.js} +1 -1
  99. package/dist-embed/chunks/{erDiagram-RLTQ6QDP-hsnql-YF.js → erDiagram-RLTQ6QDP-xubaXuKR.js} +1 -1
  100. package/dist-embed/chunks/{es-ES-U4NZUMDT-DE1vZzDE.js → es-ES-U4NZUMDT-CQz3Tsxk.js} +1 -1
  101. package/dist-embed/chunks/{eu-ES-A7QVB2H4-DmHB0zpm.js → eu-ES-A7QVB2H4-DPwxHXvP.js} +1 -1
  102. package/dist-embed/chunks/{fa-IR-HGAKTJCU-CNzE8tJj.js → fa-IR-HGAKTJCU-DlQyRFJP.js} +1 -1
  103. package/dist-embed/chunks/{fi-FI-Z5N7JZ37-Ca2vTFQC.js → fi-FI-Z5N7JZ37-BL9Dv0rT.js} +1 -1
  104. package/dist-embed/chunks/{flowDb-185abca5-D4uRRPhl.js → flowDb-185abca5-BN_8lgCO.js} +1 -1
  105. package/dist-embed/chunks/{flowDiagram-1629c991-B999anFV.js → flowDiagram-1629c991-YRlRqB59.js} +1 -1
  106. package/dist-embed/chunks/{flowDiagram-HODETNUW-DY4I6lzA.js → flowDiagram-HODETNUW-CzRvxVGK.js} +1 -1
  107. package/dist-embed/chunks/{flowDiagram-HODETNUW-D4E8W9uH.js → flowDiagram-HODETNUW-lW-icIxi.js} +1 -1
  108. package/dist-embed/chunks/{flowDiagram-v2-1d953310-2W9bzV_S.js → flowDiagram-v2-1d953310-DBFSFroi.js} +1 -1
  109. package/dist-embed/chunks/{flowchart-elk-definition-6df44142-Cz-ICcxz.js → flowchart-elk-definition-6df44142-RjL83g27.js} +1 -1
  110. package/dist-embed/chunks/{fr-FR-RHASNOE6-B0yWFX3_.js → fr-FR-RHASNOE6-xB7HyFVv.js} +1 -1
  111. package/dist-embed/chunks/{ganttDiagram-3b0b3873-CR9gwUWB.js → ganttDiagram-3b0b3873-Dowe9cKl.js} +1 -1
  112. package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-CoCfE73i.js → ganttDiagram-EL5Y4UJY-CLaynGwe.js} +1 -1
  113. package/dist-embed/chunks/{ganttDiagram-EL5Y4UJY-cZgkz4jA.js → ganttDiagram-EL5Y4UJY-CNQPBdAP.js} +1 -1
  114. package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-CZEgVaQ_.js → gitGraphDiagram-WWUBYQGX-CDuBbPX3.js} +1 -1
  115. package/dist-embed/chunks/{gitGraphDiagram-WWUBYQGX-xXoxdFf9.js → gitGraphDiagram-WWUBYQGX-CupHqYWl.js} +1 -1
  116. package/dist-embed/chunks/{gitGraphDiagram-f01e8bc2-NdofvPL5.js → gitGraphDiagram-f01e8bc2-C06Sje1n.js} +1 -1
  117. package/dist-embed/chunks/{gl-ES-HMX3MZ6V-2_3FMVJq.js → gl-ES-HMX3MZ6V-BX50ltap.js} +1 -1
  118. package/dist-embed/chunks/{he-IL-6SHJWFNN-BW1lby00.js → he-IL-6SHJWFNN-DR3hLzYG.js} +1 -1
  119. package/dist-embed/chunks/{hi-IN-IWLTKZ5I-DTixfSwB.js → hi-IN-IWLTKZ5I-C3bSDqVc.js} +1 -1
  120. package/dist-embed/chunks/{hu-HU-A5ZG7DT2-DOfYwLWP.js → hu-HU-A5ZG7DT2--mRUDQG6.js} +1 -1
  121. package/dist-embed/chunks/{id-ID-SAP4L64H-Cwtdtkvg.js → id-ID-SAP4L64H-D6psdwdp.js} +1 -1
  122. package/dist-embed/chunks/{index-Dyh5xopp.js → index-3O3ob63z.js} +15 -15
  123. package/dist-embed/chunks/{index-KgE-JGae.js → index-7F_pA42X.js} +4 -4
  124. package/dist-embed/chunks/{index-9bae90f3-D4JbZiwv.js → index-9bae90f3-BY7E8HZU.js} +1 -1
  125. package/dist-embed/chunks/{index-DYkwi0aX.js → index-Azo_wV3K.js} +1 -1
  126. package/dist-embed/chunks/{index-BFPUYxvD.js → index-B063q-PC.js} +4 -4
  127. package/dist-embed/chunks/index-B0KVfQGJ.js +1 -0
  128. package/dist-embed/chunks/{index-BRBFWMMG.js → index-B2He8CnP.js} +1 -1
  129. package/dist-embed/chunks/{index-BAr0Q6NS.js → index-BExwmtFS.js} +1 -1
  130. package/dist-embed/chunks/{index-B3WvcNQa.js → index-BJhxZF_K.js} +1 -1
  131. package/dist-embed/chunks/{index-CXL3UCHy.js → index-BYMZi_1t.js} +1 -1
  132. package/dist-embed/chunks/{index-wovGU2zp.js → index-BblwlEJB.js} +1 -1
  133. package/dist-embed/chunks/{index-DvpdAlVH.js → index-BdvS7Q4t.js} +1 -1
  134. package/dist-embed/chunks/{index-S-sjhoD3.js → index-BhU2ra4k.js} +3 -3
  135. package/dist-embed/chunks/{index-j-oeqTuo.js → index-BipXK1tF.js} +1 -1
  136. package/dist-embed/chunks/{index-B_9UD0bt.js → index-BlWZloLe.js} +3 -3
  137. package/dist-embed/chunks/{index-B-UP9DlM.js → index-BzXMsI1v.js} +1 -1
  138. package/dist-embed/chunks/{index-CPY91aGL.js → index-BzxtV5-v.js} +1 -1
  139. package/dist-embed/chunks/{index-C17RrmNV.js → index-C01nR1dW.js} +1 -1
  140. package/dist-embed/chunks/{index-t_gNTVoL.js → index-C643Hfu1.js} +1 -1
  141. package/dist-embed/chunks/{index-BAwsCLGT.js → index-C6wF35Kk.js} +10 -10
  142. package/dist-embed/chunks/{index--qMT5k1q.js → index-C8IekrmL.js} +1 -1
  143. package/dist-embed/chunks/{index-BxjlpSy4.js → index-C9CpG6Nf.js} +1 -1
  144. package/dist-embed/chunks/{index-BITOMOWN.js → index-CA8D7U2s.js} +2 -2
  145. package/dist-embed/chunks/{index-DEn5R18M.js → index-CUL9WiLS.js} +5 -5
  146. package/dist-embed/chunks/{index-DFEBhySA.js → index-Cknn3VQD.js} +1 -1
  147. package/dist-embed/chunks/{index-BJ7Yskx5.js → index-CpcHHQd7.js} +1 -1
  148. package/dist-embed/chunks/{index-wzK_9qZx.js → index-CvBxCcaE.js} +1 -1
  149. package/dist-embed/chunks/{index-DkUimZI8.js → index-CzXnKkqM.js} +1 -1
  150. package/dist-embed/chunks/{index-Ck-wonpc.js → index-D0DBuFMt.js} +1 -1
  151. package/dist-embed/chunks/{index-CMUTS_sA.js → index-D1lY79hS.js} +4 -4
  152. package/dist-embed/chunks/{index-sQy5cmWo.js → index-DB46n9Tf.js} +2 -2
  153. package/dist-embed/chunks/{index-Cgf7tlW3.js → index-DToDguC3.js} +1 -1
  154. package/dist-embed/chunks/{index-Bi5hexj-.js → index-DVDREi21.js} +1 -1
  155. package/dist-embed/chunks/{index-TRLGqZaF.js → index-DVUMPcVw.js} +1 -1
  156. package/dist-embed/chunks/{index-YcqCoWJl.js → index-DcZQ2Oqj.js} +1 -1
  157. package/dist-embed/chunks/{index-bRwN_nxZ.js → index-DvWWLOj6.js} +1 -1
  158. package/dist-embed/chunks/{index-Clp8quV1.js → index-Dv_XGY6Q.js} +1 -1
  159. package/dist-embed/chunks/{index-C3oDHYfa.js → index-DxsDy6PY.js} +1 -1
  160. package/dist-embed/chunks/{index-Jt4bWLoz.js → index-EpYurdzk.js} +6 -6
  161. package/dist-embed/chunks/{index-CzuLxFBK.js → index-MTdX216X.js} +1 -1
  162. package/dist-embed/chunks/{index-B2OWWcCj.js → index-YqGHzM2S.js} +1 -1
  163. package/dist-embed/chunks/{index-BvvaLLhn.js → index-a51XM5L8.js} +3 -3
  164. package/dist-embed/chunks/{index-CrNfUmIU.js → index-jy9kOmqu.js} +1 -1
  165. package/dist-embed/chunks/{index-e5PkgYFg.js → index-kpqZuE4J.js} +1 -1
  166. package/dist-embed/chunks/{index-BgFbP5P0.js → index-qsUgit40.js} +1 -1
  167. package/dist-embed/chunks/{index-Cq19rGjf.js → index-rfsiH_M6.js} +1 -1
  168. package/dist-embed/chunks/{index-BYQwy0Zx.js → index-s3hayhRS.js} +2 -2
  169. package/dist-embed/chunks/{index.esm-RCuogyl2.js → index.esm-CWygaJYM.js} +1 -1
  170. package/dist-embed/chunks/{index.esm-CVNfNVDy.js → index.esm-DYeUXS4c.js} +1 -1
  171. package/dist-embed/chunks/{infoDiagram-27XIBGKW-DpFWmHEH.js → infoDiagram-27XIBGKW-Ctm-zk09.js} +1 -1
  172. package/dist-embed/chunks/{infoDiagram-27XIBGKW-DRf2y76w.js → infoDiagram-27XIBGKW-DRzH33_4.js} +1 -1
  173. package/dist-embed/chunks/{infoDiagram-a29d40f1-CehVkLUM.js → infoDiagram-a29d40f1-c78-ZMuT.js} +1 -1
  174. package/dist-embed/chunks/{isEqual-BybBNsZK.js → isEqual-niFNV5MZ.js} +1 -1
  175. package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-C_d1mmp3.js → ishikawaDiagram-5VMMS53U-CILSTTqm.js} +1 -1
  176. package/dist-embed/chunks/{ishikawaDiagram-5VMMS53U-B534qRQJ.js → ishikawaDiagram-5VMMS53U-DKv5KL85.js} +1 -1
  177. package/dist-embed/chunks/{it-IT-JPQ66NNP-C3xZ61-6.js → it-IT-JPQ66NNP-BfrG_atL.js} +1 -1
  178. package/dist-embed/chunks/{ja-JP-DBVTYXUO-CeTmglEb.js → ja-JP-DBVTYXUO-sahpmNGY.js} +1 -1
  179. package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-DEeA8WJr.js → journeyDiagram-3NMN7TZE-CSMQRlsr.js} +1 -1
  180. package/dist-embed/chunks/{journeyDiagram-3NMN7TZE-C0GQLJYz.js → journeyDiagram-3NMN7TZE-DlMPiHSP.js} +1 -1
  181. package/dist-embed/chunks/{journeyDiagram-95396277-Cwx_BI95.js → journeyDiagram-95396277-VzHClVrX.js} +1 -1
  182. package/dist-embed/chunks/{kaa-6HZHGXH3-D6Jr6B6Y.js → kaa-6HZHGXH3-BrkhtXQj.js} +1 -1
  183. package/dist-embed/chunks/{kab-KAB-ZGHBKWFO-pEXBqeuG.js → kab-KAB-ZGHBKWFO-DwtFIV_I.js} +1 -1
  184. package/dist-embed/chunks/{kanban-definition-UXKFOSKX-DucvIyR1.js → kanban-definition-UXKFOSKX-BkxvAXq2.js} +1 -1
  185. package/dist-embed/chunks/{kanban-definition-UXKFOSKX-Dww2l0wQ.js → kanban-definition-UXKFOSKX-esf1amn7.js} +1 -1
  186. package/dist-embed/chunks/{kk-KZ-P5N5QNE5-BRJunmHm.js → kk-KZ-P5N5QNE5-UxN1LGH5.js} +1 -1
  187. package/dist-embed/chunks/{km-KH-HSX4SM5Z--GJgT9rN.js → km-KH-HSX4SM5Z-B7lolfpy.js} +1 -1
  188. package/dist-embed/chunks/{ko-KR-MTYHY66A-Bjnez4qR.js → ko-KR-MTYHY66A-CnxefCaN.js} +1 -1
  189. package/dist-embed/chunks/{ku-TR-6OUDTVRD-DgOdYJrS.js → ku-TR-6OUDTVRD-Bt7bmFnv.js} +1 -1
  190. package/dist-embed/chunks/{layout-DiAMrtPi.js → layout-D7Mk1riq.js} +1 -1
  191. package/dist-embed/chunks/{layout-LNJhMVxV.js → layout-Sl9Lf6Ae.js} +1 -1
  192. package/dist-embed/chunks/{lexicalHooks-DEzWXVZY.js → lexicalHooks-DKF-DsxG.js} +1 -1
  193. package/dist-embed/chunks/{lt-LT-XHIRWOB4-BMwhrtjM.js → lt-LT-XHIRWOB4-D6qkXs9m.js} +1 -1
  194. package/dist-embed/chunks/{lv-LV-5QDEKY6T-0pxW7YE0.js → lv-LV-5QDEKY6T-D8g27j86.js} +1 -1
  195. package/dist-embed/chunks/{mermaid.core-huvnfV8t.js → mermaid.core-BhiOhb5K.js} +3 -3
  196. package/dist-embed/chunks/{mermaid.core-Dw1n-Hii.js → mermaid.core-CRlujv29.js} +5 -5
  197. package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-DWUezf-k.js → mindmap-definition-YA3MSWOX-BJQsz4H1.js} +1 -1
  198. package/dist-embed/chunks/{mindmap-definition-YA3MSWOX-DKQu2lXp.js → mindmap-definition-YA3MSWOX-eCxs0BsL.js} +1 -1
  199. package/dist-embed/chunks/{mindmap-definition-e4c1d938-DSDPusnk.js → mindmap-definition-e4c1d938-DoGG9eDO.js} +1 -1
  200. package/dist-embed/chunks/{model-BHONoBA6.js → model-BziAhKNp.js} +1 -1
  201. package/dist-embed/chunks/{mr-IN-CRQNXWMA-tndp8BXC.js → mr-IN-CRQNXWMA-CMbVGyJm.js} +1 -1
  202. package/dist-embed/chunks/{my-MM-5M5IBNSE-sispDhO4.js → my-MM-5M5IBNSE-B-KPsx1j.js} +1 -1
  203. package/dist-embed/chunks/{nb-NO-T6EIAALU-CjBurOuS.js → nb-NO-T6EIAALU-Cl7QLAt7.js} +1 -1
  204. package/dist-embed/chunks/{nl-NL-IS3SIHDZ-B58EVmr3.js → nl-NL-IS3SIHDZ-Brzte_o2.js} +1 -1
  205. package/dist-embed/chunks/{nn-NO-6E72VCQL-D1p7LZSq.js → nn-NO-6E72VCQL-CzCKEx02.js} +1 -1
  206. package/dist-embed/chunks/{oc-FR-POXYY2M6-C1M8sddP.js → oc-FR-POXYY2M6-DA72PkVY.js} +1 -1
  207. package/dist-embed/chunks/{pa-IN-N4M65BXN-D8ESzASl.js → pa-IN-N4M65BXN-CzkFYtL0.js} +1 -1
  208. package/dist-embed/chunks/{pegDiagram-XKGWAZYB-ChXFZFas.js → pegDiagram-XKGWAZYB-CD3xZvKE.js} +1 -1
  209. package/dist-embed/chunks/{pegDiagram-XKGWAZYB-BUPTGFu3.js → pegDiagram-XKGWAZYB-CV-d6HkK.js} +1 -1
  210. package/dist-embed/chunks/{percentages-BXMCSKIN-BihMTsFR.js → percentages-BXMCSKIN-mjCCp4uI.js} +6 -6
  211. package/dist-embed/chunks/{pica-BQREYloS.js → pica-5TeyVfIV.js} +1 -1
  212. package/dist-embed/chunks/{pieDiagram-E7YTZNPT-DAuVz3z-.js → pieDiagram-E7YTZNPT-DipS--g7.js} +1 -1
  213. package/dist-embed/chunks/{pieDiagram-E7YTZNPT-BORvsKK0.js → pieDiagram-E7YTZNPT-toANOh_O.js} +1 -1
  214. package/dist-embed/chunks/{pieDiagram-c941bede-FM1PHjj3.js → pieDiagram-c941bede-DytniBrW.js} +1 -1
  215. package/dist-embed/chunks/{pl-PL-T2D74RX3-DQGe6LHC.js → pl-PL-T2D74RX3-F4ebFTYK.js} +1 -1
  216. package/dist-embed/chunks/{plugin-BoxsYxwM.js → plugin-Cf3g-jak.js} +1 -1
  217. package/dist-embed/chunks/plugin-DA_NCYQX.js +1 -0
  218. package/dist-embed/chunks/{pt-BR-5N22H2LF-CvXBgZQs.js → pt-BR-5N22H2LF-B5i8LuE4.js} +1 -1
  219. package/dist-embed/chunks/{pt-PT-UZXXM6DQ-BMnnlIUJ.js → pt-PT-UZXXM6DQ-BQ7hfRRg.js} +1 -1
  220. package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-DpGcSrR9.js → quadrantDiagram-AXDQQJYC-D_j5dzK-.js} +1 -1
  221. package/dist-embed/chunks/{quadrantDiagram-AXDQQJYC-CZe_C7e2.js → quadrantDiagram-AXDQQJYC-DlhtjZ-k.js} +1 -1
  222. package/dist-embed/chunks/{quadrantDiagram-cf8b8fe0-DZNznYqD.js → quadrantDiagram-cf8b8fe0-BQ2yjLYu.js} +1 -1
  223. package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-CuL_zbZ8.js → railroadDiagram-O6MQD6OU-CZFkdwSz.js} +1 -1
  224. package/dist-embed/chunks/{railroadDiagram-O6MQD6OU-BnCn-tIV.js → railroadDiagram-O6MQD6OU-aWlxxhLc.js} +1 -1
  225. package/dist-embed/chunks/{renderer-lVFw9lw7.js → renderer-2D5v6hpK.js} +1 -1
  226. package/dist-embed/chunks/{requirementDiagram-53bda41b-BLToEv8I.js → requirementDiagram-53bda41b-CWV_b9FE.js} +1 -1
  227. package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-KU7DW76t.js → requirementDiagram-BXWQKSXE-BSF51uZZ.js} +1 -1
  228. package/dist-embed/chunks/{requirementDiagram-BXWQKSXE-W6Oaw9v0.js → requirementDiagram-BXWQKSXE-EVwiX2gg.js} +1 -1
  229. package/dist-embed/chunks/{ro-RO-JPDTUUEW-DZ-9UUH7.js → ro-RO-JPDTUUEW-BdcZRS6h.js} +1 -1
  230. package/dist-embed/chunks/{ru-RU-B4JR7IUQ-JlRBwjob.js → ru-RU-B4JR7IUQ-Cta1z8f6.js} +1 -1
  231. package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-y5tPDHfE.js → sankeyDiagram-P5KCCOFB-BqD6w06O.js} +1 -1
  232. package/dist-embed/chunks/{sankeyDiagram-P5KCCOFB-1UXJ4wHP.js → sankeyDiagram-P5KCCOFB-t6rHaBZJ.js} +1 -1
  233. package/dist-embed/chunks/{sankeyDiagram-c3ef121a-6gF3bcjb.js → sankeyDiagram-c3ef121a-C9O52Zx9.js} +1 -1
  234. package/dist-embed/chunks/{sequenceDiagram-82a5b84f-CglVrG1T.js → sequenceDiagram-82a5b84f-Dga-BwWi.js} +1 -1
  235. package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-CG-4aOyN.js → sequenceDiagram-WJ2MYXX4-DphVeQVS.js} +1 -1
  236. package/dist-embed/chunks/{sequenceDiagram-WJ2MYXX4-DVcXqRnq.js → sequenceDiagram-WJ2MYXX4-ih6W0378.js} +1 -1
  237. package/dist-embed/chunks/{sessions-3PQsLINe.js → sessions-APuuDN3K.js} +2 -2
  238. package/dist-embed/chunks/{si-LK-N5RQ5JYF-Bx8kHnkd.js → si-LK-N5RQ5JYF-DYy_OKHx.js} +1 -1
  239. package/dist-embed/chunks/{sizeCapture-INFHLROL-e294GOp7.js → sizeCapture-INFHLROL-CxIMCruL.js} +1 -1
  240. package/dist-embed/chunks/{sizeCapture-INFHLROL-CCZ7JXfm.js → sizeCapture-INFHLROL-o0dzt8-T.js} +1 -1
  241. package/dist-embed/chunks/{sk-SK-C5VTKIMK-xsfEfbZb.js → sk-SK-C5VTKIMK-B4A8rgzq.js} +1 -1
  242. package/dist-embed/chunks/{sl-SI-NN7IZMDC-SQYUECnr.js → sl-SI-NN7IZMDC-Dn2yU1RA.js} +1 -1
  243. package/dist-embed/chunks/{stateDiagram-43e79a5f-DktiQR1L.js → stateDiagram-43e79a5f-RBFnM6HD.js} +1 -1
  244. package/dist-embed/chunks/{stateDiagram-D77RDMKH-Czz7slb9.js → stateDiagram-D77RDMKH-DUbaZs3a.js} +1 -1
  245. package/dist-embed/chunks/{stateDiagram-D77RDMKH-DvgDxPXs.js → stateDiagram-D77RDMKH-R5RRRvFY.js} +1 -1
  246. package/dist-embed/chunks/{stateDiagram-v2-2041ed4f-CGEkaZYz.js → stateDiagram-v2-2041ed4f-O5FpnsEz.js} +1 -1
  247. package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-CbzbC1qh.js → stateDiagram-v2-MP3YSRHH-CxTXB7mT.js} +1 -1
  248. package/dist-embed/chunks/{stateDiagram-v2-MP3YSRHH-DGG9ROyK.js → stateDiagram-v2-MP3YSRHH-xKTLvXGN.js} +1 -1
  249. package/dist-embed/chunks/{styles-455b33cd-BpfBULhz.js → styles-455b33cd-D4Xv2qYx.js} +1 -1
  250. package/dist-embed/chunks/{styles-f932cba9-DsM5quNh.js → styles-f932cba9-BRIqeB8k.js} +1 -1
  251. package/dist-embed/chunks/{styles-fcc2142b-bC7I59Fx.js → styles-fcc2142b-CSNd2DtU.js} +1 -1
  252. package/dist-embed/chunks/{subset-shared.chunk-Ch6j8nKC.js → subset-shared.chunk-SugOGKH0.js} +1 -1
  253. package/dist-embed/chunks/{subset-worker.chunk-pJjck5pR.js → subset-worker.chunk-CHn-RJwQ.js} +1 -1
  254. package/dist-embed/chunks/{sv-SE-XGPEYMSR-BxcjSHE2.js → sv-SE-XGPEYMSR-DIGNKjA1.js} +1 -1
  255. package/dist-embed/chunks/{svgDrawCommon-148a3cd9-OC_CIhNw.js → svgDrawCommon-148a3cd9-ioBjWI45.js} +1 -1
  256. package/dist-embed/chunks/{swimlanes-42K2YHIH-DLiqjxvc.js → swimlanes-42K2YHIH-BPXSOfWl.js} +1 -1
  257. package/dist-embed/chunks/{swimlanes-42K2YHIH-nfpJsGfW.js → swimlanes-42K2YHIH-DID4P1mJ.js} +1 -1
  258. package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-DVkRheaE.js → swimlanesDiagram-VR7AAH4N-B216TpFb.js} +1 -1
  259. package/dist-embed/chunks/{swimlanesDiagram-VR7AAH4N-DjeQ0TlI.js → swimlanesDiagram-VR7AAH4N-C5LAWW5q.js} +1 -1
  260. package/dist-embed/chunks/{ta-IN-2NMHFXQM-rItSkDUS.js → ta-IN-2NMHFXQM-h5n2V9ms.js} +1 -1
  261. package/dist-embed/chunks/{th-TH-HPSO5L25-B7UzESFj.js → th-TH-HPSO5L25-DPUFV7b6.js} +1 -1
  262. package/dist-embed/chunks/{timeline-definition-24CTP7MA-CapVlXMl.js → timeline-definition-24CTP7MA-CsrTDzso.js} +1 -1
  263. package/dist-embed/chunks/{timeline-definition-24CTP7MA-eOK0mNc7.js → timeline-definition-24CTP7MA-Y3tUsmSp.js} +1 -1
  264. package/dist-embed/chunks/{timeline-definition-7545f45a-afx9iuZR.js → timeline-definition-7545f45a-Dwe7O50H.js} +1 -1
  265. package/dist-embed/chunks/{tokens-BfuLIPUq.js → tokens-DTIgYcNS.js} +1 -1
  266. package/dist-embed/chunks/{tr-TR-DEFEU3FU-Ci6oNfEX.js → tr-TR-DEFEU3FU-BezJkdMx.js} +1 -1
  267. package/dist-embed/chunks/{uk-UA-QMV73CPH-C9csqvO6.js → uk-UA-QMV73CPH-CqILlosm.js} +1 -1
  268. package/dist-embed/chunks/{usePrimerThemeBridge-D_1NuGKb.js → usePrimerThemeBridge-CoHussa9.js} +1 -1
  269. package/dist-embed/chunks/{vennDiagram-4TSXK5OY-D12hHdDQ.js → vennDiagram-4TSXK5OY-BhVdyHxt.js} +1 -1
  270. package/dist-embed/chunks/{vennDiagram-4TSXK5OY-CJ0VIZqI.js → vennDiagram-4TSXK5OY-ClTlC2ql.js} +1 -1
  271. package/dist-embed/chunks/{vi-VN-M7AON7JQ-DRAj2kZj.js → vi-VN-M7AON7JQ-CnkPVQ0a.js} +1 -1
  272. package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-B1FfO2GD.js → wardleyDiagram-VM6X3IG4-DbWIMpvU.js} +1 -1
  273. package/dist-embed/chunks/{wardleyDiagram-VM6X3IG4-BfuBJbTV.js → wardleyDiagram-VM6X3IG4-kS16z5iB.js} +1 -1
  274. package/dist-embed/chunks/{xychartDiagram-3f383b91-BMDhPCCG.js → xychartDiagram-3f383b91-DYoT_EjG.js} +1 -1
  275. package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-xLO3w9Bz.js → xychartDiagram-S5SC5T6Z-CdwuwQAF.js} +1 -1
  276. package/dist-embed/chunks/{xychartDiagram-S5SC5T6Z-DZ-XUHKl.js → xychartDiagram-S5SC5T6Z-KeQp-cQ1.js} +1 -1
  277. package/dist-embed/chunks/{zh-CN-LNUGB5OW-DLOyW8hH.js → zh-CN-LNUGB5OW-CNdfctAT.js} +1 -1
  278. package/dist-embed/chunks/{zh-HK-E62DVLB3-DwC6_2Ws.js → zh-HK-E62DVLB3-DEXwa5-T.js} +1 -1
  279. package/dist-embed/chunks/{zh-TW-RAJ6MFWO-DEMugIwa.js → zh-TW-RAJ6MFWO-BF7cCYAK.js} +1 -1
  280. package/dist-embed/datalayer-app-main.js +21 -21
  281. package/lib/apps/core/index.d.ts +16 -0
  282. package/lib/apps/index.d.ts +2 -2
  283. package/lib/apps/index.js +1 -1
  284. package/lib/apps/plugins/agents/DatalayerAgentBridge.js +9 -14
  285. package/lib/apps/plugins/agents/index.d.ts +1 -1
  286. package/lib/apps/plugins/agents/index.js +1 -1
  287. package/lib/apps/plugins/agents/plugin.d.ts +10 -0
  288. package/lib/apps/plugins/agents/plugin.js +10 -0
  289. package/lib/apps/plugins/chat/ChatView.js +13 -1
  290. package/lib/apps/shell/LoopWorkspace.d.ts +8 -1
  291. package/lib/apps/shell/LoopWorkspace.js +5 -3
  292. package/lib/chat/header/ChatHeaderBase.d.ts +3 -1
  293. package/lib/chat/header/ChatHeaderBase.js +2 -2
  294. package/lib/chat/header/ChatViewModeToggle.d.ts +7 -1
  295. package/lib/chat/header/ChatViewModeToggle.js +5 -2
  296. package/lib/protocols/agentProtocols.js +3 -1
  297. package/lib/protocols/pap/index.d.ts +4 -0
  298. package/lib/protocols/pap/index.js +41 -0
  299. package/package.json +2 -2
  300. package/dist-embed/chunks/Avatar-DbU3YP4x.js +0 -1
  301. package/dist-embed/chunks/DatalayerAgentBridge-Bz2KWRXK.js +0 -1
  302. package/dist-embed/chunks/YouTubePlugin-xBjNr2Iu.js +0 -1
  303. package/dist-embed/chunks/index-DlK9qLPz.js +0 -1
  304. package/dist-embed/chunks/plugin-Dz5L6Xn8.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as n,B as i,r as p,T as _,L as Y,_ as le,cn as ce,co as ue,I as fe,cp as pe,cq as me,cr as Q,be as he,cs as xe,ct as _e}from"../datalayer-app-main.js";const ge=["scalar","string","sequence","mapping","set","ndarray","dataframe","series","figure","widget","module","function","class","object"],J=1e4,N="__DL_KERNEL_VARIABLES__",ye=`def __dl_kernel_variables(__dl_name=None, __dl_modules=False):
1
+ import{j as n,B as i,r as p,T as _,L as Y,_ as le,co as ce,cp as ue,I as fe,cq as pe,cr as me,cs as Q,bf as he,ct as xe,cu as _e}from"../datalayer-app-main.js";const ge=["scalar","string","sequence","mapping","set","ndarray","dataframe","series","figure","widget","module","function","class","object"],J=1e4,N="__DL_KERNEL_VARIABLES__",ye=`def __dl_kernel_variables(__dl_name=None, __dl_modules=False):
2
2
  import io as _io
3
3
  import json as _json
4
4
  import sys as _sys
@@ -196,4 +196,4 @@ try:
196
196
  __dl_kernel_variables(${t}, ${s})
197
197
  finally:
198
198
  del __dl_kernel_variables
199
- `}const V=new Map([["python",{code:be}]]);function Le(e,t){const s=e.toLowerCase();return V.set(s,t),()=>{V.get(s)===t&&V.delete(s)}}function O(e){if(!e)return;const t=e.toLowerCase();return V.get(t)??V.get(t.replace(/[0-9.]+$/,""))}function Z(e){return O(e)!==void 0}class b extends Error{constructor(t){super(t),this.name="KernelVariablesError"}}function X(e){const{stdout:t,error:s}=e,r=t.lastIndexOf(N),a=r>0?t.lastIndexOf(N,r-1):-1;if(a<0||r<=a)throw new b(s?`The kernel could not list its variables: ${s}`:"The kernel did not say what its variables are.");const l=t.slice(a+N.length,r);let c;try{c=JSON.parse(l)}catch{throw new b("The kernel answered with something that is not JSON.")}if(!c||typeof c!="object"||Array.isArray(c))throw new b("The kernel answered with no variables.");const u=c;if(typeof u.error=="string")throw new b(u.error);return u}const k=e=>typeof e=="string"?e:void 0,M=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0;function ee(e){if(!e||typeof e!="object")return;const t=e,s=k(t.name);if(!s)return;const r=ge.includes(t.kind)?t.kind:"object",a={name:s,type:k(t.type)??"object",kind:r,preview:k(t.preview)??""},l=k(t.module);l&&(a.module=l);const c=M(t.size);c!==void 0&&(a.size=c),Array.isArray(t.shape)&&t.shape.every(m=>M(m)!==void 0)&&(a.shape=t.shape);const u=M(t.length);u!==void 0&&(a.length=u);const f=k(t.dtype);f&&(a.dtype=f);const o=k(t.model_id);return o&&(a.modelId=o),a}function je(e){const t=X(e);if(!Array.isArray(t.variables))throw new b("The kernel answered with no variables.");return t.variables.map(ee).filter(s=>s!==void 0)}function ke(e){const s=X(e).variable,r=ee(s);if(!s||!r)throw new b("The kernel did not describe the variable.");const a=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return{...r,repr:k(s.repr)??"",truncated:s.truncated===!0,data:a}}async function ve(e,t={}){const s=O(t.language??"python");if(!s)throw new b(`Variables are listed for Python kernels, not ${t.language}.`);return je(await e(s.code({modules:t.modules})))}async function Se(e,t,s={}){const r=O(s.language??"python");if(!r)throw new b(`Variables are listed for Python kernels, not ${s.language}.`);return ke(await e(r.code({name:t})))}function S(e){if(e===void 0)return"";const t=["B","KB","MB","GB","TB"];let s=e,r=0;for(;s>=1024&&r<t.length-1;)s/=1024,r+=1;return r===0?`${s} ${t[r]}`:`${s.toFixed(s<10?1:0)} ${t[r]}`}function C(e){const{kind:t,shape:s,length:r,dtype:a}=e;if(t==="dataframe"&&s?.length===2)return`${s[0]} rows × ${s[1]} cols`;if(t==="series"&&s?.length)return`${s[0]} rows${a?` · ${a}`:""}`;if(t==="ndarray"&&s){const l=s.length?s.join(" × "):"scalar";return a?`${l} · ${a}`:l}return r!==void 0?t==="mapping"?`${r} ${r===1?"key":"keys"}`:t==="string"?`${r} ${r===1?"char":"chars"}`:`${r} ${r===1?"item":"items"}`:""}async function $e(e,t,s){const r=e.requestExecute({code:t,silent:!0,store_history:!1,stop_on_error:!1,allow_stdin:!1},!0);s?.(r.msg.header.msg_id);const a=[];let l;r.onIOPub=u=>{const f=u.header.msg_type;if(f==="stream"){const o=u.content;o.name==="stdout"&&a.push(o.text)}else if(f==="error"){const o=u.content;l=`${o.ename}: ${o.evalue}`}};const c=await r.done;if(!l&&c?.content?.status==="error"){const u=c.content;l=`${u.ename}: ${u.evalue}`}return{stdout:a.join(""),error:l}}function ze(e,t){return s=>$e(e,s,t)}const Ee=p.lazy(()=>le(()=>import("./WidgetVariableView-CJTAKqh1.js"),[],import.meta.url)),W={fontFamily:"mono",fontSize:0,whiteSpace:"pre-wrap",wordBreak:"break-word"};function E({variable:e}){return n.jsxs(i,{children:[n.jsx(i,{as:"pre","data-kernel-variable-repr":"",sx:{...W,m:0,p:2,maxHeight:240,overflow:"auto",bg:"canvas.inset",color:"fg.default",border:"1px solid",borderColor:"border.default",borderRadius:2},children:e.repr}),e.truncated&&n.jsxs(_,{as:"p",sx:{fontSize:0,color:"fg.muted",m:0,mt:1},children:["Cut at ",e.repr.length.toLocaleString()," characters."]})]})}function w({facts:e}){return n.jsx(i,{as:"dl",sx:{display:"grid",gridTemplateColumns:"max-content 1fr",columnGap:3,rowGap:1,m:0,fontSize:1},children:e.filter(([,t])=>t).map(([t,s])=>n.jsxs(i,{sx:{display:"contents"},children:[n.jsx(i,{as:"dt",sx:{color:"fg.muted"},children:t}),n.jsx(i,{as:"dd",sx:{m:0,...W,fontSize:1},children:s})]},t))})}function P({columns:e,index:t,rows:s,caption:r}){const a={px:2,py:1,borderBottom:"1px solid",borderColor:"border.muted",textAlign:"left",whiteSpace:"nowrap",fontFamily:"mono",fontSize:0};return n.jsx(i,{sx:{overflow:"auto",maxHeight:280,border:"1px solid",borderColor:"border.default",borderRadius:2},children:n.jsxs(i,{as:"table","data-kernel-variable-table":"",sx:{borderCollapse:"collapse",width:"100%",color:"fg.default"},children:[r&&n.jsx(i,{as:"caption",sx:{textAlign:"left",p:2,fontSize:0,color:"fg.muted"},children:r}),n.jsx("thead",{children:n.jsxs(i,{as:"tr",sx:{bg:"canvas.subtle"},children:[t&&n.jsx(i,{as:"th",sx:a}),e.map((l,c)=>n.jsx(i,{as:"th",sx:{...a,fontWeight:"bold"},children:l},`${l}-${c}`))]})}),n.jsx("tbody",{children:s.map((l,c)=>n.jsxs("tr",{children:[t&&n.jsx(i,{as:"th",sx:{...a,color:"fg.muted"},children:t[c]}),l.map((u,f)=>n.jsx(i,{as:"td",sx:a,children:u},f))]},c))})]})})}const y=e=>Array.isArray(e)?e.map(t=>String(t)):[],Ne=[{id:"scalar",matches:e=>e.kind==="scalar"||e.kind==="string",render:({variable:e})=>n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Type",e.type],["Length",e.length?.toLocaleString()],["Size",S(e.size)]]}),n.jsx(E,{variable:e})]})},{id:"collection",matches:e=>e.kind==="sequence"||e.kind==="set"||e.kind==="mapping",render:({variable:e})=>{const t=Array.isArray(e.data.items)?e.data.items:[],s=e.kind==="mapping";return n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Type",e.type],["Length",C(e)],["Size",S(e.size)]]}),t.length>0&&n.jsx(P,{caption:e.length!==void 0&&e.length>t.length?`The first ${t.length} of ${e.length.toLocaleString()}`:void 0,columns:s?["Key","Value"]:["Item"],index:s?void 0:t.map((r,a)=>String(a)),rows:t.map(r=>s?y(r):[String(r)])})]})}},{id:"ndarray",matches:e=>e.kind==="ndarray",render:({variable:e})=>n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Shape",e.shape?`(${e.shape.join(", ")})`:""],["Dtype",e.dtype],["Size",S(e.size)]]}),n.jsx(E,{variable:e})]})},{id:"dataframe",matches:e=>e.kind==="dataframe",render:({variable:e})=>{const t=y(e.data.columns),s=y(e.data.dtypes),r=Array.isArray(e.data.rows)?e.data.rows.map(y):[];return n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Shape",C(e)],["Size",S(e.size)]]}),t.length>0?n.jsx(P,{caption:`head(${r.length})`,columns:t.map((a,l)=>s[l]?`${a} · ${s[l]}`:a),index:y(e.data.index),rows:r}):n.jsx(E,{variable:e})]})}},{id:"series",matches:e=>e.kind==="series",render:({variable:e})=>{const t=y(e.data.values);return n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Name",e.data.name],["Length",C(e)],["Size",S(e.size)]]}),n.jsx(P,{caption:`head(${t.length})`,columns:[String(e.data.name??e.name)],index:y(e.data.index),rows:t.map(s=>[s])})]})}},{id:"figure",matches:e=>e.kind==="figure",render:({variable:e})=>typeof e.data.png=="string"?n.jsx(i,{as:"img",alt:`The figure ${e.name}`,src:`data:image/png;base64,${e.data.png}`,sx:{maxWidth:"100%",bg:"white",borderRadius:2}}):n.jsx(E,{variable:e})},{id:"widget",matches:e=>e.kind==="widget",summary:e=>e.preview?`value: ${e.preview}`:e.type,render:({variable:e,connection:t})=>n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Widget",e.type],["Value",e.preview],["Description",e.data.description]]}),t&&e.modelId?n.jsx(p.Suspense,{fallback:n.jsx(_,{sx:{fontSize:1,color:"fg.muted"},children:"Loading the widget…"}),children:n.jsx(Ee,{connection:t,modelId:e.modelId})}):n.jsx(_,{as:"p",sx:{m:0,fontSize:1,color:"fg.muted"},children:"The widget is drawn live where the page talks to its kernel."})]})},{id:"callable",matches:e=>e.kind==="function"||e.kind==="class"||e.kind==="module",summary:e=>e.kind==="module"?`module ${e.preview}`:`${e.kind} ${e.preview}`,render:({variable:e})=>n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.kind!=="module"&&n.jsxs(i,{sx:{...W,fontSize:1},children:[e.kind==="class"?"class ":"def ",e.preview,e.data.signature??""]}),e.kind==="class"&&y(e.data.bases).length>0&&n.jsx(i,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:y(e.data.bases).map(t=>n.jsx(Y,{variant:"secondary",children:t},t))}),n.jsx(w,{facts:[["Module",e.kind==="module"?e.preview:void 0],["File",e.data.file]]}),typeof e.data.doc=="string"&&e.data.doc&&n.jsx(_,{as:"p",sx:{m:0,fontSize:1,whiteSpace:"pre-wrap"},children:e.data.doc})]})}],U={id:"repr",matches:()=>!0,render:({variable:e})=>n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Type",e.module&&e.module!=="builtins"?`${e.module}.${e.type}`:e.type],["Size",S(e.size)]]}),n.jsx(E,{variable:e})]})};class Ve{_registered=[];register(t){return this._registered.unshift(t),()=>{this._registered=this._registered.filter(s=>s!==t)}}list(){return[...this._registered,...Ne,U]}resolve(t,s=[]){return[...s,...this.list()].find(r=>r.matches(t))??U}}const te=new Ve;function v({children:e,busy:t=!1,...s}){return n.jsxs(i,{...s,sx:{display:"flex",alignItems:"center",gap:2,p:3,color:"fg.muted",fontSize:1},children:[t&&n.jsx(_e,{size:"small"}),n.jsx(_,{children:e})]})}function Te(e,t,s,r,a){const[l,c]=p.useState({state:"none"});return p.useEffect(()=>{let u=!1;const f=o=>!u&&c(o);return s?(f(Z(r)?{state:"ready",execute:s,language:r}:{state:"unsupported",language:r}),()=>{u=!0}):!e&&!t?(f({state:"none"}),()=>{u=!0}):(f({state:"starting"}),(async()=>{e&&await e.ready;const o=t??e?.connection??null;if(!o){f({state:"none"});return}const x=(await o.info)?.language_info?.name??"";f(Z(x)?{state:"ready",execute:ze(o,g=>a.add(g)),language:x,connection:o}:{state:"unsupported",language:x||"an unknown language"})})().catch(()=>f({state:"none"})),()=>{u=!0})},[e,t,s,r,a]),l}function Ie({variable:e,connection:t,execute:s,language:r,renderers:a,version:l}){const[c,u]=p.useState(),[f,o]=p.useState();if(p.useEffect(()=>{let x=!1;return o(void 0),Se(s,e.name,{language:r}).then(g=>!x&&u(g)).catch(g=>!x&&o(g instanceof Error?g.message:String(g))),()=>{x=!0}},[s,e.name,r,l]),f)return n.jsx(Q,{variant:"danger",sx:{fontSize:1},children:f});if(!c)return n.jsx(v,{busy:!0,children:"Reading the variable…"});const m=te.resolve(c,a);return n.jsx(i,{"data-kernel-variable-details":c.name,"data-renderer":m.id,children:m.render({variable:c,connection:t})})}const Ce=({kernel:e,connection:t,execute:s,language:r="python",autoRefresh:a=!0,showModules:l=!1,renderers:c=[],maxHeight:u=480})=>{const f=p.useMemo(()=>new Set,[]),o=Te(e,t,s,r,f),[m,x]=p.useState(),[g,q]=p.useState(!1),[T,G]=p.useState(),[R,ne]=p.useState(""),[I,se]=p.useState(l),[re,K]=p.useState(),[ae,ie]=p.useState(0),B=p.useRef(void 0),$=p.useCallback(async()=>{if(o.state==="ready"){q(!0);try{const d=await ve(o.execute,{language:o.language,modules:I});x(d),G(void 0),ie(h=>h+1)}catch(d){G(d instanceof Error?d.message:String(d))}finally{q(!1)}}},[o,I]);p.useEffect(()=>{x(void 0),K(void 0),$()},[$]),p.useEffect(()=>{const d=o.state==="ready"?o.connection:void 0;if(!d||!a)return;const h=()=>{clearTimeout(B.current),B.current=setTimeout(()=>{$()},250)},L=(oe,j)=>{if(j.header.msg_type!=="status")return;const de=j.content.execution_state,F=j.parent_header;de==="idle"&&F?.msg_type==="execute_request"&&F.msg_id&&!f.has(F.msg_id)&&h()};let z=!1;const H=(oe,j)=>{j==="restarting"||j==="autorestarting"?(z=!0,x([]),K(void 0)):j==="idle"&&z&&(z=!1,h())};return d.iopubMessage.connect(L),d.statusChanged.connect(H),()=>{clearTimeout(B.current),d.iopubMessage.disconnect(L),d.statusChanged.disconnect(H)}},[o,a,$,f]);const A=p.useMemo(()=>{const d=R.trim().toLowerCase();return(m??[]).filter(h=>!d||h.name.toLowerCase().includes(d)||h.type.toLowerCase().includes(d))},[m,R]);if(o.state==="none")return n.jsx(v,{"data-kernel-variables":"none",children:"No kernel: its variables are listed once there is one."});if(o.state==="starting")return n.jsx(v,{busy:!0,"data-kernel-variables":"starting",children:"The kernel is starting…"});if(o.state==="unsupported")return n.jsx(v,{"data-kernel-variables":"unsupported",children:`Variables are listed for Python kernels; this one runs ${o.language}.`});const D=o;return n.jsxs(i,{"data-kernel-variables":"ready",sx:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[n.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:2},children:[n.jsx(ce,{"aria-label":"Filter the variables",placeholder:"Filter by name or type",leadingVisual:ue,value:R,onChange:d=>ne(d.target.value),size:"small",sx:{flex:1,minWidth:0}}),n.jsx(fe,{icon:pe,"aria-label":"Refresh the variables",size:"small",disabled:g,onClick:()=>{$()},"data-kernel-variables-refresh":""})]}),n.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:2},children:[n.jsx(_,{id:"kernel-variables-modules",sx:{fontSize:0,color:"fg.muted",flex:1},children:m?`${A.length} of ${m.length} variable${m.length===1?"":"s"}`:""}),n.jsx(_,{sx:{fontSize:0,color:"fg.muted"},children:"Modules"}),n.jsx(me,{size:"small","aria-labelledby":"kernel-variables-modules",checked:I,onClick:()=>se(!I),statusLabelPosition:"end"})]}),T&&n.jsx(Q,{variant:"danger",sx:{fontSize:1},children:T}),!m&&!T&&n.jsx(v,{busy:!0,children:"Listing the variables…"}),m&&m.length===0&&!T&&n.jsx(v,{"data-kernel-variables":"empty",children:"No variables yet: define some by running code."}),A.length>0&&n.jsx(i,{as:"ul",sx:{listStyle:"none",m:0,p:0,maxHeight:u,overflow:"auto",border:"1px solid",borderColor:"border.default",borderRadius:2},children:A.map(d=>{const h=re===d.name,L=te.resolve(d,c),z=C(d);return n.jsxs(i,{as:"li","data-kernel-variable":d.name,sx:{borderBottom:"1px solid",borderColor:"border.muted","&:last-child":{borderBottom:"none"}},children:[n.jsxs(i,{as:"button",type:"button","aria-expanded":h,onClick:()=>K(h?void 0:d.name),sx:{display:"grid",gridTemplateColumns:"auto minmax(0, 1fr) auto",columnGap:2,alignItems:"baseline",width:"100%",textAlign:"left",px:2,py:1,border:"none",bg:h?"canvas.subtle":"transparent",color:"fg.default",cursor:"pointer","&:hover":{bg:"canvas.subtle"}},children:[n.jsx(i,{sx:{color:"fg.muted",alignSelf:"center"},children:h?n.jsx(he,{size:12}):n.jsx(xe,{size:12})}),n.jsxs(i,{sx:{minWidth:0},children:[n.jsx(_,{sx:{fontFamily:"mono",fontSize:1,fontWeight:"bold"},children:d.name}),n.jsx(_,{as:"div",sx:{fontFamily:"mono",fontSize:0,color:"fg.muted",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L.summary?.(d)??d.preview})]}),n.jsxs(i,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:1},children:[n.jsx(Y,{variant:"secondary",size:"small",children:d.type}),n.jsx(_,{sx:{fontSize:0,color:"fg.muted"},children:z||S(d.size)})]})]}),h&&n.jsx(i,{sx:{px:3,pb:3,pt:1},children:n.jsx(Ie,{variable:d,connection:D.connection,execute:D.execute,language:D.language,renderers:c,version:ae})})]},d.name)})}),m&&m.length>0&&A.length===0&&n.jsx(v,{children:"No variable matches the filter."})]})};export{Ce as K,ye as P,N as a,J as b,Ve as c,E as d,$e as e,P as f,b as g,U as h,S as i,Se as j,we as k,ze as l,C as m,te as n,O as o,X as p,ve as q,ke as r,je as s,be as t,Le as u,Z as v,ee as w};
199
+ `}const V=new Map([["python",{code:be}]]);function Le(e,t){const s=e.toLowerCase();return V.set(s,t),()=>{V.get(s)===t&&V.delete(s)}}function O(e){if(!e)return;const t=e.toLowerCase();return V.get(t)??V.get(t.replace(/[0-9.]+$/,""))}function Z(e){return O(e)!==void 0}class b extends Error{constructor(t){super(t),this.name="KernelVariablesError"}}function X(e){const{stdout:t,error:s}=e,r=t.lastIndexOf(N),a=r>0?t.lastIndexOf(N,r-1):-1;if(a<0||r<=a)throw new b(s?`The kernel could not list its variables: ${s}`:"The kernel did not say what its variables are.");const l=t.slice(a+N.length,r);let c;try{c=JSON.parse(l)}catch{throw new b("The kernel answered with something that is not JSON.")}if(!c||typeof c!="object"||Array.isArray(c))throw new b("The kernel answered with no variables.");const u=c;if(typeof u.error=="string")throw new b(u.error);return u}const k=e=>typeof e=="string"?e:void 0,M=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0;function ee(e){if(!e||typeof e!="object")return;const t=e,s=k(t.name);if(!s)return;const r=ge.includes(t.kind)?t.kind:"object",a={name:s,type:k(t.type)??"object",kind:r,preview:k(t.preview)??""},l=k(t.module);l&&(a.module=l);const c=M(t.size);c!==void 0&&(a.size=c),Array.isArray(t.shape)&&t.shape.every(m=>M(m)!==void 0)&&(a.shape=t.shape);const u=M(t.length);u!==void 0&&(a.length=u);const f=k(t.dtype);f&&(a.dtype=f);const o=k(t.model_id);return o&&(a.modelId=o),a}function je(e){const t=X(e);if(!Array.isArray(t.variables))throw new b("The kernel answered with no variables.");return t.variables.map(ee).filter(s=>s!==void 0)}function ke(e){const s=X(e).variable,r=ee(s);if(!s||!r)throw new b("The kernel did not describe the variable.");const a=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return{...r,repr:k(s.repr)??"",truncated:s.truncated===!0,data:a}}async function ve(e,t={}){const s=O(t.language??"python");if(!s)throw new b(`Variables are listed for Python kernels, not ${t.language}.`);return je(await e(s.code({modules:t.modules})))}async function Se(e,t,s={}){const r=O(s.language??"python");if(!r)throw new b(`Variables are listed for Python kernels, not ${s.language}.`);return ke(await e(r.code({name:t})))}function S(e){if(e===void 0)return"";const t=["B","KB","MB","GB","TB"];let s=e,r=0;for(;s>=1024&&r<t.length-1;)s/=1024,r+=1;return r===0?`${s} ${t[r]}`:`${s.toFixed(s<10?1:0)} ${t[r]}`}function C(e){const{kind:t,shape:s,length:r,dtype:a}=e;if(t==="dataframe"&&s?.length===2)return`${s[0]} rows × ${s[1]} cols`;if(t==="series"&&s?.length)return`${s[0]} rows${a?` · ${a}`:""}`;if(t==="ndarray"&&s){const l=s.length?s.join(" × "):"scalar";return a?`${l} · ${a}`:l}return r!==void 0?t==="mapping"?`${r} ${r===1?"key":"keys"}`:t==="string"?`${r} ${r===1?"char":"chars"}`:`${r} ${r===1?"item":"items"}`:""}async function $e(e,t,s){const r=e.requestExecute({code:t,silent:!0,store_history:!1,stop_on_error:!1,allow_stdin:!1},!0);s?.(r.msg.header.msg_id);const a=[];let l;r.onIOPub=u=>{const f=u.header.msg_type;if(f==="stream"){const o=u.content;o.name==="stdout"&&a.push(o.text)}else if(f==="error"){const o=u.content;l=`${o.ename}: ${o.evalue}`}};const c=await r.done;if(!l&&c?.content?.status==="error"){const u=c.content;l=`${u.ename}: ${u.evalue}`}return{stdout:a.join(""),error:l}}function ze(e,t){return s=>$e(e,s,t)}const Ee=p.lazy(()=>le(()=>import("./WidgetVariableView-BTOwHP78.js"),[],import.meta.url)),W={fontFamily:"mono",fontSize:0,whiteSpace:"pre-wrap",wordBreak:"break-word"};function E({variable:e}){return n.jsxs(i,{children:[n.jsx(i,{as:"pre","data-kernel-variable-repr":"",sx:{...W,m:0,p:2,maxHeight:240,overflow:"auto",bg:"canvas.inset",color:"fg.default",border:"1px solid",borderColor:"border.default",borderRadius:2},children:e.repr}),e.truncated&&n.jsxs(_,{as:"p",sx:{fontSize:0,color:"fg.muted",m:0,mt:1},children:["Cut at ",e.repr.length.toLocaleString()," characters."]})]})}function w({facts:e}){return n.jsx(i,{as:"dl",sx:{display:"grid",gridTemplateColumns:"max-content 1fr",columnGap:3,rowGap:1,m:0,fontSize:1},children:e.filter(([,t])=>t).map(([t,s])=>n.jsxs(i,{sx:{display:"contents"},children:[n.jsx(i,{as:"dt",sx:{color:"fg.muted"},children:t}),n.jsx(i,{as:"dd",sx:{m:0,...W,fontSize:1},children:s})]},t))})}function P({columns:e,index:t,rows:s,caption:r}){const a={px:2,py:1,borderBottom:"1px solid",borderColor:"border.muted",textAlign:"left",whiteSpace:"nowrap",fontFamily:"mono",fontSize:0};return n.jsx(i,{sx:{overflow:"auto",maxHeight:280,border:"1px solid",borderColor:"border.default",borderRadius:2},children:n.jsxs(i,{as:"table","data-kernel-variable-table":"",sx:{borderCollapse:"collapse",width:"100%",color:"fg.default"},children:[r&&n.jsx(i,{as:"caption",sx:{textAlign:"left",p:2,fontSize:0,color:"fg.muted"},children:r}),n.jsx("thead",{children:n.jsxs(i,{as:"tr",sx:{bg:"canvas.subtle"},children:[t&&n.jsx(i,{as:"th",sx:a}),e.map((l,c)=>n.jsx(i,{as:"th",sx:{...a,fontWeight:"bold"},children:l},`${l}-${c}`))]})}),n.jsx("tbody",{children:s.map((l,c)=>n.jsxs("tr",{children:[t&&n.jsx(i,{as:"th",sx:{...a,color:"fg.muted"},children:t[c]}),l.map((u,f)=>n.jsx(i,{as:"td",sx:a,children:u},f))]},c))})]})})}const y=e=>Array.isArray(e)?e.map(t=>String(t)):[],Ne=[{id:"scalar",matches:e=>e.kind==="scalar"||e.kind==="string",render:({variable:e})=>n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Type",e.type],["Length",e.length?.toLocaleString()],["Size",S(e.size)]]}),n.jsx(E,{variable:e})]})},{id:"collection",matches:e=>e.kind==="sequence"||e.kind==="set"||e.kind==="mapping",render:({variable:e})=>{const t=Array.isArray(e.data.items)?e.data.items:[],s=e.kind==="mapping";return n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Type",e.type],["Length",C(e)],["Size",S(e.size)]]}),t.length>0&&n.jsx(P,{caption:e.length!==void 0&&e.length>t.length?`The first ${t.length} of ${e.length.toLocaleString()}`:void 0,columns:s?["Key","Value"]:["Item"],index:s?void 0:t.map((r,a)=>String(a)),rows:t.map(r=>s?y(r):[String(r)])})]})}},{id:"ndarray",matches:e=>e.kind==="ndarray",render:({variable:e})=>n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Shape",e.shape?`(${e.shape.join(", ")})`:""],["Dtype",e.dtype],["Size",S(e.size)]]}),n.jsx(E,{variable:e})]})},{id:"dataframe",matches:e=>e.kind==="dataframe",render:({variable:e})=>{const t=y(e.data.columns),s=y(e.data.dtypes),r=Array.isArray(e.data.rows)?e.data.rows.map(y):[];return n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Shape",C(e)],["Size",S(e.size)]]}),t.length>0?n.jsx(P,{caption:`head(${r.length})`,columns:t.map((a,l)=>s[l]?`${a} · ${s[l]}`:a),index:y(e.data.index),rows:r}):n.jsx(E,{variable:e})]})}},{id:"series",matches:e=>e.kind==="series",render:({variable:e})=>{const t=y(e.data.values);return n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Name",e.data.name],["Length",C(e)],["Size",S(e.size)]]}),n.jsx(P,{caption:`head(${t.length})`,columns:[String(e.data.name??e.name)],index:y(e.data.index),rows:t.map(s=>[s])})]})}},{id:"figure",matches:e=>e.kind==="figure",render:({variable:e})=>typeof e.data.png=="string"?n.jsx(i,{as:"img",alt:`The figure ${e.name}`,src:`data:image/png;base64,${e.data.png}`,sx:{maxWidth:"100%",bg:"white",borderRadius:2}}):n.jsx(E,{variable:e})},{id:"widget",matches:e=>e.kind==="widget",summary:e=>e.preview?`value: ${e.preview}`:e.type,render:({variable:e,connection:t})=>n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Widget",e.type],["Value",e.preview],["Description",e.data.description]]}),t&&e.modelId?n.jsx(p.Suspense,{fallback:n.jsx(_,{sx:{fontSize:1,color:"fg.muted"},children:"Loading the widget…"}),children:n.jsx(Ee,{connection:t,modelId:e.modelId})}):n.jsx(_,{as:"p",sx:{m:0,fontSize:1,color:"fg.muted"},children:"The widget is drawn live where the page talks to its kernel."})]})},{id:"callable",matches:e=>e.kind==="function"||e.kind==="class"||e.kind==="module",summary:e=>e.kind==="module"?`module ${e.preview}`:`${e.kind} ${e.preview}`,render:({variable:e})=>n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.kind!=="module"&&n.jsxs(i,{sx:{...W,fontSize:1},children:[e.kind==="class"?"class ":"def ",e.preview,e.data.signature??""]}),e.kind==="class"&&y(e.data.bases).length>0&&n.jsx(i,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:y(e.data.bases).map(t=>n.jsx(Y,{variant:"secondary",children:t},t))}),n.jsx(w,{facts:[["Module",e.kind==="module"?e.preview:void 0],["File",e.data.file]]}),typeof e.data.doc=="string"&&e.data.doc&&n.jsx(_,{as:"p",sx:{m:0,fontSize:1,whiteSpace:"pre-wrap"},children:e.data.doc})]})}],U={id:"repr",matches:()=>!0,render:({variable:e})=>n.jsxs(i,{sx:{display:"flex",flexDirection:"column",gap:2},children:[n.jsx(w,{facts:[["Type",e.module&&e.module!=="builtins"?`${e.module}.${e.type}`:e.type],["Size",S(e.size)]]}),n.jsx(E,{variable:e})]})};class Ve{_registered=[];register(t){return this._registered.unshift(t),()=>{this._registered=this._registered.filter(s=>s!==t)}}list(){return[...this._registered,...Ne,U]}resolve(t,s=[]){return[...s,...this.list()].find(r=>r.matches(t))??U}}const te=new Ve;function v({children:e,busy:t=!1,...s}){return n.jsxs(i,{...s,sx:{display:"flex",alignItems:"center",gap:2,p:3,color:"fg.muted",fontSize:1},children:[t&&n.jsx(_e,{size:"small"}),n.jsx(_,{children:e})]})}function Te(e,t,s,r,a){const[l,c]=p.useState({state:"none"});return p.useEffect(()=>{let u=!1;const f=o=>!u&&c(o);return s?(f(Z(r)?{state:"ready",execute:s,language:r}:{state:"unsupported",language:r}),()=>{u=!0}):!e&&!t?(f({state:"none"}),()=>{u=!0}):(f({state:"starting"}),(async()=>{e&&await e.ready;const o=t??e?.connection??null;if(!o){f({state:"none"});return}const x=(await o.info)?.language_info?.name??"";f(Z(x)?{state:"ready",execute:ze(o,g=>a.add(g)),language:x,connection:o}:{state:"unsupported",language:x||"an unknown language"})})().catch(()=>f({state:"none"})),()=>{u=!0})},[e,t,s,r,a]),l}function Ie({variable:e,connection:t,execute:s,language:r,renderers:a,version:l}){const[c,u]=p.useState(),[f,o]=p.useState();if(p.useEffect(()=>{let x=!1;return o(void 0),Se(s,e.name,{language:r}).then(g=>!x&&u(g)).catch(g=>!x&&o(g instanceof Error?g.message:String(g))),()=>{x=!0}},[s,e.name,r,l]),f)return n.jsx(Q,{variant:"danger",sx:{fontSize:1},children:f});if(!c)return n.jsx(v,{busy:!0,children:"Reading the variable…"});const m=te.resolve(c,a);return n.jsx(i,{"data-kernel-variable-details":c.name,"data-renderer":m.id,children:m.render({variable:c,connection:t})})}const Ce=({kernel:e,connection:t,execute:s,language:r="python",autoRefresh:a=!0,showModules:l=!1,renderers:c=[],maxHeight:u=480})=>{const f=p.useMemo(()=>new Set,[]),o=Te(e,t,s,r,f),[m,x]=p.useState(),[g,q]=p.useState(!1),[T,G]=p.useState(),[R,ne]=p.useState(""),[I,se]=p.useState(l),[re,K]=p.useState(),[ae,ie]=p.useState(0),B=p.useRef(void 0),$=p.useCallback(async()=>{if(o.state==="ready"){q(!0);try{const d=await ve(o.execute,{language:o.language,modules:I});x(d),G(void 0),ie(h=>h+1)}catch(d){G(d instanceof Error?d.message:String(d))}finally{q(!1)}}},[o,I]);p.useEffect(()=>{x(void 0),K(void 0),$()},[$]),p.useEffect(()=>{const d=o.state==="ready"?o.connection:void 0;if(!d||!a)return;const h=()=>{clearTimeout(B.current),B.current=setTimeout(()=>{$()},250)},L=(oe,j)=>{if(j.header.msg_type!=="status")return;const de=j.content.execution_state,F=j.parent_header;de==="idle"&&F?.msg_type==="execute_request"&&F.msg_id&&!f.has(F.msg_id)&&h()};let z=!1;const H=(oe,j)=>{j==="restarting"||j==="autorestarting"?(z=!0,x([]),K(void 0)):j==="idle"&&z&&(z=!1,h())};return d.iopubMessage.connect(L),d.statusChanged.connect(H),()=>{clearTimeout(B.current),d.iopubMessage.disconnect(L),d.statusChanged.disconnect(H)}},[o,a,$,f]);const A=p.useMemo(()=>{const d=R.trim().toLowerCase();return(m??[]).filter(h=>!d||h.name.toLowerCase().includes(d)||h.type.toLowerCase().includes(d))},[m,R]);if(o.state==="none")return n.jsx(v,{"data-kernel-variables":"none",children:"No kernel: its variables are listed once there is one."});if(o.state==="starting")return n.jsx(v,{busy:!0,"data-kernel-variables":"starting",children:"The kernel is starting…"});if(o.state==="unsupported")return n.jsx(v,{"data-kernel-variables":"unsupported",children:`Variables are listed for Python kernels; this one runs ${o.language}.`});const D=o;return n.jsxs(i,{"data-kernel-variables":"ready",sx:{display:"flex",flexDirection:"column",gap:2,minWidth:0},children:[n.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:2},children:[n.jsx(ce,{"aria-label":"Filter the variables",placeholder:"Filter by name or type",leadingVisual:ue,value:R,onChange:d=>ne(d.target.value),size:"small",sx:{flex:1,minWidth:0}}),n.jsx(fe,{icon:pe,"aria-label":"Refresh the variables",size:"small",disabled:g,onClick:()=>{$()},"data-kernel-variables-refresh":""})]}),n.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:2},children:[n.jsx(_,{id:"kernel-variables-modules",sx:{fontSize:0,color:"fg.muted",flex:1},children:m?`${A.length} of ${m.length} variable${m.length===1?"":"s"}`:""}),n.jsx(_,{sx:{fontSize:0,color:"fg.muted"},children:"Modules"}),n.jsx(me,{size:"small","aria-labelledby":"kernel-variables-modules",checked:I,onClick:()=>se(!I),statusLabelPosition:"end"})]}),T&&n.jsx(Q,{variant:"danger",sx:{fontSize:1},children:T}),!m&&!T&&n.jsx(v,{busy:!0,children:"Listing the variables…"}),m&&m.length===0&&!T&&n.jsx(v,{"data-kernel-variables":"empty",children:"No variables yet: define some by running code."}),A.length>0&&n.jsx(i,{as:"ul",sx:{listStyle:"none",m:0,p:0,maxHeight:u,overflow:"auto",border:"1px solid",borderColor:"border.default",borderRadius:2},children:A.map(d=>{const h=re===d.name,L=te.resolve(d,c),z=C(d);return n.jsxs(i,{as:"li","data-kernel-variable":d.name,sx:{borderBottom:"1px solid",borderColor:"border.muted","&:last-child":{borderBottom:"none"}},children:[n.jsxs(i,{as:"button",type:"button","aria-expanded":h,onClick:()=>K(h?void 0:d.name),sx:{display:"grid",gridTemplateColumns:"auto minmax(0, 1fr) auto",columnGap:2,alignItems:"baseline",width:"100%",textAlign:"left",px:2,py:1,border:"none",bg:h?"canvas.subtle":"transparent",color:"fg.default",cursor:"pointer","&:hover":{bg:"canvas.subtle"}},children:[n.jsx(i,{sx:{color:"fg.muted",alignSelf:"center"},children:h?n.jsx(he,{size:12}):n.jsx(xe,{size:12})}),n.jsxs(i,{sx:{minWidth:0},children:[n.jsx(_,{sx:{fontFamily:"mono",fontSize:1,fontWeight:"bold"},children:d.name}),n.jsx(_,{as:"div",sx:{fontFamily:"mono",fontSize:0,color:"fg.muted",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:L.summary?.(d)??d.preview})]}),n.jsxs(i,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:1},children:[n.jsx(Y,{variant:"secondary",size:"small",children:d.type}),n.jsx(_,{sx:{fontSize:0,color:"fg.muted"},children:z||S(d.size)})]})]}),h&&n.jsx(i,{sx:{px:3,pb:3,pt:1},children:n.jsx(Ie,{variable:d,connection:D.connection,execute:D.execute,language:D.language,renderers:c,version:ae})})]},d.name)})}),m&&m.length>0&&A.length===0&&n.jsx(v,{children:"No variable matches the filter."})]})};export{Ce as K,ye as P,N as a,J as b,Ve as c,E as d,$e as e,P as f,b as g,U as h,S as i,Se as j,we as k,ze as l,C as m,te as n,O as o,X as p,ve as q,ke as r,je as s,be as t,Le as u,Z as v,ee as w};
@@ -1,7 +1,7 @@
1
- import{dO as K,_ as Y,dP as I,jA as m,jB as B,jC as A,jD as u,jE as v,jF as f,jG as z,jH as X,jI as E,jJ as y,jK as b,r as V}from"../datalayer-app-main.js";let x;function Q(){return x===void 0&&(x=typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="true"),x}function p(...t){Q()&&console.log(...t)}const g=K((t,o)=>({lexicals:new Map,pluginTools:new Map,setLexicals:e=>t(()=>({lexicals:e})),selectLexical:e=>o().lexicals.get(e),selectLexicalAdapter:e=>o().lexicals.get(e)?.adapter,registerPluginTools:(e,a)=>{const r=new Map(o().pluginTools),l=new Map(r.get(e)??[]);l.set(a.name,a),r.set(e,l),t(()=>({pluginTools:r}))},unregisterPluginTools:(e,a)=>{const r=o().pluginTools.get(e);if(!r?.has(a))return;const l=new Map(o().pluginTools),s=new Map(r);s.delete(a),s.size===0?l.delete(e):l.set(e,s),t(()=>({pluginTools:l}))},selectPluginTools:e=>[...o().pluginTools.get(e)?.values()??[]].sort((a,r)=>a.name.localeCompare(r.name)),selectPluginToolsKey:e=>[...o().pluginTools.get(e)?.keys()??[]].sort().join(","),selectPluginToolHandler:(e,a)=>{for(const r of o().pluginTools.get(e)?.values()??[]){const l=r.handlers[a];if(l)return l}},insertBlock:async(e,a,r,l,s)=>{const n=typeof e=="object"?e:{id:e,type:a,source:r,metadata:l,afterId:s},i=o().lexicals.get(n.id)?.adapter;if(!i)throw new Error(`Lexical document ${n.id} not found`);const c={block_id:"",block_type:n.type,source:n.source,metadata:n.metadata},d=await i.insertBlock(c,n.afterId);if(!d.success)throw new Error(d.error||"Failed to insert block");return d},updateBlock:async(e,a,r,l,s)=>{const n=typeof e=="object"?e:{id:e,blockId:a,type:r,source:l,metadata:s},i=o().lexicals.get(n.id)?.adapter;if(!i)throw new Error(`Lexical document ${n.id} not found`);const c=await i.getBlockById(n.blockId);if(!c)throw new Error(`Block ${n.blockId} not found`);const d={...c,block_type:n.type??c.block_type,source:n.source??c.source,metadata:{...c.metadata,...n.metadata}},h=await i.updateBlock(n.blockId,d);if(!h.success)throw new Error(h.error||"Failed to update block")},deleteBlock:async(e,a)=>{const r=typeof e=="object"?e:{id:e,blockId:a},l=o().lexicals.get(r.id)?.adapter;if(!l)throw new Error(`Lexical document ${r.id} not found`);const s=await l.deleteBlock([r.blockId]);if(!s.success)throw new Error(s.error||"Failed to delete block")},deleteBlocks:async(e,a)=>{const r=typeof e=="object"?e:{id:e,blockIds:a},l=o().lexicals.get(r.id)?.adapter;if(!l)throw new Error(`Lexical document ${r.id} not found`);const s=Array.isArray(r.blockIds)?r.blockIds:[r.blockIds],n=await l.deleteBlock(s);if(!n.success)throw new Error(n.error||"Failed to delete block");return n},readBlock:async(e,a)=>{const r=typeof e=="object"?e:{id:e,blockId:a},l=o().lexicals.get(r.id)?.adapter;if(!l)throw new Error(`Lexical document ${r.id} not found`);return await l.getBlockById(r.blockId)},readAllBlocks:async(e,a)=>{const r=typeof e=="object"?e:{id:e,format:a||"brief"},l=o().lexicals.get(r.id)?.adapter;if(!l)throw new Error(`Lexical document ${r.id} not found`);return await l.getBlocks(r.format||"brief")},runBlock:async(e,a)=>{const r=typeof e=="object"?e:{id:e,blockId:a};return await o().lexicals.get(r.id)?.adapter?.runBlock(r.blockId)??{success:!1,error:"Adapter not found"}},runAllBlocks:async e=>{const a=typeof e=="object"?e:{id:e};return await o().lexicals.get(a.id)?.adapter?.runAllBlocks()??{success:!1,error:"Adapter not found"}},executeCode:async(e,a,r,l,s)=>{const n=typeof e=="object"?e:{id:e,code:a,storeHistory:r,silent:l,stopOnError:s};return await o().lexicals.get(n.id)?.adapter?.executeCode(n.code,n.storeHistory,n.silent,n.stopOnError)??{success:!1,error:"Adapter not found"}},clearAllOutputs:async e=>{const a=typeof e=="object"?e:{id:e},r=o().lexicals.get(a.id)?.adapter;return r?await r.clearAllOutputs():{success:!1,error:"Adapter not found"}},restartKernel:async e=>{const a=typeof e=="object"?e:{id:e},r=o().lexicals.get(a.id)?.adapter;return r?await r.restartKernel():{success:!1,error:"Adapter not found"}},getBlockCount:async e=>(await o().readAllBlocks(e)).length,listAvailableBlocks:async e=>{p("[LexicalState] 🔍 listAvailableBlocks CALLED with:",{id:e});const a=typeof e=="object"?e:{id:e};p("[LexicalState] 📦 Processed params:",a);const r=o().lexicals.get(a.id)?.adapter;if(!r){const{listAvailableBlocksOperation:s}=await Y(async()=>{const{listAvailableBlocksOperation:i}=await Promise.resolve().then(()=>fe);return{listAvailableBlocksOperation:i}},void 0,import.meta.url);return await s.execute({type:"all"},{documentId:"static",executor:null})}return await r.listAvailableBlocks()},reset:()=>t({lexicals:new Map,pluginTools:new Map})}));function he(t){return I(g,t)}const D=m({afterId:u().describe("Position to insert block: 'TOP' for beginning, 'BOTTOM' for end, or a specific block ID"),type:u().min(1).describe("Block type (e.g., 'paragraph', 'heading', 'code', 'jupyter-cell', 'table', 'collapsible', 'list-item')"),source:u().describe("Block source content"),metadata:B(t=>{if(!(t===""||t===null)){if(typeof t=="string")try{const o=JSON.parse(t);return typeof o=="object"&&!Array.isArray(o)?o:void 0}catch{return}if(!(typeof t!="object"||Array.isArray(t)))return t}},A(u(),v()).optional().describe('Optional block metadata (aligned with Jupyter format). CRITICAL: To insert blocks INSIDE a collapsible, set metadata.collapsible to the RETURNED BLOCK ID from inserting the collapsible container (a specific ID like "6", NOT position markers like "TOP" or "BOTTOM"). Example: {collapsible: "6"} inserts block inside collapsible with ID "6". Position markers (TOP/BOTTOM) are ONLY for the afterId parameter, never for metadata.collapsible.'))}),G={name:"datalayer_insertBlock",displayName:"Insert Lexical Block",toolReferenceName:"insertBlock",description:"Insert blocks into Lexical documents (.dlex files). IMPORTANT: Lexical documents support EXECUTABLE JUPYTER CELLS - use type='jupyter-cell' to insert Python/R/Julia code cells that can be executed via kernel (just like .ipynb notebooks). Other block types: paragraph, heading, code (non-executable syntax highlighting), quote, list, table, collapsible, equation, image, youtube, horizontalrule. CRITICAL: DO NOT use markdown syntax in source field. Heading blocks use PLAIN TEXT (no # symbols) - specify tag metadata (h1-h6) instead. Inline formatting like **bold** or *italic* is automatically converted. ALWAYS call listAvailableBlocks FIRST to see block types and required metadata format. When inserting MULTIPLE blocks sequentially (e.g., creating a document outline with heading + paragraph + code), ALWAYS use afterId: 'BOTTOM' for each insertion to append blocks in order. For single insertions, call readAllBlocks first to see document structure. Position blocks using afterId: 'TOP' (beginning), 'BOTTOM' (end - REQUIRED for sequential inserts), or a specific block_id value from readAllBlocks. To insert blocks INSIDE a collapsible: 1) First insert collapsible (type='collapsible'), which returns a blockId, 2) Then insert nested blocks with metadata.collapsible set to that RETURNED BLOCK ID (NOT 'TOP' or 'BOTTOM'). Example: result = insertBlock({type: 'collapsible', source: 'Section', afterId: 'BOTTOM'}); insertBlock({type: 'paragraph', source: 'text', metadata: {collapsible: result.blockId}, afterId: 'BOTTOM'}). DO NOT use position markers (TOP/BOTTOM) as collapsible IDs - they are only for afterId positioning. Works on active .lexical/.dlex file.",parameters:f(D),operation:"insertBlock",config:{confirmationMessage:t=>`Insert ${t.type} block ${t.afterId==="TOP"?"at beginning":t.afterId==="BOTTOM"?"at end":`after block ${t.afterId}`}?
1
+ import{dP as K,_ as Y,dQ as I,jB as m,jC as B,jD as A,jE as u,jF as v,jG as f,jH as z,jI as X,jJ as E,jK as y,jL as b,r as V}from"../datalayer-app-main.js";let x;function Q(){return x===void 0&&(x=typeof window<"u"&&new URLSearchParams(window.location.search).get("debug")==="true"),x}function p(...t){Q()&&console.log(...t)}const g=K((t,o)=>({lexicals:new Map,pluginTools:new Map,setLexicals:e=>t(()=>({lexicals:e})),selectLexical:e=>o().lexicals.get(e),selectLexicalAdapter:e=>o().lexicals.get(e)?.adapter,registerPluginTools:(e,a)=>{const r=new Map(o().pluginTools),l=new Map(r.get(e)??[]);l.set(a.name,a),r.set(e,l),t(()=>({pluginTools:r}))},unregisterPluginTools:(e,a)=>{const r=o().pluginTools.get(e);if(!r?.has(a))return;const l=new Map(o().pluginTools),s=new Map(r);s.delete(a),s.size===0?l.delete(e):l.set(e,s),t(()=>({pluginTools:l}))},selectPluginTools:e=>[...o().pluginTools.get(e)?.values()??[]].sort((a,r)=>a.name.localeCompare(r.name)),selectPluginToolsKey:e=>[...o().pluginTools.get(e)?.keys()??[]].sort().join(","),selectPluginToolHandler:(e,a)=>{for(const r of o().pluginTools.get(e)?.values()??[]){const l=r.handlers[a];if(l)return l}},insertBlock:async(e,a,r,l,s)=>{const n=typeof e=="object"?e:{id:e,type:a,source:r,metadata:l,afterId:s},i=o().lexicals.get(n.id)?.adapter;if(!i)throw new Error(`Lexical document ${n.id} not found`);const c={block_id:"",block_type:n.type,source:n.source,metadata:n.metadata},d=await i.insertBlock(c,n.afterId);if(!d.success)throw new Error(d.error||"Failed to insert block");return d},updateBlock:async(e,a,r,l,s)=>{const n=typeof e=="object"?e:{id:e,blockId:a,type:r,source:l,metadata:s},i=o().lexicals.get(n.id)?.adapter;if(!i)throw new Error(`Lexical document ${n.id} not found`);const c=await i.getBlockById(n.blockId);if(!c)throw new Error(`Block ${n.blockId} not found`);const d={...c,block_type:n.type??c.block_type,source:n.source??c.source,metadata:{...c.metadata,...n.metadata}},h=await i.updateBlock(n.blockId,d);if(!h.success)throw new Error(h.error||"Failed to update block")},deleteBlock:async(e,a)=>{const r=typeof e=="object"?e:{id:e,blockId:a},l=o().lexicals.get(r.id)?.adapter;if(!l)throw new Error(`Lexical document ${r.id} not found`);const s=await l.deleteBlock([r.blockId]);if(!s.success)throw new Error(s.error||"Failed to delete block")},deleteBlocks:async(e,a)=>{const r=typeof e=="object"?e:{id:e,blockIds:a},l=o().lexicals.get(r.id)?.adapter;if(!l)throw new Error(`Lexical document ${r.id} not found`);const s=Array.isArray(r.blockIds)?r.blockIds:[r.blockIds],n=await l.deleteBlock(s);if(!n.success)throw new Error(n.error||"Failed to delete block");return n},readBlock:async(e,a)=>{const r=typeof e=="object"?e:{id:e,blockId:a},l=o().lexicals.get(r.id)?.adapter;if(!l)throw new Error(`Lexical document ${r.id} not found`);return await l.getBlockById(r.blockId)},readAllBlocks:async(e,a)=>{const r=typeof e=="object"?e:{id:e,format:a||"brief"},l=o().lexicals.get(r.id)?.adapter;if(!l)throw new Error(`Lexical document ${r.id} not found`);return await l.getBlocks(r.format||"brief")},runBlock:async(e,a)=>{const r=typeof e=="object"?e:{id:e,blockId:a};return await o().lexicals.get(r.id)?.adapter?.runBlock(r.blockId)??{success:!1,error:"Adapter not found"}},runAllBlocks:async e=>{const a=typeof e=="object"?e:{id:e};return await o().lexicals.get(a.id)?.adapter?.runAllBlocks()??{success:!1,error:"Adapter not found"}},executeCode:async(e,a,r,l,s)=>{const n=typeof e=="object"?e:{id:e,code:a,storeHistory:r,silent:l,stopOnError:s};return await o().lexicals.get(n.id)?.adapter?.executeCode(n.code,n.storeHistory,n.silent,n.stopOnError)??{success:!1,error:"Adapter not found"}},clearAllOutputs:async e=>{const a=typeof e=="object"?e:{id:e},r=o().lexicals.get(a.id)?.adapter;return r?await r.clearAllOutputs():{success:!1,error:"Adapter not found"}},restartKernel:async e=>{const a=typeof e=="object"?e:{id:e},r=o().lexicals.get(a.id)?.adapter;return r?await r.restartKernel():{success:!1,error:"Adapter not found"}},getBlockCount:async e=>(await o().readAllBlocks(e)).length,listAvailableBlocks:async e=>{p("[LexicalState] 🔍 listAvailableBlocks CALLED with:",{id:e});const a=typeof e=="object"?e:{id:e};p("[LexicalState] 📦 Processed params:",a);const r=o().lexicals.get(a.id)?.adapter;if(!r){const{listAvailableBlocksOperation:s}=await Y(async()=>{const{listAvailableBlocksOperation:i}=await Promise.resolve().then(()=>fe);return{listAvailableBlocksOperation:i}},void 0,import.meta.url);return await s.execute({type:"all"},{documentId:"static",executor:null})}return await r.listAvailableBlocks()},reset:()=>t({lexicals:new Map,pluginTools:new Map})}));function he(t){return I(g,t)}const D=m({afterId:u().describe("Position to insert block: 'TOP' for beginning, 'BOTTOM' for end, or a specific block ID"),type:u().min(1).describe("Block type (e.g., 'paragraph', 'heading', 'code', 'jupyter-cell', 'table', 'collapsible', 'list-item')"),source:u().describe("Block source content"),metadata:B(t=>{if(!(t===""||t===null)){if(typeof t=="string")try{const o=JSON.parse(t);return typeof o=="object"&&!Array.isArray(o)?o:void 0}catch{return}if(!(typeof t!="object"||Array.isArray(t)))return t}},A(u(),v()).optional().describe('Optional block metadata (aligned with Jupyter format). CRITICAL: To insert blocks INSIDE a collapsible, set metadata.collapsible to the RETURNED BLOCK ID from inserting the collapsible container (a specific ID like "6", NOT position markers like "TOP" or "BOTTOM"). Example: {collapsible: "6"} inserts block inside collapsible with ID "6". Position markers (TOP/BOTTOM) are ONLY for the afterId parameter, never for metadata.collapsible.'))}),G={name:"datalayer_insertBlock",displayName:"Insert Lexical Block",toolReferenceName:"insertBlock",description:"Insert blocks into Lexical documents (.dlex files). IMPORTANT: Lexical documents support EXECUTABLE JUPYTER CELLS - use type='jupyter-cell' to insert Python/R/Julia code cells that can be executed via kernel (just like .ipynb notebooks). Other block types: paragraph, heading, code (non-executable syntax highlighting), quote, list, table, collapsible, equation, image, youtube, horizontalrule. CRITICAL: DO NOT use markdown syntax in source field. Heading blocks use PLAIN TEXT (no # symbols) - specify tag metadata (h1-h6) instead. Inline formatting like **bold** or *italic* is automatically converted. ALWAYS call listAvailableBlocks FIRST to see block types and required metadata format. When inserting MULTIPLE blocks sequentially (e.g., creating a document outline with heading + paragraph + code), ALWAYS use afterId: 'BOTTOM' for each insertion to append blocks in order. For single insertions, call readAllBlocks first to see document structure. Position blocks using afterId: 'TOP' (beginning), 'BOTTOM' (end - REQUIRED for sequential inserts), or a specific block_id value from readAllBlocks. To insert blocks INSIDE a collapsible: 1) First insert collapsible (type='collapsible'), which returns a blockId, 2) Then insert nested blocks with metadata.collapsible set to that RETURNED BLOCK ID (NOT 'TOP' or 'BOTTOM'). Example: result = insertBlock({type: 'collapsible', source: 'Section', afterId: 'BOTTOM'}); insertBlock({type: 'paragraph', source: 'text', metadata: {collapsible: result.blockId}, afterId: 'BOTTOM'}). DO NOT use position markers (TOP/BOTTOM) as collapsible IDs - they are only for afterId positioning. Works on active .lexical/.dlex file.",parameters:f(D),operation:"insertBlock",config:{confirmationMessage:t=>`Insert ${t.type} block ${t.afterId==="TOP"?"at beginning":t.afterId==="BOTTOM"?"at end":`after block ${t.afterId}`}?
2
2
 
3
- ${t.source}`,invocationMessage:t=>`Inserting ${t.type} block into lexical document`,requiresConfirmation:!0,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","insert","block","edit"]},O=m({id:u().min(1).describe("Block ID to update"),type:u().min(1).optional().describe("New block type (e.g., 'paragraph', 'heading', 'code', 'list-item')"),source:u().optional().describe("New block source content"),metadata:B(t=>{if(!(t===""||t===null)){if(typeof t=="string")try{const o=JSON.parse(t);return typeof o=="object"&&!Array.isArray(o)?o:void 0}catch{return}if(!(typeof t!="object"||Array.isArray(t)))return t}},A(u(),v()).optional().describe("New block metadata (aligned with Jupyter format)"))}),Z={name:"datalayer_updateBlock",displayName:"Update Lexical Block",toolReferenceName:"updateBlock",description:"Update an existing block in the currently open Lexical document. CRITICAL: DO NOT use markdown syntax (like # for headings) in source field - use plain text and specify block type/metadata instead. Inline formatting like **bold** or *italic* is automatically converted. Use listAvailableBlocks to get available block types. Can modify block type, source content, and/or metadata. Requires id from readAllBlocks. At least one of type, source, or metadata must be provided. Metadata is merged with existing metadata. Works on active .lexical file.",parameters:f(O),operation:"updateBlock",config:{confirmationMessage:t=>{const o=[];return t.type&&o.push(`type to ${t.type}`),t.source&&o.push("source"),t.metadata&&o.push("metadata"),`Update block ${t.id} (${o.join(", ")})?`},invocationMessage:t=>`Updating block ${t.id}`,requiresConfirmation:!0,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","update","edit","block","modify"]},P=m({ids:z(u().min(1)).min(1).describe("Array of block IDs to delete")}),ee={name:"datalayer_deleteBlocks",displayName:"Delete Lexical Block(s)",toolReferenceName:"deleteBlocks",description:"Delete one or more blocks from the currently open Lexical document by block_id. Pass array of block IDs to delete. WORKFLOW: 1) Call readAllBlocks to get block_id values, 2) Pass block_id array to delete. Validates all IDs exist before deletion. This permanently removes blocks and changes appear immediately. Works on active .lexical file.",parameters:f(P),operation:"deleteBlocks",config:{confirmationMessage:t=>{const o=t.ids.length;return o===1?`Delete block ${t.ids[0]}? This action cannot be undone.`:`Delete ${o} blocks (${t.ids.join(", ")})? This action cannot be undone.`},invocationMessage:t=>{const o=t.ids.length;return o===1?`Deleting block ${t.ids[0]} from lexical document`:`Deleting ${o} blocks from lexical document`},requiresConfirmation:!0,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","delete","block","edit"]},C=m({id:u().min(1).describe("Block ID to read")}),te={name:"datalayer_readBlock",displayName:"Read Lexical Block",toolReferenceName:"readBlock",description:"Read a single block from the currently open Lexical document by its block_id. Use listAvailableBlocks to get available block types. Returns the block with: block_id, block_type (e.g. 'heading', 'paragraph', 'jupyter-cell'), source (content as string), metadata (properties like level, language). Use block_id values from readAllBlocks. Works on active .lexical file.",parameters:f(C),operation:"readBlock",config:{confirmationMessage:t=>`Read block ${t.id} from the lexical document?`,invocationMessage:t=>`Reading block ${t.id} from lexical document`,requiresConfirmation:!1,canBeReferencedInPrompt:!0,priority:"medium"},tags:["lexical","read","block","single"]},R=m({format:X(["brief","detailed"]).default("brief").optional()}),oe={name:"datalayer_readAllBlocks",displayName:"Read All Lexical Blocks",toolReferenceName:"readAllBlocks",description:"Read all blocks from the currently open Lexical document. Use listAvailableBlocks to get available block types. Supports two response formats: 'brief' (default, ~1,100 tokens) returns block_id, block_type, and 40-char content preview for structure queries; 'detailed' (~20,000 tokens) returns full content with source, metadata, and properties. Use brief when you need to see document structure, count blocks, or quickly scan content. Use detailed when you need to read full content. Brief format preview shows: lists as comma-separated items, code/jupyter-cell as first line, horizontalrule as empty string. Returns array of blocks with: block_id (stable identifier for insertion), block_type (e.g. 'heading', 'paragraph', 'jupyter-cell'), preview (brief only), and optionally source/metadata (detailed only). CRITICAL: Use the block_id values from this result for insertBlock's afterId parameter. Works on active .lexical file.",parameters:f(R),operation:"readAllBlocks",config:{confirmationMessage:()=>"Read all blocks from the lexical document?",invocationMessage:()=>"Reading all blocks from lexical document",requiresConfirmation:!1,canBeReferencedInPrompt:!0,priority:"medium"},tags:["lexical","read","blocks","all"]},L=m({id:u().min(1).describe("Executable block ID to run"),timeoutSeconds:E().positive().optional().describe("Execution timeout in seconds. If omitted, no timeout is enforced (normal Jupyter behavior)."),stream:y().optional().describe("Enable streaming progress updates (default: false)"),progressInterval:E().positive().optional().describe("Progress update interval in seconds when stream=true (default: 5)")}),ae={name:"datalayer_runBlock",displayName:"Run Lexical Block",toolReferenceName:"runBlock",description:"Execute a single block in the currently open Lexical document by block_id. WORKFLOW: 1) Call readAllBlocks to get block_id values, 2) Pass block_id to execute. Validates block exists before execution. Only works on executable blocks (jupyter-cell or code blocks with executable: true). Optional timeout (timeoutSeconds) and streaming (stream, progressInterval) parameters available. Triggers execution and returns immediately. Use readBlock after execution to check results. Works on active .lexical file.",parameters:f(L),operation:"runBlock",config:{confirmationMessage:t=>`Run block ${t.id}?`,invocationMessage:t=>`Running block ${t.id}`,requiresConfirmation:!0,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","run","execute","block","jupyter"]},M=m({}),re={name:"datalayer_runAllBlocks",displayName:"Run All Lexical Blocks",toolReferenceName:"runAllBlocks",description:"Execute all executable blocks in the currently open Lexical document in sequence. Only runs executable blocks (jupyter-cell or code blocks with executable: true). Non-executable blocks are skipped. Triggers execution and returns immediately with count of blocks executed. Use readAllBlocks after execution to check results. Works on active .lexical file.",parameters:f(M),operation:"runAllBlocks",config:{confirmationMessage:()=>"Run all executable blocks in the lexical document?",invocationMessage:()=>"Running all executable blocks in lexical document",requiresConfirmation:!0,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","run","execute","blocks","all","jupyter"]},N=m({type:B(t=>t==null||t===""?"all":t,u().default("all").describe('Block type to filter (e.g., "youtube", "table", "paragraph") or "all" to return all available blocks. Default: "all".'))}),le={name:"datalayer_listAvailableBlocks",displayName:"List Available Lexical Blocks",toolReferenceName:"listAvailableBlocks",description:"Discover available block types for the currently open Lexical document. Available blocks: paragraph, heading, quote, code, list, horizontalrule, jupyter-cell (executable), equation, image, youtube (video embed), table (data table), collapsible (expandable section). Returns detailed schema including required/optional metadata for each block type. Set type parameter to specific block type (e.g., 'youtube', 'table') or 'all' (default) for all blocks. Use this BEFORE calling insertBlock to see exact type names and required metadata format.",parameters:f(N),operation:"listAvailableBlocks",config:{confirmationMessage:t=>t.type&&t.type!=="all"?`List details for '${t.type}' block type?`:"List all available block types?",invocationMessage:t=>t.type&&t.type!=="all"?`Listing '${t.type}' block type details`:"Listing all available block types",requiresConfirmation:!1,canBeReferencedInPrompt:!0,priority:"low"},tags:["lexical","schema","discovery","blocks"]},q=m({code:u().min(1).describe("Code to execute in the kernel"),storeHistory:y().optional().default(!1).describe("Whether to store execution in kernel history"),silent:y().optional().default(!0).describe("Whether to suppress output"),stopOnError:y().optional().default(!0).describe("Whether to stop execution on error")}),se={name:"datalayer_executeCodeInDocument",displayName:"Execute Code in Document Kernel",toolReferenceName:"executeCodeInDocument",description:"Execute code directly in the document kernel without creating blocks. Runs code and returns execution results immediately. Useful for quick computations, variable inspection, or running commands that should not appear in the document. Works on the active kernel for the currently open .lexical file.",parameters:f(q),operation:"executeCodeInDocument",config:{confirmationMessage:t=>`Execute code: ${t.code.substring(0,50)}${t.code.length>50?"...":""}?`,invocationMessage:()=>"Executing code in kernel",requiresConfirmation:!1,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","kernel","execute","code","inspection"]},ne={name:"insertBlock",async execute(t,o){const e=b(D,t,"insertBlock"),{afterId:a,type:r,source:l,metadata:s}=e,{documentId:n}=o;if(!n)throw new Error("Document ID is required for insertBlock operation. Ensure the tool execution context includes a valid documentId.");const i=r==="jupyter-cell"&&(!s||Object.keys(s).length===0)?{language:"python"}:s;if(!o.executor)throw new Error("Executor is required for insertBlock operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{const c=await o.executor.execute(this.name,{type:r,source:l,metadata:i,afterId:a}),d=a==="TOP"?`Block of type '${r}' inserted at the beginning of the document`:a==="BOTTOM"?`Block of type '${r}' inserted at the end of the document`:`Block of type '${r}' inserted after block '${a}'`;return{success:!0,blockId:c?.blockId,message:d}}catch(c){const d=c instanceof Error?c.message:String(c);throw new Error(`Failed to insert block: ${d}`,{cause:c})}}},ie={name:"updateBlock",async execute(t,o){const e=b(O,t,"updateBlock"),{id:a,type:r,source:l,metadata:s}=e,{documentId:n}=o;if(r===void 0&&l===void 0&&s===void 0)throw new Error("At least one of type, source, or metadata must be provided for updateBlock operation.");if(!n)throw new Error("Document ID is required for updateBlock operation. Ensure the tool execution context includes a valid documentId.");if(!o.executor)throw new Error("Executor is required for updateBlock operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{await o.executor.execute(this.name,{blockId:a,type:r,source:l,metadata:s});const i=[r!==void 0&&"type",l!==void 0&&"source",s!==void 0&&"metadata"].filter(Boolean).join(", "),c=`Block '${a}' updated successfully (${i})`;return{success:!0,id:a,message:c}}catch(i){const c=i instanceof Error?i.message:String(i);throw new Error(`Failed to update block: ${c}`,{cause:i})}}},ce={name:"deleteBlocks",async execute(t,o){const e=b(P,t,"deleteBlocks"),{ids:a}=e,{documentId:r}=o;if(!r)throw new Error("Document ID is required for deleteBlocks operation. Ensure the tool execution context includes a valid documentId.");if(!o.executor)throw new Error("Executor is required for deleteBlocks operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{const l=await o.executor.execute("deleteBlocks",{blockIds:a});if(!l||!l.deletedBlocks)throw new Error("Adapter did not return expected result structure");const s=l.deletedBlocks.map(n=>`Deleted block with ID '${n.id}'`).join(`
4
- `);return{success:!0,deletedBlocks:l.deletedBlocks,message:s||`Deleted ${l.deletedBlocks.length} block(s)`}}catch(l){const s=l instanceof Error?l.message:String(l);throw new Error(`Failed to delete block(s): ${s}`,{cause:l})}}},w={name:"readAllBlocks",async execute(t,o){const e=b(R,t||{},"readAllBlocks"),{format:a="brief"}=e,{documentId:r}=o;if(!r)throw new Error("Document ID is required for readAllBlocks operation. Ensure the tool execution context includes a valid documentId.");if(!o.executor)throw new Error("Executor is required for readAllBlocks operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{const l=await o.executor.execute(this.name,{format:a});return{success:!0,blocks:l,blockCount:l.length}}catch(l){const s=l instanceof Error?l.message:String(l);throw new Error(`Failed to read all blocks: ${s}`,{cause:l})}}},de={name:"readBlock",async execute(t,o){const e=b(C,t,"readBlock"),{id:a}=e,{documentId:r}=o;if(!r)throw new Error("Document ID is required for readBlock operation. Ensure the tool execution context includes a valid documentId.");if(!o.executor)throw new Error("Executor is required for readBlock operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{const l=await w.execute({},o);if(!l.success||!l.blocks)throw new Error("Failed to read blocks for bounds validation");const s=l.blocks.length;return l.blocks.some(c=>c.block_id===a)?{success:!0,block:await o.executor.execute(this.name,{blockId:a})}:{success:!1,error:`Block ID '${a}' not found. Document has ${s} block${s!==1?"s":""}.`}}catch(l){const s=l instanceof Error?l.message:String(l);throw new Error(`Failed to read block: ${s}`,{cause:l})}}},ue={name:"runBlock",async execute(t,o){const{id:e,timeoutSeconds:a,stream:r=!1,progressInterval:l=5}=b(L,t,this.name),{documentId:s}=o;if(!s)return{success:!1,error:"Document ID is required for this operation."};if(!o.executor)throw new Error("Executor is required for runBlock operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");const n=Date.now();try{const i=await w.execute({},o);if(!i.success||!i.blocks)throw new Error("Failed to read blocks for bounds validation");if(!i.blocks.some(k=>k.block_id===e)){const k=i.blocks.length;return{success:!1,error:`Block ID '${e}' not found. The document has ${k} block${k!==1?"s":""}.`}}let d;if(a!==void 0){const k=new Promise((be,J)=>{setTimeout(()=>{J(new Error(`TIMEOUT_ERROR: Block execution exceeded ${a} seconds`))},a*1e3)}),H=o.executor.execute(this.name,{blockId:e,timeoutSeconds:a,stream:r,progressInterval:l});d=await Promise.race([H,k])}else d=await o.executor.execute(this.name,{blockId:e,stream:r,progressInterval:l});const h=(Date.now()-n)/1e3,U=d?.execution_count??null,F=d?.outputs??[],W=d?.message||`Block executed in ${h.toFixed(2)}s`;return{success:!0,id:e,execution_count:U,outputs:F,elapsed_time:h,message:W}}catch(i){const c=(Date.now()-n)/1e3,d=i instanceof Error?i.message:String(i);if(d.includes("TIMEOUT_ERROR"))return{success:!1,timeout:!0,id:e,elapsed_time:c,error:`Execution timed out after ${a} seconds`};throw new Error(`Failed to run block: ${d}`,{cause:i})}}},pe={name:"runAllBlocks",async execute(t,o){b(M,t||{},"runAllBlocks");const{documentId:e}=o;if(!e)throw new Error("Document ID is required for runAllBlocks operation. Ensure the tool execution context includes a valid documentId.");if(!o.executor)throw new Error("Executor is required for runAllBlocks operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{return{success:!0,executedCount:await o.executor.execute(this.name,{})}}catch(a){const r=a instanceof Error?a.message:String(a);throw new Error(`Failed to run all blocks: ${r}`,{cause:a})}}},me=[{type:"paragraph",displayName:"Paragraph",description:"A regular paragraph block for text content. Use plain text in source field - do NOT include markdown syntax.",canContainChildren:!0,example:{type:"paragraph",source:"This is a regular paragraph with text."}},{type:"heading",displayName:"Heading",description:"A semantic HTML heading block (NOT markdown). Use plain text in source field - do NOT include markdown syntax like # or ##. Specify heading level (h1-h6) via the tag property.",requiredProperties:["tag"],optionalProperties:{tag:{type:"string",description:"Heading level: h1 (largest) to h6 (smallest). Use h1 for main titles, h2 for sections, h3 for subsections.",enum:["h1","h2","h3","h4","h5","h6"],default:"h2"}},canContainChildren:!0,example:{type:"heading",source:"Introduction",metadata:{tag:"h1"}}},{type:"quote",displayName:"Blockquote",description:"A blockquote for highlighting quoted text",canContainChildren:!0,example:{type:"quote",source:"To be or not to be, that is the question."}},{type:"list",displayName:"List",description:"A list container supporting bullet or numbered items. Provide items as newline-separated text in the source field - each line becomes a separate list item automatically.",optionalProperties:{listType:{type:"string",description:"Type of list: bullet or number",enum:["bullet","number"],default:"bullet"},start:{type:"number",description:"Starting number for numbered lists",default:1}},canContainChildren:!0,example:{type:"list",source:`Apple
3
+ ${t.source}`,invocationMessage:t=>`Inserting ${t.type} block into lexical document`,requiresConfirmation:!0,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","insert","block","edit"]},O=m({id:u().min(1).describe("Block ID to update"),type:u().min(1).optional().describe("New block type (e.g., 'paragraph', 'heading', 'code', 'list-item')"),source:u().optional().describe("New block source content"),metadata:B(t=>{if(!(t===""||t===null)){if(typeof t=="string")try{const o=JSON.parse(t);return typeof o=="object"&&!Array.isArray(o)?o:void 0}catch{return}if(!(typeof t!="object"||Array.isArray(t)))return t}},A(u(),v()).optional().describe("New block metadata (aligned with Jupyter format)"))}),Z={name:"datalayer_updateBlock",displayName:"Update Lexical Block",toolReferenceName:"updateBlock",description:"Update an existing block in the currently open Lexical document. CRITICAL: DO NOT use markdown syntax (like # for headings) in source field - use plain text and specify block type/metadata instead. Inline formatting like **bold** or *italic* is automatically converted. Use listAvailableBlocks to get available block types. Can modify block type, source content, and/or metadata. Requires id from readAllBlocks. At least one of type, source, or metadata must be provided. Metadata is merged with existing metadata. Works on active .lexical file.",parameters:f(O),operation:"updateBlock",config:{confirmationMessage:t=>{const o=[];return t.type&&o.push(`type to ${t.type}`),t.source&&o.push("source"),t.metadata&&o.push("metadata"),`Update block ${t.id} (${o.join(", ")})?`},invocationMessage:t=>`Updating block ${t.id}`,requiresConfirmation:!0,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","update","edit","block","modify"]},P=m({ids:z(u().min(1)).min(1).describe("Array of block IDs to delete")}),ee={name:"datalayer_deleteBlocks",displayName:"Delete Lexical Block(s)",toolReferenceName:"deleteBlocks",description:"Delete one or more blocks from the currently open Lexical document by block_id. Pass array of block IDs to delete. WORKFLOW: 1) Call readAllBlocks to get block_id values, 2) Pass block_id array to delete. Validates all IDs exist before deletion. This permanently removes blocks and changes appear immediately. Works on active .lexical file.",parameters:f(P),operation:"deleteBlocks",config:{confirmationMessage:t=>{const o=t.ids.length;return o===1?`Delete block ${t.ids[0]}? This action cannot be undone.`:`Delete ${o} blocks (${t.ids.join(", ")})? This action cannot be undone.`},invocationMessage:t=>{const o=t.ids.length;return o===1?`Deleting block ${t.ids[0]} from lexical document`:`Deleting ${o} blocks from lexical document`},requiresConfirmation:!0,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","delete","block","edit"]},C=m({id:u().min(1).describe("Block ID to read")}),te={name:"datalayer_readBlock",displayName:"Read Lexical Block",toolReferenceName:"readBlock",description:"Read a single block from the currently open Lexical document by its block_id. Use listAvailableBlocks to get available block types. Returns the block with: block_id, block_type (e.g. 'heading', 'paragraph', 'jupyter-cell'), source (content as string), metadata (properties like level, language). Use block_id values from readAllBlocks. Works on active .lexical file.",parameters:f(C),operation:"readBlock",config:{confirmationMessage:t=>`Read block ${t.id} from the lexical document?`,invocationMessage:t=>`Reading block ${t.id} from lexical document`,requiresConfirmation:!1,canBeReferencedInPrompt:!0,priority:"medium"},tags:["lexical","read","block","single"]},L=m({format:X(["brief","detailed"]).default("brief").optional()}),oe={name:"datalayer_readAllBlocks",displayName:"Read All Lexical Blocks",toolReferenceName:"readAllBlocks",description:"Read all blocks from the currently open Lexical document. Use listAvailableBlocks to get available block types. Supports two response formats: 'brief' (default, ~1,100 tokens) returns block_id, block_type, and 40-char content preview for structure queries; 'detailed' (~20,000 tokens) returns full content with source, metadata, and properties. Use brief when you need to see document structure, count blocks, or quickly scan content. Use detailed when you need to read full content. Brief format preview shows: lists as comma-separated items, code/jupyter-cell as first line, horizontalrule as empty string. Returns array of blocks with: block_id (stable identifier for insertion), block_type (e.g. 'heading', 'paragraph', 'jupyter-cell'), preview (brief only), and optionally source/metadata (detailed only). CRITICAL: Use the block_id values from this result for insertBlock's afterId parameter. Works on active .lexical file.",parameters:f(L),operation:"readAllBlocks",config:{confirmationMessage:()=>"Read all blocks from the lexical document?",invocationMessage:()=>"Reading all blocks from lexical document",requiresConfirmation:!1,canBeReferencedInPrompt:!0,priority:"medium"},tags:["lexical","read","blocks","all"]},R=m({id:u().min(1).describe("Executable block ID to run"),timeoutSeconds:E().positive().optional().describe("Execution timeout in seconds. If omitted, no timeout is enforced (normal Jupyter behavior)."),stream:y().optional().describe("Enable streaming progress updates (default: false)"),progressInterval:E().positive().optional().describe("Progress update interval in seconds when stream=true (default: 5)")}),ae={name:"datalayer_runBlock",displayName:"Run Lexical Block",toolReferenceName:"runBlock",description:"Execute a single block in the currently open Lexical document by block_id. WORKFLOW: 1) Call readAllBlocks to get block_id values, 2) Pass block_id to execute. Validates block exists before execution. Only works on executable blocks (jupyter-cell or code blocks with executable: true). Optional timeout (timeoutSeconds) and streaming (stream, progressInterval) parameters available. Triggers execution and returns immediately. Use readBlock after execution to check results. Works on active .lexical file.",parameters:f(R),operation:"runBlock",config:{confirmationMessage:t=>`Run block ${t.id}?`,invocationMessage:t=>`Running block ${t.id}`,requiresConfirmation:!0,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","run","execute","block","jupyter"]},M=m({}),re={name:"datalayer_runAllBlocks",displayName:"Run All Lexical Blocks",toolReferenceName:"runAllBlocks",description:"Execute all executable blocks in the currently open Lexical document in sequence. Only runs executable blocks (jupyter-cell or code blocks with executable: true). Non-executable blocks are skipped. Triggers execution and returns immediately with count of blocks executed. Use readAllBlocks after execution to check results. Works on active .lexical file.",parameters:f(M),operation:"runAllBlocks",config:{confirmationMessage:()=>"Run all executable blocks in the lexical document?",invocationMessage:()=>"Running all executable blocks in lexical document",requiresConfirmation:!0,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","run","execute","blocks","all","jupyter"]},N=m({type:B(t=>t==null||t===""?"all":t,u().default("all").describe('Block type to filter (e.g., "youtube", "table", "paragraph") or "all" to return all available blocks. Default: "all".'))}),le={name:"datalayer_listAvailableBlocks",displayName:"List Available Lexical Blocks",toolReferenceName:"listAvailableBlocks",description:"Discover available block types for the currently open Lexical document. Available blocks: paragraph, heading, quote, code, list, horizontalrule, jupyter-cell (executable), equation, image, youtube (video embed), table (data table), collapsible (expandable section). Returns detailed schema including required/optional metadata for each block type. Set type parameter to specific block type (e.g., 'youtube', 'table') or 'all' (default) for all blocks. Use this BEFORE calling insertBlock to see exact type names and required metadata format.",parameters:f(N),operation:"listAvailableBlocks",config:{confirmationMessage:t=>t.type&&t.type!=="all"?`List details for '${t.type}' block type?`:"List all available block types?",invocationMessage:t=>t.type&&t.type!=="all"?`Listing '${t.type}' block type details`:"Listing all available block types",requiresConfirmation:!1,canBeReferencedInPrompt:!0,priority:"low"},tags:["lexical","schema","discovery","blocks"]},q=m({code:u().min(1).describe("Code to execute in the kernel"),storeHistory:y().optional().default(!1).describe("Whether to store execution in kernel history"),silent:y().optional().default(!0).describe("Whether to suppress output"),stopOnError:y().optional().default(!0).describe("Whether to stop execution on error")}),se={name:"datalayer_executeCodeInDocument",displayName:"Execute Code in Document Kernel",toolReferenceName:"executeCodeInDocument",description:"Execute code directly in the document kernel without creating blocks. Runs code and returns execution results immediately. Useful for quick computations, variable inspection, or running commands that should not appear in the document. Works on the active kernel for the currently open .lexical file.",parameters:f(q),operation:"executeCodeInDocument",config:{confirmationMessage:t=>`Execute code: ${t.code.substring(0,50)}${t.code.length>50?"...":""}?`,invocationMessage:()=>"Executing code in kernel",requiresConfirmation:!1,canBeReferencedInPrompt:!0,priority:"high"},tags:["lexical","kernel","execute","code","inspection"]},ne={name:"insertBlock",async execute(t,o){const e=b(D,t,"insertBlock"),{afterId:a,type:r,source:l,metadata:s}=e,{documentId:n}=o;if(!n)throw new Error("Document ID is required for insertBlock operation. Ensure the tool execution context includes a valid documentId.");const i=r==="jupyter-cell"&&(!s||Object.keys(s).length===0)?{language:"python"}:s;if(!o.executor)throw new Error("Executor is required for insertBlock operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{const c=await o.executor.execute(this.name,{type:r,source:l,metadata:i,afterId:a}),d=a==="TOP"?`Block of type '${r}' inserted at the beginning of the document`:a==="BOTTOM"?`Block of type '${r}' inserted at the end of the document`:`Block of type '${r}' inserted after block '${a}'`;return{success:!0,blockId:c?.blockId,message:d}}catch(c){const d=c instanceof Error?c.message:String(c);throw new Error(`Failed to insert block: ${d}`,{cause:c})}}},ie={name:"updateBlock",async execute(t,o){const e=b(O,t,"updateBlock"),{id:a,type:r,source:l,metadata:s}=e,{documentId:n}=o;if(r===void 0&&l===void 0&&s===void 0)throw new Error("At least one of type, source, or metadata must be provided for updateBlock operation.");if(!n)throw new Error("Document ID is required for updateBlock operation. Ensure the tool execution context includes a valid documentId.");if(!o.executor)throw new Error("Executor is required for updateBlock operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{await o.executor.execute(this.name,{blockId:a,type:r,source:l,metadata:s});const i=[r!==void 0&&"type",l!==void 0&&"source",s!==void 0&&"metadata"].filter(Boolean).join(", "),c=`Block '${a}' updated successfully (${i})`;return{success:!0,id:a,message:c}}catch(i){const c=i instanceof Error?i.message:String(i);throw new Error(`Failed to update block: ${c}`,{cause:i})}}},ce={name:"deleteBlocks",async execute(t,o){const e=b(P,t,"deleteBlocks"),{ids:a}=e,{documentId:r}=o;if(!r)throw new Error("Document ID is required for deleteBlocks operation. Ensure the tool execution context includes a valid documentId.");if(!o.executor)throw new Error("Executor is required for deleteBlocks operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{const l=await o.executor.execute("deleteBlocks",{blockIds:a});if(!l||!l.deletedBlocks)throw new Error("Adapter did not return expected result structure");const s=l.deletedBlocks.map(n=>`Deleted block with ID '${n.id}'`).join(`
4
+ `);return{success:!0,deletedBlocks:l.deletedBlocks,message:s||`Deleted ${l.deletedBlocks.length} block(s)`}}catch(l){const s=l instanceof Error?l.message:String(l);throw new Error(`Failed to delete block(s): ${s}`,{cause:l})}}},w={name:"readAllBlocks",async execute(t,o){const e=b(L,t||{},"readAllBlocks"),{format:a="brief"}=e,{documentId:r}=o;if(!r)throw new Error("Document ID is required for readAllBlocks operation. Ensure the tool execution context includes a valid documentId.");if(!o.executor)throw new Error("Executor is required for readAllBlocks operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{const l=await o.executor.execute(this.name,{format:a});return{success:!0,blocks:l,blockCount:l.length}}catch(l){const s=l instanceof Error?l.message:String(l);throw new Error(`Failed to read all blocks: ${s}`,{cause:l})}}},de={name:"readBlock",async execute(t,o){const e=b(C,t,"readBlock"),{id:a}=e,{documentId:r}=o;if(!r)throw new Error("Document ID is required for readBlock operation. Ensure the tool execution context includes a valid documentId.");if(!o.executor)throw new Error("Executor is required for readBlock operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{const l=await w.execute({},o);if(!l.success||!l.blocks)throw new Error("Failed to read blocks for bounds validation");const s=l.blocks.length;return l.blocks.some(c=>c.block_id===a)?{success:!0,block:await o.executor.execute(this.name,{blockId:a})}:{success:!1,error:`Block ID '${a}' not found. Document has ${s} block${s!==1?"s":""}.`}}catch(l){const s=l instanceof Error?l.message:String(l);throw new Error(`Failed to read block: ${s}`,{cause:l})}}},ue={name:"runBlock",async execute(t,o){const{id:e,timeoutSeconds:a,stream:r=!1,progressInterval:l=5}=b(R,t,this.name),{documentId:s}=o;if(!s)return{success:!1,error:"Document ID is required for this operation."};if(!o.executor)throw new Error("Executor is required for runBlock operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");const n=Date.now();try{const i=await w.execute({},o);if(!i.success||!i.blocks)throw new Error("Failed to read blocks for bounds validation");if(!i.blocks.some(k=>k.block_id===e)){const k=i.blocks.length;return{success:!1,error:`Block ID '${e}' not found. The document has ${k} block${k!==1?"s":""}.`}}let d;if(a!==void 0){const k=new Promise((be,J)=>{setTimeout(()=>{J(new Error(`TIMEOUT_ERROR: Block execution exceeded ${a} seconds`))},a*1e3)}),H=o.executor.execute(this.name,{blockId:e,timeoutSeconds:a,stream:r,progressInterval:l});d=await Promise.race([H,k])}else d=await o.executor.execute(this.name,{blockId:e,stream:r,progressInterval:l});const h=(Date.now()-n)/1e3,U=d?.execution_count??null,F=d?.outputs??[],W=d?.message||`Block executed in ${h.toFixed(2)}s`;return{success:!0,id:e,execution_count:U,outputs:F,elapsed_time:h,message:W}}catch(i){const c=(Date.now()-n)/1e3,d=i instanceof Error?i.message:String(i);if(d.includes("TIMEOUT_ERROR"))return{success:!1,timeout:!0,id:e,elapsed_time:c,error:`Execution timed out after ${a} seconds`};throw new Error(`Failed to run block: ${d}`,{cause:i})}}},pe={name:"runAllBlocks",async execute(t,o){b(M,t||{},"runAllBlocks");const{documentId:e}=o;if(!e)throw new Error("Document ID is required for runAllBlocks operation. Ensure the tool execution context includes a valid documentId.");if(!o.executor)throw new Error("Executor is required for runAllBlocks operation. This should be provided by the platform (DefaultExecutor, BridgeExecutor, etc.)");try{return{success:!0,executedCount:await o.executor.execute(this.name,{})}}catch(a){const r=a instanceof Error?a.message:String(a);throw new Error(`Failed to run all blocks: ${r}`,{cause:a})}}},me=[{type:"paragraph",displayName:"Paragraph",description:"A regular paragraph block for text content. Use plain text in source field - do NOT include markdown syntax.",canContainChildren:!0,example:{type:"paragraph",source:"This is a regular paragraph with text."}},{type:"heading",displayName:"Heading",description:"A semantic HTML heading block (NOT markdown). Use plain text in source field - do NOT include markdown syntax like # or ##. Specify heading level (h1-h6) via the tag property.",requiredProperties:["tag"],optionalProperties:{tag:{type:"string",description:"Heading level: h1 (largest) to h6 (smallest). Use h1 for main titles, h2 for sections, h3 for subsections.",enum:["h1","h2","h3","h4","h5","h6"],default:"h2"}},canContainChildren:!0,example:{type:"heading",source:"Introduction",metadata:{tag:"h1"}}},{type:"quote",displayName:"Blockquote",description:"A blockquote for highlighting quoted text",canContainChildren:!0,example:{type:"quote",source:"To be or not to be, that is the question."}},{type:"list",displayName:"List",description:"A list container supporting bullet or numbered items. Provide items as newline-separated text in the source field - each line becomes a separate list item automatically.",optionalProperties:{listType:{type:"string",description:"Type of list: bullet or number",enum:["bullet","number"],default:"bullet"},start:{type:"number",description:"Starting number for numbered lists",default:1}},canContainChildren:!0,example:{type:"list",source:`Apple
5
5
  Banana
6
6
  Tangerine`,metadata:{listType:"number",start:1}}},{type:"horizontalrule",displayName:"Horizontal Rule",description:"A horizontal divider line for visually separating sections of content. Source field should be empty or omitted.",canContainChildren:!1,example:{type:"horizontalrule",source:""}},{type:"jupyter-cell",displayName:"Jupyter Code Cell",description:"An executable Jupyter code cell integrated into the document. RECOMMENDED: Use this for executable code (Python, JavaScript, etc.) instead of static code blocks, as it allows users to run code and see outputs directly in the document.",optionalProperties:{language:{type:"string",description:"Programming language for the cell",enum:["python","javascript"],default:"python"},kernelName:{type:"string",description:"Name of the Jupyter kernel to use"}},canContainChildren:!1,isExecutable:!0,example:{type:"jupyter-cell",source:`import pandas as pd
7
7
  df = pd.DataFrame({'A': [1, 2, 3]})
@@ -1 +1 @@
1
- import{b6 as E,ck as z,cl as $,b9 as R,j as a,d0 as m,ar as T,as as O,r as B,d1 as I,B as r,d2 as M,d3 as y}from"../datalayer-app-main.js";import{D as W}from"./Avatar-DbU3YP4x.js";var _={SkeletonAvatar:"prc-SkeletonAvatar-SkeletonAvatar-inefu"};function C(t){const e=E.c(31);let s,l,o,n,g;e[0]!==t?({size:g,square:o,className:s,style:n,...l}=t,e[0]=t,e[1]=s,e[2]=l,e[3]=o,e[4]=n,e[5]=g):(s=e[1],l=e[2],o=e[3],n=e[4],g=e[5]);const x=g===void 0?W:g;let j;e[6]!==x?(j=z(x),e[6]=x,e[7]=j):j=e[7];const S=j;let d,i,u,c,h,p,f;if(e[8]!==s||e[9]!==S||e[10]!==l||e[11]!==x||e[12]!==o||e[13]!==n){const k={};if(S)for(const[L,w]of Object.entries(x))k[`--avatarSize-${L}`]=`${w}px`;else k["--avatarSize-regular"]=`${x}px`;d=m,e[21]!==s?(i=$(s,_.SkeletonAvatar),e[21]=s,e[22]=i):i=e[22],u=l,c="SkeletonAvatar",h=S?"":void 0,p=o?"":void 0,f=R(n,k),e[8]=s,e[9]=S,e[10]=l,e[11]=x,e[12]=o,e[13]=n,e[14]=d,e[15]=i,e[16]=u,e[17]=c,e[18]=h,e[19]=p,e[20]=f}else d=e[14],i=e[15],u=e[16],c=e[17],h=e[18],p=e[19],f=e[20];let b;return e[23]!==d||e[24]!==i||e[25]!==u||e[26]!==c||e[27]!==h||e[28]!==p||e[29]!==f?(b=a.jsx(d,{className:i,...u,"data-component":c,"data-responsive":h,"data-square":p,style:f}),e[23]=d,e[24]=i,e[25]=u,e[26]=c,e[27]=h,e[28]=p,e[29]=f,e[30]=b):b=e[30],b}const N=["glow","blaze","surge","gold","pop","flame","spark"];function A(t="datalayer",e="dark"){const s=I(t,e);return N.map(l=>s[l])}function v(t){let e=5381;for(let s=0;s<t.length;s+=1)e=(e<<5)+e+t.charCodeAt(s)|0;return Math.abs(e)}function J(t,e="datalayer",s="dark"){const l=A(e,s);return l[v(t)%l.length]}function V(){const{theme:t,colorMode:e}=T(),s=O(),l=e==="auto"?s:e;return B.useMemo(()=>A(t,l),[t,l])}function Q(t){const e=V();return e[v(t)%e.length]}function D(t,e){const s=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t.trim());if(!s)return t;const l=s[1].length===3?s[1].split("").map(n=>n+n).join(""):s[1],o=parseInt(l,16);return`rgba(${o>>16&255}, ${o>>8&255}, ${o&255}, ${e})`}const H="--skeletonLoader-bgColor";function q(t){return D(t.textLight,t.isLight?.1:.18)}function F({label:t,children:e,sx:s}){const l=M(),o={[H]:q(l)};return a.jsx(r,{role:"status","aria-label":t,"aria-busy":"true",sx:s,style:o,children:a.jsx(r,{"aria-hidden":"true",sx:{display:"grid",gap:3},children:e})})}function P(){return a.jsxs(r,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:3,p:3,borderBottom:"1px solid",borderColor:"border.muted"},children:[a.jsxs(r,{sx:{flex:1,minWidth:0,maxWidth:520,display:"grid",gap:2},children:[a.jsx(y,{size:"titleMedium",lines:1,maxWidth:"18rem"}),a.jsx(y,{size:"bodySmall",lines:1,maxWidth:"11rem"})]}),a.jsxs(r,{sx:{display:"flex",alignItems:"center",gap:2,flexShrink:0},children:[a.jsx(C,{size:24}),a.jsx(C,{size:24}),a.jsx(m,{width:"72px",height:"28px"})]})]})}function U({lines:t=3,output:e}){return a.jsxs(r,{sx:{display:"grid",gap:2},children:[a.jsxs(r,{sx:{display:"flex",gap:3,alignItems:"flex-start"},children:[a.jsx(m,{width:"44px",height:"20px"}),a.jsx(r,{sx:{flex:1,minWidth:0},children:a.jsx(m,{width:"100%",height:`${t*20+16}px`})})]}),e?a.jsxs(r,{sx:{display:"flex",gap:3,alignItems:"flex-start"},children:[a.jsx(r,{sx:{width:44,flexShrink:0}}),a.jsx(r,{sx:{flex:1,minWidth:0},children:a.jsx(m,{width:"82%",height:"64px"})})]}):null]})}const K=[{lines:2},{lines:4,output:!0},{lines:3},{lines:2,output:!0}];function X({label:t="Loading the notebook",header:e=!1,cells:s=K,maxWidth:l=980}={}){return a.jsxs(F,{label:t,sx:{flex:1,minHeight:0,width:"100%",overflow:"hidden"},children:[e?a.jsx(P,{}):null,a.jsx(r,{sx:{px:4,py:e?0:4,pb:4,display:"grid",gap:4,maxWidth:l,mx:"auto",width:"100%"},children:s.map((o,n)=>a.jsx(U,{lines:o.lines,output:o.output},n))})]})}export{U as C,P as E,X as N,C as S,H as a,F as b,J as c,A as d,V as e,v as f,q as s,Q as u,D as w};
1
+ import{b7 as E,cl as z,cm as $,ba as R,j as a,d1 as m,ar as T,as as O,r as B,d2 as I,B as r,d3 as M,d4 as y}from"../datalayer-app-main.js";import{D as W}from"./Avatar-9MpXENSs.js";var _={SkeletonAvatar:"prc-SkeletonAvatar-SkeletonAvatar-inefu"};function C(t){const e=E.c(31);let s,l,o,n,g;e[0]!==t?({size:g,square:o,className:s,style:n,...l}=t,e[0]=t,e[1]=s,e[2]=l,e[3]=o,e[4]=n,e[5]=g):(s=e[1],l=e[2],o=e[3],n=e[4],g=e[5]);const x=g===void 0?W:g;let j;e[6]!==x?(j=z(x),e[6]=x,e[7]=j):j=e[7];const S=j;let d,i,u,c,h,p,f;if(e[8]!==s||e[9]!==S||e[10]!==l||e[11]!==x||e[12]!==o||e[13]!==n){const k={};if(S)for(const[L,w]of Object.entries(x))k[`--avatarSize-${L}`]=`${w}px`;else k["--avatarSize-regular"]=`${x}px`;d=m,e[21]!==s?(i=$(s,_.SkeletonAvatar),e[21]=s,e[22]=i):i=e[22],u=l,c="SkeletonAvatar",h=S?"":void 0,p=o?"":void 0,f=R(n,k),e[8]=s,e[9]=S,e[10]=l,e[11]=x,e[12]=o,e[13]=n,e[14]=d,e[15]=i,e[16]=u,e[17]=c,e[18]=h,e[19]=p,e[20]=f}else d=e[14],i=e[15],u=e[16],c=e[17],h=e[18],p=e[19],f=e[20];let b;return e[23]!==d||e[24]!==i||e[25]!==u||e[26]!==c||e[27]!==h||e[28]!==p||e[29]!==f?(b=a.jsx(d,{className:i,...u,"data-component":c,"data-responsive":h,"data-square":p,style:f}),e[23]=d,e[24]=i,e[25]=u,e[26]=c,e[27]=h,e[28]=p,e[29]=f,e[30]=b):b=e[30],b}const N=["glow","blaze","surge","gold","pop","flame","spark"];function A(t="datalayer",e="dark"){const s=I(t,e);return N.map(l=>s[l])}function v(t){let e=5381;for(let s=0;s<t.length;s+=1)e=(e<<5)+e+t.charCodeAt(s)|0;return Math.abs(e)}function J(t,e="datalayer",s="dark"){const l=A(e,s);return l[v(t)%l.length]}function V(){const{theme:t,colorMode:e}=T(),s=O(),l=e==="auto"?s:e;return B.useMemo(()=>A(t,l),[t,l])}function Q(t){const e=V();return e[v(t)%e.length]}function D(t,e){const s=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t.trim());if(!s)return t;const l=s[1].length===3?s[1].split("").map(n=>n+n).join(""):s[1],o=parseInt(l,16);return`rgba(${o>>16&255}, ${o>>8&255}, ${o&255}, ${e})`}const H="--skeletonLoader-bgColor";function q(t){return D(t.textLight,t.isLight?.1:.18)}function F({label:t,children:e,sx:s}){const l=M(),o={[H]:q(l)};return a.jsx(r,{role:"status","aria-label":t,"aria-busy":"true",sx:s,style:o,children:a.jsx(r,{"aria-hidden":"true",sx:{display:"grid",gap:3},children:e})})}function P(){return a.jsxs(r,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:3,p:3,borderBottom:"1px solid",borderColor:"border.muted"},children:[a.jsxs(r,{sx:{flex:1,minWidth:0,maxWidth:520,display:"grid",gap:2},children:[a.jsx(y,{size:"titleMedium",lines:1,maxWidth:"18rem"}),a.jsx(y,{size:"bodySmall",lines:1,maxWidth:"11rem"})]}),a.jsxs(r,{sx:{display:"flex",alignItems:"center",gap:2,flexShrink:0},children:[a.jsx(C,{size:24}),a.jsx(C,{size:24}),a.jsx(m,{width:"72px",height:"28px"})]})]})}function U({lines:t=3,output:e}){return a.jsxs(r,{sx:{display:"grid",gap:2},children:[a.jsxs(r,{sx:{display:"flex",gap:3,alignItems:"flex-start"},children:[a.jsx(m,{width:"44px",height:"20px"}),a.jsx(r,{sx:{flex:1,minWidth:0},children:a.jsx(m,{width:"100%",height:`${t*20+16}px`})})]}),e?a.jsxs(r,{sx:{display:"flex",gap:3,alignItems:"flex-start"},children:[a.jsx(r,{sx:{width:44,flexShrink:0}}),a.jsx(r,{sx:{flex:1,minWidth:0},children:a.jsx(m,{width:"82%",height:"64px"})})]}):null]})}const K=[{lines:2},{lines:4,output:!0},{lines:3},{lines:2,output:!0}];function X({label:t="Loading the notebook",header:e=!1,cells:s=K,maxWidth:l=980}={}){return a.jsxs(F,{label:t,sx:{flex:1,minHeight:0,width:"100%",overflow:"hidden"},children:[e?a.jsx(P,{}):null,a.jsx(r,{sx:{px:4,py:e?0:4,pb:4,display:"grid",gap:4,maxWidth:l,mx:"auto",width:"100%"},children:s.map((o,n)=>a.jsx(U,{lines:o.lines,output:o.output},n))})]})}export{U as C,P as E,X as N,C as S,H as a,F as b,J as c,A as d,V as e,v as f,q as s,Q as u,D as w};
@@ -1 +1 @@
1
- import{r as C,o as h,j as l,B as c,T as j,p as I}from"../datalayer-app-main.js";import{O as v,a as T,C as k}from"./Output-BscOPLqE.js";import"./index-BvvaLLhn.js";import"./hoverbox-CStlKQWE.js";import"./index-BYQwy0Zx.js";import"./index-BJ7Yskx5.js";import"./color-CG7_7V2-.js";import"./isEqual-BybBNsZK.js";import"./defaultLocale-5voVPcsN.js";import"./index-DbMBnR4l.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./PaintbrushIcon-CLU8RilX.js";import"./index-B3WvcNQa.js";import"./RestartIcon-Ca6_HoK0.js";const R=new Set(["insertCell","updateCell","runCell","datalayer_insertCell","datalayer_updateCell","datalayer_runCell"]),w=new Set(["executeCodeInNotebook","datalayer_executeCodeInNotebook","executeCodeInDocument","datalayer_executeCodeInDocument"]);function O(r){const e=r.result;if(e&&typeof e=="object")return e;if(typeof e=="string")try{const t=I(e);if(t&&typeof t=="object")return t}catch{}}function S(r){const e=r.args??{};if(typeof e.index=="number")return e.index;const t=O(r);if(t&&typeof t.index=="number")return t.index}function B(r,e){const t=S(e);return t===void 0?null:h.getState().notebooks.get(r)?.model?.cells?.get(t)??null}function L(r){const e=O(r)??{},t=[];for(const o of e.outputs??[]){const s=o.content;if(s&&typeof s=="object"){const d=s;if("output_type"in d){t.push(d);continue}if("data"in d||"text"in d||"ename"in d){t.push({output_type:o.type??"display_data",...d});continue}}t.push({output_type:"stream",name:"stdout",text:String(s??"")})}return t}const b=new WeakSet,M={insertCell:"inserted",updateCell:"updated",runCell:"ran",executeCodeInNotebook:"executed",executeCodeInDocument:"executed"};function K({documentId:r,context:e}){const{name:t,status:o,defaultUI:s}=e,d=t.replace(/^datalayer_/,""),i=C.useRef({id:null,model:null}),[,_]=C.useState(0);C.useEffect(()=>{if(!w.has(t)||o!=="executing"||i.current.id===e.toolCallId&&i.current.model)return;let u=!1,x;const g=()=>{if(u)return;const y=h.getState().notebooks.get(r)?.adapter?.lastExecuteOutputs??null;if(y&&!b.has(y)){_(E=>E+1);return}x=window.setTimeout(g,250)};return g(),()=>{u=!0,x!==void 0&&window.clearTimeout(x)}},[t,o,e.toolCallId,r]);let a=null,p=null,n=null,f;if(o==="executing"||o==="complete"||o==="error"){if(R.has(t))f=S(e),a=B(r,e);else if(w.has(t)){if(i.current.id!==e.toolCallId){const u=h.getState().notebooks.get(r)?.adapter?.lastExecuteOutputs??null;u&&!b.has(u)&&(i.current={id:e.toolCallId,model:u})}if(n=i.current.id===e.toolCallId?i.current.model:null,n&&o!=="executing"&&b.add(n),!n&&o==="complete"){const u=L(e);p=u.length>0?u:null}}}const m=a?.type==="code"?a.outputs:void 0;return l.jsxs(l.Fragment,{children:[s,n||p?l.jsxs(c,{mt:1,width:"100%",border:"1px solid",borderColor:"border.default",borderRadius:2,overflow:"hidden",bg:"canvas.default",children:[l.jsx(c,{px:2,py:1,bg:"canvas.subtle",borderBottom:"1px solid",borderColor:"border.muted",children:l.jsxs(j,{sx:{fontSize:0,color:"fg.muted"},children:["Output ·"," ",o==="executing"?"executing…":o==="error"?"stopped":"executed"]})}),l.jsx(c,{p:2,children:n?l.jsx(v,{id:`${e.toolCallId}-execute-outputs`,model:n,showControl:!1,showEditor:!1,autoRun:!1}):l.jsx(T,{cell:{cell_type:"code",outputs:p,metadata:{}}})})]}):null,a?l.jsxs(c,{mt:1,width:"100%",border:"1px solid",borderColor:"border.default",borderRadius:2,overflow:"hidden",bg:"canvas.default",children:[l.jsx(c,{px:2,py:1,bg:"canvas.subtle",borderBottom:"1px solid",borderColor:"border.muted",children:l.jsxs(j,{sx:{fontSize:0,color:"fg.muted"},children:[f!==void 0?`Cell ${f}`:"Cell"," · ",M[d]??d]})}),l.jsx(k,{readOnly:!0,type:a.type??"code",source:a.sharedModel.getSource(),outputs:[]}),m&&(o==="executing"||m.length>0)?l.jsx(c,{borderTop:"1px solid",borderColor:"border.muted",p:2,children:l.jsx(v,{id:`${e.toolCallId}-outputs`,model:m,showControl:!1,showEditor:!1,autoRun:!1})}):null]}):null]})}export{R as CELL_TOOLS,w as EXECUTE_TOOLS,K as NotebookToolSurfaces,O as decodedResult,K as default,L as executionOutputs,S as touchedCellIndex,B as touchedCellModel};
1
+ import{r as C,o as h,j as l,B as c,T as j,p as I}from"../datalayer-app-main.js";import{O as v,a as T,C as k}from"./Output-9DKTscSv.js";import"./index-a51XM5L8.js";import"./hoverbox-CStlKQWE.js";import"./index-s3hayhRS.js";import"./index-CpcHHQd7.js";import"./color-CG7_7V2-.js";import"./isEqual-niFNV5MZ.js";import"./defaultLocale-5voVPcsN.js";import"./index-DbMBnR4l.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./PaintbrushIcon-CLU8RilX.js";import"./index-BJhxZF_K.js";import"./RestartIcon-Ca6_HoK0.js";const R=new Set(["insertCell","updateCell","runCell","datalayer_insertCell","datalayer_updateCell","datalayer_runCell"]),w=new Set(["executeCodeInNotebook","datalayer_executeCodeInNotebook","executeCodeInDocument","datalayer_executeCodeInDocument"]);function O(r){const e=r.result;if(e&&typeof e=="object")return e;if(typeof e=="string")try{const t=I(e);if(t&&typeof t=="object")return t}catch{}}function S(r){const e=r.args??{};if(typeof e.index=="number")return e.index;const t=O(r);if(t&&typeof t.index=="number")return t.index}function B(r,e){const t=S(e);return t===void 0?null:h.getState().notebooks.get(r)?.model?.cells?.get(t)??null}function L(r){const e=O(r)??{},t=[];for(const o of e.outputs??[]){const s=o.content;if(s&&typeof s=="object"){const d=s;if("output_type"in d){t.push(d);continue}if("data"in d||"text"in d||"ename"in d){t.push({output_type:o.type??"display_data",...d});continue}}t.push({output_type:"stream",name:"stdout",text:String(s??"")})}return t}const b=new WeakSet,M={insertCell:"inserted",updateCell:"updated",runCell:"ran",executeCodeInNotebook:"executed",executeCodeInDocument:"executed"};function K({documentId:r,context:e}){const{name:t,status:o,defaultUI:s}=e,d=t.replace(/^datalayer_/,""),i=C.useRef({id:null,model:null}),[,_]=C.useState(0);C.useEffect(()=>{if(!w.has(t)||o!=="executing"||i.current.id===e.toolCallId&&i.current.model)return;let u=!1,x;const g=()=>{if(u)return;const y=h.getState().notebooks.get(r)?.adapter?.lastExecuteOutputs??null;if(y&&!b.has(y)){_(E=>E+1);return}x=window.setTimeout(g,250)};return g(),()=>{u=!0,x!==void 0&&window.clearTimeout(x)}},[t,o,e.toolCallId,r]);let a=null,p=null,n=null,f;if(o==="executing"||o==="complete"||o==="error"){if(R.has(t))f=S(e),a=B(r,e);else if(w.has(t)){if(i.current.id!==e.toolCallId){const u=h.getState().notebooks.get(r)?.adapter?.lastExecuteOutputs??null;u&&!b.has(u)&&(i.current={id:e.toolCallId,model:u})}if(n=i.current.id===e.toolCallId?i.current.model:null,n&&o!=="executing"&&b.add(n),!n&&o==="complete"){const u=L(e);p=u.length>0?u:null}}}const m=a?.type==="code"?a.outputs:void 0;return l.jsxs(l.Fragment,{children:[s,n||p?l.jsxs(c,{mt:1,width:"100%",border:"1px solid",borderColor:"border.default",borderRadius:2,overflow:"hidden",bg:"canvas.default",children:[l.jsx(c,{px:2,py:1,bg:"canvas.subtle",borderBottom:"1px solid",borderColor:"border.muted",children:l.jsxs(j,{sx:{fontSize:0,color:"fg.muted"},children:["Output ·"," ",o==="executing"?"executing…":o==="error"?"stopped":"executed"]})}),l.jsx(c,{p:2,children:n?l.jsx(v,{id:`${e.toolCallId}-execute-outputs`,model:n,showControl:!1,showEditor:!1,autoRun:!1}):l.jsx(T,{cell:{cell_type:"code",outputs:p,metadata:{}}})})]}):null,a?l.jsxs(c,{mt:1,width:"100%",border:"1px solid",borderColor:"border.default",borderRadius:2,overflow:"hidden",bg:"canvas.default",children:[l.jsx(c,{px:2,py:1,bg:"canvas.subtle",borderBottom:"1px solid",borderColor:"border.muted",children:l.jsxs(j,{sx:{fontSize:0,color:"fg.muted"},children:[f!==void 0?`Cell ${f}`:"Cell"," · ",M[d]??d]})}),l.jsx(k,{readOnly:!0,type:a.type??"code",source:a.sharedModel.getSource(),outputs:[]}),m&&(o==="executing"||m.length>0)?l.jsx(c,{borderTop:"1px solid",borderColor:"border.muted",p:2,children:l.jsx(v,{id:`${e.toolCallId}-outputs`,model:m,showControl:!1,showEditor:!1,autoRun:!1})}):null]}):null]})}export{R as CELL_TOOLS,w as EXECUTE_TOOLS,K as NotebookToolSurfaces,O as decodedResult,K as default,L as executionOutputs,S as touchedCellIndex,B as touchedCellModel};
@@ -1 +1 @@
1
- import{r as c,j as k,u as y,P as m,i as I,k as T,m as v,n as u}from"../datalayer-app-main.js";import{R as C,I as w,M as d}from"./RepoPushIcon-Cm8g9NuL.js";import{T as S}from"./Toolbar-6Hdi_m3T.js";const n={save:"notebook-save",run:"notebook-run",runAll:"notebook-run-all",interrupt:"notebook-interrupt",delete:"notebook-delete",insert:"notebook-insert",cellType:"notebook-cell-type"},r={save:100,run:200,runAll:210,interrupt:220,delete:300,insert:400,cellType:410};function L(e){const t=y(),[o,l]=c.useState("code"),s=t.selectKernelStatus(e),i=s==="busy",a=s==="idle";return c.useMemo(()=>[{key:n.save,type:"button",order:r.save,group:"file",ariaLabel:"Save notebook",title:"Save notebook (⌘S)",icon:C,onClick:()=>t.save({id:e,date:new Date})},{key:"notebook-divider-file",type:"divider",order:r.save+1},{key:n.run,type:"button",order:r.run,group:"run",ariaLabel:"Run cell",title:"Run cell (⇧↵)",icon:m,disabled:!a,onClick:()=>t.run(e)},{key:n.runAll,type:"button",order:r.runAll,group:"run",ariaLabel:"Run all cells",title:"Run all cells",icon:w,disabled:!a,onClick:()=>t.runAll(e)},{key:n.interrupt,type:"button",order:r.interrupt,group:"run",ariaLabel:"Interrupt kernel",title:"Interrupt kernel (⌘I)",icon:I,disabled:!i,onClick:()=>t.interrupt(e)},{key:"notebook-divider-run",type:"divider",order:r.interrupt+1},{key:n.delete,type:"button",order:r.delete,group:"cell",ariaLabel:"Delete cell",title:"Delete cell",icon:T,onClick:()=>t.delete(e)},{key:n.insert,type:"button",order:r.insert,group:"cell",ariaLabel:`Insert ${o} cell below`,title:`Insert ${o} cell below`,icon:v,onClick:()=>t.insertBelow(e,o)},{key:n.cellType,type:"dropdown",order:r.cellType,group:"cell",ariaLabel:"Cell type to insert",title:"Cell type to insert",icon:o==="code"?u:d,label:o==="code"?"Code":"Markdown",minWidth:76,options:[{key:"code",label:"Code",icon:u,isActive:o==="code",onClick:()=>l("code")},{key:"markdown",label:"Markdown",icon:d,isActive:o==="markdown",onClick:()=>l("markdown")}]}],[o,i,a,e,t])}const f=e=>{const{notebookId:t,extraItems:o,hiddenItems:l,ariaLabel:s="Notebook toolbar"}=e,i=L(t),a=c.useMemo(()=>{if(!l?.length)return i;const p=new Set(l);return i.filter(b=>!p.has(b.key))},[i,l]);return k.jsx(S,{items:a,extraItems:o,ariaLabel:s})};export{r as N,f as a,n as b,L as u};
1
+ import{r as c,j as k,u as y,P as m,i as I,k as T,m as v,n as u}from"../datalayer-app-main.js";import{R as C,I as w,M as d}from"./RepoPushIcon-Cm8g9NuL.js";import{T as S}from"./Toolbar-CGQDY041.js";const n={save:"notebook-save",run:"notebook-run",runAll:"notebook-run-all",interrupt:"notebook-interrupt",delete:"notebook-delete",insert:"notebook-insert",cellType:"notebook-cell-type"},r={save:100,run:200,runAll:210,interrupt:220,delete:300,insert:400,cellType:410};function L(e){const t=y(),[o,l]=c.useState("code"),s=t.selectKernelStatus(e),i=s==="busy",a=s==="idle";return c.useMemo(()=>[{key:n.save,type:"button",order:r.save,group:"file",ariaLabel:"Save notebook",title:"Save notebook (⌘S)",icon:C,onClick:()=>t.save({id:e,date:new Date})},{key:"notebook-divider-file",type:"divider",order:r.save+1},{key:n.run,type:"button",order:r.run,group:"run",ariaLabel:"Run cell",title:"Run cell (⇧↵)",icon:m,disabled:!a,onClick:()=>t.run(e)},{key:n.runAll,type:"button",order:r.runAll,group:"run",ariaLabel:"Run all cells",title:"Run all cells",icon:w,disabled:!a,onClick:()=>t.runAll(e)},{key:n.interrupt,type:"button",order:r.interrupt,group:"run",ariaLabel:"Interrupt kernel",title:"Interrupt kernel (⌘I)",icon:I,disabled:!i,onClick:()=>t.interrupt(e)},{key:"notebook-divider-run",type:"divider",order:r.interrupt+1},{key:n.delete,type:"button",order:r.delete,group:"cell",ariaLabel:"Delete cell",title:"Delete cell",icon:T,onClick:()=>t.delete(e)},{key:n.insert,type:"button",order:r.insert,group:"cell",ariaLabel:`Insert ${o} cell below`,title:`Insert ${o} cell below`,icon:v,onClick:()=>t.insertBelow(e,o)},{key:n.cellType,type:"dropdown",order:r.cellType,group:"cell",ariaLabel:"Cell type to insert",title:"Cell type to insert",icon:o==="code"?u:d,label:o==="code"?"Code":"Markdown",minWidth:76,options:[{key:"code",label:"Code",icon:u,isActive:o==="code",onClick:()=>l("code")},{key:"markdown",label:"Markdown",icon:d,isActive:o==="markdown",onClick:()=>l("markdown")}]}],[o,i,a,e,t])}const f=e=>{const{notebookId:t,extraItems:o,hiddenItems:l,ariaLabel:s="Notebook toolbar"}=e,i=L(t),a=c.useMemo(()=>{if(!l?.length)return i;const p=new Set(l);return i.filter(b=>!p.has(b.key))},[i,l]);return k.jsx(S,{items:a,extraItems:o,ariaLabel:s})};export{r as N,f as a,n as b,L as u};
@@ -1,2 +1,2 @@
1
- import{w as b,x as h,E as x,r as n,j as i,B as d,T as f,O as k,R as j,U as v}from"../datalayer-app-main.js";import{EphemeralNotebook as I}from"./EphemeralNotebook-DbS4f6yr.js";import{u as y,o as E,a as T}from"./openingNotebook-CjjarT8V.js";import"./useProgressTask-UPro-gwc.js";import"./NotebookToolbar-DMKCe3c2.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-6Hdi_m3T.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./CellSidebarExtension-CQlXdanG.js";import"./index-BYQwy0Zx.js";import"./hoverbox-CStlKQWE.js";import"./NotebookSkeleton-HdM76lOj.js";import"./Avatar-DbU3YP4x.js";import"./index-BJ7Yskx5.js";import"./color-CG7_7V2-.js";import"./isEqual-BybBNsZK.js";import"./defaultLocale-5voVPcsN.js";import"./renderer-lVFw9lw7.js";import"./SquareIcon-e3ygcjpv.js";function J({workspace:p}){const r=b(),e=h(r.snapshot),m=p.surfaceId,u=y(v,j,{workspace:p,editorId:m}),t=x(k)[0]?.value,s=n.useMemo(()=>t?t.notebook():E(),[t]),l=n.useMemo(()=>t?t.prime!==void 0?t.prime:s.cells.filter(o=>o.cell_type==="code").map(o=>Array.isArray(o.source)?o.source.join(""):o.source).join(`
1
+ import{w as b,x as h,E as x,r as n,j as i,B as d,T as f,O as k,R as j,U as v}from"../datalayer-app-main.js";import{EphemeralNotebook as I}from"./EphemeralNotebook-Co-WQWCc.js";import{u as y,o as E,a as T}from"./openingNotebook-CjjarT8V.js";import"./useProgressTask-UPro-gwc.js";import"./NotebookToolbar-rtMQZWHQ.js";import"./RepoPushIcon-Cm8g9NuL.js";import"./Toolbar-CGQDY041.js";import"./KebabHorizontalIcon-CXDXtkuL.js";import"./CellSidebarExtension-CfaJL6DQ.js";import"./index-s3hayhRS.js";import"./hoverbox-CStlKQWE.js";import"./NotebookSkeleton-CI7ovjNW.js";import"./Avatar-9MpXENSs.js";import"./index-CpcHHQd7.js";import"./color-CG7_7V2-.js";import"./isEqual-niFNV5MZ.js";import"./defaultLocale-5voVPcsN.js";import"./renderer-2D5v6hpK.js";import"./SquareIcon-e3ygcjpv.js";function J({workspace:p}){const r=b(),e=h(r.snapshot),m=p.surfaceId,u=y(v,j,{workspace:p,editorId:m}),t=x(k)[0]?.value,s=n.useMemo(()=>t?t.notebook():E(),[t]),l=n.useMemo(()=>t?t.prime!==void 0?t.prime:s.cells.filter(o=>o.cell_type==="code").map(o=>Array.isArray(o.source)?o.source.join(""):o.source).join(`
2
2
  `):T(),[t,s]),c=n.useRef(null);if(n.useEffect(()=>{const o=e.kernelId;e.state!=="running"||!o||c.current!==o&&(c.current=o,r.execute(l).catch(g=>{console.warn("[loop] could not prime the opening cell",g)}))},[r,e.state,e.kernelId,l]),e.state!=="running")return i.jsx(d,{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"fg.muted",fontSize:1,px:4,textAlign:"center",children:i.jsx(f,{children:"The notebook needs a running sandbox. Open the Sandbox view to see what it is doing."})});const a=r.getServiceManager()??void 0;return i.jsx(d,{sx:{height:"100%",minHeight:0,"& .jp-NotebookPanel":{height:"100% !important",minHeight:0},"& .dla-Box-Notebook":{display:"flex",flexDirection:"column",minHeight:0}},children:i.jsx(I,{nbformat:s,inheritTheme:!0,notebookId:m,serviceManager:a,kernelId:a?e.kernelId:void 0,showToolbar:u.present,toolbarExtraItems:u.items,runtimeOverride:!a&&e.jupyterUrl?{baseUrl:e.jupyterUrl,token:e.jupyterToken}:void 0})})}export{J as default};
@@ -1,4 +1,4 @@
1
- import{j as jsxRuntimeExports,d5 as ActionMenu,I as IconButton,b5 as ActionList,iG as StopIcon,r as reactExports,jL as useJupyterReactStoreFromProps,j5 as OutputAreaModel,jM as OutputArea,aa as standardRendererFactories,gK as MessageLoop,ag as Widget,aW as PromiseDelegate,_ as __vitePreload,e0 as CodeCell,hb as MarkdownCell,iB as SessionContext,ca as find,dy as EditorThemeRegistry,du as EditorLanguageRegistry,cF as CommandRegistry,jN as createStandaloneCell,hc as Cell$1,iY as CodeCellModel,iX as MarkdownCellModel,cu as ToolbarButton,g4 as runIcon,jO as BoxPanel,j2 as DEFAULT_VARIANT,j3 as MarimoReactive,jP as cellsStore,dz as EditorExtensionRegistry,dA as ybinding,j7 as newUuid,jQ as RawCell,iW as RawCellModel,jR as useCellsStore,B as Box,ct as StyledSpinner,jS as getPanel,jT as activateHover,iO as StateField,jU as showPanel,bw as EditorView,j0 as Decoration,i$ as StateEffect,iL as Facet,jV as combineConfig,jW as RangeSetBuilder,jX as crelt,jY as hoverTooltip,j1 as WidgetType,jZ as lineNumbers,j_ as highlightActiveLineGutter,j$ as highlightSpecialChars,k0 as history,k1 as foldGutter,k2 as drawSelection,k3 as dropCursor,bN as EditorState,k4 as indentOnInput,k5 as syntaxHighlighting,k6 as bracketMatching,k7 as closeBrackets,k8 as autocompletion,k9 as rectangularSelection,ka as crosshairCursor,kb as highlightActiveLine,kc as highlightSelectionMatches,bI as keymap,kd as closeBracketsKeymap,ke as defaultKeymap,kf as searchKeymap,kg as historyKeymap,kh as foldKeymap,ki as completionKeymap,kj as defaultHighlightStyle,gj as useTheme,bh as Box$1,kk as ArrowRightIcon,kl as useOutputsStore,bH as Prec,km as Compartment,a8 as getDefaultExportFromCjs}from"../datalayer-app-main.js";import{o as Toolbar}from"./index-BvvaLLhn.js";import{j as WidgetRenderer,W as WIDGET_MIMETYPE,h as getMarked,i as createLatexTypesetter,C as CodeMirrorEditorFactory,a as CodeMirrorMimeTypeService,c as CompleterModel,b as Completer,P as ProviderReconciliator,f as KernelCompleterProvider,d as CompletionHandler,r as rendererFactory$1,g as rendererFactory$2}from"./index-BYQwy0Zx.js";import{D as DOMWidgetModel,g as DOMWidgetView,h as JupyterLuminoPanelWidget,$,M as ManagerBase,R as RenderMimeRegistry,E as ErrorWidgetView,b as base,c as controls,i as createErrorWidgetModel,a as WIDGET_STATE_MIMETYPE,s as shims,e as semverExports,r as requireLoader,S as SemVerCache,J as JUPYTER_WIDGETS_VERSION,d as JUPYTER_CONTROLS_VERSION,L as Lumino}from"./index-BJ7Yskx5.js";import{python}from"./index-DbMBnR4l.js";import{K as KebabHorizontalIcon}from"./KebabHorizontalIcon-CXDXtkuL.js";import{P as PaintbrushIcon}from"./PaintbrushIcon-CLU8RilX.js";import{P as ProgressBar}from"./index-B3WvcNQa.js";import{F as ForwardRef}from"./RestartIcon-Ca6_HoK0.js";const KernelActionMenu=n=>{const{kernel:t,outputAdapter:o,onClearOutputs:r}=n;return jsxRuntimeExports.jsxs(ActionMenu,{children:[jsxRuntimeExports.jsx(ActionMenu.Anchor,{children:jsxRuntimeExports.jsx(IconButton,{"aria-labelledby":"",icon:KebabHorizontalIcon,variant:"invisible"})}),jsxRuntimeExports.jsx(ActionMenu.Overlay,{children:jsxRuntimeExports.jsxs(ActionList,{children:[jsxRuntimeExports.jsxs(ActionList.Item,{disabled:!t,onSelect:s=>{t&&t.interrupt().catch(a=>{console.error("[KernelActionMenu] Interrupt failed:",a)})},children:[jsxRuntimeExports.jsx(ActionList.LeadingVisual,{children:jsxRuntimeExports.jsx(StopIcon,{})}),"Interrupt kernel"]}),jsxRuntimeExports.jsxs(ActionList.Item,{disabled:!t,onSelect:s=>{t&&t.restart().catch(a=>{console.error("[KernelActionMenu] Restart failed:",a)})},children:[jsxRuntimeExports.jsx(ActionList.LeadingVisual,{children:jsxRuntimeExports.jsx(ForwardRef,{})}),"Restart kernel"]}),jsxRuntimeExports.jsxs(ActionList.Item,{variant:"danger",disabled:!1,onSelect:s=>{r?r():o&&o.clear()},children:[jsxRuntimeExports.jsx(ActionList.LeadingVisual,{children:jsxRuntimeExports.jsx(PaintbrushIcon,{})}),"Clear outputs"]})]})})]})},KernelProgressBar=()=>{const[n,t]=reactExports.useState(0);return reactExports.useEffect(()=>{const o=setInterval(()=>{t(r=>{let s=r+1;return s>100&&(s=0),s})},100);return()=>clearInterval(o)},[]),jsxRuntimeExports.jsx(ProgressBar,{progress:n,barSize:"small"})},useJupyter=n=>{const{jupyterConfig:t,kernel:o,kernelIsLoading:r,serviceManager:s}=useJupyterReactStoreFromProps(n??{});return{defaultKernel:o,jupyterServerUrl:t.jupyterServerUrl,kernel:o,kernelIsLoading:r,kernelManager:s?.kernels,lite:n?.lite,serverless:n?.serverless??!1,serverSettings:s?.serverSettings,serviceManager:s}},OUTPUT_WIDGET_VERSION="1.0.0";let OutputModel$1=class extends DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"OutputModel",_view_name:"OutputView",_model_module:"@jupyter-widgets/output",_view_module:"@jupyter-widgets/output",_model_module_version:OUTPUT_WIDGET_VERSION,_view_module_version:OUTPUT_WIDGET_VERSION})}},OutputView$1=class extends DOMWidgetView{};class OutputModel extends OutputModel$1{defaults(){return Object.assign(Object.assign({},super.defaults()),{msg_id:"",outputs:[]})}initialize(t,o){super.initialize(t,o),this._outputs=new OutputAreaModel({trusted:!0}),this.listenTo(this,"change:outputs",this.setOutputs),this.setOutputs()}get outputs(){return this._outputs}clear_output(t=!1){this._outputs.clear(t)}setOutputs(t,o,r){r&&r.newMessage||(this.clear_output(),this._outputs.fromJSON(JSON.parse(JSON.stringify(this.get("outputs")))))}}class OutputView extends OutputView$1{_createElement(t){return this.luminoWidget=new JupyterLuminoPanelWidget({view:this}),this.luminoWidget.node}_setElement(t){if(this.el||t!==this.luminoWidget.node)throw new Error("Cannot reset the DOM element.");this.el=this.luminoWidget.node,this.$el=$(this.luminoWidget.node)}render(){super.render(),this._outputView=new OutputArea({rendermime:this.model.widget_manager.renderMime,model:this.model.outputs}),this.luminoWidget.insertWidget(0,this._outputView),this.luminoWidget.addClass("jupyter-widgets"),this.luminoWidget.addClass("widget-output"),this.update()}remove(){return this._outputView.dispose(),super.remove()}}const outputWidgets=Object.freeze(Object.defineProperty({__proto__:null,OutputModel,OutputView},Symbol.toStringTag,{value:"Module"}));class HTMLManager extends ManagerBase{_viewList;constructor(t){super(),this.loader=t?.loader,this.renderMime=new RenderMimeRegistry({initialFactories:standardRendererFactories}),this.renderMime.addFactory({safe:!1,mimeTypes:[WIDGET_MIMETYPE],createRenderer:o=>new WidgetRenderer(o,this)},0),this._viewList=new Set,window.addEventListener("resize",()=>{this._viewList.forEach(o=>{MessageLoop.postMessage(o.luminoWidget,Widget.ResizeMessage.UnknownSize)})})}async display_view(t,o){let r;try{r=await t}catch(s){const a=`Could not create a view for ${t}`;console.error(a);const u=createErrorWidgetModel(s,a),h=new u;r=new ErrorWidgetView({model:h}),r.render()}Widget.attach(r.luminoWidget,o),this._viewList.add(r),r.once("remove",()=>{this._viewList.delete(r)})}filterExistingModelState(t){return super.filterExistingModelState(t)}_get_comm_info(){return Promise.resolve({})}_create_comm(t,o,r,s,a){return Promise.resolve({on_close:()=>{},on_msg:()=>{},close:()=>{}})}loadClass(t,o,r){return new Promise((s,a)=>{o==="@jupyter-widgets/base"?s(base):o==="@jupyter-widgets/controls"?s(controls):o==="@jupyter-widgets/output"?s(outputWidgets):this.loader!==void 0?s(this.loader(o,r)):a(`Could not load module ${o}@${r}`)}).then(s=>s[t]?s[t]:Promise.reject(`Class ${t} not found in module ${o}@${r}`))}renderMime;loader}class ClassicWidgetManager extends HTMLManager{_kernelConnection;_commRegistration;_onError;_registry;_ready=new PromiseDelegate;constructor(t){super(t),this.comm_target_name="jupyter.widget";const o=()=>{window.define("@jupyter-widgets/base",base),window.define("@jupyter-widgets/controls",controls),this._registry=new SemVerCache,this.register=this.register.bind(this),this.registerWithKernel=this.registerWithKernel.bind(this),this._getRegistry=this._getRegistry.bind(this),this._handleCommOpen=this._handleCommOpen.bind(this),this.register({name:"@jupyter-widgets/base",version:JUPYTER_WIDGETS_VERSION,exports:()=>__vitePreload(()=>import("./index-BJ7Yskx5.js").then(r=>r.b),[],import.meta.url)}),this.register({name:"@jupyter-widgets/controls",version:JUPYTER_CONTROLS_VERSION,exports:()=>__vitePreload(()=>import("./index-BJ7Yskx5.js").then(r=>r.c),[],import.meta.url)}),this._ready.resolve(!0)};if(window.require&&window.define)o();else{const r=document.createElement("script"),s=document.createElement("script");s.setAttribute("data-jupyter-widgets-cdn-only","true"),document.body.appendChild(s),r.src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js",document.body.appendChild(r),r.onload=()=>{o()},r.onerror=a=>{console.error("ClassicWidgetManager: Failed to load RequireJS",a),o()}}}get ready(){return this._ready}async _loadFromNotebook(t){const o=t.getMetadata("widgets");if(o&&o[WIDGET_STATE_MIMETYPE]){let r=o[WIDGET_STATE_MIMETYPE];r=this.filterExistingModelState(r),await this.set_state(r)}}registerWithKernel(t){if(this._kernelConnection=t,this.kernel=t,this._commRegistration&&this._commRegistration.dispose(),t){if(!this._registry){console.error("ClassicWidgetManager: Registry not initialized when registering with kernel.");return}this._commRegistration=t.registerCommTarget(this.comm_target_name,this._handleCommOpen)}else this.kernel=null}async _handleCommOpen(t,o){try{const r=new shims.services.Comm(t);await this.handle_comm_open(r,o)}catch(r){throw console.error("ClassicWidgetManager: Error in _handleCommOpen:",r),r}}_getRegistry(){return this._registry}get onError(){return this._onError}display_view(t,o){return Promise.resolve(t).then(r=>{Widget.attach(r.luminoWidget,o),r.on("remove",()=>{})})}async loadClass(t,o,r){(o==="@jupyter-widgets/base"||o==="@jupyter-widgets/controls")&&semverExports.valid(r)&&(r=`^${r}`);let s=this._getRegistry().getAllVersions(o);const a=r.split(".").length===2?r+".0":r;if(!s){const g=await requireLoader(o,a),w={name:o,version:a.replaceAll("^",""),exports:{...g}};if(this.register(w),s=this._getRegistry().getAllVersions(o),!s)throw new Error(`No version of module ${o} is registered`)}const u=this._getRegistry().get(o,a);if(!u){const g=Object.keys(s);throw new Error(`Module ${o}, version ${a} is not registered, however, ${g.join(",")} ${g.length>1?"are":"is"}`)}let h;typeof u=="function"?h=await u():h=await u;const b=h[t];if(!b)throw new Error(`Class ${t} not found in module ${o}`);return b}callbacks(t){const o=super.callbacks(t);return Object.assign({},o,{iopub:{output:r=>this._onError.emit(r)}})}_create_comm(t,o,r,s,a){const u=this._kernelConnection?.createComm(t,o);return(r||s)&&u?.open(r,s),Promise.resolve(new shims.services.Comm(u))}_get_comm_info(){return this._kernelConnection.requestCommInfo({target_name:this.comm_target_name}).then(t=>t.content.comms)}register(t){this._getRegistry().set(t.name,t.version,t.exports)}}const CSS_CLASS="jp-RenderedPlotly",MIME_TYPE="application/vnd.plotly.v1+json";class RenderedPlotly extends Widget{constructor(t){super(),this.addClass(CSS_CLASS),this._mimeType=t.mimeType,this._img_el=document.createElement("img"),this._img_el.className="plot-img",this.node.appendChild(this._img_el),this._img_el.addEventListener("mouseenter",o=>{this.createGraph(this._model)})}renderModel(t){if(this.hasGraphElement())return Promise.resolve();this._model=t;const o=t.data["image/png"];return o!=null?(this.updateImage(o),Promise.resolve()):this.createGraph(t)}hasGraphElement(){return this.node.querySelector(".plot-container")!==null}updateImage(t){this.hideGraph(),this._img_el.src="data:image/png;base64,"+t,this.showImage()}hideGraph(){const t=this.node.querySelector(".plot-container");t!=null&&(t.style.display="none")}showGraph(){const t=this.node.querySelector(".plot-container");t!=null&&(t.style.display="block")}hideImage(){const t=this.node.querySelector(".plot-img");t!=null&&(t.style.display="none")}showImage(){const t=this.node.querySelector(".plot-img");t!=null&&(t.style.display="block")}createGraph(t){const{data:o,layout:r,frames:s,config:a}=t.data[this._mimeType];return r.height||(r.height=360),(async()=>(RenderedPlotly.Plotly===null&&(RenderedPlotly.Plotly=await __vitePreload(()=>import("./index-t_gNTVoL.js").then(h=>h.i),[],import.meta.url),RenderedPlotly._resolveLoadingPlotly()),RenderedPlotly.loadingPlotly))().then(()=>RenderedPlotly.Plotly.react(this.node,o,r,a)).then(h=>{this.showGraph(),this.hideImage(),this.update(),s&&RenderedPlotly.Plotly.addFrames(this.node,s),this.node.offsetWidth>0&&this.node.offsetHeight>0&&RenderedPlotly.Plotly.toImage(h,{format:"png",width:this.node.offsetWidth,height:this.node.offsetHeight}).then(b=>{const g=b.split(",")[1];t.data["image/png"]!==g&&t.setData({data:{...t.data,"image/png":g}})}),this.node.on("plotly_webglcontextlost",()=>{const b=t.data["image/png"];if(b!=null)return this.updateImage(b),Promise.resolve()})})}onAfterShow(t){this.update()}onResize(t){this.update()}onUpdateRequest(t){RenderedPlotly.Plotly&&this.isVisible&&this.hasGraphElement()&&RenderedPlotly.Plotly.redraw(this.node).then(()=>{RenderedPlotly.Plotly.Plots.resize(this.node)})}_mimeType;_img_el;_model;static Plotly=null;static _resolveLoadingPlotly;static loadingPlotly=new Promise(t=>{RenderedPlotly._resolveLoadingPlotly=t})}const rendererFactory={safe:!0,mimeTypes:[MIME_TYPE],defaultRank:10,createRenderer:n=>new RenderedPlotly(n)};async function execute(n,t,o,r,s,a=!1,u){let h=!0;s&&Array.isArray(s.tags)&&s.tags.indexOf("raises-exception")!==-1&&(h=!1);const g=r.execute(t,{model:o.model,stopOnError:h,suppressCodeExecutionErrors:a,onExecutionPhaseChanged:u})?.future;if(!g){console.warn(`execute: the kernel returned no execution for output ${n}; is it connected?`);return}return o._onIOPub=g.onIOPub,o._onExecuteReply=g.onReply,o.future=g,g.done}const cmdIds={invoke:"completer:invoke",select:"completer:select"},CellCommands=(n,t,o,r)=>{n.addCommand(cmdIds.invoke,{label:"Completer: Invoke",execute:()=>o.invoke()}),n.addCommand(cmdIds.select,{label:"Completer: Select",execute:()=>o.completer.selectActive()}),n.addCommand("run:cell",{execute:()=>{t instanceof CodeCell?r.execute():t instanceof MarkdownCell&&(t.rendered=!0)}}),n.addKeyBinding({selector:".jp-InputArea-editor.jp-mod-completer-enabled",keys:["Tab"],command:cmdIds.invoke}),n.addKeyBinding({selector:".jp-InputArea-editor",keys:["Shift Enter"],command:"run:cell"}),[{selector:".jp-InputArea-editor.jp-mod-completer-active",keys:["Enter"],command:cmdIds.select}].map(a=>n.addKeyBinding(a))};class CellAdapter{_id;_outputs;_cell;_kernel;_panel;_sessionContext;_variant;_type;_iPyWidgetsClassicManager;constructor(t){const{id:o,type:r,source:s,outputs:a,kernel:u,boxOptions:h,variant:b}=t;this._id=o,this._variant=b,this._outputs=a,this._kernel=u,this._type=r,this.setupCell(r,s,u,h)}setupCell(t="code",o,r,s){const a=r.sessionManager,u=r.kernelSpecManager,h=r?{id:r.id,shouldStart:!1,autoStartDefault:!1,shutdownOnDispose:!1}:{name:"python",shouldStart:!0,autoStartDefault:!0,shutdownOnDispose:!0};this._sessionContext=new SessionContext({name:r?.path,path:r?.path,sessionManager:a,specsManager:u,type:"python",kernelPreference:h}),this._sessionContext._initialize=async()=>{const l=this._sessionContext.sessionManager;await l.ready,await l.refreshRunning();const y=find(l.running(),A=>A.kernel?.id===this._kernel.id);if(y)try{const A=l.connectTo({model:y,kernelConnectionOptions:{handleComms:!0}});A.kernel&&!A.kernel.handleComms&&(A.kernel.handleComms=!0),this._sessionContext._handleNewSession(A)}catch(A){return this._sessionContext._handleSessionError(A),Promise.reject(A)}return await this._sessionContext._startIfNecessary()};const b=new EditorThemeRegistry;for(const l of EditorThemeRegistry.getDefaultThemes())b.addTheme(l);const g=()=>{const l=new EditorExtensionRegistry;for(const y of EditorExtensionRegistry.getDefaultExtensions({themes:b}))l.addExtension(y);return l.addExtension({name:"shared-model-binding",factory:y=>{const A=y.model.sharedModel;return EditorExtensionRegistry.createImmutableExtension(ybinding({ytext:A.ysource,undoManager:A.undoManager??void 0}))}}),l},w=new EditorLanguageRegistry;for(const l of EditorLanguageRegistry.getDefaultLanguages())w.addLanguage(l);w.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>(await __vitePreload(()=>import("./index-KgE-JGae.js"),[],import.meta.url)).markdown({codeLanguages:y=>w.findBest(y)})});const E=new CodeMirrorMimeTypeService(w),R=new CommandRegistry;document.addEventListener("keydown",l=>{const y=document.activeElement;y&&y.closest(".dla-Jupyter-Cell")===this._cell.node&&R.processKeydownEvent(l)},!0);const k=new RenderMimeRegistry({initialFactories:standardRendererFactories,latexTypesetter:createLatexTypesetter(),markdownParser:getMarked(w)});this._iPyWidgetsClassicManager=new ClassicWidgetManager({loader:requireLoader}),k.addFactory({safe:!1,mimeTypes:[WIDGET_MIMETYPE],createRenderer:l=>new WidgetRenderer(l,this._iPyWidgetsClassicManager)},0);const q=new CodeMirrorEditorFactory({extensions:g(),languages:w}),_=createStandaloneCell({cell_type:t,source:o,outputs:this._outputs,metadata:{}}),S=new Cell$1.ContentFactory({editorFactory:q.newInlineEditor.bind(q)});if(t==="code"){const l=_;this._cell=new CodeCell({rendermime:k,model:new CodeCellModel({sharedModel:l}),contentFactory:S})}else if(t==="markdown"){const l=_;this._cell=new MarkdownCell({rendermime:k,model:new MarkdownCellModel({sharedModel:l}),contentFactory:S})}this._cell.addClass("dla-Jupyter-Cell"),this._cell.initializeState(),this._type==="markdown"&&(this._cell.rendered=!1);let D=!1,T=null;const O=async l=>{if(l&&(!D||T!==l.id))try{l.handleComms||(console.warn("Kernel connection does not handle Comms, enabling it",l.id),l.handleComms=!0),D=!0,T=l.id,await l.info,l.connectionStatus==="connected"?this._iPyWidgetsClassicManager?.registerWithKernel(l):console.log("Kernel disconnected while waiting for info, will retry on next connection...")}catch(y){console.error("Error getting kernel info or registering widget manager:",y),D=!1,T=null,setTimeout(()=>{l.connectionStatus==="connected"&&T!==l.id&&(this._iPyWidgetsClassicManager?.registerWithKernel(l),D=!0,T=l.id)},1e3)}else!l&&D&&(this._iPyWidgetsClassicManager?.registerWithKernel(null),D=!1,T=null)};this._sessionContext.kernelChanged.connect((l,y)=>{const A=y.newValue;D=!1,T=null,O(A)}),this._sessionContext.kernelChanged.connect(()=>{this._sessionContext.session?.kernel?.info.then(l=>{if(this._type==="code"){const y=l.language_info,A=E.getMimeTypeByLanguage(y);this._cell.model&&(this._cell.model.mimeType=A)}})}),this._sessionContext.ready.then(()=>{const l=this._sessionContext.session?.kernel;O(l||null)});const F=this._cell.editor,H=new CompleterModel,P=new Completer({editor:F,model:H}),I=1e3,N=new KernelCompleterProvider,V=new ProviderReconciliator({context:{widget:this._cell,editor:F,session:this._sessionContext.session},providers:[N],timeout:I}),W=new CompletionHandler({completer:P,reconciliator:V});this._sessionContext.ready.then(()=>{const l=new KernelCompleterProvider;W.reconciliator=new ProviderReconciliator({context:{widget:this._cell,editor:F,session:this._sessionContext.session},providers:[l],timeout:I})}),this._cell.ready.then(()=>{W.editor=this._cell&&this._cell.editor}),CellCommands(R,this._cell,W,this),P.hide(),P.addClass("jp-Completer-Cell"),Widget.attach(P,document.body);const i=new Toolbar;i.addItem("spacer",Toolbar.createSpacerItem());const d=new ToolbarButton({icon:runIcon,onClick:()=>{this._type==="code"?this.execute():this._type==="markdown"&&(this._cell.rendered=!0)},tooltip:"Run"});i.addItem("run",d),i.addItem("interrupt",Toolbar.createInterruptButton(this._sessionContext)),i.addItem("restart",Toolbar.createRestartButton(this._sessionContext)),i.addItem("status",Toolbar.createKernelStatusItem(this._sessionContext)),this._type==="code"&&(this._cell.outputsScrolled=!1),this._cell.activate(),this._panel=new BoxPanel,this._panel.direction="top-to-bottom",this._panel.spacing=0,s?.showToolbar!==!1&&this._panel.addWidget(i),this._panel.addWidget(this._cell),s?.showToolbar!==!1&&BoxPanel.setStretch(i,0),BoxPanel.setStretch(this._cell,1),window.addEventListener("resize",()=>{this._panel.update()}),this._panel.update()}get panel(){return this._panel}get cell(){return this._cell}get sessionContext(){return this._sessionContext}get kernel(){return this._kernel}get variant(){return this._variant??this._kernel?.variant??DEFAULT_VARIANT}execute=({react:t=!0}={})=>{this._type==="code"?(this._iPyWidgetsClassicManager?.registerWithKernel(this._kernel.connection),this._execute(this._cell,void 0,t)):this._type==="markdown"&&(this._cell.rendered=!0)};reactive(){const t=this._kernel?.connection;return this.variant==="marimo"&&t?MarimoReactive.for(t):void 0}async _execute(t,o,r=!0){cellsStore.getState().setIsExecuting(this._id,!0);const s=t.model,a=s.sharedModel.getSource();if(!a.trim()||!this.kernel)return s.sharedModel.transact(()=>{s.clearExecution()},!1),cellsStore.getState().setIsExecuting(this._id,!1),new Promise(()=>{});const u=this.reactive();u&&(u.bindRunner(this._id,()=>this._execute(t,void 0,!1)),(await u.register(this._id,a)).error&&u.unbindRunner(this._id));const h={cellId:s.sharedModel.getId()};o={...s.metadata,...o,...h};const{recordTiming:b}=o;s.sharedModel.transact(()=>{s.clearExecution(),t.outputHidden=!1},!1),t.setPrompt("*"),s.trusted=!0;let g;try{const w=execute(this._id,a,t.outputArea,this._kernel,o);if(b){const R=L=>{let k;switch(L.header.msg_type){case"status":k=`status.${L.content.execution_state}`;break;case"execute_input":k="execute_input";break;default:return!0}const q=L.header.date||new Date().toISOString(),_=Object.assign({},s.getMetadata("execution"));return _[`iopub.${k}`]=q,s.setMetadata("execution",_),!0};t.outputArea.future.registerMessageHook(R)}else s.deleteMetadata("execution");g=t.outputArea.future;const E=await w;if(s.executionCount=E.content.execution_count,b){const R=Object.assign({},s.getMetadata("execution")),L=E.metadata.started;L&&(R["shell.execute_reply.started"]=L);const k=E.header.date;R["shell.execute_reply"]=k||new Date().toISOString(),s.setMetadata("execution",R)}return cellsStore.getState().setIsExecuting(this._id,!1),u&&r&&!u.reacting&&E.content.status==="ok"&&await u.react(this._id),E}catch(w){if(cellsStore.getState().setIsExecuting(this._id,!1),g&&!t.isDisposed&&t.outputArea.future===g&&(t.setPrompt(""),b&&g.isDisposed)){const E=Object.assign({},s.getMetadata("execution"));E.execution_failed=new Date().toISOString(),s.setMetadata("execution",E)}throw w}}}const themes=new EditorThemeRegistry,editorExtensions=()=>{const n=new EditorExtensionRegistry;for(const t of EditorExtensionRegistry.getDefaultExtensions({themes}))n.addExtension(t);return n.addExtension({name:"shared-model-binding",factory:t=>{const o=t.model.sharedModel;return EditorExtensionRegistry.createImmutableExtension(ybinding({ytext:o.ysource,undoManager:o.undoManager??void 0}))}}),n},languages=new EditorLanguageRegistry;for(const n of EditorLanguageRegistry.getDefaultLanguages())languages.addLanguage(n);languages.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>(await __vitePreload(()=>import("./index-KgE-JGae.js"),[],import.meta.url)).markdown({codeLanguages:t=>languages.findBest(t)})});const renderFactories=standardRendererFactories.concat(rendererFactory),rendermime=new RenderMimeRegistry({initialFactories:renderFactories,latexTypesetter:createLatexTypesetter(),markdownParser:getMarked(languages)}),factoryService=new CodeMirrorEditorFactory({extensions:editorExtensions(),languages}),InputViewer=n=>{const{cell:t,languageInfo:o}=n,r=t.id||newUuid();switch(t.cell_type){case"code":{const s=createStandaloneCell(t),a=new CodeCell({rendermime,model:new CodeCellModel({sharedModel:s}),contentFactory:new Cell$1.ContentFactory({editorFactory:factoryService.newInlineEditor.bind(factoryService)})}).initializeState();return o&&o.mimetype&&(a.model.mimeType=o.mimetype),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Lumino,{id:r,children:a})})}case"markdown":{const s=createStandaloneCell(t),a=new MarkdownCell({rendermime,showEditorForReadOnlyMarkdown:!1,model:new MarkdownCellModel({sharedModel:s}),contentFactory:new Cell$1.ContentFactory({editorFactory:factoryService.newInlineEditor.bind(factoryService)})}).initializeState();return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Lumino,{id:r,children:a})})}case"raw":{const s=createStandaloneCell(t),a=new RawCell({model:new RawCellModel({sharedModel:s}),contentFactory:new Cell$1.ContentFactory({editorFactory:factoryService.newInlineEditor.bind(factoryService)})});return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Lumino,{id:r,children:a})})}default:return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}};class OutputViewerAdapter{_renderers;_outputArea;_rendermime;constructor(adaptPlotly,outputs){this._renderers=standardRendererFactories.filter(n=>n.mimeTypes[0]!=="text/javascript"),this._renderers.push(rendererFactory$1),this._renderers.push(rendererFactory$2),this._rendermime=new RenderMimeRegistry({initialFactories:this._renderers});const outputAreaModel=new OutputAreaModel({trusted:!0,values:outputs});if(this._outputArea=new OutputArea({model:outputAreaModel,rendermime:this._rendermime}),adaptPlotly&&outputs&&outputs[0]){const data=outputs[0].data,isPlotly=data["application/vnd.plotly.v1+json"];if(isPlotly){let script=this._outputArea.node.children[0].children[1].children[0].children[1].innerHTML;script=script.replaceAll(`
1
+ import{j as jsxRuntimeExports,d6 as ActionMenu,I as IconButton,b6 as ActionList,iH as StopIcon,r as reactExports,jM as useJupyterReactStoreFromProps,j6 as OutputAreaModel,jN as OutputArea,aa as standardRendererFactories,gL as MessageLoop,ag as Widget,aW as PromiseDelegate,_ as __vitePreload,e1 as CodeCell,hc as MarkdownCell,iC as SessionContext,cb as find,dz as EditorThemeRegistry,dv as EditorLanguageRegistry,cG as CommandRegistry,jO as createStandaloneCell,hd as Cell$1,iZ as CodeCellModel,iY as MarkdownCellModel,cv as ToolbarButton,g5 as runIcon,jP as BoxPanel,j3 as DEFAULT_VARIANT,j4 as MarimoReactive,jQ as cellsStore,dA as EditorExtensionRegistry,dB as ybinding,j8 as newUuid,jR as RawCell,iX as RawCellModel,jS as useCellsStore,B as Box,cu as StyledSpinner,jT as getPanel,jU as activateHover,iP as StateField,jV as showPanel,bx as EditorView,j1 as Decoration,j0 as StateEffect,iM as Facet,jW as combineConfig,jX as RangeSetBuilder,jY as crelt,jZ as hoverTooltip,j2 as WidgetType,j_ as lineNumbers,j$ as highlightActiveLineGutter,k0 as highlightSpecialChars,k1 as history,k2 as foldGutter,k3 as drawSelection,k4 as dropCursor,bO as EditorState,k5 as indentOnInput,k6 as syntaxHighlighting,k7 as bracketMatching,k8 as closeBrackets,k9 as autocompletion,ka as rectangularSelection,kb as crosshairCursor,kc as highlightActiveLine,kd as highlightSelectionMatches,bJ as keymap,ke as closeBracketsKeymap,kf as defaultKeymap,kg as searchKeymap,kh as historyKeymap,ki as foldKeymap,kj as completionKeymap,kk as defaultHighlightStyle,gk as useTheme,bi as Box$1,kl as ArrowRightIcon,km as useOutputsStore,bI as Prec,kn as Compartment,a8 as getDefaultExportFromCjs}from"../datalayer-app-main.js";import{o as Toolbar}from"./index-a51XM5L8.js";import{j as WidgetRenderer,W as WIDGET_MIMETYPE,h as getMarked,i as createLatexTypesetter,C as CodeMirrorEditorFactory,a as CodeMirrorMimeTypeService,c as CompleterModel,b as Completer,P as ProviderReconciliator,f as KernelCompleterProvider,d as CompletionHandler,r as rendererFactory$1,g as rendererFactory$2}from"./index-s3hayhRS.js";import{D as DOMWidgetModel,g as DOMWidgetView,h as JupyterLuminoPanelWidget,$,M as ManagerBase,R as RenderMimeRegistry,E as ErrorWidgetView,b as base,c as controls,i as createErrorWidgetModel,a as WIDGET_STATE_MIMETYPE,s as shims,e as semverExports,r as requireLoader,S as SemVerCache,J as JUPYTER_WIDGETS_VERSION,d as JUPYTER_CONTROLS_VERSION,L as Lumino}from"./index-CpcHHQd7.js";import{python}from"./index-DbMBnR4l.js";import{K as KebabHorizontalIcon}from"./KebabHorizontalIcon-CXDXtkuL.js";import{P as PaintbrushIcon}from"./PaintbrushIcon-CLU8RilX.js";import{P as ProgressBar}from"./index-BJhxZF_K.js";import{F as ForwardRef}from"./RestartIcon-Ca6_HoK0.js";const KernelActionMenu=n=>{const{kernel:t,outputAdapter:o,onClearOutputs:r}=n;return jsxRuntimeExports.jsxs(ActionMenu,{children:[jsxRuntimeExports.jsx(ActionMenu.Anchor,{children:jsxRuntimeExports.jsx(IconButton,{"aria-labelledby":"",icon:KebabHorizontalIcon,variant:"invisible"})}),jsxRuntimeExports.jsx(ActionMenu.Overlay,{children:jsxRuntimeExports.jsxs(ActionList,{children:[jsxRuntimeExports.jsxs(ActionList.Item,{disabled:!t,onSelect:s=>{t&&t.interrupt().catch(a=>{console.error("[KernelActionMenu] Interrupt failed:",a)})},children:[jsxRuntimeExports.jsx(ActionList.LeadingVisual,{children:jsxRuntimeExports.jsx(StopIcon,{})}),"Interrupt kernel"]}),jsxRuntimeExports.jsxs(ActionList.Item,{disabled:!t,onSelect:s=>{t&&t.restart().catch(a=>{console.error("[KernelActionMenu] Restart failed:",a)})},children:[jsxRuntimeExports.jsx(ActionList.LeadingVisual,{children:jsxRuntimeExports.jsx(ForwardRef,{})}),"Restart kernel"]}),jsxRuntimeExports.jsxs(ActionList.Item,{variant:"danger",disabled:!1,onSelect:s=>{r?r():o&&o.clear()},children:[jsxRuntimeExports.jsx(ActionList.LeadingVisual,{children:jsxRuntimeExports.jsx(PaintbrushIcon,{})}),"Clear outputs"]})]})})]})},KernelProgressBar=()=>{const[n,t]=reactExports.useState(0);return reactExports.useEffect(()=>{const o=setInterval(()=>{t(r=>{let s=r+1;return s>100&&(s=0),s})},100);return()=>clearInterval(o)},[]),jsxRuntimeExports.jsx(ProgressBar,{progress:n,barSize:"small"})},useJupyter=n=>{const{jupyterConfig:t,kernel:o,kernelIsLoading:r,serviceManager:s}=useJupyterReactStoreFromProps(n??{});return{defaultKernel:o,jupyterServerUrl:t.jupyterServerUrl,kernel:o,kernelIsLoading:r,kernelManager:s?.kernels,lite:n?.lite,serverless:n?.serverless??!1,serverSettings:s?.serverSettings,serviceManager:s}},OUTPUT_WIDGET_VERSION="1.0.0";let OutputModel$1=class extends DOMWidgetModel{defaults(){return Object.assign(Object.assign({},super.defaults()),{_model_name:"OutputModel",_view_name:"OutputView",_model_module:"@jupyter-widgets/output",_view_module:"@jupyter-widgets/output",_model_module_version:OUTPUT_WIDGET_VERSION,_view_module_version:OUTPUT_WIDGET_VERSION})}},OutputView$1=class extends DOMWidgetView{};class OutputModel extends OutputModel$1{defaults(){return Object.assign(Object.assign({},super.defaults()),{msg_id:"",outputs:[]})}initialize(t,o){super.initialize(t,o),this._outputs=new OutputAreaModel({trusted:!0}),this.listenTo(this,"change:outputs",this.setOutputs),this.setOutputs()}get outputs(){return this._outputs}clear_output(t=!1){this._outputs.clear(t)}setOutputs(t,o,r){r&&r.newMessage||(this.clear_output(),this._outputs.fromJSON(JSON.parse(JSON.stringify(this.get("outputs")))))}}class OutputView extends OutputView$1{_createElement(t){return this.luminoWidget=new JupyterLuminoPanelWidget({view:this}),this.luminoWidget.node}_setElement(t){if(this.el||t!==this.luminoWidget.node)throw new Error("Cannot reset the DOM element.");this.el=this.luminoWidget.node,this.$el=$(this.luminoWidget.node)}render(){super.render(),this._outputView=new OutputArea({rendermime:this.model.widget_manager.renderMime,model:this.model.outputs}),this.luminoWidget.insertWidget(0,this._outputView),this.luminoWidget.addClass("jupyter-widgets"),this.luminoWidget.addClass("widget-output"),this.update()}remove(){return this._outputView.dispose(),super.remove()}}const outputWidgets=Object.freeze(Object.defineProperty({__proto__:null,OutputModel,OutputView},Symbol.toStringTag,{value:"Module"}));class HTMLManager extends ManagerBase{_viewList;constructor(t){super(),this.loader=t?.loader,this.renderMime=new RenderMimeRegistry({initialFactories:standardRendererFactories}),this.renderMime.addFactory({safe:!1,mimeTypes:[WIDGET_MIMETYPE],createRenderer:o=>new WidgetRenderer(o,this)},0),this._viewList=new Set,window.addEventListener("resize",()=>{this._viewList.forEach(o=>{MessageLoop.postMessage(o.luminoWidget,Widget.ResizeMessage.UnknownSize)})})}async display_view(t,o){let r;try{r=await t}catch(s){const a=`Could not create a view for ${t}`;console.error(a);const u=createErrorWidgetModel(s,a),h=new u;r=new ErrorWidgetView({model:h}),r.render()}Widget.attach(r.luminoWidget,o),this._viewList.add(r),r.once("remove",()=>{this._viewList.delete(r)})}filterExistingModelState(t){return super.filterExistingModelState(t)}_get_comm_info(){return Promise.resolve({})}_create_comm(t,o,r,s,a){return Promise.resolve({on_close:()=>{},on_msg:()=>{},close:()=>{}})}loadClass(t,o,r){return new Promise((s,a)=>{o==="@jupyter-widgets/base"?s(base):o==="@jupyter-widgets/controls"?s(controls):o==="@jupyter-widgets/output"?s(outputWidgets):this.loader!==void 0?s(this.loader(o,r)):a(`Could not load module ${o}@${r}`)}).then(s=>s[t]?s[t]:Promise.reject(`Class ${t} not found in module ${o}@${r}`))}renderMime;loader}class ClassicWidgetManager extends HTMLManager{_kernelConnection;_commRegistration;_onError;_registry;_ready=new PromiseDelegate;constructor(t){super(t),this.comm_target_name="jupyter.widget";const o=()=>{window.define("@jupyter-widgets/base",base),window.define("@jupyter-widgets/controls",controls),this._registry=new SemVerCache,this.register=this.register.bind(this),this.registerWithKernel=this.registerWithKernel.bind(this),this._getRegistry=this._getRegistry.bind(this),this._handleCommOpen=this._handleCommOpen.bind(this),this.register({name:"@jupyter-widgets/base",version:JUPYTER_WIDGETS_VERSION,exports:()=>__vitePreload(()=>import("./index-CpcHHQd7.js").then(r=>r.b),[],import.meta.url)}),this.register({name:"@jupyter-widgets/controls",version:JUPYTER_CONTROLS_VERSION,exports:()=>__vitePreload(()=>import("./index-CpcHHQd7.js").then(r=>r.c),[],import.meta.url)}),this._ready.resolve(!0)};if(window.require&&window.define)o();else{const r=document.createElement("script"),s=document.createElement("script");s.setAttribute("data-jupyter-widgets-cdn-only","true"),document.body.appendChild(s),r.src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js",document.body.appendChild(r),r.onload=()=>{o()},r.onerror=a=>{console.error("ClassicWidgetManager: Failed to load RequireJS",a),o()}}}get ready(){return this._ready}async _loadFromNotebook(t){const o=t.getMetadata("widgets");if(o&&o[WIDGET_STATE_MIMETYPE]){let r=o[WIDGET_STATE_MIMETYPE];r=this.filterExistingModelState(r),await this.set_state(r)}}registerWithKernel(t){if(this._kernelConnection=t,this.kernel=t,this._commRegistration&&this._commRegistration.dispose(),t){if(!this._registry){console.error("ClassicWidgetManager: Registry not initialized when registering with kernel.");return}this._commRegistration=t.registerCommTarget(this.comm_target_name,this._handleCommOpen)}else this.kernel=null}async _handleCommOpen(t,o){try{const r=new shims.services.Comm(t);await this.handle_comm_open(r,o)}catch(r){throw console.error("ClassicWidgetManager: Error in _handleCommOpen:",r),r}}_getRegistry(){return this._registry}get onError(){return this._onError}display_view(t,o){return Promise.resolve(t).then(r=>{Widget.attach(r.luminoWidget,o),r.on("remove",()=>{})})}async loadClass(t,o,r){(o==="@jupyter-widgets/base"||o==="@jupyter-widgets/controls")&&semverExports.valid(r)&&(r=`^${r}`);let s=this._getRegistry().getAllVersions(o);const a=r.split(".").length===2?r+".0":r;if(!s){const g=await requireLoader(o,a),w={name:o,version:a.replaceAll("^",""),exports:{...g}};if(this.register(w),s=this._getRegistry().getAllVersions(o),!s)throw new Error(`No version of module ${o} is registered`)}const u=this._getRegistry().get(o,a);if(!u){const g=Object.keys(s);throw new Error(`Module ${o}, version ${a} is not registered, however, ${g.join(",")} ${g.length>1?"are":"is"}`)}let h;typeof u=="function"?h=await u():h=await u;const b=h[t];if(!b)throw new Error(`Class ${t} not found in module ${o}`);return b}callbacks(t){const o=super.callbacks(t);return Object.assign({},o,{iopub:{output:r=>this._onError.emit(r)}})}_create_comm(t,o,r,s,a){const u=this._kernelConnection?.createComm(t,o);return(r||s)&&u?.open(r,s),Promise.resolve(new shims.services.Comm(u))}_get_comm_info(){return this._kernelConnection.requestCommInfo({target_name:this.comm_target_name}).then(t=>t.content.comms)}register(t){this._getRegistry().set(t.name,t.version,t.exports)}}const CSS_CLASS="jp-RenderedPlotly",MIME_TYPE="application/vnd.plotly.v1+json";class RenderedPlotly extends Widget{constructor(t){super(),this.addClass(CSS_CLASS),this._mimeType=t.mimeType,this._img_el=document.createElement("img"),this._img_el.className="plot-img",this.node.appendChild(this._img_el),this._img_el.addEventListener("mouseenter",o=>{this.createGraph(this._model)})}renderModel(t){if(this.hasGraphElement())return Promise.resolve();this._model=t;const o=t.data["image/png"];return o!=null?(this.updateImage(o),Promise.resolve()):this.createGraph(t)}hasGraphElement(){return this.node.querySelector(".plot-container")!==null}updateImage(t){this.hideGraph(),this._img_el.src="data:image/png;base64,"+t,this.showImage()}hideGraph(){const t=this.node.querySelector(".plot-container");t!=null&&(t.style.display="none")}showGraph(){const t=this.node.querySelector(".plot-container");t!=null&&(t.style.display="block")}hideImage(){const t=this.node.querySelector(".plot-img");t!=null&&(t.style.display="none")}showImage(){const t=this.node.querySelector(".plot-img");t!=null&&(t.style.display="block")}createGraph(t){const{data:o,layout:r,frames:s,config:a}=t.data[this._mimeType];return r.height||(r.height=360),(async()=>(RenderedPlotly.Plotly===null&&(RenderedPlotly.Plotly=await __vitePreload(()=>import("./index-C643Hfu1.js").then(h=>h.i),[],import.meta.url),RenderedPlotly._resolveLoadingPlotly()),RenderedPlotly.loadingPlotly))().then(()=>RenderedPlotly.Plotly.react(this.node,o,r,a)).then(h=>{this.showGraph(),this.hideImage(),this.update(),s&&RenderedPlotly.Plotly.addFrames(this.node,s),this.node.offsetWidth>0&&this.node.offsetHeight>0&&RenderedPlotly.Plotly.toImage(h,{format:"png",width:this.node.offsetWidth,height:this.node.offsetHeight}).then(b=>{const g=b.split(",")[1];t.data["image/png"]!==g&&t.setData({data:{...t.data,"image/png":g}})}),this.node.on("plotly_webglcontextlost",()=>{const b=t.data["image/png"];if(b!=null)return this.updateImage(b),Promise.resolve()})})}onAfterShow(t){this.update()}onResize(t){this.update()}onUpdateRequest(t){RenderedPlotly.Plotly&&this.isVisible&&this.hasGraphElement()&&RenderedPlotly.Plotly.redraw(this.node).then(()=>{RenderedPlotly.Plotly.Plots.resize(this.node)})}_mimeType;_img_el;_model;static Plotly=null;static _resolveLoadingPlotly;static loadingPlotly=new Promise(t=>{RenderedPlotly._resolveLoadingPlotly=t})}const rendererFactory={safe:!0,mimeTypes:[MIME_TYPE],defaultRank:10,createRenderer:n=>new RenderedPlotly(n)};async function execute(n,t,o,r,s,a=!1,u){let h=!0;s&&Array.isArray(s.tags)&&s.tags.indexOf("raises-exception")!==-1&&(h=!1);const g=r.execute(t,{model:o.model,stopOnError:h,suppressCodeExecutionErrors:a,onExecutionPhaseChanged:u})?.future;if(!g){console.warn(`execute: the kernel returned no execution for output ${n}; is it connected?`);return}return o._onIOPub=g.onIOPub,o._onExecuteReply=g.onReply,o.future=g,g.done}const cmdIds={invoke:"completer:invoke",select:"completer:select"},CellCommands=(n,t,o,r)=>{n.addCommand(cmdIds.invoke,{label:"Completer: Invoke",execute:()=>o.invoke()}),n.addCommand(cmdIds.select,{label:"Completer: Select",execute:()=>o.completer.selectActive()}),n.addCommand("run:cell",{execute:()=>{t instanceof CodeCell?r.execute():t instanceof MarkdownCell&&(t.rendered=!0)}}),n.addKeyBinding({selector:".jp-InputArea-editor.jp-mod-completer-enabled",keys:["Tab"],command:cmdIds.invoke}),n.addKeyBinding({selector:".jp-InputArea-editor",keys:["Shift Enter"],command:"run:cell"}),[{selector:".jp-InputArea-editor.jp-mod-completer-active",keys:["Enter"],command:cmdIds.select}].map(a=>n.addKeyBinding(a))};class CellAdapter{_id;_outputs;_cell;_kernel;_panel;_sessionContext;_variant;_type;_iPyWidgetsClassicManager;constructor(t){const{id:o,type:r,source:s,outputs:a,kernel:u,boxOptions:h,variant:b}=t;this._id=o,this._variant=b,this._outputs=a,this._kernel=u,this._type=r,this.setupCell(r,s,u,h)}setupCell(t="code",o,r,s){const a=r.sessionManager,u=r.kernelSpecManager,h=r?{id:r.id,shouldStart:!1,autoStartDefault:!1,shutdownOnDispose:!1}:{name:"python",shouldStart:!0,autoStartDefault:!0,shutdownOnDispose:!0};this._sessionContext=new SessionContext({name:r?.path,path:r?.path,sessionManager:a,specsManager:u,type:"python",kernelPreference:h}),this._sessionContext._initialize=async()=>{const l=this._sessionContext.sessionManager;await l.ready,await l.refreshRunning();const y=find(l.running(),A=>A.kernel?.id===this._kernel.id);if(y)try{const A=l.connectTo({model:y,kernelConnectionOptions:{handleComms:!0}});A.kernel&&!A.kernel.handleComms&&(A.kernel.handleComms=!0),this._sessionContext._handleNewSession(A)}catch(A){return this._sessionContext._handleSessionError(A),Promise.reject(A)}return await this._sessionContext._startIfNecessary()};const b=new EditorThemeRegistry;for(const l of EditorThemeRegistry.getDefaultThemes())b.addTheme(l);const g=()=>{const l=new EditorExtensionRegistry;for(const y of EditorExtensionRegistry.getDefaultExtensions({themes:b}))l.addExtension(y);return l.addExtension({name:"shared-model-binding",factory:y=>{const A=y.model.sharedModel;return EditorExtensionRegistry.createImmutableExtension(ybinding({ytext:A.ysource,undoManager:A.undoManager??void 0}))}}),l},w=new EditorLanguageRegistry;for(const l of EditorLanguageRegistry.getDefaultLanguages())w.addLanguage(l);w.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>(await __vitePreload(()=>import("./index-7F_pA42X.js"),[],import.meta.url)).markdown({codeLanguages:y=>w.findBest(y)})});const E=new CodeMirrorMimeTypeService(w),R=new CommandRegistry;document.addEventListener("keydown",l=>{const y=document.activeElement;y&&y.closest(".dla-Jupyter-Cell")===this._cell.node&&R.processKeydownEvent(l)},!0);const k=new RenderMimeRegistry({initialFactories:standardRendererFactories,latexTypesetter:createLatexTypesetter(),markdownParser:getMarked(w)});this._iPyWidgetsClassicManager=new ClassicWidgetManager({loader:requireLoader}),k.addFactory({safe:!1,mimeTypes:[WIDGET_MIMETYPE],createRenderer:l=>new WidgetRenderer(l,this._iPyWidgetsClassicManager)},0);const q=new CodeMirrorEditorFactory({extensions:g(),languages:w}),_=createStandaloneCell({cell_type:t,source:o,outputs:this._outputs,metadata:{}}),S=new Cell$1.ContentFactory({editorFactory:q.newInlineEditor.bind(q)});if(t==="code"){const l=_;this._cell=new CodeCell({rendermime:k,model:new CodeCellModel({sharedModel:l}),contentFactory:S})}else if(t==="markdown"){const l=_;this._cell=new MarkdownCell({rendermime:k,model:new MarkdownCellModel({sharedModel:l}),contentFactory:S})}this._cell.addClass("dla-Jupyter-Cell"),this._cell.initializeState(),this._type==="markdown"&&(this._cell.rendered=!1);let D=!1,T=null;const O=async l=>{if(l&&(!D||T!==l.id))try{l.handleComms||(console.warn("Kernel connection does not handle Comms, enabling it",l.id),l.handleComms=!0),D=!0,T=l.id,await l.info,l.connectionStatus==="connected"?this._iPyWidgetsClassicManager?.registerWithKernel(l):console.log("Kernel disconnected while waiting for info, will retry on next connection...")}catch(y){console.error("Error getting kernel info or registering widget manager:",y),D=!1,T=null,setTimeout(()=>{l.connectionStatus==="connected"&&T!==l.id&&(this._iPyWidgetsClassicManager?.registerWithKernel(l),D=!0,T=l.id)},1e3)}else!l&&D&&(this._iPyWidgetsClassicManager?.registerWithKernel(null),D=!1,T=null)};this._sessionContext.kernelChanged.connect((l,y)=>{const A=y.newValue;D=!1,T=null,O(A)}),this._sessionContext.kernelChanged.connect(()=>{this._sessionContext.session?.kernel?.info.then(l=>{if(this._type==="code"){const y=l.language_info,A=E.getMimeTypeByLanguage(y);this._cell.model&&(this._cell.model.mimeType=A)}})}),this._sessionContext.ready.then(()=>{const l=this._sessionContext.session?.kernel;O(l||null)});const F=this._cell.editor,H=new CompleterModel,P=new Completer({editor:F,model:H}),I=1e3,N=new KernelCompleterProvider,V=new ProviderReconciliator({context:{widget:this._cell,editor:F,session:this._sessionContext.session},providers:[N],timeout:I}),W=new CompletionHandler({completer:P,reconciliator:V});this._sessionContext.ready.then(()=>{const l=new KernelCompleterProvider;W.reconciliator=new ProviderReconciliator({context:{widget:this._cell,editor:F,session:this._sessionContext.session},providers:[l],timeout:I})}),this._cell.ready.then(()=>{W.editor=this._cell&&this._cell.editor}),CellCommands(R,this._cell,W,this),P.hide(),P.addClass("jp-Completer-Cell"),Widget.attach(P,document.body);const i=new Toolbar;i.addItem("spacer",Toolbar.createSpacerItem());const d=new ToolbarButton({icon:runIcon,onClick:()=>{this._type==="code"?this.execute():this._type==="markdown"&&(this._cell.rendered=!0)},tooltip:"Run"});i.addItem("run",d),i.addItem("interrupt",Toolbar.createInterruptButton(this._sessionContext)),i.addItem("restart",Toolbar.createRestartButton(this._sessionContext)),i.addItem("status",Toolbar.createKernelStatusItem(this._sessionContext)),this._type==="code"&&(this._cell.outputsScrolled=!1),this._cell.activate(),this._panel=new BoxPanel,this._panel.direction="top-to-bottom",this._panel.spacing=0,s?.showToolbar!==!1&&this._panel.addWidget(i),this._panel.addWidget(this._cell),s?.showToolbar!==!1&&BoxPanel.setStretch(i,0),BoxPanel.setStretch(this._cell,1),window.addEventListener("resize",()=>{this._panel.update()}),this._panel.update()}get panel(){return this._panel}get cell(){return this._cell}get sessionContext(){return this._sessionContext}get kernel(){return this._kernel}get variant(){return this._variant??this._kernel?.variant??DEFAULT_VARIANT}execute=({react:t=!0}={})=>{this._type==="code"?(this._iPyWidgetsClassicManager?.registerWithKernel(this._kernel.connection),this._execute(this._cell,void 0,t)):this._type==="markdown"&&(this._cell.rendered=!0)};reactive(){const t=this._kernel?.connection;return this.variant==="marimo"&&t?MarimoReactive.for(t):void 0}async _execute(t,o,r=!0){cellsStore.getState().setIsExecuting(this._id,!0);const s=t.model,a=s.sharedModel.getSource();if(!a.trim()||!this.kernel)return s.sharedModel.transact(()=>{s.clearExecution()},!1),cellsStore.getState().setIsExecuting(this._id,!1),new Promise(()=>{});const u=this.reactive();u&&(u.bindRunner(this._id,()=>this._execute(t,void 0,!1)),(await u.register(this._id,a)).error&&u.unbindRunner(this._id));const h={cellId:s.sharedModel.getId()};o={...s.metadata,...o,...h};const{recordTiming:b}=o;s.sharedModel.transact(()=>{s.clearExecution(),t.outputHidden=!1},!1),t.setPrompt("*"),s.trusted=!0;let g;try{const w=execute(this._id,a,t.outputArea,this._kernel,o);if(b){const R=L=>{let k;switch(L.header.msg_type){case"status":k=`status.${L.content.execution_state}`;break;case"execute_input":k="execute_input";break;default:return!0}const q=L.header.date||new Date().toISOString(),_=Object.assign({},s.getMetadata("execution"));return _[`iopub.${k}`]=q,s.setMetadata("execution",_),!0};t.outputArea.future.registerMessageHook(R)}else s.deleteMetadata("execution");g=t.outputArea.future;const E=await w;if(s.executionCount=E.content.execution_count,b){const R=Object.assign({},s.getMetadata("execution")),L=E.metadata.started;L&&(R["shell.execute_reply.started"]=L);const k=E.header.date;R["shell.execute_reply"]=k||new Date().toISOString(),s.setMetadata("execution",R)}return cellsStore.getState().setIsExecuting(this._id,!1),u&&r&&!u.reacting&&E.content.status==="ok"&&await u.react(this._id),E}catch(w){if(cellsStore.getState().setIsExecuting(this._id,!1),g&&!t.isDisposed&&t.outputArea.future===g&&(t.setPrompt(""),b&&g.isDisposed)){const E=Object.assign({},s.getMetadata("execution"));E.execution_failed=new Date().toISOString(),s.setMetadata("execution",E)}throw w}}}const themes=new EditorThemeRegistry,editorExtensions=()=>{const n=new EditorExtensionRegistry;for(const t of EditorExtensionRegistry.getDefaultExtensions({themes}))n.addExtension(t);return n.addExtension({name:"shared-model-binding",factory:t=>{const o=t.model.sharedModel;return EditorExtensionRegistry.createImmutableExtension(ybinding({ytext:o.ysource,undoManager:o.undoManager??void 0}))}}),n},languages=new EditorLanguageRegistry;for(const n of EditorLanguageRegistry.getDefaultLanguages())languages.addLanguage(n);languages.addLanguage({name:"ipythongfm",mime:"text/x-ipythongfm",load:async()=>(await __vitePreload(()=>import("./index-7F_pA42X.js"),[],import.meta.url)).markdown({codeLanguages:t=>languages.findBest(t)})});const renderFactories=standardRendererFactories.concat(rendererFactory),rendermime=new RenderMimeRegistry({initialFactories:renderFactories,latexTypesetter:createLatexTypesetter(),markdownParser:getMarked(languages)}),factoryService=new CodeMirrorEditorFactory({extensions:editorExtensions(),languages}),InputViewer=n=>{const{cell:t,languageInfo:o}=n,r=t.id||newUuid();switch(t.cell_type){case"code":{const s=createStandaloneCell(t),a=new CodeCell({rendermime,model:new CodeCellModel({sharedModel:s}),contentFactory:new Cell$1.ContentFactory({editorFactory:factoryService.newInlineEditor.bind(factoryService)})}).initializeState();return o&&o.mimetype&&(a.model.mimeType=o.mimetype),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Lumino,{id:r,children:a})})}case"markdown":{const s=createStandaloneCell(t),a=new MarkdownCell({rendermime,showEditorForReadOnlyMarkdown:!1,model:new MarkdownCellModel({sharedModel:s}),contentFactory:new Cell$1.ContentFactory({editorFactory:factoryService.newInlineEditor.bind(factoryService)})}).initializeState();return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Lumino,{id:r,children:a})})}case"raw":{const s=createStandaloneCell(t),a=new RawCell({model:new RawCellModel({sharedModel:s}),contentFactory:new Cell$1.ContentFactory({editorFactory:factoryService.newInlineEditor.bind(factoryService)})});return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Lumino,{id:r,children:a})})}default:return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})}};class OutputViewerAdapter{_renderers;_outputArea;_rendermime;constructor(adaptPlotly,outputs){this._renderers=standardRendererFactories.filter(n=>n.mimeTypes[0]!=="text/javascript"),this._renderers.push(rendererFactory$1),this._renderers.push(rendererFactory$2),this._rendermime=new RenderMimeRegistry({initialFactories:this._renderers});const outputAreaModel=new OutputAreaModel({trusted:!0,values:outputs});if(this._outputArea=new OutputArea({model:outputAreaModel,rendermime:this._rendermime}),adaptPlotly&&outputs&&outputs[0]){const data=outputs[0].data,isPlotly=data["application/vnd.plotly.v1+json"];if(isPlotly){let script=this._outputArea.node.children[0].children[1].children[0].children[1].innerHTML;script=script.replaceAll(`
2
2
  ,`,`
3
3
  `),eval(script)}}}clearOutput(){this._outputArea.model.clear()}get outputArea(){return this._outputArea}}const OutputViewer=({cell:n,adaptPlotly:t=!1})=>{const o=n.outputs?n.outputs:void 0,r=new OutputViewerAdapter(t,o);return n.cell_type==="code"?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Lumino,{children:r.outputArea})}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})},Cell=({autoStart:n=!0,id:t,kernel:o,outputs:r=[],readOnly:s=!1,showToolbar:a=!0,source:u="",type:h="code",variant:b})=>{const[g]=reactExports.useState(t||newUuid()),[w,E]=reactExports.useState(),R=useCellsStore(),L=reactExports.useRef(!1),k=_=>{_.cell.model.contentChanged.connect((S,D)=>{R.setSource(g,S.sharedModel.getSource())}),_.cell instanceof CodeCell&&_.cell.outputArea.outputLengthChanged?.connect((S,D)=>{R.setOutputsCount(g,D)}),_.sessionContext.initialize().then(()=>{n&&_.cell.model&&_.execute()}),_.sessionContext.kernelChanged.connect(()=>{_.sessionContext.session?.kernel?.info.then(S=>{R.setKernelSessionAvailable(g,!0)})})};reactExports.useEffect(()=>{!w&&!L.current&&o&&(L.current=!0,o.ready.then(()=>{const _=new CellAdapter({id:g,type:h,source:u,outputs:r,kernel:o,boxOptions:{showToolbar:a},variant:b});E(_),R.setAdapter(g,_),R.setSource(g,u),k(_);const S=D=>{let T=D.target;for(;T&&!T.classList.contains("jp-MarkdownOutput");)T=T.parentElement;T&&T.classList.contains("jp-MarkdownOutput")&&(_.cell.rendered=!1)};return document.addEventListener("dblclick",S),()=>{document.removeEventListener("dblclick",S)}}))},[u,o]);const q=reactExports.useMemo(()=>({cell_type:h,source:u,metadata:{editable:!1,trusted:!0},...h==="code"?{outputs:r,execution_count:null}:{}}),[h,u,r]);return s?jsxRuntimeExports.jsxs(Box,{className:"dla-Jupyter-ReadOnlyCell",children:[jsxRuntimeExports.jsx(InputViewer,{cell:q}),h==="code"&&q.outputs?.length?jsxRuntimeExports.jsx(OutputViewer,{cell:q}):null]}):w?jsxRuntimeExports.jsx(Box,{sx:{"& .dla-Jupyter-Cell":{position:"relative !important",contain:"content !important"},"& .jp-Toolbar":{height:"auto !important",position:"relative"},"& .lm-BoxPanel":{position:"relative"},"& .jp-Cell":{position:"relative"},"& .jp-CodeCell":{height:"auto !important",position:"relative"},"& .jp-MarkdownCell":{height:"auto !important",minHeight:"65px",position:"relative"},"& .jp-Cell-outputArea":{paddingBottom:"2px"},"& .jp-CodeMirrorEditor":{cursor:"text !important"}},children:jsxRuntimeExports.jsx(Lumino,{children:w.panel})}):jsxRuntimeExports.jsx(Box,{sx:{display:"flex",justifyContent:"center",alignItems:"center",p:4},children:jsxRuntimeExports.jsx(StyledSpinner,{size:"medium"})})};class SelectedDiagnostic{constructor(t,o,r){this.from=t,this.to=o,this.diagnostic=r}}class LintState{constructor(t,o,r){this.diagnostics=t,this.panel=o,this.selected=r}static init(t,o,r){let s=r.facet(lintConfig).markerFilter;s&&(t=s(t,r));let a=t.slice().sort((L,k)=>L.from-k.from||L.to-k.to),u=new RangeSetBuilder,h=[],b=0,g=r.doc.iter(),w=0,E=r.doc.length;for(let L=0;;){let k=L==a.length?null:a[L];if(!k&&!h.length)break;let q,_;if(h.length)q=b,_=h.reduce((T,O)=>Math.min(T,O.to),k&&k.from>q?k.from:1e8);else{if(q=k.from,q>E)break;_=k.to,h.push(k),L++}for(;L<a.length;){let T=a[L];if(T.from==q&&(T.to>T.from||T.to==q))h.push(T),L++,_=Math.min(T.to,_);else{_=Math.min(T.from,_);break}}_=Math.min(_,E);let S=!1;if(h.some(T=>T.from==q&&(T.to==_||_==E))&&(S=q==_,!S&&_-q<10)){let T=q-(w+g.value.length);T>0&&(g.next(T),w=q);for(let O=q;;){if(O>=_){S=!0;break}if(!g.lineBreak&&w+g.value.length>O)break;O=w+g.value.length,w+=g.value.length,g.next()}}let D=maxSeverity(h);if(S)u.add(q,q,Decoration.widget({widget:new DiagnosticWidget(D),diagnostics:h.slice()}));else{let T=h.reduce((O,F)=>F.markClass?O+" "+F.markClass:O,"");u.add(q,_,Decoration.mark({class:"cm-lintRange cm-lintRange-"+D+T,diagnostics:h.slice(),inclusiveEnd:h.some(O=>O.to>_)}))}if(b=_,b==E)break;for(let T=0;T<h.length;T++)h[T].to<=b&&h.splice(T--,1)}let R=u.finish();return new LintState(R,o,findDiagnostic(R))}}function findDiagnostic(n,t=null,o=0){let r=null;return n.between(o,1e9,(s,a,{spec:u})=>{if(!(t&&u.diagnostics.indexOf(t)<0))if(!r)r=new SelectedDiagnostic(s,a,t||u.diagnostics[0]);else{if(u.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new SelectedDiagnostic(r.from,a,r.diagnostic)}}),r}function hideTooltip(n,t){let o=t.pos,r=t.end||o,s=n.state.facet(lintConfig).hideOn(n,o,r);if(s!=null)return s;let a=n.startState.doc.lineAt(t.pos);return!!(n.effects.some(u=>u.is(setDiagnosticsEffect))||n.changes.touchesRange(a.from,Math.max(a.to,r)))}function maybeEnableLint(n,t){return n.field(lintState,!1)?t:t.concat(StateEffect.appendConfig.of(lintExtensions))}const setDiagnosticsEffect=StateEffect.define(),togglePanel=StateEffect.define(),movePanelSelection=StateEffect.define(),lintState=StateField.define({create(){return new LintState(Decoration.none,null,null)},update(n,t){if(t.docChanged&&n.diagnostics.size){let o=n.diagnostics.map(t.changes),r=null,s=n.panel;if(n.selected){let a=t.changes.mapPos(n.selected.from,1);r=findDiagnostic(o,n.selected.diagnostic,a)||findDiagnostic(o,null,a)}!o.size&&s&&t.state.facet(lintConfig).autoPanel&&(s=null),n=new LintState(o,s,r)}for(let o of t.effects)if(o.is(setDiagnosticsEffect)){let r=t.state.facet(lintConfig).autoPanel?o.value.length?LintPanel.open:null:n.panel;n=LintState.init(o.value,r,t.state)}else o.is(togglePanel)?n=new LintState(n.diagnostics,o.value?LintPanel.open:null,n.selected):o.is(movePanelSelection)&&(n=new LintState(n.diagnostics,n.panel,o.value));return n},provide:n=>[showPanel.from(n,t=>t.panel),EditorView.decorations.from(n,t=>t.diagnostics)]}),activeMark=Decoration.mark({class:"cm-lintRange cm-lintRange-active"});function lintTooltip(n,t,o){let{diagnostics:r}=n.state.field(lintState),s,a=-1,u=-1;r.between(t-(o<0?1:0),t+(o>0?1:0),(b,g,{spec:w})=>{if(t>=b&&t<=g&&(b==g||(t>b||o>0)&&(t<g||o<0)))return s=w.diagnostics,a=b,u=g,!1});let h=n.state.facet(lintConfig).tooltipFilter;return s&&h&&(s=h(s,n.state)),s?{pos:a,end:u,above:!0,create(){return{dom:diagnosticsTooltip(n,s)}}}:null}function diagnosticsTooltip(n,t){return crelt("ul",{class:"cm-tooltip-lint"},t.map(o=>renderDiagnostic(n,o,!1)))}const openLintPanel=n=>{let t=n.state.field(lintState,!1);(!t||!t.panel)&&n.dispatch({effects:maybeEnableLint(n.state,[togglePanel.of(!0)])});let o=getPanel(n,LintPanel.open);return o&&o.dom.querySelector(".cm-panel-lint ul").focus(),!0},closeLintPanel=n=>{let t=n.state.field(lintState,!1);return!t||!t.panel?!1:(n.dispatch({effects:togglePanel.of(!1)}),!0)},nextDiagnostic=n=>{let t=n.state.field(lintState,!1);if(!t)return!1;let o=n.state.selection.main,r=findDiagnostic(t.diagnostics,null,o.to+1);return!r&&(r=findDiagnostic(t.diagnostics,null,0),!r||r.from==o.from&&r.to==o.to)?!1:(n.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),activateHover(n,r.from,1,{tooltip:lintHover,until:s=>s.docChanged||s.newSelection.main.head<r.from||s.newSelection.main.head>r.to}),!0)},lintKeymap=[{key:"Mod-Shift-m",run:openLintPanel,preventDefault:!0},{key:"F8",run:nextDiagnostic}],lintConfig=Facet.define({combine(n){return{sources:n.map(t=>t.source).filter(t=>t!=null),...combineConfig(n.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:combineFilter,tooltipFilter:combineFilter,needsRefresh:(t,o)=>t?o?r=>t(r)||o(r):t:o,hideOn:(t,o)=>t?o?(r,s,a)=>t(r,s,a)||o(r,s,a):t:o,autoPanel:(t,o)=>t||o})}}});function combineFilter(n,t){return n?t?(o,r)=>t(n(o,r),r):n:t}function assignKeys(n){let t=[];if(n)t:for(let{name:o}of n){for(let r=0;r<o.length;r++){let s=o[r];if(/[a-zA-Z]/.test(s)&&!t.some(a=>a.toLowerCase()==s.toLowerCase())){t.push(s);continue t}}t.push("")}return t}function renderDiagnostic(n,t,o){var r;let s=o?assignKeys(t.actions):[];return crelt("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},crelt("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(n):t.message),(r=t.actions)===null||r===void 0?void 0:r.map((a,u)=>{let h=!1,b=L=>{if(L.preventDefault(),h)return;h=!0;let k=findDiagnostic(n.state.field(lintState).diagnostics,t);k&&a.apply(n,k.from,k.to)},{name:g}=a,w=s[u]?g.indexOf(s[u]):-1,E=w<0?g:[g.slice(0,w),crelt("u",g.slice(w,w+1)),g.slice(w+1)],R=a.markClass?" "+a.markClass:"";return crelt("button",{type:"button",class:"cm-diagnosticAction"+R,onclick:b,onmousedown:b,"aria-label":` Action: ${g}${w<0?"":` (access key "${s[u]})"`}.`},E)}),t.source&&crelt("div",{class:"cm-diagnosticSource"},t.source))}class DiagnosticWidget extends WidgetType{constructor(t){super(),this.sev=t}eq(t){return t.sev==this.sev}toDOM(){return crelt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class PanelItem{constructor(t,o){this.diagnostic=o,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=renderDiagnostic(t,o,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class LintPanel{constructor(t){this.view=t,this.items=[];let o=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)closeLintPanel(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:a}=this.items[this.selectedIndex],u=assignKeys(a.actions);for(let h=0;h<u.length;h++)if(u[h].toUpperCase().charCodeAt(0)==s.keyCode){let b=findDiagnostic(this.view.state.field(lintState).diagnostics,a);b&&a.actions[h].apply(t,b.from,b.to)}}else return;s.preventDefault()}},r=s=>{for(let a=0;a<this.items.length;a++)this.items[a].dom.contains(s.target)&&this.moveSelection(a)};this.list=crelt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:o,onclick:r}),this.dom=crelt("div",{class:"cm-panel-lint"},this.list,crelt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>closeLintPanel(this.view)},"×")),this.update()}get selectedIndex(){let t=this.view.state.field(lintState).selected;if(!t)return-1;for(let o=0;o<this.items.length;o++)if(this.items[o].diagnostic==t.diagnostic)return o;return-1}update(){let{diagnostics:t,selected:o}=this.view.state.field(lintState),r=0,s=!1,a=null,u=new Set;for(t.between(0,this.view.state.doc.length,(h,b,{spec:g})=>{for(let w of g.diagnostics){if(u.has(w))continue;u.add(w);let E=-1,R;for(let L=r;L<this.items.length;L++)if(this.items[L].diagnostic==w){E=L;break}E<0?(R=new PanelItem(this.view,w),this.items.splice(r,0,R),s=!0):(R=this.items[E],E>r&&(this.items.splice(r,E-r),s=!0)),o&&R.diagnostic==o.diagnostic?R.dom.hasAttribute("aria-selected")||(R.dom.setAttribute("aria-selected","true"),a=R):R.dom.hasAttribute("aria-selected")&&R.dom.removeAttribute("aria-selected"),r++}});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new PanelItem(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),a?(this.list.setAttribute("aria-activedescendant",a.id),this.view.requestMeasure({key:this,read:()=>({sel:a.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:h,panel:b})=>{let g=b.height/this.list.offsetHeight;h.top<b.top?this.list.scrollTop-=(b.top-h.top)/g:h.bottom>b.bottom&&(this.list.scrollTop+=(h.bottom-b.bottom)/g)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let t=this.list.firstChild;function o(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)o();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)o()}moveSelection(t){if(this.selectedIndex<0)return;let o=this.view.state.field(lintState),r=findDiagnostic(o.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:movePanelSelection.of(r)})}static open(t){return new LintPanel(t)}}function svg$2(n,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(n)}</svg>')`}function underline(n){return svg$2(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const baseTheme=EditorView.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:underline("#f11")},".cm-lintRange-warning":{backgroundImage:underline("orange")},".cm-lintRange-info":{backgroundImage:underline("#999")},".cm-lintRange-hint":{backgroundImage:underline("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function severityWeight(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function maxSeverity(n){let t="hint",o=1;for(let r of n){let s=severityWeight(r.severity);s>o&&(o=s,t=r.severity)}return t}const lintHover=hoverTooltip(lintTooltip,{hideOn:hideTooltip}),lintExtensions=[lintState,EditorView.decorations.compute([lintState],n=>{let{selected:t,panel:o}=n.field(lintState);return!t||!o||t.from==t.to?Decoration.none:Decoration.set([activeMark.range(t.from,t.to)])}),lintHover,baseTheme],basicSetup=[lineNumbers(),highlightActiveLineGutter(),highlightSpecialChars(),history(),foldGutter(),drawSelection(),dropCursor(),EditorState.allowMultipleSelections.of(!0),indentOnInput(),syntaxHighlighting(defaultHighlightStyle,{fallback:!0}),bracketMatching(),closeBrackets(),autocompletion(),rectangularSelection(),crosshairCursor(),highlightActiveLine(),highlightSelectionMatches(),keymap.of([...closeBracketsKeymap,...defaultKeymap,...searchKeymap,...historyKeymap,...foldKeymap,...completionKeymap,...lintKeymap])],theme=EditorView.theme({"&":{fontSize:"9pt",border:"1px solid var(--borderColor-default, #d0d7de)",backgroundColor:"var(--bgColor-default, #ffffff)",color:"var(--fgColor-default, #1f2328)"},".cm-content":{fontFamily:"Menlo, Monaco, Lucida Console, monospace",minHeight:"10px",color:"var(--fgColor-default, #1f2328)",caretColor:"var(--fgColor-accent, #0969da)"},".cm-gutters":{minHeight:"10px",backgroundColor:"var(--bgColor-muted, #f6f8fa)",color:"var(--fgColor-muted, #656d76)",borderRight:"1px solid var(--borderColor-default, #d0d7de)"},".cm-lineNumbers .cm-gutterElement":{color:"var(--fgColor-muted, #656d76)"},".cm-activeLineGutter":{backgroundColor:"var(--bgColor-neutral-muted, rgba(175, 184, 193, 0.2))",color:"var(--fgColor-default, #1f2328)"},".cm-scroller":{overflow:"auto"}},{dark:!1}),codeMirrorTheme=[theme],CodeMirrorOutputToolbarMenu=n=>{const{executeCode:t,outputAdapter:o,editorView:r}=n;return jsxRuntimeExports.jsxs(ActionMenu,{children:[jsxRuntimeExports.jsx(ActionMenu.Anchor,{children:jsxRuntimeExports.jsx(IconButton,{"aria-labelledby":"",icon:KebabHorizontalIcon,variant:"invisible"})}),jsxRuntimeExports.jsx(ActionMenu.Overlay,{children:jsxRuntimeExports.jsxs(ActionList,{children:[jsxRuntimeExports.jsxs(ActionList.Item,{onSelect:s=>{s.preventDefault(),t(r)},children:[jsxRuntimeExports.jsx(ActionList.LeadingVisual,{children:jsxRuntimeExports.jsx(ArrowRightIcon,{})}),jsxRuntimeExports.jsx(ActionList.TrailingVisual,{children:"⇧ ↵"}),"Run code"]}),jsxRuntimeExports.jsxs(ActionList.Item,{onSelect:s=>{s.preventDefault(),o.interrupt()},children:[jsxRuntimeExports.jsx(ActionList.LeadingVisual,{children:jsxRuntimeExports.jsx(StopIcon,{})}),"Interrupt kernel"]}),jsxRuntimeExports.jsxs(ActionList.Item,{variant:"danger",onClick:s=>{s.preventDefault(),o.clear()},children:[jsxRuntimeExports.jsx(ActionList.LeadingVisual,{children:jsxRuntimeExports.jsx(PaintbrushIcon,{})}),"Clear outputs"]})]})})]})},KernelStatus=({color:n})=>jsxRuntimeExports.jsx(Box$1,{sx:{backgroundColor:n,width:"14px",height:"14px",borderRadius:3}}),CodeMirrorOutputToolbar=n=>{const{executeCode:t,editorView:o,kernel:r,codePre:s}=n,{theme:a}=useTheme(),u=reactExports.useMemo(()=>a?.colorSchemes.light.colors.success.muted,[]),h=reactExports.useMemo(()=>a?.colorSchemes.light.colors.severe.muted,[]),[b,g]=reactExports.useState("unknown");reactExports.useEffect(()=>{r&&r.ready.then(()=>{s&&t(o,s),g(r.connection.status),r.connection.statusChanged.connect((E,R)=>{g(R)})})},[r]);const w=E=>E==="idle"?u:h;return jsxRuntimeExports.jsxs(Box$1,{display:"flex",children:[jsxRuntimeExports.jsx(Box$1,{flexGrow:1}),jsxRuntimeExports.jsx(Box$1,{sx:{paddingTop:"6px"},children:jsxRuntimeExports.jsx(KernelStatus,{color:w(b)})}),jsxRuntimeExports.jsx(Box$1,{children:jsxRuntimeExports.jsx(CodeMirrorOutputToolbarMenu,{...n})})]})},CodeMirrorEditor=n=>{const{code:t,codePre:o,outputAdapter:r,autoRun:s,disableRun:a,sourceId:u,toolbarPosition:h,insertText:b,kernel:g}=n,w=useOutputsStore(),[E,R]=reactExports.useState(),L=reactExports.useRef(a),k=reactExports.useRef(r),q=reactExports.useRef(g),_=w.getDataset(u),S=w.getInput(u),D=reactExports.useRef(void 0);reactExports.useEffect(()=>{L.current=a},[a]),reactExports.useEffect(()=>{k.current=r},[r]),reactExports.useEffect(()=>{q.current=g,k.current&&(k.current.kernel=g)},[g]);const T=H=>{if(E&&H!==void 0){if(E.state.doc.toString()===H)return;E.dispatch({changes:{from:0,to:E.state.doc.length,insert:H}})}},O=H=>{E&&b&&E.dispatch({changes:{from:0,insert:b(H)}})},F=(H,P)=>{if(L.current)return alert("Code execution is disabled for this editor. There should be a button on the page to run this editor."),!0;const I=k.current;return q.current&&(I.kernel=q.current),P?I.execute(P):I.execute(H.state.doc.toString()),!0};return reactExports.useEffect(()=>{w.setInput(u,t);const H=new Compartment,P=EditorState.create({doc:t,extensions:[Prec.highest(keymap.of([{key:"Shift-Enter",run:N=>F(N),preventDefault:!0}])),EditorView.domEventHandlers({keydown:(N,V)=>N.shiftKey&&N.key==="Enter"?(N.preventDefault(),F(V)):!1}),basicSetup,H.of(python()),EditorView.lineWrapping,codeMirrorTheme,EditorView.updateListener.of(N=>{if(N.docChanged){const V=N.state.doc.toString();w.setInput(u,V)}})]}),I=new EditorView({state:P,parent:D.current});return R(I),s&&F(I),()=>{I.destroy()}},[t]),reactExports.useEffect(()=>{O(_)},[_]),reactExports.useEffect(()=>{T(S)},[S]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[g&&h==="up"&&jsxRuntimeExports.jsx(CodeMirrorOutputToolbar,{editorView:E,codePre:o,kernel:g,outputAdapter:r,executeCode:F}),jsxRuntimeExports.jsx("div",{ref:D}),g&&h==="middle"&&jsxRuntimeExports.jsx(CodeMirrorOutputToolbar,{editorView:E,codePre:o,kernel:g,outputAdapter:r,executeCode:F})]})},CodeMirrorDatalayerEditor=CodeMirrorEditor;class OutputAdapter{_id;_kernel;_renderers;_outputArea;_rendermime;_iPyWidgetsManager;_suppressCodeExecutionErrors;_variant;_lastCode="";constructor(id,kernel,outputs,outputAreaModel,suppressCodeExecutionErrors=!1,variant){this._id=id,this._kernel=kernel,this._variant=variant,this._suppressCodeExecutionErrors=suppressCodeExecutionErrors,this._renderers=standardRendererFactories.filter(n=>n.mimeTypes[0]!=="text/javascript"),this._renderers.push(rendererFactory$1),this._renderers.push(rendererFactory$2),this._rendermime=new RenderMimeRegistry({initialFactories:this._renderers}),this._iPyWidgetsManager=new ClassicWidgetManager({loader:requireLoader}),this._rendermime.addFactory({safe:!1,mimeTypes:[WIDGET_MIMETYPE],createRenderer:n=>new WidgetRenderer(n,this._iPyWidgetsManager)},0);const model=outputAreaModel??new OutputAreaModel({trusted:!0,values:outputs});if(this._outputArea=new OutputArea({model,rendermime:this._rendermime}),outputs&&outputs[0]){const data=outputs[0].data;if(data){const isPlotly=data["application/vnd.plotly.v1+json"];if(isPlotly){let script=this._outputArea.node.children[0].children[1].children[0].children[1].innerHTML;script=script.replaceAll(`
4
4
  ,`,`
@@ -1,4 +1,4 @@
1
- import{r as p,l as _,s as S,b as L,d as A,t as P,j as n,T as x,B as c,c as b,D as B,S as K,H as O,N as U,L as N,e as T,I as z,C as R,f as $}from"../datalayer-app-main.js";import{e as F,K as H}from"./KernelVariables-KCUfxhF4.js";function D({status:e}){const s=e==="running"||e==="idle"?"success":e==="busy"||e==="starting"?"attention":e==="error"||e==="dead"?"danger":"secondary";return n.jsx(N,{variant:s,size:"small","data-sandbox-status":e,children:e})}function Y({url:e}){const[s,l]=p.useState(!1);return n.jsxs(c,{display:"flex",alignItems:"center",gap:1,minWidth:0,children:[n.jsx(T,{href:e,target:"_blank",rel:"noreferrer",sx:{fontFamily:"mono",fontSize:0,wordBreak:"break-all"},children:e}),n.jsx(z,{icon:s?R:$,"aria-label":"Copy the URL",size:"small",variant:"invisible",onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})}})]})}function E(e){if(e===void 0||e==="")return;const s=typeof e=="number"?new Date(e<1e12?e*1e3:e):new Date(e);return Number.isNaN(s.getTime())?void 0:s.toLocaleString()}const h="__DL_PYODIDE__",M=`def __dl_pyodide():
1
+ import{r as p,l as _,s as S,b as L,d as A,t as P,j as n,T as x,B as c,c as b,D as B,S as K,H as O,N as U,L as N,e as T,I as z,C as R,f as $}from"../datalayer-app-main.js";import{e as F,K as H}from"./KernelVariables-Cl57Zze1.js";function D({status:e}){const s=e==="running"||e==="idle"?"success":e==="busy"||e==="starting"?"attention":e==="error"||e==="dead"?"danger":"secondary";return n.jsx(N,{variant:s,size:"small","data-sandbox-status":e,children:e})}function Y({url:e}){const[s,l]=p.useState(!1);return n.jsxs(c,{display:"flex",alignItems:"center",gap:1,minWidth:0,children:[n.jsx(T,{href:e,target:"_blank",rel:"noreferrer",sx:{fontFamily:"mono",fontSize:0,wordBreak:"break-all"},children:e}),n.jsx(z,{icon:s?R:$,"aria-label":"Copy the URL",size:"small",variant:"invisible",onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})}})]})}function E(e){if(e===void 0||e==="")return;const s=typeof e=="number"?new Date(e<1e12?e*1e3:e):new Date(e);return Number.isNaN(s.getTime())?void 0:s.toLocaleString()}const h="__DL_PYODIDE__",M=`def __dl_pyodide():
2
2
  import json, sys
3
3
  facts = {'python': sys.version.split()[0], 'packages': []}
4
4
  try: