@marimo-team/frontend 0.25.1-dev90 → 0.25.2-dev0

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 (365) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-Bdak5-o8.js → ConnectedDataExplorerComponent-DJ5jwKfp.js} +1 -1
  2. package/dist/assets/{ErrorBoundary-DrliQ_7g.js → ErrorBoundary-BeE1cdgM.js} +2 -2
  3. package/dist/assets/{ImageComparisonComponent-DLxkuRy3.js → ImageComparisonComponent-pCLPT6RA.js} +1 -1
  4. package/dist/assets/LazyAnyLanguageCodeMirror-B_IYTCX5.js +2 -0
  5. package/dist/assets/{RunButton-qknEPbRR.js → RunButton-C2kFUhyO.js} +10 -10
  6. package/dist/assets/{abnfDiagram-VCTEODGH-dm832Yw9.js → abnfDiagram-VCTEODGH-CSPJSGaM.js} +1 -1
  7. package/dist/assets/add-cell-with-ai-BFgdVPaN.js +76 -0
  8. package/dist/assets/{agent-panel-CJva58SL.js → agent-panel-Dh7yWh9P.js} +5 -5
  9. package/dist/assets/ai-model-dropdown-DJ2elMLM.js +5 -0
  10. package/dist/assets/{any-language-editor-B7QvjaYO.js → any-language-editor-Cj_HzlZY.js} +1 -1
  11. package/dist/assets/app-config-button-DBCTefOX.js +1 -0
  12. package/dist/assets/{architectureDiagram-5GKGNRK7-CiRaYU5G.js → architectureDiagram-5GKGNRK7-7iukRoC9.js} +1 -1
  13. package/dist/assets/{blockDiagram-I7D4REHJ-BK3JcsXA.js → blockDiagram-I7D4REHJ-cuhpQB60.js} +1 -1
  14. package/dist/assets/{c4Diagram-7LVT6UL2-BbMz-zwF.js → c4Diagram-7LVT6UL2-CMQEYn6T.js} +1 -1
  15. package/dist/assets/{cache-panel-DxdmvFwH.js → cache-panel-C0oB1kE2.js} +1 -1
  16. package/dist/assets/{cells-BcQ8Tm3j.js → cells-CzugpTQu.js} +33 -33
  17. package/dist/assets/channel-CGdeorQk.js +1 -0
  18. package/dist/assets/{chat-display-TI342pMF.js → chat-display-DevO4F8W.js} +1 -1
  19. package/dist/assets/chat-panel-BGw0bqDk.js +4 -0
  20. package/dist/assets/{chat-ui-B1aeiWdr.js → chat-ui-CZZFGlZi.js} +4 -4
  21. package/dist/assets/{chunk-4HAMMTFA-F3WVmmmo.js → chunk-4HAMMTFA-C6Tl7kEY.js} +1 -1
  22. package/dist/assets/{chunk-75Z2AOVW-DA_lihEi.js → chunk-75Z2AOVW-BzzYECN7.js} +1 -1
  23. package/dist/assets/{chunk-DU6HZSFF-J-califE.js → chunk-DU6HZSFF-BlpgvKzl.js} +2 -2
  24. package/dist/assets/{chunk-F27PBJKO-BzJrz4xx.js → chunk-F27PBJKO-BVIgLGPF.js} +1 -1
  25. package/dist/assets/{chunk-GMAD6QVW-mXoq4V-T.js → chunk-GMAD6QVW-hv6IsAru.js} +1 -1
  26. package/dist/assets/{chunk-GVQU2GXP-B-87l3Xt.js → chunk-GVQU2GXP-Duv4ZYb-.js} +1 -1
  27. package/dist/assets/{chunk-IMKFNOWR-yy9Ec7ZM.js → chunk-IMKFNOWR-BIILwBhp.js} +1 -1
  28. package/dist/assets/{chunk-L3NEJ4N5-DLeZO9l0.js → chunk-L3NEJ4N5-B2hafvRU.js} +1 -1
  29. package/dist/assets/{chunk-OSK3NFVY-PWoOtECb.js → chunk-OSK3NFVY-SNGRdtNA.js} +1 -1
  30. package/dist/assets/{chunk-P2QGCYS3-DsJshZeL.js → chunk-P2QGCYS3-_SeE0QXb.js} +1 -1
  31. package/dist/assets/{chunk-POPQ4Y6H-CCg5TpSp.js → chunk-POPQ4Y6H-BB5NNJFE.js} +1 -1
  32. package/dist/assets/{chunk-PWAF6VOD-CrFPAGFi.js → chunk-PWAF6VOD-BZoBqp8x.js} +1 -1
  33. package/dist/assets/{chunk-SHT3W25Y-lri4OQTX.js → chunk-SHT3W25Y-BtLGdeDB.js} +1 -1
  34. package/dist/assets/{chunk-SVP7TREG-B3ISFgJc.js → chunk-SVP7TREG-B0UfxhUP.js} +1 -1
  35. package/dist/assets/{chunk-TICWLB2K-CJ7ETjY3.js → chunk-TICWLB2K-BP7vel_P.js} +1 -1
  36. package/dist/assets/classDiagram-ZZMXUADV-CoNXKNMZ.js +1 -0
  37. package/dist/assets/classDiagram-v2-VYDZK3BY-CoNXKNMZ.js +1 -0
  38. package/dist/assets/code-visibility-BFNYI7hr.js +1 -0
  39. package/dist/assets/command-palette-DN4JoOLD.js +1 -0
  40. package/dist/assets/{common-cDzShymV.js → common-DUCPhoyP.js} +1 -1
  41. package/dist/assets/{components-B3KlHXnD.js → components-CK7CeYlo.js} +1 -1
  42. package/dist/assets/components-DAmFBASm.js +1 -0
  43. package/dist/assets/config-B4VJJibu.js +1 -0
  44. package/dist/assets/{utils-B3E7otfg.js → config-BxZgoFvi.js} +1 -1
  45. package/dist/assets/config-DpGPGznL.js +1 -0
  46. package/dist/assets/{cynefinDiagram-5FMLGOSQ-1zl1wSTB.js → cynefinDiagram-5FMLGOSQ-BARZRQBb.js} +1 -1
  47. package/dist/assets/{dagre-DM-Ch8wC.js → dagre-DVyyr7Cb.js} +1 -1
  48. package/dist/assets/{dagre-GXQ25YYZ-BqoUeivc.js → dagre-GXQ25YYZ-79s0lOP0.js} +1 -1
  49. package/dist/assets/data-grid-overlay-editor-DPfnIudL.js +1 -0
  50. package/dist/assets/{dependency-graph-panel-C-SFFOPF.js → dependency-graph-panel-BN4CLayU.js} +3 -3
  51. package/dist/assets/{diagram-S7CK7UJ4-CF90sb1m.js → diagram-S7CK7UJ4-BCviGhvd.js} +1 -1
  52. package/dist/assets/{diagram-UQ7AKVKN-DgbZAUCH.js → diagram-UQ7AKVKN-Ds-BT46T.js} +1 -1
  53. package/dist/assets/{diagram-VSXAHHWV-DOQllF_r.js → diagram-VSXAHHWV-CK4GkM-q.js} +1 -1
  54. package/dist/assets/{diagram-VX7I27RA-6dC0a_-i.js → diagram-VX7I27RA-BtL2eh0t.js} +1 -1
  55. package/dist/assets/{diagram-Z3DM3KII-C1OXYmlB.js → diagram-Z3DM3KII-C6SmbLBS.js} +1 -1
  56. package/dist/assets/{dist-0HQ0BMF5.js → dist-CQvJDryh.js} +1 -1
  57. package/dist/assets/{documentation-panel-idK3s0j3.js → documentation-panel-CzRbXV5u.js} +1 -1
  58. package/dist/assets/{ebnfDiagram-PWID7BFC-7gC3cuC7.js → ebnfDiagram-PWID7BFC-D_JU4cMQ.js} +1 -1
  59. package/dist/assets/edit-page-jGNYBqQo.js +174 -0
  60. package/dist/assets/{erDiagram-RLTQ6QDP-BsE87b_i.js → erDiagram-RLTQ6QDP-Z9MJ6X-r.js} +1 -1
  61. package/dist/assets/{error-entries-C-LFkdXb.js → error-entries-CDSsy76p.js} +1 -1
  62. package/dist/assets/{error-panel-YAFgCest.js → error-panel-ABvjFG3p.js} +1 -1
  63. package/dist/assets/{feedback-button-sRQQL2TH.js → feedback-button-CZhLiwkO.js} +2 -2
  64. package/dist/assets/file-explorer-panel-DTiEpmVE.js +1 -0
  65. package/dist/assets/file-name-input-C1C8xrjA.js +3 -0
  66. package/dist/assets/filename-fxG7K_MU.js +1 -0
  67. package/dist/assets/flowDiagram-HODETNUW-ncLciK2K.js +1 -0
  68. package/dist/assets/{gallery-page-CH8TM7bV.js → gallery-page-Moi4ZdJ0.js} +1 -1
  69. package/dist/assets/{ganttDiagram-EL5Y4UJY-d9Qqbnau.js → ganttDiagram-EL5Y4UJY-Cgy11k0G.js} +1 -1
  70. package/dist/assets/{gitGraphDiagram-WWUBYQGX-DBunV_fz.js → gitGraphDiagram-WWUBYQGX-CVH8fay_.js} +1 -1
  71. package/dist/assets/glide-data-editor-CbsCWu-K.js +131 -0
  72. package/dist/assets/{graphlib-DDJ8O6ZH.js → graphlib-3maKwbRO.js} +1 -1
  73. package/dist/assets/has-cJsIKK9t.js +1 -0
  74. package/dist/assets/home-page-UAgVOkCZ.js +4 -0
  75. package/dist/assets/index--sT8xf-8.css +2 -0
  76. package/dist/assets/index-DafnX1Xx.js +62 -0
  77. package/dist/assets/{infoDiagram-27XIBGKW-FE7De1I6.js → infoDiagram-27XIBGKW-Dk8U81nJ.js} +1 -1
  78. package/dist/assets/{ishikawaDiagram-5VMMS53U-CSEGYrJ-.js → ishikawaDiagram-5VMMS53U-CzHQlMUQ.js} +1 -1
  79. package/dist/assets/{journeyDiagram-3NMN7TZE-Cp4mxQrE.js → journeyDiagram-3NMN7TZE-DRc8ACzh.js} +1 -1
  80. package/dist/assets/{kanban-definition-UXKFOSKX-d7iAZsOb.js → kanban-definition-UXKFOSKX-CVyVYiI6.js} +1 -1
  81. package/dist/assets/katex-DkE0ukCy.js +257 -0
  82. package/dist/assets/{logs-panel-xMj01DRN.js → logs-panel-Bz5ysVX4.js} +1 -1
  83. package/dist/assets/{mermaid-CNjXdDrA.js → mermaid-D_jPUVqz.js} +4 -4
  84. package/dist/assets/mhchem-CmzEtQj8.js +1 -0
  85. package/dist/assets/{mindmap-definition-YA3MSWOX-CddM9_uP.js → mindmap-definition-YA3MSWOX-D5t6Aq5Z.js} +1 -1
  86. package/dist/assets/{number-overlay-editor-N57if5NT.js → number-overlay-editor-FAD8sjFU.js} +1 -1
  87. package/dist/assets/{outline-panel-Garp-f5k.js → outline-panel-85oiQ0XX.js} +1 -1
  88. package/dist/assets/packages-panel-ClKIaP5S.js +1 -0
  89. package/dist/assets/{panels-CnbmgzkS.js → panels-B48zp96D.js} +9 -9
  90. package/dist/assets/{pegDiagram-XKGWAZYB-CEns8d-M.js → pegDiagram-XKGWAZYB-BTkTm4ej.js} +1 -1
  91. package/dist/assets/{pieDiagram-E7YTZNPT-wyb0xQ0R.js → pieDiagram-E7YTZNPT-Bq6X88M1.js} +1 -1
  92. package/dist/assets/{process-output-ObDfw1uu.js → process-output-Cg2ta3vY.js} +1 -1
  93. package/dist/assets/{quadrantDiagram-AXDQQJYC-BE-xlTLH.js → quadrantDiagram-AXDQQJYC-D_wrOwLk.js} +1 -1
  94. package/dist/assets/{railroadDiagram-O6MQD6OU-DZZVHmr2.js → railroadDiagram-O6MQD6OU-fv8HXW_g.js} +1 -1
  95. package/dist/assets/{requirementDiagram-BXWQKSXE-C3Bf4dd5.js → requirementDiagram-BXWQKSXE-DDOOMUfC.js} +1 -1
  96. package/dist/assets/{reveal-component-DgrXq3Kv.js → reveal-component-CR43gpTZ.js} +3 -3
  97. package/dist/assets/run-page-NR_KFWk8.js +1 -0
  98. package/dist/assets/{sankeyDiagram-P5KCCOFB-BWLQCyjK.js → sankeyDiagram-P5KCCOFB-CvvUY6tS.js} +1 -1
  99. package/dist/assets/scratchpad-panel-DHc-oVb1.js +1 -0
  100. package/dist/assets/{secrets-panel-4dRIaZfY.js → secrets-panel-C-65ZjnM.js} +1 -1
  101. package/dist/assets/{sequenceDiagram-WJ2MYXX4-BIY0mgX7.js → sequenceDiagram-WJ2MYXX4-DdpBhQaS.js} +1 -1
  102. package/dist/assets/session-DXKMv4Bs.js +1 -0
  103. package/dist/assets/session-panel-DiwQqIbt.js +1 -0
  104. package/dist/assets/{SelectionIndicator-DLJBcP4e.js → shell-BSnvn9t7.js} +1 -1
  105. package/dist/assets/snippets-panel-BLmXrneD.js +1 -0
  106. package/dist/assets/{stateDiagram-D77RDMKH-D_xRHRLf.js → stateDiagram-D77RDMKH-D3p19fac.js} +1 -1
  107. package/dist/assets/stateDiagram-v2-MP3YSRHH-CplsDaDl.js +1 -0
  108. package/dist/assets/{swimlanes-42K2YHIH-CDQzpfz0.js → swimlanes-42K2YHIH-CLxCSvU4.js} +1 -1
  109. package/dist/assets/swimlanesDiagram-VR7AAH4N-DPoIFx8T.js +8 -0
  110. package/dist/assets/{swiper-component-j-Lk25wW.js → swiper-component-rqJChT_P.js} +1 -1
  111. package/dist/assets/{terminal-BToH-U1t.js → terminal-CY4h1UmO.js} +1 -1
  112. package/dist/assets/{timeline-definition-24CTP7MA-D5Jgj1fz.js → timeline-definition-24CTP7MA-Cw2PY--x.js} +1 -1
  113. package/dist/assets/tooltip-PLkI_UfK.js +61 -0
  114. package/dist/assets/{tracing-DtKLmNHj.js → tracing-Q8NAdlrA.js} +1 -1
  115. package/dist/assets/tracing-panel-Ci4kY4dr.js +2 -0
  116. package/dist/assets/useCellActionButton-DpYtVfFe.js +1 -0
  117. package/dist/assets/useTheme-DcnXlv0_.js +1 -0
  118. package/dist/assets/{constants-BDbGiS7O.js → utils-B4K466FK.js} +1 -1
  119. package/dist/assets/{vega-component-DVSvu4vP.js → vega-component-BpoSew4K.js} +1 -1
  120. package/dist/assets/{vega-embed-container-QM1zZmYi.js → vega-embed-container-BOJG8mCA.js} +1 -1
  121. package/dist/assets/{vennDiagram-4TSXK5OY-Cv6jxbpX.js → vennDiagram-4TSXK5OY-D8bN6lVl.js} +1 -1
  122. package/dist/assets/{wardleyDiagram-VM6X3IG4-lwv-YoWo.js → wardleyDiagram-VM6X3IG4-CbZdo0SA.js} +1 -1
  123. package/dist/assets/{write-secret-modal-CBUZw27N.js → write-secret-modal-BiG2tahJ.js} +1 -1
  124. package/dist/assets/{xychartDiagram-S5SC5T6Z-CGM4LlFN.js → xychartDiagram-S5SC5T6Z-DUUQ9tau.js} +1 -1
  125. package/dist/assets/youtube-A9VT7NHb.js +1 -0
  126. package/dist/index.html +14 -13
  127. package/package.json +1 -2
  128. package/src/__mocks__/common.ts +3 -3
  129. package/src/__tests__/CellStatus.test.tsx +1 -1
  130. package/src/__tests__/setup.ts +7 -7
  131. package/src/components/app-config/ai-config.tsx +2 -0
  132. package/src/components/app-config/optional-features.tsx +1 -1
  133. package/src/components/chat/chat-panel.tsx +19 -8
  134. package/src/components/data-table/TableTopBar.tsx +2 -2
  135. package/src/components/data-table/__tests__/export-actions.test.tsx +662 -0
  136. package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +286 -0
  137. package/src/components/data-table/charts/charts.tsx +26 -13
  138. package/src/components/data-table/column-summary/chart-spec-model.tsx +4 -4
  139. package/src/components/data-table/data-table.tsx +1 -1
  140. package/src/components/data-table/export-actions.tsx +642 -176
  141. package/src/components/data-table/schemas.ts +25 -3
  142. package/src/components/dependency-graph/elements.ts +2 -2
  143. package/src/components/editor/__tests__/package-alert.test.tsx +140 -0
  144. package/src/components/editor/actions/__tests__/pair-with-agent.test.tsx +107 -0
  145. package/src/components/editor/actions/pair-with-agent.tsx +119 -0
  146. package/src/components/editor/actions/useNotebookActions.tsx +2 -1
  147. package/src/components/editor/ai/add-cell-with-ai.tsx +2 -0
  148. package/src/components/editor/ai/staged-cell-submission.ts +2 -2
  149. package/src/components/editor/ai/transport/chat-transport.tsx +1 -1
  150. package/src/components/editor/chrome/components/contribute-snippet-button.tsx +6 -1
  151. package/src/components/editor/connections/database/as-code.ts +44 -44
  152. package/src/components/editor/connections/storage/as-code.ts +3 -3
  153. package/src/components/editor/file-tree/requesting-tree.tsx +16 -13
  154. package/src/components/editor/navigation/clipboard.ts +2 -2
  155. package/src/components/editor/notebook-cell.tsx +2 -2
  156. package/src/components/editor/output/MarimoTracebackOutput.tsx +1 -1
  157. package/src/components/editor/output/VideoOutput.tsx +1 -1
  158. package/src/components/editor/output/ansi-reduce.ts +21 -17
  159. package/src/components/editor/output/console/ConsoleOutput.tsx +3 -3
  160. package/src/components/editor/output/console/__tests__/ConsoleOutput.test.tsx +59 -0
  161. package/src/components/editor/output/console/text-rendering.tsx +3 -1
  162. package/src/components/editor/package-alert.tsx +20 -7
  163. package/src/components/home/components.tsx +1 -0
  164. package/src/components/markdown/markdown-renderer.css +1 -1
  165. package/src/components/pages/run-page.tsx +1 -0
  166. package/src/components/slides/__tests__/minimap-actions.test.tsx +7 -7
  167. package/src/components/slides/__tests__/minimap.test.ts +12 -12
  168. package/src/components/slides/__tests__/slide-scroll-hint.test.tsx +8 -8
  169. package/src/components/static-html/__tests__/share-modal.test.tsx +154 -0
  170. package/src/components/static-html/__tests__/stage-for-publish.test.ts +111 -0
  171. package/src/components/static-html/share-modal.tsx +114 -144
  172. package/src/components/static-html/stage-for-publish.ts +56 -0
  173. package/src/components/static-html/static-banner.tsx +2 -2
  174. package/src/components/ui/links.tsx +6 -1
  175. package/src/components/ui/typography.tsx +16 -8
  176. package/src/core/ai/context/__tests__/registry.test.ts +31 -28
  177. package/src/core/ai/context/providers/cell-output.ts +8 -8
  178. package/src/core/ai/context/providers/datasource.ts +10 -7
  179. package/src/core/ai/context/providers/error.ts +7 -7
  180. package/src/core/ai/context/providers/file.ts +8 -8
  181. package/src/core/ai/context/providers/tables.ts +7 -7
  182. package/src/core/ai/context/providers/variable.ts +7 -7
  183. package/src/core/ai/context/registry.ts +18 -18
  184. package/src/core/ai/ids/ids.ts +5 -5
  185. package/src/core/ai/model-registry.ts +12 -9
  186. package/src/core/ai/staged-cells.ts +6 -6
  187. package/src/core/ai/tools/base.ts +6 -6
  188. package/src/core/ai/tools/edit-notebook-tool.ts +6 -6
  189. package/src/core/ai/tools/registry.ts +4 -4
  190. package/src/core/ai/tools/run-cells-tool.ts +7 -7
  191. package/src/core/ai/tools/sample-tool.ts +6 -6
  192. package/src/core/cells/__tests__/cells.test.ts +27 -0
  193. package/src/core/cells/cells.ts +2 -1
  194. package/src/core/codemirror/cells/debugger-decorations.ts +13 -7
  195. package/src/core/codemirror/cells/line-timing-decorations.ts +9 -9
  196. package/src/core/codemirror/cells/traceback-decorations.ts +7 -4
  197. package/src/core/codemirror/code-lens/extension.ts +13 -13
  198. package/src/core/codemirror/copilot/__tests__/language-server.test.ts +6 -6
  199. package/src/core/codemirror/copilot/__tests__/transport.test.ts +12 -12
  200. package/src/core/codemirror/copilot/language-server.ts +13 -13
  201. package/src/core/codemirror/copilot/transport.ts +1 -1
  202. package/src/core/codemirror/find-replace/search-highlight.ts +5 -5
  203. package/src/core/codemirror/go-to-definition/underline.ts +3 -3
  204. package/src/core/codemirror/keymaps/vim.ts +3 -3
  205. package/src/core/codemirror/language/languages/markdown.ts +8 -8
  206. package/src/core/codemirror/language/languages/python.ts +7 -7
  207. package/src/core/codemirror/language/languages/sql/completion-builder.ts +5 -5
  208. package/src/core/codemirror/language/languages/sql/completion-store.ts +4 -4
  209. package/src/core/codemirror/language/languages/sql/sql.ts +21 -21
  210. package/src/core/codemirror/lsp/__tests__/transports.test.ts +10 -10
  211. package/src/core/codemirror/lsp/federated-lsp.ts +29 -27
  212. package/src/core/codemirror/lsp/notebook-lsp.ts +21 -21
  213. package/src/core/codemirror/misc/__tests__/dnd.test.ts +10 -10
  214. package/src/core/codemirror/misc/__tests__/paste.test.ts +7 -4
  215. package/src/core/codemirror/reactive-references/extension.ts +3 -3
  216. package/src/core/codemirror/rtc/loro/awareness.ts +12 -12
  217. package/src/core/codemirror/rtc/loro/sync.ts +5 -5
  218. package/src/core/codemirror/vim/cursor-visibility.ts +3 -3
  219. package/src/core/dom/ui-element.ts +5 -5
  220. package/src/core/dom/uiregistry.ts +10 -10
  221. package/src/core/hotkeys/hotkeys.ts +9 -9
  222. package/src/core/islands/__tests__/bridge.test.ts +4 -4
  223. package/src/core/islands/__tests__/test-utils.tsx +4 -4
  224. package/src/core/islands/bridge.ts +85 -82
  225. package/src/core/islands/components/web-components.tsx +7 -7
  226. package/src/core/islands/worker/__tests__/controller.test.ts +1 -1
  227. package/src/core/islands/worker/controller.ts +6 -3
  228. package/src/core/islands/worker-factory.ts +2 -2
  229. package/src/core/kernel/RuntimeState.ts +4 -4
  230. package/src/core/kernel/__tests__/session.test.ts +110 -1
  231. package/src/core/kernel/session.ts +46 -15
  232. package/src/core/lsp/__tests__/transport.test.ts +19 -19
  233. package/src/core/lsp/transport.ts +5 -5
  234. package/src/core/network/CachingRequestRegistry.ts +2 -2
  235. package/src/core/network/DeferredRequestRegistry.ts +4 -4
  236. package/src/core/network/__tests__/export-asset-url.test.ts +45 -0
  237. package/src/core/network/export-asset-url.ts +19 -0
  238. package/src/core/network/requests-network.ts +2 -7
  239. package/src/core/runtime/runtime.ts +25 -20
  240. package/src/core/static/virtual-file-tracker.ts +5 -5
  241. package/src/core/wasm/__tests__/bridge.test.ts +2 -2
  242. package/src/core/wasm/bridge.ts +132 -133
  243. package/src/core/wasm/router.ts +5 -5
  244. package/src/core/wasm/store.ts +4 -4
  245. package/src/core/wasm/worker/bootstrap.ts +8 -5
  246. package/src/core/wasm/worker/message-buffer.ts +3 -3
  247. package/src/core/websocket/transports/__tests__/ws.test.ts +8 -8
  248. package/src/core/websocket/transports/basic.ts +15 -8
  249. package/src/core/websocket/transports/sse.ts +7 -7
  250. package/src/core/websocket/transports/transport.ts +3 -3
  251. package/src/core/websocket/transports/ws.ts +9 -7
  252. package/src/css/globals.css +18 -21
  253. package/src/css/katex.min.css +260 -241
  254. package/src/hooks/__tests__/useOverflowDetection.test.tsx +5 -5
  255. package/src/hooks/__tests__/useResizeObserver.test.tsx +12 -12
  256. package/src/plugins/core/registerReactComponent.tsx +5 -5
  257. package/src/plugins/core/sidebar-element.tsx +2 -2
  258. package/src/plugins/impl/ButtonPlugin.tsx +3 -3
  259. package/src/plugins/impl/CheckboxPlugin.tsx +3 -3
  260. package/src/plugins/impl/CodeEditorPlugin.tsx +3 -3
  261. package/src/plugins/impl/DatePickerPlugin.tsx +3 -3
  262. package/src/plugins/impl/DateRangePlugin.tsx +3 -3
  263. package/src/plugins/impl/DateTimePickerPlugin.tsx +3 -3
  264. package/src/plugins/impl/DictPlugin.tsx +3 -3
  265. package/src/plugins/impl/DropdownPlugin.tsx +3 -3
  266. package/src/plugins/impl/FileUploadPlugin.tsx +3 -3
  267. package/src/plugins/impl/MatrixPlugin.tsx +4 -4
  268. package/src/plugins/impl/MicrophonePlugin.tsx +3 -3
  269. package/src/plugins/impl/MultiselectPlugin.tsx +3 -3
  270. package/src/plugins/impl/NumberPlugin.tsx +3 -3
  271. package/src/plugins/impl/RadioPlugin.tsx +9 -5
  272. package/src/plugins/impl/RangeSliderPlugin.tsx +3 -3
  273. package/src/plugins/impl/RefreshPlugin.tsx +3 -3
  274. package/src/plugins/impl/SliderPlugin.tsx +3 -3
  275. package/src/plugins/impl/SwitchPlugin.tsx +3 -3
  276. package/src/plugins/impl/TabsPlugin.tsx +3 -3
  277. package/src/plugins/impl/TextAreaPlugin.tsx +3 -3
  278. package/src/plugins/impl/TextInputPlugin.tsx +3 -3
  279. package/src/plugins/impl/__tests__/MatrixPlugin.test.tsx +2 -2
  280. package/src/plugins/impl/anywidget/model.ts +10 -10
  281. package/src/plugins/impl/anywidget/registry.ts +12 -9
  282. package/src/plugins/impl/anywidget/runtime.ts +11 -9
  283. package/src/plugins/impl/anywidget/widget-binding.ts +6 -6
  284. package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +7 -6
  285. package/src/plugins/impl/matplotlib/MatplotlibPlugin.tsx +3 -3
  286. package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +2 -2
  287. package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +2 -2
  288. package/src/plugins/impl/mpl-interactive/mpl-websocket-shim.ts +10 -10
  289. package/src/plugins/impl/panel/utils.ts +5 -5
  290. package/src/plugins/impl/plotly/PlotlyPlugin.tsx +3 -3
  291. package/src/plugins/impl/vega/VegaPlugin.tsx +3 -3
  292. package/src/plugins/impl/vega/__tests__/use-vega-container-remeasure.test.ts +7 -7
  293. package/src/plugins/impl/vega/__tests__/utils.test.ts +16 -1
  294. package/src/plugins/impl/vega/__tests__/vega.test.ts +37 -0
  295. package/src/plugins/impl/vega/loader.ts +23 -1
  296. package/src/plugins/impl/vega/utils.ts +5 -4
  297. package/src/plugins/layout/AccordionPlugin.tsx +3 -3
  298. package/src/plugins/layout/CalloutPlugin.tsx +3 -3
  299. package/src/plugins/layout/ImageComparisonPlugin.tsx +5 -3
  300. package/src/plugins/layout/JsonOutputPlugin.tsx +3 -3
  301. package/src/plugins/layout/MimeRenderPlugin.tsx +3 -3
  302. package/src/plugins/layout/NavigationMenuPlugin.tsx +3 -3
  303. package/src/plugins/layout/OutlinePlugin.tsx +3 -3
  304. package/src/plugins/layout/ProgressPlugin.tsx +3 -3
  305. package/src/plugins/layout/RoutesPlugin.tsx +6 -8
  306. package/src/plugins/layout/StatPlugin.tsx +3 -3
  307. package/src/plugins/layout/TexPlugin.tsx +3 -3
  308. package/src/plugins/layout/carousel/CarouselPlugin.tsx +4 -4
  309. package/src/plugins/layout/mermaid/MermaidPlugin.tsx +3 -3
  310. package/src/utils/Deferred.ts +6 -6
  311. package/src/utils/async-capture-tracker.ts +10 -7
  312. package/src/utils/errors.ts +5 -5
  313. package/src/utils/id-tree.tsx +83 -80
  314. package/src/utils/lru.ts +1 -1
  315. package/src/utils/multi-map.ts +14 -12
  316. package/src/utils/paths.ts +6 -6
  317. package/src/utils/pluralize.ts +3 -3
  318. package/src/utils/progress.ts +6 -6
  319. package/src/utils/python-poet/poet.ts +14 -14
  320. package/src/utils/routes.ts +4 -2
  321. package/src/utils/semaphore.ts +6 -6
  322. package/src/utils/storage/storage.ts +6 -6
  323. package/src/utils/storage/typed.ts +16 -12
  324. package/src/utils/time.ts +9 -9
  325. package/src/utils/timed-cache.ts +4 -4
  326. package/src/utils/tracer.ts +9 -6
  327. package/dist/assets/LazyAnyLanguageCodeMirror-EBegnOE0.js +0 -2
  328. package/dist/assets/add-cell-with-ai-Ovbsj95O.js +0 -76
  329. package/dist/assets/ai-model-dropdown-1t7m1iFc.js +0 -3
  330. package/dist/assets/app-config-button-vCxNGhe2.js +0 -1
  331. package/dist/assets/channel-ni7ei-yz.js +0 -1
  332. package/dist/assets/chat-panel-CzdR8RG_.js +0 -4
  333. package/dist/assets/classDiagram-ZZMXUADV-CIEFh40S.js +0 -1
  334. package/dist/assets/classDiagram-v2-VYDZK3BY-CIEFh40S.js +0 -1
  335. package/dist/assets/code-visibility-G0W4ym3Y.js +0 -1
  336. package/dist/assets/command-palette-DhdK67bL.js +0 -1
  337. package/dist/assets/components-CQVZgYvR.js +0 -1
  338. package/dist/assets/config-CMqNngzA.js +0 -1
  339. package/dist/assets/config-CmBpjGXk.js +0 -1
  340. package/dist/assets/data-grid-overlay-editor-DbqMOWZn.js +0 -1
  341. package/dist/assets/edit-page-_D_Nv3dJ.js +0 -176
  342. package/dist/assets/file-explorer-panel-LAa-LxTN.js +0 -1
  343. package/dist/assets/file-name-input-BXq6eIDs.js +0 -3
  344. package/dist/assets/flowDiagram-HODETNUW-B4xRBXB1.js +0 -1
  345. package/dist/assets/glide-data-editor-DPMjaN4R.js +0 -131
  346. package/dist/assets/has-CanCEarv.js +0 -1
  347. package/dist/assets/home-page-vDWLpS4F.js +0 -4
  348. package/dist/assets/index-2TQenOiQ.css +0 -2
  349. package/dist/assets/index-CgQsZfww.js +0 -62
  350. package/dist/assets/katex-mNPPSsir.js +0 -257
  351. package/dist/assets/katex-ukvJUC1e.js +0 -257
  352. package/dist/assets/mhchem-DcHTrqjv.js +0 -1
  353. package/dist/assets/packages-panel-B8HU9FAM.js +0 -1
  354. package/dist/assets/run-page-E0qMru0p.js +0 -1
  355. package/dist/assets/scratchpad-panel-CCFyaegO.js +0 -1
  356. package/dist/assets/session-C8nQMsOE.js +0 -1
  357. package/dist/assets/session-panel-CR3BHLhQ.js +0 -1
  358. package/dist/assets/snippets-panel-Dn22yTr_.js +0 -1
  359. package/dist/assets/stateDiagram-v2-MP3YSRHH-BQvYFx_a.js +0 -1
  360. package/dist/assets/swimlanesDiagram-VR7AAH4N-BAn2JKhB.js +0 -8
  361. package/dist/assets/tooltip-B1vGi-z4.js +0 -61
  362. package/dist/assets/tracing-panel-C5ybTQyJ.js +0 -2
  363. package/dist/assets/useCellActionButton-Bm9OZdcq.js +0 -1
  364. package/dist/assets/useTheme-Ho3YdAx3.js +0 -1
  365. package/dist/assets/youtube-ELpGJEdR.js +0 -1
@@ -1,22 +1,22 @@
1
- import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,d as n,f as r,l as i,o as a,r as o,s,t as c,u as l}from"./useEvent-Dc9HkKI2.js";import{t as u}from"./react-CUdNIagt.js";import{$i as d,Bn as f,Br as p,Bt as m,Ca as h,Ci as g,Co as _,Cr as v,D as y,Dr as b,Fr as x,H as S,I as C,Ir as w,K as ee,Lr as te,Lt as T,Ni as E,Nn as ne,Nr as D,Pr as re,Qi as ie,Qr as ae,Ri as O,Rr as k,Si as oe,U as se,Ur as ce,V as le,Vn as ue,W as de,Wr as fe,Yn as pe,Zn as me,_i as he,_n as ge,_t as _e,a as ve,ai as ye,ar as be,at as xe,b as Se,ba as Ce,bi as we,bt as Te,ca as Ee,ci as De,cn as Oe,cr as ke,d as Ae,dr as je,dt as Me,f as Ne,fi as Pe,fn as Fe,fo as Ie,ft as Le,ga as Re,gn as ze,gt as Be,h as Ve,ha as He,ht as Ue,i as We,it as Ge,jo as Ke,jr as qe,li as Je,lr as Ye,mn as Xe,mt as Ze,ni as Qe,nr as $e,or as et,ot as tt,pi as nt,pt as rt,qa as it,ri as at,rr as ot,sa as st,si as ct,sr as lt,ti as ut,tr as dt,tt as ft,u as pt,ui as mt,un as ht,ur as gt,vn as _t,vr as vt,vt as yt,wa as bt,wi as xt,xa as St,xi as Ct,xo as wt,yi as Tt,za as Et,zr as A}from"./cells-BcQ8Tm3j.js";import{t as Dt}from"./react-dom-CKsE8sC1.js";import{A as Ot,E as kt,I as At,P as jt,S as Mt,j as Nt,x as Pt,y as Ft}from"./schemas-BL-NsLlF.js";import{t as It}from"./compiler-runtime-BQ9S8nyo.js";import{t as Lt}from"./debounce-aFmHgJZY.js";import{D as Rt,_ as zt,c as Bt,g as Vt,l as Ht,o as Ut,v as Wt}from"./utils-B3E7otfg.js";import{A as Gt,E as Kt,S as qt,_ as Jt,g as Yt,h as Xt,k as Zt,m as Qt,t as $t,v as en}from"./ai-model-dropdown-1t7m1iFc.js";import{_ as tn,c as nn,g as rn,m as an,t as on}from"./useEventListener-BdZUApHd.js";import{t as sn}from"./objects-snlMn4yk.js";import{t as cn}from"./invariant-Ci2dTZ72.js";import{E as ln,F as un,O as dn,P as fn,S as pn,T as mn,_ as hn,m as gn,o as _n,p as vn,r as yn,u as bn,z as xn}from"./config-CmBpjGXk.js";import{t as Sn}from"./ErrorBoundary-DrliQ_7g.js";import{n as Cn,t as wn}from"./cn-ldLVeaqm.js";import{t as Tn}from"./jsx-runtime-B74pBk57.js";import{d as En}from"./select-BplWpfFo.js";import{t as Dn}from"./tooltip-DR2Z2N4w.js";import{r as On,t as kn}from"./button-BoklZTGL.js";import{t as An}from"./createLucideIcon-rHn2EdoM.js";import{i as jn,n as Mn}from"./paths-CzfpItSz.js";import{$ as Nn,V as Pn,l as Fn,p as In,u as Ln}from"./panels-CnbmgzkS.js";import{B as Rn,F as zn,G as Bn,I as Vn,L as Hn,M as Un,R as Wn,T as Gn,V as Kn,W as qn,Y as Jn,c as Yn,f as Xn,i as Zn,n as Qn,o as $n,r as er,s as tr,w as nr,z as rr}from"./add-cell-with-ai-Ovbsj95O.js";import{r as ir}from"./useNumberFormatter-C4-_TnkF.js";import{c as ar,l as or,n as sr,t as cr}from"./toDate-BbJ1_N2T.js";import{t as lr}from"./database-zap-CrkOvbyN.js";import{b as ur}from"./write-secret-modal-CBUZw27N.js";import{a as dr,i as fr,n as pr,r as mr}from"./process-output-ObDfw1uu.js";import{$ as hr,At as gr,Ft as _r,Gt as vr,Ht as yr,I as br,Kt as xr,Mt as Sr,P as Cr,Pt as wr,Q as Tr,Wt as Er,Xt as Dr,jt as Or,rt as kr}from"./input-BDakodZ2.js";import{n as Ar}from"./copy-BhJktFeI.js";import{t as jr}from"./use-toast-CC89xOwH.js";import{$t as Mr,At as Nr,Bt as Pr,Ct as Fr,Dt as Ir,E as Lr,Et as Rr,Ft as zr,Gt as Br,H as Vr,Ht as Hr,I as Ur,J as Wr,Jt as Gr,L as Kr,Lt as qr,M as Jr,P as Yr,Pt as Xr,Qt as Zr,Rt as Qr,St as $r,Tt as ei,Ut as ti,V as ni,Wt as ri,Yt as ii,Zt as j,_ as ai,at as M,bt as oi,ct as si,dt as ci,en as li,gt as ui,ht as di,lt as fi,m as pi,ot as mi,qt as hi,rn as gi,st as N,ut as _i,w as vi,xt as yi}from"./dist-BczecT6V.js";import{C as bi,E as xi,I as Si,O as Ci,S as wi,a as Ti,c as Ei,n as Di,r as Oi,w as ki}from"./dist-BTskHGpb.js";import{o as Ai}from"./arrays-BqUx5USx.js";import{n as ji}from"./once-Haz_uxEL.js";import{t as Mi}from"./createReducer-BPvK7C_R.js";import{a as Ni,c as Pi,f as Fi,h as Ii,i as Li,l as Ri,n as zi,o as Bi,t as Vi}from"./dist-Ccyblc8N.js";import{r as Hi}from"./strings-BHZPE0Mc.js";import{r as Ui,t as Wi}from"./requests-yTHMxhVa.js";import{t as Gi}from"./badge-DFf033uX.js";import{o as Ki}from"./dist-DueXZKz9.js";import{t as qi}from"./Deferred-CrTnjj37.js";import{t as Ji}from"./session-C8nQMsOE.js";import{r as Yi}from"./useTheme-Ho3YdAx3.js";import{t as Xi}from"./context-BFOBKCJB.js";import{i as Zi}from"./numbers-DsgsDslU.js";import{n as Qi}from"./useAsyncData-DucTwMkf.js";import{a as $i}from"./errors-D9vyuMar.js";import{Bi as ea,Br as ta,En as na,Et as ra,Kt as ia,Li as aa,Mi as oa,O as sa,Or as ca,Pr as la,Si as ua,Tn as da,Vi as fa,Vr as P,Wt as pa,Yi as ma,_a as ha,a as ga,ar as _a,b as va,h as ya,jr as ba,k as xa,ka as Sa,or as Ca,p as wa,pa as Ta,pi as Ea,qi as Da,ua as Oa,w as ka,x as Aa,xa as ja,za as Ma,zi as Na,zr as Pa,zt as Fa}from"./index-CgQsZfww.js";import{t as Ia}from"./skeleton-CKpBjoLm.js";import{t as La}from"./github-khsXwCtv.js";import{n as Ra,t as za}from"./useInterval-ChchS0Rl.js";var Ba=An(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Va=An(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),Ha=An(`hard-drive-download`,[[`path`,{d:`M12 2v8`,key:`1q4o3n`}],[`path`,{d:`m16 6-4 4-4-4`,key:`6wukr`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M10 18h.01`,key:`h775k`}]]),Ua=An(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Wa=An(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Ga=An(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),F=e(u(),1);function Ka(e,t){let{"aria-label":n,"aria-labelledby":r,orientation:i=`horizontal`}=e,[a,o]=(0,F.useState)(!1);yr(()=>{o(!!(t.current&&t.current.parentElement?.closest(`[role="toolbar"]`)))});let{direction:s}=Xi(),c=s===`rtl`&&i===`horizontal`,l=Da(t),u=e=>{if(Sr(e.currentTarget,_r(e))){if(i===`horizontal`&&e.key===`ArrowRight`||i===`vertical`&&e.key===`ArrowDown`)c?l.focusPrevious():l.focusNext();else if(i===`horizontal`&&e.key===`ArrowLeft`||i===`vertical`&&e.key===`ArrowUp`)c?l.focusNext():l.focusPrevious();else if(e.key===`Tab`){e.stopPropagation(),d.current=wr(),e.shiftKey?l.focusFirst():l.focusLast();return}else return;e.stopPropagation(),e.preventDefault()}},d=(0,F.useRef)(null),f=e=>{!Sr(e.currentTarget,e.relatedTarget)&&!d.current&&(d.current=_r(e))},p=e=>{if(d.current&&!Sr(e.currentTarget,e.relatedTarget)&&Sr(t.current,_r(e))){var n;(n=d.current)==null||n.focus(),d.current=null}};return{toolbarProps:{...gr(e,{labelable:!0}),role:a?`group`:`toolbar`,"aria-orientation":i,"aria-label":n,"aria-labelledby":n==null?r:void 0,onKeyDownCapture:a?void 0:u,onFocusCapture:a?void 0:p,onBlurCapture:a?void 0:f}}}var qa=(0,F.createContext)({}),Ja=(0,F.forwardRef)(function(e,t){[e,t]=Tr(e,t,qa);let{toolbarProps:n}=Ka(e,t),r=hr({...e,values:{orientation:e.orientation||`horizontal`},defaultClassName:`react-aria-Toolbar`}),i=gr(e,{global:!0});return delete i.id,F.createElement(kr.div,{...Or(i,r,n),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`horizontal`},r.children)});function Ya(e,t){let n=+cr(e)-cr(t);return n<0?-1:n>0?1:n}function Xa(e){return sr(e,Date.now())}function Za(e,t,n){let[r,i]=Na(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Qa(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function $a(e,t){return+cr(e)-cr(t)}function eo(e,t){let n=cr(e,t?.in);return n.setHours(23,59,59,999),n}function to(e,t){let n=cr(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function no(e,t){let n=cr(e,t?.in);return+eo(n,t)==+to(n,t)}function ro(e,t,n){let[r,i,a]=Na(n?.in,e,e,t),o=Ya(i,a),s=Math.abs(Za(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=Ya(i,a)===-o;no(r)&&s===1&&Ya(r,a)===1&&(c=!1);let l=o*(s-+c);return l===0?0:l}function io(e,t,n){let r=$a(e,t)/1e3;return Qa(n?.roundingMethod)(r)}function ao(e,t,n){let r=fa(),i=n?.locale??r.locale??aa,a=Ya(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=Na(n?.in,...a>0?[t,e]:[e,t]),l=io(c,s),u=(ea(c)-ea(s))/1e3,d=Math.round((l-u)/60),f;if(d<2)return n?.includeSeconds?l<5?i.formatDistance(`lessThanXSeconds`,5,o):l<10?i.formatDistance(`lessThanXSeconds`,10,o):l<20?i.formatDistance(`lessThanXSeconds`,20,o):l<40?i.formatDistance(`halfAMinute`,0,o):l<60?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,1,o):d===0?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,d,o);if(d<45)return i.formatDistance(`xMinutes`,d,o);if(d<90)return i.formatDistance(`aboutXHours`,1,o);if(d<1440){let e=Math.round(d/60);return i.formatDistance(`aboutXHours`,e,o)}if(d<2520)return i.formatDistance(`xDays`,1,o);if(d<43200){let e=Math.round(d/ar);return i.formatDistance(`xDays`,e,o)}if(d<86400)return f=Math.round(d/or),i.formatDistance(`aboutXMonths`,f,o);if(f=ro(c,s),f<12){let e=Math.round(d/or);return i.formatDistance(`xMonths`,e,o)}{let e=f%12,t=Math.trunc(f/12);return e<3?i.formatDistance(`aboutXYears`,t,o):e<9?i.formatDistance(`overXYears`,t,o):i.formatDistance(`almostXYears`,t+1,o)}}function oo(e,t){return ao(e,Xa(e),t)}var so=e(Dt(),1),co=e(Ke(),1),I=It(),L=Tn(),lo=h(),uo=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function fo(e,t,n,r,i,a){if(e==r)return[];let o=So(e,t,n,r,i,a),s=Co(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new uo(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new uo(t,t+o,i,i),new uo(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new uo(t,t,i,i+o),new uo(n,n,i+o+c,a)]}if(c==1||l==1)return[new uo(t,n,i,a)];let u=To(e,t,n,r,i,a);if(u){let[o,s,c]=u;return fo(e,t,o,r,i,s).concat(fo(e,o+c,n,r,s+c,a))}return go(e,t,n,r,i,a)}var po=1e9,mo=0,ho=!1;function go(e,t,n,r,i,a){let o=n-t,s=a-i;if(po<1e9&&Math.min(o,s)>po*16||mo>0&&Date.now()>mo)return Math.min(o,s)>po*64?[new uo(t,n,i,a)]:Eo(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);vo.reset(c),yo.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:yo,f=d?null:vo;for(let p=0;p<c;p++){if(p>po||mo>0&&!(p&63)&&Date.now()>mo)return Eo(e,t,n,r,i,a);let m=vo.advance(p,o,s,c,d,!1,l)||yo.advance(p,o,s,c,f,!0,u);if(m)return bo(e,t,n,t+m[0],r,i,a,i+m[1])}return[new uo(t,n,i,a)]}var _o=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1){if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}}return null}},vo=new _o,yo=new _o;function bo(e,t,n,r,i,a,o,s){let c=!1;return!Vo(e,r)&&++r==n&&(c=!0),!Vo(i,s)&&++s==o&&(c=!0),c?[new uo(t,n,a,o)]:fo(e,t,r,i,a,s).concat(fo(e,r,n,i,s,o))}function xo(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function So(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=xo(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!Vo(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function Co(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=xo(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!Vo(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function wo(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){Vo(e,s)||s++;let u=s+o;if(Vo(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=So(e,u,n,r,i+f+d.length,a),c=Co(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function To(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=To(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:wo(e,t,n,r,i,a,Math.floor(o/4),-1)}function Eo(e,t,n,r,i,a){ho=!0;let o=n-t,s=a-i,c;if(o<s){let s=wo(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=wo(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new uo(t,n,i,a)];let[l,u,d]=c;return fo(e,t,l,r,i,u).concat(fo(e,l+d,n,r,u+d,a))}function Do(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new uo(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function Oo(e,t,n){for(;;){Do(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=So(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new uo(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=Co(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new uo(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new uo(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new uo(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function ko(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=Io(t,a.fromA,l),f=Fo(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new uo(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=Fo(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new uo(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=Io(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new uo(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Ro(n,a.fromB,a.toB),r,o=t<0?-1:Lo(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=Ro(t,a.fromA,a.toA),r,o=n<0?-1:Lo(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return Do(e,3),e}var Ao;try{Ao=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function jo(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Mo(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!jo(n):Ao?!zo(n)||t==e.length-1?+!!Ao.test(String.fromCharCode(n)):Ao.test(e.slice(t,t+2))?2:0:0}function No(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!jo(n):Ao?!Bo(n)||t==1?+!!Ao.test(String.fromCharCode(n)):Ao.test(e.slice(t-2,t))?2:0:0}var Po=8;function Fo(e,t,n){if(t==e.length||!No(e,t))return t;for(let r=t,i=t+n,a=0;a<Po;a++){let t=Mo(e,r);if(!t||r+t>i)return r;r+=t}return t}function Io(e,t,n){if(!t||!Mo(e,t))return t;for(let r=t,i=t-n,a=0;a<Po;a++){let t=No(e,r);if(!t||r-t<i)return r;r-=t}return t}function Lo(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Ro(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var zo=e=>e>=55296&&e<=56319,Bo=e=>e>=56320&&e<=57343;function Vo(e,t){return!t||t==e.length||!zo(e.charCodeAt(t-1))||!Bo(e.charCodeAt(t))}function Ho(e,t,n){let r=n?.override;return r?r(e,t):(po=(n?.scanLimit??1e9)>>1,mo=n?.timeout?Date.now()+n.timeout:0,ho=!1,Oo(e,t,fo(e,0,e.length,t,0,t.length)))}function Uo(){return!ho}function Wo(e,t,n){return ko(Ho(e,t,n),e,t)}var Go=Br.define({combine:e=>e[0]}),Ko=j.define(),qo=Br.define(),Jo=Zr.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Ko)&&(e=n.value);for(let n of t.state.facet(qo))e=n(e,t);return e}}),Yo=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Qo(Wo(e.toString(),t.toString(),n),e,t,0,0,Uo())}static updateA(e,t,n,r,i){return ns(ts(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return ns(ts(e,r,!1,t.length),e,t,n,i)}};function Xo(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function Zo(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function Qo(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Xo(c.fromA+r,c.fromB+i,t,n),[d,f]=Zo(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=Xo(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=Zo(a.toA+r,a.toB+i,t,n),s++}o.push(new Yo(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var $o=1e3;function es(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function ts(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>$o&&([l,d]=es(e,a-$o,n,!0)),o<t.length-$o&&([u,f]=es(e,o+$o,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function ns(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=Wo(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Qo(h,n,r,d,f,Uo()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var rs={scanLimit:500},is=_i.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=ms(e))}update(e){(e.docChanged||e.viewportChanged||os(e.startState,e.state)||ss(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=ms(e.view))}},{decorations:e=>e.deco}),as=hi.low(oi({class:`cm-changeGutter`,markers:e=>e.plugin(is)?.gutter||Gr.empty}));function os(e,t){return e.field(Jo,!1)!=t.field(Jo,!1)}function ss(e,t){return e.facet(Go)!=t.facet(Go)}var cs=M.line({class:`cm-changedLine`}),ls=M.mark({class:`cm-changedText`}),us=M.mark({tagName:`ins`,class:`cm-insertedLine`}),ds=M.mark({tagName:`del`,class:`cm-deletedLine`}),fs=new class extends si{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function ps(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,cs),i.add(o,s,n?ds:us),a&&a.add(o,o,fs);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,cs),a&&a.add(u,u,fs);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,ls),s<t)c++;else break}u=t}}}function ms(e){let t=e.state.field(Jo),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(Go),o=n==`a`,s=new ii,c=i?new ii:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&ps(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var hs=class extends ci{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},gs=j.define({map:(e,t)=>e.map(t)}),_s=Zr.define({create:()=>M.none,update:(e,t)=>{for(let e of t.effects)if(e.is(gs))return e.value;return e.map(t.changes)},provide:e=>N.decorations.from(e)}),vs=.01;function ys(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function bs(e,t,n){let r=new ii,i=new ii,a=e.state.field(_s).iter(),o=t.state.field(_s).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-.01?(l-=n,r.add(s,s,M.widget({widget:new hs(-n),block:!0,side:-1}))):n>vs&&(u+=n,i.add(c,c,M.widget({widget:new hs(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<vs?r.add(e.state.doc.length,e.state.doc.length,M.widget({widget:new hs(-p),block:!0,side:1})):p>vs&&i.add(t.state.doc.length,t.state.doc.length,M.widget({widget:new hs(p),block:!0,side:1}));let m=r.finish(),h=i.finish();ys(m,e.state.field(_s))||e.dispatch({effects:gs.of(m)}),ys(h,t.state.field(_s))||t.dispatch({effects:gs.of(h)})}var xs=j.define({map:(e,t)=>t.mapPos(e)}),Ss=class extends ci{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:xs.of(n)});let{side:r,sibling:i}=e.state.facet(Go);i&&i().dispatch({effects:xs.of(Cs(n,e.state.field(Jo),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Cs(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var ws=Zr.define({create(e){return M.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(xs)&&(e=e.update({filter:e=>e!=n.value}));if(e.size&&t.state.field(Jo)!=t.startState.field(Jo,!1)){let n=t.state.facet(Go).side==`a`,r=[];for(let i of t.state.field(Jo))e.between(n?i.fromA:i.fromB,n?i.toA:i.toB,e=>{r.push(e)});r.length&&(e=e.update({filter:e=>r.indexOf(e)<0}))}return e},provide:e=>N.decorations.from(e)});function Ts({margin:e=3,minSize:t=4}){return ws.init(n=>Es(n,e,t))}function Es(e,t,n){let r=new ii,i=e.facet(Go).side==`a`,a=e.field(Jo),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,M.replace({widget:new Ss(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var Ds=N.styleModule.of(new qr({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),Os=N.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),ks=new Hr,As=new Hr,js=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||rs;let t=[hi.low(is),Os,Ds,_s,N.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(gs)))&&this.measure()})],n=[Go.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(as);let r=ri.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],N.editorAttributes.of({class:`cm-merge-a`}),As.of(n),t]}),i=[Go.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(as);let a=ri.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],N.editorAttributes.of({class:`cm-merge-b`}),As.of(i),t]});this.chunks=Yo.build(r.doc,a.doc,this.diffConf);let o=[Jo.init(()=>this.chunks),ks.of(e.collapseUnchanged?Ts(e.collapseUnchanged):[])];r=r.update({effects:j.appendConfig.of(o)}).state,a=a.update({effects:j.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new N({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new N({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),Pr.empty(e[0].startState.doc.length));this.chunks=t==this.a?Yo.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Yo.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Ko.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Ko.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(Go),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(As.reconfigure([Go.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?as:[]])),a.push(As.reconfigure([Go.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?as:[]]))}if(r){let t=ks.reconfigure(e.collapseUnchanged?Ts(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){bs(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=Ms(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=Ms(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function Ms(e){let t=e.nextSibling;return e.remove(),t}var Ns=new class extends si{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},Ps=hi.low(oi({class:`cm-changeGutter`,markers:e=>e.plugin(is)?.gutter||Gr.empty,widgetMarker:(e,t)=>t instanceof zs?Ns:null}));function Fs(e){let t=typeof e.original==`string`?Mr.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||rs;return[hi.low(is),Ws,Os,N.editorAttributes.of({class:`cm-merge-b`}),qo.of((e,t)=>{let r=t.effects.find(e=>e.is(Is));return r&&(e=Yo.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Yo.updateB(e,t.state.field(Ls),t.newDoc,t.changes,n)),e}),Go.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?Xs:void 0,side:`b`}),Ls.init(()=>t),e.gutter===!1?[]:Ps,e.collapseUnchanged?Ts(e.collapseUnchanged):[],Jo.init(e=>Yo.build(t,e.doc,n))]}var Is=j.define(),Ls=Zr.define({create:()=>Mr.empty,update(e,t){for(let n of t.effects)n.is(Is)&&(e=n.value.doc);return e}}),Rs=new WeakMap,zs=class extends ci{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function Bs(e,t,n){let r=Rs.get(t.changes);if(r)return r;let i=M.widget({block:!0,side:-1,widget:new zs(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(Go),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),Vs(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),Hs(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(Ls).sliceString(t.fromA,t.endA),u=a&&e.facet(Kr),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
1
+ import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{c as t,d as n,f as r,l as i,o as a,r as o,s,t as c,u as l}from"./useEvent-Dc9HkKI2.js";import{t as u}from"./react-CUdNIagt.js";import{$i as d,Bn as f,Br as p,Bt as m,Ca as h,Ci as g,Co as _,Cr as v,D as y,Dr as b,Fr as x,H as S,I as C,Ir as w,K as ee,Lr as te,Lt as T,Ni as E,Nn as ne,Nr as D,Pr as re,Qi as ie,Qr as ae,Ri as O,Rr as k,Si as oe,U as se,Ur as ce,V as le,Vn as ue,W as de,Wr as fe,Yn as pe,Zn as me,_i as he,_n as ge,_t as _e,a as ve,ai as ye,ar as be,at as xe,b as Se,ba as Ce,bi as we,bt as Te,ca as Ee,ci as De,cn as Oe,cr as ke,d as Ae,dr as je,dt as Me,f as Ne,fi as Pe,fn as Fe,fo as Ie,ft as Le,ga as Re,gn as ze,gt as Be,h as Ve,ha as He,ht as Ue,i as We,it as Ge,jo as Ke,jr as qe,li as Je,lr as Ye,mn as Xe,mt as Ze,ni as Qe,nr as $e,or as et,ot as tt,pi as nt,pt as rt,qa as it,ri as at,rr as ot,sa as st,si as ct,sr as lt,ti as ut,tr as dt,tt as ft,u as pt,ui as mt,un as ht,ur as gt,vn as _t,vr as vt,vt as yt,wa as bt,wi as xt,xa as St,xi as Ct,xo as wt,yi as Tt,za as Et,zr as A}from"./cells-CzugpTQu.js";import{t as Dt}from"./react-dom-CKsE8sC1.js";import{A as Ot,E as kt,I as At,P as jt,S as Mt,j as Nt,x as Pt,y as Ft}from"./schemas-BL-NsLlF.js";import{t as It}from"./compiler-runtime-BQ9S8nyo.js";import{t as Lt}from"./debounce-aFmHgJZY.js";import{E as Rt,_ as zt,a as Bt,c as Vt,g as Ht,h as Ut,s as Wt}from"./config-BxZgoFvi.js";import{M as Gt,N as Kt,T as qt,_ as Jt,b as Yt,k as Xt,t as Zt,v as Qt,x as $t,y as en}from"./ai-model-dropdown-DJ2elMLM.js";import{_ as tn,c as nn,g as rn,m as an,t as on}from"./useEventListener-BdZUApHd.js";import{t as sn}from"./objects-snlMn4yk.js";import{t as cn}from"./invariant-Ci2dTZ72.js";import{p as ln,t as un,u as dn}from"./session-DXKMv4Bs.js";import{D as fn,M as pn,O as mn,S as hn,T as gn,_ as _n,m as vn,o as yn,p as bn,r as xn,u as Sn}from"./config-DpGPGznL.js";import{t as Cn}from"./ErrorBoundary-BeE1cdgM.js";import{n as wn,t as Tn}from"./cn-ldLVeaqm.js";import{t as En}from"./jsx-runtime-B74pBk57.js";import{d as Dn}from"./select-BplWpfFo.js";import{t as On}from"./tooltip-DR2Z2N4w.js";import{r as kn,t as An}from"./button-BoklZTGL.js";import{t as jn}from"./createLucideIcon-rHn2EdoM.js";import{i as Mn,n as Nn}from"./paths-CzfpItSz.js";import{$ as Pn,V as Fn,l as In,p as Ln,u as Rn}from"./panels-B48zp96D.js";import{B as zn,F as Bn,G as Vn,I as Hn,L as Un,M as Wn,R as Gn,T as Kn,V as qn,W as Jn,Y as Yn,c as Xn,f as Zn,i as Qn,n as $n,o as er,r as tr,s as nr,w as rr,z as ir}from"./add-cell-with-ai-BFgdVPaN.js";import{r as ar}from"./useNumberFormatter-C4-_TnkF.js";import{c as or,l as sr,n as cr,t as lr}from"./toDate-BbJ1_N2T.js";import{t as ur}from"./database-zap-CrkOvbyN.js";import{b as dr}from"./write-secret-modal-BiG2tahJ.js";import{a as fr,i as pr,n as mr,r as hr}from"./process-output-Cg2ta3vY.js";import{$ as gr,At as _r,Ft as vr,Gt as yr,Ht as br,I as xr,Kt as Sr,Mt as Cr,P as wr,Pt as Tr,Q as Er,Wt as Dr,Xt as Or,jt as kr,rt as Ar}from"./input-BDakodZ2.js";import{n as jr}from"./copy-BhJktFeI.js";import{t as Mr}from"./use-toast-CC89xOwH.js";import{$t as Nr,At as Pr,Bt as Fr,Ct as Ir,Dt as Lr,E as Rr,Et as zr,Ft as Br,Gt as Vr,H as Hr,Ht as Ur,I as Wr,J as Gr,Jt as Kr,L as qr,Lt as Jr,M as Yr,P as Xr,Pt as Zr,Qt as Qr,Rt as $r,St as ei,Tt as ti,Ut as ni,V as ri,Wt as ii,Yt as ai,Zt as j,_ as oi,at as M,bt as si,ct as ci,dt as li,en as ui,gt as di,ht as fi,lt as pi,m as mi,ot as hi,qt as gi,rn as _i,st as N,ut as vi,w as yi,xt as bi}from"./dist-BczecT6V.js";import{C as xi,E as Si,I as Ci,O as wi,S as Ti,a as Ei,c as Di,n as Oi,r as ki,w as Ai}from"./dist-BTskHGpb.js";import{o as ji}from"./arrays-BqUx5USx.js";import{n as Mi}from"./once-Haz_uxEL.js";import{t as Ni}from"./createReducer-BPvK7C_R.js";import{a as Pi,c as Fi,f as Ii,h as Li,i as Ri,l as zi,n as Bi,o as Vi,t as Hi}from"./dist-Ccyblc8N.js";import{r as Ui}from"./strings-BHZPE0Mc.js";import{r as Wi,t as Gi}from"./requests-yTHMxhVa.js";import{t as Ki}from"./badge-DFf033uX.js";import{o as qi}from"./dist-DueXZKz9.js";import{t as Ji}from"./Deferred-CrTnjj37.js";import{r as Yi}from"./useTheme-DcnXlv0_.js";import{t as Xi}from"./context-BFOBKCJB.js";import{i as Zi}from"./numbers-DsgsDslU.js";import{n as Qi}from"./useAsyncData-DucTwMkf.js";import{a as $i}from"./errors-D9vyuMar.js";import{n as ea,t as ta}from"./filename-fxG7K_MU.js";import{Ai as na,D as ra,Da as ia,En as aa,Er as oa,Fi as sa,Gi as ca,Kt as la,Li as ua,Lr as da,Lt as fa,Mr as pa,O as ma,Ra as ha,Ri as ga,Rr as _a,S as va,Tn as ya,Tt as ba,Wt as xa,bi as Sa,ca as Ca,da as wa,di as Ta,f as Ea,ha as Da,kr as Oa,m as ka,qi as Aa,v as ja,y as Ma,ya as Na,zi as Pa,zr as P,zt as Fa}from"./index-DafnX1Xx.js";import{t as Ia}from"./skeleton-CKpBjoLm.js";import{t as La}from"./github-khsXwCtv.js";import{n as Ra,t as za}from"./useInterval-ChchS0Rl.js";var Ba=jn(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Va=jn(`file-pen`,[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]]),Ha=jn(`hard-drive-download`,[[`path`,{d:`M12 2v8`,key:`1q4o3n`}],[`path`,{d:`m16 6-4 4-4-4`,key:`6wukr`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h.01`,key:`uhywen`}],[`path`,{d:`M10 18h.01`,key:`h775k`}]]),Ua=jn(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),Wa=jn(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Ga=jn(`workflow`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),F=e(u(),1);function Ka(e,t){let{"aria-label":n,"aria-labelledby":r,orientation:i=`horizontal`}=e,[a,o]=(0,F.useState)(!1);br(()=>{o(!!(t.current&&t.current.parentElement?.closest(`[role="toolbar"]`)))});let{direction:s}=Xi(),c=s===`rtl`&&i===`horizontal`,l=ca(t),u=e=>{if(Cr(e.currentTarget,vr(e))){if(i===`horizontal`&&e.key===`ArrowRight`||i===`vertical`&&e.key===`ArrowDown`)c?l.focusPrevious():l.focusNext();else if(i===`horizontal`&&e.key===`ArrowLeft`||i===`vertical`&&e.key===`ArrowUp`)c?l.focusNext():l.focusPrevious();else if(e.key===`Tab`){e.stopPropagation(),d.current=Tr(),e.shiftKey?l.focusFirst():l.focusLast();return}else return;e.stopPropagation(),e.preventDefault()}},d=(0,F.useRef)(null),f=e=>{!Cr(e.currentTarget,e.relatedTarget)&&!d.current&&(d.current=vr(e))},p=e=>{if(d.current&&!Cr(e.currentTarget,e.relatedTarget)&&Cr(t.current,vr(e))){var n;(n=d.current)==null||n.focus(),d.current=null}};return{toolbarProps:{..._r(e,{labelable:!0}),role:a?`group`:`toolbar`,"aria-orientation":i,"aria-label":n,"aria-labelledby":n==null?r:void 0,onKeyDownCapture:a?void 0:u,onFocusCapture:a?void 0:p,onBlurCapture:a?void 0:f}}}var qa=(0,F.createContext)({}),Ja=(0,F.forwardRef)(function(e,t){[e,t]=Er(e,t,qa);let{toolbarProps:n}=Ka(e,t),r=gr({...e,values:{orientation:e.orientation||`horizontal`},defaultClassName:`react-aria-Toolbar`}),i=_r(e,{global:!0});return delete i.id,F.createElement(Ar.div,{...kr(i,r,n),ref:t,slot:e.slot||void 0,"data-orientation":e.orientation||`horizontal`},r.children)});function Ya(e,t){let n=+lr(e)-lr(t);return n<0?-1:n>0?1:n}function Xa(e){return cr(e,Date.now())}function Za(e,t,n){let[r,i]=ua(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function Qa(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function $a(e,t){return+lr(e)-lr(t)}function eo(e,t){let n=lr(e,t?.in);return n.setHours(23,59,59,999),n}function to(e,t){let n=lr(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function no(e,t){let n=lr(e,t?.in);return+eo(n,t)==+to(n,t)}function ro(e,t,n){let[r,i,a]=ua(n?.in,e,e,t),o=Ya(i,a),s=Math.abs(Za(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=Ya(i,a)===-o;no(r)&&s===1&&Ya(r,a)===1&&(c=!1);let l=o*(s-+c);return l===0?0:l}function io(e,t,n){let r=$a(e,t)/1e3;return Qa(n?.roundingMethod)(r)}function ao(e,t,n){let r=Pa(),i=n?.locale??r.locale??sa,a=Ya(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=ua(n?.in,...a>0?[t,e]:[e,t]),l=io(c,s),u=(ga(c)-ga(s))/1e3,d=Math.round((l-u)/60),f;if(d<2)return n?.includeSeconds?l<5?i.formatDistance(`lessThanXSeconds`,5,o):l<10?i.formatDistance(`lessThanXSeconds`,10,o):l<20?i.formatDistance(`lessThanXSeconds`,20,o):l<40?i.formatDistance(`halfAMinute`,0,o):l<60?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,1,o):d===0?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,d,o);if(d<45)return i.formatDistance(`xMinutes`,d,o);if(d<90)return i.formatDistance(`aboutXHours`,1,o);if(d<1440){let e=Math.round(d/60);return i.formatDistance(`aboutXHours`,e,o)}if(d<2520)return i.formatDistance(`xDays`,1,o);if(d<43200){let e=Math.round(d/or);return i.formatDistance(`xDays`,e,o)}if(d<86400)return f=Math.round(d/sr),i.formatDistance(`aboutXMonths`,f,o);if(f=ro(c,s),f<12){let e=Math.round(d/sr);return i.formatDistance(`xMonths`,e,o)}{let e=f%12,t=Math.trunc(f/12);return e<3?i.formatDistance(`aboutXYears`,t,o):e<9?i.formatDistance(`overXYears`,t,o):i.formatDistance(`almostXYears`,t+1,o)}}function oo(e,t){return ao(e,Xa(e),t)}var so=e(Dt(),1),co=e(Ke(),1),I=It(),L=En(),lo=h(),uo=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}offset(t,n=t){return new e(this.fromA+t,this.toA+t,this.fromB+n,this.toB+n)}};function fo(e,t,n,r,i,a){if(e==r)return[];let o=So(e,t,n,r,i,a),s=Co(e,t+o,n,r,i+o,a);t+=o,n-=s,i+=o,a-=s;let c=n-t,l=a-i;if(!c||!l)return[new uo(t,n,i,a)];if(c>l){let o=e.slice(t,n).indexOf(r.slice(i,a));if(o>-1)return[new uo(t,t+o,i,i),new uo(t+o+l,n,a,a)]}else if(l>c){let o=r.slice(i,a).indexOf(e.slice(t,n));if(o>-1)return[new uo(t,t,i,i+o),new uo(n,n,i+o+c,a)]}if(c==1||l==1)return[new uo(t,n,i,a)];let u=To(e,t,n,r,i,a);if(u){let[o,s,c]=u;return fo(e,t,o,r,i,s).concat(fo(e,o+c,n,r,s+c,a))}return go(e,t,n,r,i,a)}var po=1e9,mo=0,ho=!1;function go(e,t,n,r,i,a){let o=n-t,s=a-i;if(po<1e9&&Math.min(o,s)>po*16||mo>0&&Date.now()>mo)return Math.min(o,s)>po*64?[new uo(t,n,i,a)]:Eo(e,t,n,r,i,a);let c=Math.ceil((o+s)/2);vo.reset(c),yo.reset(c);let l=(n,a)=>e.charCodeAt(t+n)==r.charCodeAt(i+a),u=(t,i)=>e.charCodeAt(n-t-1)==r.charCodeAt(a-i-1),d=(o-s)%2==0?null:yo,f=d?null:vo;for(let p=0;p<c;p++){if(p>po||mo>0&&!(p&63)&&Date.now()>mo)return Eo(e,t,n,r,i,a);let m=vo.advance(p,o,s,c,d,!1,l)||yo.advance(p,o,s,c,f,!0,u);if(m)return bo(e,t,n,t+m[0],r,i,a,i+m[1])}return[new uo(t,n,i,a)]}var _o=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let e=0;e<this.len;e++)this.vec[e]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,r,i,a,o){for(let s=-e+this.start;s<=e-this.end;s+=2){let c=r+s,l=s==-e||s!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,u=l-s;for(;l<t&&u<n&&o(l,u);)l++,u++;if(this.vec[c]=l,l>t)this.end+=2;else if(u>n)this.start+=2;else if(i){let e=r+(t-n)-s;if(e>=0&&e<this.len&&i.vec[e]!=-1){if(a){let n=i.vec[e];if(n>=t-l)return[n,r+n-e]}else{let n=t-i.vec[e];if(l>=n)return[l,u]}}}}return null}},vo=new _o,yo=new _o;function bo(e,t,n,r,i,a,o,s){let c=!1;return!Vo(e,r)&&++r==n&&(c=!0),!Vo(i,s)&&++s==o&&(c=!0),c?[new uo(t,n,a,o)]:fo(e,t,r,i,a,s).concat(fo(e,r,n,i,s,o))}function xo(e,t){let n=1,r=Math.min(e,t);for(;n<r;)n<<=1;return n}function So(e,t,n,r,i,a){if(t==n||t==a||e.charCodeAt(t)!=r.charCodeAt(i))return 0;let o=xo(n-t,a-i);for(let s=t,c=i;;){let i=s+o,l=c+o;if(i>n||l>a||e.slice(s,i)!=r.slice(c,l)){if(o==1)return s-t-+!Vo(e,s);o>>=1}else if(i==n||l==a)return i-t;else s=i,c=l}}function Co(e,t,n,r,i,a){if(t==n||i==a||e.charCodeAt(n-1)!=r.charCodeAt(a-1))return 0;let o=xo(n-t,a-i);for(let s=n,c=a;;){let a=s-o,l=c-o;if(a<t||l<i||e.slice(a,s)!=r.slice(l,c)){if(o==1)return n-s-+!Vo(e,s);o>>=1}else if(a==t||l==i)return n-a;else s=a,c=l}}function wo(e,t,n,r,i,a,o,s){let c=r.slice(i,a),l=null;for(;;){if(l||o<s)return l;for(let s=t+o;;){Vo(e,s)||s++;let u=s+o;if(Vo(e,u)||(u+=u==s+1?1:-1),u>=n)break;let d=e.slice(s,u),f=-1;for(;(f=c.indexOf(d,f+1))!=-1;){let o=So(e,u,n,r,i+f+d.length,a),c=Co(e,t,s,r,i,i+f),p=d.length+o+c;(!l||l[2]<p)&&(l=[s-c,i+f-c,p])}s=u}if(s<0)return l;o>>=1}}function To(e,t,n,r,i,a){let o=n-t,s=a-i;if(o<s){let o=To(r,i,a,e,t,n);return o&&[o[1],o[0],o[2]]}return o<4||s*2<o?null:wo(e,t,n,r,i,a,Math.floor(o/4),-1)}function Eo(e,t,n,r,i,a){ho=!0;let o=n-t,s=a-i,c;if(o<s){let s=wo(r,i,a,e,t,n,Math.floor(o/6),50);c=s&&[s[1],s[0],s[2]]}else c=wo(e,t,n,r,i,a,Math.floor(s/6),50);if(!c)return[new uo(t,n,i,a)];let[l,u,d]=c;return fo(e,t,l,r,i,u).concat(fo(e,l+d,n,r,u+d,a))}function Do(e,t){for(let n=1;n<e.length;n++){let r=e[n-1],i=e[n];r.toA>i.fromA-t&&r.toB>i.fromB-t&&(e[n-1]=new uo(r.fromA,i.toA,r.fromB,i.toB),e.splice(n--,1))}}function Oo(e,t,n){for(;;){Do(n,1);let r=!1;for(let i=0;i<n.length;i++){let a=n[i],o,s;(o=So(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new uo(a.fromA+o,a.toA,a.fromB+o,a.toB)),(s=Co(e,a.fromA,a.toA,t,a.fromB,a.toB))&&(a=n[i]=new uo(a.fromA,a.toA-s,a.fromB,a.toB-s));let c=a.toA-a.fromA,l=a.toB-a.fromB;if(c&&l)continue;let u=a.fromA-(i?n[i-1].toA:0),d=(i<n.length-1?n[i+1].fromA:e.length)-a.toA;if(!u||!d)continue;let f=c?e.slice(a.fromA,a.toA):t.slice(a.fromB,a.toB);u<=f.length&&e.slice(a.fromA-u,a.fromA)==f.slice(f.length-u)?(n[i]=new uo(a.fromA-u,a.toA-u,a.fromB-u,a.toB-u),r=!0):d<=f.length&&e.slice(a.toA,a.toA+d)==f.slice(0,d)&&(n[i]=new uo(a.fromA+d,a.toA+d,a.fromB+d,a.toB+d),r=!0)}if(!r)break}return n}function ko(e,t,n){for(let r=0,i=0;i<e.length;i++){let a=e[i],o=a.toA-a.fromA,s=a.toB-a.fromB;if(o&&s||o>3||s>3){let c=i==e.length-1?t.length:e[i+1].fromA,l=a.fromA-r,u=c-a.toA,d=Io(t,a.fromA,l),f=Fo(t,a.toA,u),p=a.fromA-d,m=f-a.toA;if((!o||!s)&&p&&m){let l=Math.max(o,s),[u,h,g]=o?[t,a.fromA,a.toA]:[n,a.fromB,a.toB];l>p&&t.slice(d,a.fromA)==u.slice(g-p,g)?(a=e[i]=new uo(d,d+o,a.fromB-p,a.toB-p),d=a.fromA,f=Fo(t,a.toA,c-a.toA)):l>m&&t.slice(a.toA,f)==u.slice(h,h+m)&&(a=e[i]=new uo(f-o,f,a.fromB+m,a.toB+m),f=a.toA,d=Io(t,a.fromA,a.fromA-r)),p=a.fromA-d,m=f-a.toA}if(p||m)a=e[i]=new uo(a.fromA-p,a.toA+m,a.fromB-p,a.toB+m);else if(!o){let t=Ro(n,a.fromB,a.toB),r,o=t<0?-1:Lo(n,a.toB,a.fromB);t>-1&&(r=t-a.fromB)<=u&&n.slice(a.fromB,t)==n.slice(a.toB,a.toB+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toB-o)<=l&&n.slice(a.fromB-r,a.fromB)==n.slice(o,a.toB)&&(a=e[i]=a.offset(-r))}else if(!s){let n=Ro(t,a.fromA,a.toA),r,o=n<0?-1:Lo(t,a.toA,a.fromA);n>-1&&(r=n-a.fromA)<=u&&t.slice(a.fromA,n)==t.slice(a.toA,a.toA+r)?a=e[i]=a.offset(r):o>-1&&(r=a.toA-o)<=l&&t.slice(a.fromA-r,a.fromA)==t.slice(o,a.toA)&&(a=e[i]=a.offset(-r))}}r=a.toA}return Do(e,3),e}var Ao;try{Ao=RegExp(`[\\p{Alphabetic}\\p{Number}]`,`u`)}catch{}function jo(e){return e>48&&e<58||e>64&&e<91||e>96&&e<123}function Mo(e,t){if(t==e.length)return 0;let n=e.charCodeAt(t);return n<192?+!!jo(n):Ao?!zo(n)||t==e.length-1?+!!Ao.test(String.fromCharCode(n)):Ao.test(e.slice(t,t+2))?2:0:0}function No(e,t){if(!t)return 0;let n=e.charCodeAt(t-1);return n<192?+!!jo(n):Ao?!Bo(n)||t==1?+!!Ao.test(String.fromCharCode(n)):Ao.test(e.slice(t-2,t))?2:0:0}var Po=8;function Fo(e,t,n){if(t==e.length||!No(e,t))return t;for(let r=t,i=t+n,a=0;a<Po;a++){let t=Mo(e,r);if(!t||r+t>i)return r;r+=t}return t}function Io(e,t,n){if(!t||!Mo(e,t))return t;for(let r=t,i=t-n,a=0;a<Po;a++){let t=No(e,r);if(!t||r-t<i)return r;r-=t}return t}function Lo(e,t,n){for(;t!=n;t--)if(e.charCodeAt(t-1)==10)return t;return-1}function Ro(e,t,n){for(;t!=n;t++)if(e.charCodeAt(t)==10)return t;return-1}var zo=e=>e>=55296&&e<=56319,Bo=e=>e>=56320&&e<=57343;function Vo(e,t){return!t||t==e.length||!zo(e.charCodeAt(t-1))||!Bo(e.charCodeAt(t))}function Ho(e,t,n){let r=n?.override;return r?r(e,t):(po=(n?.scanLimit??1e9)>>1,mo=n?.timeout?Date.now()+n.timeout:0,ho=!1,Oo(e,t,fo(e,0,e.length,t,0,t.length)))}function Uo(){return!ho}function Wo(e,t,n){return ko(Ho(e,t,n),e,t)}var Go=Vr.define({combine:e=>e[0]}),Ko=j.define(),qo=Vr.define(),Jo=Qr.define({create(e){return null},update(e,t){for(let n of t.effects)n.is(Ko)&&(e=n.value);for(let n of t.state.facet(qo))e=n(e,t);return e}}),Yo=class e{constructor(e,t,n,r,i,a=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=r,this.toB=i,this.precise=a}offset(t,n){return t||n?new e(this.changes,this.fromA+t,this.toA+t,this.fromB+n,this.toB+n,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,t,n){return Qo(Wo(e.toString(),t.toString(),n),e,t,0,0,Uo())}static updateA(e,t,n,r,i){return ns(ts(e,r,!0,n.length),e,t,n,i)}static updateB(e,t,n,r,i){return ns(ts(e,r,!1,t.length),e,t,n,i)}};function Xo(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.to==e&&a.to==t&&e<n.length&&t<r.length?[e+1,t+1]:[i.from,a.from]}function Zo(e,t,n,r){let i=n.lineAt(e),a=r.lineAt(t);return i.from==e&&a.from==t?[e,t]:[i.to+1,a.to+1]}function Qo(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length;s++){let c=e[s],[l,u]=Xo(c.fromA+r,c.fromB+i,t,n),[d,f]=Zo(c.toA+r,c.toB+i,t,n),p=[c.offset(-l+r,-u+i)];for(;s<e.length-1;){let a=e[s+1],[o,c]=Xo(a.fromA+r,a.fromB+i,t,n);if(o>d+1&&c>f+1)break;p.push(a.offset(-l+r,-u+i)),[d,f]=Zo(a.toA+r,a.toB+i,t,n),s++}o.push(new Yo(p,l,Math.max(l,d),u,Math.max(u,f),a))}return o}var $o=1e3;function es(e,t,n,r){let i=0,a=e.length;for(;;){if(i==a){let r=0,a=0;i&&({toA:r,toB:a}=e[i-1]);let o=t-(n?r:a);return[r+o,a+o]}let o=i+a>>1,s=e[o],[c,l]=n?[s.fromA,s.toA]:[s.fromB,s.toB];if(c>t)a=o;else if(l<=t)i=o+1;else return r?[s.fromA,s.fromB]:[s.toA,s.toB]}}function ts(e,t,n,r){let i=[];return t.iterChangedRanges((a,o,s,c)=>{let l=0,u=n?t.length:r,d=0,f=n?r:t.length;a>$o&&([l,d]=es(e,a-$o,n,!0)),o<t.length-$o&&([u,f]=es(e,o+$o,n,!1));let p=c-s-(o-a),m,[h,g]=n?[p,0]:[0,p];i.length&&(m=i[i.length-1]).toA>=l?i[i.length-1]={fromA:m.fromA,fromB:m.fromB,toA:u,toB:f,diffA:m.diffA+h,diffB:m.diffB+g}:i.push({fromA:l,toA:u,fromB:d,toB:f,diffA:h,diffB:g})}),i}function ns(e,t,n,r,i){if(!e.length)return t;let a=[];for(let o=0,s=0,c=0,l=0;;o++){let u=o==e.length?null:e[o],d=u?u.fromA+s:n.length,f=u?u.fromB+c:r.length;for(;l<t.length;){let e=t[l];if(u&&(e.toA+s>d||e.toB+c>f))break;a.push(e.offset(s,c)),l++}if(!u)break;let p=u.toA+s+u.diffA,m=u.toB+c+u.diffB,h=Wo(n.sliceString(d,p),r.sliceString(f,m),i);for(let e of Qo(h,n,r,d,f,Uo()))a.push(e);for(s+=u.diffA,c+=u.diffB;l<t.length;){let e=t[l];if(e.fromA+s>p&&e.fromB+c>m)break;l++}}return a}var rs={scanLimit:500},is=vi.fromClass(class{constructor(e){({deco:this.deco,gutter:this.gutter}=ms(e))}update(e){(e.docChanged||e.viewportChanged||os(e.startState,e.state)||ss(e.startState,e.state))&&({deco:this.deco,gutter:this.gutter}=ms(e.view))}},{decorations:e=>e.deco}),as=gi.low(si({class:`cm-changeGutter`,markers:e=>e.plugin(is)?.gutter||Kr.empty}));function os(e,t){return e.field(Jo,!1)!=t.field(Jo,!1)}function ss(e,t){return e.facet(Go)!=t.facet(Go)}var cs=M.line({class:`cm-changedLine`}),ls=M.mark({class:`cm-changedText`}),us=M.mark({tagName:`ins`,class:`cm-insertedLine`}),ds=M.mark({tagName:`del`,class:`cm-deletedLine`}),fs=new class extends ci{constructor(){super(...arguments),this.elementClass=`cm-changedLineGutter`}};function ps(e,t,n,r,i,a){let o=n?e.fromA:e.fromB,s=n?e.toA:e.toB,c=0;if(o!=s){i.add(o,o,cs),i.add(o,s,n?ds:us),a&&a.add(o,o,fs);for(let l=t.iterRange(o,s-1),u=o;!l.next().done;){if(l.lineBreak){u++,i.add(u,u,cs),a&&a.add(u,u,fs);continue}let t=u+l.value.length;if(r)for(;c<e.changes.length;){let r=e.changes[c],a=o+(n?r.fromA:r.fromB),s=o+(n?r.toA:r.toB),l=Math.max(u,a),d=Math.min(t,s);if(l<d&&i.add(l,d,ls),s<t)c++;else break}u=t}}}function ms(e){let t=e.state.field(Jo),{side:n,highlightChanges:r,markGutter:i,overrideChunk:a}=e.state.facet(Go),o=n==`a`,s=new ai,c=i?new ai:null,{from:l,to:u}=e.viewport;for(let n of t){if((o?n.fromA:n.fromB)>=u)break;(o?n.toA:n.toB)>l&&(!a||!a(e.state,n,s,c))&&ps(n,e.state.doc,o,r,s,c)}return{deco:s.finish(),gutter:c&&c.finish()}}var hs=class extends li{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement(`div`);return e.className=`cm-mergeSpacer`,e.style.height=this.height+`px`,e}updateDOM(e){return e.style.height=this.height+`px`,!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},gs=j.define({map:(e,t)=>e.map(t)}),_s=Qr.define({create:()=>M.none,update:(e,t)=>{for(let e of t.effects)if(e.is(gs))return e.value;return e.map(t.changes)},provide:e=>N.decorations.from(e)}),vs=.01;function ys(e,t){if(e.size!=t.size)return!1;let n=e.iter(),r=t.iter();for(;n.value;){if(n.from!=r.from||Math.abs(n.value.spec.widget.height-r.value.spec.widget.height)>1)return!1;n.next(),r.next()}return!0}function bs(e,t,n){let r=new ai,i=new ai,a=e.state.field(_s).iter(),o=t.state.field(_s).iter(),s=0,c=0,l=0,u=0,d=e.viewport,f=t.viewport;for(let p=0;;p++){let m=p<n.length?n[p]:null,h=m?m.fromA:e.state.doc.length,g=m?m.fromB:t.state.doc.length;if(s<h){let n=e.lineBlockAt(s).top+l-(t.lineBlockAt(c).top+u);n<-.01?(l-=n,r.add(s,s,M.widget({widget:new hs(-n),block:!0,side:-1}))):n>vs&&(u+=n,i.add(c,c,M.widget({widget:new hs(n),block:!0,side:-1})))}if(h>s+1e3&&s<d.from&&h>d.from&&c<f.from&&g>f.from){let e=Math.min(d.from-s,f.from-c);s+=e,c+=e,p--}else if(m)s=m.toA,c=m.toB;else break;for(;a.value&&a.from<s;)l-=a.value.spec.widget.height,a.next();for(;o.value&&o.from<c;)u-=o.value.spec.widget.height,o.next()}for(;a.value;)l-=a.value.spec.widget.height,a.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let p=e.contentHeight+l-(t.contentHeight+u);p<vs?r.add(e.state.doc.length,e.state.doc.length,M.widget({widget:new hs(-p),block:!0,side:1})):p>vs&&i.add(t.state.doc.length,t.state.doc.length,M.widget({widget:new hs(p),block:!0,side:1}));let m=r.finish(),h=i.finish();ys(m,e.state.field(_s))||e.dispatch({effects:gs.of(m)}),ys(h,t.state.field(_s))||t.dispatch({effects:gs.of(h)})}var xs=j.define({map:(e,t)=>t.mapPos(e)}),Ss=class extends li{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement(`div`);return t.className=`cm-collapsedLines`,t.textContent=e.state.phrase(`$ unchanged lines`,this.lines),t.addEventListener(`click`,t=>{let n=e.posAtDOM(t.target);e.dispatch({effects:xs.of(n)});let{side:r,sibling:i}=e.state.facet(Go);i&&i().dispatch({effects:xs.of(Cs(n,e.state.field(Jo),r==`a`))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return`collapsed-unchanged-code`}};function Cs(e,t,n){let r=0,i=0;for(let a=0;;a++){let o=a<t.length?t[a]:null;if(!o||(n?o.fromA:o.fromB)>=e)return i+(e-r);[r,i]=n?[o.toA,o.toB]:[o.toB,o.toA]}}var ws=Qr.define({create(e){return M.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(xs)&&(e=e.update({filter:e=>e!=n.value}));if(e.size&&t.state.field(Jo)!=t.startState.field(Jo,!1)){let n=t.state.facet(Go).side==`a`,r=[];for(let i of t.state.field(Jo))e.between(n?i.fromA:i.fromB,n?i.toA:i.toB,e=>{r.push(e)});r.length&&(e=e.update({filter:e=>r.indexOf(e)<0}))}return e},provide:e=>N.decorations.from(e)});function Ts({margin:e=3,minSize:t=4}){return ws.init(n=>Es(n,e,t))}function Es(e,t,n){let r=new ai,i=e.facet(Go).side==`a`,a=e.field(Jo),o=1;for(let s=0;;s++){let c=s<a.length?a[s]:null,l=s?o+t:1,u=c?e.doc.lineAt(i?c.fromA:c.fromB).number-1-t:e.doc.lines,d=u-l+1;if(d>=n&&r.add(e.doc.line(l).from,e.doc.line(u).to,M.replace({widget:new Ss(d),block:!0})),!c)break;o=e.doc.lineAt(Math.min(e.doc.length,i?c.toA:c.toB)).number}return r.finish()}var Ds=N.styleModule.of(new Jr({".cm-mergeView":{overflowY:`auto`},".cm-mergeViewEditors":{display:`flex`,alignItems:`stretch`},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:`hidden`},".cm-merge-revert":{width:`1.6em`,flexGrow:0,flexShrink:0,position:`relative`},".cm-merge-revert button":{position:`absolute`,display:`block`,width:`100%`,boxSizing:`border-box`,textAlign:`center`,background:`none`,border:`none`,font:`inherit`,cursor:`pointer`}})),Os=N.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:`auto !important`,overflowY:`visible !important`},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:`rgba(160, 128, 100, .08)`},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:`rgba(100, 160, 128, .08)`},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat`},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:`linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat`},"&light.cm-merge-b .cm-changedText":{background:`linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat`},"&dark.cm-merge-b .cm-changedText":{background:`linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat`},"&.cm-merge-b .cm-deletedText":{background:`#ff000033`},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:`none`},".cm-deletedChunk":{paddingLeft:`6px`,"& .cm-chunkButtons":{position:`absolute`,insetInlineEnd:`5px`},"& button":{border:`none`,cursor:`pointer`,color:`white`,margin:`0 2px`,borderRadius:`3px`,"&[name=accept]":{background:`#2a2`},"&[name=reject]":{background:`#d43`}}},".cm-collapsedLines":{padding:`5px 5px 5px 10px`,cursor:`pointer`,"&:before":{content:`"⦚"`,marginInlineEnd:`7px`},"&:after":{content:`"⦚"`,marginInlineStart:`7px`}},"&light .cm-collapsedLines":{color:`#444`,background:`linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)`},"&dark .cm-collapsedLines":{color:`#ddd`,background:`linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)`},".cm-changeGutter":{width:`3px`,paddingLeft:`1px`},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:`#e43`},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:`#fa9`},"&light.cm-merge-b .cm-changedLineGutter":{background:`#2b2`},"&dark.cm-merge-b .cm-changedLineGutter":{background:`#8f8`},".cm-inlineChangedLineGutter":{background:`#75d`}}),ks=new Ur,As=new Ur,js=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||rs;let t=[gi.low(is),Os,Ds,_s,N.updateListener.of(e=>{this.measuring<0&&(e.heightChanged||e.viewportChanged)&&!e.transactions.some(e=>e.effects.some(e=>e.is(gs)))&&this.measure()})],n=[Go.of({side:`a`,sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(as);let r=ii.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],N.editorAttributes.of({class:`cm-merge-a`}),As.of(n),t]}),i=[Go.of({side:`b`,sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(as);let a=ii.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],N.editorAttributes.of({class:`cm-merge-b`}),As.of(i),t]});this.chunks=Yo.build(r.doc,a.doc,this.diffConf);let o=[Jo.init(()=>this.chunks),ks.of(e.collapseUnchanged?Ts(e.collapseUnchanged):[])];r=r.update({effects:j.appendConfig.of(o)}).state,a=a.update({effects:j.appendConfig.of(o)}).state,this.dom=document.createElement(`div`),this.dom.className=`cm-mergeView`,this.editorDOM=this.dom.appendChild(document.createElement(`div`)),this.editorDOM.className=`cm-mergeViewEditors`;let s=e.orientation||`a-b`,c=document.createElement(`div`);c.className=`cm-mergeViewEditor`;let l=document.createElement(`div`);l.className=`cm-mergeViewEditor`,this.editorDOM.appendChild(s==`a-b`?c:l),this.editorDOM.appendChild(s==`a-b`?l:c),this.a=new N({state:r,parent:c,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.a)}),this.b=new N({state:a,parent:l,root:e.root,dispatchTransactions:e=>this.dispatch(e,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls==`b-to-a`,e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,t){if(e.some(e=>e.docChanged)){let n=e[e.length-1],r=e.reduce((e,t)=>e.compose(t.changes),Fr.empty(e[0].startState.doc.length));this.chunks=t==this.a?Yo.updateA(this.chunks,n.newDoc,this.b.state.doc,r,this.diffConf):Yo.updateB(this.chunks,this.a.state.doc,n.newDoc,r,this.diffConf),t.update([...e,n.state.update({effects:Ko.of(this.chunks)})]);let i=t==this.a?this.b:this.a;i.update([i.state.update({effects:Ko.of(this.chunks)})]),this.scheduleMeasure()}else t.update(e)}reconfigure(e){if(`diffConfig`in e&&(this.diffConf=e.diffConfig),`orientation`in e){let t=e.orientation!=`b-a`;if(t!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let e=this.a.dom.parentNode,n=this.b.dom.parentNode;e.remove(),n.remove(),this.editorDOM.insertBefore(t?e:n,this.editorDOM.firstChild),this.editorDOM.appendChild(t?n:e),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent=``)}}if(`revertControls`in e||`renderRevertControl`in e){let t=!!this.revertDOM,n=this.revertToA,r=this.renderRevert;`revertControls`in e&&(t=!!e.revertControls,n=e.revertControls==`b-to-a`),`renderRevertControl`in e&&(r=e.renderRevertControl),this.setupRevertControls(t,n,r)}let t=`highlightChanges`in e,n=`gutter`in e,r=`collapseUnchanged`in e;if(t||n||r){let i=[],a=[];if(t||n){let r=this.a.state.facet(Go),o=n?e.gutter!==!1:r.markGutter,s=t?e.highlightChanges!==!1:r.highlightChanges;i.push(As.reconfigure([Go.of({side:`a`,sibling:()=>this.b,highlightChanges:s,markGutter:o}),o?as:[]])),a.push(As.reconfigure([Go.of({side:`b`,sibling:()=>this.a,highlightChanges:s,markGutter:o}),o?as:[]]))}if(r){let t=ks.reconfigure(e.collapseUnchanged?Ts(e.collapseUnchanged):[]);i.push(t),a.push(t)}this.a.dispatch({effects:i}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement(`div`),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener(`mousedown`,e=>this.revertClicked(e)),this.revertDOM.className=`cm-merge-revert`):this.revertDOM&&(this.revertDOM.textContent=``)}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){bs(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,r=this.b.viewport;for(let i=0;i<this.chunks.length;i++){let a=this.chunks[i];if(a.fromA>n.to||a.fromB>r.to)break;if(a.fromA<n.from||a.fromB<r.from)continue;let o=this.a.lineBlockAt(a.fromA).top+`px`;for(;t&&+t.dataset.chunk<i;)t=Ms(t);t&&t.dataset.chunk==String(i)?(t.style.top!=o&&(t.style.top=o),t=t.nextSibling):e.insertBefore(this.renderRevertButton(o,i),t)}for(;t;)t=Ms(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement(`button`);let e=this.a.state.phrase(`Revert this chunk`);n.setAttribute(`aria-label`,e),n.setAttribute(`title`,e),n.textContent=this.revertToLeft?`⇜`:`⇝`}return n.style.top=e,n.setAttribute(`data-chunk`,String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[t,r,i,a,o,s]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],c=t.state.sliceDoc(i,Math.max(i,a-1));i!=a&&s<=r.state.doc.length&&(c+=t.state.lineBreak),r.dispatch({changes:{from:o,to:Math.min(r.state.doc.length,s),insert:c},userEvent:`revert`}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function Ms(e){let t=e.nextSibling;return e.remove(),t}var Ns=new class extends ci{constructor(){super(...arguments),this.elementClass=`cm-deletedLineGutter`}},Ps=gi.low(si({class:`cm-changeGutter`,markers:e=>e.plugin(is)?.gutter||Kr.empty,widgetMarker:(e,t)=>t instanceof zs?Ns:null}));function Fs(e){let t=typeof e.original==`string`?Nr.of(e.original.split(/\r?\n/)):e.original,n=e.diffConfig||rs;return[gi.low(is),Ws,Os,N.editorAttributes.of({class:`cm-merge-b`}),qo.of((e,t)=>{let r=t.effects.find(e=>e.is(Is));return r&&(e=Yo.updateA(e,r.value.doc,t.startState.doc,r.value.changes,n)),t.docChanged&&(e=Yo.updateB(e,t.state.field(Ls),t.newDoc,t.changes,n)),e}),Go.of({highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1,syntaxHighlightDeletions:e.syntaxHighlightDeletions!==!1,syntaxHighlightDeletionsMaxLength:3e3,mergeControls:e.mergeControls??!0,overrideChunk:e.allowInlineDiffs?Xs:void 0,side:`b`}),Ls.init(()=>t),e.gutter===!1?[]:Ps,e.collapseUnchanged?Ts(e.collapseUnchanged):[],Jo.init(e=>Yo.build(t,e.doc,n))]}var Is=j.define(),Ls=Qr.define({create:()=>Nr.empty,update(e,t){for(let n of t.effects)n.is(Is)&&(e=n.value.doc);return e}}),Rs=new WeakMap,zs=class extends li{constructor(e){super(),this.buildDOM=e,this.dom=null}eq(e){return this.dom==e.dom}toDOM(e){return this.dom||=this.buildDOM(e)}};function Bs(e,t,n){let r=Rs.get(t.changes);if(r)return r;let i=M.widget({block:!0,side:-1,widget:new zs(r=>{let{highlightChanges:i,syntaxHighlightDeletions:a,syntaxHighlightDeletionsMaxLength:o,mergeControls:s}=e.facet(Go),c=document.createElement(`div`);if(c.className=`cm-deletedChunk`,s){let t=c.appendChild(document.createElement(`div`));t.className=`cm-chunkButtons`;let n=e=>{e.preventDefault(),Vs(r,r.posAtDOM(c))},i=e=>{e.preventDefault(),Hs(r,r.posAtDOM(c))};if(typeof s==`function`)t.appendChild(s(`accept`,n)),t.appendChild(s(`reject`,i));else{let r=t.appendChild(document.createElement(`button`));r.name=`accept`,r.textContent=e.phrase(`Accept`),r.onmousedown=n;let a=t.appendChild(document.createElement(`button`));a.name=`reject`,a.textContent=e.phrase(`Reject`),a.onmousedown=i}}if(n||t.fromA>=t.toA)return c;let l=r.state.field(Ls).sliceString(t.fromA,t.endA),u=a&&e.facet(qr),d=h(),f=t.changes,p=0,m=!1;function h(){let e=c.appendChild(document.createElement(`div`));return e.className=`cm-deletedLine`,e.appendChild(document.createElement(`del`))}function g(e,t,n){for(let r=e;r<t;){if(l.charAt(r)==`
2
2
  `){d.firstChild||d.appendChild(document.createElement(`br`)),d=h(),r++;continue}let e=t,a=n+(m?` cm-deletedText`:``),o=!1,s=l.indexOf(`
3
- `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Wr(t,{style:t=>Jr(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return Rs.set(t.changes,i),i}function Vs(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Jo).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(Ls);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Pr.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:Is.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Hs(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Jo).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Ls).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function Us(e){let t=new ii;for(let n of e.field(Jo)){let r=e.facet(Go).overrideChunk&&Ks(e,n);t.add(n.fromB,n.fromB,Bs(e,n,!!r))}return t.finish()}var Ws=Zr.define({create:e=>Us(e),update(e,t){return t.state.field(Jo,!1)==t.startState.field(Jo,!1)?e:Us(t.state)},provide:e=>N.decorations.from(e)}),Gs=new WeakMap;function Ks(e,t){let n=Gs.get(t);if(n!==void 0)return n;n=null;let r=e.field(Ls),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(M.widget({widget:new qs(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(ls.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return Gs.set(t,n),n}var qs=class extends ci{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},Js=new class extends si{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},Ys=M.line({class:`cm-inlineChangedLine`});function Xs(e,t,n,r){let i=Ks(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,Js),n.add(o.from,o.from,Ys);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var Zs={showInput:`Mod-l`,acceptEdit:`Mod-y`,rejectEdit:`Mod-u`},Qs=300,$s=Br.define({combine:e=>gi(e,{onError:console.error,inputDebounceTime:Qs,keymaps:Zs},{onError:(e,t)=>e&&t,inputDebounceTime:(e,t)=>e&&t,keymaps:(e,t)=>e&&t})}),ec=j.define(),tc=Zr.define({create(){return{show:!1,lineFrom:0,lineTo:0}},update(e,t){for(let e of t.effects)if(e.is(ec))return e.value;return e}}),nc=j.define(),rc=j.define(),ic=Zr.define({create(){return{shouldFocus:!1,inputValue:``}},update(e,t){let n=e;for(let e of t.effects)e.is(nc)&&(n={...n,inputValue:e.value}),e.is(rc)&&(n={...n,shouldFocus:e.value});return n}}),ac=j.define(),oc=Zr.define({create(){return null},update(e,t){for(let e of t.effects)if(e.is(ac))return e.value;return e}}),sc=j.define(),cc=Zr.define({create(){return!1},update(e,t){for(let e of t.effects)if(e.is(sc))return e.value;return e}}),lc=1,uc=e=>{let{state:t}=e,n=t.selection.main;if(n.empty)return!1;let r=t.doc,i=r.lineAt(n.from),a=r.lineAt(n.to);if(t.sliceDoc(i.from,a.to).trim().length<lc)return!1;let o=Math.max(1,Math.min(i.number,r.lines)),s=Math.max(1,Math.min(a.number,r.lines));return e.dispatch({effects:[ec.of({show:!0,lineFrom:o,lineTo:s}),rc.of(!0),nc.of(``)],selection:ti.cursor(i.from)}),!0},dc=e=>e.state.field(oc)?(e.dispatch({effects:[ac.of(null),ec.of({show:!1,lineFrom:0,lineTo:0}),rc.of(!1),nc.of(``),sc.of(!1)]}),!0):!1,fc=e=>{let t=e.state.field(oc);return t?(e.dispatch({changes:{from:t.from,to:t.to,insert:t.oldCode},effects:[ac.of(null),ec.of({show:!1,lineFrom:0,lineTo:0}),rc.of(!1),nc.of(``),sc.of(!1)]}),!0):!1},pc={mac:`⌘`,windows:`Ctrl`,default:`Ctrl`};function mc(){return navigator.platform.startsWith(`Mac`)?pc.mac:navigator.platform.startsWith(`Win`)?pc.windows:pc.default}function hc(e){return e.replace(`Mod`,mc()).replace(`-`,` `).toUpperCase()}function gc(e,t){let n=document.createElement(e);return n.className=t,n}function _c(e,t,n=void 0){let r=()=>{};return(...i)=>(r(),new Promise((a,o)=>{let s=setTimeout(()=>a(e(...i)),t);r=()=>{clearTimeout(s),n!==void 0&&o(n)}}))}var vc=Zr.define({create(){return{suggestion:null}},update(e,t){let n=t.effects.find(e=>e.is(yc));return!t.docChanged&&!n&&!t.selection?e:n&&t.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),yc=j.define();function bc(e,t){let n=e.state.selection.main.head,r=[],i=M.widget({widget:new xc(t),side:1});return r.push(i.range(n)),M.set(r)}var xc=class extends ci{suggestion;constructor(e){super(),this.suggestion=e}toDOM(){let e=document.createElement(`span`);return e.style.opacity=`0.4`,e.className=`cm-inline-suggestion`,e.textContent=this.suggestion,e.setAttribute(`role`,`suggestion`),e.setAttribute(`aria-label`,`Suggestion: ${this.suggestion}`),e}get lineBreaks(){return this.suggestion.split(`
4
- `).length-1}},Sc=class{cache=new Map;timeout;constructor(e){this.timeout=e}get(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>this.timeout?(this.cache.delete(e),null):t.result:null}set(e,t){this.cache.set(e,{result:t,timestamp:Date.now()})}},Cc=(e,t)=>_i.fromClass(class{abortController=null;cache;constructor(){this.cache=new Sc(t.cacheTimeout??1e3)}async update(n){if(!n.docChanged||t.events?.beforeSuggestionFetch?.(n.view)===!1)return;this.abortController?.abort(),this.abortController=new AbortController;let r=n.state.doc,i=r.toString(),a=this.cache.get(i);if(a){n.view.dispatch({effects:yc.of({text:a,doc:r})});return}try{let a=await e(n.state,this.abortController.signal,n.view);if(this.abortController.signal.aborted||t.events?.shouldShowSuggestion?.(n.view,a)===!1)return;this.cache.set(i,a),n.view.dispatch({effects:yc.of({text:a,doc:r})})}catch(e){e instanceof Error&&e.name!==`AbortError`&&console.error(`Suggestion fetch error:`,e)}}destroy(){this.abortController?.abort()}}),wc=_i.fromClass(class{decorations;constructor(){this.decorations=M.none}update(e){let t=e.state.field(vc)?.suggestion;if(!t){this.decorations=M.none;return}this.decorations=bc(e.view,t)}},{decorations:e=>e.decorations});function Tc(e,t,n,r){return{...e.changeByRange(i=>{if(i===e.selection.main)return{changes:{from:n,to:r,insert:t},range:ti.cursor(n+t.length)};let a=r-n;return!i.empty||a&&e.sliceDoc(i.from-a,i.from)!==e.sliceDoc(n,r)?{range:i}:{changes:{from:i.from-a,to:i.from,insert:t},range:ti.cursor(i.from-a+t.length)}}),userEvent:`input.complete`}}var Ec=e=>{let t=e.state.field(vc)?.suggestion;if(!t)return!1;let n=e.state.facet(kc);return e.dispatch({...Tc(e.state,t,e.state.selection.main.head,e.state.selection.main.head)}),n.events?.onSuggestionAccepted?.(e,t),!0},Dc=e=>{let t=e.state.field(vc)?.suggestion;if(!t)return!1;let n=e.state.facet(kc);return e.dispatch({effects:yc.of({text:null,doc:e.state.doc})}),n.events?.onSuggestionRejected?.(e,t),!0},Oc=ei.of([{key:`Tab`,run:Ec},{key:`Escape`,run:Dc}]),kc=Br.define({combine:e=>e.at(-1)});function Ac(e){let{delay:t=500,includeKeymap:n=!0}=e,r=_c(e.fetchFn,t);return[vc,kc.of(e),Cc(r,e),wc,n?Oc:[]]}var jc=N.baseTheme({".cm-ai-input-container":{display:`flex`,flexDirection:`column`,gap:`4px`,width:`min(calc(100% + 7px), 500px)`,padding:`5px 5px`,margin:`0 -6px`,backgroundColor:`light-dark(rgb(241, 243, 245), rgb(40, 40, 40))`},".cm-ai-input":{display:`block`,width:`100%`,padding:`3px 8px`,border:`2px solid rgb(51, 154, 240)`,borderRadius:`5px`,fontSize:`12px`},".cm-ai-help-info-button":{fontSize:`10px`,paddingLeft:`10px`,height:`18px`,color:`light-dark(rgb(109, 117, 125), rgb(170, 170, 170))`,display:`block`,marginRight:`auto`},".cm-ai-help-info-button:hover":{color:`light-dark(rgb(89, 97, 105), rgb(190, 190, 190))`},".cm-ai-generate-button":{background:`#0E639C`,border:`none`,padding:`2px 6px`,color:`#ffffff`,cursor:`pointer`,font:`inherit`,borderRadius:`4px`,"&:hover":{backgroundColor:`#1177bb`}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:`light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important`},".cm-line:has(.cm-new-code-line)":{backgroundColor:`light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important`},".cm-old-code-container":{backgroundColor:`light-dark(rgb(255, 205, 205), rgb(100, 40, 40))`,position:`relative`,display:`flex`,paddingTop:`0`,width:`100%`,alignItems:`center`},".cm-code-button":{position:`absolute`,right:`5px`,top:`50%`,transform:`translateY(-50%)`,background:`none`,border:`none`,cursor:`pointer`,fontSize:`16px`},".cm-floating-buttons":{fontFamily:`sans-serif`,position:`absolute`,top:`-20px`,left:`5px`,display:`flex`},".cm-floating-button":{fontFamily:`sans-serif`,padding:`2px 5px`,fontSize:`10px`,cursor:`pointer`,fontWeight:`700`},".cm-floating-accept":{backgroundColor:`light-dark(rgb(55, 125, 34), rgb(40, 80, 25))`,borderTopLeftRadius:`5px`,borderBottomLeftRadius:`5px`,color:`white`,filter:`brightness(90%)`,"&:hover":{filter:`brightness(100%)`}},".cm-floating-reject":{backgroundColor:`light-dark(rgb(220, 53, 69), rgb(180, 40, 50))`,color:`white`,borderTopRightRadius:`5px`,borderBottomRightRadius:`5px`,filter:`brightness(90%)`,"&:hover":{filter:`brightness(100%)`}},".hotkey":{display:`inline-block`,padding:`0 4px`,borderRadius:`3px`,backgroundColor:`rgba(255, 255, 255, 0.1)`,fontSize:`90%`},".cm-ai-loading-indicator":{fontStyle:`italic`,fontSize:`10px`,paddingLeft:`12px`,color:`light-dark(rgb(109, 117, 125), rgb(170, 170, 170))`,opacity:`0`,transition:`opacity 0.3s ease-in-out`,"&::after":{content:`""`,display:`inline-block`,animation:`ellipsis-pulse 1.5s steps(4, end) infinite`},"&:not(:empty)":{opacity:`1`}},".cm-ai-input:disabled":{opacity:`0.5`},"@keyframes ellipsis-pulse":{"0%":{content:`'.'`},"25%":{content:`'..'`},"50%":{content:`'...'`},"75%":{content:`''`}},".cm-ai-loading-container":{display:`flex`,alignItems:`center`,padding:`0 8px`},".cm-ai-cancel-button":{padding:`2px 8px`,fontSize:`10px`,borderRadius:`4px`,color:`light-dark(rgb(109, 117, 125), rgb(170, 170, 170))`,cursor:`pointer`,"&:hover":{background:`light-dark(rgb(223, 227, 232), rgb(50, 50, 50))`}},".hidden":{display:`none`}});function Mc(e){let t=e.state.facet($s),n={...Zs,...t.keymaps},r=e.state.facet(Nc),i=gc(`div`,`cm-ai-tooltip`).appendChild(gc(`div`,`cm-ai-tooltip-button`)),a=i.appendChild(document.createElement(`span`));a.textContent=`${r.label} `;let o=a.appendChild(document.createElement(`span`));return o.className=`hotkey`,o.textContent=hc(n.showInput),i.querySelector(`span`)?.addEventListener(`mousedown`,e=>{e.stopPropagation(),e.button===0&&e.preventDefault()}),i.querySelector(`span`)?.addEventListener(`click`,t=>{t.preventDefault(),uc(e)}),i}var Nc=Br.define({combine(e){return gi(e,{render:Mc,hideOnBlur:!1,label:`Edit with AI`})}}),Pc=_i.fromClass(class{view;suppress;dom;mousedown=()=>{this.suppress=!0};mouseup=()=>{this.suppress=!1,this.display(this.view)};scroll=()=>{this.display(this.view)};windowScroll=()=>{this.display(this.view)};constructor(e){this.view=e;let t=e.state.facet(Nc);this.suppress=!1,document.addEventListener(`mousedown`,this.mousedown),document.addEventListener(`mouseup`,this.mouseup),e.scrollDOM.addEventListener(`scroll`,this.scroll),window.addEventListener(`scroll`,this.windowScroll,!0);let n=t.render(e);e.dom.appendChild(n),this.dom=n}update(e){this.display(e.view)}docViewUpdate(e){this.display(e)}display(e){if(e.state.field(tc).show){this.dom.style.display=`none`;return}if(e.state.facet(Nc).hideOnBlur&&!e.hasFocus){this.dom.style.display=`none`,this.dom.setAttribute(`aria-hidden`,`true`);return}e.requestMeasure({read:this.#e})}#e=e=>{let t=e.state.selection.ranges.find(e=>!e.empty);if(t&&!this.suppress){let n=e.coordsAtPos(t.from),r=e.coordsAtPos(t.to);if(!n||!r)return;let i=e.dom.getBoundingClientRect(),a=e.dom.parentElement?.getBoundingClientRect(),o=e=>e.top>=i.top&&e.top<=i.bottom&&e.left>=i.left&&e.left<=i.right,s=e=>!a||e.top>=a.top&&e.top<=a.bottom&&e.left>=a.left&&e.left<=a.right,c=o(n)||o(r),l=s(n)||s(r);if(!c||!l){this.dom.style.display=`none`,this.dom.setAttribute(`aria-hidden`,`true`);return}this.dom.style.display=`flex`,this.dom.setAttribute(`aria-hidden`,`false`);let u=this.dom.getBoundingClientRect(),d=o(n)?n:r,f=i.right-u.width,p=Math.min(d.left,f),m=d.top-u.height,h=a?a.y:-1/0;m<h&&(m=r.bottom),this.dom.style.left=`${p}px`,this.dom.style.top=`${m}px`,requestAnimationFrame(()=>{this.dom&&this.dom.setAttribute(`aria-hidden`,`false`)})}else this.dom.style.display=`none`,this.dom.setAttribute(`aria-hidden`,`true`)};destroy(){document.removeEventListener(`mousedown`,this.mousedown),document.removeEventListener(`mouseup`,this.mouseup),this.view.scrollDOM.removeEventListener(`scroll`,this.scroll),window.removeEventListener(`scroll`,this.windowScroll,!0),this.dom.remove()}}),Fc=N.baseTheme({".cm-ai-tooltip-button":{userSelect:`none`,fontFamily:`system-ui, -apple-system, sans-serif`,position:`fixed`,display:`flex`,boxSizing:`border-box`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`,backgroundColor:`#0E639C`,color:`#ffffff`,border:`1px solid transparent`,boxShadow:`0 2px 4px rgba(0,0,0,0.1)`,zIndex:`999`,transition:`opacity 0.5s`,"&[aria-hidden='true']":{opacity:`0`},"&[aria-hidden='false']":{opacity:`1`},"& > span":{pointerEvents:`auto`,cursor:`pointer`,display:`inline-block`,padding:`2px`},"&:hover":{backgroundColor:`#1177bb`}}});function Ic(){return[Pc,Fc]}var Lc=class extends ci{oldCode;constructor(e){super(),this.oldCode=e}toDOM(e){let t=gc(`div`,`cm-old-code-container`);t.setAttribute(`role`,`region`),t.setAttribute(`aria-label`,`Previous code version`);let n=gc(`div`,`cm-old-code cm-line`);n.textContent=this.oldCode;let r=gc(`div`,`cm-floating-buttons`),i=e.state.facet($s),a={...Zs,...i.keymaps},o=gc(`button`,`cm-floating-button cm-floating-accept`);o.innerHTML=`<span class="hotkey">${hc(a.acceptEdit)}</span> Accept`,o.setAttribute(`aria-label`,`Accept changes`),o.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),e.focus(),dc(e)});let s=gc(`button`,`cm-floating-button cm-floating-reject`);return s.innerHTML=`<span class="hotkey">${hc(a.rejectEdit)}</span> Reject`,s.setAttribute(`aria-label`,`Reject changes`),s.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),e.focus(),fc(e)}),r.append(o,s),t.append(n,r),t}updateDOM(e,t){return!0}},Rc=class extends ci{complete;abortController=null;dom=null;input=null;loadingContainer=null;helpInfo=null;inputContainer=null;form=null;view=null;constructor(e){super(),this.complete=e}toDOM(e){if(this.dom)return this.dom;this.view=e;let t=e.state.field(ic),n=e.state.field(cc),r=gc(`div`,`cm-ai-input-container`);this.inputContainer=r,this.dom=r;let i=gc(`form`,`cm-ai-input-form`);this.form=i,i.setAttribute(`role`,`search`),i.setAttribute(`aria-label`,`AI editing instructions`),i.addEventListener(`submit`,e=>e.preventDefault());let a=gc(`input`,`cm-ai-input`);this.input=a,i.append(a),a.placeholder=`Editing instructions...`,a.setAttribute(`aria-label`,`AI editing instructions`),a.setAttribute(`autocomplete`,`off`),a.setAttribute(`spellcheck`,`true`),a.value=t.inputValue;let o=gc(`div`,`cm-ai-loading-container`);this.loadingContainer=o;let s=gc(`div`,`cm-ai-loading-indicator`);s.setAttribute(`role`,`status`),s.setAttribute(`aria-live`,`polite`),s.textContent=`Generating`;let c=gc(`button`,`cm-ai-cancel-button`);c.textContent=`Cancel`,c.setAttribute(`aria-label`,`Cancel code generation`),c.addEventListener(`click`,this.onCancel),o.append(c,s);let l=gc(`div`,`cm-ai-help-info`);this.helpInfo=l;let u=l.appendChild(document.createElement(`button`));u.className=`cm-ai-help-info-button`,u.textContent=`Esc to close`,u.addEventListener(`click`,this.onCancel);let d=gc(`button`,`cm-ai-generate-button`);d.textContent=`⏎ Generate`,d.setAttribute(`aria-label`,`Generate code`),d.addEventListener(`click`,this.handleSubmit),this.toggleLoading(n),t.shouldFocus&&requestAnimationFrame(()=>{a.value=t.inputValue,a.focus(),e.dispatch({effects:rc.of(!1)})}),f(a.value),a.addEventListener(`input`,m),a.addEventListener(`keydown`,this.onKeyDown);function f(e){l.replaceChildren(e?d:u)}let p=``;function m(){e.dispatch({effects:nc.of(a.value)});let t=a.value.trim();t!==p&&(p=t,f(t))}return r}toggleLoading(e){this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&this.inputContainer?.replaceChildren(this.form,e?this.loadingContainer:this.helpInfo)}onKeyDown=async e=>{e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),await this.handleSubmit()):e.key===`Escape`&&this.onCancel()};onCancel=()=>{this.cleanup();let e=this.view;e&&(e.dispatch({effects:[ec.of({show:!1,lineFrom:0,lineTo:0}),sc.of(!1)]}),e.focus())};handleSubmit=async e=>{let t=this.view;if(!t)return;let n=t.state.facet($s);e?.stopPropagation();let r=t.state.field(tc),{input:i}=this;if(!i)return;let a=i.value.trim();if(!r.show||!a)return;let o=t.state.doc.line(r.lineFrom),s=t.state.doc.line(r.lineTo),c=o.from,l=s.to,u=t.state.sliceDoc(c,l),d=t.state.sliceDoc(0,c),f=t.state.sliceDoc(l);this.abortController=new AbortController,t.dispatch({effects:sc.of(!0)}),this.toggleLoading(!0);try{let e=await this.complete({prompt:a,selection:u,codeBefore:d,codeAfter:f,editorView:t,signal:this.abortController.signal});if(!t.state.field(tc).show)return;if(!e||typeof e!=`string`)throw Error(`Invalid completion result`);t.dispatch({changes:{from:c,to:l,insert:e},effects:[ec.of({show:!1,lineFrom:0,lineTo:0}),ac.of({from:c,to:c+e.length,oldCode:u,newCode:e}),sc.of(!1)]})}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;n.onError?.(e)}finally{this.cleanup(),this.toggleLoading(!1),t.focus()}};updateDOM(e,t){return this.dom=e,this.input=e.querySelector(`.cm-ai-input`),!0}cleanup(){this.abortController?.abort(),this.abortController=null,this.dom?.remove(),this.input?.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}};function zc(e){if(!e.prompt)throw Error(`prompt function is required`);let t={...Zs,...e.keymaps};return[$s.of(e),tc,ic,oc,cc,Ic(),jc,ei.of([{key:t.showInput,run:uc}]),hi.highest([ei.of([{key:t.acceptEdit,run:dc},{key:t.rejectEdit,run:fc}])]),Bc,Vc,Hc,Uc]}var Bc=N.updateListener.of(e=>{let t=e.state.field(tc);if(!t.show||!e.docChanged)return;let{lineFrom:n,lineTo:r}=t,i=!1;e.changes.iterChanges((t,a,o,s)=>{let c=e.state.doc.lineAt(t).number;if(c<n){let t=e.state.doc.lineAt(s).number-e.state.doc.lineAt(o).number;n+=t,r+=t,i=!0}else if(c<=r){let t=e.state.doc.lineAt(s).number-e.state.doc.lineAt(o).number;r+=t,i=!0}}),i&&e.view.dispatch({effects:[ec.of({show:!0,lineFrom:n,lineTo:r})]})}),Vc=N.decorations.of(e=>{let t=e.state.field(oc);return t?M.set([M.mark({class:`cm-new-code-line`}).range(t.from,t.to)]):M.none}),Hc=N.decorations.compute([tc],e=>{let t=e.field(tc),n=e.facet($s),r=[];if(t.show){let i=t.lineFrom,a=t.lineTo;for(let t=i;t<=a;t++){let a=e.doc.line(t).from;r.push(M.line({class:`cm-ai-selection`}).range(a)),t===i&&r.push(M.widget({widget:new Rc(n.prompt),side:-1}).range(a))}}return M.set(r)}),Uc=Zr.define({create(e){return M.none},update(e,t){let n=t.state.field(oc);return n?M.set([M.widget({widget:new Lc(n.oldCode),block:!0}).range(n.from)]):M.none},provide:e=>N.decorations.from(e)});function Wc(e,t){if(e===0||e===-1)return`0 B`;let n=1024,r=[`B`,`KB`,`MB`,`GB`,`TB`],i=Math.floor(Math.log(e)/Math.log(n)),a=e/n**i;return`${Zi(a,t)} ${r[i]}`}function Gc(e,t){if(e===0)return`0s`;if(e<.001)return`${Zi(e*1e6,t)}µs`;if(e<1)return`${Zi(e*1e3,t)}ms`;if(e<60)return`${Zi(e,t)}s`;let n=Math.floor(e/60),r=e%60;if(n<60)return r>0?`${n}m ${Zi(r,t)}s`:`${n}m`;let i=Math.floor(n/60),a=n%60;return a>0?`${i}h ${a}m`:`${i}h`}var Kc=e=>{let t=(0,I.c)(8),{children:n,layerTop:r}=e,i=r!==void 0&&r,a;t[0]===n?a=t[1]:(a=F.Children.toArray(n),t[0]=n,t[1]=a);let[o,s]=a,c=`second-icon absolute ${i?`top-[-2px] left-[-2px]`:`bottom-[-2px] right-[-2px]`} rounded-full`,l;t[2]!==s||t[3]!==c?(l=(0,L.jsx)(`div`,{className:c,children:s}),t[2]=s,t[3]=c,t[4]=l):l=t[4];let u;return t[5]!==o||t[6]!==l?(u=(0,L.jsxs)(`div`,{className:`multi-icon relative w-fit`,children:[o,l]}),t[5]=o,t[6]=l,t[7]=u):u=t[7],u};function qc(){let e=(0,I.c)(3),{splitCell:t,undoSplitCell:n}=y(),r;return e[0]!==t||e[1]!==n?(r=e=>{let r=Ne(e.cellId);if(!r)return;let i=Me(r);t(e);let{dismiss:a}=jr({title:`Cell split`,action:(0,L.jsx)(fr,{"data-testid":`undo-split-button`,size:`sm`,variant:`outline`,onClick:()=>{n({...e,snapshot:i}),o()},children:`Undo`})}),o=a},e[0]=t,e[1]=n,e[2]=r):r=e[2],c(r)}var Jc={s3:{src:Xt,dark:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20id='Layer_1'%20x='0'%20y='0'%20version='1.1'%20viewBox='0.02%20102.6%20511.9%20306.4'%3e%3cstyle%3e.st1{fill-rule:evenodd;clip-rule:evenodd;fill:%23f90}%3c/style%3e%3cpath%20d='M144.3%20214.1c0%206.3.7%2011.4%201.9%2015.2%201.4%203.7%203.1%207.8%205.4%2012.3.9%201.4%201.2%202.7%201.2%203.9%200%201.7-1%203.4-3.2%205.1l-10.7%207.2c-1.5%201-3.1%201.5-4.4%201.5-1.7%200-3.4-.9-5.1-2.4-2.4-2.6-4.4-5.3-6.1-8-1.7-2.9-3.4-6.1-5.3-10-13.3%2015.7-30%2023.5-50.1%2023.5-14.3%200-25.7-4.1-34.1-12.3-8.3-8.2-12.6-19.1-12.6-32.7%200-14.5%205.1-26.2%2015.5-35.1S60.8%20169%2078.4%20169c5.8%200%2011.7.5%2018.1%201.4s12.8%202.2%2019.6%203.7v-12.4c0-12.9-2.7-22-8-27.2-5.4-5.3-14.6-7.8-27.8-7.8-6%200-12.1.7-18.4%202.2s-12.4%203.4-18.4%205.8c-2.7%201.2-4.8%201.9-6%202.2s-2%20.5-2.7.5c-2.4%200-3.6-1.7-3.6-5.3v-8.3c0-2.7.3-4.8%201.2-6s2.4-2.4%204.8-3.6c6-3.1%2013.1-5.6%2021.5-7.7%208.3-2.2%2017.2-3.2%2026.6-3.2%2020.3%200%2035.1%204.6%2044.6%2013.8%209.4%209.2%2014.1%2023.2%2014.1%2041.9v55.2h.3zM75.2%20240c5.6%200%2011.4-1%2017.5-3.1%206.1-2%2011.6-5.8%2016.2-10.9%202.7-3.2%204.8-6.8%205.8-10.9s1.7-9%201.7-14.8v-7.2c-4.9-1.2-10.2-2.2-15.7-2.9-5.4-.7-10.7-1-16-1-11.4%200-19.8%202.2-25.4%206.8S51%20207.1%2051%20215.6c0%208%202%2014%206.3%2018.1%204.1%204.2%2010%206.3%2017.9%206.3m136.7%2018.4c-3.1%200-5.1-.5-6.5-1.7-1.4-1-2.6-3.4-3.6-6.6l-40-131.6c-1-3.4-1.5-5.6-1.5-6.8%200-2.7%201.4-4.3%204.1-4.3h16.7c3.2%200%205.4.5%206.6%201.7%201.4%201%202.4%203.4%203.4%206.6l28.6%20112.7%2026.6-112.7c.9-3.4%201.9-5.6%203.2-6.6%201.4-1%203.7-1.7%206.8-1.7H270c3.2%200%205.4.5%206.8%201.7%201.4%201%202.6%203.4%203.2%206.6l26.9%20114.1%2029.5-114.1c1-3.4%202.2-5.6%203.4-6.6%201.4-1%203.6-1.7%206.6-1.7h15.8c2.7%200%204.3%201.4%204.3%204.3%200%20.9-.2%201.7-.3%202.7-.2%201-.5%202.4-1.2%204.3l-41%20131.6q-1.5%205.1-3.6%206.6c-1.4%201-3.6%201.7-6.5%201.7h-14.6c-3.2%200-5.4-.5-6.8-1.7s-2.6-3.4-3.2-6.8l-26.4-109.8L236.7%20250c-.9%203.4-1.9%205.6-3.2%206.8-1.4%201.2-3.7%201.7-6.8%201.7h-14.8zm218.8%204.6c-8.9%200-17.7-1-26.2-3.1-8.5-2-15.2-4.3-19.6-6.8-2.7-1.5-4.6-3.2-5.3-4.8s-1-3.2-1-4.8v-8.7c0-3.6%201.4-5.3%203.9-5.3%201%200%202%20.2%203.1.5%201%20.3%202.6%201%204.3%201.7%205.8%202.6%2012.1%204.6%2018.7%206%206.8%201.4%2013.5%202%2020.3%202%2010.7%200%2019.1-1.9%2024.9-5.6s8.9-9.2%208.9-16.2c0-4.8-1.5-8.7-4.6-11.9s-8.9-6.1-17.2-8.9l-24.7-7.7c-12.4-3.9-21.6-9.7-27.2-17.4-5.6-7.5-8.5-15.8-8.5-24.7%200-7.2%201.5-13.5%204.6-18.9s7.2-10.2%2012.3-14c5.1-3.9%2010.9-6.8%2017.7-8.9%206.8-2%2014-2.9%2021.5-2.9%203.7%200%207.7.2%2011.4.7%203.9.5%207.5%201.2%2011.1%201.9%203.4.9%206.6%201.7%209.7%202.7s5.4%202%207.2%203.1c2.4%201.4%204.1%202.7%205.1%204.3%201%201.4%201.5%203.2%201.5%205.6v8c0%203.6-1.4%205.4-3.9%205.4-1.4%200-3.6-.7-6.5-2q-14.55-6.6-32.7-6.6c-9.7%200-17.4%201.5-22.6%204.8s-8%208.2-8%2015.2c0%204.8%201.7%208.9%205.1%2012.1s9.7%206.5%2018.7%209.4l24.2%207.7c12.3%203.9%2021.1%209.4%2026.4%2016.3s7.8%2015%207.8%2023.8c0%207.3-1.5%2014-4.4%2019.8-3.1%205.8-7.2%2010.9-12.4%2015-5.3%204.3-11.6%207.3-18.9%209.5-8%202.5-16%203.7-24.7%203.7'%20style='fill:%23fff'/%3e%3cpath%20fill='%23fff'%20d='M462.9%20345.7c-56%2041.4-137.4%2063.3-207.4%2063.3-98.1%200-186.5-36.3-253.2-96.6-5.3-4.8-.5-11.2%205.8-7.5%2072.2%2041.9%20161.3%2067.3%20253.4%2067.3%2062.2%200%20130.4-12.9%20193.3-39.5%209.3-4.2%2017.3%206.2%208.1%2013'%20class='st1'/%3e%3cpath%20fill='%23fff'%20d='M486.2%20319.2c-7.2-9.2-47.3-4.4-65.6-2.2-5.4.7-6.3-4.1-1.4-7.7%2032-22.5%2084.6-16%2090.8-8.5%206.1%207.7-1.7%2060.3-31.7%2085.5-4.6%203.9-9%201.9-7-3.2%206.9-16.9%2022.1-54.9%2014.9-63.9'%20class='st1'/%3e%3c/svg%3e`},coreweave:{src:`data:image/svg+xml,%3csvg%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns='http://www.w3.org/2000/svg'%20id='Layer_1'%20data-name='Layer%201'%20viewBox='0%200%20224.09%20161.1'%20width='224.09'%20height='161.1'%20%3e%3cdefs%3e%3cstyle%3e%20.cls-1,%20.cls-2%20{%20fill:%20%23000;%20stroke-width:%200px;%20}%20.cls-2%20{%20fill-rule:%20evenodd;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='cls-2'%20d='M92.1,112.3h-27.07c-1.65,0-3.3-.99-4.29-2.64l-12.55-22.47c-.66-1.65-.66-3.3,0-4.62l12.55-22.47c.99-1.65,2.64-2.64,4.29-2.64h15.52c1.65,0,3.3-.99,4.29-2.64l11.23-20.16c.99-1.65-.33-3.63-1.98-3.63h-41.6c-3.63,0-6.6,1.98-8.58,4.96l-24.76,44.28c-1.65,2.97-1.65,6.61,0,9.58l24.76,43.94c1.65,2.97,4.95,4.96,8.58,4.96h53.15c1.98,0,2.97-1.98,1.98-3.64l-11.55-20.49c-.33-1.65-1.98-2.31-3.96-2.31Z'/%3e%3cpath%20class='cls-1'%20d='M165.4,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.55,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61,0-9.58Z'/%3e%3cpath%20class='cls-2'%20d='M111.58,86.86l13.21-23.46c.66-1.32.66-3.3,0-4.96l-15.19-26.1c-.99-1.65-3.3-1.65-4.29,0l-12.88,22.8c-.66,1.32-.66,3.3,0,4.63l14.86,26.76c.99,1.98,3.63,1.98,4.29.33Z'/%3e%3cpath%20class='cls-1'%20d='M204.35,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.89,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61-.33-9.58Z'/%3e%3c/svg%3e`,dark:`data:image/svg+xml,%3csvg%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns='http://www.w3.org/2000/svg'%20id='Layer_1'%20data-name='Layer%201'%20viewBox='0%200%20224.09%20161.1'%20width='224.09'%20height='161.1'%3e%3cdefs%3e%3cstyle%3e%20.cls-1,%20.cls-2%20{%20fill:%20%23fff;%20stroke-width:%200px;%20}%20.cls-2%20{%20fill-rule:%20evenodd;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='cls-2'%20d='M92.1,112.3h-27.07c-1.65,0-3.3-.99-4.29-2.64l-12.55-22.47c-.66-1.65-.66-3.3,0-4.62l12.55-22.47c.99-1.65,2.64-2.64,4.29-2.64h15.52c1.65,0,3.3-.99,4.29-2.64l11.23-20.16c.99-1.65-.33-3.63-1.98-3.63h-41.6c-3.63,0-6.6,1.98-8.58,4.96l-24.76,44.28c-1.65,2.97-1.65,6.61,0,9.58l24.76,43.94c1.65,2.97,4.95,4.96,8.58,4.96h53.15c1.98,0,2.97-1.98,1.98-3.64l-11.55-20.49c-.33-1.65-1.98-2.31-3.96-2.31Z'%3e%3c/path%3e%3cpath%20class='cls-1'%20d='M165.4,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.55,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61,0-9.58Z'%3e%3c/path%3e%3cpath%20class='cls-2'%20d='M111.58,86.86l13.21-23.46c.66-1.32.66-3.3,0-4.96l-15.19-26.1c-.99-1.65-3.3-1.65-4.29,0l-12.88,22.8c-.66,1.32-.66,3.3,0,4.63l14.86,26.76c.99,1.98,3.63,1.98,4.29.33Z'%3e%3c/path%3e%3cpath%20class='cls-1'%20d='M204.35,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.89,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61-.33-9.58Z'%3e%3c/path%3e%3c/svg%3e`},cloudflare:{src:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20128%20128'%3e%3cpath%20fill='%23FFF'%20d='m115.679%2069.288-15.591-8.94-2.689-1.163-63.781.436v32.381h82.061z'/%3e%3cpath%20fill='%23F38020'%20d='M87.295%2089.022c.763-2.617.472-5.015-.8-6.796-1.163-1.635-3.125-2.58-5.488-2.689l-44.737-.581c-.291%200-.545-.145-.691-.363s-.182-.509-.109-.8c.145-.436.581-.763%201.054-.8l45.137-.581c5.342-.254%2011.157-4.579%2013.192-9.885l2.58-6.723c.109-.291.145-.581.073-.872-2.906-13.158-14.644-22.97-28.672-22.97-12.938%200-23.913%208.359-27.838%2019.952a13.35%2013.35%200%200%200-9.267-2.58c-6.215.618-11.193%205.597-11.811%2011.811-.145%201.599-.036%203.162.327%204.615C10.104%2070.051%202%2078.337%202%2088.549c0%20.909.073%201.817.182%202.726a.895.895%200%200%200%20.872.763h82.57c.472%200%20.909-.327%201.054-.8l.617-2.216z'/%3e%3cpath%20fill='%23FAAE40'%20d='M101.542%2060.275c-.4%200-.836%200-1.236.036-.291%200-.545.218-.654.509l-1.744%206.069c-.763%202.617-.472%205.015.8%206.796%201.163%201.635%203.125%202.58%205.488%202.689l9.522.581c.291%200%20.545.145.691.363.145.218.182.545.109.8-.145.436-.581.763-1.054.8l-9.924.582c-5.379.254-11.157%204.579-13.192%209.885l-.727%201.853c-.145.363.109.727.509.727h34.089c.4%200%20.763-.254.872-.654.581-2.108.909-4.325.909-6.614%200-13.447-10.975-24.422-24.458-24.422'/%3e%3c/svg%3e`},azure:{src:Qt},gcs:{src:`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='standard_product_icon'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20512%20512'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2029.1.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.0%20Build%20142)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20none;%20}%20.st1%20{%20fill:%20%234285f4;%20}%20.st2%20{%20fill:%20%2334a853;%20}%20.st3%20{%20fill:%20%23fbbc04;%20}%20.st4%20{%20fill:%20%23ea4335;%20}%20%3c/style%3e%3c/defs%3e%3cg%20id='bounding_box'%3e%3crect%20class='st0'%20width='512'%20height='512'/%3e%3c/g%3e%3cg%20id='art'%3e%3cpath%20class='st2'%20d='M442,277.9H70c-8.8,0-16,7.2-16,16v148.1c0,8.8,7.2,16,16,16h107.2c1.5.5,3.1.7,4.8.7s3.3-.3,4.8-.7h255.2c8.8,0,16-7.2,16-16v-148.1c0-8.8-7.2-16-16-16ZM86,309.9h80v116.1h-80v-116.1ZM426,425.9h-228v-116.1h228v116.1Z'/%3e%3cpath%20class='st3'%20d='M442,54H70c-8.8,0-16,7.2-16,16v148.8c0,8.8,7.2,16,16,16h372c8.8,0,16-7.2,16-16V70c0-8.8-7.2-16-16-16ZM86,86h80v116.8h-80v-116.8ZM426,202.8h-228v-116.8h228v116.8Z'/%3e%3cpath%20class='st4'%20d='M442,234.8h-16V86H54v-16c0-8.8,7.2-16,16-16h372c8.8,0,16,7.2,16,16v148.8c0,8.8-7.2,16-16,16Z'/%3e%3cpath%20class='st1'%20d='M442,457.9h-16v-148.1H54v-16c0-8.8,7.2-16,16-16h372c8.8,0,16,7.2,16,16v148.1c0,8.8-7.2,16-16,16Z'/%3e%3ccircle%20class='st4'%20cx='349'%20cy='144.4'%20r='37'/%3e%3ccircle%20class='st1'%20cx='349'%20cy='367.9'%20r='37'/%3e%3c/g%3e%3c/svg%3e`},http:ja,file:Ua,"in-memory":lr,gdrive:{src:`data:image/svg+xml,%3csvg%20viewBox='0%200%2087.3%2078'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m6.6%2066.85%203.85%206.65c.8%201.4%201.95%202.5%203.3%203.3l13.75-23.8h-27.5c0%201.55.4%203.1%201.2%204.5z'%20fill='%230066da'/%3e%3cpath%20d='m43.65%2025-13.75-23.8c-1.35.8-2.5%201.9-3.3%203.3l-25.4%2044a9.06%209.06%200%200%200%20-1.2%204.5h27.5z'%20fill='%2300ac47'/%3e%3cpath%20d='m73.55%2076.8c1.35-.8%202.5-1.9%203.3-3.3l1.6-2.75%207.65-13.25c.8-1.4%201.2-2.95%201.2-4.5h-27.502l5.852%2011.5z'%20fill='%23ea4335'/%3e%3cpath%20d='m43.65%2025%2013.75-23.8c-1.35-.8-2.9-1.2-4.5-1.2h-18.5c-1.6%200-3.15.45-4.5%201.2z'%20fill='%2300832d'/%3e%3cpath%20d='m59.8%2053h-32.3l-13.75%2023.8c1.35.8%202.9%201.2%204.5%201.2h50.8c1.6%200%203.15-.45%204.5-1.2z'%20fill='%232684fc'/%3e%3cpath%20d='m73.4%2026.5-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3l-13.75%2023.8%2016.15%2028h27.45c0-1.55-.4-3.1-1.2-4.5z'%20fill='%23ffba00'/%3e%3c/svg%3e`},hf:{src:`data:image/svg+xml,%3csvg%20width='256'%20height='256'%20viewBox='0%200%20256%20256'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M230.721%20172.7C230.183%20170.673%20229.313%20168.75%20228.146%20167.008C228.396%20166.091%20228.587%20165.159%20228.714%20164.217C229.543%20158.241%20227.471%20152.77%20223.567%20148.537C221.452%20146.225%20219.185%20144.698%20216.784%20143.761C218.36%20137.018%20219.157%20130.117%20219.161%20123.193C219.161%20120.03%20218.982%20116.932%20218.682%20113.88C218.526%20112.356%20218.337%20110.836%20218.115%20109.32C217.428%20104.847%20216.408%20100.431%20215.064%2096.11C214.183%2093.2707%20213.164%2090.476%20212.01%2087.736C210.281%2083.6782%20208.262%2079.75%20205.969%2075.982C204.465%2073.475%20202.827%2071.0508%20201.062%2068.72C200.197%2067.543%20199.296%2066.3938%20198.358%2065.274C195.58%2061.898%20192.561%2058.7277%20189.325%2055.788C188.25%2054.7997%20187.145%2053.8453%20186.01%2052.926C184.893%2051.9943%20183.751%2051.0927%20182.586%2050.222C180.241%2048.4766%20177.818%2046.8392%20175.324%2045.315C161.543%2036.945%20145.382%2032.145%20128.109%2032.145C77.817%2032.145%2037.057%2072.907%2037.057%20123.196C37.055%20130.208%2037.867%20137.196%2039.477%20144.02C37.317%20144.958%2035.247%20146.42%2033.327%20148.535C29.424%20152.766%2027.351%20158.217%2028.18%20164.193C28.306%20165.142%2028.495%20166.082%2028.747%20167.006C27.5811%20168.749%2026.7117%20170.673%2026.174%20172.7C24.974%20177.261%2025.369%20181.374%2026.894%20184.978C25.236%20189.688%2025.65%20194.704%2027.809%20199.065C29.379%20202.25%2031.626%20204.714%2034.396%20206.916C37.689%20209.534%2041.811%20211.758%2046.783%20213.892C52.715%20216.422%2059.956%20218.799%2063.249%20219.671C71.755%20221.873%2079.911%20223.269%2088.177%20223.337C99.954%20223.446%20110.096%20220.677%20117.357%20213.59C120.924%20214.027%20124.515%20214.246%20128.109%20214.244C131.906%20214.236%20135.699%20213.997%20139.467%20213.529C146.711%20220.661%20156.892%20223.455%20168.712%20223.343C176.977%20223.277%20185.133%20221.881%20193.617%20219.676C196.932%20218.804%20204.17%20216.427%20210.105%20213.897C215.077%20211.76%20219.199%20209.536%20222.514%20206.922C225.263%20204.719%20227.508%20202.256%20229.079%20199.071C231.26%20194.709%20231.652%20189.693%20230.017%20184.983C231.527%20181.379%20231.92%20177.257%20230.721%20172.7ZM222.281%20184.673C223.952%20187.844%20224.059%20191.427%20222.585%20194.764C220.349%20199.821%20214.795%20203.805%20204.008%20208.082C197.3%20210.742%20191.158%20212.443%20191.104%20212.458C182.232%20214.759%20174.208%20215.928%20167.262%20215.928C155.76%20215.928%20147.201%20212.754%20141.773%20206.486C132.594%20208.05%20123.222%20208.103%20114.026%20206.644C108.591%20212.808%20100.081%20215.928%2088.676%20215.928C81.729%20215.928%2073.706%20214.759%2064.833%20212.458C64.779%20212.443%2058.639%20210.742%2051.929%20208.082C41.143%20203.805%2035.587%20199.824%2033.352%20194.764C31.878%20191.427%2031.985%20187.844%2033.656%20184.673C33.81%20184.378%2033.976%20184.091%2034.153%20183.813C33.1516%20182.309%2032.4799%20180.61%2032.182%20178.827C31.8842%20177.045%2031.967%20175.22%2032.425%20173.472C33.089%20170.949%2034.46%20168.851%2036.322%20167.344C35.425%20165.87%2034.8365%20164.23%2034.592%20162.522C34.056%20158.808%2035.289%20155.1%2038.062%20152.076C40.222%20149.723%2043.275%20148.428%2046.655%20148.428H46.745C44.1965%20140.259%2042.9044%20131.75%2042.913%20123.193C42.913%2076.522%2080.749%2038.683%20127.427%2038.683C174.104%2038.683%20211.94%2076.518%20211.94%20123.193C211.947%20131.773%20210.646%20140.304%20208.081%20148.492C208.489%20148.452%20208.889%20148.432%20209.282%20148.431C212.662%20148.431%20215.716%20149.726%20217.874%20152.079C220.647%20155.1%20221.881%20158.811%20221.344%20162.525C221.1%20164.233%20220.511%20165.873%20219.615%20167.347C221.477%20168.854%20222.849%20170.952%20223.512%20173.475C223.97%20175.223%20224.053%20177.048%20223.755%20178.831C223.458%20180.613%20222.786%20182.312%20221.784%20183.816C221.961%20184.091%20222.129%20184.378%20222.281%20184.673Z'%20fill='white'/%3e%3cpath%20d='M221.784%20183.816C222.786%20182.312%20223.458%20180.613%20223.756%20178.831C224.053%20177.048%20223.97%20175.223%20223.512%20173.475C222.848%20170.952%20221.476%20168.854%20219.615%20167.347C220.512%20165.873%20221.1%20164.233%20221.344%20162.525C221.881%20158.811%20220.648%20155.103%20217.874%20152.079C215.716%20149.726%20212.662%20148.431%20209.282%20148.431C208.889%20148.431%20208.489%20148.452%20208.081%20148.492C210.643%20140.304%20211.942%20131.774%20211.933%20123.195C211.933%2076.5231%20174.097%2038.6851%20127.424%2038.6851C80.75%2038.6851%2042.9099%2076.5191%2042.9099%20123.195C42.9015%20131.752%2044.1936%20140.261%2046.742%20148.43H46.6519C43.2719%20148.43%2040.219%20149.724%2038.06%20152.077C35.287%20155.098%2034.0529%20158.81%2034.5899%20162.523C34.8346%20164.231%2035.4231%20165.872%2036.3199%20167.346C34.4579%20168.852%2033.086%20170.95%2032.422%20173.473C31.9642%20175.222%2031.8817%20177.047%2032.1799%20178.83C32.4781%20180.612%2033.1501%20182.312%2034.1519%20183.816C33.9739%20184.094%2033.8099%20184.381%2033.6549%20184.676C31.9849%20187.847%2031.877%20191.43%2033.352%20194.767C35.588%20199.824%2041.1419%20203.808%2051.9289%20208.085C58.6359%20210.745%2064.779%20212.446%2064.833%20212.461C73.705%20214.762%2081.729%20215.931%2088.675%20215.931C100.081%20215.931%20108.591%20212.811%20114.026%20206.647C123.222%20208.106%20132.594%20208.052%20141.773%20206.489C147.201%20212.757%20155.76%20215.931%20167.262%20215.931C174.208%20215.931%20182.232%20214.762%20191.103%20212.461C191.158%20212.446%20197.298%20210.745%20204.008%20208.085C214.795%20203.808%20220.35%20199.824%20222.585%20194.767C224.059%20191.43%20223.952%20187.847%20222.281%20184.676C222.129%20184.379%20221.961%20184.091%20221.784%20183.816ZM110.137%20196.997C109.669%20197.815%20109.168%20198.614%20108.635%20199.391C107.23%20201.448%20105.382%20203.02%20103.237%20204.188C99.1369%20206.424%2093.947%20207.205%2088.675%20207.205C80.346%20207.205%2071.808%20205.256%2067.023%20204.015C66.787%20203.954%2037.689%20195.735%2041.373%20188.739C41.993%20187.562%2043.0129%20187.092%2044.2979%20187.092C49.4849%20187.092%2058.9299%20194.816%2062.9889%20194.816C63.8959%20194.816%2064.5359%20194.43%2064.7969%20193.488C66.5269%20187.284%2038.5039%20184.676%2040.8639%20175.692C41.2799%20174.102%2042.41%20173.456%2043.998%20173.456C50.856%20173.455%2066.248%20185.516%2069.467%20185.516C69.714%20185.516%2069.8909%20185.443%2069.9869%20185.291C70.0009%20185.268%2070.015%20185.246%2070.028%20185.222C71.539%20182.727%2070.6719%20180.913%2060.3209%20174.573L59.3269%20173.968C47.9359%20167.074%2039.9409%20162.925%2044.4879%20157.975C45.0109%20157.404%2045.7529%20157.151%2046.6539%20157.151C47.7219%20157.151%2049.0149%20157.508%2050.4389%20158.108C56.4549%20160.645%2064.793%20167.564%2068.276%20170.581C68.8239%20171.057%2069.3683%20171.538%2069.9089%20172.022C69.9089%20172.022%2074.319%20176.608%2076.985%20176.608C77.599%20176.608%2078.1199%20176.366%2078.4729%20175.768C80.364%20172.58%2060.9099%20157.838%2059.8129%20151.755C59.0689%20147.634%2060.3349%20145.546%2062.6749%20145.546C63.7879%20145.546%2065.1459%20146.02%2066.6449%20146.971C71.2949%20149.922%2080.2729%20165.35%2083.5599%20171.352C84.6619%20173.363%2086.5429%20174.213%2088.2379%20174.213C91.6009%20174.213%2094.2299%20170.87%2088.5459%20166.622C80.0029%20160.23%2083.001%20149.782%2087.078%20149.139C87.252%20149.111%2087.4279%20149.097%2087.6029%20149.097C91.3109%20149.097%2092.9459%20155.486%2092.9459%20155.486C92.9459%20155.486%2097.7399%20167.524%20105.975%20175.753C113.447%20183.222%20114.491%20189.351%20110.137%20196.997ZM136.766%20198.407L136.339%20198.458L135.611%20198.541C135.228%20198.581%20134.844%20198.619%20134.459%20198.654L134.084%20198.688L133.741%20198.717L133.255%20198.756L132.718%20198.795L132.182%20198.83L132.063%20198.838C131.923%20198.846%20131.783%20198.855%20131.641%20198.862L131.462%20198.872C131.296%20198.881%20131.13%20198.889%20130.962%20198.896L130.381%20198.921L129.854%20198.939L129.502%20198.949H129.323C129.213%20198.949%20129.104%20198.955%20128.994%20198.956H128.82C128.71%20198.956%20128.601%20198.956%20128.491%20198.961L128.043%20198.967H127.418C126.927%20198.967%20126.437%20198.962%20125.949%20198.952L125.553%20198.943C125.44%20198.943%20125.327%20198.938%20125.216%20198.934L124.796%20198.922L124.275%20198.902L123.805%20198.881L123.684%20198.876L123.237%20198.853C123.112%20198.846%20122.989%20198.84%20122.865%20198.831L122.576%20198.814C122.213%20198.791%20121.85%20198.766%20121.487%20198.738L121.107%20198.707C120.947%20198.695%20120.787%20198.68%20120.628%20198.666C120.441%20198.65%20120.254%20198.632%20120.067%20198.614C119.754%20198.585%20119.441%20198.553%20119.128%20198.519H119.113C123.683%20188.324%20121.372%20178.802%20112.137%20169.575C106.08%20163.526%20102.051%20154.594%20101.215%20152.633C99.5229%20146.828%2095.045%20140.375%2087.608%20140.375C86.979%20140.375%2086.351%20140.425%2085.73%20140.523C82.472%20141.036%2079.624%20142.911%2077.592%20145.733C75.396%20143.002%2073.262%20140.831%2071.332%20139.605C68.422%20137.76%2065.5179%20136.824%2062.6889%20136.824C59.1579%20136.824%2056.0019%20138.274%2053.8019%20140.904L53.7459%20140.971C53.7039%20140.798%2053.6639%20140.625%2053.6229%20140.451L53.6179%20140.428C53.1992%20138.638%2052.8477%20136.833%2052.5639%20135.016C52.5639%20135.004%2052.5639%20134.992%2052.5579%20134.98C52.5359%20134.843%2052.5159%20134.705%2052.4949%20134.568C52.4334%20134.162%2052.3757%20133.755%2052.3219%20133.348C52.2979%20133.163%2052.2719%20132.978%2052.2489%20132.793L52.1809%20132.238C52.1589%20132.053%2052.1409%20131.885%2052.1209%20131.709L52.115%20131.665C52.0351%20130.945%2051.9651%20130.225%2051.9049%20129.503L51.8829%20129.226L51.8479%20128.754C51.8379%20128.625%2051.8279%20128.495%2051.8209%20128.365C51.8209%20128.334%2051.8159%20128.304%2051.8149%20128.275C51.7895%20127.913%2051.7678%20127.55%2051.7499%20127.187C51.7399%20126.998%2051.7299%20126.81%2051.7219%20126.62L51.7019%20126.124L51.6969%20125.974L51.6809%20125.517L51.6709%20125.128C51.6709%20124.973%2051.6629%20124.818%2051.6609%20124.663C51.6579%20124.508%2051.6539%20124.338%2051.6529%20124.174C51.6509%20124.01%2051.6529%20123.848%2051.6479%20123.685C51.6439%20123.521%2051.6479%20123.358%2051.6479%20123.195C51.6479%2081.3421%2085.5789%2047.4111%20127.436%2047.4111C169.292%2047.4111%20203.222%2081.3411%20203.222%20123.195V124.174C203.222%20124.337%20203.217%20124.501%20203.214%20124.663C203.214%20124.798%20203.208%20124.931%20203.204%20125.068C203.204%20125.188%20203.199%20125.309%20203.195%20125.425C203.195%20125.578%20203.186%20125.731%20203.181%20125.884V125.896L203.16%20126.427C203.153%20126.582%20203.147%20126.738%20203.139%20126.893L203.134%20127.003L203.107%20127.499C203.048%20128.562%20202.967%20129.623%20202.866%20130.683V130.696C202.849%20130.87%20202.832%20131.044%20202.813%20131.218L202.768%20131.629L202.679%20132.433L202.628%20132.84L202.565%20133.319C202.542%20133.493%20202.519%20133.668%20202.493%20133.841C202.467%20134.036%20202.438%20134.23%20202.409%20134.424L202.34%20134.883L202.258%20135.403C202.23%20135.576%20202.2%20135.748%20202.168%20135.92C202.135%20136.093%20202.109%20136.265%20202.079%20136.437C202.019%20136.781%20201.956%20137.125%20201.89%20137.468C201.789%20137.981%20201.686%20138.493%20201.58%20139.005L201.47%20139.512C201.434%20139.681%20201.395%20139.851%20201.357%20140.02C199.224%20137.947%20196.399%20136.818%20193.284%20136.818C190.457%20136.818%20187.55%20137.753%20184.641%20139.598C182.711%20140.824%20180.578%20142.996%20178.381%20145.726C176.346%20142.904%20173.498%20141.029%20170.242%20140.516C169.621%20140.418%20168.993%20140.368%20168.364%20140.368C160.925%20140.368%20156.45%20146.821%20154.757%20152.626C153.917%20154.587%20149.887%20163.519%20143.825%20169.577C134.596%20178.775%20132.268%20188.254%20136.766%20198.407ZM215.007%20177.998L214.977%20178.087C214.901%20178.288%20214.813%20178.484%20214.714%20178.674C214.639%20178.814%20214.558%20178.95%20214.47%20179.082C214.303%20179.331%20214.12%20179.569%20213.921%20179.793C213.875%20179.845%20213.831%20179.897%20213.779%20179.948C213.707%20180.025%20213.634%20180.101%20213.559%20180.175C212.213%20181.509%20210.161%20182.679%20207.841%20183.752C207.578%20183.871%20207.311%20183.99%20207.042%20184.11L206.774%20184.229C206.595%20184.308%20206.416%20184.386%20206.228%20184.463C206.049%20184.541%20205.863%20184.619%20205.677%20184.695L205.119%20184.925C203.814%20185.462%20202.477%20185.974%20201.173%20186.479L200.615%20186.696L200.064%20186.912C199.697%20187.055%20199.335%20187.198%20198.979%20187.341L198.448%20187.555L197.926%20187.768L197.67%20187.876C197.499%20187.947%20197.332%20188.018%20197.165%20188.089C193.328%20189.736%20190.567%20191.411%20191.147%20193.489C191.163%20193.548%20191.181%20193.604%20191.201%20193.659C191.253%20193.813%20191.324%20193.958%20191.413%20194.095C191.465%20194.176%20191.525%20194.253%20191.592%20194.323C192.274%20195.032%20193.515%20194.92%20195.08%20194.357C195.3%20194.276%20195.519%20194.192%20195.736%20194.104L195.872%20194.048C196.23%20193.896%20196.609%20193.726%20196.996%20193.542C197.093%20193.496%20197.191%20193.452%20197.289%20193.401C199.203%20192.465%20201.372%20191.205%20203.524%20190.058C204.385%20189.593%20205.258%20189.152%20206.142%20188.733C208.18%20187.774%20210.096%20187.094%20211.636%20187.094C212.359%20187.094%20212.997%20187.242%20213.529%20187.582L213.618%20187.641C213.952%20187.876%20214.232%20188.178%20214.441%20188.528C214.482%20188.595%20214.522%20188.666%20214.561%20188.739C215.322%20190.184%20214.685%20191.68%20213.194%20193.147C211.763%20194.556%20209.537%20195.937%20207.007%20197.215C206.819%20197.31%20206.631%20197.405%20206.44%20197.498C198.91%20201.196%20189.049%20203.981%20188.912%20204.016C186.284%20204.697%20182.526%20205.591%20178.292%20206.26L177.666%20206.358L177.563%20206.373C177.089%20206.445%20176.614%20206.512%20176.138%20206.574C175.655%20206.639%20175.167%20206.698%20174.676%20206.753L174.586%20206.763C172.806%20206.968%20171.019%20207.104%20169.228%20207.169H169.202C168.554%20207.192%20167.907%20207.204%20167.259%20207.204H166.512C165.524%20207.191%20164.538%20207.146%20163.553%20207.07C163.53%20207.07%20163.505%20207.07%20163.482%20207.064C163.129%20207.037%20162.777%20207.004%20162.425%20206.965C162.06%20206.926%20161.696%20206.882%20161.333%20206.833C161.094%20206.801%20160.856%20206.765%20160.618%20206.726C160.376%20206.687%20160.134%20206.647%20159.893%20206.605L159.564%20206.543L159.539%20206.538C159.192%20206.472%20158.847%20206.399%20158.503%20206.319C158.303%20206.274%20158.104%20206.23%20157.907%20206.176L157.788%20206.146C157.69%20206.122%20157.595%20206.096%20157.498%20206.07L157.445%20206.056L157.137%20205.966C157.025%20205.935%20156.913%20205.901%20156.801%20205.868L156.762%20205.857L156.471%20205.768C156.361%20205.734%20156.251%20205.698%20156.142%20205.662L155.874%20205.573L155.677%20205.504C155.487%20205.437%20155.298%20205.368%20155.111%20205.296L154.933%20205.226L154.786%20205.168C154.502%20205.054%20154.22%20204.935%20153.941%20204.81L153.756%20204.72L153.725%20204.706C153.659%20204.675%20153.594%20204.644%20153.528%20204.617C153.399%20204.555%20153.271%20204.491%20153.144%20204.426L153.105%20204.407L152.921%20204.31C152.594%20204.139%20152.274%20203.957%20151.96%20203.764L151.788%20203.658C151.702%20203.605%20151.616%20203.55%20151.532%20203.494L151.308%20203.346L151.067%20203.18L150.923%20203.077C150.771%20202.969%20150.622%20202.857%20150.476%20202.742L150.243%20202.563C150.15%20202.488%20150.058%20202.412%20149.967%20202.335C149.89%20202.272%20149.815%20202.206%20149.74%20202.14L149.734%20202.135C149.653%20202.064%20149.574%20201.993%20149.495%20201.92C149.417%20201.849%20149.339%20201.777%20149.263%20201.704L149.254%20201.695C149.174%20201.619%20149.096%20201.542%20149.019%20201.463C148.942%20201.385%20148.863%20201.307%20148.788%20201.227C148.713%20201.148%20148.636%20201.067%20148.562%20200.984C148.488%20200.902%20148.42%20200.827%20148.35%20200.746L148.327%20200.719C148.259%20200.641%20148.192%20200.562%20148.126%20200.481C147.983%20200.31%20147.844%20200.135%20147.71%20199.956C147.575%20199.776%20147.443%20199.592%20147.314%20199.405L147.191%20199.221C147.027%20198.981%20146.867%20198.739%20146.712%20198.493C146.596%20198.316%20146.483%20198.138%20146.373%20197.957C146.302%20197.844%20146.234%20197.73%20146.166%20197.618L146.138%20197.572C146.073%20197.462%20146.009%20197.354%20145.947%20197.245C145.911%20197.186%20145.877%20197.127%20145.845%20197.066C145.812%20197.004%20145.774%20196.941%20145.739%20196.878L145.682%20196.779L145.647%20196.715C145.58%20196.595%20145.514%20196.474%20145.45%20196.352C145.42%20196.298%20145.391%20196.244%20145.36%20196.192L145.271%20196.019L145.181%20195.848C144.956%20195.398%20144.743%20194.942%20144.543%20194.48L144.472%20194.311C144.426%20194.198%20144.383%20194.086%20144.337%20193.975C144.315%20193.921%20144.293%20193.868%20144.274%20193.814C144.167%20193.537%20144.067%20193.257%20143.975%20192.975C143.942%20192.874%20143.91%20192.775%20143.88%20192.675C143.808%20192.448%20143.743%20192.219%20143.685%20191.988C143.614%20191.719%20143.551%20191.448%20143.498%20191.175C143.487%20191.12%20143.476%20191.065%20143.467%20191.012C143.415%20190.745%20143.373%20190.476%20143.34%20190.206C143.332%20190.153%20143.326%20190.1%20143.32%20190.047L143.303%20189.885C143.281%20189.673%20143.264%20189.46%20143.254%20189.247C143.254%20189.193%20143.249%20189.139%20143.247%20189.087C143.242%20188.981%20143.24%20188.875%20143.239%20188.769C143.183%20184.496%20145.345%20180.388%20149.968%20175.767C158.203%20167.54%20162.997%20155.501%20162.997%20155.501C162.997%20155.501%20163.126%20154.996%20163.394%20154.269C163.431%20154.168%20163.47%20154.064%20163.514%20153.955C163.67%20153.548%20163.846%20153.148%20164.041%20152.758L164.08%20152.683C164.246%20152.351%20164.428%20152.027%20164.624%20151.712C164.67%20151.639%20164.714%20151.567%20164.765%20151.494C164.912%20151.277%20165.067%20151.065%20165.23%20150.86C165.319%20150.749%20165.416%20150.639%20165.513%20150.532C165.552%20150.49%20165.59%20150.448%20165.631%20150.408C166.108%20149.915%20166.653%20149.513%20167.27%20149.299L167.348%20149.273C167.4%20149.256%20167.452%20149.24%20167.505%20149.225C167.566%20149.209%20167.627%20149.195%20167.69%20149.182L167.719%20149.176C167.849%20149.15%20167.981%20149.133%20168.114%20149.124H168.125C168.194%20149.124%20168.264%20149.117%20168.335%20149.117C168.424%20149.117%20168.507%20149.117%20168.594%20149.126C168.684%20149.134%20168.773%20149.144%20168.863%20149.158C169.605%20149.276%20170.311%20149.718%20170.919%20150.4C171.15%20150.66%20171.358%20150.94%20171.54%20151.236C171.66%20151.428%20171.773%20151.631%20171.88%20151.845C171.923%20151.934%20171.964%20152.016%20172.004%20152.104C172.108%20152.33%20172.202%20152.56%20172.284%20152.795C172.479%20153.345%20172.626%20153.911%20172.723%20154.487C172.807%20154.992%20172.857%20155.502%20172.873%20156.013C172.881%20156.286%20172.881%20156.563%20172.873%20156.842C172.819%20158.14%20172.553%20159.421%20172.086%20160.634C172.044%20160.745%20171.997%20160.857%20171.952%20160.969C171.86%20161.195%20171.759%20161.417%20171.65%20161.634C171.569%20161.799%20171.484%20161.965%20171.392%20162.13C171.332%20162.24%20171.269%20162.35%20171.206%20162.46C171.045%20162.734%20170.871%20163.006%20170.684%20163.277L170.571%20163.439C170.129%20164.055%20169.637%20164.633%20169.099%20165.167C168.569%20165.698%20168.001%20166.189%20167.4%20166.637C166.798%20167.083%20166.233%20167.577%20165.711%20168.114C164.208%20169.691%20163.858%20171.083%20164.196%20172.138C164.25%20172.304%20164.321%20172.465%20164.407%20172.617C164.508%20172.791%20164.628%20172.951%20164.764%20173.097L164.817%20173.152L164.871%20173.206C164.925%20173.258%20164.982%20173.309%20165.043%20173.359L165.103%20173.407C165.248%20173.519%20165.402%20173.619%20165.563%20173.707C165.61%20173.732%20165.652%20173.757%20165.705%20173.781C165.879%20173.866%20166.058%20173.939%20166.242%20173.998C166.293%20174.015%20166.344%20174.03%20166.396%20174.046L166.461%20174.063L166.551%20174.087L166.628%20174.106L166.712%20174.124L166.795%20174.141L166.874%20174.154C166.932%20174.164%20166.992%20174.174%20167.052%20174.181L167.109%20174.19L167.213%20174.2L167.277%20174.207L167.382%20174.214H167.444L167.554%20174.22H167.9L167.999%20174.214L168.113%20174.207L168.252%20174.194L168.382%20174.179C168.412%20174.179%20168.442%20174.171%20168.472%20174.165C168.872%20174.107%20169.264%20174.001%20169.639%20173.849L169.798%20173.782C169.887%20173.743%20169.977%20173.702%20170.059%20173.658C170.235%20173.57%20170.406%20173.47%20170.57%20173.361C170.799%20173.211%20171.015%20173.043%20171.217%20172.858C171.265%20172.815%20171.312%20172.769%20171.358%20172.725C171.381%20172.703%20171.403%20172.682%20171.425%20172.658C171.469%20172.613%20171.514%20172.569%20171.558%20172.52C171.878%20172.168%20172.155%20171.78%20172.383%20171.363C174.34%20167.804%20176.391%20164.298%20178.534%20160.849L178.828%20160.378L179.125%20159.907C179.273%20159.668%20179.423%20159.433%20179.572%20159.199L179.722%20158.965C180.22%20158.185%20180.726%20157.41%20181.241%20156.641L181.546%20156.185C182.158%20155.278%20182.768%20154.396%20183.373%20153.558L183.674%20153.143C184.332%20152.236%20185.017%20151.348%20185.728%20150.482L186.01%20150.144C186.057%20150.088%20186.1%20150.032%20186.151%20149.978C186.244%20149.868%20186.337%20149.761%20186.428%20149.657C186.474%20149.604%20186.517%20149.552%20186.566%20149.5L186.834%20149.198L186.968%20149.051C187.103%20148.906%20187.235%20148.767%20187.365%20148.634C187.455%20148.544%20187.538%20148.455%20187.624%20148.371C188.131%20147.853%20188.69%20147.388%20189.293%20146.985L189.433%20146.895C189.567%20146.805%20189.706%20146.721%20189.848%20146.645C192.212%20145.303%20194.169%20145.204%20195.296%20146.331C195.978%20147.013%20196.356%20148.144%20196.335%20149.718C196.335%20149.787%20196.335%20149.857%20196.33%20149.929V150.006C196.33%20150.078%20196.324%20150.15%20196.318%20150.223C196.318%20150.313%20196.308%20150.402%20196.299%20150.492C196.29%20150.581%20196.285%20150.649%20196.276%20150.729C196.276%20150.751%20196.272%20150.774%20196.268%20150.798C196.262%20150.867%20196.253%20150.938%20196.243%20151.009C196.243%20151.03%20196.243%20151.052%20196.235%20151.074C196.224%20151.169%20196.21%20151.263%20196.194%20151.357C196.183%20151.447%20196.168%20151.531%20196.152%20151.619L196.126%20151.768C196.1%20151.91%20196.067%20152.05%20196.026%20152.188C195.948%20152.447%20195.854%20152.7%20195.743%20152.946C195.588%20153.284%20195.417%20153.613%20195.229%20153.933C195.125%20154.111%20195.018%20154.286%20194.907%20154.459C194.793%20154.638%20194.673%20154.819%20194.549%20155.002C194.233%20155.454%20193.905%20155.897%20193.564%20156.33L193.408%20156.527C192.852%20157.22%20192.278%20157.899%20191.686%20158.562L191.499%20158.772C191.247%20159.053%20190.991%20159.336%20190.729%20159.62L190.532%20159.834C190.401%20159.977%20190.264%20160.12%20190.132%20160.264C190.001%20160.407%20189.864%20160.552%20189.726%20160.697L189.315%20161.13L188.898%20161.566L188.478%20162.002C188.196%20162.294%20187.913%20162.586%20187.628%20162.878C183.573%20167.037%20179.301%20171.182%20177.855%20173.766C177.758%20173.934%20177.671%20174.108%20177.593%20174.285C177.387%20174.755%20177.301%20175.157%20177.36%20175.482C177.379%20175.589%20177.416%20175.691%20177.471%20175.785C177.552%20175.926%20177.651%20176.056%20177.766%20176.172C177.819%20176.224%20177.875%20176.272%20177.934%20176.316C178.232%20176.528%20178.591%20176.637%20178.957%20176.627H179.071L179.188%20176.618L179.305%20176.605L179.402%20176.591C179.415%20176.589%20179.429%20176.587%20179.442%20176.583L179.531%20176.566L179.554%20176.561L179.653%20176.54L179.688%20176.531C179.723%20176.522%20179.757%20176.513%20179.792%20176.503C179.827%20176.493%20179.875%20176.48%20179.917%20176.466C180.093%20176.413%20180.265%20176.35%20180.434%20176.278C180.523%20176.242%20180.61%20176.203%20180.696%20176.161C180.741%20176.141%20180.786%20176.12%20180.828%20176.098L180.962%20176.032C181.282%20175.866%20181.594%20175.685%20181.898%20175.491L182.031%20175.401C182.076%20175.373%20182.121%20175.344%20182.164%20175.312L182.297%20175.223L182.368%20175.174L182.56%20175.039C182.739%20174.916%20182.906%20174.789%20183.075%20174.66L183.09%20174.648L183.359%20174.44C183.726%20174.15%20184.074%20173.858%20184.39%20173.583L184.6%20173.399L184.619%20173.381L184.729%20173.284C184.987%20173.052%20185.217%20172.836%20185.408%20172.658L185.487%20172.581C185.556%20172.516%20185.619%20172.455%20185.676%20172.403L185.788%20172.292L185.828%20172.253L185.839%20172.242L185.956%20172.125L186.03%20172.048L186.039%20172.041L186.074%20172.009L186.118%20171.969L186.132%20171.956L186.169%20171.922L186.373%20171.743L186.487%20171.641C186.548%20171.588%20186.607%20171.534%20186.666%20171.479L186.802%20171.358C186.827%20171.338%20186.851%20171.316%20186.876%20171.294L187.019%20171.169L187.229%20170.984L187.341%20170.887C187.776%20170.509%20188.305%20170.052%20188.913%20169.537L189.162%20169.326L189.573%20168.981L189.994%20168.63C190.544%20168.173%20191.136%20167.688%20191.762%20167.185L192.173%20166.855C192.523%20166.576%20192.882%20166.292%20193.246%20166.006C193.393%20165.891%20193.542%20165.776%20193.694%20165.662C194.066%20165.373%20194.44%20165.086%20194.817%20164.803C195.675%20164.155%20196.56%20163.506%20197.456%20162.874L197.84%20162.606C198.109%20162.421%20198.377%20162.235%20198.645%20162.054L198.888%20161.89C199.367%20161.565%20199.853%20161.248%20200.343%20160.939L200.586%20160.786L200.827%20160.636C201.069%20160.486%20201.309%20160.339%20201.548%20160.196L201.787%20160.053L202.265%20159.775L202.734%20159.506L202.829%20159.454L203.2%20159.25C203.355%20159.166%20203.509%20159.085%20203.663%20159.006L203.892%20158.888L204.115%20158.776C204.193%20158.739%20204.27%20158.7%20204.346%20158.663C204.848%20158.415%20205.36%20158.187%20205.88%20157.979C206.021%20157.919%20206.161%20157.865%20206.3%20157.818L206.71%20157.674C206.833%20157.633%20206.953%20157.594%20207.068%20157.559L207.108%20157.547C207.17%20157.527%20207.232%20157.509%20207.293%20157.493L207.311%20157.488C207.439%20157.451%20207.566%20157.419%20207.691%20157.389H207.7C208.054%20157.304%20208.414%20157.243%20208.777%20157.206C208.944%20157.189%20209.111%20157.18%20209.279%20157.181H209.363C209.475%20157.181%20209.583%20157.188%20209.69%20157.199C209.739%20157.199%20209.788%20157.209%20209.836%20157.215H209.856C209.904%20157.221%20209.952%20157.228%20210%20157.239C210.047%20157.248%20210.095%20157.256%20210.141%20157.267H210.156C210.203%20157.277%20210.245%20157.289%20210.294%20157.303C210.548%20157.374%20210.79%20157.484%20211.012%20157.628C211.121%20157.699%20211.223%20157.779%20211.317%20157.868L211.344%20157.894C211.362%20157.91%20211.379%20157.927%20211.395%20157.944L211.444%20157.997C211.846%20158.418%20212.178%20158.901%20212.428%20159.427L212.466%20159.517C212.551%20159.717%20212.618%20159.924%20212.666%20160.135C212.808%20160.781%20212.753%20161.455%20212.508%20162.07C212.415%20162.318%20212.302%20162.557%20212.169%20162.785C211.858%20163.309%20211.489%20163.796%20211.07%20164.237L210.981%20164.332C210.848%20164.472%20210.71%20164.612%20210.565%20164.752C210.501%20164.815%20210.434%20164.877%20210.367%20164.94L210.162%20165.129L210.055%20165.224C209.797%20165.454%20209.532%20165.677%20209.263%20165.893C209.1%20166.025%20208.936%20166.154%20208.77%20166.281C208.184%20166.729%20207.587%20167.161%20206.979%20167.578C206.612%20167.83%20206.242%20168.077%20205.869%20168.321C204.95%20168.924%20204.021%20169.512%20203.083%20170.084C201.115%20171.294%20198.934%20172.588%20196.609%20173.995L196.007%20174.36C195.348%20174.762%20194.726%20175.146%20194.14%20175.512L193.845%20175.697L193.287%20176.055C192.917%20176.292%20192.548%20176.531%20192.179%20176.77L191.882%20176.966C191.737%20177.06%20191.593%20177.156%20191.449%20177.252L191.308%20177.342L190.876%20177.633L190.647%20177.79L190.379%20177.976L190.13%20178.149C189.713%20178.444%20189.325%20178.725%20188.968%20178.992L188.834%20179.094C188.624%20179.253%20188.416%20179.415%20188.211%20179.58C187.902%20179.829%20187.62%20180.067%20187.367%20180.296L187.243%20180.409C187.172%20180.474%20187.102%20180.539%20187.035%20180.603C186.989%20180.648%20186.946%20180.693%20186.898%20180.736L186.834%20180.8C186.691%20180.944%20186.551%20181.091%20186.416%20181.242L186.35%20181.318C186.203%20181.488%20186.075%20181.651%20185.963%20181.81L185.913%20181.881C185.825%20182.009%20185.744%20182.141%20185.671%20182.277C185.652%20182.311%20185.635%20182.345%20185.618%20182.379L185.569%20182.481L185.536%20182.555L185.515%20182.605L185.498%20182.65L185.475%20182.711C185.413%20182.88%20185.37%20183.056%20185.345%20183.234L185.337%20183.296L185.331%20183.354V183.669C185.331%20183.695%20185.331%20183.721%20185.338%20183.749L185.343%20183.797C185.343%20183.823%20185.349%20183.848%20185.353%20183.876C185.357%20183.902%20185.364%20183.949%20185.372%20183.986V183.991C185.379%20184.026%20185.386%20184.06%20185.395%20184.095C185.404%20184.13%20185.413%20184.17%20185.424%20184.206C185.443%20184.277%20185.467%20184.347%20185.492%20184.417C185.508%20184.459%20185.523%20184.5%20185.54%20184.541C185.54%20184.549%20185.546%20184.558%20185.55%20184.566L185.586%20184.647L185.636%20184.758C185.69%20184.873%20185.749%20184.985%20185.813%20185.094L185.879%20185.208L185.947%20185.322C185.959%20185.341%20185.973%20185.359%20185.988%20185.376L186.01%20185.399L186.035%20185.422L186.061%20185.442C186.099%20185.469%20186.14%20185.49%20186.183%20185.505C186.206%20185.513%20186.23%20185.519%20186.254%20185.525C186.831%20185.655%20188.017%20185.178%20189.593%20184.346C189.682%20184.298%20189.78%20184.248%20189.875%20184.196L190.355%20183.934L190.589%20183.804C190.756%20183.715%20190.926%20183.614%20191.1%20183.515L191.417%20183.336C193.5%20182.137%20195.988%20180.597%20198.56%20179.093C198.801%20178.952%20199.043%20178.811%20199.285%20178.672L199.771%20178.361C200.335%20178.038%20200.902%20177.719%20201.471%20177.404C202.188%20177.01%20202.91%20176.626%20203.639%20176.254L204.115%20176.013C204.431%20175.857%20204.744%20175.705%20205.053%20175.557C205.651%20175.273%20206.256%20175.003%20206.868%20174.748L207.203%20174.612L207.243%20174.596C209.018%20173.893%20210.627%20173.459%20211.929%20173.459C212.21%20173.456%20212.492%20173.48%20212.769%20173.528H212.778C212.867%20173.544%20212.948%20173.562%20213.031%20173.582H213.046C213.259%20173.636%20213.466%20173.713%20213.662%20173.812C213.937%20173.954%20214.184%20174.143%20214.393%20174.371C214.489%20174.477%20214.574%20174.592%20214.649%20174.714C214.789%20174.929%20214.899%20175.162%20214.978%20175.406C215.01%20175.501%20215.038%20175.594%20215.067%20175.693C215.278%20176.45%20215.257%20177.253%20215.007%20177.998Z'%20fill='%23FF9D00'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M203.21%20123.685V123.194C203.21%2081.34%20169.292%2047.411%20127.435%2047.411C85.5791%2047.411%2051.648%2081.342%2051.648%20123.194V123.358C51.646%20123.467%2051.645%20123.576%2051.648%20123.685C51.6529%20123.848%2051.6546%20124.011%2051.653%20124.174L51.6581%20124.534L51.661%20124.663C51.661%20124.723%2051.6631%20124.782%2051.6651%20124.842C51.6681%20124.937%2051.67%20125.033%2051.67%20125.128L51.681%20125.517L51.697%20125.974L51.702%20126.124L51.722%20126.597V126.62C51.73%20126.805%2051.7401%20126.989%2051.7491%20127.173L51.75%20127.187C51.76%20127.375%2051.7701%20127.564%2051.7821%20127.753C51.7921%20127.927%2051.802%20128.101%2051.815%20128.275L51.8171%20128.306C51.8258%20128.455%2051.8358%20128.605%2051.847%20128.754L51.85%20128.794L51.883%20129.226L51.8861%20129.254C51.8921%20129.338%2051.898%20129.422%2051.906%20129.503C51.9658%20130.224%2052.0355%20130.945%2052.1151%20131.664L52.12%20131.709L52.181%20132.238L52.2491%20132.793L52.299%20133.17L52.322%20133.347C52.3753%20133.755%2052.433%20134.162%2052.495%20134.568L52.4991%20134.595L52.558%20134.979C52.8435%20136.808%2053.1971%20138.626%2053.618%20140.429L53.6231%20140.451L53.655%20140.586L53.746%20140.971L53.802%20140.904C56.002%20138.274%2059.158%20136.824%2062.689%20136.824C65.519%20136.824%2068.4221%20137.76%2071.3321%20139.605C73.2621%20140.831%2075.3961%20143.002%2077.5921%20145.733C79.6241%20142.911%2082.4721%20141.035%2085.7301%20140.523C86.3513%20140.425%2086.9792%20140.376%2087.6081%20140.375C95.0441%20140.375%2099.523%20146.828%20101.215%20152.633C102.051%20154.594%20106.08%20163.526%20112.156%20169.568C121.392%20178.795%20123.703%20188.316%20119.132%20198.511H119.148C119.459%20198.546%20119.772%20198.578%20120.087%20198.607C120.274%20198.625%20120.46%20198.643%20120.648%20198.659L120.714%20198.665L121.127%20198.7L121.507%20198.73C121.869%20198.758%20122.232%20198.784%20122.596%20198.807L122.885%20198.824L123.114%20198.838L123.256%20198.846L123.703%20198.869L123.825%20198.874L124.294%20198.895L124.816%20198.915L125.235%20198.927L125.305%20198.929C125.394%20198.933%20125.483%20198.936%20125.572%20198.936L125.668%20198.939C126.258%20198.953%20126.847%20198.96%20127.437%20198.959H128.063L128.51%20198.954C128.62%20198.949%20128.729%20198.949%20128.84%20198.949H129.014L129.165%20198.945C129.224%20198.943%20129.283%20198.941%20129.343%20198.941H129.522L129.873%20198.932L130.401%20198.914L130.982%20198.888C131.15%20198.882%20131.316%20198.873%20131.482%20198.865L131.661%20198.854L131.927%20198.84L132.083%20198.831L132.201%20198.823L132.738%20198.788L133.274%20198.749L133.761%20198.71L134.103%20198.681L134.479%20198.647C135.107%20198.591%20135.733%20198.525%20136.359%20198.45L136.786%20198.399C132.287%20188.247%20134.616%20178.767%20143.813%20169.577C149.876%20163.519%20153.905%20154.587%20154.745%20152.625C156.438%20146.821%20160.914%20140.368%20168.352%20140.368C168.981%20140.368%20169.61%20140.418%20170.231%20140.516C173.486%20141.028%20176.334%20142.904%20178.369%20145.726C180.566%20142.996%20182.699%20140.823%20184.63%20139.597C187.539%20137.753%20190.445%20136.817%20193.272%20136.817C196.388%20136.817%20199.212%20137.947%20201.345%20140.02C201.384%20139.851%20201.422%20139.682%20201.459%20139.512L201.568%20139.006C201.607%20138.821%20201.646%20138.636%20201.683%20138.451C201.749%20138.124%20201.815%20137.797%20201.878%20137.467C201.944%20137.125%20202.007%20136.781%20202.067%20136.437L202.098%20136.251C202.117%20136.141%20202.135%20136.031%20202.156%20135.92C202.19%20135.748%20202.218%20135.576%20202.246%20135.402L202.257%20135.336L202.328%20134.883L202.398%20134.424V134.42C202.449%20134.081%20202.497%20133.742%20202.542%20133.403L202.553%20133.319L202.616%20132.841L202.667%20132.433L202.757%20131.629L202.792%20131.306L202.801%20131.218C202.82%20131.044%20202.838%20130.87%20202.854%20130.696V130.682C202.867%20130.544%20202.881%20130.405%20202.893%20130.266C202.964%20129.478%20203.024%20128.686%20203.072%20127.891C203.081%20127.761%20203.088%20127.63%20203.096%20127.499V127.493L203.122%20127.002L203.128%20126.892C203.144%20126.56%20203.158%20126.228%20203.169%20125.896V125.884L203.174%20125.754C203.179%20125.645%20203.183%20125.535%20203.183%20125.425L203.185%20125.381C203.189%20125.278%20203.193%20125.172%20203.193%20125.067L203.196%20124.977C203.199%20124.872%20203.202%20124.768%20203.202%20124.663L203.204%20124.574C203.207%20124.441%20203.21%20124.307%20203.21%20124.174V123.685ZM108.638%20199.391C114.64%20190.59%20114.214%20183.984%20105.98%20175.754C97.7441%20167.523%2092.951%20155.487%2092.951%20155.487C92.951%20155.487%2091.1621%20148.496%2087.0821%20149.138C83.0021%20149.78%2080.0091%20160.227%2088.5521%20166.622C97.0941%20173.017%2086.8521%20177.353%2083.5641%20171.352C80.2761%20165.35%2071.299%20149.923%2066.645%20146.972C61.991%20144.021%2058.718%20145.675%2059.815%20151.757C60.36%20154.776%2065.4281%20159.929%2070.1631%20164.743C74.9671%20169.627%2079.428%20174.163%2078.474%20175.768C76.581%20178.955%2069.9141%20172.023%2069.9141%20172.023C69.9141%20172.023%2049.038%20153.025%2044.494%20157.976C40.304%20162.539%2046.765%20166.418%2056.7211%20172.397C57.5671%20172.905%2058.4391%20173.429%2059.3321%20173.969C70.7231%20180.865%2071.609%20182.684%2069.992%20185.293C69.395%20186.257%2065.582%20183.968%2060.892%20181.153C52.897%20176.352%2042.3551%20170.023%2040.8661%20175.688C39.5781%20180.591%2047.334%20183.595%2054.368%20186.32C60.228%20188.59%2065.5881%20190.666%2064.7991%20193.484C63.9821%20196.406%2059.5531%20193.969%2054.7121%20191.305C49.2771%20188.314%2043.3221%20185.038%2041.3731%20188.735C37.6901%20195.725%2066.7831%20203.954%2067.0231%20204.015C76.4231%20206.453%20100.295%20211.619%20108.638%20199.391ZM147.303%20199.391C141.301%20190.59%20141.727%20183.984%20149.962%20175.754C158.197%20167.523%20162.99%20155.487%20162.99%20155.487C162.99%20155.487%20164.779%20148.496%20168.859%20149.138C172.939%20149.78%20175.932%20160.227%20167.39%20166.622C158.847%20173.017%20169.089%20177.353%20172.377%20171.352C175.666%20165.35%20184.637%20149.923%20189.291%20146.972C193.945%20144.021%20197.22%20145.675%20196.122%20151.757C195.578%20154.776%20190.509%20159.929%20185.774%20164.744C180.97%20169.628%20176.509%20174.163%20177.462%20175.768C179.355%20178.955%20186.027%20172.019%20186.027%20172.019C186.027%20172.019%20206.902%20153.022%20211.448%20157.973C215.637%20162.535%20209.176%20166.415%20199.219%20172.394C198.348%20172.917%20197.478%20173.441%20196.609%20173.966C185.218%20180.862%20184.332%20182.681%20185.948%20185.289C186.546%20186.254%20190.359%20183.964%20195.048%20181.149C203.044%20176.349%20213.586%20170.019%20215.075%20175.685C216.364%20180.588%20208.607%20183.592%20201.573%20186.317C195.713%20188.587%20190.353%20190.663%20191.141%20193.481C191.957%20196.402%20196.385%20193.965%20201.225%20191.301C206.66%20188.31%20212.616%20185.032%20214.564%20188.732C218.248%20195.726%20189.15%20203.947%20188.915%20204.007C179.515%20206.453%20155.643%20211.619%20147.303%20199.391Z'%20fill='%23FFD21E'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M152.047%20102.567C153.229%20102.985%20154.108%20104.257%20154.944%20105.468C156.074%20107.104%20157.126%20108.627%20158.74%20107.769C160.644%20106.756%20162.205%20105.202%20163.225%20103.302C164.246%20101.402%20164.681%2099.2427%20164.475%2097.096C164.321%2095.4908%20163.813%2093.9398%20162.987%2092.5548C162.161%2091.1697%20161.038%2089.985%20159.7%2089.0862C158.361%2088.1874%20156.839%2087.5968%20155.245%2087.3569C153.65%2087.117%20152.022%2087.2339%20150.478%2087.699C148.934%2088.1639%20147.513%2088.9653%20146.316%2090.0455C145.119%2091.1257%20144.176%2092.4578%20143.556%2093.946C142.936%2095.4342%20142.653%2097.0415%20142.728%2098.652C142.804%20100.263%20143.235%20101.836%20143.992%20103.26C144.74%20104.667%20146.4%20104.003%20148.152%20103.302C149.525%20102.753%20150.956%20102.181%20152.047%20102.567ZM100.672%20102.567C99.49%20102.985%2098.611%20104.258%2097.775%20105.468C96.645%20107.105%2095.592%20108.627%2093.979%20107.769C91.5845%20106.501%2089.7482%20104.386%2088.8278%20101.838C87.9075%2099.2895%2087.9692%2096.4896%2089.0008%2093.9841C90.0324%2091.4786%2091.9601%2089.4471%2094.408%2088.2855C96.856%2087.1239%2099.6488%2086.9156%20102.242%2087.701C104.307%2088.3228%20106.141%2089.5427%20107.513%2091.2065C108.885%2092.8704%20109.732%2094.9035%20109.949%2097.049C110.165%2099.1945%20109.74%20101.356%20108.728%20103.26C107.979%20104.667%20106.319%20104.003%20104.567%20103.303C103.193%20102.753%20101.764%20102.181%20100.672%20102.567ZM144.099%20149.318C152.242%20142.903%20155.233%20132.429%20155.233%20125.977C155.233%20120.877%20151.802%20122.482%20146.309%20125.202L145.999%20125.355C140.957%20127.852%20134.245%20131.177%20126.877%20131.177C119.508%20131.177%20112.796%20127.852%20107.755%20125.354C102.084%20122.545%2098.527%20120.783%2098.527%20125.978C98.527%20132.634%20101.709%20143.563%20110.443%20149.912C111.596%20147.573%20113.219%20145.497%20115.211%20143.813C117.202%20142.129%20119.52%20140.874%20122.018%20140.126C122.89%20139.866%20123.788%20141.367%20124.707%20142.904C125.594%20144.386%20126.501%20145.902%20127.423%20145.902C128.406%20145.902%20129.371%20144.408%20130.314%20142.95C131.299%20141.425%20132.26%20139.94%20133.189%20140.237C137.864%20141.738%20141.775%20144.993%20144.099%20149.318Z'%20fill='%2332343D'/%3e%3cpath%20d='M144.097%20149.317C139.856%20152.659%20134.219%20154.9%20126.878%20154.9C119.981%20154.9%20114.587%20152.922%20110.443%20149.911C111.596%20147.572%20113.219%20145.495%20115.211%20143.812C117.202%20142.128%20119.52%20140.873%20122.018%20140.125C123.73%20139.614%20125.545%20145.901%20127.423%20145.901C129.433%20145.901%20131.37%20139.655%20133.189%20140.236C137.863%20141.738%20141.773%20144.993%20144.097%20149.317Z'%20fill='%23FF323D'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M81.2%20111.64C80.2312%20112.288%2079.1173%20112.687%2077.9572%20112.801C76.7971%20112.916%2075.6267%20112.742%2074.55%20112.295C73.6893%20111.94%2072.9072%20111.418%2072.2488%20110.759C71.5903%20110.101%2071.0684%20109.319%2070.713%20108.458C70.267%20107.381%2070.0935%20106.211%2070.2082%20105.051C70.3228%20103.891%2070.7219%20102.777%2071.37%20101.808C72.1488%20100.642%2073.2558%2099.7333%2074.5512%2099.1967C75.8466%2098.6601%2077.272%2098.5197%2078.6471%2098.7935C80.0223%2099.0672%2081.2853%2099.7427%2082.2764%20100.734C83.2675%20101.726%2083.9422%20102.99%2084.215%20104.365C84.4883%20105.74%2084.3477%20107.165%2083.8113%20108.46C83.2748%20109.755%2082.3654%20110.861%2081.2%20111.64ZM182.613%20111.64C181.644%20112.288%20180.53%20112.687%20179.37%20112.801C178.209%20112.916%20177.039%20112.742%20175.962%20112.295C175.101%20111.939%20174.319%20111.418%20173.661%20110.759C173.003%20110.101%20172.481%20109.319%20172.125%20108.458C171.68%20107.381%20171.507%20106.211%20171.621%20105.051C171.736%20103.891%20172.135%20102.777%20172.782%20101.808C173.364%20100.936%20174.133%20100.205%20175.032%2099.6658C175.931%2099.1269%20176.938%2098.7942%20177.981%2098.6917C179.025%2098.5891%20180.078%2098.7193%20181.064%2099.0728C182.051%2099.4264%20182.947%2099.9944%20183.688%20100.736C184.68%20101.727%20185.355%20102.99%20185.628%20104.365C185.902%20105.74%20185.761%20107.165%20185.224%20108.46C184.687%20109.755%20183.779%20110.861%20182.613%20111.64Z'%20fill='%23FFAD03'/%3e%3c/svg%3e`},github:La},Yc=e=>{let t=(0,I.c)(11),{protocol:n,forceDark:r,className:i}=e,{theme:a}=Yi(),o=Jc[n.toLowerCase()]??Ua;if(`src`in o){let e=o.src;o.dark&&(r||a===`dark`)&&(e=o.dark);let s=e,c;t[0]===i?c=t[1]:(c=wn(`h-3.5 w-3.5`,i),t[0]=i,t[1]=c);let l;return t[2]!==n||t[3]!==e||t[4]!==c?(l=(0,L.jsx)(`img`,{src:s,alt:n,className:c}),t[2]=n,t[3]=e,t[4]=c,t[5]=l):l=t[5],l}let s=o,c;t[6]===i?c=t[7]:(c=wn(`h-3.5 w-3.5`,i),t[6]=i,t[7]=c);let l;return t[8]!==s||t[9]!==c?(l=(0,L.jsx)(s,{className:c}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l},Xc=un(`marimo:session-panel:state`,{openSections:[`variables`],hasUserInteracted:!1},ae,{getOnInit:!0}),Zc=un(`marimo:file-explorer-panel:state`,{openSections:[`files`],hasUserInteracted:!1},ae,{getOnInit:!0});function Qc(e,t){o.set(e,e=>e.openSections.includes(t)?e:{...e,openSections:[...e.openSections,t]})}var $c=()=>({entries:new Map}),{valueAtom:el,useActions:tl}=Mi($c,{submit:(e,t)=>{let{cellIds:n,deleteCell:r,deleteManyCells:i,store:a}=t,o=a.get(Se),s=a.get(ut),c=new Set(o.cellIds.inOrderIds.filter(e=>o.cellData[e].code.trim()===``)),l=new Map;for(let e of n){if(c.has(e)){l.set(e,{cellId:e,type:`simple`});continue}let t=o.cellRuntime[e],n=new Map;for(let t of Object.values(s)){let r=t.declaredBy.includes(e),i=t.usedBy.some(e=>!c.has(e));r&&i&&n.set(t.name,t.usedBy)}let r;t?.runElapsedTimeMs&&t.runElapsedTimeMs>2e3&&(r=t.runElapsedTimeMs),n.size===0&&r===void 0?l.set(e,{cellId:e,type:`simple`}):l.set(e,{cellId:e,type:`expensive`,executionDurationMs:r,defs:n})}let u=[...l.values()].every(e=>e.type===`simple`);return l.size>0&&u?(l.size===1?r({cellId:[...l.values()][0].cellId}):i({cellIds:[...l.values()].map(e=>e.cellId)}),$c()):{...e,entries:l}},clear:()=>$c()});function nl(){let e=n(),{submit:t,clear:r}=tl(),{entries:a}=i(el),o=pr(),s=mr();return{submit:n=>{t({cellIds:n,deleteCell:o,deleteManyCells:s,store:e})},clear:r,get idle(){return a.size===0},get shouldConfirmDelete(){return a.size>1}}}function rl(e){let t=(0,I.c)(16),n=i(el),r=tl(),a=mr(),o;t[0]!==e||t[1]!==n.entries?(o=n.entries.get(e),t[0]=e,t[1]=n.entries,t[2]=o):o=t[2];let s=o;if(!s){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e={isPending:!1},t[3]=e):e=t[3],e}if(n.entries.size!==1){let e;return t[4]===s?e=t[5]:(e={isPending:!0,shouldConfirmDelete:!1,...s},t[4]=s,t[5]=e),e}let c;t[6]!==r||t[7]!==a||t[8]!==n.entries?(c=()=>{a({cellIds:[...n.entries.values()].map(il)}),r.clear()},t[6]=r,t[7]=a,t[8]=n.entries,t[9]=c):c=t[9];let l;t[10]===r?l=t[11]:(l=()=>r.clear(),t[10]=r,t[11]=l);let u;return t[12]!==s||t[13]!==c||t[14]!==l?(u={isPending:!0,...s,shouldConfirmDelete:!0,confirm:c,cancel:l},t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15],u}function il(e){return e.cellId}async function al(e){if(!e.ok)throw Error(await e.text());if(!e.body)throw Error(`Failed to get response body`);let t=null,n=!1;if(await Kn({stream:Bn({stream:e.body,schema:qn}).pipeThrough(new TransformStream({transform(e){if(!e.success)throw e.error;let r=e.value;if(Hn(r)&&r.type===zn)t=Vn.parse(r.data).code;else if(r.type===`error`)throw Error(r.errorText);else r.type===`finish`&&(n=r.finishReason===`stop`)}})),onError:e=>{throw e}}),!n)throw Error(`AI completion ended before final validation`);if(t===null)throw Error(`AI completion returned no cell code`);return t}async function ol(e){let t=`
3
+ `,r);if(s>-1&&s<t&&(e=s),i&&p<f.length){let t=Math.max(0,m?f[p].toA:f[p].fromA);t<=e&&(e=t,m&&p++,o=!0)}if(e>r){let t=document.createTextNode(l.slice(r,e));if(a){let e=d.appendChild(document.createElement(`span`));e.className=a,e.appendChild(t)}else d.appendChild(t);r=e}o&&(m=!m)}}if(u&&t.toA-t.fromA<=o){let t=u.parser.parse(l),n=0;Gr(t,{style:t=>Yr(e,t)},(e,t,r)=>{e>n&&g(n,e,``),g(e,t,r),n=t}),g(n,l.length,``)}else g(0,l.length,``);return d.firstChild||d.appendChild(document.createElement(`br`)),c})});return Rs.set(t.changes,i),i}function Vs(e,t){let{state:n}=e,r=t??n.selection.main.head,i=e.state.field(Jo).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=e.state.sliceDoc(i.fromB,Math.max(i.fromB,i.toB-1)),o=e.state.field(Ls);i.fromB!=i.toB&&i.toA<=o.length&&(a+=e.state.lineBreak);let s=Fr.of({from:i.fromA,to:Math.min(o.length,i.toA),insert:a},o.length);return e.dispatch({effects:Is.of({doc:s.apply(o),changes:s}),userEvent:`accept`}),!0}function Hs(e,t){let{state:n}=e,r=t??n.selection.main.head,i=n.field(Jo).find(e=>e.fromB<=r&&e.endB>=r);if(!i)return!1;let a=n.field(Ls).sliceString(i.fromA,Math.max(i.fromA,i.toA-1));return i.fromA!=i.toA&&i.toB<=n.doc.length&&(a+=n.lineBreak),e.dispatch({changes:{from:i.fromB,to:Math.min(n.doc.length,i.toB),insert:a},userEvent:`revert`}),!0}function Us(e){let t=new ai;for(let n of e.field(Jo)){let r=e.facet(Go).overrideChunk&&Ks(e,n);t.add(n.fromB,n.fromB,Bs(e,n,!!r))}return t.finish()}var Ws=Qr.define({create:e=>Us(e),update(e,t){return t.state.field(Jo,!1)==t.startState.field(Jo,!1)?e:Us(t.state)},provide:e=>N.decorations.from(e)}),Gs=new WeakMap;function Ks(e,t){let n=Gs.get(t);if(n!==void 0)return n;n=null;let r=e.field(Ls),i=e.doc,a=r.lineAt(t.endA).number-r.lineAt(t.fromA).number+1,o=i.lineAt(t.endB).number-i.lineAt(t.fromB).number+1;abort:if(a==o&&a<10){let e=[],i=0,o=t.fromA,s=t.fromB;for(let n of t.changes){if(n.fromA<n.toA){i+=n.toA-n.fromA;let t=r.sliceString(o+n.fromA,o+n.toA);if(/\n/.test(t))break abort;e.push(M.widget({widget:new qs(t),side:-1}).range(s+n.fromB))}n.fromB<n.toB&&e.push(ls.range(s+n.fromB,s+n.toB))}i<t.endA-t.fromA-a*2&&(n=e)}return Gs.set(t,n),n}var qs=class extends li{constructor(e){super(),this.text=e}eq(e){return this.text==e.text}toDOM(e){let t=document.createElement(`del`);return t.className=`cm-deletedText`,t.textContent=this.text,t}},Js=new class extends ci{constructor(){super(...arguments),this.elementClass=`cm-inlineChangedLineGutter`}},Ys=M.line({class:`cm-inlineChangedLine`});function Xs(e,t,n,r){let i=Ks(e,t),a=0;if(!i)return!1;for(let o=e.doc.lineAt(t.fromB);;){for(r&&r.add(o.from,o.from,Js),n.add(o.from,o.from,Ys);a<i.length&&i[a].to<=o.to;){let e=i[a++];n.add(e.from,e.to,e.value)}if(o.to>=t.endB)break;o=e.doc.lineAt(o.to+1)}return!0}var Zs={showInput:`Mod-l`,acceptEdit:`Mod-y`,rejectEdit:`Mod-u`},Qs=300,$s=Vr.define({combine:e=>_i(e,{onError:console.error,inputDebounceTime:Qs,keymaps:Zs},{onError:(e,t)=>e&&t,inputDebounceTime:(e,t)=>e&&t,keymaps:(e,t)=>e&&t})}),ec=j.define(),tc=Qr.define({create(){return{show:!1,lineFrom:0,lineTo:0}},update(e,t){for(let e of t.effects)if(e.is(ec))return e.value;return e}}),nc=j.define(),rc=j.define(),ic=Qr.define({create(){return{shouldFocus:!1,inputValue:``}},update(e,t){let n=e;for(let e of t.effects)e.is(nc)&&(n={...n,inputValue:e.value}),e.is(rc)&&(n={...n,shouldFocus:e.value});return n}}),ac=j.define(),oc=Qr.define({create(){return null},update(e,t){for(let e of t.effects)if(e.is(ac))return e.value;return e}}),sc=j.define(),cc=Qr.define({create(){return!1},update(e,t){for(let e of t.effects)if(e.is(sc))return e.value;return e}}),lc=1,uc=e=>{let{state:t}=e,n=t.selection.main;if(n.empty)return!1;let r=t.doc,i=r.lineAt(n.from),a=r.lineAt(n.to);if(t.sliceDoc(i.from,a.to).trim().length<lc)return!1;let o=Math.max(1,Math.min(i.number,r.lines)),s=Math.max(1,Math.min(a.number,r.lines));return e.dispatch({effects:[ec.of({show:!0,lineFrom:o,lineTo:s}),rc.of(!0),nc.of(``)],selection:ni.cursor(i.from)}),!0},dc=e=>e.state.field(oc)?(e.dispatch({effects:[ac.of(null),ec.of({show:!1,lineFrom:0,lineTo:0}),rc.of(!1),nc.of(``),sc.of(!1)]}),!0):!1,fc=e=>{let t=e.state.field(oc);return t?(e.dispatch({changes:{from:t.from,to:t.to,insert:t.oldCode},effects:[ac.of(null),ec.of({show:!1,lineFrom:0,lineTo:0}),rc.of(!1),nc.of(``),sc.of(!1)]}),!0):!1},pc={mac:`⌘`,windows:`Ctrl`,default:`Ctrl`};function mc(){return navigator.platform.startsWith(`Mac`)?pc.mac:navigator.platform.startsWith(`Win`)?pc.windows:pc.default}function hc(e){return e.replace(`Mod`,mc()).replace(`-`,` `).toUpperCase()}function gc(e,t){let n=document.createElement(e);return n.className=t,n}function _c(e,t,n=void 0){let r=()=>{};return(...i)=>(r(),new Promise((a,o)=>{let s=setTimeout(()=>a(e(...i)),t);r=()=>{clearTimeout(s),n!==void 0&&o(n)}}))}var vc=Qr.define({create(){return{suggestion:null}},update(e,t){let n=t.effects.find(e=>e.is(yc));return!t.docChanged&&!n&&!t.selection?e:n&&t.state.doc===n.value.doc?{suggestion:n.value.text}:{suggestion:null}}}),yc=j.define();function bc(e,t){let n=e.state.selection.main.head,r=[],i=M.widget({widget:new xc(t),side:1});return r.push(i.range(n)),M.set(r)}var xc=class extends li{suggestion;constructor(e){super(),this.suggestion=e}toDOM(){let e=document.createElement(`span`);return e.style.opacity=`0.4`,e.className=`cm-inline-suggestion`,e.textContent=this.suggestion,e.setAttribute(`role`,`suggestion`),e.setAttribute(`aria-label`,`Suggestion: ${this.suggestion}`),e}get lineBreaks(){return this.suggestion.split(`
4
+ `).length-1}},Sc=class{cache=new Map;timeout;constructor(e){this.timeout=e}get(e){let t=this.cache.get(e);return t?Date.now()-t.timestamp>this.timeout?(this.cache.delete(e),null):t.result:null}set(e,t){this.cache.set(e,{result:t,timestamp:Date.now()})}},Cc=(e,t)=>vi.fromClass(class{abortController=null;cache;constructor(){this.cache=new Sc(t.cacheTimeout??1e3)}async update(n){if(!n.docChanged||t.events?.beforeSuggestionFetch?.(n.view)===!1)return;this.abortController?.abort(),this.abortController=new AbortController;let r=n.state.doc,i=r.toString(),a=this.cache.get(i);if(a){n.view.dispatch({effects:yc.of({text:a,doc:r})});return}try{let a=await e(n.state,this.abortController.signal,n.view);if(this.abortController.signal.aborted||t.events?.shouldShowSuggestion?.(n.view,a)===!1)return;this.cache.set(i,a),n.view.dispatch({effects:yc.of({text:a,doc:r})})}catch(e){e instanceof Error&&e.name!==`AbortError`&&console.error(`Suggestion fetch error:`,e)}}destroy(){this.abortController?.abort()}}),wc=vi.fromClass(class{decorations;constructor(){this.decorations=M.none}update(e){let t=e.state.field(vc)?.suggestion;if(!t){this.decorations=M.none;return}this.decorations=bc(e.view,t)}},{decorations:e=>e.decorations});function Tc(e,t,n,r){return{...e.changeByRange(i=>{if(i===e.selection.main)return{changes:{from:n,to:r,insert:t},range:ni.cursor(n+t.length)};let a=r-n;return!i.empty||a&&e.sliceDoc(i.from-a,i.from)!==e.sliceDoc(n,r)?{range:i}:{changes:{from:i.from-a,to:i.from,insert:t},range:ni.cursor(i.from-a+t.length)}}),userEvent:`input.complete`}}var Ec=e=>{let t=e.state.field(vc)?.suggestion;if(!t)return!1;let n=e.state.facet(kc);return e.dispatch({...Tc(e.state,t,e.state.selection.main.head,e.state.selection.main.head)}),n.events?.onSuggestionAccepted?.(e,t),!0},Dc=e=>{let t=e.state.field(vc)?.suggestion;if(!t)return!1;let n=e.state.facet(kc);return e.dispatch({effects:yc.of({text:null,doc:e.state.doc})}),n.events?.onSuggestionRejected?.(e,t),!0},Oc=ti.of([{key:`Tab`,run:Ec},{key:`Escape`,run:Dc}]),kc=Vr.define({combine:e=>e.at(-1)});function Ac(e){let{delay:t=500,includeKeymap:n=!0}=e,r=_c(e.fetchFn,t);return[vc,kc.of(e),Cc(r,e),wc,n?Oc:[]]}var jc=N.baseTheme({".cm-ai-input-container":{display:`flex`,flexDirection:`column`,gap:`4px`,width:`min(calc(100% + 7px), 500px)`,padding:`5px 5px`,margin:`0 -6px`,backgroundColor:`light-dark(rgb(241, 243, 245), rgb(40, 40, 40))`},".cm-ai-input":{display:`block`,width:`100%`,padding:`3px 8px`,border:`2px solid rgb(51, 154, 240)`,borderRadius:`5px`,fontSize:`12px`},".cm-ai-help-info-button":{fontSize:`10px`,paddingLeft:`10px`,height:`18px`,color:`light-dark(rgb(109, 117, 125), rgb(170, 170, 170))`,display:`block`,marginRight:`auto`},".cm-ai-help-info-button:hover":{color:`light-dark(rgb(89, 97, 105), rgb(190, 190, 190))`},".cm-ai-generate-button":{background:`#0E639C`,border:`none`,padding:`2px 6px`,color:`#ffffff`,cursor:`pointer`,font:`inherit`,borderRadius:`4px`,"&:hover":{backgroundColor:`#1177bb`}},".cm-line.cm-ai-selection, .cm-line.cm-ai-selection.cm-active-line":{backgroundColor:`light-dark(color-mix(in srgb, rgb(223, 227, 232) 50%, transparent), color-mix(in srgb, rgb(50, 50, 50) 50%, transparent)) !important`},".cm-line:has(.cm-new-code-line)":{backgroundColor:`light-dark(color-mix(in srgb, rgb(183, 235, 143) 50%, transparent), color-mix(in srgb, rgb(40, 100, 40) 50%, transparent)) !important`},".cm-old-code-container":{backgroundColor:`light-dark(rgb(255, 205, 205), rgb(100, 40, 40))`,position:`relative`,display:`flex`,paddingTop:`0`,width:`100%`,alignItems:`center`},".cm-code-button":{position:`absolute`,right:`5px`,top:`50%`,transform:`translateY(-50%)`,background:`none`,border:`none`,cursor:`pointer`,fontSize:`16px`},".cm-floating-buttons":{fontFamily:`sans-serif`,position:`absolute`,top:`-20px`,left:`5px`,display:`flex`},".cm-floating-button":{fontFamily:`sans-serif`,padding:`2px 5px`,fontSize:`10px`,cursor:`pointer`,fontWeight:`700`},".cm-floating-accept":{backgroundColor:`light-dark(rgb(55, 125, 34), rgb(40, 80, 25))`,borderTopLeftRadius:`5px`,borderBottomLeftRadius:`5px`,color:`white`,filter:`brightness(90%)`,"&:hover":{filter:`brightness(100%)`}},".cm-floating-reject":{backgroundColor:`light-dark(rgb(220, 53, 69), rgb(180, 40, 50))`,color:`white`,borderTopRightRadius:`5px`,borderBottomRightRadius:`5px`,filter:`brightness(90%)`,"&:hover":{filter:`brightness(100%)`}},".hotkey":{display:`inline-block`,padding:`0 4px`,borderRadius:`3px`,backgroundColor:`rgba(255, 255, 255, 0.1)`,fontSize:`90%`},".cm-ai-loading-indicator":{fontStyle:`italic`,fontSize:`10px`,paddingLeft:`12px`,color:`light-dark(rgb(109, 117, 125), rgb(170, 170, 170))`,opacity:`0`,transition:`opacity 0.3s ease-in-out`,"&::after":{content:`""`,display:`inline-block`,animation:`ellipsis-pulse 1.5s steps(4, end) infinite`},"&:not(:empty)":{opacity:`1`}},".cm-ai-input:disabled":{opacity:`0.5`},"@keyframes ellipsis-pulse":{"0%":{content:`'.'`},"25%":{content:`'..'`},"50%":{content:`'...'`},"75%":{content:`''`}},".cm-ai-loading-container":{display:`flex`,alignItems:`center`,padding:`0 8px`},".cm-ai-cancel-button":{padding:`2px 8px`,fontSize:`10px`,borderRadius:`4px`,color:`light-dark(rgb(109, 117, 125), rgb(170, 170, 170))`,cursor:`pointer`,"&:hover":{background:`light-dark(rgb(223, 227, 232), rgb(50, 50, 50))`}},".hidden":{display:`none`}});function Mc(e){let t=e.state.facet($s),n={...Zs,...t.keymaps},r=e.state.facet(Nc),i=gc(`div`,`cm-ai-tooltip`).appendChild(gc(`div`,`cm-ai-tooltip-button`)),a=i.appendChild(document.createElement(`span`));a.textContent=`${r.label} `;let o=a.appendChild(document.createElement(`span`));return o.className=`hotkey`,o.textContent=hc(n.showInput),i.querySelector(`span`)?.addEventListener(`mousedown`,e=>{e.stopPropagation(),e.button===0&&e.preventDefault()}),i.querySelector(`span`)?.addEventListener(`click`,t=>{t.preventDefault(),uc(e)}),i}var Nc=Vr.define({combine(e){return _i(e,{render:Mc,hideOnBlur:!1,label:`Edit with AI`})}}),Pc=vi.fromClass(class{view;suppress;dom;mousedown=()=>{this.suppress=!0};mouseup=()=>{this.suppress=!1,this.display(this.view)};scroll=()=>{this.display(this.view)};windowScroll=()=>{this.display(this.view)};constructor(e){this.view=e;let t=e.state.facet(Nc);this.suppress=!1,document.addEventListener(`mousedown`,this.mousedown),document.addEventListener(`mouseup`,this.mouseup),e.scrollDOM.addEventListener(`scroll`,this.scroll),window.addEventListener(`scroll`,this.windowScroll,!0);let n=t.render(e);e.dom.appendChild(n),this.dom=n}update(e){this.display(e.view)}docViewUpdate(e){this.display(e)}display(e){if(e.state.field(tc).show){this.dom.style.display=`none`;return}if(e.state.facet(Nc).hideOnBlur&&!e.hasFocus){this.dom.style.display=`none`,this.dom.setAttribute(`aria-hidden`,`true`);return}e.requestMeasure({read:this.#e})}#e=e=>{let t=e.state.selection.ranges.find(e=>!e.empty);if(t&&!this.suppress){let n=e.coordsAtPos(t.from),r=e.coordsAtPos(t.to);if(!n||!r)return;let i=e.dom.getBoundingClientRect(),a=e.dom.parentElement?.getBoundingClientRect(),o=e=>e.top>=i.top&&e.top<=i.bottom&&e.left>=i.left&&e.left<=i.right,s=e=>!a||e.top>=a.top&&e.top<=a.bottom&&e.left>=a.left&&e.left<=a.right,c=o(n)||o(r),l=s(n)||s(r);if(!c||!l){this.dom.style.display=`none`,this.dom.setAttribute(`aria-hidden`,`true`);return}this.dom.style.display=`flex`,this.dom.setAttribute(`aria-hidden`,`false`);let u=this.dom.getBoundingClientRect(),d=o(n)?n:r,f=i.right-u.width,p=Math.min(d.left,f),m=d.top-u.height,h=a?a.y:-1/0;m<h&&(m=r.bottom),this.dom.style.left=`${p}px`,this.dom.style.top=`${m}px`,requestAnimationFrame(()=>{this.dom&&this.dom.setAttribute(`aria-hidden`,`false`)})}else this.dom.style.display=`none`,this.dom.setAttribute(`aria-hidden`,`true`)};destroy(){document.removeEventListener(`mousedown`,this.mousedown),document.removeEventListener(`mouseup`,this.mouseup),this.view.scrollDOM.removeEventListener(`scroll`,this.scroll),window.removeEventListener(`scroll`,this.windowScroll,!0),this.dom.remove()}}),Fc=N.baseTheme({".cm-ai-tooltip-button":{userSelect:`none`,fontFamily:`system-ui, -apple-system, sans-serif`,position:`fixed`,display:`flex`,boxSizing:`border-box`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`,backgroundColor:`#0E639C`,color:`#ffffff`,border:`1px solid transparent`,boxShadow:`0 2px 4px rgba(0,0,0,0.1)`,zIndex:`999`,transition:`opacity 0.5s`,"&[aria-hidden='true']":{opacity:`0`},"&[aria-hidden='false']":{opacity:`1`},"& > span":{pointerEvents:`auto`,cursor:`pointer`,display:`inline-block`,padding:`2px`},"&:hover":{backgroundColor:`#1177bb`}}});function Ic(){return[Pc,Fc]}var Lc=class extends li{oldCode;constructor(e){super(),this.oldCode=e}toDOM(e){let t=gc(`div`,`cm-old-code-container`);t.setAttribute(`role`,`region`),t.setAttribute(`aria-label`,`Previous code version`);let n=gc(`div`,`cm-old-code cm-line`);n.textContent=this.oldCode;let r=gc(`div`,`cm-floating-buttons`),i=e.state.facet($s),a={...Zs,...i.keymaps},o=gc(`button`,`cm-floating-button cm-floating-accept`);o.innerHTML=`<span class="hotkey">${hc(a.acceptEdit)}</span> Accept`,o.setAttribute(`aria-label`,`Accept changes`),o.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),e.focus(),dc(e)});let s=gc(`button`,`cm-floating-button cm-floating-reject`);return s.innerHTML=`<span class="hotkey">${hc(a.rejectEdit)}</span> Reject`,s.setAttribute(`aria-label`,`Reject changes`),s.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),e.focus(),fc(e)}),r.append(o,s),t.append(n,r),t}updateDOM(e,t){return!0}},Rc=class extends li{complete;abortController=null;dom=null;input=null;loadingContainer=null;helpInfo=null;inputContainer=null;form=null;view=null;constructor(e){super(),this.complete=e}toDOM(e){if(this.dom)return this.dom;this.view=e;let t=e.state.field(ic),n=e.state.field(cc),r=gc(`div`,`cm-ai-input-container`);this.inputContainer=r,this.dom=r;let i=gc(`form`,`cm-ai-input-form`);this.form=i,i.setAttribute(`role`,`search`),i.setAttribute(`aria-label`,`AI editing instructions`),i.addEventListener(`submit`,e=>e.preventDefault());let a=gc(`input`,`cm-ai-input`);this.input=a,i.append(a),a.placeholder=`Editing instructions...`,a.setAttribute(`aria-label`,`AI editing instructions`),a.setAttribute(`autocomplete`,`off`),a.setAttribute(`spellcheck`,`true`),a.value=t.inputValue;let o=gc(`div`,`cm-ai-loading-container`);this.loadingContainer=o;let s=gc(`div`,`cm-ai-loading-indicator`);s.setAttribute(`role`,`status`),s.setAttribute(`aria-live`,`polite`),s.textContent=`Generating`;let c=gc(`button`,`cm-ai-cancel-button`);c.textContent=`Cancel`,c.setAttribute(`aria-label`,`Cancel code generation`),c.addEventListener(`click`,this.onCancel),o.append(c,s);let l=gc(`div`,`cm-ai-help-info`);this.helpInfo=l;let u=l.appendChild(document.createElement(`button`));u.className=`cm-ai-help-info-button`,u.textContent=`Esc to close`,u.addEventListener(`click`,this.onCancel);let d=gc(`button`,`cm-ai-generate-button`);d.textContent=`⏎ Generate`,d.setAttribute(`aria-label`,`Generate code`),d.addEventListener(`click`,this.handleSubmit),this.toggleLoading(n),t.shouldFocus&&requestAnimationFrame(()=>{a.value=t.inputValue,a.focus(),e.dispatch({effects:rc.of(!1)})}),f(a.value),a.addEventListener(`input`,m),a.addEventListener(`keydown`,this.onKeyDown);function f(e){l.replaceChildren(e?d:u)}let p=``;function m(){e.dispatch({effects:nc.of(a.value)});let t=a.value.trim();t!==p&&(p=t,f(t))}return r}toggleLoading(e){this.inputContainer&&this.form&&this.loadingContainer&&this.helpInfo&&this.inputContainer?.replaceChildren(this.form,e?this.loadingContainer:this.helpInfo)}onKeyDown=async e=>{e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),await this.handleSubmit()):e.key===`Escape`&&this.onCancel()};onCancel=()=>{this.cleanup();let e=this.view;e&&(e.dispatch({effects:[ec.of({show:!1,lineFrom:0,lineTo:0}),sc.of(!1)]}),e.focus())};handleSubmit=async e=>{let t=this.view;if(!t)return;let n=t.state.facet($s);e?.stopPropagation();let r=t.state.field(tc),{input:i}=this;if(!i)return;let a=i.value.trim();if(!r.show||!a)return;let o=t.state.doc.line(r.lineFrom),s=t.state.doc.line(r.lineTo),c=o.from,l=s.to,u=t.state.sliceDoc(c,l),d=t.state.sliceDoc(0,c),f=t.state.sliceDoc(l);this.abortController=new AbortController,t.dispatch({effects:sc.of(!0)}),this.toggleLoading(!0);try{let e=await this.complete({prompt:a,selection:u,codeBefore:d,codeAfter:f,editorView:t,signal:this.abortController.signal});if(!t.state.field(tc).show)return;if(!e||typeof e!=`string`)throw Error(`Invalid completion result`);t.dispatch({changes:{from:c,to:l,insert:e},effects:[ec.of({show:!1,lineFrom:0,lineTo:0}),ac.of({from:c,to:c+e.length,oldCode:u,newCode:e}),sc.of(!1)]})}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return;n.onError?.(e)}finally{this.cleanup(),this.toggleLoading(!1),t.focus()}};updateDOM(e,t){return this.dom=e,this.input=e.querySelector(`.cm-ai-input`),!0}cleanup(){this.abortController?.abort(),this.abortController=null,this.dom?.remove(),this.input?.remove(),this.dom=null,this.input=null}destroy(){this.cleanup()}};function zc(e){if(!e.prompt)throw Error(`prompt function is required`);let t={...Zs,...e.keymaps};return[$s.of(e),tc,ic,oc,cc,Ic(),jc,ti.of([{key:t.showInput,run:uc}]),gi.highest([ti.of([{key:t.acceptEdit,run:dc},{key:t.rejectEdit,run:fc}])]),Bc,Vc,Hc,Uc]}var Bc=N.updateListener.of(e=>{let t=e.state.field(tc);if(!t.show||!e.docChanged)return;let{lineFrom:n,lineTo:r}=t,i=!1;e.changes.iterChanges((t,a,o,s)=>{let c=e.state.doc.lineAt(t).number;if(c<n){let t=e.state.doc.lineAt(s).number-e.state.doc.lineAt(o).number;n+=t,r+=t,i=!0}else if(c<=r){let t=e.state.doc.lineAt(s).number-e.state.doc.lineAt(o).number;r+=t,i=!0}}),i&&e.view.dispatch({effects:[ec.of({show:!0,lineFrom:n,lineTo:r})]})}),Vc=N.decorations.of(e=>{let t=e.state.field(oc);return t?M.set([M.mark({class:`cm-new-code-line`}).range(t.from,t.to)]):M.none}),Hc=N.decorations.compute([tc],e=>{let t=e.field(tc),n=e.facet($s),r=[];if(t.show){let i=t.lineFrom,a=t.lineTo;for(let t=i;t<=a;t++){let a=e.doc.line(t).from;r.push(M.line({class:`cm-ai-selection`}).range(a)),t===i&&r.push(M.widget({widget:new Rc(n.prompt),side:-1}).range(a))}}return M.set(r)}),Uc=Qr.define({create(e){return M.none},update(e,t){let n=t.state.field(oc);return n?M.set([M.widget({widget:new Lc(n.oldCode),block:!0}).range(n.from)]):M.none},provide:e=>N.decorations.from(e)});function Wc(e,t){if(e===0||e===-1)return`0 B`;let n=1024,r=[`B`,`KB`,`MB`,`GB`,`TB`],i=Math.floor(Math.log(e)/Math.log(n)),a=e/n**i;return`${Zi(a,t)} ${r[i]}`}function Gc(e,t){if(e===0)return`0s`;if(e<.001)return`${Zi(e*1e6,t)}µs`;if(e<1)return`${Zi(e*1e3,t)}ms`;if(e<60)return`${Zi(e,t)}s`;let n=Math.floor(e/60),r=e%60;if(n<60)return r>0?`${n}m ${Zi(r,t)}s`:`${n}m`;let i=Math.floor(n/60),a=n%60;return a>0?`${i}h ${a}m`:`${i}h`}var Kc=e=>{let t=(0,I.c)(8),{children:n,layerTop:r}=e,i=r!==void 0&&r,a;t[0]===n?a=t[1]:(a=F.Children.toArray(n),t[0]=n,t[1]=a);let[o,s]=a,c=`second-icon absolute ${i?`top-[-2px] left-[-2px]`:`bottom-[-2px] right-[-2px]`} rounded-full`,l;t[2]!==s||t[3]!==c?(l=(0,L.jsx)(`div`,{className:c,children:s}),t[2]=s,t[3]=c,t[4]=l):l=t[4];let u;return t[5]!==o||t[6]!==l?(u=(0,L.jsxs)(`div`,{className:`multi-icon relative w-fit`,children:[o,l]}),t[5]=o,t[6]=l,t[7]=u):u=t[7],u};function qc(){let e=(0,I.c)(3),{splitCell:t,undoSplitCell:n}=y(),r;return e[0]!==t||e[1]!==n?(r=e=>{let r=Ne(e.cellId);if(!r)return;let i=Me(r);t(e);let{dismiss:a}=Mr({title:`Cell split`,action:(0,L.jsx)(pr,{"data-testid":`undo-split-button`,size:`sm`,variant:`outline`,onClick:()=>{n({...e,snapshot:i}),o()},children:`Undo`})}),o=a},e[0]=t,e[1]=n,e[2]=r):r=e[2],c(r)}var Jc={s3:{src:Qt,dark:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xml:space='preserve'%20id='Layer_1'%20x='0'%20y='0'%20version='1.1'%20viewBox='0.02%20102.6%20511.9%20306.4'%3e%3cstyle%3e.st1{fill-rule:evenodd;clip-rule:evenodd;fill:%23f90}%3c/style%3e%3cpath%20d='M144.3%20214.1c0%206.3.7%2011.4%201.9%2015.2%201.4%203.7%203.1%207.8%205.4%2012.3.9%201.4%201.2%202.7%201.2%203.9%200%201.7-1%203.4-3.2%205.1l-10.7%207.2c-1.5%201-3.1%201.5-4.4%201.5-1.7%200-3.4-.9-5.1-2.4-2.4-2.6-4.4-5.3-6.1-8-1.7-2.9-3.4-6.1-5.3-10-13.3%2015.7-30%2023.5-50.1%2023.5-14.3%200-25.7-4.1-34.1-12.3-8.3-8.2-12.6-19.1-12.6-32.7%200-14.5%205.1-26.2%2015.5-35.1S60.8%20169%2078.4%20169c5.8%200%2011.7.5%2018.1%201.4s12.8%202.2%2019.6%203.7v-12.4c0-12.9-2.7-22-8-27.2-5.4-5.3-14.6-7.8-27.8-7.8-6%200-12.1.7-18.4%202.2s-12.4%203.4-18.4%205.8c-2.7%201.2-4.8%201.9-6%202.2s-2%20.5-2.7.5c-2.4%200-3.6-1.7-3.6-5.3v-8.3c0-2.7.3-4.8%201.2-6s2.4-2.4%204.8-3.6c6-3.1%2013.1-5.6%2021.5-7.7%208.3-2.2%2017.2-3.2%2026.6-3.2%2020.3%200%2035.1%204.6%2044.6%2013.8%209.4%209.2%2014.1%2023.2%2014.1%2041.9v55.2h.3zM75.2%20240c5.6%200%2011.4-1%2017.5-3.1%206.1-2%2011.6-5.8%2016.2-10.9%202.7-3.2%204.8-6.8%205.8-10.9s1.7-9%201.7-14.8v-7.2c-4.9-1.2-10.2-2.2-15.7-2.9-5.4-.7-10.7-1-16-1-11.4%200-19.8%202.2-25.4%206.8S51%20207.1%2051%20215.6c0%208%202%2014%206.3%2018.1%204.1%204.2%2010%206.3%2017.9%206.3m136.7%2018.4c-3.1%200-5.1-.5-6.5-1.7-1.4-1-2.6-3.4-3.6-6.6l-40-131.6c-1-3.4-1.5-5.6-1.5-6.8%200-2.7%201.4-4.3%204.1-4.3h16.7c3.2%200%205.4.5%206.6%201.7%201.4%201%202.4%203.4%203.4%206.6l28.6%20112.7%2026.6-112.7c.9-3.4%201.9-5.6%203.2-6.6%201.4-1%203.7-1.7%206.8-1.7H270c3.2%200%205.4.5%206.8%201.7%201.4%201%202.6%203.4%203.2%206.6l26.9%20114.1%2029.5-114.1c1-3.4%202.2-5.6%203.4-6.6%201.4-1%203.6-1.7%206.6-1.7h15.8c2.7%200%204.3%201.4%204.3%204.3%200%20.9-.2%201.7-.3%202.7-.2%201-.5%202.4-1.2%204.3l-41%20131.6q-1.5%205.1-3.6%206.6c-1.4%201-3.6%201.7-6.5%201.7h-14.6c-3.2%200-5.4-.5-6.8-1.7s-2.6-3.4-3.2-6.8l-26.4-109.8L236.7%20250c-.9%203.4-1.9%205.6-3.2%206.8-1.4%201.2-3.7%201.7-6.8%201.7h-14.8zm218.8%204.6c-8.9%200-17.7-1-26.2-3.1-8.5-2-15.2-4.3-19.6-6.8-2.7-1.5-4.6-3.2-5.3-4.8s-1-3.2-1-4.8v-8.7c0-3.6%201.4-5.3%203.9-5.3%201%200%202%20.2%203.1.5%201%20.3%202.6%201%204.3%201.7%205.8%202.6%2012.1%204.6%2018.7%206%206.8%201.4%2013.5%202%2020.3%202%2010.7%200%2019.1-1.9%2024.9-5.6s8.9-9.2%208.9-16.2c0-4.8-1.5-8.7-4.6-11.9s-8.9-6.1-17.2-8.9l-24.7-7.7c-12.4-3.9-21.6-9.7-27.2-17.4-5.6-7.5-8.5-15.8-8.5-24.7%200-7.2%201.5-13.5%204.6-18.9s7.2-10.2%2012.3-14c5.1-3.9%2010.9-6.8%2017.7-8.9%206.8-2%2014-2.9%2021.5-2.9%203.7%200%207.7.2%2011.4.7%203.9.5%207.5%201.2%2011.1%201.9%203.4.9%206.6%201.7%209.7%202.7s5.4%202%207.2%203.1c2.4%201.4%204.1%202.7%205.1%204.3%201%201.4%201.5%203.2%201.5%205.6v8c0%203.6-1.4%205.4-3.9%205.4-1.4%200-3.6-.7-6.5-2q-14.55-6.6-32.7-6.6c-9.7%200-17.4%201.5-22.6%204.8s-8%208.2-8%2015.2c0%204.8%201.7%208.9%205.1%2012.1s9.7%206.5%2018.7%209.4l24.2%207.7c12.3%203.9%2021.1%209.4%2026.4%2016.3s7.8%2015%207.8%2023.8c0%207.3-1.5%2014-4.4%2019.8-3.1%205.8-7.2%2010.9-12.4%2015-5.3%204.3-11.6%207.3-18.9%209.5-8%202.5-16%203.7-24.7%203.7'%20style='fill:%23fff'/%3e%3cpath%20fill='%23fff'%20d='M462.9%20345.7c-56%2041.4-137.4%2063.3-207.4%2063.3-98.1%200-186.5-36.3-253.2-96.6-5.3-4.8-.5-11.2%205.8-7.5%2072.2%2041.9%20161.3%2067.3%20253.4%2067.3%2062.2%200%20130.4-12.9%20193.3-39.5%209.3-4.2%2017.3%206.2%208.1%2013'%20class='st1'/%3e%3cpath%20fill='%23fff'%20d='M486.2%20319.2c-7.2-9.2-47.3-4.4-65.6-2.2-5.4.7-6.3-4.1-1.4-7.7%2032-22.5%2084.6-16%2090.8-8.5%206.1%207.7-1.7%2060.3-31.7%2085.5-4.6%203.9-9%201.9-7-3.2%206.9-16.9%2022.1-54.9%2014.9-63.9'%20class='st1'/%3e%3c/svg%3e`},coreweave:{src:`data:image/svg+xml,%3csvg%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns='http://www.w3.org/2000/svg'%20id='Layer_1'%20data-name='Layer%201'%20viewBox='0%200%20224.09%20161.1'%20width='224.09'%20height='161.1'%20%3e%3cdefs%3e%3cstyle%3e%20.cls-1,%20.cls-2%20{%20fill:%20%23000;%20stroke-width:%200px;%20}%20.cls-2%20{%20fill-rule:%20evenodd;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='cls-2'%20d='M92.1,112.3h-27.07c-1.65,0-3.3-.99-4.29-2.64l-12.55-22.47c-.66-1.65-.66-3.3,0-4.62l12.55-22.47c.99-1.65,2.64-2.64,4.29-2.64h15.52c1.65,0,3.3-.99,4.29-2.64l11.23-20.16c.99-1.65-.33-3.63-1.98-3.63h-41.6c-3.63,0-6.6,1.98-8.58,4.96l-24.76,44.28c-1.65,2.97-1.65,6.61,0,9.58l24.76,43.94c1.65,2.97,4.95,4.96,8.58,4.96h53.15c1.98,0,2.97-1.98,1.98-3.64l-11.55-20.49c-.33-1.65-1.98-2.31-3.96-2.31Z'/%3e%3cpath%20class='cls-1'%20d='M165.4,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.55,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61,0-9.58Z'/%3e%3cpath%20class='cls-2'%20d='M111.58,86.86l13.21-23.46c.66-1.32.66-3.3,0-4.96l-15.19-26.1c-.99-1.65-3.3-1.65-4.29,0l-12.88,22.8c-.66,1.32-.66,3.3,0,4.63l14.86,26.76c.99,1.98,3.63,1.98,4.29.33Z'/%3e%3cpath%20class='cls-1'%20d='M204.35,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.89,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61-.33-9.58Z'/%3e%3c/svg%3e`,dark:`data:image/svg+xml,%3csvg%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xmlns='http://www.w3.org/2000/svg'%20id='Layer_1'%20data-name='Layer%201'%20viewBox='0%200%20224.09%20161.1'%20width='224.09'%20height='161.1'%3e%3cdefs%3e%3cstyle%3e%20.cls-1,%20.cls-2%20{%20fill:%20%23fff;%20stroke-width:%200px;%20}%20.cls-2%20{%20fill-rule:%20evenodd;%20}%20%3c/style%3e%3c/defs%3e%3cpath%20class='cls-2'%20d='M92.1,112.3h-27.07c-1.65,0-3.3-.99-4.29-2.64l-12.55-22.47c-.66-1.65-.66-3.3,0-4.62l12.55-22.47c.99-1.65,2.64-2.64,4.29-2.64h15.52c1.65,0,3.3-.99,4.29-2.64l11.23-20.16c.99-1.65-.33-3.63-1.98-3.63h-41.6c-3.63,0-6.6,1.98-8.58,4.96l-24.76,44.28c-1.65,2.97-1.65,6.61,0,9.58l24.76,43.94c1.65,2.97,4.95,4.96,8.58,4.96h53.15c1.98,0,2.97-1.98,1.98-3.64l-11.55-20.49c-.33-1.65-1.98-2.31-3.96-2.31Z'%3e%3c/path%3e%3cpath%20class='cls-1'%20d='M165.4,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.55,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61,0-9.58Z'%3e%3c/path%3e%3cpath%20class='cls-2'%20d='M111.58,86.86l13.21-23.46c.66-1.32.66-3.3,0-4.96l-15.19-26.1c-.99-1.65-3.3-1.65-4.29,0l-12.88,22.8c-.66,1.32-.66,3.3,0,4.63l14.86,26.76c.99,1.98,3.63,1.98,4.29.33Z'%3e%3c/path%3e%3cpath%20class='cls-1'%20d='M204.35,50.51l-10.57-17.84c-.99-1.65-3.3-1.65-4.29,0l-44.57,79.3c-.66,1.65-.66,3.3,0,4.63l11.89,20.82c.99,1.65,3.3,1.65,4.29,0l43.58-77.32c1.65-2.97,1.65-6.61-.33-9.58Z'%3e%3c/path%3e%3c/svg%3e`},cloudflare:{src:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20128%20128'%3e%3cpath%20fill='%23FFF'%20d='m115.679%2069.288-15.591-8.94-2.689-1.163-63.781.436v32.381h82.061z'/%3e%3cpath%20fill='%23F38020'%20d='M87.295%2089.022c.763-2.617.472-5.015-.8-6.796-1.163-1.635-3.125-2.58-5.488-2.689l-44.737-.581c-.291%200-.545-.145-.691-.363s-.182-.509-.109-.8c.145-.436.581-.763%201.054-.8l45.137-.581c5.342-.254%2011.157-4.579%2013.192-9.885l2.58-6.723c.109-.291.145-.581.073-.872-2.906-13.158-14.644-22.97-28.672-22.97-12.938%200-23.913%208.359-27.838%2019.952a13.35%2013.35%200%200%200-9.267-2.58c-6.215.618-11.193%205.597-11.811%2011.811-.145%201.599-.036%203.162.327%204.615C10.104%2070.051%202%2078.337%202%2088.549c0%20.909.073%201.817.182%202.726a.895.895%200%200%200%20.872.763h82.57c.472%200%20.909-.327%201.054-.8l.617-2.216z'/%3e%3cpath%20fill='%23FAAE40'%20d='M101.542%2060.275c-.4%200-.836%200-1.236.036-.291%200-.545.218-.654.509l-1.744%206.069c-.763%202.617-.472%205.015.8%206.796%201.163%201.635%203.125%202.58%205.488%202.689l9.522.581c.291%200%20.545.145.691.363.145.218.182.545.109.8-.145.436-.581.763-1.054.8l-9.924.582c-5.379.254-11.157%204.579-13.192%209.885l-.727%201.853c-.145.363.109.727.509.727h34.089c.4%200%20.763-.254.872-.654.581-2.108.909-4.325.909-6.614%200-13.447-10.975-24.422-24.458-24.422'/%3e%3c/svg%3e`},azure:{src:Jt},gcs:{src:`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='standard_product_icon'%20xmlns='http://www.w3.org/2000/svg'%20version='1.1'%20viewBox='0%200%20512%20512'%3e%3c!--%20Generator:%20Adobe%20Illustrator%2029.1.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.0%20Build%20142)%20--%3e%3cdefs%3e%3cstyle%3e%20.st0%20{%20fill:%20none;%20}%20.st1%20{%20fill:%20%234285f4;%20}%20.st2%20{%20fill:%20%2334a853;%20}%20.st3%20{%20fill:%20%23fbbc04;%20}%20.st4%20{%20fill:%20%23ea4335;%20}%20%3c/style%3e%3c/defs%3e%3cg%20id='bounding_box'%3e%3crect%20class='st0'%20width='512'%20height='512'/%3e%3c/g%3e%3cg%20id='art'%3e%3cpath%20class='st2'%20d='M442,277.9H70c-8.8,0-16,7.2-16,16v148.1c0,8.8,7.2,16,16,16h107.2c1.5.5,3.1.7,4.8.7s3.3-.3,4.8-.7h255.2c8.8,0,16-7.2,16-16v-148.1c0-8.8-7.2-16-16-16ZM86,309.9h80v116.1h-80v-116.1ZM426,425.9h-228v-116.1h228v116.1Z'/%3e%3cpath%20class='st3'%20d='M442,54H70c-8.8,0-16,7.2-16,16v148.8c0,8.8,7.2,16,16,16h372c8.8,0,16-7.2,16-16V70c0-8.8-7.2-16-16-16ZM86,86h80v116.8h-80v-116.8ZM426,202.8h-228v-116.8h228v116.8Z'/%3e%3cpath%20class='st4'%20d='M442,234.8h-16V86H54v-16c0-8.8,7.2-16,16-16h372c8.8,0,16,7.2,16,16v148.8c0,8.8-7.2,16-16,16Z'/%3e%3cpath%20class='st1'%20d='M442,457.9h-16v-148.1H54v-16c0-8.8,7.2-16,16-16h372c8.8,0,16,7.2,16,16v148.1c0,8.8-7.2,16-16,16Z'/%3e%3ccircle%20class='st4'%20cx='349'%20cy='144.4'%20r='37'/%3e%3ccircle%20class='st1'%20cx='349'%20cy='367.9'%20r='37'/%3e%3c/g%3e%3c/svg%3e`},http:Na,file:Ua,"in-memory":ur,gdrive:{src:`data:image/svg+xml,%3csvg%20viewBox='0%200%2087.3%2078'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m6.6%2066.85%203.85%206.65c.8%201.4%201.95%202.5%203.3%203.3l13.75-23.8h-27.5c0%201.55.4%203.1%201.2%204.5z'%20fill='%230066da'/%3e%3cpath%20d='m43.65%2025-13.75-23.8c-1.35.8-2.5%201.9-3.3%203.3l-25.4%2044a9.06%209.06%200%200%200%20-1.2%204.5h27.5z'%20fill='%2300ac47'/%3e%3cpath%20d='m73.55%2076.8c1.35-.8%202.5-1.9%203.3-3.3l1.6-2.75%207.65-13.25c.8-1.4%201.2-2.95%201.2-4.5h-27.502l5.852%2011.5z'%20fill='%23ea4335'/%3e%3cpath%20d='m43.65%2025%2013.75-23.8c-1.35-.8-2.9-1.2-4.5-1.2h-18.5c-1.6%200-3.15.45-4.5%201.2z'%20fill='%2300832d'/%3e%3cpath%20d='m59.8%2053h-32.3l-13.75%2023.8c1.35.8%202.9%201.2%204.5%201.2h50.8c1.6%200%203.15-.45%204.5-1.2z'%20fill='%232684fc'/%3e%3cpath%20d='m73.4%2026.5-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3l-13.75%2023.8%2016.15%2028h27.45c0-1.55-.4-3.1-1.2-4.5z'%20fill='%23ffba00'/%3e%3c/svg%3e`},hf:{src:`data:image/svg+xml,%3csvg%20width='256'%20height='256'%20viewBox='0%200%20256%20256'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M230.721%20172.7C230.183%20170.673%20229.313%20168.75%20228.146%20167.008C228.396%20166.091%20228.587%20165.159%20228.714%20164.217C229.543%20158.241%20227.471%20152.77%20223.567%20148.537C221.452%20146.225%20219.185%20144.698%20216.784%20143.761C218.36%20137.018%20219.157%20130.117%20219.161%20123.193C219.161%20120.03%20218.982%20116.932%20218.682%20113.88C218.526%20112.356%20218.337%20110.836%20218.115%20109.32C217.428%20104.847%20216.408%20100.431%20215.064%2096.11C214.183%2093.2707%20213.164%2090.476%20212.01%2087.736C210.281%2083.6782%20208.262%2079.75%20205.969%2075.982C204.465%2073.475%20202.827%2071.0508%20201.062%2068.72C200.197%2067.543%20199.296%2066.3938%20198.358%2065.274C195.58%2061.898%20192.561%2058.7277%20189.325%2055.788C188.25%2054.7997%20187.145%2053.8453%20186.01%2052.926C184.893%2051.9943%20183.751%2051.0927%20182.586%2050.222C180.241%2048.4766%20177.818%2046.8392%20175.324%2045.315C161.543%2036.945%20145.382%2032.145%20128.109%2032.145C77.817%2032.145%2037.057%2072.907%2037.057%20123.196C37.055%20130.208%2037.867%20137.196%2039.477%20144.02C37.317%20144.958%2035.247%20146.42%2033.327%20148.535C29.424%20152.766%2027.351%20158.217%2028.18%20164.193C28.306%20165.142%2028.495%20166.082%2028.747%20167.006C27.5811%20168.749%2026.7117%20170.673%2026.174%20172.7C24.974%20177.261%2025.369%20181.374%2026.894%20184.978C25.236%20189.688%2025.65%20194.704%2027.809%20199.065C29.379%20202.25%2031.626%20204.714%2034.396%20206.916C37.689%20209.534%2041.811%20211.758%2046.783%20213.892C52.715%20216.422%2059.956%20218.799%2063.249%20219.671C71.755%20221.873%2079.911%20223.269%2088.177%20223.337C99.954%20223.446%20110.096%20220.677%20117.357%20213.59C120.924%20214.027%20124.515%20214.246%20128.109%20214.244C131.906%20214.236%20135.699%20213.997%20139.467%20213.529C146.711%20220.661%20156.892%20223.455%20168.712%20223.343C176.977%20223.277%20185.133%20221.881%20193.617%20219.676C196.932%20218.804%20204.17%20216.427%20210.105%20213.897C215.077%20211.76%20219.199%20209.536%20222.514%20206.922C225.263%20204.719%20227.508%20202.256%20229.079%20199.071C231.26%20194.709%20231.652%20189.693%20230.017%20184.983C231.527%20181.379%20231.92%20177.257%20230.721%20172.7ZM222.281%20184.673C223.952%20187.844%20224.059%20191.427%20222.585%20194.764C220.349%20199.821%20214.795%20203.805%20204.008%20208.082C197.3%20210.742%20191.158%20212.443%20191.104%20212.458C182.232%20214.759%20174.208%20215.928%20167.262%20215.928C155.76%20215.928%20147.201%20212.754%20141.773%20206.486C132.594%20208.05%20123.222%20208.103%20114.026%20206.644C108.591%20212.808%20100.081%20215.928%2088.676%20215.928C81.729%20215.928%2073.706%20214.759%2064.833%20212.458C64.779%20212.443%2058.639%20210.742%2051.929%20208.082C41.143%20203.805%2035.587%20199.824%2033.352%20194.764C31.878%20191.427%2031.985%20187.844%2033.656%20184.673C33.81%20184.378%2033.976%20184.091%2034.153%20183.813C33.1516%20182.309%2032.4799%20180.61%2032.182%20178.827C31.8842%20177.045%2031.967%20175.22%2032.425%20173.472C33.089%20170.949%2034.46%20168.851%2036.322%20167.344C35.425%20165.87%2034.8365%20164.23%2034.592%20162.522C34.056%20158.808%2035.289%20155.1%2038.062%20152.076C40.222%20149.723%2043.275%20148.428%2046.655%20148.428H46.745C44.1965%20140.259%2042.9044%20131.75%2042.913%20123.193C42.913%2076.522%2080.749%2038.683%20127.427%2038.683C174.104%2038.683%20211.94%2076.518%20211.94%20123.193C211.947%20131.773%20210.646%20140.304%20208.081%20148.492C208.489%20148.452%20208.889%20148.432%20209.282%20148.431C212.662%20148.431%20215.716%20149.726%20217.874%20152.079C220.647%20155.1%20221.881%20158.811%20221.344%20162.525C221.1%20164.233%20220.511%20165.873%20219.615%20167.347C221.477%20168.854%20222.849%20170.952%20223.512%20173.475C223.97%20175.223%20224.053%20177.048%20223.755%20178.831C223.458%20180.613%20222.786%20182.312%20221.784%20183.816C221.961%20184.091%20222.129%20184.378%20222.281%20184.673Z'%20fill='white'/%3e%3cpath%20d='M221.784%20183.816C222.786%20182.312%20223.458%20180.613%20223.756%20178.831C224.053%20177.048%20223.97%20175.223%20223.512%20173.475C222.848%20170.952%20221.476%20168.854%20219.615%20167.347C220.512%20165.873%20221.1%20164.233%20221.344%20162.525C221.881%20158.811%20220.648%20155.103%20217.874%20152.079C215.716%20149.726%20212.662%20148.431%20209.282%20148.431C208.889%20148.431%20208.489%20148.452%20208.081%20148.492C210.643%20140.304%20211.942%20131.774%20211.933%20123.195C211.933%2076.5231%20174.097%2038.6851%20127.424%2038.6851C80.75%2038.6851%2042.9099%2076.5191%2042.9099%20123.195C42.9015%20131.752%2044.1936%20140.261%2046.742%20148.43H46.6519C43.2719%20148.43%2040.219%20149.724%2038.06%20152.077C35.287%20155.098%2034.0529%20158.81%2034.5899%20162.523C34.8346%20164.231%2035.4231%20165.872%2036.3199%20167.346C34.4579%20168.852%2033.086%20170.95%2032.422%20173.473C31.9642%20175.222%2031.8817%20177.047%2032.1799%20178.83C32.4781%20180.612%2033.1501%20182.312%2034.1519%20183.816C33.9739%20184.094%2033.8099%20184.381%2033.6549%20184.676C31.9849%20187.847%2031.877%20191.43%2033.352%20194.767C35.588%20199.824%2041.1419%20203.808%2051.9289%20208.085C58.6359%20210.745%2064.779%20212.446%2064.833%20212.461C73.705%20214.762%2081.729%20215.931%2088.675%20215.931C100.081%20215.931%20108.591%20212.811%20114.026%20206.647C123.222%20208.106%20132.594%20208.052%20141.773%20206.489C147.201%20212.757%20155.76%20215.931%20167.262%20215.931C174.208%20215.931%20182.232%20214.762%20191.103%20212.461C191.158%20212.446%20197.298%20210.745%20204.008%20208.085C214.795%20203.808%20220.35%20199.824%20222.585%20194.767C224.059%20191.43%20223.952%20187.847%20222.281%20184.676C222.129%20184.379%20221.961%20184.091%20221.784%20183.816ZM110.137%20196.997C109.669%20197.815%20109.168%20198.614%20108.635%20199.391C107.23%20201.448%20105.382%20203.02%20103.237%20204.188C99.1369%20206.424%2093.947%20207.205%2088.675%20207.205C80.346%20207.205%2071.808%20205.256%2067.023%20204.015C66.787%20203.954%2037.689%20195.735%2041.373%20188.739C41.993%20187.562%2043.0129%20187.092%2044.2979%20187.092C49.4849%20187.092%2058.9299%20194.816%2062.9889%20194.816C63.8959%20194.816%2064.5359%20194.43%2064.7969%20193.488C66.5269%20187.284%2038.5039%20184.676%2040.8639%20175.692C41.2799%20174.102%2042.41%20173.456%2043.998%20173.456C50.856%20173.455%2066.248%20185.516%2069.467%20185.516C69.714%20185.516%2069.8909%20185.443%2069.9869%20185.291C70.0009%20185.268%2070.015%20185.246%2070.028%20185.222C71.539%20182.727%2070.6719%20180.913%2060.3209%20174.573L59.3269%20173.968C47.9359%20167.074%2039.9409%20162.925%2044.4879%20157.975C45.0109%20157.404%2045.7529%20157.151%2046.6539%20157.151C47.7219%20157.151%2049.0149%20157.508%2050.4389%20158.108C56.4549%20160.645%2064.793%20167.564%2068.276%20170.581C68.8239%20171.057%2069.3683%20171.538%2069.9089%20172.022C69.9089%20172.022%2074.319%20176.608%2076.985%20176.608C77.599%20176.608%2078.1199%20176.366%2078.4729%20175.768C80.364%20172.58%2060.9099%20157.838%2059.8129%20151.755C59.0689%20147.634%2060.3349%20145.546%2062.6749%20145.546C63.7879%20145.546%2065.1459%20146.02%2066.6449%20146.971C71.2949%20149.922%2080.2729%20165.35%2083.5599%20171.352C84.6619%20173.363%2086.5429%20174.213%2088.2379%20174.213C91.6009%20174.213%2094.2299%20170.87%2088.5459%20166.622C80.0029%20160.23%2083.001%20149.782%2087.078%20149.139C87.252%20149.111%2087.4279%20149.097%2087.6029%20149.097C91.3109%20149.097%2092.9459%20155.486%2092.9459%20155.486C92.9459%20155.486%2097.7399%20167.524%20105.975%20175.753C113.447%20183.222%20114.491%20189.351%20110.137%20196.997ZM136.766%20198.407L136.339%20198.458L135.611%20198.541C135.228%20198.581%20134.844%20198.619%20134.459%20198.654L134.084%20198.688L133.741%20198.717L133.255%20198.756L132.718%20198.795L132.182%20198.83L132.063%20198.838C131.923%20198.846%20131.783%20198.855%20131.641%20198.862L131.462%20198.872C131.296%20198.881%20131.13%20198.889%20130.962%20198.896L130.381%20198.921L129.854%20198.939L129.502%20198.949H129.323C129.213%20198.949%20129.104%20198.955%20128.994%20198.956H128.82C128.71%20198.956%20128.601%20198.956%20128.491%20198.961L128.043%20198.967H127.418C126.927%20198.967%20126.437%20198.962%20125.949%20198.952L125.553%20198.943C125.44%20198.943%20125.327%20198.938%20125.216%20198.934L124.796%20198.922L124.275%20198.902L123.805%20198.881L123.684%20198.876L123.237%20198.853C123.112%20198.846%20122.989%20198.84%20122.865%20198.831L122.576%20198.814C122.213%20198.791%20121.85%20198.766%20121.487%20198.738L121.107%20198.707C120.947%20198.695%20120.787%20198.68%20120.628%20198.666C120.441%20198.65%20120.254%20198.632%20120.067%20198.614C119.754%20198.585%20119.441%20198.553%20119.128%20198.519H119.113C123.683%20188.324%20121.372%20178.802%20112.137%20169.575C106.08%20163.526%20102.051%20154.594%20101.215%20152.633C99.5229%20146.828%2095.045%20140.375%2087.608%20140.375C86.979%20140.375%2086.351%20140.425%2085.73%20140.523C82.472%20141.036%2079.624%20142.911%2077.592%20145.733C75.396%20143.002%2073.262%20140.831%2071.332%20139.605C68.422%20137.76%2065.5179%20136.824%2062.6889%20136.824C59.1579%20136.824%2056.0019%20138.274%2053.8019%20140.904L53.7459%20140.971C53.7039%20140.798%2053.6639%20140.625%2053.6229%20140.451L53.6179%20140.428C53.1992%20138.638%2052.8477%20136.833%2052.5639%20135.016C52.5639%20135.004%2052.5639%20134.992%2052.5579%20134.98C52.5359%20134.843%2052.5159%20134.705%2052.4949%20134.568C52.4334%20134.162%2052.3757%20133.755%2052.3219%20133.348C52.2979%20133.163%2052.2719%20132.978%2052.2489%20132.793L52.1809%20132.238C52.1589%20132.053%2052.1409%20131.885%2052.1209%20131.709L52.115%20131.665C52.0351%20130.945%2051.9651%20130.225%2051.9049%20129.503L51.8829%20129.226L51.8479%20128.754C51.8379%20128.625%2051.8279%20128.495%2051.8209%20128.365C51.8209%20128.334%2051.8159%20128.304%2051.8149%20128.275C51.7895%20127.913%2051.7678%20127.55%2051.7499%20127.187C51.7399%20126.998%2051.7299%20126.81%2051.7219%20126.62L51.7019%20126.124L51.6969%20125.974L51.6809%20125.517L51.6709%20125.128C51.6709%20124.973%2051.6629%20124.818%2051.6609%20124.663C51.6579%20124.508%2051.6539%20124.338%2051.6529%20124.174C51.6509%20124.01%2051.6529%20123.848%2051.6479%20123.685C51.6439%20123.521%2051.6479%20123.358%2051.6479%20123.195C51.6479%2081.3421%2085.5789%2047.4111%20127.436%2047.4111C169.292%2047.4111%20203.222%2081.3411%20203.222%20123.195V124.174C203.222%20124.337%20203.217%20124.501%20203.214%20124.663C203.214%20124.798%20203.208%20124.931%20203.204%20125.068C203.204%20125.188%20203.199%20125.309%20203.195%20125.425C203.195%20125.578%20203.186%20125.731%20203.181%20125.884V125.896L203.16%20126.427C203.153%20126.582%20203.147%20126.738%20203.139%20126.893L203.134%20127.003L203.107%20127.499C203.048%20128.562%20202.967%20129.623%20202.866%20130.683V130.696C202.849%20130.87%20202.832%20131.044%20202.813%20131.218L202.768%20131.629L202.679%20132.433L202.628%20132.84L202.565%20133.319C202.542%20133.493%20202.519%20133.668%20202.493%20133.841C202.467%20134.036%20202.438%20134.23%20202.409%20134.424L202.34%20134.883L202.258%20135.403C202.23%20135.576%20202.2%20135.748%20202.168%20135.92C202.135%20136.093%20202.109%20136.265%20202.079%20136.437C202.019%20136.781%20201.956%20137.125%20201.89%20137.468C201.789%20137.981%20201.686%20138.493%20201.58%20139.005L201.47%20139.512C201.434%20139.681%20201.395%20139.851%20201.357%20140.02C199.224%20137.947%20196.399%20136.818%20193.284%20136.818C190.457%20136.818%20187.55%20137.753%20184.641%20139.598C182.711%20140.824%20180.578%20142.996%20178.381%20145.726C176.346%20142.904%20173.498%20141.029%20170.242%20140.516C169.621%20140.418%20168.993%20140.368%20168.364%20140.368C160.925%20140.368%20156.45%20146.821%20154.757%20152.626C153.917%20154.587%20149.887%20163.519%20143.825%20169.577C134.596%20178.775%20132.268%20188.254%20136.766%20198.407ZM215.007%20177.998L214.977%20178.087C214.901%20178.288%20214.813%20178.484%20214.714%20178.674C214.639%20178.814%20214.558%20178.95%20214.47%20179.082C214.303%20179.331%20214.12%20179.569%20213.921%20179.793C213.875%20179.845%20213.831%20179.897%20213.779%20179.948C213.707%20180.025%20213.634%20180.101%20213.559%20180.175C212.213%20181.509%20210.161%20182.679%20207.841%20183.752C207.578%20183.871%20207.311%20183.99%20207.042%20184.11L206.774%20184.229C206.595%20184.308%20206.416%20184.386%20206.228%20184.463C206.049%20184.541%20205.863%20184.619%20205.677%20184.695L205.119%20184.925C203.814%20185.462%20202.477%20185.974%20201.173%20186.479L200.615%20186.696L200.064%20186.912C199.697%20187.055%20199.335%20187.198%20198.979%20187.341L198.448%20187.555L197.926%20187.768L197.67%20187.876C197.499%20187.947%20197.332%20188.018%20197.165%20188.089C193.328%20189.736%20190.567%20191.411%20191.147%20193.489C191.163%20193.548%20191.181%20193.604%20191.201%20193.659C191.253%20193.813%20191.324%20193.958%20191.413%20194.095C191.465%20194.176%20191.525%20194.253%20191.592%20194.323C192.274%20195.032%20193.515%20194.92%20195.08%20194.357C195.3%20194.276%20195.519%20194.192%20195.736%20194.104L195.872%20194.048C196.23%20193.896%20196.609%20193.726%20196.996%20193.542C197.093%20193.496%20197.191%20193.452%20197.289%20193.401C199.203%20192.465%20201.372%20191.205%20203.524%20190.058C204.385%20189.593%20205.258%20189.152%20206.142%20188.733C208.18%20187.774%20210.096%20187.094%20211.636%20187.094C212.359%20187.094%20212.997%20187.242%20213.529%20187.582L213.618%20187.641C213.952%20187.876%20214.232%20188.178%20214.441%20188.528C214.482%20188.595%20214.522%20188.666%20214.561%20188.739C215.322%20190.184%20214.685%20191.68%20213.194%20193.147C211.763%20194.556%20209.537%20195.937%20207.007%20197.215C206.819%20197.31%20206.631%20197.405%20206.44%20197.498C198.91%20201.196%20189.049%20203.981%20188.912%20204.016C186.284%20204.697%20182.526%20205.591%20178.292%20206.26L177.666%20206.358L177.563%20206.373C177.089%20206.445%20176.614%20206.512%20176.138%20206.574C175.655%20206.639%20175.167%20206.698%20174.676%20206.753L174.586%20206.763C172.806%20206.968%20171.019%20207.104%20169.228%20207.169H169.202C168.554%20207.192%20167.907%20207.204%20167.259%20207.204H166.512C165.524%20207.191%20164.538%20207.146%20163.553%20207.07C163.53%20207.07%20163.505%20207.07%20163.482%20207.064C163.129%20207.037%20162.777%20207.004%20162.425%20206.965C162.06%20206.926%20161.696%20206.882%20161.333%20206.833C161.094%20206.801%20160.856%20206.765%20160.618%20206.726C160.376%20206.687%20160.134%20206.647%20159.893%20206.605L159.564%20206.543L159.539%20206.538C159.192%20206.472%20158.847%20206.399%20158.503%20206.319C158.303%20206.274%20158.104%20206.23%20157.907%20206.176L157.788%20206.146C157.69%20206.122%20157.595%20206.096%20157.498%20206.07L157.445%20206.056L157.137%20205.966C157.025%20205.935%20156.913%20205.901%20156.801%20205.868L156.762%20205.857L156.471%20205.768C156.361%20205.734%20156.251%20205.698%20156.142%20205.662L155.874%20205.573L155.677%20205.504C155.487%20205.437%20155.298%20205.368%20155.111%20205.296L154.933%20205.226L154.786%20205.168C154.502%20205.054%20154.22%20204.935%20153.941%20204.81L153.756%20204.72L153.725%20204.706C153.659%20204.675%20153.594%20204.644%20153.528%20204.617C153.399%20204.555%20153.271%20204.491%20153.144%20204.426L153.105%20204.407L152.921%20204.31C152.594%20204.139%20152.274%20203.957%20151.96%20203.764L151.788%20203.658C151.702%20203.605%20151.616%20203.55%20151.532%20203.494L151.308%20203.346L151.067%20203.18L150.923%20203.077C150.771%20202.969%20150.622%20202.857%20150.476%20202.742L150.243%20202.563C150.15%20202.488%20150.058%20202.412%20149.967%20202.335C149.89%20202.272%20149.815%20202.206%20149.74%20202.14L149.734%20202.135C149.653%20202.064%20149.574%20201.993%20149.495%20201.92C149.417%20201.849%20149.339%20201.777%20149.263%20201.704L149.254%20201.695C149.174%20201.619%20149.096%20201.542%20149.019%20201.463C148.942%20201.385%20148.863%20201.307%20148.788%20201.227C148.713%20201.148%20148.636%20201.067%20148.562%20200.984C148.488%20200.902%20148.42%20200.827%20148.35%20200.746L148.327%20200.719C148.259%20200.641%20148.192%20200.562%20148.126%20200.481C147.983%20200.31%20147.844%20200.135%20147.71%20199.956C147.575%20199.776%20147.443%20199.592%20147.314%20199.405L147.191%20199.221C147.027%20198.981%20146.867%20198.739%20146.712%20198.493C146.596%20198.316%20146.483%20198.138%20146.373%20197.957C146.302%20197.844%20146.234%20197.73%20146.166%20197.618L146.138%20197.572C146.073%20197.462%20146.009%20197.354%20145.947%20197.245C145.911%20197.186%20145.877%20197.127%20145.845%20197.066C145.812%20197.004%20145.774%20196.941%20145.739%20196.878L145.682%20196.779L145.647%20196.715C145.58%20196.595%20145.514%20196.474%20145.45%20196.352C145.42%20196.298%20145.391%20196.244%20145.36%20196.192L145.271%20196.019L145.181%20195.848C144.956%20195.398%20144.743%20194.942%20144.543%20194.48L144.472%20194.311C144.426%20194.198%20144.383%20194.086%20144.337%20193.975C144.315%20193.921%20144.293%20193.868%20144.274%20193.814C144.167%20193.537%20144.067%20193.257%20143.975%20192.975C143.942%20192.874%20143.91%20192.775%20143.88%20192.675C143.808%20192.448%20143.743%20192.219%20143.685%20191.988C143.614%20191.719%20143.551%20191.448%20143.498%20191.175C143.487%20191.12%20143.476%20191.065%20143.467%20191.012C143.415%20190.745%20143.373%20190.476%20143.34%20190.206C143.332%20190.153%20143.326%20190.1%20143.32%20190.047L143.303%20189.885C143.281%20189.673%20143.264%20189.46%20143.254%20189.247C143.254%20189.193%20143.249%20189.139%20143.247%20189.087C143.242%20188.981%20143.24%20188.875%20143.239%20188.769C143.183%20184.496%20145.345%20180.388%20149.968%20175.767C158.203%20167.54%20162.997%20155.501%20162.997%20155.501C162.997%20155.501%20163.126%20154.996%20163.394%20154.269C163.431%20154.168%20163.47%20154.064%20163.514%20153.955C163.67%20153.548%20163.846%20153.148%20164.041%20152.758L164.08%20152.683C164.246%20152.351%20164.428%20152.027%20164.624%20151.712C164.67%20151.639%20164.714%20151.567%20164.765%20151.494C164.912%20151.277%20165.067%20151.065%20165.23%20150.86C165.319%20150.749%20165.416%20150.639%20165.513%20150.532C165.552%20150.49%20165.59%20150.448%20165.631%20150.408C166.108%20149.915%20166.653%20149.513%20167.27%20149.299L167.348%20149.273C167.4%20149.256%20167.452%20149.24%20167.505%20149.225C167.566%20149.209%20167.627%20149.195%20167.69%20149.182L167.719%20149.176C167.849%20149.15%20167.981%20149.133%20168.114%20149.124H168.125C168.194%20149.124%20168.264%20149.117%20168.335%20149.117C168.424%20149.117%20168.507%20149.117%20168.594%20149.126C168.684%20149.134%20168.773%20149.144%20168.863%20149.158C169.605%20149.276%20170.311%20149.718%20170.919%20150.4C171.15%20150.66%20171.358%20150.94%20171.54%20151.236C171.66%20151.428%20171.773%20151.631%20171.88%20151.845C171.923%20151.934%20171.964%20152.016%20172.004%20152.104C172.108%20152.33%20172.202%20152.56%20172.284%20152.795C172.479%20153.345%20172.626%20153.911%20172.723%20154.487C172.807%20154.992%20172.857%20155.502%20172.873%20156.013C172.881%20156.286%20172.881%20156.563%20172.873%20156.842C172.819%20158.14%20172.553%20159.421%20172.086%20160.634C172.044%20160.745%20171.997%20160.857%20171.952%20160.969C171.86%20161.195%20171.759%20161.417%20171.65%20161.634C171.569%20161.799%20171.484%20161.965%20171.392%20162.13C171.332%20162.24%20171.269%20162.35%20171.206%20162.46C171.045%20162.734%20170.871%20163.006%20170.684%20163.277L170.571%20163.439C170.129%20164.055%20169.637%20164.633%20169.099%20165.167C168.569%20165.698%20168.001%20166.189%20167.4%20166.637C166.798%20167.083%20166.233%20167.577%20165.711%20168.114C164.208%20169.691%20163.858%20171.083%20164.196%20172.138C164.25%20172.304%20164.321%20172.465%20164.407%20172.617C164.508%20172.791%20164.628%20172.951%20164.764%20173.097L164.817%20173.152L164.871%20173.206C164.925%20173.258%20164.982%20173.309%20165.043%20173.359L165.103%20173.407C165.248%20173.519%20165.402%20173.619%20165.563%20173.707C165.61%20173.732%20165.652%20173.757%20165.705%20173.781C165.879%20173.866%20166.058%20173.939%20166.242%20173.998C166.293%20174.015%20166.344%20174.03%20166.396%20174.046L166.461%20174.063L166.551%20174.087L166.628%20174.106L166.712%20174.124L166.795%20174.141L166.874%20174.154C166.932%20174.164%20166.992%20174.174%20167.052%20174.181L167.109%20174.19L167.213%20174.2L167.277%20174.207L167.382%20174.214H167.444L167.554%20174.22H167.9L167.999%20174.214L168.113%20174.207L168.252%20174.194L168.382%20174.179C168.412%20174.179%20168.442%20174.171%20168.472%20174.165C168.872%20174.107%20169.264%20174.001%20169.639%20173.849L169.798%20173.782C169.887%20173.743%20169.977%20173.702%20170.059%20173.658C170.235%20173.57%20170.406%20173.47%20170.57%20173.361C170.799%20173.211%20171.015%20173.043%20171.217%20172.858C171.265%20172.815%20171.312%20172.769%20171.358%20172.725C171.381%20172.703%20171.403%20172.682%20171.425%20172.658C171.469%20172.613%20171.514%20172.569%20171.558%20172.52C171.878%20172.168%20172.155%20171.78%20172.383%20171.363C174.34%20167.804%20176.391%20164.298%20178.534%20160.849L178.828%20160.378L179.125%20159.907C179.273%20159.668%20179.423%20159.433%20179.572%20159.199L179.722%20158.965C180.22%20158.185%20180.726%20157.41%20181.241%20156.641L181.546%20156.185C182.158%20155.278%20182.768%20154.396%20183.373%20153.558L183.674%20153.143C184.332%20152.236%20185.017%20151.348%20185.728%20150.482L186.01%20150.144C186.057%20150.088%20186.1%20150.032%20186.151%20149.978C186.244%20149.868%20186.337%20149.761%20186.428%20149.657C186.474%20149.604%20186.517%20149.552%20186.566%20149.5L186.834%20149.198L186.968%20149.051C187.103%20148.906%20187.235%20148.767%20187.365%20148.634C187.455%20148.544%20187.538%20148.455%20187.624%20148.371C188.131%20147.853%20188.69%20147.388%20189.293%20146.985L189.433%20146.895C189.567%20146.805%20189.706%20146.721%20189.848%20146.645C192.212%20145.303%20194.169%20145.204%20195.296%20146.331C195.978%20147.013%20196.356%20148.144%20196.335%20149.718C196.335%20149.787%20196.335%20149.857%20196.33%20149.929V150.006C196.33%20150.078%20196.324%20150.15%20196.318%20150.223C196.318%20150.313%20196.308%20150.402%20196.299%20150.492C196.29%20150.581%20196.285%20150.649%20196.276%20150.729C196.276%20150.751%20196.272%20150.774%20196.268%20150.798C196.262%20150.867%20196.253%20150.938%20196.243%20151.009C196.243%20151.03%20196.243%20151.052%20196.235%20151.074C196.224%20151.169%20196.21%20151.263%20196.194%20151.357C196.183%20151.447%20196.168%20151.531%20196.152%20151.619L196.126%20151.768C196.1%20151.91%20196.067%20152.05%20196.026%20152.188C195.948%20152.447%20195.854%20152.7%20195.743%20152.946C195.588%20153.284%20195.417%20153.613%20195.229%20153.933C195.125%20154.111%20195.018%20154.286%20194.907%20154.459C194.793%20154.638%20194.673%20154.819%20194.549%20155.002C194.233%20155.454%20193.905%20155.897%20193.564%20156.33L193.408%20156.527C192.852%20157.22%20192.278%20157.899%20191.686%20158.562L191.499%20158.772C191.247%20159.053%20190.991%20159.336%20190.729%20159.62L190.532%20159.834C190.401%20159.977%20190.264%20160.12%20190.132%20160.264C190.001%20160.407%20189.864%20160.552%20189.726%20160.697L189.315%20161.13L188.898%20161.566L188.478%20162.002C188.196%20162.294%20187.913%20162.586%20187.628%20162.878C183.573%20167.037%20179.301%20171.182%20177.855%20173.766C177.758%20173.934%20177.671%20174.108%20177.593%20174.285C177.387%20174.755%20177.301%20175.157%20177.36%20175.482C177.379%20175.589%20177.416%20175.691%20177.471%20175.785C177.552%20175.926%20177.651%20176.056%20177.766%20176.172C177.819%20176.224%20177.875%20176.272%20177.934%20176.316C178.232%20176.528%20178.591%20176.637%20178.957%20176.627H179.071L179.188%20176.618L179.305%20176.605L179.402%20176.591C179.415%20176.589%20179.429%20176.587%20179.442%20176.583L179.531%20176.566L179.554%20176.561L179.653%20176.54L179.688%20176.531C179.723%20176.522%20179.757%20176.513%20179.792%20176.503C179.827%20176.493%20179.875%20176.48%20179.917%20176.466C180.093%20176.413%20180.265%20176.35%20180.434%20176.278C180.523%20176.242%20180.61%20176.203%20180.696%20176.161C180.741%20176.141%20180.786%20176.12%20180.828%20176.098L180.962%20176.032C181.282%20175.866%20181.594%20175.685%20181.898%20175.491L182.031%20175.401C182.076%20175.373%20182.121%20175.344%20182.164%20175.312L182.297%20175.223L182.368%20175.174L182.56%20175.039C182.739%20174.916%20182.906%20174.789%20183.075%20174.66L183.09%20174.648L183.359%20174.44C183.726%20174.15%20184.074%20173.858%20184.39%20173.583L184.6%20173.399L184.619%20173.381L184.729%20173.284C184.987%20173.052%20185.217%20172.836%20185.408%20172.658L185.487%20172.581C185.556%20172.516%20185.619%20172.455%20185.676%20172.403L185.788%20172.292L185.828%20172.253L185.839%20172.242L185.956%20172.125L186.03%20172.048L186.039%20172.041L186.074%20172.009L186.118%20171.969L186.132%20171.956L186.169%20171.922L186.373%20171.743L186.487%20171.641C186.548%20171.588%20186.607%20171.534%20186.666%20171.479L186.802%20171.358C186.827%20171.338%20186.851%20171.316%20186.876%20171.294L187.019%20171.169L187.229%20170.984L187.341%20170.887C187.776%20170.509%20188.305%20170.052%20188.913%20169.537L189.162%20169.326L189.573%20168.981L189.994%20168.63C190.544%20168.173%20191.136%20167.688%20191.762%20167.185L192.173%20166.855C192.523%20166.576%20192.882%20166.292%20193.246%20166.006C193.393%20165.891%20193.542%20165.776%20193.694%20165.662C194.066%20165.373%20194.44%20165.086%20194.817%20164.803C195.675%20164.155%20196.56%20163.506%20197.456%20162.874L197.84%20162.606C198.109%20162.421%20198.377%20162.235%20198.645%20162.054L198.888%20161.89C199.367%20161.565%20199.853%20161.248%20200.343%20160.939L200.586%20160.786L200.827%20160.636C201.069%20160.486%20201.309%20160.339%20201.548%20160.196L201.787%20160.053L202.265%20159.775L202.734%20159.506L202.829%20159.454L203.2%20159.25C203.355%20159.166%20203.509%20159.085%20203.663%20159.006L203.892%20158.888L204.115%20158.776C204.193%20158.739%20204.27%20158.7%20204.346%20158.663C204.848%20158.415%20205.36%20158.187%20205.88%20157.979C206.021%20157.919%20206.161%20157.865%20206.3%20157.818L206.71%20157.674C206.833%20157.633%20206.953%20157.594%20207.068%20157.559L207.108%20157.547C207.17%20157.527%20207.232%20157.509%20207.293%20157.493L207.311%20157.488C207.439%20157.451%20207.566%20157.419%20207.691%20157.389H207.7C208.054%20157.304%20208.414%20157.243%20208.777%20157.206C208.944%20157.189%20209.111%20157.18%20209.279%20157.181H209.363C209.475%20157.181%20209.583%20157.188%20209.69%20157.199C209.739%20157.199%20209.788%20157.209%20209.836%20157.215H209.856C209.904%20157.221%20209.952%20157.228%20210%20157.239C210.047%20157.248%20210.095%20157.256%20210.141%20157.267H210.156C210.203%20157.277%20210.245%20157.289%20210.294%20157.303C210.548%20157.374%20210.79%20157.484%20211.012%20157.628C211.121%20157.699%20211.223%20157.779%20211.317%20157.868L211.344%20157.894C211.362%20157.91%20211.379%20157.927%20211.395%20157.944L211.444%20157.997C211.846%20158.418%20212.178%20158.901%20212.428%20159.427L212.466%20159.517C212.551%20159.717%20212.618%20159.924%20212.666%20160.135C212.808%20160.781%20212.753%20161.455%20212.508%20162.07C212.415%20162.318%20212.302%20162.557%20212.169%20162.785C211.858%20163.309%20211.489%20163.796%20211.07%20164.237L210.981%20164.332C210.848%20164.472%20210.71%20164.612%20210.565%20164.752C210.501%20164.815%20210.434%20164.877%20210.367%20164.94L210.162%20165.129L210.055%20165.224C209.797%20165.454%20209.532%20165.677%20209.263%20165.893C209.1%20166.025%20208.936%20166.154%20208.77%20166.281C208.184%20166.729%20207.587%20167.161%20206.979%20167.578C206.612%20167.83%20206.242%20168.077%20205.869%20168.321C204.95%20168.924%20204.021%20169.512%20203.083%20170.084C201.115%20171.294%20198.934%20172.588%20196.609%20173.995L196.007%20174.36C195.348%20174.762%20194.726%20175.146%20194.14%20175.512L193.845%20175.697L193.287%20176.055C192.917%20176.292%20192.548%20176.531%20192.179%20176.77L191.882%20176.966C191.737%20177.06%20191.593%20177.156%20191.449%20177.252L191.308%20177.342L190.876%20177.633L190.647%20177.79L190.379%20177.976L190.13%20178.149C189.713%20178.444%20189.325%20178.725%20188.968%20178.992L188.834%20179.094C188.624%20179.253%20188.416%20179.415%20188.211%20179.58C187.902%20179.829%20187.62%20180.067%20187.367%20180.296L187.243%20180.409C187.172%20180.474%20187.102%20180.539%20187.035%20180.603C186.989%20180.648%20186.946%20180.693%20186.898%20180.736L186.834%20180.8C186.691%20180.944%20186.551%20181.091%20186.416%20181.242L186.35%20181.318C186.203%20181.488%20186.075%20181.651%20185.963%20181.81L185.913%20181.881C185.825%20182.009%20185.744%20182.141%20185.671%20182.277C185.652%20182.311%20185.635%20182.345%20185.618%20182.379L185.569%20182.481L185.536%20182.555L185.515%20182.605L185.498%20182.65L185.475%20182.711C185.413%20182.88%20185.37%20183.056%20185.345%20183.234L185.337%20183.296L185.331%20183.354V183.669C185.331%20183.695%20185.331%20183.721%20185.338%20183.749L185.343%20183.797C185.343%20183.823%20185.349%20183.848%20185.353%20183.876C185.357%20183.902%20185.364%20183.949%20185.372%20183.986V183.991C185.379%20184.026%20185.386%20184.06%20185.395%20184.095C185.404%20184.13%20185.413%20184.17%20185.424%20184.206C185.443%20184.277%20185.467%20184.347%20185.492%20184.417C185.508%20184.459%20185.523%20184.5%20185.54%20184.541C185.54%20184.549%20185.546%20184.558%20185.55%20184.566L185.586%20184.647L185.636%20184.758C185.69%20184.873%20185.749%20184.985%20185.813%20185.094L185.879%20185.208L185.947%20185.322C185.959%20185.341%20185.973%20185.359%20185.988%20185.376L186.01%20185.399L186.035%20185.422L186.061%20185.442C186.099%20185.469%20186.14%20185.49%20186.183%20185.505C186.206%20185.513%20186.23%20185.519%20186.254%20185.525C186.831%20185.655%20188.017%20185.178%20189.593%20184.346C189.682%20184.298%20189.78%20184.248%20189.875%20184.196L190.355%20183.934L190.589%20183.804C190.756%20183.715%20190.926%20183.614%20191.1%20183.515L191.417%20183.336C193.5%20182.137%20195.988%20180.597%20198.56%20179.093C198.801%20178.952%20199.043%20178.811%20199.285%20178.672L199.771%20178.361C200.335%20178.038%20200.902%20177.719%20201.471%20177.404C202.188%20177.01%20202.91%20176.626%20203.639%20176.254L204.115%20176.013C204.431%20175.857%20204.744%20175.705%20205.053%20175.557C205.651%20175.273%20206.256%20175.003%20206.868%20174.748L207.203%20174.612L207.243%20174.596C209.018%20173.893%20210.627%20173.459%20211.929%20173.459C212.21%20173.456%20212.492%20173.48%20212.769%20173.528H212.778C212.867%20173.544%20212.948%20173.562%20213.031%20173.582H213.046C213.259%20173.636%20213.466%20173.713%20213.662%20173.812C213.937%20173.954%20214.184%20174.143%20214.393%20174.371C214.489%20174.477%20214.574%20174.592%20214.649%20174.714C214.789%20174.929%20214.899%20175.162%20214.978%20175.406C215.01%20175.501%20215.038%20175.594%20215.067%20175.693C215.278%20176.45%20215.257%20177.253%20215.007%20177.998Z'%20fill='%23FF9D00'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M203.21%20123.685V123.194C203.21%2081.34%20169.292%2047.411%20127.435%2047.411C85.5791%2047.411%2051.648%2081.342%2051.648%20123.194V123.358C51.646%20123.467%2051.645%20123.576%2051.648%20123.685C51.6529%20123.848%2051.6546%20124.011%2051.653%20124.174L51.6581%20124.534L51.661%20124.663C51.661%20124.723%2051.6631%20124.782%2051.6651%20124.842C51.6681%20124.937%2051.67%20125.033%2051.67%20125.128L51.681%20125.517L51.697%20125.974L51.702%20126.124L51.722%20126.597V126.62C51.73%20126.805%2051.7401%20126.989%2051.7491%20127.173L51.75%20127.187C51.76%20127.375%2051.7701%20127.564%2051.7821%20127.753C51.7921%20127.927%2051.802%20128.101%2051.815%20128.275L51.8171%20128.306C51.8258%20128.455%2051.8358%20128.605%2051.847%20128.754L51.85%20128.794L51.883%20129.226L51.8861%20129.254C51.8921%20129.338%2051.898%20129.422%2051.906%20129.503C51.9658%20130.224%2052.0355%20130.945%2052.1151%20131.664L52.12%20131.709L52.181%20132.238L52.2491%20132.793L52.299%20133.17L52.322%20133.347C52.3753%20133.755%2052.433%20134.162%2052.495%20134.568L52.4991%20134.595L52.558%20134.979C52.8435%20136.808%2053.1971%20138.626%2053.618%20140.429L53.6231%20140.451L53.655%20140.586L53.746%20140.971L53.802%20140.904C56.002%20138.274%2059.158%20136.824%2062.689%20136.824C65.519%20136.824%2068.4221%20137.76%2071.3321%20139.605C73.2621%20140.831%2075.3961%20143.002%2077.5921%20145.733C79.6241%20142.911%2082.4721%20141.035%2085.7301%20140.523C86.3513%20140.425%2086.9792%20140.376%2087.6081%20140.375C95.0441%20140.375%2099.523%20146.828%20101.215%20152.633C102.051%20154.594%20106.08%20163.526%20112.156%20169.568C121.392%20178.795%20123.703%20188.316%20119.132%20198.511H119.148C119.459%20198.546%20119.772%20198.578%20120.087%20198.607C120.274%20198.625%20120.46%20198.643%20120.648%20198.659L120.714%20198.665L121.127%20198.7L121.507%20198.73C121.869%20198.758%20122.232%20198.784%20122.596%20198.807L122.885%20198.824L123.114%20198.838L123.256%20198.846L123.703%20198.869L123.825%20198.874L124.294%20198.895L124.816%20198.915L125.235%20198.927L125.305%20198.929C125.394%20198.933%20125.483%20198.936%20125.572%20198.936L125.668%20198.939C126.258%20198.953%20126.847%20198.96%20127.437%20198.959H128.063L128.51%20198.954C128.62%20198.949%20128.729%20198.949%20128.84%20198.949H129.014L129.165%20198.945C129.224%20198.943%20129.283%20198.941%20129.343%20198.941H129.522L129.873%20198.932L130.401%20198.914L130.982%20198.888C131.15%20198.882%20131.316%20198.873%20131.482%20198.865L131.661%20198.854L131.927%20198.84L132.083%20198.831L132.201%20198.823L132.738%20198.788L133.274%20198.749L133.761%20198.71L134.103%20198.681L134.479%20198.647C135.107%20198.591%20135.733%20198.525%20136.359%20198.45L136.786%20198.399C132.287%20188.247%20134.616%20178.767%20143.813%20169.577C149.876%20163.519%20153.905%20154.587%20154.745%20152.625C156.438%20146.821%20160.914%20140.368%20168.352%20140.368C168.981%20140.368%20169.61%20140.418%20170.231%20140.516C173.486%20141.028%20176.334%20142.904%20178.369%20145.726C180.566%20142.996%20182.699%20140.823%20184.63%20139.597C187.539%20137.753%20190.445%20136.817%20193.272%20136.817C196.388%20136.817%20199.212%20137.947%20201.345%20140.02C201.384%20139.851%20201.422%20139.682%20201.459%20139.512L201.568%20139.006C201.607%20138.821%20201.646%20138.636%20201.683%20138.451C201.749%20138.124%20201.815%20137.797%20201.878%20137.467C201.944%20137.125%20202.007%20136.781%20202.067%20136.437L202.098%20136.251C202.117%20136.141%20202.135%20136.031%20202.156%20135.92C202.19%20135.748%20202.218%20135.576%20202.246%20135.402L202.257%20135.336L202.328%20134.883L202.398%20134.424V134.42C202.449%20134.081%20202.497%20133.742%20202.542%20133.403L202.553%20133.319L202.616%20132.841L202.667%20132.433L202.757%20131.629L202.792%20131.306L202.801%20131.218C202.82%20131.044%20202.838%20130.87%20202.854%20130.696V130.682C202.867%20130.544%20202.881%20130.405%20202.893%20130.266C202.964%20129.478%20203.024%20128.686%20203.072%20127.891C203.081%20127.761%20203.088%20127.63%20203.096%20127.499V127.493L203.122%20127.002L203.128%20126.892C203.144%20126.56%20203.158%20126.228%20203.169%20125.896V125.884L203.174%20125.754C203.179%20125.645%20203.183%20125.535%20203.183%20125.425L203.185%20125.381C203.189%20125.278%20203.193%20125.172%20203.193%20125.067L203.196%20124.977C203.199%20124.872%20203.202%20124.768%20203.202%20124.663L203.204%20124.574C203.207%20124.441%20203.21%20124.307%20203.21%20124.174V123.685ZM108.638%20199.391C114.64%20190.59%20114.214%20183.984%20105.98%20175.754C97.7441%20167.523%2092.951%20155.487%2092.951%20155.487C92.951%20155.487%2091.1621%20148.496%2087.0821%20149.138C83.0021%20149.78%2080.0091%20160.227%2088.5521%20166.622C97.0941%20173.017%2086.8521%20177.353%2083.5641%20171.352C80.2761%20165.35%2071.299%20149.923%2066.645%20146.972C61.991%20144.021%2058.718%20145.675%2059.815%20151.757C60.36%20154.776%2065.4281%20159.929%2070.1631%20164.743C74.9671%20169.627%2079.428%20174.163%2078.474%20175.768C76.581%20178.955%2069.9141%20172.023%2069.9141%20172.023C69.9141%20172.023%2049.038%20153.025%2044.494%20157.976C40.304%20162.539%2046.765%20166.418%2056.7211%20172.397C57.5671%20172.905%2058.4391%20173.429%2059.3321%20173.969C70.7231%20180.865%2071.609%20182.684%2069.992%20185.293C69.395%20186.257%2065.582%20183.968%2060.892%20181.153C52.897%20176.352%2042.3551%20170.023%2040.8661%20175.688C39.5781%20180.591%2047.334%20183.595%2054.368%20186.32C60.228%20188.59%2065.5881%20190.666%2064.7991%20193.484C63.9821%20196.406%2059.5531%20193.969%2054.7121%20191.305C49.2771%20188.314%2043.3221%20185.038%2041.3731%20188.735C37.6901%20195.725%2066.7831%20203.954%2067.0231%20204.015C76.4231%20206.453%20100.295%20211.619%20108.638%20199.391ZM147.303%20199.391C141.301%20190.59%20141.727%20183.984%20149.962%20175.754C158.197%20167.523%20162.99%20155.487%20162.99%20155.487C162.99%20155.487%20164.779%20148.496%20168.859%20149.138C172.939%20149.78%20175.932%20160.227%20167.39%20166.622C158.847%20173.017%20169.089%20177.353%20172.377%20171.352C175.666%20165.35%20184.637%20149.923%20189.291%20146.972C193.945%20144.021%20197.22%20145.675%20196.122%20151.757C195.578%20154.776%20190.509%20159.929%20185.774%20164.744C180.97%20169.628%20176.509%20174.163%20177.462%20175.768C179.355%20178.955%20186.027%20172.019%20186.027%20172.019C186.027%20172.019%20206.902%20153.022%20211.448%20157.973C215.637%20162.535%20209.176%20166.415%20199.219%20172.394C198.348%20172.917%20197.478%20173.441%20196.609%20173.966C185.218%20180.862%20184.332%20182.681%20185.948%20185.289C186.546%20186.254%20190.359%20183.964%20195.048%20181.149C203.044%20176.349%20213.586%20170.019%20215.075%20175.685C216.364%20180.588%20208.607%20183.592%20201.573%20186.317C195.713%20188.587%20190.353%20190.663%20191.141%20193.481C191.957%20196.402%20196.385%20193.965%20201.225%20191.301C206.66%20188.31%20212.616%20185.032%20214.564%20188.732C218.248%20195.726%20189.15%20203.947%20188.915%20204.007C179.515%20206.453%20155.643%20211.619%20147.303%20199.391Z'%20fill='%23FFD21E'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M152.047%20102.567C153.229%20102.985%20154.108%20104.257%20154.944%20105.468C156.074%20107.104%20157.126%20108.627%20158.74%20107.769C160.644%20106.756%20162.205%20105.202%20163.225%20103.302C164.246%20101.402%20164.681%2099.2427%20164.475%2097.096C164.321%2095.4908%20163.813%2093.9398%20162.987%2092.5548C162.161%2091.1697%20161.038%2089.985%20159.7%2089.0862C158.361%2088.1874%20156.839%2087.5968%20155.245%2087.3569C153.65%2087.117%20152.022%2087.2339%20150.478%2087.699C148.934%2088.1639%20147.513%2088.9653%20146.316%2090.0455C145.119%2091.1257%20144.176%2092.4578%20143.556%2093.946C142.936%2095.4342%20142.653%2097.0415%20142.728%2098.652C142.804%20100.263%20143.235%20101.836%20143.992%20103.26C144.74%20104.667%20146.4%20104.003%20148.152%20103.302C149.525%20102.753%20150.956%20102.181%20152.047%20102.567ZM100.672%20102.567C99.49%20102.985%2098.611%20104.258%2097.775%20105.468C96.645%20107.105%2095.592%20108.627%2093.979%20107.769C91.5845%20106.501%2089.7482%20104.386%2088.8278%20101.838C87.9075%2099.2895%2087.9692%2096.4896%2089.0008%2093.9841C90.0324%2091.4786%2091.9601%2089.4471%2094.408%2088.2855C96.856%2087.1239%2099.6488%2086.9156%20102.242%2087.701C104.307%2088.3228%20106.141%2089.5427%20107.513%2091.2065C108.885%2092.8704%20109.732%2094.9035%20109.949%2097.049C110.165%2099.1945%20109.74%20101.356%20108.728%20103.26C107.979%20104.667%20106.319%20104.003%20104.567%20103.303C103.193%20102.753%20101.764%20102.181%20100.672%20102.567ZM144.099%20149.318C152.242%20142.903%20155.233%20132.429%20155.233%20125.977C155.233%20120.877%20151.802%20122.482%20146.309%20125.202L145.999%20125.355C140.957%20127.852%20134.245%20131.177%20126.877%20131.177C119.508%20131.177%20112.796%20127.852%20107.755%20125.354C102.084%20122.545%2098.527%20120.783%2098.527%20125.978C98.527%20132.634%20101.709%20143.563%20110.443%20149.912C111.596%20147.573%20113.219%20145.497%20115.211%20143.813C117.202%20142.129%20119.52%20140.874%20122.018%20140.126C122.89%20139.866%20123.788%20141.367%20124.707%20142.904C125.594%20144.386%20126.501%20145.902%20127.423%20145.902C128.406%20145.902%20129.371%20144.408%20130.314%20142.95C131.299%20141.425%20132.26%20139.94%20133.189%20140.237C137.864%20141.738%20141.775%20144.993%20144.099%20149.318Z'%20fill='%2332343D'/%3e%3cpath%20d='M144.097%20149.317C139.856%20152.659%20134.219%20154.9%20126.878%20154.9C119.981%20154.9%20114.587%20152.922%20110.443%20149.911C111.596%20147.572%20113.219%20145.495%20115.211%20143.812C117.202%20142.128%20119.52%20140.873%20122.018%20140.125C123.73%20139.614%20125.545%20145.901%20127.423%20145.901C129.433%20145.901%20131.37%20139.655%20133.189%20140.236C137.863%20141.738%20141.773%20144.993%20144.097%20149.317Z'%20fill='%23FF323D'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M81.2%20111.64C80.2312%20112.288%2079.1173%20112.687%2077.9572%20112.801C76.7971%20112.916%2075.6267%20112.742%2074.55%20112.295C73.6893%20111.94%2072.9072%20111.418%2072.2488%20110.759C71.5903%20110.101%2071.0684%20109.319%2070.713%20108.458C70.267%20107.381%2070.0935%20106.211%2070.2082%20105.051C70.3228%20103.891%2070.7219%20102.777%2071.37%20101.808C72.1488%20100.642%2073.2558%2099.7333%2074.5512%2099.1967C75.8466%2098.6601%2077.272%2098.5197%2078.6471%2098.7935C80.0223%2099.0672%2081.2853%2099.7427%2082.2764%20100.734C83.2675%20101.726%2083.9422%20102.99%2084.215%20104.365C84.4883%20105.74%2084.3477%20107.165%2083.8113%20108.46C83.2748%20109.755%2082.3654%20110.861%2081.2%20111.64ZM182.613%20111.64C181.644%20112.288%20180.53%20112.687%20179.37%20112.801C178.209%20112.916%20177.039%20112.742%20175.962%20112.295C175.101%20111.939%20174.319%20111.418%20173.661%20110.759C173.003%20110.101%20172.481%20109.319%20172.125%20108.458C171.68%20107.381%20171.507%20106.211%20171.621%20105.051C171.736%20103.891%20172.135%20102.777%20172.782%20101.808C173.364%20100.936%20174.133%20100.205%20175.032%2099.6658C175.931%2099.1269%20176.938%2098.7942%20177.981%2098.6917C179.025%2098.5891%20180.078%2098.7193%20181.064%2099.0728C182.051%2099.4264%20182.947%2099.9944%20183.688%20100.736C184.68%20101.727%20185.355%20102.99%20185.628%20104.365C185.902%20105.74%20185.761%20107.165%20185.224%20108.46C184.687%20109.755%20183.779%20110.861%20182.613%20111.64Z'%20fill='%23FFAD03'/%3e%3c/svg%3e`},github:La},Yc=e=>{let t=(0,I.c)(11),{protocol:n,forceDark:r,className:i}=e,{theme:a}=Yi(),o=Jc[n.toLowerCase()]??Ua;if(`src`in o){let e=o.src;o.dark&&(r||a===`dark`)&&(e=o.dark);let s=e,c;t[0]===i?c=t[1]:(c=Tn(`h-3.5 w-3.5`,i),t[0]=i,t[1]=c);let l;return t[2]!==n||t[3]!==e||t[4]!==c?(l=(0,L.jsx)(`img`,{src:s,alt:n,className:c}),t[2]=n,t[3]=e,t[4]=c,t[5]=l):l=t[5],l}let s=o,c;t[6]===i?c=t[7]:(c=Tn(`h-3.5 w-3.5`,i),t[6]=i,t[7]=c);let l;return t[8]!==s||t[9]!==c?(l=(0,L.jsx)(s,{className:c}),t[8]=s,t[9]=c,t[10]=l):l=t[10],l},Xc=mn(`marimo:session-panel:state`,{openSections:[`variables`],hasUserInteracted:!1},ae,{getOnInit:!0}),Zc=mn(`marimo:file-explorer-panel:state`,{openSections:[`files`],hasUserInteracted:!1},ae,{getOnInit:!0});function Qc(e,t){o.set(e,e=>e.openSections.includes(t)?e:{...e,openSections:[...e.openSections,t]})}var $c=()=>({entries:new Map}),{valueAtom:el,useActions:tl}=Ni($c,{submit:(e,t)=>{let{cellIds:n,deleteCell:r,deleteManyCells:i,store:a}=t,o=a.get(Se),s=a.get(ut),c=new Set(o.cellIds.inOrderIds.filter(e=>o.cellData[e].code.trim()===``)),l=new Map;for(let e of n){if(c.has(e)){l.set(e,{cellId:e,type:`simple`});continue}let t=o.cellRuntime[e],n=new Map;for(let t of Object.values(s)){let r=t.declaredBy.includes(e),i=t.usedBy.some(e=>!c.has(e));r&&i&&n.set(t.name,t.usedBy)}let r;t?.runElapsedTimeMs&&t.runElapsedTimeMs>2e3&&(r=t.runElapsedTimeMs),n.size===0&&r===void 0?l.set(e,{cellId:e,type:`simple`}):l.set(e,{cellId:e,type:`expensive`,executionDurationMs:r,defs:n})}let u=[...l.values()].every(e=>e.type===`simple`);return l.size>0&&u?(l.size===1?r({cellId:[...l.values()][0].cellId}):i({cellIds:[...l.values()].map(e=>e.cellId)}),$c()):{...e,entries:l}},clear:()=>$c()});function nl(){let e=n(),{submit:t,clear:r}=tl(),{entries:a}=i(el),o=mr(),s=hr();return{submit:n=>{t({cellIds:n,deleteCell:o,deleteManyCells:s,store:e})},clear:r,get idle(){return a.size===0},get shouldConfirmDelete(){return a.size>1}}}function rl(e){let t=(0,I.c)(16),n=i(el),r=tl(),a=hr(),o;t[0]!==e||t[1]!==n.entries?(o=n.entries.get(e),t[0]=e,t[1]=n.entries,t[2]=o):o=t[2];let s=o;if(!s){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e={isPending:!1},t[3]=e):e=t[3],e}if(n.entries.size!==1){let e;return t[4]===s?e=t[5]:(e={isPending:!0,shouldConfirmDelete:!1,...s},t[4]=s,t[5]=e),e}let c;t[6]!==r||t[7]!==a||t[8]!==n.entries?(c=()=>{a({cellIds:[...n.entries.values()].map(il)}),r.clear()},t[6]=r,t[7]=a,t[8]=n.entries,t[9]=c):c=t[9];let l;t[10]===r?l=t[11]:(l=()=>r.clear(),t[10]=r,t[11]=l);let u;return t[12]!==s||t[13]!==c||t[14]!==l?(u={isPending:!0,...s,shouldConfirmDelete:!0,confirm:c,cancel:l},t[12]=s,t[13]=c,t[14]=l,t[15]=u):u=t[15],u}function il(e){return e.cellId}async function al(e){if(!e.ok)throw Error(await e.text());if(!e.body)throw Error(`Failed to get response body`);let t=null,n=!1;if(await qn({stream:Vn({stream:e.body,schema:Jn}).pipeThrough(new TransformStream({transform(e){if(!e.success)throw e.error;let r=e.value;if(Un(r)&&r.type===Bn)t=Hn.parse(r.data).code;else if(r.type===`error`)throw Error(r.errorText);else r.type===`finish`&&(n=r.finishReason===`stop`)}})),onError:e=>{throw e}}),!n)throw Error(`AI completion ended before final validation`);if(t===null)throw Error(`AI completion returned no cell code`);return t}async function ol(e){let t=`
5
5
  ${e.codeBefore}
6
6
  <rewrite_this>
7
7
  ${e.selection}
8
8
  </rewrite_this>
9
9
  ${e.codeAfter}
10
- `.trim(),n=yn();await pn();let r=await fetch(n.getAiURL(`completion`).toString(),{method:`POST`,headers:n.headers(),body:JSON.stringify({prompt:e.prompt,code:t,selectedText:e.selection,includeOtherCode:``,language:e.language})}),i=e.selection.match(/^\s*/)?.[0]||``,a=await al(r);return a.startsWith(i)||(a=i+a),a}function sl(e){switch(e){case`table`:case`connection`:fe(`variables`),Qc(Xc,`datasources`);return;case`bucket`:fe(`files`),Qc(Zc,`remote-storage`);return;case`cache`:fe(`cache`);return;default:Hi(e)}}function cl(e){let{state:t,names:n}=e;if(n.size===0)return[];let r=Vr(t);if(!r||w(r))return[];let i=new Map,a=e=>{if(e.name===A.VariableName){let r=t.doc.sliceString(e.from,e.to);n.has(r)&&!i.has(r)&&i.set(r,{from:e.from,to:e.to,name:r});return}if(e.name===A.TupleExpression||e.name===A.ArrayExpression||e.name===A.ParenthesizedExpression)for(let t=e.firstChild;t;t=t.nextSibling)a(t)},o=e=>{let t=-1;for(let n=e.firstChild;n;n=n.nextSibling)n.name===A.AssignOp&&(t=n.from);if(t!==-1)for(let n=e.firstChild;n&&n.from<t;n=n.nextSibling)a(n)},s=e=>{if(!p.has(e.name)){if(e.name===A.AssignStatement){o(e);return}for(let t=e.firstChild;t;t=t.nextSibling)s(t)}};return s(r.topNode),[...i.values()]}var ll=/\bmo\.(?:persistent_cache|cache)\b/g;function ul(e){let t=e.match(/^[A-Za-z]*("""|'''|"|')([\s\S]*)\1$/);return t?t[2]:e}function dl(e,t){if(!e)return null;let n=e=>e?.name===`,`||e?.name===`)`,r=null;for(let i=e.firstChild;i;i=i.nextSibling)if(i.name!==`(`&&i.name!==`)`&&i.name!==`,`&&(r??=i,i.name===A.VariableName&&t(i)===`name`&&i.nextSibling?.name===A.AssignOp)){let e=i.nextSibling.nextSibling;if(e?.name===A.String&&n(e.nextSibling))return ul(t(e))}return r&&r.name===A.String&&n(r.nextSibling)?ul(t(r)):null}function fl(e,t,n,r){let i=t=>e.doc.sliceString(t.from,t.to),a=t.resolveInner(n,1),o=null,s=null,c=r,l=null;for(let e=a.parent;e&&e.from===n;e=e.parent)if(e.name===A.CallExpression){l=e;break}if(l){c=l.to,s=l.getChild(A.ArgList);let e=l.parent;if(e?.name===A.AssignStatement){let t=e.getChild(A.VariableName);o=t&&t.from<l.from?i(t):null}else if(e?.name===A.WithStatement){let t=e.firstChild;for(;t;){if(t.from<l.to||t.name===k.As){t=t.nextSibling;continue}t.name===A.VariableName&&(o=i(t));break}}}else if(a.parent?.name===A.Decorator){let e=a.parent,t=e.getChild(A.ArgList);t?.from===r&&(s=t,c=t.to);let n=(e.parent?.getChild(A.FunctionDefinition))?.getChild(A.VariableName);o=n?i(n):null}let u=dl(s,i);return{from:n,to:c,boundName:o,cacheName:u}}function pl(e,t,n){let r=t.resolveInner(n,1);return!te.has(r.name)&&r.name===A.VariableName&&e.doc.sliceString(r.from,r.to)===`mo`}function ml(e){let t=Vr(e);return!t||w(t)?[]:[...e.doc.toString().matchAll(ll)].filter(n=>pl(e,t,n.index??0)).map(n=>{let r=n.index??0;return fl(e,t,r,r+n[0].length)})}function hl(e,t,n){let r=e.get(t);r!==void 0&&r!==n&&rn.error(`[code-lens] "${t}" is claimed by both a ${r} and a ${n} entity; keeping ${n}`),e.set(t,n)}var gl=r(e=>{let t=new Map;for(let n of e(O))n.variable_name&&hl(t,n.variable_name,`table`);for(let n of e(E).keys())ie.has(n)||hl(t,n,`connection`);for(let n of e(Te))hl(t,n.name,`bucket`);return t}),_l=r(e=>{let t=e(gl),n=e(ut),r=new Map,i=new Map;for(let[e,a]of t){let t=n[e];if(t==null){i.set(e,a);continue}for(let n of t.declaredBy){let t=r.get(n);t||(t=new Map,r.set(n,t)),t.set(e,a)}}return{byCell:r,pending:i}});function vl(e){let{byCell:t,pending:n}=o.get(_l),r=new Map(t.get(e));for(let[e,t]of n)r.has(e)||r.set(e,t);return r}var yl=e=>`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${e}</svg>`,bl={table:yl(`<path d="M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18"/>`),connection:yl(`<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/>`),bucket:yl(`<line x1="22" x2="2" y1="12" y2="12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><line x1="6" x2="6.01" y1="16" y2="16"/><line x1="10" x2="10.01" y1="16" y2="16"/>`),cache:yl(`<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 15 21.84"/><path d="M21 5V8"/><path d="M21 12L18 17H22L19 22"/><path d="M3 12A9 3 0 0 0 14.59 14.87"/>`)},xl={table:`Open in data sources`,connection:`Open in data sources`,bucket:`Open in remote storage`,cache:`Open cache panel`};function Sl(e,t){let n=(0,co.createRoot)(e);return(0,so.flushSync)(()=>{n.render((0,L.jsx)(s,{store:o,children:(0,L.jsx)(Cl,{spec:t})}))}),()=>queueMicrotask(()=>n.unmount())}var Cl=e=>{let t=(0,I.c)(9),{spec:n}=e;switch(n.kind){case`table`:{let e;return t[0]===n.name?e=t[1]:(e=(0,L.jsx)(wl,{name:n.name}),t[0]=n.name,t[1]=e),e}case`connection`:{let e;return t[2]===n.name?e=t[3]:(e=(0,L.jsx)(Tl,{name:n.name}),t[2]=n.name,t[3]=e),e}case`bucket`:{let e;return t[4]===n.name?e=t[5]:(e=(0,L.jsx)(El,{name:n.name}),t[4]=n.name,t[5]=e),e}case`cache`:{let e=n.cache?.boundName??null,r=n.cache?.cacheName??null,i;return t[6]!==e||t[7]!==r?(i=(0,L.jsx)(jl,{boundName:e,cacheName:r}),t[6]=e,t[7]=r,t[8]=i):i=t[8],i}default:Hi(n.kind)}},wl=e=>{let t=(0,I.c)(5),{name:n}=e,r=i(O),a;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>e.variable_name===n,t[3]=n,t[4]=e);let i=r.find(e);a=i?xt(i):g(`table`),t[0]=n,t[1]=r,t[2]=a}else a=t[2];return a},Tl=e=>{let t=(0,I.c)(5),{name:n}=e,r=i(E),a,o;if(t[0]!==r||t[1]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.get(n);if(!e){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=g(`database`),t[4]=e):e=t[4],o=e;break bb0}a=oe(e)}t[0]=r,t[1]=n,t[2]=a,t[3]=o}else a=t[2],o=t[3];return o===Symbol.for(`react.early_return_sentinel`)?a:o},El=e=>{let t=(0,I.c)(27),{name:n}=e,r=i(Te),a;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>e.name===n,t[3]=n,t[4]=e),a=r.find(e),t[0]=n,t[1]=r,t[2]=a}else a=t[2];let o=a;if(!o){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`div`,{className:Tt,children:(0,L.jsx)(`span`,{className:`text-xs text-(--slate-11)`,children:`No storage information available.`})}),t[5]=e):e=t[5],e}let s;t[6]===o.protocol?s=t[7]:(s=(0,L.jsx)(Yc,{protocol:o.protocol,className:`w-4 h-4`}),t[6]=o.protocol,t[7]=s);let c;t[8]===o.protocol?c=t[9]:(c=(0,L.jsx)(Gi,{variant:`outline`,className:`text-xs`,children:o.protocol}),t[8]=o.protocol,t[9]=c);let l;t[10]!==o.displayName||t[11]!==s||t[12]!==c?(l=(0,L.jsx)(Ct,{icon:s,title:o.displayName,badge:c}),t[10]=o.displayName,t[11]=s,t[12]=c,t[13]=l):l=t[13];let u;t[14]===o.name?u=t[15]:(u=(0,L.jsx)(we,{label:`Variable`,value:(0,L.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:o.name})}),t[14]=o.name,t[15]=u);let d=o.rootPath||`(root)`,f;t[16]===d?f=t[17]:(f=(0,L.jsx)(we,{label:`Root`,value:(0,L.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:d})}),t[16]=d,t[17]=f);let p;t[18]===o.backendType?p=t[19]:(p=(0,L.jsx)(we,{label:`Backend`,value:(0,L.jsx)(`span`,{className:`font-medium`,children:o.backendType})}),t[18]=o.backendType,t[19]=p);let m;t[20]!==u||t[21]!==f||t[22]!==p?(m=(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[u,f,p]}),t[20]=u,t[21]=f,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==l||t[25]!==m?(h=(0,L.jsxs)(`div`,{className:Tt,children:[l,m]}),t[24]=l,t[25]=m,t[26]=h):h=t[26],h},Dl=/\bhits=(\d+) misses=(\d+)/,Ol=null,kl=5e3;function Al(){let e=Date.now();Ol!=null&&e-Ol<kl||(Ol=e,Wi().getCacheInfo().catch(()=>{Ol=null}))}var jl=e=>{let t=(0,I.c)(16),{boundName:n,cacheName:r}=e,{locale:a}=Xi(),o=i(ut),s=i(Nn),c=n?o[n]:void 0,l;t[0]===c?l=t[1]:(l=c?.dataType?.startsWith(`_cache_call`)?c.value?.match(Dl):void 0,t[0]=c,t[1]=l);let u=l,d=!!u,f,p;t[2]===d?(f=t[3],p=t[4]):(f=()=>{d||Al()},p=[d],t[2]=d,t[3]=f,t[4]=p),(0,F.useEffect)(f,p);let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,L.jsx)(lr,{className:`w-4 h-4 text-(--amber-9)`}),t[5]=m):m=t[5];let h=r??n??`Cache`,g;t[6]===h?g=t[7]:(g=(0,L.jsx)(Ct,{icon:m,title:h}),t[6]=h,t[7]=g);let _;t[8]!==s||t[9]!==a||t[10]!==u?(_=u?(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,L.jsx)(we,{label:`Hits`,value:(0,L.jsx)(`span`,{className:`font-medium`,children:Zi(Number(u[1]),a)})}),(0,L.jsx)(we,{label:`Misses`,value:(0,L.jsx)(`span`,{className:`font-medium`,children:Zi(Number(u[2]),a)})})]}):s&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium text-(--slate-11)`,children:`Notebook-wide`}),(0,L.jsx)(we,{label:`Hits`,value:Zi(s.hits,a)}),(0,L.jsx)(we,{label:`Misses`,value:Zi(s.misses,a)}),(0,L.jsx)(we,{label:`Time saved`,value:Gc(s.time,a)})]}),t[8]=s,t[9]=a,t[10]=u,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,L.jsx)(`div`,{className:`pt-2 text-xs text-(--slate-10)`,children:`Click to open the cache panel`}),t[12]=v):v=t[12];let y;return t[13]!==g||t[14]!==_?(y=(0,L.jsxs)(`div`,{className:Tt,children:[g,_,v]}),t[13]=g,t[14]=_,t[15]=y):y=t[15],y},Ml=j.define(),Nl=j.define();function Pl(e,t){return e.pos===t.pos&&e.kind===t.kind&&e.name===t.name&&e.cache?.boundName===t.cache?.boundName&&e.cache?.cacheName===t.cache?.cacheName}var Fl=class{view;showTimer;hideTimer;constructor(e){this.view=e}enterLens(e,t){this.clearTimers(),Ll(this.view,t);let n=this.view.state.field(Bl,!1);n&&Pl(n.spec,e)||(this.showTimer=window.setTimeout(()=>{this.showTimer=void 0,this.view.dispatch({effects:Nl.of(e)})},400))}leave(){this.clearTimers(),this.hideTimer=window.setTimeout(()=>{this.hideTimer=void 0,this.hide()},200)}enterPopover(){window.clearTimeout(this.hideTimer),this.hideTimer=void 0}hide(){this.clearTimers(),this.view.state.field(Bl,!1)&&this.view.dispatch({effects:Nl.of(null)})}destroy(){this.clearTimers()}clearTimers(){window.clearTimeout(this.showTimer),window.clearTimeout(this.hideTimer),this.showTimer=void 0,this.hideTimer=void 0}},Il=_i.define(e=>new Fl(e));function Ll(e,t){e.dom.dispatchEvent(new MouseEvent(`mouseleave`,{relatedTarget:t}))}var Rl=class extends ci{spec;constructor(e){super(),this.spec=e}eq(e){return Pl(this.spec,e.spec)}toDOM(e){let{spec:t}=this,n=document.createElement(`span`);n.className=`mo-code-lens`,n.setAttribute(`role`,`button`),n.tabIndex=0,n.setAttribute(`aria-label`,xl[t.kind]),n.innerHTML=bl[t.kind];let r=()=>e.plugin(Il),i=()=>r()?.hide();return n.onmouseenter=()=>r()?.enterLens(t,n),n.onmouseleave=()=>r()?.leave(),n.onmousemove=e=>{e.stopPropagation()},n.onmousedown=e=>{e.preventDefault(),e.stopPropagation()},n.onclick=e=>{e.preventDefault(),e.stopPropagation(),i(),sl(t.kind)},n.onkeydown=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),i(),sl(t.kind))},n}ignoreEvent(){return!0}};function zl(e){return{spec:e,tooltip:{pos:e.pos,above:!0,create:t=>{let n=document.createElement(`div`);return n.classList.add(`mo-cm-tooltip`,`docs-documentation`),n.onmouseenter=()=>t.plugin(Il)?.enterPopover(),n.onmouseleave=()=>t.plugin(Il)?.leave(),{dom:n,resize:!1,destroy:Sl(n,e)}}}}}var Bl=Zr.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(Nl))return n.value?zl(n.value):null;if(n.is(Ml)&&e)return n.value.some(t=>Pl(t,e.spec))?e:null}return t.docChanged?null:e},provide:e=>Xr.from(e,e=>e?.tooltip??null)}),Vl=Zr.define({create(){return M.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Ml)&&(e=M.set(n.value.map(e=>M.widget({widget:new Rl(e),side:1}).range(e.pos)),!0));return e},provide:e=>N.decorations.from(e)}),Hl=class{view;cellId;includeCache;unsubscribes;debounceMs=300;scheduleUpdate;constructor(e,t,n){this.view=e,this.cellId=t,this.includeCache=n,this.scheduleUpdate=Lt(()=>this.run(),this.debounceMs);let r=()=>this.scheduleUpdate();this.unsubscribes=[o.sub(O,r),o.sub(E,r),o.sub(Te,r),o.sub(ut,r)],this.scheduleUpdate()}update(e){let t=e.startState.field(Ue,!1)?.type!==e.state.field(Ue,!1)?.type;(e.docChanged||t)&&this.scheduleUpdate()}destroy(){this.scheduleUpdate.cancel();for(let e of this.unsubscribes)e()}run(){let{state:e}=this.view,t=[],n=e.field(Ue,!1)?.type;if(n==null||n===`python`){let n=vl(this.cellId),r=cl({state:e,names:new Set(n.keys())});for(let e of r){let r=n.get(e.name);r&&t.push({pos:e.to,kind:r,name:e.name})}if(this.includeCache)for(let n of ml(e))t.push({pos:n.to,kind:`cache`,name:`cache:${n.from}`,cache:{boundName:n.boundName,cacheName:n.cacheName}})}queueMicrotask(()=>{this.view.dispatch({effects:Ml.of(t)})})}},Ul=`3px`,Wl=N.baseTheme({".mo-code-lens":{display:`inline-flex`,verticalAlign:`baseline`,transform:`translateY(1.5px)`,padding:Ul,margin:`-${Ul} 0 -${Ul} calc(0.3em - ${Ul})`,cursor:`pointer`,opacity:`0.5`},".mo-code-lens:hover":{opacity:`1`}});function Gl(e,t=!0){return t?[Vl,Bl,Il,_i.define(t=>new Hl(t,e,ye(`cache_panel`))),Wl]:[]}var Kl=[`%alias`,`%cd`,`%clear`,`%debug`,`%env`,`%load`,`%load_ext`,`%lsmagic`,`%matplotlib`,`%pwd`,`%who_ls`,`%system`,`%%time`,`%%timeit`,`%%writefile`,`%%capture`,`%%html`,`%%latex`],ql;function Jl(){let e=async e=>{let t=o.get(Rt),{saveUserConfig:n}=Wi();await n({config:{runtime:{auto_reload:e}}}).then(()=>o.set(Rt,{...t,runtime:{...t.runtime,auto_reload:e}}))},t=[{match:`!pip install`,onMatch:()=>{o.set(ce,e=>({...e,isSidebarOpen:!0,selectedPanel:`packages`})),la()},title:`Package Installation`,description:(0,L.jsxs)(L.Fragment,{children:[`The package manager sidebar has been opened.`,(0,L.jsx)(`br`,{}),`Install packages directly from there instead.`]})},{match:`!uv pip install`,onMatch:()=>{o.set(ce,e=>({...e,isSidebarOpen:!0,selectedPanel:`packages`})),la()},title:`Package Installation`,description:(0,L.jsxs)(L.Fragment,{children:[`The package manager sidebar has been opened.`,(0,L.jsx)(`br`,{}),`Install packages directly from there instead.`]})},{match:`!uv add`,onMatch:()=>{o.set(ce,e=>({...e,isSidebarOpen:!0,selectedPanel:`packages`})),la()},title:`Package Installation`,description:(0,L.jsxs)(L.Fragment,{children:[`The package manager sidebar has been opened.`,(0,L.jsx)(`br`,{}),`Install packages directly from there instead.`]})},{match:`%autoreload 2`,onMatch:async()=>{await e(`autorun`)},title:`Module reload`,description:(0,L.jsxs)(L.Fragment,{children:[`Module reload mode set to `,(0,L.jsx)(`b`,{children:`autorun`}),` - module changes will re-run the cells that import them.`]})},{match:`%autoreload 1`,onMatch:async()=>{await e(`lazy`)},title:`Module reload`,description:(0,L.jsxs)(L.Fragment,{children:[`Module reload mode set to `,(0,L.jsx)(`b`,{children:`lazy`}),` - module changes will mark the cells that import them as stale.`]})},{match:`%autoreload 0`,onMatch:async()=>{await e(`off`)},title:`Module reload`,description:(0,L.jsx)(L.Fragment,{children:`Module reload disabled - module changes will not be detected.`})},{match:`!ls`,onMatch:()=>{},title:`Listing files`,description:(0,L.jsxs)(L.Fragment,{children:[`Shell commands are not directly supported.`,(0,L.jsx)(`br`,{}),`Use `,(0,L.jsx)(`code`,{children:`import subprocess; subprocess.run(['ls'])`}),` instead.`]})},...Kl.map(e=>({match:e,onMatch:()=>{},title:(0,L.jsx)(Pa,{className:`inline`,children:e}),description:(0,L.jsxs)(L.Fragment,{children:[`Magic commands are not supported in marimo. Read more about replacements in the`,` `,(0,L.jsx)(`a`,{href:`https://docs.marimo.io/guides/coming_from/jupyter/#adapting-to-the-absence-of-magic-commands`,target:`_blank`,className:`text-link underline cursor-pointer`,rel:`noopener noreferrer`,children:`documentation`}),`.`]})}))],n=new Map(t.map(e=>[e.match,e]));return N.updateListener.of(e=>{if(e.docChanged){let t=e.state.selection.main,r=e.state.doc,i=r.lineAt(t.head),a=r.sliceString(i.from,t.anchor).trim(),o=n.get(a);o&&(o.onMatch(),ql?ql.upsert({title:o.title,description:o.description}):ql=jr({title:o.title,description:o.description}))}})}var Yl=new Set([`Escape`,"Alt-`"]);function Xl(e,t=Yl){return e.filter(e=>![e.key,e.mac,e.linux,e.win].some(e=>t.has(e)))}function Zl(e=!0){let t=new Set(Yl);e||t.add(`Enter`);let n=Xl(Pi,t);return hi.highest(ei.of([...n,{key:`Ctrl-y`,run:e=>v(e)?zi(e):!1},{key:`Ctrl-n`,run:e=>v(e)?Fi(!0)(e):!1},{key:`Ctrl-p`,run:e=>v(e)?Fi(!1)(e):!1}]))}var Ql=j.define(),$l=j.define(),eu=j.define();function R(e,t){if(!e)throw Error(t)}var tu=34028234663852886e22,nu=-34028234663852886e22,ru=4294967295,iu=2147483647,au=-2147483648;function ou(e){if(typeof e!=`number`)throw Error(`invalid int 32: `+typeof e);if(!Number.isInteger(e)||e>iu||e<au)throw Error(`invalid int 32: `+e)}function su(e){if(typeof e!=`number`)throw Error(`invalid uint 32: `+typeof e);if(!Number.isInteger(e)||e>ru||e<0)throw Error(`invalid uint 32: `+e)}function cu(e){if(typeof e!=`number`)throw Error(`invalid float 32: `+typeof e);if(Number.isFinite(e)&&(e>tu||e<nu))throw Error(`invalid float 32: `+e)}var lu=Symbol(`@bufbuild/protobuf/enum-type`);function uu(e){let t=e[lu];return R(t,`missing enum type on enum object`),t}function du(e,t,n,r){e[lu]=fu(t,n.map(t=>({no:t.no,name:t.name,localName:e[t.no]})),r)}function fu(e,t,n){let r=Object.create(null),i=Object.create(null),a=[];for(let e of t){let t=mu(e);a.push(t),r[e.name]=t,i[e.no]=t}return{typeName:e,values:a,findName(e){return r[e]},findNumber(e){return i[e]}}}function pu(e,t,n){let r={};for(let e of t){let t=mu(e);r[t.localName]=t.no,r[t.no]=t.localName}return du(r,e,t,n),r}function mu(e){return`localName`in e?e:Object.assign(Object.assign({},e),{localName:e.name})}var z=class{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){let n=this.getType().runtime.bin,r=n.makeReadOptions(t);return n.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,t){let n=this.getType(),r=n.runtime.json,i=r.makeReadOptions(t);return r.readMessage(n,e,i,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`cannot decode ${this.getType().typeName} from JSON: ${e instanceof Error?e.message:String(e)}`)}return this.fromJson(n,t)}toBinary(e){let t=this.getType().runtime.bin,n=t.makeWriteOptions(e),r=n.writerFactory();return t.writeMessage(this,r,n),r.finish()}toJson(e){let t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){let t=this.toJson(e);return JSON.stringify(t,null,e?.prettySpaces??0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function hu(e,t,n,r){let i=r?.localName??t.substring(t.lastIndexOf(`.`)+1),a={[i]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[i];return Object.setPrototypeOf(a.prototype,new z),Object.assign(a,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary(e,t){return new a().fromBinary(e,t)},fromJson(e,t){return new a().fromJson(e,t)},fromJsonString(e,t){return new a().fromJsonString(e,t)},equals(t,n){return e.util.equals(a,t,n)}}),a}function gu(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(n&15)<<28,t=(n&112)>>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}throw Error(`invalid varint`)}function _u(e,t,n){for(let r=0;r<28;r+=7){let i=e>>>r,a=!(!(i>>>7)&&t==0),o=(a?i|128:i)&255;if(n.push(o),!a)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),i){for(let e=3;e<31;e+=7){let r=t>>>e,i=!!(r>>>7),a=(i?r|128:r)&255;if(n.push(a),!i)return}n.push(t>>>31&1)}}var vu=4294967296;function yu(e){let t=e[0]===`-`;t&&(e=e.slice(1));let n=1e6,r=0,i=0;function a(t,a){let o=Number(e.slice(t,a));i*=n,r=r*n+o,r>=vu&&(i+=r/vu|0,r%=vu)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?wu(r,i):Cu(r,i)}function bu(e,t){let n=Cu(e,t),r=n.hi&2147483648;r&&(n=wu(n.lo,n.hi));let i=xu(n.lo,n.hi);return r?`-`+i:i}function xu(e,t){if({lo:e,hi:t}=Su(e,t),t<=2097151)return String(vu*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+Tu(o)+Tu(a)}function Su(e,t){return{lo:e>>>0,hi:t>>>0}}function Cu(e,t){return{lo:e|0,hi:t|0}}function wu(e,t){return t=~t,e?e=~e+1:t+=1,Cu(e,t)}var Tu=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function Eu(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}function Du(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}function Ou(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(typeof process!=`object`||{}.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||r<t)throw Error(`int64 invalid: ${e}`);return r},uParse(e){let t=typeof e==`bigint`?e:BigInt(e);if(t>i||t<r)throw Error(`uint64 invalid: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)},uDec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0)}}}let t=e=>R(/^-?[0-9]+$/.test(e),`int64 invalid: ${e}`),n=e=>R(/^[0-9]+$/.test(e),`uint64 invalid: ${e}`);return{zero:`0`,supported:!1,parse(e){return typeof e!=`string`&&(e=e.toString()),t(e),e},uParse(e){return typeof e!=`string`&&(e=e.toString()),n(e),e},enc(e){return typeof e!=`string`&&(e=e.toString()),t(e),yu(e)},uEnc(e){return typeof e!=`string`&&(e=e.toString()),n(e),yu(e)},dec(e,t){return bu(e,t)},uDec(e,t){return xu(e,t)}}}var B=Ou(),V;(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(V||={});var ku;(function(e){e[e.BIGINT=0]=`BIGINT`,e[e.STRING=1]=`STRING`})(ku||={});function Au(e,t,n){if(t===n)return!0;if(e==V.BYTES){if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array)||t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case V.UINT64:case V.FIXED64:case V.INT64:case V.SFIXED64:case V.SINT64:return t==n}return!1}function ju(e,t){switch(e){case V.BOOL:return!1;case V.UINT64:case V.FIXED64:case V.INT64:case V.SFIXED64:case V.SINT64:return t==0?B.zero:`0`;case V.DOUBLE:case V.FLOAT:return 0;case V.BYTES:return new Uint8Array;case V.STRING:return``;default:return 0}}function Mu(e,t){switch(e){case V.BOOL:return t===!1;case V.STRING:return t===``;case V.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return t==0}}var H;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(H||={});var Nu=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),n=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],n),n+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw Error(`invalid state, fork stack empty`);return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(su(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return ou(e),Eu(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){cu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){su(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){ou(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return ou(e),e=(e<<1^e>>31)>>>0,Eu(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=B.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=B.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=B.enc(e);return _u(t.lo,t.hi,this.buf),this}sint64(e){let t=B.enc(e),n=t.hi>>31;return _u(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=B.uEnc(e);return _u(t.lo,t.hi,this.buf),this}},Pu=class{constructor(e,t){this.varint64=gu,this.uint32=Du,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case H.Varint:for(;this.buf[this.pos++]&128;);break;case H.Bit64:this.pos+=4;case H.Bit32:this.pos+=4;break;case H.LengthDelimited:let n=this.uint32();this.pos+=n;break;case H.StartGroup:for(;;){let[e,n]=this.tag();if(n===H.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(n,e)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return B.dec(...this.varint64())}uint64(){return B.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,B.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return B.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return B.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function Fu(e,t,n,r){let i;return{typeName:t,extendee:n,get field(){if(!i){let n=typeof r==`function`?r():r;n.name=t.split(`.`).pop(),n.jsonName=`[${t}]`,i=e.util.newFieldList([n]).list()[0]}return i},runtime:e}}function Iu(e){let t=e.field.localName,n=Object.create(null);return n[t]=Lu(e),[n,()=>n[t]]}function Lu(e){let t=e.field;if(t.repeated)return[];if(t.default!==void 0)return t.default;switch(t.kind){case`enum`:return t.T.values[0].no;case`scalar`:return ju(t.T,t.L);case`message`:let e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case`map`:throw`map fields are not allowed to be extensions`}}function Ru(e,t){if(!t.repeated&&(t.kind==`enum`||t.kind==`scalar`)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(e=>e.no===t.no)}var zu=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),Bu=[];for(let e=0;e<zu.length;e++)Bu[zu[e].charCodeAt(0)]=e;Bu[45]=zu.indexOf(`+`),Bu[95]=zu.indexOf(`/`);var Vu={dec(e){let t=e.length*3/4;e[e.length-2]==`=`?t-=2:e[e.length-1]==`=`&&--t;let n=new Uint8Array(t),r=0,i=0,a,o=0;for(let t=0;t<e.length;t++){if(a=Bu[e.charCodeAt(t)],a===void 0)switch(e[t]){case`=`:i=0;case`
11
- `:case`\r`:case` `:case` `:continue;default:throw Error(`invalid base64 string.`)}switch(i){case 0:o=a,i=1;break;case 1:n[r++]=o<<2|(a&48)>>4,o=a,i=2;break;case 2:n[r++]=(o&15)<<4|(a&60)>>2,o=a,i=3;break;case 3:n[r++]=(o&3)<<6|a,i=0}}if(i==1)throw Error(`invalid base64 string.`);return n.subarray(0,r)},enc(e){let t=``,n=0,r,i=0;for(let a=0;a<e.length;a++)switch(r=e[a],n){case 0:t+=zu[r>>2],i=(r&3)<<4,n=1;break;case 1:t+=zu[i|r>>4],i=(r&15)<<2,n=2;break;case 2:t+=zu[i|r>>6],t+=zu[r&63],n=0}return n&&(t+=zu[i],t+=`=`,n==1&&(t+=`=`)),t}};function Hu(e,t,n){Gu(t,e);let r=t.runtime.bin.makeReadOptions(n),i=Ru(e.getType().runtime.bin.listUnknownFields(e),t.field),[a,o]=Iu(t);for(let e of i)t.runtime.bin.readField(a,r.readerFactory(e.data),t.field,e.wireType,r);return o()}function Uu(e,t,n,r){Gu(t,e);let i=t.runtime.bin.makeReadOptions(r),a=t.runtime.bin.makeWriteOptions(r);if(Wu(e,t)){let n=e.getType().runtime.bin.listUnknownFields(e).filter(e=>e.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(let t of n)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}let o=a.writerFactory(),s=t.field;!s.opt&&!s.repeated&&(s.kind==`enum`||s.kind==`scalar`)&&(s=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(s,n,o,a);let c=i.readerFactory(o.finish());for(;c.pos<c.len;){let[t,n]=c.tag(),r=c.skip(n,t);e.getType().runtime.bin.onUnknownField(e,t,n,r)}}function Wu(e,t){let n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find(e=>e.no==t.field.no)}function Gu(e,t){R(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}function Ku(e,t){let n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case`enum`:case`scalar`:return e.opt||e.req?t[n]!==void 0:e.kind==`enum`?t[n]!==e.T.values[0].no:!Mu(e.T,t[n]);case`message`:return t[n]!==void 0;case`map`:return Object.keys(t[n]).length>0}}function qu(e,t){let n=e.localName,r=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case`map`:t[n]={};break;case`enum`:t[n]=r?e.T.values[0].no:void 0;break;case`scalar`:t[n]=r?ju(e.T,e.L):void 0;break;case`message`:t[n]=void 0}}function Ju(e,t){if(typeof e!=`object`||!e||!Object.getOwnPropertyNames(z.prototype).every(t=>t in e&&typeof e[t]==`function`))return!1;let n=e.getType();return n===null||typeof n!=`function`||!(`typeName`in n)||typeof n.typeName!=`string`?!1:t===void 0||n.typeName==t.typeName}function Yu(e,t){return Ju(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}V.DOUBLE,V.FLOAT,V.INT64,V.UINT64,V.INT32,V.UINT32,V.BOOL,V.STRING,V.BYTES;var Xu={ignoreUnknownFields:!1},Zu={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function Qu(e){return e?Object.assign(Object.assign({},Xu),e):Xu}function $u(e){return e?Object.assign(Object.assign({},Zu),e):Zu}var ed=Symbol(),td=Symbol();function nd(){return{makeReadOptions:Qu,makeWriteOptions:$u,readMessage(e,t,n,r){if(t==null||Array.isArray(t)||typeof t!=`object`)throw Error(`cannot decode message ${e.typeName} from JSON: ${rd(t)}`);r??=new e;let i=new Map,a=n.typeRegistry;for(let[o,s]of Object.entries(t)){let t=e.fields.findJsonName(o);if(t){if(t.oneof){if(s===null&&t.kind==`scalar`)continue;let n=i.get(t.oneof);if(n!==void 0)throw Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${t.oneof.name}" present: "${n}", "${o}"`);i.set(t.oneof,o)}id(r,s,t,n,e)}else{let t=!1;if(a?.findExtension&&o.startsWith(`[`)&&o.endsWith(`]`)){let i=a.findExtension(o.substring(1,o.length-1));if(i&&i.extendee.typeName==e.typeName){t=!0;let[e,a]=Iu(i);id(e,s,i.field,n,i),Uu(r,i,a(),n)}}if(!t&&!n.ignoreUnknownFields)throw Error(`cannot decode message ${e.typeName} from JSON: key "${o}" is unknown`)}}return r},writeMessage(e,t){let n=e.getType(),r={},i;try{for(i of n.fields.byNumber()){if(!Ku(i,e)){if(i.req)throw`required field not set`;if(!t.emitDefaultValues||!cd(i))continue}let n=i.oneof?e[i.oneof.localName].value:e[i.localName],a=ld(i,n,t);a!==void 0&&(r[t.useProtoFieldName?i.name:i.jsonName]=a)}let a=t.typeRegistry;if(a?.findExtensionFor)for(let i of n.runtime.bin.listUnknownFields(e)){let o=a.findExtensionFor(n.typeName,i.no);if(o&&Wu(e,o)){let n=Hu(e,o,t),i=ld(o.field,n,t);i!==void 0&&(r[o.field.jsonName]=i)}}}catch(e){let t=i?`cannot encode field ${n.typeName}.${i.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,r=e instanceof Error?e.message:String(e);throw Error(t+(r.length>0?`: ${r}`:``))}return r},readScalar(e,t,n){return od(e,t,n??ku.BIGINT,!0)},writeScalar(e,t,n){if(t!==void 0&&(n||Mu(e,t)))return dd(e,t)},debug:rd}}function rd(e){if(e===null)return`null`;switch(typeof e){case`object`:return Array.isArray(e)?`array`:`object`;case`string`:return e.length>100?`string`:`"${e.split(`"`).join(`\\"`)}"`;default:return String(e)}}function id(e,t,n,r,i){let a=n.localName;if(n.repeated){if(R(n.kind!=`map`),t===null)return;if(!Array.isArray(t))throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${rd(t)}`);let o=e[a];for(let e of t){if(e===null)throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${rd(e)}`);switch(n.kind){case`message`:o.push(n.T.fromJson(e,r));break;case`enum`:let t=sd(n.T,e,r.ignoreUnknownFields,!0);t!==td&&o.push(t);break;case`scalar`:try{o.push(od(n.T,e,n.L,!0))}catch(t){let r=`cannot decode field ${i.typeName}.${n.name} from JSON: ${rd(e)}`;throw t instanceof Error&&t.message.length>0&&(r+=`: ${t.message}`),Error(r)}}}}else if(n.kind==`map`){if(t===null)return;if(typeof t!=`object`||Array.isArray(t))throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${rd(t)}`);let o=e[a];for(let[e,a]of Object.entries(t)){if(a===null)throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: map value null`);let s;try{s=ad(n.K,e)}catch(e){let r=`cannot decode map key for field ${i.typeName}.${n.name} from JSON: ${rd(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}switch(n.V.kind){case`message`:o[s]=n.V.T.fromJson(a,r);break;case`enum`:let e=sd(n.V.T,a,r.ignoreUnknownFields,!0);e!==td&&(o[s]=e);break;case`scalar`:try{o[s]=od(n.V.T,a,ku.BIGINT,!0)}catch(e){let r=`cannot decode map value for field ${i.typeName}.${n.name} from JSON: ${rd(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a=`value`),n.kind){case`message`:let o=n.T;if(t===null&&o.typeName!=`google.protobuf.Value`)return;let s=e[a];Ju(s)?s.fromJson(t,r):(e[a]=s=o.fromJson(t,r),o.fieldWrapper&&!n.oneof&&(e[a]=o.fieldWrapper.unwrapField(s)));break;case`enum`:let c=sd(n.T,t,r.ignoreUnknownFields,!1);switch(c){case ed:qu(n,e);break;case td:break;default:e[a]=c}break;case`scalar`:try{let r=od(n.T,t,n.L,!1);switch(r){case ed:qu(n,e);break;default:e[a]=r}}catch(e){let r=`cannot decode field ${i.typeName}.${n.name} from JSON: ${rd(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}}}function ad(e,t){if(e===V.BOOL)switch(t){case`true`:t=!0;break;case`false`:t=!1}return od(e,t,ku.BIGINT,!0).toString()}function od(e,t,n,r){if(t===null)return r?ju(e,n):ed;switch(e){case V.DOUBLE:case V.FLOAT:if(t===`NaN`)return NaN;if(t===`Infinity`)return 1/0;if(t===`-Infinity`)return-1/0;if(t===``||typeof t==`string`&&t.trim().length!==t.length||typeof t!=`string`&&typeof t!=`number`)break;let r=Number(t);if(Number.isNaN(r)||!Number.isFinite(r))break;return e==V.FLOAT&&cu(r),r;case V.INT32:case V.FIXED32:case V.SFIXED32:case V.SINT32:case V.UINT32:let i;if(typeof t==`number`?i=t:typeof t==`string`&&t.length>0&&t.trim().length===t.length&&(i=Number(t)),i===void 0)break;return e==V.UINT32||e==V.FIXED32?su(i):ou(i),i;case V.INT64:case V.SFIXED64:case V.SINT64:if(typeof t!=`number`&&typeof t!=`string`)break;let a=B.parse(t);return n?a.toString():a;case V.FIXED64:case V.UINT64:if(typeof t!=`number`&&typeof t!=`string`)break;let o=B.uParse(t);return n?o.toString():o;case V.BOOL:if(typeof t!=`boolean`)break;return t;case V.STRING:if(typeof t!=`string`)break;return t;case V.BYTES:if(t===``)return new Uint8Array;if(typeof t!=`string`)break;return Vu.dec(t)}throw Error()}function sd(e,t,n,r){if(t===null)return e.typeName==`google.protobuf.NullValue`?0:r?e.values[0].no:ed;switch(typeof t){case`number`:if(Number.isInteger(t))return t;break;case`string`:let r=e.findName(t);if(r!==void 0)return r.no;if(n)return td}throw Error(`cannot decode enum ${e.typeName} from JSON: ${rd(t)}`)}function cd(e){return e.repeated||e.kind==`map`?!0:!(e.oneof||e.kind==`message`||e.opt||e.req)}function ld(e,t,n){if(e.kind==`map`){R(typeof t==`object`&&!!t);let r={},i=Object.entries(t);switch(e.V.kind){case`scalar`:for(let[t,n]of i)r[t.toString()]=dd(e.V.T,n);break;case`message`:for(let[e,t]of i)r[e.toString()]=t.toJson(n);break;case`enum`:let t=e.V.T;for(let[e,a]of i)r[e.toString()]=ud(t,a,n.enumAsInteger)}return n.emitDefaultValues||i.length>0?r:void 0}if(e.repeated){R(Array.isArray(t));let r=[];switch(e.kind){case`scalar`:for(let n=0;n<t.length;n++)r.push(dd(e.T,t[n]));break;case`enum`:for(let i=0;i<t.length;i++)r.push(ud(e.T,t[i],n.enumAsInteger));break;case`message`:for(let e=0;e<t.length;e++)r.push(t[e].toJson(n))}return n.emitDefaultValues||r.length>0?r:void 0}switch(e.kind){case`scalar`:return dd(e.T,t);case`enum`:return ud(e.T,t,n.enumAsInteger);case`message`:return Yu(e.T,t).toJson(n)}}function ud(e,t,n){return R(typeof t==`number`),e.typeName==`google.protobuf.NullValue`?null:n?t:e.findNumber(t)?.name??t}function dd(e,t){switch(e){case V.INT32:case V.SFIXED32:case V.SINT32:case V.FIXED32:case V.UINT32:return R(typeof t==`number`),t;case V.FLOAT:case V.DOUBLE:return R(typeof t==`number`),Number.isNaN(t)?`NaN`:t===1/0?`Infinity`:t===-1/0?`-Infinity`:t;case V.STRING:return R(typeof t==`string`),t;case V.BOOL:return R(typeof t==`boolean`),t;case V.UINT64:case V.FIXED64:case V.INT64:case V.SFIXED64:case V.SINT64:return R(typeof t==`bigint`||typeof t==`string`||typeof t==`number`),t.toString();case V.BYTES:return R(t instanceof Uint8Array),Vu.enc(t)}}var fd=Symbol(`@bufbuild/protobuf/unknown-fields`),pd={readUnknownFields:!0,readerFactory:e=>new Pu(e)},md={writeUnknownFields:!0,writerFactory:()=>new Nu};function hd(e){return e?Object.assign(Object.assign({},pd),e):pd}function gd(e){return e?Object.assign(Object.assign({},md),e):md}function _d(){return{makeReadOptions:hd,makeWriteOptions:gd,listUnknownFields(e){return e[fd]??[]},discardUnknownFields(e){delete e[fd]},writeUnknownFields(e,t){let n=e[fd];if(n)for(let e of n)t.tag(e.no,e.wireType).raw(e.data)},onUnknownField(e,t,n,r){let i=e;Array.isArray(i[fd])||(i[fd]=[]),i[fd].push({no:t,wireType:n,data:r})},readMessage(e,t,n,r,i){let a=e.getType(),o=i?t.len:t.pos+n,s,c;for(;t.pos<o&&([s,c]=t.tag(),i!==!0||c!=H.EndGroup);){let n=a.fields.find(s);if(!n){let n=t.skip(c,s);r.readUnknownFields&&this.onUnknownField(e,s,c,n);continue}vd(e,t,n,c,r)}if(i&&(c!=H.EndGroup||s!==n))throw Error(`invalid end group tag`)},readField:vd,writeMessage(e,t,n){let r=e.getType();for(let i of r.fields.byNumber()){if(!Ku(i,e)){if(i.req)throw Error(`cannot encode field ${r.typeName}.${i.name} to binary: required field not set`);continue}Cd(i,i.oneof?e[i.oneof.localName].value:e[i.localName],t,n)}return n.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,n,r){t!==void 0&&Cd(e,t,n,r)}}}function vd(e,t,n,r,i){let{repeated:a,localName:o}=n;switch(n.oneof&&(e=e[n.oneof.localName],e.case!=o&&delete e.value,e.case=o,o=`value`),n.kind){case`scalar`:case`enum`:let s=n.kind==`enum`?V.INT32:n.T,c=Sd;if(n.kind==`scalar`&&n.L>0&&(c=xd),a){let n=e[o];if(r==H.LengthDelimited&&s!=V.STRING&&s!=V.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(c(t,s))}else n.push(c(t,s))}else e[o]=c(t,s);break;case`message`:let l=n.T;a?e[o].push(yd(t,new l,i,n)):Ju(e[o])?yd(t,e[o],i,n):(e[o]=yd(t,new l,i,n),l.fieldWrapper&&!n.oneof&&!n.repeated&&(e[o]=l.fieldWrapper.unwrapField(e[o])));break;case`map`:let[u,d]=bd(n,t,i);e[o][u]=d}}function yd(e,t,n,r){let i=t.getType().runtime.bin,a=r?.delimited;return i.readMessage(t,e,a?r.no:e.uint32(),n,a),t}function bd(e,t,n){let r=t.uint32(),i=t.pos+r,a,o;for(;t.pos<i;){let[r]=t.tag();switch(r){case 1:a=Sd(t,e.K);break;case 2:switch(e.V.kind){case`scalar`:o=Sd(t,e.V.T);break;case`enum`:o=t.int32();break;case`message`:o=yd(t,new e.V.T,n,void 0)}}}if(a===void 0&&(a=ju(e.K,ku.BIGINT)),typeof a!=`string`&&typeof a!=`number`&&(a=a.toString()),o===void 0)switch(e.V.kind){case`scalar`:o=ju(e.V.T,ku.BIGINT);break;case`enum`:o=e.V.T.values[0].no;break;case`message`:o=new e.V.T}return[a,o]}function xd(e,t){let n=Sd(e,t);return typeof n==`bigint`?n.toString():n}function Sd(e,t){switch(t){case V.STRING:return e.string();case V.BOOL:return e.bool();case V.DOUBLE:return e.double();case V.FLOAT:return e.float();case V.INT32:return e.int32();case V.INT64:return e.int64();case V.UINT64:return e.uint64();case V.FIXED64:return e.fixed64();case V.BYTES:return e.bytes();case V.FIXED32:return e.fixed32();case V.SFIXED32:return e.sfixed32();case V.SFIXED64:return e.sfixed64();case V.SINT64:return e.sint64();case V.UINT32:return e.uint32();case V.SINT32:return e.sint32()}}function Cd(e,t,n,r){R(t!==void 0);let i=e.repeated;switch(e.kind){case`scalar`:case`enum`:let a=e.kind==`enum`?V.INT32:e.T;if(i){if(R(Array.isArray(t)),e.packed)Dd(n,a,e.no,t);else for(let r of t)Ed(n,a,e.no,r)}else Ed(n,a,e.no,t);break;case`message`:if(i){R(Array.isArray(t));for(let i of t)Td(n,r,e,i)}else Td(n,r,e,t);break;case`map`:R(typeof t==`object`&&!!t);for(let[i,a]of Object.entries(t))wd(n,r,e,i,a)}}function wd(e,t,n,r,i){e.tag(n.no,H.LengthDelimited),e.fork();let a=r;switch(n.K){case V.INT32:case V.FIXED32:case V.UINT32:case V.SFIXED32:case V.SINT32:a=Number.parseInt(r);break;case V.BOOL:R(r==`true`||r==`false`),a=r==`true`}switch(Ed(e,n.K,1,a),n.V.kind){case`scalar`:Ed(e,n.V.T,2,i);break;case`enum`:Ed(e,V.INT32,2,i);break;case`message`:R(i!==void 0),e.tag(2,H.LengthDelimited).bytes(i.toBinary(t))}e.join()}function Td(e,t,n,r){let i=Yu(n.T,r);n.delimited?e.tag(n.no,H.StartGroup).raw(i.toBinary(t)).tag(n.no,H.EndGroup):e.tag(n.no,H.LengthDelimited).bytes(i.toBinary(t))}function Ed(e,t,n,r){R(r!==void 0);let[i,a]=Od(t);e.tag(n,i)[a](r)}function Dd(e,t,n,r){if(!r.length)return;e.tag(n,H.LengthDelimited).fork();let[,i]=Od(t);for(let t=0;t<r.length;t++)e[i](r[t]);e.join()}function Od(e){let t=H.Varint;switch(e){case V.BYTES:case V.STRING:t=H.LengthDelimited;break;case V.DOUBLE:case V.FIXED64:case V.SFIXED64:t=H.Bit64;break;case V.FIXED32:case V.SFIXED32:case V.FLOAT:t=H.Bit32}let n=V[e].toLowerCase();return[t,n]}function kd(){return{setEnumType:du,initPartial(e,t){if(e===void 0)return;let n=t.getType();for(let r of n.fields.byMember()){let n=r.localName,i=t,a=e;if(a[n]!=null)switch(r.kind){case`oneof`:let e=a[n].case;if(e===void 0)continue;let t=r.findField(e),o=a[n].value;t&&t.kind==`message`&&!Ju(o,t.T)?o=new t.T(o):t&&t.kind===`scalar`&&t.T===V.BYTES&&(o=jd(o)),i[n]={case:e,value:o};break;case`scalar`:case`enum`:let s=a[n];r.T===V.BYTES&&(s=r.repeated?s.map(jd):jd(s)),i[n]=s;break;case`map`:switch(r.V.kind){case`scalar`:case`enum`:if(r.V.T===V.BYTES)for(let[e,t]of Object.entries(a[n]))i[n][e]=jd(t);else Object.assign(i[n],a[n]);break;case`message`:let e=r.V.T;for(let t of Object.keys(a[n])){let r=a[n][t];e.fieldWrapper||(r=new e(r)),i[n][t]=r}}break;case`message`:let c=r.T;if(r.repeated)i[n]=a[n].map(e=>Ju(e,c)?e:new c(e));else{let e=a[n];i[n]=c.fieldWrapper?c.typeName===`google.protobuf.BytesValue`?jd(e):e:Ju(e,c)?e:new c(e)}}}},equals(e,t,n){return t===n?!0:!t||!n?!1:e.fields.byMember().every(e=>{let r=t[e.localName],i=n[e.localName];if(e.repeated){if(r.length!==i.length)return!1;switch(e.kind){case`message`:return r.every((t,n)=>e.T.equals(t,i[n]));case`scalar`:return r.every((t,n)=>Au(e.T,t,i[n]));case`enum`:return r.every((e,t)=>Au(V.INT32,e,i[t]))}throw Error(`repeated cannot contain ${e.kind}`)}switch(e.kind){case`message`:let t=r,n=i;return e.T.fieldWrapper&&(t!==void 0&&!Ju(t)&&(t=e.T.fieldWrapper.wrapField(t)),n!==void 0&&!Ju(n)&&(n=e.T.fieldWrapper.wrapField(n))),e.T.equals(t,n);case`enum`:return Au(V.INT32,r,i);case`scalar`:return Au(e.T,r,i);case`oneof`:if(r.case!==i.case)return!1;let a=e.findField(r.case);if(a===void 0)return!0;switch(a.kind){case`message`:return a.T.equals(r.value,i.value);case`enum`:return Au(V.INT32,r.value,i.value);case`scalar`:return Au(a.T,r.value,i.value)}throw Error(`oneof cannot contain ${a.kind}`);case`map`:let o=Object.keys(r).concat(Object.keys(i));switch(e.V.kind){case`message`:let t=e.V.T;return o.every(e=>t.equals(r[e],i[e]));case`enum`:return o.every(e=>Au(V.INT32,r[e],i[e]));case`scalar`:let n=e.V.T;return o.every(e=>Au(n,r[e],i[e]))}}})},clone(e){let t=e.getType(),n=new t,r=n;for(let n of t.fields.byMember()){let t=e[n.localName],i;if(n.repeated)i=t.map(Ad);else if(n.kind==`map`){i=r[n.localName];for(let[e,n]of Object.entries(t))i[e]=Ad(n)}else i=n.kind==`oneof`?n.findField(t.case)?{case:t.case,value:Ad(t.value)}:{case:void 0}:Ad(t);r[n.localName]=i}for(let n of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(r,n.no,n.wireType,n.data);return n}}}function Ad(e){if(e===void 0)return e;if(Ju(e))return e.clone();if(e instanceof Uint8Array){let t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function jd(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Md(e,t,n){return{syntax:e,json:nd(),bin:_d(),util:Object.assign(Object.assign({},kd()),{newFieldList:t,initFields:n}),makeMessageType(e,t,n){return hu(this,e,t,n)},makeEnum:pu,makeEnumType:fu,getEnumType:uu,makeExtension(e,t,n){return Fu(this,e,t,n)}}}var Nd=class{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){let e={};for(let t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){let e={};for(let t of this.list())e[t.no]=t;this.numbers=e}return this.numbers[e]}list(){return this.all||=this._normalizer(this._fields),this.all}byNumber(){return this.numbersAsc||=this.list().concat().sort((e,t)=>e.no-t.no),this.numbersAsc}byMember(){if(!this.members){this.members=[];let e=this.members,t;for(let n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}};function Pd(e,t){let n=Ld(e);return t?n:Hd(Vd(n))}function Fd(e){return Pd(e,!1)}var Id=Ld;function Ld(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=e.charAt(r);switch(i){case`_`:t=!0;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n.push(i),t=!1;break;default:t&&(t=!1,i=i.toUpperCase()),n.push(i)}}return n.join(``)}var Rd=new Set([`constructor`,`toString`,`toJSON`,`valueOf`]),zd=new Set([`getType`,`clone`,`equals`,`fromBinary`,`fromJson`,`fromJsonString`,`toBinary`,`toJson`,`toJsonString`,`toObject`]),Bd=e=>`${e}$`,Vd=e=>zd.has(e)?Bd(e):e,Hd=e=>Rd.has(e)?Bd(e):e,Ud=class{constructor(e){this.kind=`oneof`,this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=Fd(e)}addField(e){R(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}};function Wd(e,t){let n=[],r;for(let i of typeof e==`function`?e():e){let e=i;if(e.localName=Pd(i.name,i.oneof!==void 0),e.jsonName=i.jsonName??Id(i.name),e.repeated=i.repeated??!1,i.kind==`scalar`&&(e.L=i.L??ku.BIGINT),e.delimited=i.delimited??!1,e.req=i.req??!1,e.opt=i.opt??!1,i.packed===void 0&&(e.packed=t?i.kind==`enum`||i.kind==`scalar`&&i.T!=V.BYTES&&i.T!=V.STRING:!1),i.oneof!==void 0){let t=typeof i.oneof==`string`?i.oneof:i.oneof.name;(!r||r.name!=t)&&(r=new Ud(t)),e.oneof=r,r.addField(e)}n.push(e)}return n}var U=Md(`proto3`,e=>new Nd(e,e=>Wd(e,!0)),e=>{for(let t of e.getType().fields.byMember()){if(t.opt)continue;let n=t.localName,r=e;if(t.repeated){r[n]=[];continue}switch(t.kind){case`oneof`:r[n]={case:void 0};break;case`enum`:r[n]=0;break;case`map`:r[n]={};break;case`scalar`:r[n]=ju(t.T,t.L)}}}),Gd;(function(e){e[e.Unary=0]=`Unary`,e[e.ServerStreaming=1]=`ServerStreaming`,e[e.ClientStreaming=2]=`ClientStreaming`,e[e.BiDiStreaming=3]=`BiDiStreaming`})(Gd||={});var Kd;(function(e){e[e.NoSideEffects=1]=`NoSideEffects`,e[e.Idempotent=2]=`Idempotent`})(Kd||={});var qd;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.JUPYTER_FORMAT=77]=`JUPYTER_FORMAT`})(qd||={}),U.util.setEnumType(qd,`exa.codeium_common_pb.ExperimentKey`,[{no:0,name:`UNSPECIFIED`},{no:77,name:`JUPYTER_FORMAT`}]);var Jd;(function(e){e[e.CODEIUM=0]=`CODEIUM`})(Jd||={}),U.util.setEnumType(Jd,`exa.codeium_common_pb.AuthSource`,[{no:0,name:`AUTH_SOURCE_CODEIUM`}]);var Yd;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.ENABLE_CODEIUM=1]=`ENABLE_CODEIUM`,e[e.DISABLE_CODEIUM=2]=`DISABLE_CODEIUM`,e[e.SHOW_PREVIOUS_COMPLETION=3]=`SHOW_PREVIOUS_COMPLETION`,e[e.SHOW_NEXT_COMPLETION=4]=`SHOW_NEXT_COMPLETION`})(Yd||={}),U.util.setEnumType(Yd,`exa.codeium_common_pb.EventType`,[{no:0,name:`EVENT_TYPE_UNSPECIFIED`},{no:1,name:`EVENT_TYPE_ENABLE_CODEIUM`},{no:2,name:`EVENT_TYPE_DISABLE_CODEIUM`},{no:3,name:`EVENT_TYPE_SHOW_PREVIOUS_COMPLETION`},{no:4,name:`EVENT_TYPE_SHOW_NEXT_COMPLETION`}]);var Xd;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TYPING_AS_SUGGESTED=1]=`TYPING_AS_SUGGESTED`,e[e.CACHE=2]=`CACHE`,e[e.NETWORK=3]=`NETWORK`})(Xd||={}),U.util.setEnumType(Xd,`exa.codeium_common_pb.CompletionSource`,[{no:0,name:`COMPLETION_SOURCE_UNSPECIFIED`},{no:1,name:`COMPLETION_SOURCE_TYPING_AS_SUGGESTED`},{no:2,name:`COMPLETION_SOURCE_CACHE`},{no:3,name:`COMPLETION_SOURCE_NETWORK`}]);var Zd;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.C=1]=`C`,e[e.CLOJURE=2]=`CLOJURE`,e[e.COFFEESCRIPT=3]=`COFFEESCRIPT`,e[e.CPP=4]=`CPP`,e[e.CSHARP=5]=`CSHARP`,e[e.CSS=6]=`CSS`,e[e.CUDACPP=7]=`CUDACPP`,e[e.DOCKERFILE=8]=`DOCKERFILE`,e[e.GO=9]=`GO`,e[e.GROOVY=10]=`GROOVY`,e[e.HANDLEBARS=11]=`HANDLEBARS`,e[e.HASKELL=12]=`HASKELL`,e[e.HCL=13]=`HCL`,e[e.HTML=14]=`HTML`,e[e.INI=15]=`INI`,e[e.JAVA=16]=`JAVA`,e[e.JAVASCRIPT=17]=`JAVASCRIPT`,e[e.JSON=18]=`JSON`,e[e.JULIA=19]=`JULIA`,e[e.KOTLIN=20]=`KOTLIN`,e[e.LATEX=21]=`LATEX`,e[e.LESS=22]=`LESS`,e[e.LUA=23]=`LUA`,e[e.MAKEFILE=24]=`MAKEFILE`,e[e.MARKDOWN=25]=`MARKDOWN`,e[e.OBJECTIVEC=26]=`OBJECTIVEC`,e[e.OBJECTIVECPP=27]=`OBJECTIVECPP`,e[e.PERL=28]=`PERL`,e[e.PHP=29]=`PHP`,e[e.PLAINTEXT=30]=`PLAINTEXT`,e[e.PROTOBUF=31]=`PROTOBUF`,e[e.PBTXT=32]=`PBTXT`,e[e.PYTHON=33]=`PYTHON`,e[e.R=34]=`R`,e[e.RUBY=35]=`RUBY`,e[e.RUST=36]=`RUST`,e[e.SASS=37]=`SASS`,e[e.SCALA=38]=`SCALA`,e[e.SCSS=39]=`SCSS`,e[e.SHELL=40]=`SHELL`,e[e.SQL=41]=`SQL`,e[e.STARLARK=42]=`STARLARK`,e[e.SWIFT=43]=`SWIFT`,e[e.TSX=44]=`TSX`,e[e.TYPESCRIPT=45]=`TYPESCRIPT`,e[e.VISUALBASIC=46]=`VISUALBASIC`,e[e.VUE=47]=`VUE`,e[e.XML=48]=`XML`,e[e.XSL=49]=`XSL`,e[e.YAML=50]=`YAML`,e[e.SVELTE=51]=`SVELTE`,e[e.TOML=52]=`TOML`,e[e.DART=53]=`DART`,e[e.RST=54]=`RST`,e[e.OCAML=55]=`OCAML`,e[e.CMAKE=56]=`CMAKE`,e[e.PASCAL=57]=`PASCAL`,e[e.ELIXIR=58]=`ELIXIR`,e[e.FSHARP=59]=`FSHARP`,e[e.LISP=60]=`LISP`,e[e.MATLAB=61]=`MATLAB`,e[e.POWERSHELL=62]=`POWERSHELL`,e[e.SOLIDITY=63]=`SOLIDITY`,e[e.ADA=64]=`ADA`,e[e.OCAML_INTERFACE=65]=`OCAML_INTERFACE`})(Zd||={}),U.util.setEnumType(Zd,`exa.codeium_common_pb.Language`,[{no:0,name:`LANGUAGE_UNSPECIFIED`},{no:1,name:`LANGUAGE_C`},{no:2,name:`LANGUAGE_CLOJURE`},{no:3,name:`LANGUAGE_COFFEESCRIPT`},{no:4,name:`LANGUAGE_CPP`},{no:5,name:`LANGUAGE_CSHARP`},{no:6,name:`LANGUAGE_CSS`},{no:7,name:`LANGUAGE_CUDACPP`},{no:8,name:`LANGUAGE_DOCKERFILE`},{no:9,name:`LANGUAGE_GO`},{no:10,name:`LANGUAGE_GROOVY`},{no:11,name:`LANGUAGE_HANDLEBARS`},{no:12,name:`LANGUAGE_HASKELL`},{no:13,name:`LANGUAGE_HCL`},{no:14,name:`LANGUAGE_HTML`},{no:15,name:`LANGUAGE_INI`},{no:16,name:`LANGUAGE_JAVA`},{no:17,name:`LANGUAGE_JAVASCRIPT`},{no:18,name:`LANGUAGE_JSON`},{no:19,name:`LANGUAGE_JULIA`},{no:20,name:`LANGUAGE_KOTLIN`},{no:21,name:`LANGUAGE_LATEX`},{no:22,name:`LANGUAGE_LESS`},{no:23,name:`LANGUAGE_LUA`},{no:24,name:`LANGUAGE_MAKEFILE`},{no:25,name:`LANGUAGE_MARKDOWN`},{no:26,name:`LANGUAGE_OBJECTIVEC`},{no:27,name:`LANGUAGE_OBJECTIVECPP`},{no:28,name:`LANGUAGE_PERL`},{no:29,name:`LANGUAGE_PHP`},{no:30,name:`LANGUAGE_PLAINTEXT`},{no:31,name:`LANGUAGE_PROTOBUF`},{no:32,name:`LANGUAGE_PBTXT`},{no:33,name:`LANGUAGE_PYTHON`},{no:34,name:`LANGUAGE_R`},{no:35,name:`LANGUAGE_RUBY`},{no:36,name:`LANGUAGE_RUST`},{no:37,name:`LANGUAGE_SASS`},{no:38,name:`LANGUAGE_SCALA`},{no:39,name:`LANGUAGE_SCSS`},{no:40,name:`LANGUAGE_SHELL`},{no:41,name:`LANGUAGE_SQL`},{no:42,name:`LANGUAGE_STARLARK`},{no:43,name:`LANGUAGE_SWIFT`},{no:44,name:`LANGUAGE_TSX`},{no:45,name:`LANGUAGE_TYPESCRIPT`},{no:46,name:`LANGUAGE_VISUALBASIC`},{no:47,name:`LANGUAGE_VUE`},{no:48,name:`LANGUAGE_XML`},{no:49,name:`LANGUAGE_XSL`},{no:50,name:`LANGUAGE_YAML`},{no:51,name:`LANGUAGE_SVELTE`},{no:52,name:`LANGUAGE_TOML`},{no:53,name:`LANGUAGE_DART`},{no:54,name:`LANGUAGE_RST`},{no:55,name:`LANGUAGE_OCAML`},{no:56,name:`LANGUAGE_CMAKE`},{no:57,name:`LANGUAGE_PASCAL`},{no:58,name:`LANGUAGE_ELIXIR`},{no:59,name:`LANGUAGE_FSHARP`},{no:60,name:`LANGUAGE_LISP`},{no:61,name:`LANGUAGE_MATLAB`},{no:62,name:`LANGUAGE_POWERSHELL`},{no:63,name:`LANGUAGE_SOLIDITY`},{no:64,name:`LANGUAGE_ADA`},{no:65,name:`LANGUAGE_OCAML_INTERFACE`}]);var Qd=class e extends z{completionId=``;text=``;prefix=``;stop=``;score=0;tokens=[];decodedTokens=[];probabilities=[];adjustedProbabilities=[];generatedLength=B.zero;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.codeium_common_pb.Completion`;static fields=U.util.newFieldList(()=>[{no:1,name:`completion_id`,kind:`scalar`,T:9},{no:2,name:`text`,kind:`scalar`,T:9},{no:3,name:`prefix`,kind:`scalar`,T:9},{no:4,name:`stop`,kind:`scalar`,T:9},{no:5,name:`score`,kind:`scalar`,T:1},{no:6,name:`tokens`,kind:`scalar`,T:4,repeated:!0},{no:7,name:`decoded_tokens`,kind:`scalar`,T:9,repeated:!0},{no:8,name:`probabilities`,kind:`scalar`,T:1,repeated:!0},{no:9,name:`adjusted_probabilities`,kind:`scalar`,T:1,repeated:!0},{no:10,name:`generated_length`,kind:`scalar`,T:4}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},$d=class e extends z{ideName=``;ideVersion=``;extensionName=``;extensionVersion=``;apiKey=``;locale=``;sessionId=``;requestId=B.zero;userAgent=``;url=``;authSource=Jd.CODEIUM;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.codeium_common_pb.Metadata`;static fields=U.util.newFieldList(()=>[{no:1,name:`ide_name`,kind:`scalar`,T:9},{no:7,name:`ide_version`,kind:`scalar`,T:9},{no:12,name:`extension_name`,kind:`scalar`,T:9},{no:2,name:`extension_version`,kind:`scalar`,T:9},{no:3,name:`api_key`,kind:`scalar`,T:9},{no:4,name:`locale`,kind:`scalar`,T:9},{no:10,name:`session_id`,kind:`scalar`,T:9},{no:9,name:`request_id`,kind:`scalar`,T:4},{no:13,name:`user_agent`,kind:`scalar`,T:9},{no:14,name:`url`,kind:`scalar`,T:9},{no:15,name:`auth_source`,kind:`enum`,T:U.getEnumType(Jd)}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},ef=class e extends z{tabSize=B.zero;insertSpaces=!1;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.codeium_common_pb.EditorOptions`;static fields=U.util.newFieldList(()=>[{no:1,name:`tab_size`,kind:`scalar`,T:4},{no:2,name:`insert_spaces`,kind:`scalar`,T:8}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}};(class e extends z{eventType=Yd.UNSPECIFIED;eventJson=``;timestampUnixMs=B.zero;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.codeium_common_pb.Event`;static fields=U.util.newFieldList(()=>[{no:1,name:`event_type`,kind:`enum`,T:U.getEnumType(Yd)},{no:2,name:`event_json`,kind:`scalar`,T:9},{no:3,name:`timestamp_unix_ms`,kind:`scalar`,T:3}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}});var tf=class extends ci{index;total;constructor(e,t){super(),this.index=e,this.total=t}toDOM(){let e=document.createElement(`span`);e.setAttribute(`aria-hidden`,`true`),e.className=`cm-codeium-cycle`;let t=e.appendChild(document.createElement(`span`));t.className=`cm-codeium-cycle-explanation`,t.innerText=`${this.index+1}/${this.total}`;let n=e.appendChild(document.createElement(`button`));return n.className=`cm-codeium-cycle-key`,n.innerText=`→ (Ctrl ])`,n.dataset.action=`codeium-cycle`,e}ignoreEvent(){return!1}},nf=Br.define({combine(e){return gi(e,{language:Zd.TYPESCRIPT,timeout:150,widgetClass:tf,alwaysOn:!0},{})}}),rf=Br.define({combine(e){return gi(e,{override:()=>[]},{})}}),af=M.mark({class:`cm-ghostText`}),of=Zr.define({create(e){return null},update(e,t){let n=t.state.facet(nf);for(let e of t.effects){if(e.is(Ql)){let{changeSpecs:t,index:r}=e.value,i=t[r].map(e=>af.range(e.absoluteStartPos,e.absoluteEndPos)),a=i.at(-1)?.to;return{index:r,decorations:M.set([...i,...a!==void 0&&t.length>1&&n.widgetClass?[M.widget({widget:new n.widgetClass(r,t.length),side:1}).range(a)]:[]]),changeSpecs:t,reverseChangeSet:e.value.reverseChangeSet}}if(e.is($l)||e.is(eu))return null}return e&&{...e,decorations:e.decorations.map(t.changes),reverseChangeSet:e.reverseChangeSet.map(t.changes)}},provide:e=>N.decorations.from(e,e=>e?.decorations||M.none)}),sf=Qr.define(),cf=Qr.define(),W;(function(e){e[e.Canceled=1]=`Canceled`,e[e.Unknown=2]=`Unknown`,e[e.InvalidArgument=3]=`InvalidArgument`,e[e.DeadlineExceeded=4]=`DeadlineExceeded`,e[e.NotFound=5]=`NotFound`,e[e.AlreadyExists=6]=`AlreadyExists`,e[e.PermissionDenied=7]=`PermissionDenied`,e[e.ResourceExhausted=8]=`ResourceExhausted`,e[e.FailedPrecondition=9]=`FailedPrecondition`,e[e.Aborted=10]=`Aborted`,e[e.OutOfRange=11]=`OutOfRange`,e[e.Unimplemented=12]=`Unimplemented`,e[e.Internal=13]=`Internal`,e[e.Unavailable=14]=`Unavailable`,e[e.DataLoss=15]=`DataLoss`,e[e.Unauthenticated=16]=`Unauthenticated`})(W||={});function lf(e){let t=W[e];return typeof t==`string`?t[0].toLowerCase()+t.substring(1).replace(/[A-Z]/g,e=>`_`+e.toLowerCase()):e.toString()}var uf;function df(e){if(!uf){uf={};for(let e of Object.values(W))typeof e!=`string`&&(uf[lf(e)]=e)}return uf[e]}var ff=class e extends Error{constructor(e,t=W.Unknown,n,r,i){super(pf(e,t)),this.name=`ConnectError`,Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=t,this.metadata=new Headers(n??{}),this.details=r??[],this.cause=i}static from(t,n=W.Unknown){return t instanceof e?t:t instanceof Error?t.name==`AbortError`?new e(t.message,W.Canceled):new e(t.message,n,void 0,void 0,t):new e(String(t),n,void 0,void 0,t)}static[Symbol.hasInstance](t){return t instanceof Error?Object.getPrototypeOf(t)===e.prototype||t.name===`ConnectError`&&`code`in t&&typeof t.code==`number`&&`metadata`in t&&`details`in t&&Array.isArray(t.details)&&`rawMessage`in t&&typeof t.rawMessage==`string`&&`cause`in t:!1}findDetails(e){let t=`typeName`in e?{findMessage:t=>t===e.typeName?e:void 0}:e,n=[];for(let e of this.details){if(`getType`in e){t.findMessage(e.getType().typeName)&&n.push(e);continue}let r=t.findMessage(e.type);if(r)try{n.push(r.fromBinary(e.value))}catch{}}return n}};function pf(e,t){return e.length?`[${lf(t)}] ${e}`:`[${lf(t)}]`}function mf(...e){let t=new Headers;for(let n of e)n.forEach((e,n)=>{t.append(n,e)});return t}function hf(e,t){let n={};for(let[r,i]of Object.entries(e.methods)){let a=t(Object.assign(Object.assign({},i),{localName:r,service:e}));a!=null&&(n[r]=a)}return n}function gf(e){let t,n=new Uint8Array;function r(e){let t=new Uint8Array(n.length+e.length);t.set(n),t.set(e,n.length),n=t}return new ReadableStream({start(){t=e.getReader()},async pull(e){let i;for(;;){if(i===void 0&&n.byteLength>=5){let e=0;for(let t=1;t<5;t++)e=(e<<8)+n[t];i={flags:n[0],length:e}}if(i!==void 0&&n.byteLength>=i.length+5)break;let e=await t.read();if(e.done)break;r(e.value)}if(i===void 0){if(n.byteLength==0){e.close();return}e.error(new ff(`premature end of stream`,W.DataLoss));return}let a=n.subarray(5,5+i.length);n=n.subarray(5+i.length),e.enqueue({flags:i.flags,data:a})}})}function _f(e,t){let n=new Uint8Array(t.length+5);n.set(t,5);let r=new DataView(n.buffer,n.byteOffset,n.byteLength);return r.setUint8(0,e),r.setUint32(1,t.length),n}var vf=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},yf=function(e){return this instanceof yf?(this.v=e,this):new yf(e)},bf=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof yf?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}},xf=function(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:yf(e[r](t)),done:!1}:i?i(t):t}:i}};function Sf(e){return bf(this,arguments,function*(){yield yf(yield*xf(vf(e)))})}var Cf=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},wf=function(e){return this instanceof wf?(this.v=e,this):new wf(e)},Tf=function(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:wf(e[r](t)),done:!1}:i?i(t):t}:i}},Ef=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof wf?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}};function Df(e,t){return hf(e,n=>{switch(n.kind){case Gd.Unary:return kf(t,e,n);case Gd.ServerStreaming:return Af(t,e,n);case Gd.ClientStreaming:return jf(t,e,n);case Gd.BiDiStreaming:return Mf(t,e,n);default:return null}})}function Of(e,t){return Df(e,t)}function kf(e,t,n){return async function(r,i){var a,o;let s=await e.unary(t,n,i?.signal,i?.timeoutMs,i?.headers,r,i?.contextValues);return(a=i?.onHeader)==null||a.call(i,s.header),(o=i?.onTrailer)==null||o.call(i,s.trailer),s.message}}function Af(e,t,n){return function(r,i){return Nf(e.stream(t,n,i?.signal,i?.timeoutMs,i?.headers,Sf([r]),i?.contextValues),i)}}function jf(e,t,n){return async function(r,i){var a,o,s,c,l,u;let d=await e.stream(t,n,i?.signal,i?.timeoutMs,i?.headers,r,i?.contextValues);(l=i?.onHeader)==null||l.call(i,d.header);let f,p=0;try{for(var m=!0,h=Cf(d.message),g;g=await h.next(),a=g.done,!a;m=!0)c=g.value,m=!1,f=c,p++}catch(e){o={error:e}}finally{try{!m&&!a&&(s=h.return)&&await s.call(h)}finally{if(o)throw o.error}}if(!f)throw new ff(`protocol error: missing response message`,W.Unimplemented);if(p>1)throw new ff(`protocol error: received extra messages for client streaming method`,W.Unimplemented);return(u=i?.onTrailer)==null||u.call(i,d.trailer),f}}function Mf(e,t,n){return function(r,i){return Nf(e.stream(t,n,i?.signal,i?.timeoutMs,i?.headers,r,i?.contextValues),i)}}function Nf(e,t){let n=(function(){return Ef(this,arguments,function*(){var n,r;let i=yield wf(e);(n=t?.onHeader)==null||n.call(t,i.header),yield wf(yield*Tf(Cf(i.message))),(r=t?.onTrailer)==null||r.call(t,i.trailer)})})()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function Pf(...e){let t=new AbortController,n=e.filter(e=>e!==void 0).concat(t.signal);for(let e of n){if(e.aborted){r.apply(e);break}e.addEventListener(`abort`,r)}function r(){t.signal.aborted||t.abort(If(this));for(let e of n)e.removeEventListener(`abort`,r)}return t}function Ff(e){let t=new AbortController,n=()=>{t.abort(new ff(`the operation timed out`,W.DeadlineExceeded))},r;return e!==void 0&&(e<=0?n():r=setTimeout(n,e)),{signal:t.signal,cleanup:()=>clearTimeout(r)}}function If(e){if(!e.aborted)return;if(e.reason!==void 0)return e.reason;let t=Error(`This operation was aborted`);return t.name=`AbortError`,t}function Lf(){return{get(e){return e.id in this?this[e.id]:e.defaultValue},set(e,t){return this[e.id]=t,this},delete(e){return delete this[e.id],this}}}function Rf(e,t,n){let r=typeof t==`string`?t:t.typeName,i=typeof n==`string`?n:n.name;return e.toString().replace(/\/?$/,`/${r}/${i}`)}function zf(e,t){return t instanceof e?t:new e(t)}function Bf(e,t){function n(t){return t.done===!0?t:{done:t.done,value:zf(e,t.value)}}return{[Symbol.asyncIterator](){let e=t[Symbol.asyncIterator](),r={next:()=>e.next().then(n)};return e.throw!==void 0&&(r.throw=t=>e.throw(t).then(n)),e.return!==void 0&&(r.return=t=>e.return(t).then(n)),r}}}function Vf(e,t){return t?.concat().reverse().reduce((e,t)=>t(e),e)??e}function Hf(e){let t=Object.assign({},e);return t.ignoreUnknownFields??=!0,t}function Uf(e,t,n,r){let i=t?Wf(e.I,r):Gf(e.I,n);return{parse:(t?Wf(e.O,r):Gf(e.O,n)).parse,serialize:i.serialize}}function Wf(e,t){return{parse(n){try{return e.fromBinary(n,t)}catch(e){throw new ff(`parse binary: ${e instanceof Error?e.message:String(e)}`,W.Internal)}},serialize(e){try{return e.toBinary(t)}catch(e){throw new ff(`serialize binary: ${e instanceof Error?e.message:String(e)}`,W.Internal)}}}}function Gf(e,t){let n=t?.textEncoder??new TextEncoder,r=t?.textDecoder??new TextDecoder,i=Hf(t);return{parse(t){try{let n=r.decode(t);return e.fromJsonString(n,i)}catch(e){throw ff.from(e,W.InvalidArgument)}},serialize(e){try{let t=e.toJsonString(i);return n.encode(t)}catch(e){throw ff.from(e,W.Internal)}}}}var Kf=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i,qf=`application/proto`,Jf=`application/json`,Yf=`application/connect+proto`,Xf=`application/connect+json`;function Zf(e){let t=e?.match(Kf);if(t)return{stream:!!t[1],binary:!!t[3]}}function Qf(e,t,n){if(t&&new Headers(t).forEach((e,t)=>n.metadata.append(t,e)),typeof e!=`object`||!e||Array.isArray(e))throw n;let r=n.code;`code`in e&&typeof e.code==`string`&&(r=df(e.code)??r);let i=e.message;if(i!=null&&typeof i!=`string`)throw n;let a=new ff(i??``,r,t);if(`details`in e&&Array.isArray(e.details))for(let t of e.details){if(typeof t!=`object`||!t||Array.isArray(t)||typeof t.type!=`string`||typeof t.value!=`string`)throw n;try{a.details.push({type:t.type,value:Vu.dec(t.value),debug:t.debug})}catch{throw n}}return a}function $f(e){let t=new ff(`invalid end stream`,W.Unknown),n;try{n=JSON.parse(typeof e==`string`?e:new TextDecoder().decode(e))}catch{throw t}if(typeof n!=`object`||!n||Array.isArray(n))throw t;let r=new Headers;if(`metadata`in n){if(typeof n.metadata!=`object`||n.metadata==null||Array.isArray(n.metadata))throw t;for(let[e,i]of Object.entries(n.metadata)){if(!Array.isArray(i)||i.some(e=>typeof e!=`string`))throw t;for(let t of i)r.append(e,t)}}return{metadata:r,error:`error`in n&&n.error!=null?Qf(n.error,r,t):void 0}}var ep=`Content-Type`,tp=`Content-Length`,np=`Content-Encoding`,rp=`Accept-Encoding`,ip=`Connect-Timeout-Ms`,ap=`Connect-Protocol-Version`,op=`User-Agent`;function sp(e){switch(e){case 400:return W.Internal;case 401:return W.Unauthenticated;case 403:return W.PermissionDenied;case 404:return W.Unimplemented;case 429:return W.Unavailable;case 502:return W.Unavailable;case 503:return W.Unavailable;case 504:return W.Unavailable;default:return W.Unknown}}function cp(e){let t=new Headers,n=new Headers;return e.forEach((e,r)=>{r.toLowerCase().startsWith(`trailer-`)?n.append(r.substring(8),e):t.append(r,e)}),[t,n]}function lp(e,t,n,r,i){let a=new Headers(r??{});return n!==void 0&&a.set(ip,`${n}`),a.set(ep,e==Gd.Unary?t?qf:Jf:t?Yf:Xf),a.set(ap,`1`),i&&a.set(op,`connect-es/1.6.1`),a}function up(e,t,n,r){let i=r.get(ep),a=Zf(i);if(n!==200){let t=new ff(`HTTP ${n}`,sp(n),r);if(e==Gd.Unary&&a&&!a.binary)return{isUnaryError:!0,unaryError:t};throw t}let o={binary:t,stream:e!==Gd.Unary};if(a?.binary!==o.binary||a.stream!==o.stream)throw new ff(`unsupported content type ${i}`,a===void 0?W.Unknown:W.Internal,r);return{isUnaryError:!1}}var dp=`application/`;function fp(e,t){return t?Vu.enc(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``):encodeURIComponent(new TextDecoder().decode(e))}function pp(e,t,n){let r=`?connect=v1`,i=e.header.get(ep);i?.indexOf(dp)===0&&(r+=`&encoding=`+encodeURIComponent(i.slice(12)));let a=e.header.get(np);a!==null&&a!==`identity`&&(r+=`&compression=`+encodeURIComponent(a),n=!0),n&&(r+=`&base64=1`),r+=`&message=`+fp(t,n);let o=e.url+r,s=new Headers(e.header);return[ap,ep,tp,np,rp].forEach(e=>s.delete(e)),Object.assign(Object.assign({},e),{init:Object.assign(Object.assign({},e.init),{method:`GET`}),url:o,header:s})}function mp(e){let t=Vf(e.next,e.interceptors),[n,r,i]=gp(e);return t(Object.assign(Object.assign({},e.req),{message:zf(e.req.method.I,e.req.message),signal:n})).then(e=>(i(),e),r)}function hp(e){let t=Vf(e.next,e.interceptors),[n,r,i]=gp(e),a=Object.assign(Object.assign({},e.req),{message:Bf(e.req.method.I,e.req.message),signal:n}),o=!1;return n.addEventListener(`abort`,function(){var t,n;let r=e.req.message[Symbol.asyncIterator]();o||(t=r.throw)==null||t.call(r,this.reason).catch(()=>{}),(n=r.return)==null||n.call(r).catch(()=>{})}),t(a).then(e=>Object.assign(Object.assign({},e),{message:{[Symbol.asyncIterator](){let t=e.message[Symbol.asyncIterator]();return{next(){return t.next().then(e=>(e.done==1&&(o=!0,i()),e),r)}}}}}),r)}function gp(e){let{signal:t,cleanup:n}=Ff(e.timeoutMs),r=Pf(e.signal,t);return[r.signal,function(e){let i=ff.from(t.aborted?If(t):e);return r.abort(i),n(),Promise.reject(i)},function(){n(),r.abort()}]}var _p;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.INACTIVE=1]=`INACTIVE`,e[e.PROCESSING=2]=`PROCESSING`,e[e.SUCCESS=3]=`SUCCESS`,e[e.WARNING=4]=`WARNING`,e[e.ERROR=5]=`ERROR`})(_p||={}),U.util.setEnumType(_p,`exa.language_server_pb.CodeiumState`,[{no:0,name:`CODEIUM_STATE_UNSPECIFIED`},{no:1,name:`CODEIUM_STATE_INACTIVE`},{no:2,name:`CODEIUM_STATE_PROCESSING`},{no:3,name:`CODEIUM_STATE_SUCCESS`},{no:4,name:`CODEIUM_STATE_WARNING`},{no:5,name:`CODEIUM_STATE_ERROR`}]);var vp;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.SINGLE=1]=`SINGLE`,e[e.MULTI=2]=`MULTI`})(vp||={}),U.util.setEnumType(vp,`exa.language_server_pb.LineType`,[{no:0,name:`LINE_TYPE_UNSPECIFIED`},{no:1,name:`LINE_TYPE_SINGLE`},{no:2,name:`LINE_TYPE_MULTI`}]);var yp;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.INLINE=1]=`INLINE`,e[e.BLOCK=2]=`BLOCK`,e[e.INLINE_MASK=3]=`INLINE_MASK`})(yp||={}),U.util.setEnumType(yp,`exa.language_server_pb.CompletionPartType`,[{no:0,name:`COMPLETION_PART_TYPE_UNSPECIFIED`},{no:1,name:`COMPLETION_PART_TYPE_INLINE`},{no:2,name:`COMPLETION_PART_TYPE_BLOCK`},{no:3,name:`COMPLETION_PART_TYPE_INLINE_MASK`}]);var bp=class e extends z{threshold=0;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.MultilineConfig`;static fields=U.util.newFieldList(()=>[{no:1,name:`threshold`,kind:`scalar`,T:2}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},xp=class e extends z{metadata;document;editorOptions;otherDocuments=[];experimentConfig;modelName=``;multilineConfig;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.GetCompletionsRequest`;static fields=U.util.newFieldList(()=>[{no:1,name:`metadata`,kind:`message`,T:$d},{no:2,name:`document`,kind:`message`,T:Op},{no:3,name:`editor_options`,kind:`message`,T:ef},{no:5,name:`other_documents`,kind:`message`,T:Op,repeated:!0},{no:7,name:`experiment_config`,kind:`message`,T:kp},{no:10,name:`model_name`,kind:`scalar`,T:9},{no:13,name:`multiline_config`,kind:`message`,T:bp}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Sp=class e extends z{state;completionItems=[];constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.GetCompletionsResponse`;static fields=U.util.newFieldList(()=>[{no:1,name:`state`,kind:`message`,T:Ap},{no:2,name:`completion_items`,kind:`message`,T:Pp,repeated:!0}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Cp=class e extends z{metadata;completionId=``;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.AcceptCompletionRequest`;static fields=U.util.newFieldList(()=>[{no:1,name:`metadata`,kind:`message`,T:$d},{no:2,name:`completion_id`,kind:`scalar`,T:9}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},wp=class e extends z{constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.AcceptCompletionResponse`;static fields=U.util.newFieldList(()=>[]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Tp=class e extends z{constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.GetAuthTokenRequest`;static fields=U.util.newFieldList(()=>[]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Ep=class e extends z{authToken=``;uuid=``;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.GetAuthTokenResponse`;static fields=U.util.newFieldList(()=>[{no:1,name:`auth_token`,kind:`scalar`,T:9},{no:2,name:`uuid`,kind:`scalar`,T:9}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Dp=class e extends z{row=B.zero;col=B.zero;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.DocumentPosition`;static fields=U.util.newFieldList(()=>[{no:1,name:`row`,kind:`scalar`,T:4},{no:2,name:`col`,kind:`scalar`,T:4}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Op=class e extends z{absolutePath=``;relativePath=``;text=``;editorLanguage=``;language=Zd.UNSPECIFIED;cursorOffset=B.zero;cursorPosition;lineEnding=``;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.Document`;static fields=U.util.newFieldList(()=>[{no:1,name:`absolute_path`,kind:`scalar`,T:9},{no:2,name:`relative_path`,kind:`scalar`,T:9},{no:3,name:`text`,kind:`scalar`,T:9},{no:4,name:`editor_language`,kind:`scalar`,T:9},{no:5,name:`language`,kind:`enum`,T:U.getEnumType(Zd)},{no:6,name:`cursor_offset`,kind:`scalar`,T:4},{no:8,name:`cursor_position`,kind:`message`,T:Dp},{no:7,name:`line_ending`,kind:`scalar`,T:9}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},kp=class e extends z{forceEnableExperiments=[];constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.ExperimentConfig`;static fields=U.util.newFieldList(()=>[{no:1,name:`force_enable_experiments`,kind:`enum`,T:U.getEnumType(qd),repeated:!0}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Ap=class e extends z{state=_p.UNSPECIFIED;message=``;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.State`;static fields=U.util.newFieldList(()=>[{no:1,name:`state`,kind:`enum`,T:U.getEnumType(_p)},{no:2,name:`message`,kind:`scalar`,T:9}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},jp=class e extends z{startOffset=B.zero;endOffset=B.zero;startPosition;endPosition;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.Range`;static fields=U.util.newFieldList(()=>[{no:1,name:`start_offset`,kind:`scalar`,T:4},{no:2,name:`end_offset`,kind:`scalar`,T:4},{no:3,name:`start_position`,kind:`message`,T:Dp},{no:4,name:`end_position`,kind:`message`,T:Dp}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Mp=class e extends z{text=``;deltaCursorOffset=B.zero;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.Suffix`;static fields=U.util.newFieldList(()=>[{no:1,name:`text`,kind:`scalar`,T:9},{no:2,name:`delta_cursor_offset`,kind:`scalar`,T:3}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Np=class e extends z{text=``;offset=B.zero;type=yp.UNSPECIFIED;prefix=``;line=B.zero;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.CompletionPart`;static fields=U.util.newFieldList(()=>[{no:1,name:`text`,kind:`scalar`,T:9},{no:2,name:`offset`,kind:`scalar`,T:4},{no:3,name:`type`,kind:`enum`,T:U.getEnumType(yp)},{no:4,name:`prefix`,kind:`scalar`,T:9},{no:5,name:`line`,kind:`scalar`,T:4}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Pp=class e extends z{completion;suffix;range;source=Xd.UNSPECIFIED;completionParts=[];constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.CompletionItem`;static fields=U.util.newFieldList(()=>[{no:1,name:`completion`,kind:`message`,T:Qd},{no:5,name:`suffix`,kind:`message`,T:Mp},{no:2,name:`range`,kind:`message`,T:jp},{no:3,name:`source`,kind:`enum`,T:U.getEnumType(Xd)},{no:8,name:`completion_parts`,kind:`message`,T:Np,repeated:!0}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Fp={typeName:`exa.language_server_pb.LanguageServerService`,methods:{getCompletions:{name:`GetCompletions`,I:xp,O:Sp,kind:Gd.Unary},acceptCompletion:{name:`AcceptCompletion`,I:Cp,O:wp,kind:Gd.Unary},getAuthToken:{name:`GetAuthToken`,I:Tp,O:Ep,kind:Gd.Unary}}};function Ip(){try{new Headers}catch{throw Error(`connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.`)}}var Lp=function(e){return this instanceof Lp?(this.v=e,this):new Lp(e)},Rp=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof Lp?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}};function zp(e){Ip();let t=e.useBinaryFormat??!1;return{async unary(n,r,i,a,o,s,c){let{serialize:l,parse:u}=Uf(r,t,e.jsonOptions,e.binaryOptions);return a=a===void 0?e.defaultTimeoutMs:a<=0?void 0:a,await mp({interceptors:e.interceptors,signal:i,timeoutMs:a,req:{stream:!1,service:n,method:r,url:Rf(e.baseUrl,n,r),init:{method:`POST`,credentials:e.credentials??`same-origin`,redirect:`error`,mode:`cors`},header:lp(r.kind,t,a,o,!1),contextValues:c??Lf(),message:s},next:async i=>{let a=e.useHttpGet===!0&&r.idempotency===Kd.NoSideEffects,o=null;a?i=pp(i,l(i.message),t):o=l(i.message);let s=await(e.fetch??globalThis.fetch)(i.url,Object.assign(Object.assign({},i.init),{headers:i.header,signal:i.signal,body:o})),{isUnaryError:c,unaryError:d}=up(r.kind,t,s.status,s.headers);if(c)throw Qf(await s.json(),mf(...cp(s.headers)),d);let[f,p]=cp(s.headers);return{stream:!1,service:n,method:r,header:f,message:t?u(new Uint8Array(await s.arrayBuffer())):r.O.fromJson(await s.json(),Hf(e.jsonOptions)),trailer:p}}})},async stream(n,r,i,a,o,s,c){let{serialize:l,parse:u}=Uf(r,t,e.jsonOptions,e.binaryOptions);function d(e,t,n,r){return Rp(this,arguments,function*(){let i=gf(e).getReader(),a=!1;for(;;){let e=yield Lp(i.read());if(e.done)break;let{flags:r,data:o}=e.value;if((r&1)==1)throw new ff(`protocol error: received unsupported compressed output`,W.Internal);if((r&2)==2){a=!0;let e=$f(o);if(e.error){let t=e.error;throw n.forEach((e,n)=>{t.metadata.append(n,e)}),t}e.metadata.forEach((e,n)=>t.set(n,e));continue}yield yield Lp(u(o))}if(`throwIfAborted`in r&&r.throwIfAborted(),!a)throw`missing EndStreamResponse`})}async function f(e){if(r.kind!=Gd.ServerStreaming)throw`The fetch API does not support streaming request bodies`;let t=await e[Symbol.asyncIterator]().next();if(t.done==1)throw`missing request message`;return _f(0,l(t.value))}return a=a===void 0?e.defaultTimeoutMs:a<=0?void 0:a,await hp({interceptors:e.interceptors,timeoutMs:a,signal:i,req:{stream:!0,service:n,method:r,url:Rf(e.baseUrl,n,r),init:{method:`POST`,credentials:e.credentials??`same-origin`,redirect:`error`,mode:`cors`},header:lp(r.kind,t,a,o,!1),contextValues:c??Lf(),message:s},next:async n=>{let i=await(e.fetch??globalThis.fetch)(n.url,Object.assign(Object.assign({},n.init),{headers:n.header,signal:n.signal,body:await f(n.message)}));if(up(r.kind,t,i.status,i.headers),i.body===null)throw`missing response body`;let a=new Headers;return Object.assign(Object.assign({},n),{header:i.headers,trailer:a,message:d(i.body,a,i.headers,n.signal)})}})}}}var Bp=Of(Fp,zp({baseUrl:`https://web-backend.codeium.com`,useBinaryFormat:!0})),Vp;try{Vp=crypto.randomUUID()}catch{function e(){return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(+e^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>e/4).toString(16))}Vp=e()}async function Hp({text:e,cursorOffset:t,config:n,otherDocuments:r}){return await Bp.getCompletions({metadata:{ideName:`web`,ideVersion:`0.0.5`,extensionName:`@valtown/codemirror-codeium`,extensionVersion:`1.0.0`,apiKey:n.apiKey,sessionId:Vp,authSource:n.authSource},document:{text:e,cursorOffset:BigInt(t),language:n.language,editorLanguage:`typescript`,lineEnding:`
12
- `},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:r,multilineConfig:void 0},{headers:{Authorization:`Basic ${n.apiKey}-${Vp}`}})}function Up(e){return e.completionItems.map(e=>{let t=0;return e.completionParts.filter(e=>e.type!==3).map(e=>{let n=Number(e.offset),r=e.type===2?`\n${e.text}`:e.text,i={absoluteStartPos:t+n,absoluteEndPos:t+n+r.length,from:n,to:n,insert:r};return t+=r.length,i})})}async function Wp(e,t){let n=e.state.facet(nf),{override:r}=e.state.facet(rf),i=await r(),a=e.state,o=a.selection.main.head,s=a.doc.toString();try{let r=await Hp({text:s,cursorOffset:o,config:n,otherDocuments:i});if(!r||r.completionItems.length===0||!((t===void 0||o===t)&&Ri(e.state)!==`active`&&e.hasFocus))return;let c=Up(r),l=c.at(0);if(!l)return;let u=Pr.of(l,a.doc.length),d=u.invert(a.doc);e.dispatch({changes:u,effects:Ql.of({index:0,reverseChangeSet:d,changeSpecs:c}),annotations:[cf.of(null),sf.of(null),li.addToHistory.of(!1)]})}catch(e){console.warn(`copilot completion failed`,e),await new Promise(e=>setTimeout(e,300))}}function Gp(e){return e.docChanged&&!e.transactions.some(e=>e.effects.some(e=>e.is($l)||e.is(eu)))}function Kp(e){if(!e.view.hasFocus||e.state.field(of)||Ri(e.state)===`active`)return!0;for(let t of e.transactions)if(t.annotation(sf)!==void 0)return!0}function qp(){let e=null,t=0;return N.updateListener.of(n=>{let r=n.view.state.facet(nf);if(!r.alwaysOn||!Gp(n)||(e&&clearTimeout(e),Kp(n)))return;let i=n.state.selection.main.head;r.shouldComplete&&!r.shouldComplete(new Vi(n.view.state,i,!1))||(e=setTimeout(async()=>{i===t&&await Wp(n.view,t)},r.timeout),t=i)})}function Jp(e){let t=e.state.field(of);if(!t)return!1;let n=t.reverseChangeSet?.invert(e.state.doc);e.dispatch({changes:t.reverseChangeSet,effects:$l.of(null),annotations:[cf.of(null),sf.of(null),li.addToHistory.of(!1)]});let r=0;return n?.iterChangedRanges((e,t,n,i)=>{r=i}),e.dispatch({changes:n,selection:ti.cursor(r),annotations:[sf.of(null),li.addToHistory.of(!0)]}),!0}var Yp=e=>{let{state:t}=e,n=t.field(of);if(!n)return!1;let{changeSpecs:r}=n;if(r.length<2)return!1;let i=(n.index+1)%r.length,a=r.at(i);if(!a)return!1;let o=n.reverseChangeSet.apply(t.doc),s=Pr.of(n.reverseChangeSet,t.doc.length).compose(Pr.of(a,o.length)),c=Pr.of(a,o.length).invert(o);return e.dispatch({changes:s,effects:Ql.of({index:i,reverseChangeSet:c,changeSpecs:r}),annotations:[cf.of(null),sf.of(null),li.addToHistory.of(!1)]}),!0};function Xp(e){let t=e.state.field(of);return t&&e.dispatch({changes:t.reverseChangeSet,effects:eu.of(null),annotations:[cf.of(null),sf.of(null),li.addToHistory.of(!1)]}),!1}function Zp(e,t){return e.state.field(of)?t===`Tab`?Jp(e):Xp(e):!1}function Qp(e){let t=!1,n=e.state.selection.asSingle().ranges.at(0)?.head,r=e.state.field(of);return n!==void 0&&r?(r.decorations?.between(n,n,()=>{t=!0}),t):!1}function $p(){return N.domEventHandlers({keydown(e,t){return e.key===`]`&&e.ctrlKey?!1:e.key!==`Shift`&&e.key!==`Control`&&e.key!==`Alt`&&e.key!==`Meta`&&Zp(t,e.key)},mouseup(e,t){let n=e.target;return n.nodeName===`BUTTON`&&n.dataset.action===`codeium-cycle`?(Yp(t),e.stopPropagation(),e.preventDefault(),!0):Qp(t)?Jp(t):Xp(t)}})}function em(){return ei.of([{key:`Ctrl-]`,run:Yp}])}function tm(){return N.updateListener.of(e=>{e.focusChanged&&Xp(e.view)})}function nm(e){return[nf.of(e),of,hi.highest(em()),hi.highest(tm()),hi.high($p()),qp()]}function rm({response:e,prefix:t,suffix:n}){if(!e)return e;let r=e;return t&&r.startsWith(t)&&(r=r.slice(t.length)),n&&r.endsWith(n)&&(r=r.slice(0,-n.length)),r}var im=new Hr,am=rn.get(`@github/copilot-language-server`),om={delay:300,includeKeymap:!0,events:{shouldShowSuggestion:e=>e.hasFocus,beforeSuggestionFetch:e=>e.hasFocus}},sm=e=>{let t=[];return e.copilot===`codeium`&&e.codeium_api_key&&t.push(nm({apiKey:e.codeium_api_key,language:Zd.PYTHON}),rf.of({override:async()=>[{text:me(``),language:Zd.PYTHON,editorLanguage:`python`}]})),e.copilot===`github`&&t.push(Ac({...om,fetchFn:async(e,t,n)=>{let r=e.selection.main.head;if(!qt()||!n.hasFocus||e.doc.length===0)return``;await new Promise(e=>setTimeout(e,20));let i=e.doc.toString(),a=cm(e,me(i)),o=await en().getCompletion(a);return r===n.state.selection.main.head?lm(o,a.position,e):(rn.debug(`ignoring response because of new position`),``)}})),e.copilot===`custom`&&t.push(Ac({...om,fetchFn:async(e,t,n)=>{let r=e.selection.main.head;if(e.doc.length===0||!n.hasFocus)return``;let i=e.doc.sliceString(0,e.selection.main.head),a=e.doc.sliceString(e.selection.main.head,e.doc.length);if(i.length===0)return``;let o=e.field(Ue).type,s=await Ea.post(`/ai/inline_completion`,{prefix:i,suffix:a,language:o});return r===n.state.selection.main.head?(s=rm({response:s,prefix:i,suffix:a}),s):(rn.debug(`ignoring response because of new position`),``)}})),[...t,hi.highest(ei.of([{key:`Escape`,run:e=>{let t=Dc(e);return!v(e)&&t}}])),im.of(Jt())]};function cm(e,t){let n=e.doc.toString(),r=t.split(`
10
+ `.trim(),n=xn();await hn();let r=await fetch(n.getAiURL(`completion`).toString(),{method:`POST`,headers:n.headers(),body:JSON.stringify({prompt:e.prompt,code:t,selectedText:e.selection,includeOtherCode:``,language:e.language})}),i=e.selection.match(/^\s*/)?.[0]||``,a=await al(r);return a.startsWith(i)||(a=i+a),a}function sl(e){switch(e){case`table`:case`connection`:fe(`variables`),Qc(Xc,`datasources`);return;case`bucket`:fe(`files`),Qc(Zc,`remote-storage`);return;case`cache`:fe(`cache`);return;default:Ui(e)}}function cl(e){let{state:t,names:n}=e;if(n.size===0)return[];let r=Hr(t);if(!r||w(r))return[];let i=new Map,a=e=>{if(e.name===A.VariableName){let r=t.doc.sliceString(e.from,e.to);n.has(r)&&!i.has(r)&&i.set(r,{from:e.from,to:e.to,name:r});return}if(e.name===A.TupleExpression||e.name===A.ArrayExpression||e.name===A.ParenthesizedExpression)for(let t=e.firstChild;t;t=t.nextSibling)a(t)},o=e=>{let t=-1;for(let n=e.firstChild;n;n=n.nextSibling)n.name===A.AssignOp&&(t=n.from);if(t!==-1)for(let n=e.firstChild;n&&n.from<t;n=n.nextSibling)a(n)},s=e=>{if(!p.has(e.name)){if(e.name===A.AssignStatement){o(e);return}for(let t=e.firstChild;t;t=t.nextSibling)s(t)}};return s(r.topNode),[...i.values()]}var ll=/\bmo\.(?:persistent_cache|cache)\b/g;function ul(e){let t=e.match(/^[A-Za-z]*("""|'''|"|')([\s\S]*)\1$/);return t?t[2]:e}function dl(e,t){if(!e)return null;let n=e=>e?.name===`,`||e?.name===`)`,r=null;for(let i=e.firstChild;i;i=i.nextSibling)if(i.name!==`(`&&i.name!==`)`&&i.name!==`,`&&(r??=i,i.name===A.VariableName&&t(i)===`name`&&i.nextSibling?.name===A.AssignOp)){let e=i.nextSibling.nextSibling;if(e?.name===A.String&&n(e.nextSibling))return ul(t(e))}return r&&r.name===A.String&&n(r.nextSibling)?ul(t(r)):null}function fl(e,t,n,r){let i=t=>e.doc.sliceString(t.from,t.to),a=t.resolveInner(n,1),o=null,s=null,c=r,l=null;for(let e=a.parent;e&&e.from===n;e=e.parent)if(e.name===A.CallExpression){l=e;break}if(l){c=l.to,s=l.getChild(A.ArgList);let e=l.parent;if(e?.name===A.AssignStatement){let t=e.getChild(A.VariableName);o=t&&t.from<l.from?i(t):null}else if(e?.name===A.WithStatement){let t=e.firstChild;for(;t;){if(t.from<l.to||t.name===k.As){t=t.nextSibling;continue}t.name===A.VariableName&&(o=i(t));break}}}else if(a.parent?.name===A.Decorator){let e=a.parent,t=e.getChild(A.ArgList);t?.from===r&&(s=t,c=t.to);let n=(e.parent?.getChild(A.FunctionDefinition))?.getChild(A.VariableName);o=n?i(n):null}let u=dl(s,i);return{from:n,to:c,boundName:o,cacheName:u}}function pl(e,t,n){let r=t.resolveInner(n,1);return!te.has(r.name)&&r.name===A.VariableName&&e.doc.sliceString(r.from,r.to)===`mo`}function ml(e){let t=Hr(e);return!t||w(t)?[]:[...e.doc.toString().matchAll(ll)].filter(n=>pl(e,t,n.index??0)).map(n=>{let r=n.index??0;return fl(e,t,r,r+n[0].length)})}function hl(e,t,n){let r=e.get(t);r!==void 0&&r!==n&&rn.error(`[code-lens] "${t}" is claimed by both a ${r} and a ${n} entity; keeping ${n}`),e.set(t,n)}var gl=r(e=>{let t=new Map;for(let n of e(O))n.variable_name&&hl(t,n.variable_name,`table`);for(let n of e(E).keys())ie.has(n)||hl(t,n,`connection`);for(let n of e(Te))hl(t,n.name,`bucket`);return t}),_l=r(e=>{let t=e(gl),n=e(ut),r=new Map,i=new Map;for(let[e,a]of t){let t=n[e];if(t==null){i.set(e,a);continue}for(let n of t.declaredBy){let t=r.get(n);t||(t=new Map,r.set(n,t)),t.set(e,a)}}return{byCell:r,pending:i}});function vl(e){let{byCell:t,pending:n}=o.get(_l),r=new Map(t.get(e));for(let[e,t]of n)r.has(e)||r.set(e,t);return r}var yl=e=>`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${e}</svg>`,bl={table:yl(`<path d="M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18"/>`),connection:yl(`<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/>`),bucket:yl(`<line x1="22" x2="2" y1="12" y2="12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/><line x1="6" x2="6.01" y1="16" y2="16"/><line x1="10" x2="10.01" y1="16" y2="16"/>`),cache:yl(`<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 15 21.84"/><path d="M21 5V8"/><path d="M21 12L18 17H22L19 22"/><path d="M3 12A9 3 0 0 0 14.59 14.87"/>`)},xl={table:`Open in data sources`,connection:`Open in data sources`,bucket:`Open in remote storage`,cache:`Open cache panel`};function Sl(e,t){let n=(0,co.createRoot)(e);return(0,so.flushSync)(()=>{n.render((0,L.jsx)(s,{store:o,children:(0,L.jsx)(Cl,{spec:t})}))}),()=>queueMicrotask(()=>n.unmount())}var Cl=e=>{let t=(0,I.c)(9),{spec:n}=e;switch(n.kind){case`table`:{let e;return t[0]===n.name?e=t[1]:(e=(0,L.jsx)(wl,{name:n.name}),t[0]=n.name,t[1]=e),e}case`connection`:{let e;return t[2]===n.name?e=t[3]:(e=(0,L.jsx)(Tl,{name:n.name}),t[2]=n.name,t[3]=e),e}case`bucket`:{let e;return t[4]===n.name?e=t[5]:(e=(0,L.jsx)(El,{name:n.name}),t[4]=n.name,t[5]=e),e}case`cache`:{let e=n.cache?.boundName??null,r=n.cache?.cacheName??null,i;return t[6]!==e||t[7]!==r?(i=(0,L.jsx)(jl,{boundName:e,cacheName:r}),t[6]=e,t[7]=r,t[8]=i):i=t[8],i}default:Ui(n.kind)}},wl=e=>{let t=(0,I.c)(5),{name:n}=e,r=i(O),a;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>e.variable_name===n,t[3]=n,t[4]=e);let i=r.find(e);a=i?xt(i):g(`table`),t[0]=n,t[1]=r,t[2]=a}else a=t[2];return a},Tl=e=>{let t=(0,I.c)(5),{name:n}=e,r=i(E),a,o;if(t[0]!==r||t[1]!==n){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=r.get(n);if(!e){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=g(`database`),t[4]=e):e=t[4],o=e;break bb0}a=oe(e)}t[0]=r,t[1]=n,t[2]=a,t[3]=o}else a=t[2],o=t[3];return o===Symbol.for(`react.early_return_sentinel`)?a:o},El=e=>{let t=(0,I.c)(27),{name:n}=e,r=i(Te),a;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>e.name===n,t[3]=n,t[4]=e),a=r.find(e),t[0]=n,t[1]=r,t[2]=a}else a=t[2];let o=a;if(!o){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`div`,{className:Tt,children:(0,L.jsx)(`span`,{className:`text-xs text-(--slate-11)`,children:`No storage information available.`})}),t[5]=e):e=t[5],e}let s;t[6]===o.protocol?s=t[7]:(s=(0,L.jsx)(Yc,{protocol:o.protocol,className:`w-4 h-4`}),t[6]=o.protocol,t[7]=s);let c;t[8]===o.protocol?c=t[9]:(c=(0,L.jsx)(Ki,{variant:`outline`,className:`text-xs`,children:o.protocol}),t[8]=o.protocol,t[9]=c);let l;t[10]!==o.displayName||t[11]!==s||t[12]!==c?(l=(0,L.jsx)(Ct,{icon:s,title:o.displayName,badge:c}),t[10]=o.displayName,t[11]=s,t[12]=c,t[13]=l):l=t[13];let u;t[14]===o.name?u=t[15]:(u=(0,L.jsx)(we,{label:`Variable`,value:(0,L.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:o.name})}),t[14]=o.name,t[15]=u);let d=o.rootPath||`(root)`,f;t[16]===d?f=t[17]:(f=(0,L.jsx)(we,{label:`Root`,value:(0,L.jsx)(`code`,{className:`text-xs bg-(--slate-4) px-1 rounded`,children:d})}),t[16]=d,t[17]=f);let p;t[18]===o.backendType?p=t[19]:(p=(0,L.jsx)(we,{label:`Backend`,value:(0,L.jsx)(`span`,{className:`font-medium`,children:o.backendType})}),t[18]=o.backendType,t[19]=p);let m;t[20]!==u||t[21]!==f||t[22]!==p?(m=(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[u,f,p]}),t[20]=u,t[21]=f,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==l||t[25]!==m?(h=(0,L.jsxs)(`div`,{className:Tt,children:[l,m]}),t[24]=l,t[25]=m,t[26]=h):h=t[26],h},Dl=/\bhits=(\d+) misses=(\d+)/,Ol=null,kl=5e3;function Al(){let e=Date.now();Ol!=null&&e-Ol<kl||(Ol=e,Gi().getCacheInfo().catch(()=>{Ol=null}))}var jl=e=>{let t=(0,I.c)(16),{boundName:n,cacheName:r}=e,{locale:a}=Xi(),o=i(ut),s=i(Pn),c=n?o[n]:void 0,l;t[0]===c?l=t[1]:(l=c?.dataType?.startsWith(`_cache_call`)?c.value?.match(Dl):void 0,t[0]=c,t[1]=l);let u=l,d=!!u,f,p;t[2]===d?(f=t[3],p=t[4]):(f=()=>{d||Al()},p=[d],t[2]=d,t[3]=f,t[4]=p),(0,F.useEffect)(f,p);let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,L.jsx)(ur,{className:`w-4 h-4 text-(--amber-9)`}),t[5]=m):m=t[5];let h=r??n??`Cache`,g;t[6]===h?g=t[7]:(g=(0,L.jsx)(Ct,{icon:m,title:h}),t[6]=h,t[7]=g);let _;t[8]!==s||t[9]!==a||t[10]!==u?(_=u?(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,L.jsx)(we,{label:`Hits`,value:(0,L.jsx)(`span`,{className:`font-medium`,children:Zi(Number(u[1]),a)})}),(0,L.jsx)(we,{label:`Misses`,value:(0,L.jsx)(`span`,{className:`font-medium`,children:Zi(Number(u[2]),a)})})]}):s&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 py-2`,children:[(0,L.jsx)(`span`,{className:`text-xs font-medium text-(--slate-11)`,children:`Notebook-wide`}),(0,L.jsx)(we,{label:`Hits`,value:Zi(s.hits,a)}),(0,L.jsx)(we,{label:`Misses`,value:Zi(s.misses,a)}),(0,L.jsx)(we,{label:`Time saved`,value:Gc(s.time,a)})]}),t[8]=s,t[9]=a,t[10]=u,t[11]=_):_=t[11];let v;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,L.jsx)(`div`,{className:`pt-2 text-xs text-(--slate-10)`,children:`Click to open the cache panel`}),t[12]=v):v=t[12];let y;return t[13]!==g||t[14]!==_?(y=(0,L.jsxs)(`div`,{className:Tt,children:[g,_,v]}),t[13]=g,t[14]=_,t[15]=y):y=t[15],y},Ml=j.define(),Nl=j.define();function Pl(e,t){return e.pos===t.pos&&e.kind===t.kind&&e.name===t.name&&e.cache?.boundName===t.cache?.boundName&&e.cache?.cacheName===t.cache?.cacheName}var Fl=class{view;showTimer;hideTimer;constructor(e){this.view=e}enterLens(e,t){this.clearTimers(),Ll(this.view,t);let n=this.view.state.field(Bl,!1);n&&Pl(n.spec,e)||(this.showTimer=window.setTimeout(()=>{this.showTimer=void 0,this.view.dispatch({effects:Nl.of(e)})},400))}leave(){this.clearTimers(),this.hideTimer=window.setTimeout(()=>{this.hideTimer=void 0,this.hide()},200)}enterPopover(){window.clearTimeout(this.hideTimer),this.hideTimer=void 0}hide(){this.clearTimers(),this.view.state.field(Bl,!1)&&this.view.dispatch({effects:Nl.of(null)})}destroy(){this.clearTimers()}clearTimers(){window.clearTimeout(this.showTimer),window.clearTimeout(this.hideTimer),this.showTimer=void 0,this.hideTimer=void 0}},Il=vi.define(e=>new Fl(e));function Ll(e,t){e.dom.dispatchEvent(new MouseEvent(`mouseleave`,{relatedTarget:t}))}var Rl=class extends li{spec;constructor(e){super(),this.spec=e}eq(e){return Pl(this.spec,e.spec)}toDOM(e){let{spec:t}=this,n=document.createElement(`span`);n.className=`mo-code-lens`,n.setAttribute(`role`,`button`),n.tabIndex=0,n.setAttribute(`aria-label`,xl[t.kind]),n.innerHTML=bl[t.kind];let r=()=>e.plugin(Il),i=()=>r()?.hide();return n.onmouseenter=()=>r()?.enterLens(t,n),n.onmouseleave=()=>r()?.leave(),n.onmousemove=e=>{e.stopPropagation()},n.onmousedown=e=>{e.preventDefault(),e.stopPropagation()},n.onclick=e=>{e.preventDefault(),e.stopPropagation(),i(),sl(t.kind)},n.onkeydown=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),i(),sl(t.kind))},n}ignoreEvent(){return!0}};function zl(e){return{spec:e,tooltip:{pos:e.pos,above:!0,create:t=>{let n=document.createElement(`div`);return n.classList.add(`mo-cm-tooltip`,`docs-documentation`),n.onmouseenter=()=>t.plugin(Il)?.enterPopover(),n.onmouseleave=()=>t.plugin(Il)?.leave(),{dom:n,resize:!1,destroy:Sl(n,e)}}}}}var Bl=Qr.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(Nl))return n.value?zl(n.value):null;if(n.is(Ml)&&e)return n.value.some(t=>Pl(t,e.spec))?e:null}return t.docChanged?null:e},provide:e=>Zr.from(e,e=>e?.tooltip??null)}),Vl=Qr.define({create(){return M.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)n.is(Ml)&&(e=M.set(n.value.map(e=>M.widget({widget:new Rl(e),side:1}).range(e.pos)),!0));return e},provide:e=>N.decorations.from(e)}),Hl=class{view;cellId;includeCache;unsubscribes;debounceMs=300;scheduleUpdate;constructor(e,t,n){this.view=e,this.cellId=t,this.includeCache=n,this.scheduleUpdate=Lt(()=>this.run(),this.debounceMs);let r=()=>this.scheduleUpdate();this.unsubscribes=[o.sub(O,r),o.sub(E,r),o.sub(Te,r),o.sub(ut,r)],this.scheduleUpdate()}update(e){let t=e.startState.field(Ue,!1)?.type!==e.state.field(Ue,!1)?.type;(e.docChanged||t)&&this.scheduleUpdate()}destroy(){this.scheduleUpdate.cancel();for(let e of this.unsubscribes)e()}run(){let{state:e}=this.view,t=[],n=e.field(Ue,!1)?.type;if(n==null||n===`python`){let n=vl(this.cellId),r=cl({state:e,names:new Set(n.keys())});for(let e of r){let r=n.get(e.name);r&&t.push({pos:e.to,kind:r,name:e.name})}if(this.includeCache)for(let n of ml(e))t.push({pos:n.to,kind:`cache`,name:`cache:${n.from}`,cache:{boundName:n.boundName,cacheName:n.cacheName}})}queueMicrotask(()=>{this.view.dispatch({effects:Ml.of(t)})})}},Ul=`3px`,Wl=N.baseTheme({".mo-code-lens":{display:`inline-flex`,verticalAlign:`baseline`,transform:`translateY(1.5px)`,padding:Ul,margin:`-${Ul} 0 -${Ul} calc(0.3em - ${Ul})`,cursor:`pointer`,opacity:`0.5`},".mo-code-lens:hover":{opacity:`1`}});function Gl(e,t=!0){return t?[Vl,Bl,Il,vi.define(t=>new Hl(t,e,ye(`cache_panel`))),Wl]:[]}var Kl=[`%alias`,`%cd`,`%clear`,`%debug`,`%env`,`%load`,`%load_ext`,`%lsmagic`,`%matplotlib`,`%pwd`,`%who_ls`,`%system`,`%%time`,`%%timeit`,`%%writefile`,`%%capture`,`%%html`,`%%latex`],ql;function Jl(){let e=async e=>{let t=o.get(Rt),{saveUserConfig:n}=Gi();await n({config:{runtime:{auto_reload:e}}}).then(()=>o.set(Rt,{...t,runtime:{...t.runtime,auto_reload:e}}))},t=[{match:`!pip install`,onMatch:()=>{o.set(ce,e=>({...e,isSidebarOpen:!0,selectedPanel:`packages`})),pa()},title:`Package Installation`,description:(0,L.jsxs)(L.Fragment,{children:[`The package manager sidebar has been opened.`,(0,L.jsx)(`br`,{}),`Install packages directly from there instead.`]})},{match:`!uv pip install`,onMatch:()=>{o.set(ce,e=>({...e,isSidebarOpen:!0,selectedPanel:`packages`})),pa()},title:`Package Installation`,description:(0,L.jsxs)(L.Fragment,{children:[`The package manager sidebar has been opened.`,(0,L.jsx)(`br`,{}),`Install packages directly from there instead.`]})},{match:`!uv add`,onMatch:()=>{o.set(ce,e=>({...e,isSidebarOpen:!0,selectedPanel:`packages`})),pa()},title:`Package Installation`,description:(0,L.jsxs)(L.Fragment,{children:[`The package manager sidebar has been opened.`,(0,L.jsx)(`br`,{}),`Install packages directly from there instead.`]})},{match:`%autoreload 2`,onMatch:async()=>{await e(`autorun`)},title:`Module reload`,description:(0,L.jsxs)(L.Fragment,{children:[`Module reload mode set to `,(0,L.jsx)(`b`,{children:`autorun`}),` - module changes will re-run the cells that import them.`]})},{match:`%autoreload 1`,onMatch:async()=>{await e(`lazy`)},title:`Module reload`,description:(0,L.jsxs)(L.Fragment,{children:[`Module reload mode set to `,(0,L.jsx)(`b`,{children:`lazy`}),` - module changes will mark the cells that import them as stale.`]})},{match:`%autoreload 0`,onMatch:async()=>{await e(`off`)},title:`Module reload`,description:(0,L.jsx)(L.Fragment,{children:`Module reload disabled - module changes will not be detected.`})},{match:`!ls`,onMatch:()=>{},title:`Listing files`,description:(0,L.jsxs)(L.Fragment,{children:[`Shell commands are not directly supported.`,(0,L.jsx)(`br`,{}),`Use `,(0,L.jsx)(`code`,{children:`import subprocess; subprocess.run(['ls'])`}),` instead.`]})},...Kl.map(e=>({match:e,onMatch:()=>{},title:(0,L.jsx)(da,{className:`inline`,children:e}),description:(0,L.jsxs)(L.Fragment,{children:[`Magic commands are not supported in marimo. Read more about replacements in the`,` `,(0,L.jsx)(`a`,{href:`https://docs.marimo.io/guides/coming_from/jupyter/#adapting-to-the-absence-of-magic-commands`,target:`_blank`,className:`text-link underline cursor-pointer`,rel:`noopener noreferrer`,children:`documentation`}),`.`]})}))],n=new Map(t.map(e=>[e.match,e]));return N.updateListener.of(e=>{if(e.docChanged){let t=e.state.selection.main,r=e.state.doc,i=r.lineAt(t.head),a=r.sliceString(i.from,t.anchor).trim(),o=n.get(a);o&&(o.onMatch(),ql?ql.upsert({title:o.title,description:o.description}):ql=Mr({title:o.title,description:o.description}))}})}var Yl=new Set([`Escape`,"Alt-`"]);function Xl(e,t=Yl){return e.filter(e=>![e.key,e.mac,e.linux,e.win].some(e=>t.has(e)))}function Zl(e=!0){let t=new Set(Yl);e||t.add(`Enter`);let n=Xl(Fi,t);return gi.highest(ti.of([...n,{key:`Ctrl-y`,run:e=>v(e)?Bi(e):!1},{key:`Ctrl-n`,run:e=>v(e)?Ii(!0)(e):!1},{key:`Ctrl-p`,run:e=>v(e)?Ii(!1)(e):!1}]))}var Ql=j.define(),$l=j.define(),eu=j.define();function R(e,t){if(!e)throw Error(t)}var tu=34028234663852886e22,nu=-34028234663852886e22,ru=4294967295,iu=2147483647,au=-2147483648;function ou(e){if(typeof e!=`number`)throw Error(`invalid int 32: `+typeof e);if(!Number.isInteger(e)||e>iu||e<au)throw Error(`invalid int 32: `+e)}function su(e){if(typeof e!=`number`)throw Error(`invalid uint 32: `+typeof e);if(!Number.isInteger(e)||e>ru||e<0)throw Error(`invalid uint 32: `+e)}function cu(e){if(typeof e!=`number`)throw Error(`invalid float 32: `+typeof e);if(Number.isFinite(e)&&(e>tu||e<nu))throw Error(`invalid float 32: `+e)}var lu=Symbol(`@bufbuild/protobuf/enum-type`);function uu(e){let t=e[lu];return R(t,`missing enum type on enum object`),t}function du(e,t,n,r){e[lu]=fu(t,n.map(t=>({no:t.no,name:t.name,localName:e[t.no]})),r)}function fu(e,t,n){let r=Object.create(null),i=Object.create(null),a=[];for(let e of t){let t=mu(e);a.push(t),r[e.name]=t,i[e.no]=t}return{typeName:e,values:a,findName(e){return r[e]},findNumber(e){return i[e]}}}function pu(e,t,n){let r={};for(let e of t){let t=mu(e);r[t.localName]=t.no,r[t.no]=t.localName}return du(r,e,t,n),r}function mu(e){return`localName`in e?e:Object.assign(Object.assign({},e),{localName:e.name})}var z=class{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){let n=this.getType().runtime.bin,r=n.makeReadOptions(t);return n.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,t){let n=this.getType(),r=n.runtime.json,i=r.makeReadOptions(t);return r.readMessage(n,e,i,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(e){throw Error(`cannot decode ${this.getType().typeName} from JSON: ${e instanceof Error?e.message:String(e)}`)}return this.fromJson(n,t)}toBinary(e){let t=this.getType().runtime.bin,n=t.makeWriteOptions(e),r=n.writerFactory();return t.writeMessage(this,r,n),r.finish()}toJson(e){let t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){let t=this.toJson(e);return JSON.stringify(t,null,e?.prettySpaces??0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function hu(e,t,n,r){let i=r?.localName??t.substring(t.lastIndexOf(`.`)+1),a={[i]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[i];return Object.setPrototypeOf(a.prototype,new z),Object.assign(a,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary(e,t){return new a().fromBinary(e,t)},fromJson(e,t){return new a().fromJson(e,t)},fromJsonString(e,t){return new a().fromJsonString(e,t)},equals(t,n){return e.util.equals(a,t,n)}}),a}function gu(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(n&15)<<28,t=(n&112)>>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<<n,!(r&128))return this.assertBounds(),[e,t]}throw Error(`invalid varint`)}function _u(e,t,n){for(let r=0;r<28;r+=7){let i=e>>>r,a=!(!(i>>>7)&&t==0),o=(a?i|128:i)&255;if(n.push(o),!a)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),i){for(let e=3;e<31;e+=7){let r=t>>>e,i=!!(r>>>7),a=(i?r|128:r)&255;if(n.push(a),!i)return}n.push(t>>>31&1)}}var vu=4294967296;function yu(e){let t=e[0]===`-`;t&&(e=e.slice(1));let n=1e6,r=0,i=0;function a(t,a){let o=Number(e.slice(t,a));i*=n,r=r*n+o,r>=vu&&(i+=r/vu|0,r%=vu)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?wu(r,i):Cu(r,i)}function bu(e,t){let n=Cu(e,t),r=n.hi&2147483648;r&&(n=wu(n.lo,n.hi));let i=xu(n.lo,n.hi);return r?`-`+i:i}function xu(e,t){if({lo:e,hi:t}=Su(e,t),t<=2097151)return String(vu*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,s=i*2,c=1e7;return a>=c&&(o+=Math.floor(a/c),a%=c),o>=c&&(s+=Math.floor(o/c),o%=c),s.toString()+Tu(o)+Tu(a)}function Su(e,t){return{lo:e>>>0,hi:t>>>0}}function Cu(e,t){return{lo:e|0,hi:t|0}}function wu(e,t){return t=~t,e?e=~e+1:t+=1,Cu(e,t)}var Tu=e=>{let t=String(e);return`0000000`.slice(t.length)+t};function Eu(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}function Du(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}function Ou(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt==`function`&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`&&(typeof process!=`object`||{}.BUF_BIGINT_DISABLE!==`1`)){let t=BigInt(`-9223372036854775808`),n=BigInt(`9223372036854775807`),r=BigInt(`0`),i=BigInt(`18446744073709551615`);return{zero:BigInt(0),supported:!0,parse(e){let r=typeof e==`bigint`?e:BigInt(e);if(r>n||r<t)throw Error(`int64 invalid: ${e}`);return r},uParse(e){let t=typeof e==`bigint`?e:BigInt(e);if(t>i||t<r)throw Error(`uint64 invalid: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)},uDec(t,n){return e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0)}}}let t=e=>R(/^-?[0-9]+$/.test(e),`int64 invalid: ${e}`),n=e=>R(/^[0-9]+$/.test(e),`uint64 invalid: ${e}`);return{zero:`0`,supported:!1,parse(e){return typeof e!=`string`&&(e=e.toString()),t(e),e},uParse(e){return typeof e!=`string`&&(e=e.toString()),n(e),e},enc(e){return typeof e!=`string`&&(e=e.toString()),t(e),yu(e)},uEnc(e){return typeof e!=`string`&&(e=e.toString()),n(e),yu(e)},dec(e,t){return bu(e,t)},uDec(e,t){return xu(e,t)}}}var B=Ou(),V;(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(V||={});var ku;(function(e){e[e.BIGINT=0]=`BIGINT`,e[e.STRING=1]=`STRING`})(ku||={});function Au(e,t,n){if(t===n)return!0;if(e==V.BYTES){if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array)||t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case V.UINT64:case V.FIXED64:case V.INT64:case V.SFIXED64:case V.SINT64:return t==n}return!1}function ju(e,t){switch(e){case V.BOOL:return!1;case V.UINT64:case V.FIXED64:case V.INT64:case V.SFIXED64:case V.SINT64:return t==0?B.zero:`0`;case V.DOUBLE:case V.FLOAT:return 0;case V.BYTES:return new Uint8Array;case V.STRING:return``;default:return 0}}function Mu(e,t){switch(e){case V.BOOL:return t===!1;case V.STRING:return t===``;case V.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return t==0}}var H;(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(H||={});var Nu=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),n=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],n),n+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw Error(`invalid state, fork stack empty`);return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(su(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return ou(e),Eu(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){cu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){su(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){ou(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return ou(e),e=(e<<1^e>>31)>>>0,Eu(e,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=B.enc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),r=B.uEnc(e);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(t)}int64(e){let t=B.enc(e);return _u(t.lo,t.hi,this.buf),this}sint64(e){let t=B.enc(e),n=t.hi>>31;return _u(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=B.uEnc(e);return _u(t.lo,t.hi,this.buf),this}},Pu=class{constructor(e,t){this.varint64=gu,this.uint32=Du,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case H.Varint:for(;this.buf[this.pos++]&128;);break;case H.Bit64:this.pos+=4;case H.Bit32:this.pos+=4;break;case H.LengthDelimited:let n=this.uint32();this.pos+=n;break;case H.StartGroup:for(;;){let[e,n]=this.tag();if(n===H.EndGroup){if(t!==void 0&&e!==t)throw Error(`invalid end group tag`);break}this.skip(n,e)}break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return B.dec(...this.varint64())}uint64(){return B.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(e&1);return e=(e>>>1|(t&1)<<31)^n,t=t>>>1^n,B.dec(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return B.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return B.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};function Fu(e,t,n,r){let i;return{typeName:t,extendee:n,get field(){if(!i){let n=typeof r==`function`?r():r;n.name=t.split(`.`).pop(),n.jsonName=`[${t}]`,i=e.util.newFieldList([n]).list()[0]}return i},runtime:e}}function Iu(e){let t=e.field.localName,n=Object.create(null);return n[t]=Lu(e),[n,()=>n[t]]}function Lu(e){let t=e.field;if(t.repeated)return[];if(t.default!==void 0)return t.default;switch(t.kind){case`enum`:return t.T.values[0].no;case`scalar`:return ju(t.T,t.L);case`message`:let e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case`map`:throw`map fields are not allowed to be extensions`}}function Ru(e,t){if(!t.repeated&&(t.kind==`enum`||t.kind==`scalar`)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(e=>e.no===t.no)}var zu=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),Bu=[];for(let e=0;e<zu.length;e++)Bu[zu[e].charCodeAt(0)]=e;Bu[45]=zu.indexOf(`+`),Bu[95]=zu.indexOf(`/`);var Vu={dec(e){let t=e.length*3/4;e[e.length-2]==`=`?t-=2:e[e.length-1]==`=`&&--t;let n=new Uint8Array(t),r=0,i=0,a,o=0;for(let t=0;t<e.length;t++){if(a=Bu[e.charCodeAt(t)],a===void 0)switch(e[t]){case`=`:i=0;case`
11
+ `:case`\r`:case` `:case` `:continue;default:throw Error(`invalid base64 string.`)}switch(i){case 0:o=a,i=1;break;case 1:n[r++]=o<<2|(a&48)>>4,o=a,i=2;break;case 2:n[r++]=(o&15)<<4|(a&60)>>2,o=a,i=3;break;case 3:n[r++]=(o&3)<<6|a,i=0}}if(i==1)throw Error(`invalid base64 string.`);return n.subarray(0,r)},enc(e){let t=``,n=0,r,i=0;for(let a=0;a<e.length;a++)switch(r=e[a],n){case 0:t+=zu[r>>2],i=(r&3)<<4,n=1;break;case 1:t+=zu[i|r>>4],i=(r&15)<<2,n=2;break;case 2:t+=zu[i|r>>6],t+=zu[r&63],n=0}return n&&(t+=zu[i],t+=`=`,n==1&&(t+=`=`)),t}};function Hu(e,t,n){Gu(t,e);let r=t.runtime.bin.makeReadOptions(n),i=Ru(e.getType().runtime.bin.listUnknownFields(e),t.field),[a,o]=Iu(t);for(let e of i)t.runtime.bin.readField(a,r.readerFactory(e.data),t.field,e.wireType,r);return o()}function Uu(e,t,n,r){Gu(t,e);let i=t.runtime.bin.makeReadOptions(r),a=t.runtime.bin.makeWriteOptions(r);if(Wu(e,t)){let n=e.getType().runtime.bin.listUnknownFields(e).filter(e=>e.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(let t of n)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}let o=a.writerFactory(),s=t.field;!s.opt&&!s.repeated&&(s.kind==`enum`||s.kind==`scalar`)&&(s=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(s,n,o,a);let c=i.readerFactory(o.finish());for(;c.pos<c.len;){let[t,n]=c.tag(),r=c.skip(n,t);e.getType().runtime.bin.onUnknownField(e,t,n,r)}}function Wu(e,t){let n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find(e=>e.no==t.field.no)}function Gu(e,t){R(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}function Ku(e,t){let n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case`enum`:case`scalar`:return e.opt||e.req?t[n]!==void 0:e.kind==`enum`?t[n]!==e.T.values[0].no:!Mu(e.T,t[n]);case`message`:return t[n]!==void 0;case`map`:return Object.keys(t[n]).length>0}}function qu(e,t){let n=e.localName,r=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case`map`:t[n]={};break;case`enum`:t[n]=r?e.T.values[0].no:void 0;break;case`scalar`:t[n]=r?ju(e.T,e.L):void 0;break;case`message`:t[n]=void 0}}function Ju(e,t){if(typeof e!=`object`||!e||!Object.getOwnPropertyNames(z.prototype).every(t=>t in e&&typeof e[t]==`function`))return!1;let n=e.getType();return n===null||typeof n!=`function`||!(`typeName`in n)||typeof n.typeName!=`string`?!1:t===void 0||n.typeName==t.typeName}function Yu(e,t){return Ju(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}V.DOUBLE,V.FLOAT,V.INT64,V.UINT64,V.INT32,V.UINT32,V.BOOL,V.STRING,V.BYTES;var Xu={ignoreUnknownFields:!1},Zu={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function Qu(e){return e?Object.assign(Object.assign({},Xu),e):Xu}function $u(e){return e?Object.assign(Object.assign({},Zu),e):Zu}var ed=Symbol(),td=Symbol();function nd(){return{makeReadOptions:Qu,makeWriteOptions:$u,readMessage(e,t,n,r){if(t==null||Array.isArray(t)||typeof t!=`object`)throw Error(`cannot decode message ${e.typeName} from JSON: ${rd(t)}`);r??=new e;let i=new Map,a=n.typeRegistry;for(let[o,s]of Object.entries(t)){let t=e.fields.findJsonName(o);if(t){if(t.oneof){if(s===null&&t.kind==`scalar`)continue;let n=i.get(t.oneof);if(n!==void 0)throw Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${t.oneof.name}" present: "${n}", "${o}"`);i.set(t.oneof,o)}id(r,s,t,n,e)}else{let t=!1;if(a?.findExtension&&o.startsWith(`[`)&&o.endsWith(`]`)){let i=a.findExtension(o.substring(1,o.length-1));if(i&&i.extendee.typeName==e.typeName){t=!0;let[e,a]=Iu(i);id(e,s,i.field,n,i),Uu(r,i,a(),n)}}if(!t&&!n.ignoreUnknownFields)throw Error(`cannot decode message ${e.typeName} from JSON: key "${o}" is unknown`)}}return r},writeMessage(e,t){let n=e.getType(),r={},i;try{for(i of n.fields.byNumber()){if(!Ku(i,e)){if(i.req)throw`required field not set`;if(!t.emitDefaultValues||!cd(i))continue}let n=i.oneof?e[i.oneof.localName].value:e[i.localName],a=ld(i,n,t);a!==void 0&&(r[t.useProtoFieldName?i.name:i.jsonName]=a)}let a=t.typeRegistry;if(a?.findExtensionFor)for(let i of n.runtime.bin.listUnknownFields(e)){let o=a.findExtensionFor(n.typeName,i.no);if(o&&Wu(e,o)){let n=Hu(e,o,t),i=ld(o.field,n,t);i!==void 0&&(r[o.field.jsonName]=i)}}}catch(e){let t=i?`cannot encode field ${n.typeName}.${i.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,r=e instanceof Error?e.message:String(e);throw Error(t+(r.length>0?`: ${r}`:``))}return r},readScalar(e,t,n){return od(e,t,n??ku.BIGINT,!0)},writeScalar(e,t,n){if(t!==void 0&&(n||Mu(e,t)))return dd(e,t)},debug:rd}}function rd(e){if(e===null)return`null`;switch(typeof e){case`object`:return Array.isArray(e)?`array`:`object`;case`string`:return e.length>100?`string`:`"${e.split(`"`).join(`\\"`)}"`;default:return String(e)}}function id(e,t,n,r,i){let a=n.localName;if(n.repeated){if(R(n.kind!=`map`),t===null)return;if(!Array.isArray(t))throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${rd(t)}`);let o=e[a];for(let e of t){if(e===null)throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${rd(e)}`);switch(n.kind){case`message`:o.push(n.T.fromJson(e,r));break;case`enum`:let t=sd(n.T,e,r.ignoreUnknownFields,!0);t!==td&&o.push(t);break;case`scalar`:try{o.push(od(n.T,e,n.L,!0))}catch(t){let r=`cannot decode field ${i.typeName}.${n.name} from JSON: ${rd(e)}`;throw t instanceof Error&&t.message.length>0&&(r+=`: ${t.message}`),Error(r)}}}}else if(n.kind==`map`){if(t===null)return;if(typeof t!=`object`||Array.isArray(t))throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${rd(t)}`);let o=e[a];for(let[e,a]of Object.entries(t)){if(a===null)throw Error(`cannot decode field ${i.typeName}.${n.name} from JSON: map value null`);let s;try{s=ad(n.K,e)}catch(e){let r=`cannot decode map key for field ${i.typeName}.${n.name} from JSON: ${rd(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}switch(n.V.kind){case`message`:o[s]=n.V.T.fromJson(a,r);break;case`enum`:let e=sd(n.V.T,a,r.ignoreUnknownFields,!0);e!==td&&(o[s]=e);break;case`scalar`:try{o[s]=od(n.V.T,a,ku.BIGINT,!0)}catch(e){let r=`cannot decode map value for field ${i.typeName}.${n.name} from JSON: ${rd(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a=`value`),n.kind){case`message`:let o=n.T;if(t===null&&o.typeName!=`google.protobuf.Value`)return;let s=e[a];Ju(s)?s.fromJson(t,r):(e[a]=s=o.fromJson(t,r),o.fieldWrapper&&!n.oneof&&(e[a]=o.fieldWrapper.unwrapField(s)));break;case`enum`:let c=sd(n.T,t,r.ignoreUnknownFields,!1);switch(c){case ed:qu(n,e);break;case td:break;default:e[a]=c}break;case`scalar`:try{let r=od(n.T,t,n.L,!1);switch(r){case ed:qu(n,e);break;default:e[a]=r}}catch(e){let r=`cannot decode field ${i.typeName}.${n.name} from JSON: ${rd(t)}`;throw e instanceof Error&&e.message.length>0&&(r+=`: ${e.message}`),Error(r)}}}function ad(e,t){if(e===V.BOOL)switch(t){case`true`:t=!0;break;case`false`:t=!1}return od(e,t,ku.BIGINT,!0).toString()}function od(e,t,n,r){if(t===null)return r?ju(e,n):ed;switch(e){case V.DOUBLE:case V.FLOAT:if(t===`NaN`)return NaN;if(t===`Infinity`)return 1/0;if(t===`-Infinity`)return-1/0;if(t===``||typeof t==`string`&&t.trim().length!==t.length||typeof t!=`string`&&typeof t!=`number`)break;let r=Number(t);if(Number.isNaN(r)||!Number.isFinite(r))break;return e==V.FLOAT&&cu(r),r;case V.INT32:case V.FIXED32:case V.SFIXED32:case V.SINT32:case V.UINT32:let i;if(typeof t==`number`?i=t:typeof t==`string`&&t.length>0&&t.trim().length===t.length&&(i=Number(t)),i===void 0)break;return e==V.UINT32||e==V.FIXED32?su(i):ou(i),i;case V.INT64:case V.SFIXED64:case V.SINT64:if(typeof t!=`number`&&typeof t!=`string`)break;let a=B.parse(t);return n?a.toString():a;case V.FIXED64:case V.UINT64:if(typeof t!=`number`&&typeof t!=`string`)break;let o=B.uParse(t);return n?o.toString():o;case V.BOOL:if(typeof t!=`boolean`)break;return t;case V.STRING:if(typeof t!=`string`)break;return t;case V.BYTES:if(t===``)return new Uint8Array;if(typeof t!=`string`)break;return Vu.dec(t)}throw Error()}function sd(e,t,n,r){if(t===null)return e.typeName==`google.protobuf.NullValue`?0:r?e.values[0].no:ed;switch(typeof t){case`number`:if(Number.isInteger(t))return t;break;case`string`:let r=e.findName(t);if(r!==void 0)return r.no;if(n)return td}throw Error(`cannot decode enum ${e.typeName} from JSON: ${rd(t)}`)}function cd(e){return e.repeated||e.kind==`map`?!0:!(e.oneof||e.kind==`message`||e.opt||e.req)}function ld(e,t,n){if(e.kind==`map`){R(typeof t==`object`&&!!t);let r={},i=Object.entries(t);switch(e.V.kind){case`scalar`:for(let[t,n]of i)r[t.toString()]=dd(e.V.T,n);break;case`message`:for(let[e,t]of i)r[e.toString()]=t.toJson(n);break;case`enum`:let t=e.V.T;for(let[e,a]of i)r[e.toString()]=ud(t,a,n.enumAsInteger)}return n.emitDefaultValues||i.length>0?r:void 0}if(e.repeated){R(Array.isArray(t));let r=[];switch(e.kind){case`scalar`:for(let n=0;n<t.length;n++)r.push(dd(e.T,t[n]));break;case`enum`:for(let i=0;i<t.length;i++)r.push(ud(e.T,t[i],n.enumAsInteger));break;case`message`:for(let e=0;e<t.length;e++)r.push(t[e].toJson(n))}return n.emitDefaultValues||r.length>0?r:void 0}switch(e.kind){case`scalar`:return dd(e.T,t);case`enum`:return ud(e.T,t,n.enumAsInteger);case`message`:return Yu(e.T,t).toJson(n)}}function ud(e,t,n){return R(typeof t==`number`),e.typeName==`google.protobuf.NullValue`?null:n?t:e.findNumber(t)?.name??t}function dd(e,t){switch(e){case V.INT32:case V.SFIXED32:case V.SINT32:case V.FIXED32:case V.UINT32:return R(typeof t==`number`),t;case V.FLOAT:case V.DOUBLE:return R(typeof t==`number`),Number.isNaN(t)?`NaN`:t===1/0?`Infinity`:t===-1/0?`-Infinity`:t;case V.STRING:return R(typeof t==`string`),t;case V.BOOL:return R(typeof t==`boolean`),t;case V.UINT64:case V.FIXED64:case V.INT64:case V.SFIXED64:case V.SINT64:return R(typeof t==`bigint`||typeof t==`string`||typeof t==`number`),t.toString();case V.BYTES:return R(t instanceof Uint8Array),Vu.enc(t)}}var fd=Symbol(`@bufbuild/protobuf/unknown-fields`),pd={readUnknownFields:!0,readerFactory:e=>new Pu(e)},md={writeUnknownFields:!0,writerFactory:()=>new Nu};function hd(e){return e?Object.assign(Object.assign({},pd),e):pd}function gd(e){return e?Object.assign(Object.assign({},md),e):md}function _d(){return{makeReadOptions:hd,makeWriteOptions:gd,listUnknownFields(e){return e[fd]??[]},discardUnknownFields(e){delete e[fd]},writeUnknownFields(e,t){let n=e[fd];if(n)for(let e of n)t.tag(e.no,e.wireType).raw(e.data)},onUnknownField(e,t,n,r){let i=e;Array.isArray(i[fd])||(i[fd]=[]),i[fd].push({no:t,wireType:n,data:r})},readMessage(e,t,n,r,i){let a=e.getType(),o=i?t.len:t.pos+n,s,c;for(;t.pos<o&&([s,c]=t.tag(),i!==!0||c!=H.EndGroup);){let n=a.fields.find(s);if(!n){let n=t.skip(c,s);r.readUnknownFields&&this.onUnknownField(e,s,c,n);continue}vd(e,t,n,c,r)}if(i&&(c!=H.EndGroup||s!==n))throw Error(`invalid end group tag`)},readField:vd,writeMessage(e,t,n){let r=e.getType();for(let i of r.fields.byNumber()){if(!Ku(i,e)){if(i.req)throw Error(`cannot encode field ${r.typeName}.${i.name} to binary: required field not set`);continue}Cd(i,i.oneof?e[i.oneof.localName].value:e[i.localName],t,n)}return n.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,n,r){t!==void 0&&Cd(e,t,n,r)}}}function vd(e,t,n,r,i){let{repeated:a,localName:o}=n;switch(n.oneof&&(e=e[n.oneof.localName],e.case!=o&&delete e.value,e.case=o,o=`value`),n.kind){case`scalar`:case`enum`:let s=n.kind==`enum`?V.INT32:n.T,c=Sd;if(n.kind==`scalar`&&n.L>0&&(c=xd),a){let n=e[o];if(r==H.LengthDelimited&&s!=V.STRING&&s!=V.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(c(t,s))}else n.push(c(t,s))}else e[o]=c(t,s);break;case`message`:let l=n.T;a?e[o].push(yd(t,new l,i,n)):Ju(e[o])?yd(t,e[o],i,n):(e[o]=yd(t,new l,i,n),l.fieldWrapper&&!n.oneof&&!n.repeated&&(e[o]=l.fieldWrapper.unwrapField(e[o])));break;case`map`:let[u,d]=bd(n,t,i);e[o][u]=d}}function yd(e,t,n,r){let i=t.getType().runtime.bin,a=r?.delimited;return i.readMessage(t,e,a?r.no:e.uint32(),n,a),t}function bd(e,t,n){let r=t.uint32(),i=t.pos+r,a,o;for(;t.pos<i;){let[r]=t.tag();switch(r){case 1:a=Sd(t,e.K);break;case 2:switch(e.V.kind){case`scalar`:o=Sd(t,e.V.T);break;case`enum`:o=t.int32();break;case`message`:o=yd(t,new e.V.T,n,void 0)}}}if(a===void 0&&(a=ju(e.K,ku.BIGINT)),typeof a!=`string`&&typeof a!=`number`&&(a=a.toString()),o===void 0)switch(e.V.kind){case`scalar`:o=ju(e.V.T,ku.BIGINT);break;case`enum`:o=e.V.T.values[0].no;break;case`message`:o=new e.V.T}return[a,o]}function xd(e,t){let n=Sd(e,t);return typeof n==`bigint`?n.toString():n}function Sd(e,t){switch(t){case V.STRING:return e.string();case V.BOOL:return e.bool();case V.DOUBLE:return e.double();case V.FLOAT:return e.float();case V.INT32:return e.int32();case V.INT64:return e.int64();case V.UINT64:return e.uint64();case V.FIXED64:return e.fixed64();case V.BYTES:return e.bytes();case V.FIXED32:return e.fixed32();case V.SFIXED32:return e.sfixed32();case V.SFIXED64:return e.sfixed64();case V.SINT64:return e.sint64();case V.UINT32:return e.uint32();case V.SINT32:return e.sint32()}}function Cd(e,t,n,r){R(t!==void 0);let i=e.repeated;switch(e.kind){case`scalar`:case`enum`:let a=e.kind==`enum`?V.INT32:e.T;if(i){if(R(Array.isArray(t)),e.packed)Dd(n,a,e.no,t);else for(let r of t)Ed(n,a,e.no,r)}else Ed(n,a,e.no,t);break;case`message`:if(i){R(Array.isArray(t));for(let i of t)Td(n,r,e,i)}else Td(n,r,e,t);break;case`map`:R(typeof t==`object`&&!!t);for(let[i,a]of Object.entries(t))wd(n,r,e,i,a)}}function wd(e,t,n,r,i){e.tag(n.no,H.LengthDelimited),e.fork();let a=r;switch(n.K){case V.INT32:case V.FIXED32:case V.UINT32:case V.SFIXED32:case V.SINT32:a=Number.parseInt(r);break;case V.BOOL:R(r==`true`||r==`false`),a=r==`true`}switch(Ed(e,n.K,1,a),n.V.kind){case`scalar`:Ed(e,n.V.T,2,i);break;case`enum`:Ed(e,V.INT32,2,i);break;case`message`:R(i!==void 0),e.tag(2,H.LengthDelimited).bytes(i.toBinary(t))}e.join()}function Td(e,t,n,r){let i=Yu(n.T,r);n.delimited?e.tag(n.no,H.StartGroup).raw(i.toBinary(t)).tag(n.no,H.EndGroup):e.tag(n.no,H.LengthDelimited).bytes(i.toBinary(t))}function Ed(e,t,n,r){R(r!==void 0);let[i,a]=Od(t);e.tag(n,i)[a](r)}function Dd(e,t,n,r){if(!r.length)return;e.tag(n,H.LengthDelimited).fork();let[,i]=Od(t);for(let t=0;t<r.length;t++)e[i](r[t]);e.join()}function Od(e){let t=H.Varint;switch(e){case V.BYTES:case V.STRING:t=H.LengthDelimited;break;case V.DOUBLE:case V.FIXED64:case V.SFIXED64:t=H.Bit64;break;case V.FIXED32:case V.SFIXED32:case V.FLOAT:t=H.Bit32}let n=V[e].toLowerCase();return[t,n]}function kd(){return{setEnumType:du,initPartial(e,t){if(e===void 0)return;let n=t.getType();for(let r of n.fields.byMember()){let n=r.localName,i=t,a=e;if(a[n]!=null)switch(r.kind){case`oneof`:let e=a[n].case;if(e===void 0)continue;let t=r.findField(e),o=a[n].value;t&&t.kind==`message`&&!Ju(o,t.T)?o=new t.T(o):t&&t.kind===`scalar`&&t.T===V.BYTES&&(o=jd(o)),i[n]={case:e,value:o};break;case`scalar`:case`enum`:let s=a[n];r.T===V.BYTES&&(s=r.repeated?s.map(jd):jd(s)),i[n]=s;break;case`map`:switch(r.V.kind){case`scalar`:case`enum`:if(r.V.T===V.BYTES)for(let[e,t]of Object.entries(a[n]))i[n][e]=jd(t);else Object.assign(i[n],a[n]);break;case`message`:let e=r.V.T;for(let t of Object.keys(a[n])){let r=a[n][t];e.fieldWrapper||(r=new e(r)),i[n][t]=r}}break;case`message`:let c=r.T;if(r.repeated)i[n]=a[n].map(e=>Ju(e,c)?e:new c(e));else{let e=a[n];i[n]=c.fieldWrapper?c.typeName===`google.protobuf.BytesValue`?jd(e):e:Ju(e,c)?e:new c(e)}}}},equals(e,t,n){return t===n?!0:!t||!n?!1:e.fields.byMember().every(e=>{let r=t[e.localName],i=n[e.localName];if(e.repeated){if(r.length!==i.length)return!1;switch(e.kind){case`message`:return r.every((t,n)=>e.T.equals(t,i[n]));case`scalar`:return r.every((t,n)=>Au(e.T,t,i[n]));case`enum`:return r.every((e,t)=>Au(V.INT32,e,i[t]))}throw Error(`repeated cannot contain ${e.kind}`)}switch(e.kind){case`message`:let t=r,n=i;return e.T.fieldWrapper&&(t!==void 0&&!Ju(t)&&(t=e.T.fieldWrapper.wrapField(t)),n!==void 0&&!Ju(n)&&(n=e.T.fieldWrapper.wrapField(n))),e.T.equals(t,n);case`enum`:return Au(V.INT32,r,i);case`scalar`:return Au(e.T,r,i);case`oneof`:if(r.case!==i.case)return!1;let a=e.findField(r.case);if(a===void 0)return!0;switch(a.kind){case`message`:return a.T.equals(r.value,i.value);case`enum`:return Au(V.INT32,r.value,i.value);case`scalar`:return Au(a.T,r.value,i.value)}throw Error(`oneof cannot contain ${a.kind}`);case`map`:let o=Object.keys(r).concat(Object.keys(i));switch(e.V.kind){case`message`:let t=e.V.T;return o.every(e=>t.equals(r[e],i[e]));case`enum`:return o.every(e=>Au(V.INT32,r[e],i[e]));case`scalar`:let n=e.V.T;return o.every(e=>Au(n,r[e],i[e]))}}})},clone(e){let t=e.getType(),n=new t,r=n;for(let n of t.fields.byMember()){let t=e[n.localName],i;if(n.repeated)i=t.map(Ad);else if(n.kind==`map`){i=r[n.localName];for(let[e,n]of Object.entries(t))i[e]=Ad(n)}else i=n.kind==`oneof`?n.findField(t.case)?{case:t.case,value:Ad(t.value)}:{case:void 0}:Ad(t);r[n.localName]=i}for(let n of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(r,n.no,n.wireType,n.data);return n}}}function Ad(e){if(e===void 0)return e;if(Ju(e))return e.clone();if(e instanceof Uint8Array){let t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function jd(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Md(e,t,n){return{syntax:e,json:nd(),bin:_d(),util:Object.assign(Object.assign({},kd()),{newFieldList:t,initFields:n}),makeMessageType(e,t,n){return hu(this,e,t,n)},makeEnum:pu,makeEnumType:fu,getEnumType:uu,makeExtension(e,t,n){return Fu(this,e,t,n)}}}var Nd=class{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){let e={};for(let t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){let e={};for(let t of this.list())e[t.no]=t;this.numbers=e}return this.numbers[e]}list(){return this.all||=this._normalizer(this._fields),this.all}byNumber(){return this.numbersAsc||=this.list().concat().sort((e,t)=>e.no-t.no),this.numbersAsc}byMember(){if(!this.members){this.members=[];let e=this.members,t;for(let n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}};function Pd(e,t){let n=Ld(e);return t?n:Hd(Vd(n))}function Fd(e){return Pd(e,!1)}var Id=Ld;function Ld(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=e.charAt(r);switch(i){case`_`:t=!0;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n.push(i),t=!1;break;default:t&&(t=!1,i=i.toUpperCase()),n.push(i)}}return n.join(``)}var Rd=new Set([`constructor`,`toString`,`toJSON`,`valueOf`]),zd=new Set([`getType`,`clone`,`equals`,`fromBinary`,`fromJson`,`fromJsonString`,`toBinary`,`toJson`,`toJsonString`,`toObject`]),Bd=e=>`${e}$`,Vd=e=>zd.has(e)?Bd(e):e,Hd=e=>Rd.has(e)?Bd(e):e,Ud=class{constructor(e){this.kind=`oneof`,this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=Fd(e)}addField(e){R(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}};function Wd(e,t){let n=[],r;for(let i of typeof e==`function`?e():e){let e=i;if(e.localName=Pd(i.name,i.oneof!==void 0),e.jsonName=i.jsonName??Id(i.name),e.repeated=i.repeated??!1,i.kind==`scalar`&&(e.L=i.L??ku.BIGINT),e.delimited=i.delimited??!1,e.req=i.req??!1,e.opt=i.opt??!1,i.packed===void 0&&(e.packed=t?i.kind==`enum`||i.kind==`scalar`&&i.T!=V.BYTES&&i.T!=V.STRING:!1),i.oneof!==void 0){let t=typeof i.oneof==`string`?i.oneof:i.oneof.name;(!r||r.name!=t)&&(r=new Ud(t)),e.oneof=r,r.addField(e)}n.push(e)}return n}var U=Md(`proto3`,e=>new Nd(e,e=>Wd(e,!0)),e=>{for(let t of e.getType().fields.byMember()){if(t.opt)continue;let n=t.localName,r=e;if(t.repeated){r[n]=[];continue}switch(t.kind){case`oneof`:r[n]={case:void 0};break;case`enum`:r[n]=0;break;case`map`:r[n]={};break;case`scalar`:r[n]=ju(t.T,t.L)}}}),Gd;(function(e){e[e.Unary=0]=`Unary`,e[e.ServerStreaming=1]=`ServerStreaming`,e[e.ClientStreaming=2]=`ClientStreaming`,e[e.BiDiStreaming=3]=`BiDiStreaming`})(Gd||={});var Kd;(function(e){e[e.NoSideEffects=1]=`NoSideEffects`,e[e.Idempotent=2]=`Idempotent`})(Kd||={});var qd;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.JUPYTER_FORMAT=77]=`JUPYTER_FORMAT`})(qd||={}),U.util.setEnumType(qd,`exa.codeium_common_pb.ExperimentKey`,[{no:0,name:`UNSPECIFIED`},{no:77,name:`JUPYTER_FORMAT`}]);var Jd;(function(e){e[e.CODEIUM=0]=`CODEIUM`})(Jd||={}),U.util.setEnumType(Jd,`exa.codeium_common_pb.AuthSource`,[{no:0,name:`AUTH_SOURCE_CODEIUM`}]);var Yd;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.ENABLE_CODEIUM=1]=`ENABLE_CODEIUM`,e[e.DISABLE_CODEIUM=2]=`DISABLE_CODEIUM`,e[e.SHOW_PREVIOUS_COMPLETION=3]=`SHOW_PREVIOUS_COMPLETION`,e[e.SHOW_NEXT_COMPLETION=4]=`SHOW_NEXT_COMPLETION`})(Yd||={}),U.util.setEnumType(Yd,`exa.codeium_common_pb.EventType`,[{no:0,name:`EVENT_TYPE_UNSPECIFIED`},{no:1,name:`EVENT_TYPE_ENABLE_CODEIUM`},{no:2,name:`EVENT_TYPE_DISABLE_CODEIUM`},{no:3,name:`EVENT_TYPE_SHOW_PREVIOUS_COMPLETION`},{no:4,name:`EVENT_TYPE_SHOW_NEXT_COMPLETION`}]);var Xd;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TYPING_AS_SUGGESTED=1]=`TYPING_AS_SUGGESTED`,e[e.CACHE=2]=`CACHE`,e[e.NETWORK=3]=`NETWORK`})(Xd||={}),U.util.setEnumType(Xd,`exa.codeium_common_pb.CompletionSource`,[{no:0,name:`COMPLETION_SOURCE_UNSPECIFIED`},{no:1,name:`COMPLETION_SOURCE_TYPING_AS_SUGGESTED`},{no:2,name:`COMPLETION_SOURCE_CACHE`},{no:3,name:`COMPLETION_SOURCE_NETWORK`}]);var Zd;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.C=1]=`C`,e[e.CLOJURE=2]=`CLOJURE`,e[e.COFFEESCRIPT=3]=`COFFEESCRIPT`,e[e.CPP=4]=`CPP`,e[e.CSHARP=5]=`CSHARP`,e[e.CSS=6]=`CSS`,e[e.CUDACPP=7]=`CUDACPP`,e[e.DOCKERFILE=8]=`DOCKERFILE`,e[e.GO=9]=`GO`,e[e.GROOVY=10]=`GROOVY`,e[e.HANDLEBARS=11]=`HANDLEBARS`,e[e.HASKELL=12]=`HASKELL`,e[e.HCL=13]=`HCL`,e[e.HTML=14]=`HTML`,e[e.INI=15]=`INI`,e[e.JAVA=16]=`JAVA`,e[e.JAVASCRIPT=17]=`JAVASCRIPT`,e[e.JSON=18]=`JSON`,e[e.JULIA=19]=`JULIA`,e[e.KOTLIN=20]=`KOTLIN`,e[e.LATEX=21]=`LATEX`,e[e.LESS=22]=`LESS`,e[e.LUA=23]=`LUA`,e[e.MAKEFILE=24]=`MAKEFILE`,e[e.MARKDOWN=25]=`MARKDOWN`,e[e.OBJECTIVEC=26]=`OBJECTIVEC`,e[e.OBJECTIVECPP=27]=`OBJECTIVECPP`,e[e.PERL=28]=`PERL`,e[e.PHP=29]=`PHP`,e[e.PLAINTEXT=30]=`PLAINTEXT`,e[e.PROTOBUF=31]=`PROTOBUF`,e[e.PBTXT=32]=`PBTXT`,e[e.PYTHON=33]=`PYTHON`,e[e.R=34]=`R`,e[e.RUBY=35]=`RUBY`,e[e.RUST=36]=`RUST`,e[e.SASS=37]=`SASS`,e[e.SCALA=38]=`SCALA`,e[e.SCSS=39]=`SCSS`,e[e.SHELL=40]=`SHELL`,e[e.SQL=41]=`SQL`,e[e.STARLARK=42]=`STARLARK`,e[e.SWIFT=43]=`SWIFT`,e[e.TSX=44]=`TSX`,e[e.TYPESCRIPT=45]=`TYPESCRIPT`,e[e.VISUALBASIC=46]=`VISUALBASIC`,e[e.VUE=47]=`VUE`,e[e.XML=48]=`XML`,e[e.XSL=49]=`XSL`,e[e.YAML=50]=`YAML`,e[e.SVELTE=51]=`SVELTE`,e[e.TOML=52]=`TOML`,e[e.DART=53]=`DART`,e[e.RST=54]=`RST`,e[e.OCAML=55]=`OCAML`,e[e.CMAKE=56]=`CMAKE`,e[e.PASCAL=57]=`PASCAL`,e[e.ELIXIR=58]=`ELIXIR`,e[e.FSHARP=59]=`FSHARP`,e[e.LISP=60]=`LISP`,e[e.MATLAB=61]=`MATLAB`,e[e.POWERSHELL=62]=`POWERSHELL`,e[e.SOLIDITY=63]=`SOLIDITY`,e[e.ADA=64]=`ADA`,e[e.OCAML_INTERFACE=65]=`OCAML_INTERFACE`})(Zd||={}),U.util.setEnumType(Zd,`exa.codeium_common_pb.Language`,[{no:0,name:`LANGUAGE_UNSPECIFIED`},{no:1,name:`LANGUAGE_C`},{no:2,name:`LANGUAGE_CLOJURE`},{no:3,name:`LANGUAGE_COFFEESCRIPT`},{no:4,name:`LANGUAGE_CPP`},{no:5,name:`LANGUAGE_CSHARP`},{no:6,name:`LANGUAGE_CSS`},{no:7,name:`LANGUAGE_CUDACPP`},{no:8,name:`LANGUAGE_DOCKERFILE`},{no:9,name:`LANGUAGE_GO`},{no:10,name:`LANGUAGE_GROOVY`},{no:11,name:`LANGUAGE_HANDLEBARS`},{no:12,name:`LANGUAGE_HASKELL`},{no:13,name:`LANGUAGE_HCL`},{no:14,name:`LANGUAGE_HTML`},{no:15,name:`LANGUAGE_INI`},{no:16,name:`LANGUAGE_JAVA`},{no:17,name:`LANGUAGE_JAVASCRIPT`},{no:18,name:`LANGUAGE_JSON`},{no:19,name:`LANGUAGE_JULIA`},{no:20,name:`LANGUAGE_KOTLIN`},{no:21,name:`LANGUAGE_LATEX`},{no:22,name:`LANGUAGE_LESS`},{no:23,name:`LANGUAGE_LUA`},{no:24,name:`LANGUAGE_MAKEFILE`},{no:25,name:`LANGUAGE_MARKDOWN`},{no:26,name:`LANGUAGE_OBJECTIVEC`},{no:27,name:`LANGUAGE_OBJECTIVECPP`},{no:28,name:`LANGUAGE_PERL`},{no:29,name:`LANGUAGE_PHP`},{no:30,name:`LANGUAGE_PLAINTEXT`},{no:31,name:`LANGUAGE_PROTOBUF`},{no:32,name:`LANGUAGE_PBTXT`},{no:33,name:`LANGUAGE_PYTHON`},{no:34,name:`LANGUAGE_R`},{no:35,name:`LANGUAGE_RUBY`},{no:36,name:`LANGUAGE_RUST`},{no:37,name:`LANGUAGE_SASS`},{no:38,name:`LANGUAGE_SCALA`},{no:39,name:`LANGUAGE_SCSS`},{no:40,name:`LANGUAGE_SHELL`},{no:41,name:`LANGUAGE_SQL`},{no:42,name:`LANGUAGE_STARLARK`},{no:43,name:`LANGUAGE_SWIFT`},{no:44,name:`LANGUAGE_TSX`},{no:45,name:`LANGUAGE_TYPESCRIPT`},{no:46,name:`LANGUAGE_VISUALBASIC`},{no:47,name:`LANGUAGE_VUE`},{no:48,name:`LANGUAGE_XML`},{no:49,name:`LANGUAGE_XSL`},{no:50,name:`LANGUAGE_YAML`},{no:51,name:`LANGUAGE_SVELTE`},{no:52,name:`LANGUAGE_TOML`},{no:53,name:`LANGUAGE_DART`},{no:54,name:`LANGUAGE_RST`},{no:55,name:`LANGUAGE_OCAML`},{no:56,name:`LANGUAGE_CMAKE`},{no:57,name:`LANGUAGE_PASCAL`},{no:58,name:`LANGUAGE_ELIXIR`},{no:59,name:`LANGUAGE_FSHARP`},{no:60,name:`LANGUAGE_LISP`},{no:61,name:`LANGUAGE_MATLAB`},{no:62,name:`LANGUAGE_POWERSHELL`},{no:63,name:`LANGUAGE_SOLIDITY`},{no:64,name:`LANGUAGE_ADA`},{no:65,name:`LANGUAGE_OCAML_INTERFACE`}]);var Qd=class e extends z{completionId=``;text=``;prefix=``;stop=``;score=0;tokens=[];decodedTokens=[];probabilities=[];adjustedProbabilities=[];generatedLength=B.zero;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.codeium_common_pb.Completion`;static fields=U.util.newFieldList(()=>[{no:1,name:`completion_id`,kind:`scalar`,T:9},{no:2,name:`text`,kind:`scalar`,T:9},{no:3,name:`prefix`,kind:`scalar`,T:9},{no:4,name:`stop`,kind:`scalar`,T:9},{no:5,name:`score`,kind:`scalar`,T:1},{no:6,name:`tokens`,kind:`scalar`,T:4,repeated:!0},{no:7,name:`decoded_tokens`,kind:`scalar`,T:9,repeated:!0},{no:8,name:`probabilities`,kind:`scalar`,T:1,repeated:!0},{no:9,name:`adjusted_probabilities`,kind:`scalar`,T:1,repeated:!0},{no:10,name:`generated_length`,kind:`scalar`,T:4}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},$d=class e extends z{ideName=``;ideVersion=``;extensionName=``;extensionVersion=``;apiKey=``;locale=``;sessionId=``;requestId=B.zero;userAgent=``;url=``;authSource=Jd.CODEIUM;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.codeium_common_pb.Metadata`;static fields=U.util.newFieldList(()=>[{no:1,name:`ide_name`,kind:`scalar`,T:9},{no:7,name:`ide_version`,kind:`scalar`,T:9},{no:12,name:`extension_name`,kind:`scalar`,T:9},{no:2,name:`extension_version`,kind:`scalar`,T:9},{no:3,name:`api_key`,kind:`scalar`,T:9},{no:4,name:`locale`,kind:`scalar`,T:9},{no:10,name:`session_id`,kind:`scalar`,T:9},{no:9,name:`request_id`,kind:`scalar`,T:4},{no:13,name:`user_agent`,kind:`scalar`,T:9},{no:14,name:`url`,kind:`scalar`,T:9},{no:15,name:`auth_source`,kind:`enum`,T:U.getEnumType(Jd)}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},ef=class e extends z{tabSize=B.zero;insertSpaces=!1;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.codeium_common_pb.EditorOptions`;static fields=U.util.newFieldList(()=>[{no:1,name:`tab_size`,kind:`scalar`,T:4},{no:2,name:`insert_spaces`,kind:`scalar`,T:8}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}};(class e extends z{eventType=Yd.UNSPECIFIED;eventJson=``;timestampUnixMs=B.zero;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.codeium_common_pb.Event`;static fields=U.util.newFieldList(()=>[{no:1,name:`event_type`,kind:`enum`,T:U.getEnumType(Yd)},{no:2,name:`event_json`,kind:`scalar`,T:9},{no:3,name:`timestamp_unix_ms`,kind:`scalar`,T:3}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}});var tf=class extends li{index;total;constructor(e,t){super(),this.index=e,this.total=t}toDOM(){let e=document.createElement(`span`);e.setAttribute(`aria-hidden`,`true`),e.className=`cm-codeium-cycle`;let t=e.appendChild(document.createElement(`span`));t.className=`cm-codeium-cycle-explanation`,t.innerText=`${this.index+1}/${this.total}`;let n=e.appendChild(document.createElement(`button`));return n.className=`cm-codeium-cycle-key`,n.innerText=`→ (Ctrl ])`,n.dataset.action=`codeium-cycle`,e}ignoreEvent(){return!1}},nf=Vr.define({combine(e){return _i(e,{language:Zd.TYPESCRIPT,timeout:150,widgetClass:tf,alwaysOn:!0},{})}}),rf=Vr.define({combine(e){return _i(e,{override:()=>[]},{})}}),af=M.mark({class:`cm-ghostText`}),of=Qr.define({create(e){return null},update(e,t){let n=t.state.facet(nf);for(let e of t.effects){if(e.is(Ql)){let{changeSpecs:t,index:r}=e.value,i=t[r].map(e=>af.range(e.absoluteStartPos,e.absoluteEndPos)),a=i.at(-1)?.to;return{index:r,decorations:M.set([...i,...a!==void 0&&t.length>1&&n.widgetClass?[M.widget({widget:new n.widgetClass(r,t.length),side:1}).range(a)]:[]]),changeSpecs:t,reverseChangeSet:e.value.reverseChangeSet}}if(e.is($l)||e.is(eu))return null}return e&&{...e,decorations:e.decorations.map(t.changes),reverseChangeSet:e.reverseChangeSet.map(t.changes)}},provide:e=>N.decorations.from(e,e=>e?.decorations||M.none)}),sf=$r.define(),cf=$r.define(),W;(function(e){e[e.Canceled=1]=`Canceled`,e[e.Unknown=2]=`Unknown`,e[e.InvalidArgument=3]=`InvalidArgument`,e[e.DeadlineExceeded=4]=`DeadlineExceeded`,e[e.NotFound=5]=`NotFound`,e[e.AlreadyExists=6]=`AlreadyExists`,e[e.PermissionDenied=7]=`PermissionDenied`,e[e.ResourceExhausted=8]=`ResourceExhausted`,e[e.FailedPrecondition=9]=`FailedPrecondition`,e[e.Aborted=10]=`Aborted`,e[e.OutOfRange=11]=`OutOfRange`,e[e.Unimplemented=12]=`Unimplemented`,e[e.Internal=13]=`Internal`,e[e.Unavailable=14]=`Unavailable`,e[e.DataLoss=15]=`DataLoss`,e[e.Unauthenticated=16]=`Unauthenticated`})(W||={});function lf(e){let t=W[e];return typeof t==`string`?t[0].toLowerCase()+t.substring(1).replace(/[A-Z]/g,e=>`_`+e.toLowerCase()):e.toString()}var uf;function df(e){if(!uf){uf={};for(let e of Object.values(W))typeof e!=`string`&&(uf[lf(e)]=e)}return uf[e]}var ff=class e extends Error{constructor(e,t=W.Unknown,n,r,i){super(pf(e,t)),this.name=`ConnectError`,Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=t,this.metadata=new Headers(n??{}),this.details=r??[],this.cause=i}static from(t,n=W.Unknown){return t instanceof e?t:t instanceof Error?t.name==`AbortError`?new e(t.message,W.Canceled):new e(t.message,n,void 0,void 0,t):new e(String(t),n,void 0,void 0,t)}static[Symbol.hasInstance](t){return t instanceof Error?Object.getPrototypeOf(t)===e.prototype||t.name===`ConnectError`&&`code`in t&&typeof t.code==`number`&&`metadata`in t&&`details`in t&&Array.isArray(t.details)&&`rawMessage`in t&&typeof t.rawMessage==`string`&&`cause`in t:!1}findDetails(e){let t=`typeName`in e?{findMessage:t=>t===e.typeName?e:void 0}:e,n=[];for(let e of this.details){if(`getType`in e){t.findMessage(e.getType().typeName)&&n.push(e);continue}let r=t.findMessage(e.type);if(r)try{n.push(r.fromBinary(e.value))}catch{}}return n}};function pf(e,t){return e.length?`[${lf(t)}] ${e}`:`[${lf(t)}]`}function mf(...e){let t=new Headers;for(let n of e)n.forEach((e,n)=>{t.append(n,e)});return t}function hf(e,t){let n={};for(let[r,i]of Object.entries(e.methods)){let a=t(Object.assign(Object.assign({},i),{localName:r,service:e}));a!=null&&(n[r]=a)}return n}function gf(e){let t,n=new Uint8Array;function r(e){let t=new Uint8Array(n.length+e.length);t.set(n),t.set(e,n.length),n=t}return new ReadableStream({start(){t=e.getReader()},async pull(e){let i;for(;;){if(i===void 0&&n.byteLength>=5){let e=0;for(let t=1;t<5;t++)e=(e<<8)+n[t];i={flags:n[0],length:e}}if(i!==void 0&&n.byteLength>=i.length+5)break;let e=await t.read();if(e.done)break;r(e.value)}if(i===void 0){if(n.byteLength==0){e.close();return}e.error(new ff(`premature end of stream`,W.DataLoss));return}let a=n.subarray(5,5+i.length);n=n.subarray(5+i.length),e.enqueue({flags:i.flags,data:a})}})}function _f(e,t){let n=new Uint8Array(t.length+5);n.set(t,5);let r=new DataView(n.buffer,n.byteOffset,n.byteLength);return r.setUint8(0,e),r.setUint32(1,t.length),n}var vf=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},yf=function(e){return this instanceof yf?(this.v=e,this):new yf(e)},bf=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof yf?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}},xf=function(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:yf(e[r](t)),done:!1}:i?i(t):t}:i}};function Sf(e){return bf(this,arguments,function*(){yield yf(yield*xf(vf(e)))})}var Cf=function(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof __values==`function`?__values(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}},wf=function(e){return this instanceof wf?(this.v=e,this):new wf(e)},Tf=function(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:wf(e[r](t)),done:!1}:i?i(t):t}:i}},Ef=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof wf?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}};function Df(e,t){return hf(e,n=>{switch(n.kind){case Gd.Unary:return kf(t,e,n);case Gd.ServerStreaming:return Af(t,e,n);case Gd.ClientStreaming:return jf(t,e,n);case Gd.BiDiStreaming:return Mf(t,e,n);default:return null}})}function Of(e,t){return Df(e,t)}function kf(e,t,n){return async function(r,i){var a,o;let s=await e.unary(t,n,i?.signal,i?.timeoutMs,i?.headers,r,i?.contextValues);return(a=i?.onHeader)==null||a.call(i,s.header),(o=i?.onTrailer)==null||o.call(i,s.trailer),s.message}}function Af(e,t,n){return function(r,i){return Nf(e.stream(t,n,i?.signal,i?.timeoutMs,i?.headers,Sf([r]),i?.contextValues),i)}}function jf(e,t,n){return async function(r,i){var a,o,s,c,l,u;let d=await e.stream(t,n,i?.signal,i?.timeoutMs,i?.headers,r,i?.contextValues);(l=i?.onHeader)==null||l.call(i,d.header);let f,p=0;try{for(var m=!0,h=Cf(d.message),g;g=await h.next(),a=g.done,!a;m=!0)c=g.value,m=!1,f=c,p++}catch(e){o={error:e}}finally{try{!m&&!a&&(s=h.return)&&await s.call(h)}finally{if(o)throw o.error}}if(!f)throw new ff(`protocol error: missing response message`,W.Unimplemented);if(p>1)throw new ff(`protocol error: received extra messages for client streaming method`,W.Unimplemented);return(u=i?.onTrailer)==null||u.call(i,d.trailer),f}}function Mf(e,t,n){return function(r,i){return Nf(e.stream(t,n,i?.signal,i?.timeoutMs,i?.headers,r,i?.contextValues),i)}}function Nf(e,t){let n=(function(){return Ef(this,arguments,function*(){var n,r;let i=yield wf(e);(n=t?.onHeader)==null||n.call(t,i.header),yield wf(yield*Tf(Cf(i.message))),(r=t?.onTrailer)==null||r.call(t,i.trailer)})})()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function Pf(...e){let t=new AbortController,n=e.filter(e=>e!==void 0).concat(t.signal);for(let e of n){if(e.aborted){r.apply(e);break}e.addEventListener(`abort`,r)}function r(){t.signal.aborted||t.abort(If(this));for(let e of n)e.removeEventListener(`abort`,r)}return t}function Ff(e){let t=new AbortController,n=()=>{t.abort(new ff(`the operation timed out`,W.DeadlineExceeded))},r;return e!==void 0&&(e<=0?n():r=setTimeout(n,e)),{signal:t.signal,cleanup:()=>clearTimeout(r)}}function If(e){if(!e.aborted)return;if(e.reason!==void 0)return e.reason;let t=Error(`This operation was aborted`);return t.name=`AbortError`,t}function Lf(){return{get(e){return e.id in this?this[e.id]:e.defaultValue},set(e,t){return this[e.id]=t,this},delete(e){return delete this[e.id],this}}}function Rf(e,t,n){let r=typeof t==`string`?t:t.typeName,i=typeof n==`string`?n:n.name;return e.toString().replace(/\/?$/,`/${r}/${i}`)}function zf(e,t){return t instanceof e?t:new e(t)}function Bf(e,t){function n(t){return t.done===!0?t:{done:t.done,value:zf(e,t.value)}}return{[Symbol.asyncIterator](){let e=t[Symbol.asyncIterator](),r={next:()=>e.next().then(n)};return e.throw!==void 0&&(r.throw=t=>e.throw(t).then(n)),e.return!==void 0&&(r.return=t=>e.return(t).then(n)),r}}}function Vf(e,t){return t?.concat().reverse().reduce((e,t)=>t(e),e)??e}function Hf(e){let t=Object.assign({},e);return t.ignoreUnknownFields??=!0,t}function Uf(e,t,n,r){let i=t?Wf(e.I,r):Gf(e.I,n);return{parse:(t?Wf(e.O,r):Gf(e.O,n)).parse,serialize:i.serialize}}function Wf(e,t){return{parse(n){try{return e.fromBinary(n,t)}catch(e){throw new ff(`parse binary: ${e instanceof Error?e.message:String(e)}`,W.Internal)}},serialize(e){try{return e.toBinary(t)}catch(e){throw new ff(`serialize binary: ${e instanceof Error?e.message:String(e)}`,W.Internal)}}}}function Gf(e,t){let n=t?.textEncoder??new TextEncoder,r=t?.textDecoder??new TextDecoder,i=Hf(t);return{parse(t){try{let n=r.decode(t);return e.fromJsonString(n,i)}catch(e){throw ff.from(e,W.InvalidArgument)}},serialize(e){try{let t=e.toJsonString(i);return n.encode(t)}catch(e){throw ff.from(e,W.Internal)}}}}var Kf=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i,qf=`application/proto`,Jf=`application/json`,Yf=`application/connect+proto`,Xf=`application/connect+json`;function Zf(e){let t=e?.match(Kf);if(t)return{stream:!!t[1],binary:!!t[3]}}function Qf(e,t,n){if(t&&new Headers(t).forEach((e,t)=>n.metadata.append(t,e)),typeof e!=`object`||!e||Array.isArray(e))throw n;let r=n.code;`code`in e&&typeof e.code==`string`&&(r=df(e.code)??r);let i=e.message;if(i!=null&&typeof i!=`string`)throw n;let a=new ff(i??``,r,t);if(`details`in e&&Array.isArray(e.details))for(let t of e.details){if(typeof t!=`object`||!t||Array.isArray(t)||typeof t.type!=`string`||typeof t.value!=`string`)throw n;try{a.details.push({type:t.type,value:Vu.dec(t.value),debug:t.debug})}catch{throw n}}return a}function $f(e){let t=new ff(`invalid end stream`,W.Unknown),n;try{n=JSON.parse(typeof e==`string`?e:new TextDecoder().decode(e))}catch{throw t}if(typeof n!=`object`||!n||Array.isArray(n))throw t;let r=new Headers;if(`metadata`in n){if(typeof n.metadata!=`object`||n.metadata==null||Array.isArray(n.metadata))throw t;for(let[e,i]of Object.entries(n.metadata)){if(!Array.isArray(i)||i.some(e=>typeof e!=`string`))throw t;for(let t of i)r.append(e,t)}}return{metadata:r,error:`error`in n&&n.error!=null?Qf(n.error,r,t):void 0}}var ep=`Content-Type`,tp=`Content-Length`,np=`Content-Encoding`,rp=`Accept-Encoding`,ip=`Connect-Timeout-Ms`,ap=`Connect-Protocol-Version`,op=`User-Agent`;function sp(e){switch(e){case 400:return W.Internal;case 401:return W.Unauthenticated;case 403:return W.PermissionDenied;case 404:return W.Unimplemented;case 429:return W.Unavailable;case 502:return W.Unavailable;case 503:return W.Unavailable;case 504:return W.Unavailable;default:return W.Unknown}}function cp(e){let t=new Headers,n=new Headers;return e.forEach((e,r)=>{r.toLowerCase().startsWith(`trailer-`)?n.append(r.substring(8),e):t.append(r,e)}),[t,n]}function lp(e,t,n,r,i){let a=new Headers(r??{});return n!==void 0&&a.set(ip,`${n}`),a.set(ep,e==Gd.Unary?t?qf:Jf:t?Yf:Xf),a.set(ap,`1`),i&&a.set(op,`connect-es/1.6.1`),a}function up(e,t,n,r){let i=r.get(ep),a=Zf(i);if(n!==200){let t=new ff(`HTTP ${n}`,sp(n),r);if(e==Gd.Unary&&a&&!a.binary)return{isUnaryError:!0,unaryError:t};throw t}let o={binary:t,stream:e!==Gd.Unary};if(a?.binary!==o.binary||a.stream!==o.stream)throw new ff(`unsupported content type ${i}`,a===void 0?W.Unknown:W.Internal,r);return{isUnaryError:!1}}var dp=`application/`;function fp(e,t){return t?Vu.enc(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``):encodeURIComponent(new TextDecoder().decode(e))}function pp(e,t,n){let r=`?connect=v1`,i=e.header.get(ep);i?.indexOf(dp)===0&&(r+=`&encoding=`+encodeURIComponent(i.slice(12)));let a=e.header.get(np);a!==null&&a!==`identity`&&(r+=`&compression=`+encodeURIComponent(a),n=!0),n&&(r+=`&base64=1`),r+=`&message=`+fp(t,n);let o=e.url+r,s=new Headers(e.header);return[ap,ep,tp,np,rp].forEach(e=>s.delete(e)),Object.assign(Object.assign({},e),{init:Object.assign(Object.assign({},e.init),{method:`GET`}),url:o,header:s})}function mp(e){let t=Vf(e.next,e.interceptors),[n,r,i]=gp(e);return t(Object.assign(Object.assign({},e.req),{message:zf(e.req.method.I,e.req.message),signal:n})).then(e=>(i(),e),r)}function hp(e){let t=Vf(e.next,e.interceptors),[n,r,i]=gp(e),a=Object.assign(Object.assign({},e.req),{message:Bf(e.req.method.I,e.req.message),signal:n}),o=!1;return n.addEventListener(`abort`,function(){var t,n;let r=e.req.message[Symbol.asyncIterator]();o||(t=r.throw)==null||t.call(r,this.reason).catch(()=>{}),(n=r.return)==null||n.call(r).catch(()=>{})}),t(a).then(e=>Object.assign(Object.assign({},e),{message:{[Symbol.asyncIterator](){let t=e.message[Symbol.asyncIterator]();return{next(){return t.next().then(e=>(e.done==1&&(o=!0,i()),e),r)}}}}}),r)}function gp(e){let{signal:t,cleanup:n}=Ff(e.timeoutMs),r=Pf(e.signal,t);return[r.signal,function(e){let i=ff.from(t.aborted?If(t):e);return r.abort(i),n(),Promise.reject(i)},function(){n(),r.abort()}]}var _p;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.INACTIVE=1]=`INACTIVE`,e[e.PROCESSING=2]=`PROCESSING`,e[e.SUCCESS=3]=`SUCCESS`,e[e.WARNING=4]=`WARNING`,e[e.ERROR=5]=`ERROR`})(_p||={}),U.util.setEnumType(_p,`exa.language_server_pb.CodeiumState`,[{no:0,name:`CODEIUM_STATE_UNSPECIFIED`},{no:1,name:`CODEIUM_STATE_INACTIVE`},{no:2,name:`CODEIUM_STATE_PROCESSING`},{no:3,name:`CODEIUM_STATE_SUCCESS`},{no:4,name:`CODEIUM_STATE_WARNING`},{no:5,name:`CODEIUM_STATE_ERROR`}]);var vp;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.SINGLE=1]=`SINGLE`,e[e.MULTI=2]=`MULTI`})(vp||={}),U.util.setEnumType(vp,`exa.language_server_pb.LineType`,[{no:0,name:`LINE_TYPE_UNSPECIFIED`},{no:1,name:`LINE_TYPE_SINGLE`},{no:2,name:`LINE_TYPE_MULTI`}]);var yp;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.INLINE=1]=`INLINE`,e[e.BLOCK=2]=`BLOCK`,e[e.INLINE_MASK=3]=`INLINE_MASK`})(yp||={}),U.util.setEnumType(yp,`exa.language_server_pb.CompletionPartType`,[{no:0,name:`COMPLETION_PART_TYPE_UNSPECIFIED`},{no:1,name:`COMPLETION_PART_TYPE_INLINE`},{no:2,name:`COMPLETION_PART_TYPE_BLOCK`},{no:3,name:`COMPLETION_PART_TYPE_INLINE_MASK`}]);var bp=class e extends z{threshold=0;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.MultilineConfig`;static fields=U.util.newFieldList(()=>[{no:1,name:`threshold`,kind:`scalar`,T:2}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},xp=class e extends z{metadata;document;editorOptions;otherDocuments=[];experimentConfig;modelName=``;multilineConfig;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.GetCompletionsRequest`;static fields=U.util.newFieldList(()=>[{no:1,name:`metadata`,kind:`message`,T:$d},{no:2,name:`document`,kind:`message`,T:Op},{no:3,name:`editor_options`,kind:`message`,T:ef},{no:5,name:`other_documents`,kind:`message`,T:Op,repeated:!0},{no:7,name:`experiment_config`,kind:`message`,T:kp},{no:10,name:`model_name`,kind:`scalar`,T:9},{no:13,name:`multiline_config`,kind:`message`,T:bp}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Sp=class e extends z{state;completionItems=[];constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.GetCompletionsResponse`;static fields=U.util.newFieldList(()=>[{no:1,name:`state`,kind:`message`,T:Ap},{no:2,name:`completion_items`,kind:`message`,T:Pp,repeated:!0}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Cp=class e extends z{metadata;completionId=``;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.AcceptCompletionRequest`;static fields=U.util.newFieldList(()=>[{no:1,name:`metadata`,kind:`message`,T:$d},{no:2,name:`completion_id`,kind:`scalar`,T:9}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},wp=class e extends z{constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.AcceptCompletionResponse`;static fields=U.util.newFieldList(()=>[]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Tp=class e extends z{constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.GetAuthTokenRequest`;static fields=U.util.newFieldList(()=>[]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Ep=class e extends z{authToken=``;uuid=``;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.GetAuthTokenResponse`;static fields=U.util.newFieldList(()=>[{no:1,name:`auth_token`,kind:`scalar`,T:9},{no:2,name:`uuid`,kind:`scalar`,T:9}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Dp=class e extends z{row=B.zero;col=B.zero;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.DocumentPosition`;static fields=U.util.newFieldList(()=>[{no:1,name:`row`,kind:`scalar`,T:4},{no:2,name:`col`,kind:`scalar`,T:4}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Op=class e extends z{absolutePath=``;relativePath=``;text=``;editorLanguage=``;language=Zd.UNSPECIFIED;cursorOffset=B.zero;cursorPosition;lineEnding=``;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.Document`;static fields=U.util.newFieldList(()=>[{no:1,name:`absolute_path`,kind:`scalar`,T:9},{no:2,name:`relative_path`,kind:`scalar`,T:9},{no:3,name:`text`,kind:`scalar`,T:9},{no:4,name:`editor_language`,kind:`scalar`,T:9},{no:5,name:`language`,kind:`enum`,T:U.getEnumType(Zd)},{no:6,name:`cursor_offset`,kind:`scalar`,T:4},{no:8,name:`cursor_position`,kind:`message`,T:Dp},{no:7,name:`line_ending`,kind:`scalar`,T:9}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},kp=class e extends z{forceEnableExperiments=[];constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.ExperimentConfig`;static fields=U.util.newFieldList(()=>[{no:1,name:`force_enable_experiments`,kind:`enum`,T:U.getEnumType(qd),repeated:!0}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Ap=class e extends z{state=_p.UNSPECIFIED;message=``;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.State`;static fields=U.util.newFieldList(()=>[{no:1,name:`state`,kind:`enum`,T:U.getEnumType(_p)},{no:2,name:`message`,kind:`scalar`,T:9}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},jp=class e extends z{startOffset=B.zero;endOffset=B.zero;startPosition;endPosition;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.Range`;static fields=U.util.newFieldList(()=>[{no:1,name:`start_offset`,kind:`scalar`,T:4},{no:2,name:`end_offset`,kind:`scalar`,T:4},{no:3,name:`start_position`,kind:`message`,T:Dp},{no:4,name:`end_position`,kind:`message`,T:Dp}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Mp=class e extends z{text=``;deltaCursorOffset=B.zero;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.Suffix`;static fields=U.util.newFieldList(()=>[{no:1,name:`text`,kind:`scalar`,T:9},{no:2,name:`delta_cursor_offset`,kind:`scalar`,T:3}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Np=class e extends z{text=``;offset=B.zero;type=yp.UNSPECIFIED;prefix=``;line=B.zero;constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.CompletionPart`;static fields=U.util.newFieldList(()=>[{no:1,name:`text`,kind:`scalar`,T:9},{no:2,name:`offset`,kind:`scalar`,T:4},{no:3,name:`type`,kind:`enum`,T:U.getEnumType(yp)},{no:4,name:`prefix`,kind:`scalar`,T:9},{no:5,name:`line`,kind:`scalar`,T:4}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Pp=class e extends z{completion;suffix;range;source=Xd.UNSPECIFIED;completionParts=[];constructor(e){super(),U.util.initPartial(e,this)}static runtime=U;static typeName=`exa.language_server_pb.CompletionItem`;static fields=U.util.newFieldList(()=>[{no:1,name:`completion`,kind:`message`,T:Qd},{no:5,name:`suffix`,kind:`message`,T:Mp},{no:2,name:`range`,kind:`message`,T:jp},{no:3,name:`source`,kind:`enum`,T:U.getEnumType(Xd)},{no:8,name:`completion_parts`,kind:`message`,T:Np,repeated:!0}]);static fromBinary(t,n){return new e().fromBinary(t,n)}static fromJson(t,n){return new e().fromJson(t,n)}static fromJsonString(t,n){return new e().fromJsonString(t,n)}static equals(t,n){return U.util.equals(e,t,n)}},Fp={typeName:`exa.language_server_pb.LanguageServerService`,methods:{getCompletions:{name:`GetCompletions`,I:xp,O:Sp,kind:Gd.Unary},acceptCompletion:{name:`AcceptCompletion`,I:Cp,O:wp,kind:Gd.Unary},getAuthToken:{name:`GetAuthToken`,I:Tp,O:Ep,kind:Gd.Unary}}};function Ip(){try{new Headers}catch{throw Error(`connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.`)}}var Lp=function(e){return this instanceof Lp?(this.v=e,this):new Lp(e)},Rp=function(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof Lp?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}};function zp(e){Ip();let t=e.useBinaryFormat??!1;return{async unary(n,r,i,a,o,s,c){let{serialize:l,parse:u}=Uf(r,t,e.jsonOptions,e.binaryOptions);return a=a===void 0?e.defaultTimeoutMs:a<=0?void 0:a,await mp({interceptors:e.interceptors,signal:i,timeoutMs:a,req:{stream:!1,service:n,method:r,url:Rf(e.baseUrl,n,r),init:{method:`POST`,credentials:e.credentials??`same-origin`,redirect:`error`,mode:`cors`},header:lp(r.kind,t,a,o,!1),contextValues:c??Lf(),message:s},next:async i=>{let a=e.useHttpGet===!0&&r.idempotency===Kd.NoSideEffects,o=null;a?i=pp(i,l(i.message),t):o=l(i.message);let s=await(e.fetch??globalThis.fetch)(i.url,Object.assign(Object.assign({},i.init),{headers:i.header,signal:i.signal,body:o})),{isUnaryError:c,unaryError:d}=up(r.kind,t,s.status,s.headers);if(c)throw Qf(await s.json(),mf(...cp(s.headers)),d);let[f,p]=cp(s.headers);return{stream:!1,service:n,method:r,header:f,message:t?u(new Uint8Array(await s.arrayBuffer())):r.O.fromJson(await s.json(),Hf(e.jsonOptions)),trailer:p}}})},async stream(n,r,i,a,o,s,c){let{serialize:l,parse:u}=Uf(r,t,e.jsonOptions,e.binaryOptions);function d(e,t,n,r){return Rp(this,arguments,function*(){let i=gf(e).getReader(),a=!1;for(;;){let e=yield Lp(i.read());if(e.done)break;let{flags:r,data:o}=e.value;if((r&1)==1)throw new ff(`protocol error: received unsupported compressed output`,W.Internal);if((r&2)==2){a=!0;let e=$f(o);if(e.error){let t=e.error;throw n.forEach((e,n)=>{t.metadata.append(n,e)}),t}e.metadata.forEach((e,n)=>t.set(n,e));continue}yield yield Lp(u(o))}if(`throwIfAborted`in r&&r.throwIfAborted(),!a)throw`missing EndStreamResponse`})}async function f(e){if(r.kind!=Gd.ServerStreaming)throw`The fetch API does not support streaming request bodies`;let t=await e[Symbol.asyncIterator]().next();if(t.done==1)throw`missing request message`;return _f(0,l(t.value))}return a=a===void 0?e.defaultTimeoutMs:a<=0?void 0:a,await hp({interceptors:e.interceptors,timeoutMs:a,signal:i,req:{stream:!0,service:n,method:r,url:Rf(e.baseUrl,n,r),init:{method:`POST`,credentials:e.credentials??`same-origin`,redirect:`error`,mode:`cors`},header:lp(r.kind,t,a,o,!1),contextValues:c??Lf(),message:s},next:async n=>{let i=await(e.fetch??globalThis.fetch)(n.url,Object.assign(Object.assign({},n.init),{headers:n.header,signal:n.signal,body:await f(n.message)}));if(up(r.kind,t,i.status,i.headers),i.body===null)throw`missing response body`;let a=new Headers;return Object.assign(Object.assign({},n),{header:i.headers,trailer:a,message:d(i.body,a,i.headers,n.signal)})}})}}}var Bp=Of(Fp,zp({baseUrl:`https://web-backend.codeium.com`,useBinaryFormat:!0})),Vp;try{Vp=crypto.randomUUID()}catch{function e(){return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(+e^(crypto.getRandomValues(new Uint8Array(1))[0]??0)&15>>e/4).toString(16))}Vp=e()}async function Hp({text:e,cursorOffset:t,config:n,otherDocuments:r}){return await Bp.getCompletions({metadata:{ideName:`web`,ideVersion:`0.0.5`,extensionName:`@valtown/codemirror-codeium`,extensionVersion:`1.0.0`,apiKey:n.apiKey,sessionId:Vp,authSource:n.authSource},document:{text:e,cursorOffset:BigInt(t),language:n.language,editorLanguage:`typescript`,lineEnding:`
12
+ `},editorOptions:{tabSize:2n,insertSpaces:!0},otherDocuments:r,multilineConfig:void 0},{headers:{Authorization:`Basic ${n.apiKey}-${Vp}`}})}function Up(e){return e.completionItems.map(e=>{let t=0;return e.completionParts.filter(e=>e.type!==3).map(e=>{let n=Number(e.offset),r=e.type===2?`\n${e.text}`:e.text,i={absoluteStartPos:t+n,absoluteEndPos:t+n+r.length,from:n,to:n,insert:r};return t+=r.length,i})})}async function Wp(e,t){let n=e.state.facet(nf),{override:r}=e.state.facet(rf),i=await r(),a=e.state,o=a.selection.main.head,s=a.doc.toString();try{let r=await Hp({text:s,cursorOffset:o,config:n,otherDocuments:i});if(!r||r.completionItems.length===0||!((t===void 0||o===t)&&zi(e.state)!==`active`&&e.hasFocus))return;let c=Up(r),l=c.at(0);if(!l)return;let u=Fr.of(l,a.doc.length),d=u.invert(a.doc);e.dispatch({changes:u,effects:Ql.of({index:0,reverseChangeSet:d,changeSpecs:c}),annotations:[cf.of(null),sf.of(null),ui.addToHistory.of(!1)]})}catch(e){console.warn(`copilot completion failed`,e),await new Promise(e=>setTimeout(e,300))}}function Gp(e){return e.docChanged&&!e.transactions.some(e=>e.effects.some(e=>e.is($l)||e.is(eu)))}function Kp(e){if(!e.view.hasFocus||e.state.field(of)||zi(e.state)===`active`)return!0;for(let t of e.transactions)if(t.annotation(sf)!==void 0)return!0}function qp(){let e=null,t=0;return N.updateListener.of(n=>{let r=n.view.state.facet(nf);if(!r.alwaysOn||!Gp(n)||(e&&clearTimeout(e),Kp(n)))return;let i=n.state.selection.main.head;r.shouldComplete&&!r.shouldComplete(new Hi(n.view.state,i,!1))||(e=setTimeout(async()=>{i===t&&await Wp(n.view,t)},r.timeout),t=i)})}function Jp(e){let t=e.state.field(of);if(!t)return!1;let n=t.reverseChangeSet?.invert(e.state.doc);e.dispatch({changes:t.reverseChangeSet,effects:$l.of(null),annotations:[cf.of(null),sf.of(null),ui.addToHistory.of(!1)]});let r=0;return n?.iterChangedRanges((e,t,n,i)=>{r=i}),e.dispatch({changes:n,selection:ni.cursor(r),annotations:[sf.of(null),ui.addToHistory.of(!0)]}),!0}var Yp=e=>{let{state:t}=e,n=t.field(of);if(!n)return!1;let{changeSpecs:r}=n;if(r.length<2)return!1;let i=(n.index+1)%r.length,a=r.at(i);if(!a)return!1;let o=n.reverseChangeSet.apply(t.doc),s=Fr.of(n.reverseChangeSet,t.doc.length).compose(Fr.of(a,o.length)),c=Fr.of(a,o.length).invert(o);return e.dispatch({changes:s,effects:Ql.of({index:i,reverseChangeSet:c,changeSpecs:r}),annotations:[cf.of(null),sf.of(null),ui.addToHistory.of(!1)]}),!0};function Xp(e){let t=e.state.field(of);return t&&e.dispatch({changes:t.reverseChangeSet,effects:eu.of(null),annotations:[cf.of(null),sf.of(null),ui.addToHistory.of(!1)]}),!1}function Zp(e,t){return e.state.field(of)?t===`Tab`?Jp(e):Xp(e):!1}function Qp(e){let t=!1,n=e.state.selection.asSingle().ranges.at(0)?.head,r=e.state.field(of);return n!==void 0&&r?(r.decorations?.between(n,n,()=>{t=!0}),t):!1}function $p(){return N.domEventHandlers({keydown(e,t){return e.key===`]`&&e.ctrlKey?!1:e.key!==`Shift`&&e.key!==`Control`&&e.key!==`Alt`&&e.key!==`Meta`&&Zp(t,e.key)},mouseup(e,t){let n=e.target;return n.nodeName===`BUTTON`&&n.dataset.action===`codeium-cycle`?(Yp(t),e.stopPropagation(),e.preventDefault(),!0):Qp(t)?Jp(t):Xp(t)}})}function em(){return ti.of([{key:`Ctrl-]`,run:Yp}])}function tm(){return N.updateListener.of(e=>{e.focusChanged&&Xp(e.view)})}function nm(e){return[nf.of(e),of,gi.highest(em()),gi.highest(tm()),gi.high($p()),qp()]}function rm({response:e,prefix:t,suffix:n}){if(!e)return e;let r=e;return t&&r.startsWith(t)&&(r=r.slice(t.length)),n&&r.endsWith(n)&&(r=r.slice(0,-n.length)),r}var im=new Ur,am=rn.get(`@github/copilot-language-server`),om={delay:300,includeKeymap:!0,events:{shouldShowSuggestion:e=>e.hasFocus,beforeSuggestionFetch:e=>e.hasFocus}},sm=e=>{let t=[];return e.copilot===`codeium`&&e.codeium_api_key&&t.push(nm({apiKey:e.codeium_api_key,language:Zd.PYTHON}),rf.of({override:async()=>[{text:me(``),language:Zd.PYTHON,editorLanguage:`python`}]})),e.copilot===`github`&&t.push(Ac({...om,fetchFn:async(e,t,n)=>{let r=e.selection.main.head;if(!qt()||!n.hasFocus||e.doc.length===0)return``;await new Promise(e=>setTimeout(e,20));let i=e.doc.toString(),a=cm(e,me(i)),o=await $t().getCompletion(a);return r===n.state.selection.main.head?lm(o,a.position,e):(rn.debug(`ignoring response because of new position`),``)}})),e.copilot===`custom`&&t.push(Ac({...om,fetchFn:async(e,t,n)=>{let r=e.selection.main.head;if(e.doc.length===0||!n.hasFocus)return``;let i=e.doc.sliceString(0,e.selection.main.head),a=e.doc.sliceString(e.selection.main.head,e.doc.length);if(i.length===0)return``;let o=e.field(Ue).type,s=await Ta.post(`/ai/inline_completion`,{prefix:i,suffix:a,language:o});return r===n.state.selection.main.head?(s=rm({response:s,prefix:i,suffix:a}),s):(rn.debug(`ignoring response because of new position`),``)}})),[...t,gi.highest(ti.of([{key:`Escape`,run:e=>{let t=Dc(e);return!v(e)&&t}}])),im.of(Yt())]};function cm(e,t){let n=e.doc.toString(),r=t.split(`
13
13
  `).length-n.split(`
14
- `).length,i=um(e.doc,e.selection.main.head);return i.line+=r,{textDocument:{uri:`file://${Yt}`,version:`replace_me`},position:i,context:{triggerKind:lo.InlineCompletionTriggerKind.Automatic},formattingOptions:{tabSize:e.tabSize,insertSpaces:!0}}}function lm(e,t,n){if(!e)return am.debug(`No response from copilot`),``;let r=Array.isArray(e)?e[0]:e.items[0];if(!r)return am.debug(`No response from copilot`),``;let{insertText:i,range:a}=r,o=String(i);if(!a)return am.error(`No range from copilot`),o;let s=a.start.character-t.character,c=s<0?o.slice(-s):o,l=n.doc.sliceString(n.selection.main.head,n.doc.length);for(let e=0;e<c.length;e++){let t=c.slice(e);if(l.startsWith(t))return c.slice(0,e)}return c}function um(e,t){let n=e.lineAt(t);return{line:n.number-1,character:t-n.from}}function dm(e){return cn(`create`in e,`Expected query to have a "create" method`),e}var fm=fn({findText:``,replaceText:``,caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(e,t)=>{if(t===void 0)return e;switch(t.type){case`setFind`:return{...e,findText:t.find};case`setReplace`:return{...e,replaceText:t.replace};case`setCaseSensitive`:return{...e,caseSensitive:t.caseSensitive};case`setWholeWord`:return{...e,wholeWord:t.wholeWord};case`setRegex`:return{...e,regexp:t.regexp};case`setIsOpen`:return{...e,isOpen:t.isOpen};case`setCurrentView`:return{...e,currentView:{view:t.view,range:t.range}};case`clearCurrentView`:return{...e,currentView:void 0}}});function pm(e){if([...document.querySelectorAll(`[role="dialog"][data-state="open"]`)].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(e){let t=e.state.selection.main,n=e.state.sliceDoc(t.from,t.to);n?(o.set(fm,{type:`setFind`,find:n}),o.set(fm,{type:`setCurrentView`,view:e,range:{from:t.from,to:t.to}})):o.set(fm,{type:`setCurrentView`,view:e,range:{from:0,to:0}})}return o.get(fm).isOpen?(o.set(fm,{type:`setIsOpen`,isOpen:!1}),requestAnimationFrame(()=>{o.set(fm,{type:`setIsOpen`,isOpen:!0})}),!0):(o.set(fm,{type:`setIsOpen`,isOpen:!0}),!0)}function mm(){return o.get(fm).isOpen?(o.set(fm,{type:`setIsOpen`,isOpen:!1}),!0):!1}var hm=j.define();function gm(){let e=o.get(fm),t=pt();for(let n of t)n.state.readOnly||n.dispatch({effects:hm.of(new Di({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord}))})}function _m(){let e=pt();for(let t of e)t.state.readOnly||t.dispatch({effects:hm.of(new Di({search:``}))})}var vm=Zr.define({create(){let e=o.get(fm);return dm(new Di({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord})).create()},update(e,t){for(let n of t.effects)n.is(hm)&&(e=dm(n.value).create());return e}}),ym=M.mark({class:`cm-searchMatch`}),bm=M.mark({class:`cm-searchMatch cm-searchMatch-selected`}),xm=_i.fromClass(class{decorations;view;constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(vm))}update(e){let t=e.state.field(vm);(t!==e.startState.field(vm)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight(e){if(!e.spec.valid)return M.none;let{view:t}=this,n=new ii,r=t.visibleRanges,i=r.length;for(let a=0;a<i;a++){let{to:o}=r[a],{from:s}=r[a];for(;a<i-1&&o>r[a+1].from-500;)o=r[++a].to;e.highlight(t.state,s,o,(e,r)=>{let i=t.state.selection.ranges.some(t=>t.from===e&&t.to===r);n.add(e,r,i?bm:ym)})}return n.finish()}},{decorations:e=>e.decorations}),Sm=N.baseTheme({"&light .cm-searchMatch":{backgroundColor:`var(--cm-search-match-background-light)`},"&dark .cm-searchMatch":{backgroundColor:`var(--cm-search-match-background-dark)`},"&light .cm-searchMatch-selected":{backgroundColor:`transparent`},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`var(--cm-search-match-selected-background-dark) !important`}});function Cm(e){return[ei.of([{key:`Escape`,preventDefault:!1,run:mm},{key:e.getHotkey(`cell.selectNextOccurrence`).key,preventDefault:!0,run:Ti},{key:e.getHotkey(`cell.findAndReplace`).key,preventDefault:!0,run:pm}]),Oi(),xm,vm,Sm]}var wm=M.mark({class:`underline`}),Tm=j.define(),Em=j.define(),Dm=j.define(),Om=Zr.define({create(){return M.none},update(e,t){let n=e.map(t.changes);for(let r of t.effects)r.is(Tm)?n=e.update({add:[wm.range(r.value.from,r.value.to)]}):r.is(Em)?n=e.update({add:[D.range(r.value.from,r.value.to)]}):r.is(Dm)&&(n=M.none);return n},provide:e=>N.decorations.from(e)}),km=class{view;commandClickMode;hoveredRange;onClick;constructor(e,t){this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=t,window.addEventListener(`keydown`,this.keydown),window.addEventListener(`keyup`,this.keyup),window.addEventListener(`blur`,this.windowBlur),window.addEventListener(`mouseleave`,this.windowBlur)}update(e){}destroy(){window.removeEventListener(`keydown`,this.keydown),window.removeEventListener(`keyup`,this.keyup),window.removeEventListener(`blur`,this.windowBlur),window.removeEventListener(`mouseleave`,this.windowBlur),this.view.dom.removeEventListener(`mousemove`,this.mousemove),this.view.dom.removeEventListener(`click`,this.click)}keydown=e=>{(e.key===`Meta`||e.key===`Control`)&&(this.commandClickMode=!0,this.view.dom.addEventListener(`mousemove`,this.mousemove),this.view.dom.addEventListener(`click`,this.click))};keyup=e=>{(e.key===`Meta`||e.key===`Control`)&&this.exitCommandClickMode()};windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()};exitCommandClickMode(){this.commandClickMode=!1,this.view.dom.removeEventListener(`mousemove`,this.mousemove),this.view.dom.removeEventListener(`click`,this.click),this.clearUnderline()}mousemove=e=>{if(!e.metaKey&&!e.ctrlKey){this.exitCommandClickMode();return}if(!this.commandClickMode){this.clearUnderline();return}let t=this.view.posAtCoords({x:e.clientX,y:e.clientY});if(t==null){this.clearUnderline();return}let n=this.view.state.field(x,!1)?.ranges.find(e=>t>=e.from&&t<=e.to);if(n){let{from:e,to:r}=n;if(this.hoveredRange&&this.hoveredRange.from===e&&this.hoveredRange.to===r)return;this.clearUnderline(),this.hoveredRange={from:e,to:r,position:t},this.view.dispatch({effects:Em.of(this.hoveredRange)});return}let r=Vr(this.view.state).cursorAt(t);if(r.name===`VariableName`){let{from:e,to:n}=r;if(this.hoveredRange&&this.hoveredRange.from===e&&this.hoveredRange.to===n)return;this.clearUnderline(),this.hoveredRange={from:e,to:n,position:t},this.view.dispatch({effects:Tm.of(this.hoveredRange)})}else this.clearUnderline()};click=e=>{this.hoveredRange&&(e.preventDefault(),e.stopPropagation(),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}}),this.onClick(this.view))};clearUnderline(){this.hoveredRange&&=(this.view.dispatch({effects:Dm.of(null)}),null)}},Am=e=>_i.define(t=>new km(t,e));function jm(){return[Om,Am(e=>{vt(e)}),N.baseTheme({".underline":{textDecoration:`underline`,cursor:`pointer`,color:`var(--link)`}})]}function Mm(){return[N.domEventHandlers({drop:(e,t)=>{let n=e.dataTransfer?.files[0];if(n?.type.startsWith(`text/`))return e.preventDefault(),et(t,n),!0;if(n?.type.startsWith(`image/`))return e.preventDefault(),be(t,n),!0;let r=e.dataTransfer?.getData(`text/plain`);if(r){e.preventDefault();let n=t.posAtCoords({x:e.clientX,y:e.clientY});return n!==null&&t.dispatch({changes:{from:n,to:n,insert:r},scrollIntoView:!0}),!0}return!1},dragover:e=>{e.preventDefault()}})]}function Nm(){return[N.domEventHandlers({paste:(e,t)=>{let n=e.clipboardData?.getData(`text/plain`);if(!n||!Pm(n))return!1;let{setup:r,cells:i}=Fm(n);if(r===null&&i.length===0)return!1;let a=t.state.facet(d);return r!==null&&a.addOrAppendSetupCell(r),i.length>0&&a.createManyBelow(i),!0}})]}function Pm(e){return/@app\.cell|@app\.function|\bapp\.setup\b/.test(e)}function Fm(e){if(!Pm(e))return{setup:null,cells:[]};let t=[],n=[],r=Ki.parse(e),i=(t,n)=>{let r=e.lastIndexOf(`
14
+ `).length,i=um(e.doc,e.selection.main.head);return i.line+=r,{textDocument:{uri:`file://${en}`,version:`replace_me`},position:i,context:{triggerKind:lo.InlineCompletionTriggerKind.Automatic},formattingOptions:{tabSize:e.tabSize,insertSpaces:!0}}}function lm(e,t,n){if(!e)return am.debug(`No response from copilot`),``;let r=Array.isArray(e)?e[0]:e.items[0];if(!r)return am.debug(`No response from copilot`),``;let{insertText:i,range:a}=r,o=String(i);if(!a)return am.error(`No range from copilot`),o;let s=a.start.character-t.character,c=s<0?o.slice(-s):o,l=n.doc.sliceString(n.selection.main.head,n.doc.length);for(let e=0;e<c.length;e++){let t=c.slice(e);if(l.startsWith(t))return c.slice(0,e)}return c}function um(e,t){let n=e.lineAt(t);return{line:n.number-1,character:t-n.from}}function dm(e){return cn(`create`in e,`Expected query to have a "create" method`),e}var fm=fn({findText:``,replaceText:``,caseSensitive:!1,wholeWord:!1,regexp:!1,isOpen:!1,currentView:void 0},(e,t)=>{if(t===void 0)return e;switch(t.type){case`setFind`:return{...e,findText:t.find};case`setReplace`:return{...e,replaceText:t.replace};case`setCaseSensitive`:return{...e,caseSensitive:t.caseSensitive};case`setWholeWord`:return{...e,wholeWord:t.wholeWord};case`setRegex`:return{...e,regexp:t.regexp};case`setIsOpen`:return{...e,isOpen:t.isOpen};case`setCurrentView`:return{...e,currentView:{view:t.view,range:t.range}};case`clearCurrentView`:return{...e,currentView:void 0}}});function pm(e){if([...document.querySelectorAll(`[role="dialog"][data-state="open"]`)].some(e=>e instanceof HTMLElement&&e.childNodes.length>0))return!1;if(e){let t=e.state.selection.main,n=e.state.sliceDoc(t.from,t.to);n?(o.set(fm,{type:`setFind`,find:n}),o.set(fm,{type:`setCurrentView`,view:e,range:{from:t.from,to:t.to}})):o.set(fm,{type:`setCurrentView`,view:e,range:{from:0,to:0}})}return o.get(fm).isOpen?(o.set(fm,{type:`setIsOpen`,isOpen:!1}),requestAnimationFrame(()=>{o.set(fm,{type:`setIsOpen`,isOpen:!0})}),!0):(o.set(fm,{type:`setIsOpen`,isOpen:!0}),!0)}function mm(){return o.get(fm).isOpen?(o.set(fm,{type:`setIsOpen`,isOpen:!1}),!0):!1}var hm=j.define();function gm(){let e=o.get(fm),t=pt();for(let n of t)n.state.readOnly||n.dispatch({effects:hm.of(new Oi({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord}))})}function _m(){let e=pt();for(let t of e)t.state.readOnly||t.dispatch({effects:hm.of(new Oi({search:``}))})}var vm=Qr.define({create(){let e=o.get(fm);return dm(new Oi({search:e.findText,caseSensitive:e.caseSensitive,regexp:e.regexp,replace:e.replaceText,wholeWord:e.wholeWord})).create()},update(e,t){for(let n of t.effects)n.is(hm)&&(e=dm(n.value).create());return e}}),ym=M.mark({class:`cm-searchMatch`}),bm=M.mark({class:`cm-searchMatch cm-searchMatch-selected`}),xm=vi.fromClass(class{decorations;view;constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(vm))}update(e){let t=e.state.field(vm);(t!==e.startState.field(vm)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight(e){if(!e.spec.valid)return M.none;let{view:t}=this,n=new ai,r=t.visibleRanges,i=r.length;for(let a=0;a<i;a++){let{to:o}=r[a],{from:s}=r[a];for(;a<i-1&&o>r[a+1].from-500;)o=r[++a].to;e.highlight(t.state,s,o,(e,r)=>{let i=t.state.selection.ranges.some(t=>t.from===e&&t.to===r);n.add(e,r,i?bm:ym)})}return n.finish()}},{decorations:e=>e.decorations}),Sm=N.baseTheme({"&light .cm-searchMatch":{backgroundColor:`var(--cm-search-match-background-light)`},"&dark .cm-searchMatch":{backgroundColor:`var(--cm-search-match-background-dark)`},"&light .cm-searchMatch-selected":{backgroundColor:`transparent`},"&dark .cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`var(--cm-search-match-selected-background-dark) !important`}});function Cm(e){return[ti.of([{key:`Escape`,preventDefault:!1,run:mm},{key:e.getHotkey(`cell.selectNextOccurrence`).key,preventDefault:!0,run:Ei},{key:e.getHotkey(`cell.findAndReplace`).key,preventDefault:!0,run:pm}]),ki(),xm,vm,Sm]}var wm=M.mark({class:`underline`}),Tm=j.define(),Em=j.define(),Dm=j.define(),Om=Qr.define({create(){return M.none},update(e,t){let n=e.map(t.changes);for(let r of t.effects)r.is(Tm)?n=e.update({add:[wm.range(r.value.from,r.value.to)]}):r.is(Em)?n=e.update({add:[D.range(r.value.from,r.value.to)]}):r.is(Dm)&&(n=M.none);return n},provide:e=>N.decorations.from(e)}),km=class{view;commandClickMode;hoveredRange;onClick;constructor(e,t){this.view=e,this.commandClickMode=!1,this.hoveredRange=null,this.onClick=t,window.addEventListener(`keydown`,this.keydown),window.addEventListener(`keyup`,this.keyup),window.addEventListener(`blur`,this.windowBlur),window.addEventListener(`mouseleave`,this.windowBlur)}update(e){}destroy(){window.removeEventListener(`keydown`,this.keydown),window.removeEventListener(`keyup`,this.keyup),window.removeEventListener(`blur`,this.windowBlur),window.removeEventListener(`mouseleave`,this.windowBlur),this.view.dom.removeEventListener(`mousemove`,this.mousemove),this.view.dom.removeEventListener(`click`,this.click)}keydown=e=>{(e.key===`Meta`||e.key===`Control`)&&(this.commandClickMode=!0,this.view.dom.addEventListener(`mousemove`,this.mousemove),this.view.dom.addEventListener(`click`,this.click))};keyup=e=>{(e.key===`Meta`||e.key===`Control`)&&this.exitCommandClickMode()};windowBlur=()=>{this.commandClickMode&&this.exitCommandClickMode()};exitCommandClickMode(){this.commandClickMode=!1,this.view.dom.removeEventListener(`mousemove`,this.mousemove),this.view.dom.removeEventListener(`click`,this.click),this.clearUnderline()}mousemove=e=>{if(!e.metaKey&&!e.ctrlKey){this.exitCommandClickMode();return}if(!this.commandClickMode){this.clearUnderline();return}let t=this.view.posAtCoords({x:e.clientX,y:e.clientY});if(t==null){this.clearUnderline();return}let n=this.view.state.field(x,!1)?.ranges.find(e=>t>=e.from&&t<=e.to);if(n){let{from:e,to:r}=n;if(this.hoveredRange&&this.hoveredRange.from===e&&this.hoveredRange.to===r)return;this.clearUnderline(),this.hoveredRange={from:e,to:r,position:t},this.view.dispatch({effects:Em.of(this.hoveredRange)});return}let r=Hr(this.view.state).cursorAt(t);if(r.name===`VariableName`){let{from:e,to:n}=r;if(this.hoveredRange&&this.hoveredRange.from===e&&this.hoveredRange.to===n)return;this.clearUnderline(),this.hoveredRange={from:e,to:n,position:t},this.view.dispatch({effects:Tm.of(this.hoveredRange)})}else this.clearUnderline()};click=e=>{this.hoveredRange&&(e.preventDefault(),e.stopPropagation(),this.view.dispatch({selection:{head:this.hoveredRange.position,anchor:this.hoveredRange.position}}),this.onClick(this.view))};clearUnderline(){this.hoveredRange&&=(this.view.dispatch({effects:Dm.of(null)}),null)}},Am=e=>vi.define(t=>new km(t,e));function jm(){return[Om,Am(e=>{vt(e)}),N.baseTheme({".underline":{textDecoration:`underline`,cursor:`pointer`,color:`var(--link)`}})]}function Mm(){return[N.domEventHandlers({drop:(e,t)=>{let n=e.dataTransfer?.files[0];if(n?.type.startsWith(`text/`))return e.preventDefault(),et(t,n),!0;if(n?.type.startsWith(`image/`))return e.preventDefault(),be(t,n),!0;let r=e.dataTransfer?.getData(`text/plain`);if(r){e.preventDefault();let n=t.posAtCoords({x:e.clientX,y:e.clientY});return n!==null&&t.dispatch({changes:{from:n,to:n,insert:r},scrollIntoView:!0}),!0}return!1},dragover:e=>{e.preventDefault()}})]}function Nm(){return[N.domEventHandlers({paste:(e,t)=>{let n=e.clipboardData?.getData(`text/plain`);if(!n||!Pm(n))return!1;let{setup:r,cells:i}=Fm(n);if(r===null&&i.length===0)return!1;let a=t.state.facet(d);return r!==null&&a.addOrAppendSetupCell(r),i.length>0&&a.createManyBelow(i),!0}})]}function Pm(e){return/@app\.cell|@app\.function|\bapp\.setup\b/.test(e)}function Fm(e){if(!Pm(e))return{setup:null,cells:[]};let t=[],n=[],r=qi.parse(e),i=(t,n)=>{let r=e.lastIndexOf(`
15
15
  `,t-1)+1;return Im(e.slice(r,n))},a=(e,n)=>{let r=i(e,n);r.trim()&&t.push(r)},o=(e,t)=>{let n=[];for(let t=e.firstChild;t;t=t.nextSibling)t.name!==`:`&&n.push(t);t&&n.at(-1)?.name===`ReturnStatement`&&n.pop();let r=n[0],a=n.at(-1);if(!r||!a)return null;let o=i(r.from,a.to);return o.trim()?o:null};return r.iterate({enter:r=>{if(r.name===`WithStatement`){let t=r.node.getChild(`Body`);if(t&&e.slice(r.from,t.from).includes(`app.setup`)){let e=o(t,!1);e!==null&&n.push(e)}return!1}if(r.name!==`DecoratedStatement`)return!0;let i=r.node.getChild(`Decorator`),s=r.node.getChild(`FunctionDefinition`);if(!i||!s)return!1;let c=e.slice(i.from,i.to).trim();if(c.startsWith(`@app.cell`)){let e=s.getChild(`Body`);if(e){let n=o(e,!0);n!==null&&t.push(n)}return!1}return c.startsWith(`@app.function`)&&a(s.from,s.to),!1}}),{setup:n.length>0?n.join(`
16
16
 
17
17
  `):null,cells:t}}function Im(e){let t=e.split(`
18
18
  `);if(t.length===0)return``;let n=t.filter(e=>e.trim().length>0);if(n.length===0)return``;let r=/^\s*/,i=Math.min(...n.map(e=>e.match(r)?.[0].length??1/0));return i===0?e.trim():t.map(e=>e.slice(i)).join(`
19
- `).trim()}function Lm(e,t,n,r){return r!==`{`||t!==n||!Vr(e.state).resolveInner(t,-1)?.type.name.includes(`String`)?!1:(e.dispatch({changes:{from:t,to:n,insert:`{}`},selection:{anchor:t+1},userEvent:`input.type`}),!0)}function Rm(){return N.inputHandler.of(Lm)}function zm(e){let{showPlaceholder:t,enableAI:n}=e;return t?`marimo-import`:n?`ai`:`none`}var Bm=`cm-tooltip-portal`;function Vm(e){if(e==null)return document.querySelector(`#App`)??void 0;let t=document.querySelector(e);if(t==null)return;let n=t.querySelector(`:scope > .${Bm}`);if(n!=null)return n;let r=document.createElement(`div`);return r.className=`${Bm} not-prose contents`,t.append(r),r}var Hm=e=>{let{cellId:t,keymapConfig:n,hotkeys:r,enableAI:i,cellActions:a,completionConfig:o,lspConfig:s,diagnosticsConfig:c,displayConfig:l,inlineAiTooltip:u}=e,d=zm(e);return[Zt(n,r),Mm(),Nm(),Jl(),Re({cellId:t,completionConfig:o,hotkeys:r,placeholderType:d,lspConfig:s,diagnosticsConfig:c}),Ye({cellId:t,hotkeys:r,cellActions:a,keymapConfig:n}),Wm(e),jm(),c?.enabled?Ei():[],i&&u?[zc({prompt:e=>ol({prompt:e.prompt,selection:e.selection,codeBefore:e.codeBefore,codeAfter:e.codeAfter,language:at(e.editorView)})}),Nc.of({hideOnBlur:!0})]:[],re(t,l.reference_highlighting??!0),Gl(t,l.code_lens??!0)]},Um=e=>{let{from:t,to:n}=e.state.selection.main;if(t!==n)return!1;let r=e.state.doc.lineAt(n);return r.text.slice(0,n-r.from).trim()!==``&&Ii(e)},Wm=e=>{let{theme:t,hotkeys:n,completionConfig:r,acceptCompletionOnEnter:i,cellId:a,lspConfig:o,diagnosticsConfig:s,tooltipParentSelector:c}=e,l=zm(e),u=r.auto_close_pairs!==!1;return[N.lineWrapping,di(),ui(),yi(),$r(),Fr(),Ir(),Nr(),zr({position:`fixed`,parent:Vm(c)}),Qe(),t===`dark`?Aa:va,qe(o),sm(r),vi(),Rm(),u?Li():[],Zl(i),u?hi.high(ei.of(Ni)):[],pi(),Yr(),Ur.of(` `),ni(ai,{fallback:!0}),ei.of(Lr),rt({placeholderType:l,completionConfig:r,hotkeys:n,cellId:a,lspConfig:{...o,diagnostics:s}}),He.of(wi()),ri.allowMultipleSelections.of(!0),Cm(n),ei.of([{key:`Tab`,run:e=>zi(e)||Um(e)||xi(e),preventDefault:!0},{key:n.getHotkey(`completion.moveDown`).key,run:e=>Ri(e.state)!==null&&(Fi(!0)(e),!0),preventDefault:!0},{key:n.getHotkey(`completion.moveUp`).key,run:e=>Ri(e.state)!==null&&(Fi(!1)(e),!0),preventDefault:!0}]),ei.of([...ki,Ci])]},G;function Gm(e){G=e}var K=Array(128).fill(void 0);K.push(void 0,null,!0,!1);function q(e){return K[e]}var J=0,Km=null;function qm(){return(Km===null||Km.byteLength===0)&&(Km=new Uint8Array(G.memory.buffer)),Km}var Jm=new(typeof TextEncoder>`u`?(0,module.require)(`util`).TextEncoder:TextEncoder)(`utf-8`),Ym=typeof Jm.encodeInto==`function`?function(e,t){return Jm.encodeInto(e,t)}:function(e,t){let n=Jm.encode(e);return t.set(n),{read:e.length,written:n.length}};function Y(e,t,n){if(n===void 0){let n=Jm.encode(e),r=t(n.length,1)>>>0;return qm().subarray(r,r+n.length).set(n),J=n.length,r}let r=e.length,i=t(r,1)>>>0,a=qm(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=qm().subarray(i+o,i+r),a=Ym(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return J=o,i}var Xm=null;function X(){return(Xm===null||Xm.buffer.detached===!0||Xm.buffer.detached===void 0&&Xm.buffer!==G.memory.buffer)&&(Xm=new DataView(G.memory.buffer)),Xm}var Zm=K.length;function Z(e){Zm===K.length&&K.push(K.length+1);let t=Zm;return Zm=K[t],K[t]=e,t}function Qm(e,t){try{return e.apply(this,t)}catch(e){G.__wbindgen_exn_store(Z(e))}}var $m=new(typeof TextDecoder>`u`?(0,module.require)(`util`).TextDecoder:TextDecoder)(`utf-8`,{ignoreBOM:!0,fatal:!0});$m.decode();function Q(e,t){return e>>>=0,$m.decode(qm().subarray(e,e+t))}function eh(e){e<132||(K[e]=Zm,Zm=e)}function $(e){let t=q(e);return eh(e),t}function th(e){return e==null}var nh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>{G.__wbindgen_export_4.get(e.dtor)(e.a,e.b)});function rh(e,t,n,r){let i={a:e,b:t,cnt:1,dtor:n},a=(...e)=>{i.cnt++;let t=i.a;i.a=0;try{return r(t,i.b,...e)}finally{--i.cnt===0?(G.__wbindgen_export_4.get(i.dtor)(t,i.b),nh.unregister(i)):i.a=t}};return a.original=i,nh.register(a,i,i),a}function ih(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=ih(e[0]));for(let r=1;r<t;r++)n+=`, `+ih(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}function ah(){let e,t;try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.LORO_VERSION(i);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);return e=n,t=r,Q(n,r)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(e,t,1)}}function oh(e,t){let n=t(e.length*1,1)>>>0;return qm().set(e,n/1),J=e.length,n}function sh(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=oh(e,G.__wbindgen_malloc),o=J;G.decodeImportBlobMeta(i,a,o,t);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}function ch(){G.callPendingEvents()}function lh(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.redactJsonUpdates(i,Z(e),Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}function uh(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;return G.isValidContainerId(t,n)!==0}function dh(){G.run()}function fh(e,t){let n=t(e.length*4,4)>>>0,r=X();for(let t=0;t<e.length;t++)r.setUint32(n+4*t,Z(e[t]),!0);return J=e.length,n}function ph(e,t){return e>>>=0,qm().subarray(e/1,e/1+t)}function mh(e){try{let a=G.__wbindgen_add_to_stack_pointer(-16),o=fh(e,G.__wbindgen_malloc),s=J;G.encodeFrontiers(a,o,s);var t=X().getInt32(a+0,!0),n=X().getInt32(a+4,!0),r=X().getInt32(a+8,!0);if(X().getInt32(a+12,!0))throw $(r);var i=ph(t,n).slice();return G.__wbindgen_free(t,n*1,1),i}finally{G.__wbindgen_add_to_stack_pointer(16)}}function hh(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=oh(e,G.__wbindgen_malloc),a=J;G.decodeFrontiers(r,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}function gh(){G.setDebug()}var _h=128;function vh(e){if(_h==1)throw Error(`out of js stack`);return K[--_h]=e,_h}function yh(e,t){if(!(e instanceof t))throw Error(`expected instance of ${t.name}`)}function bh(e,t){e>>>=0;let n=X(),r=[];for(let i=e;i<e+4*t;i+=4)r.push($(n.getUint32(i,!0)));return r}function xh(e,t,n){G._dyn_core_9b3796e30d99ddb7___ops__function__FnMut_______Output______as_wasm_bindgen_c71729c74976bed3___closure__WasmClosure___describe__invoke___wasm_bindgen_c71729c74976bed3___JsValue_____(e,t,Z(n))}function Sh(e,t){G._dyn_core_9b3796e30d99ddb7___ops__function__FnMut_____Output______as_wasm_bindgen_c71729c74976bed3___closure__WasmClosure___describe__invoke______(e,t)}var Ch=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_awarenesswasm_free(e>>>0,1)),wh=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ch.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_awarenesswasm_free(e,0)}getAllStates(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_getAllStates(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getTimestamp(e){try{let i=G.__wbindgen_add_to_stack_pointer(-32);G.awarenesswasm_getTimestamp(i,this.__wbg_ptr,Z(e));var t=X().getInt32(i+0,!0),n=X().getFloat64(i+8,!0),r=X().getInt32(i+16,!0);if(X().getInt32(i+20,!0))throw $(r);return t===0?void 0:n}finally{G.__wbindgen_add_to_stack_pointer(32)}}setLocalState(e){G.awarenesswasm_setLocalState(this.__wbg_ptr,Z(e))}removeOutdated(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_removeOutdated(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}constructor(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_new(i,Z(e),t);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return this.__wbg_ptr=n>>>0,Ch.register(this,this.__wbg_ptr,this),this}finally{G.__wbindgen_add_to_stack_pointer(16)}}peer(){return $(G.awarenesswasm_peer(this.__wbg_ptr))}apply(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=oh(e,G.__wbindgen_malloc),a=J;G.awarenesswasm_apply(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}peers(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_peers(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}encode(e){try{let a=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_encode(a,this.__wbg_ptr,Z(e));var t=X().getInt32(a+0,!0),n=X().getInt32(a+4,!0),r=X().getInt32(a+8,!0);if(X().getInt32(a+12,!0))throw $(r);var i=ph(t,n).slice();return G.__wbindgen_free(t,n*1,1),i}finally{G.__wbindgen_add_to_stack_pointer(16)}}length(){return G.awarenesswasm_length(this.__wbg_ptr)}isEmpty(){return G.awarenesswasm_isEmpty(this.__wbg_ptr)!==0}getState(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_getState(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_encodeAll(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=ph(e,t).slice();return G.__wbindgen_free(e,t*1,1),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}},Th=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_changemodifier_free(e>>>0,1)),Eh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Th.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Th.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_changemodifier_free(e,0)}setMessage(t){let n=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),r=J,i=G.changemodifier_setMessage(this.__wbg_ptr,n,r);return e.__wrap(i)}setTimestamp(t){let n=G.changemodifier_setTimestamp(this.__wbg_ptr,t);return e.__wrap(n)}},Dh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_cursor_free(e>>>0,1)),Oh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Dh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Dh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_cursor_free(e,0)}containerId(){return $(G.cursor_containerId(this.__wbg_ptr))}pos(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.cursor_pos(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}kind(){return $(G.cursor_kind(this.__wbg_ptr))}side(){return $(G.cursor_side(this.__wbg_ptr))}static decode(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=oh(t,G.__wbindgen_malloc),o=J;G.cursor_decode(i,a,o);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}encode(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.cursor_encode(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=ph(e,t).slice();return G.__wbindgen_free(e,t*1,1),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}},kh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_ephemeralstorewasm_free(e>>>0,1)),Ah=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,kh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_ephemeralstorewasm_free(e,0)}getAllStates(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.ephemeralstorewasm_getAllStates(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}removeOutdated(){G.ephemeralstorewasm_removeOutdated(this.__wbg_ptr)}subscribeLocalUpdates(e){return $(G.ephemeralstorewasm_subscribeLocalUpdates(this.__wbg_ptr,Z(e)))}get(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;return $(G.ephemeralstorewasm_get(this.__wbg_ptr,t,n))}constructor(e){let t=G.ephemeralstorewasm_new(e);return this.__wbg_ptr=t>>>0,kh.register(this,this.__wbg_ptr,this),this}set(e,t){let n=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),r=J;G.ephemeralstorewasm_set(this.__wbg_ptr,n,r,Z(t))}keys(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.ephemeralstorewasm_keys(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}apply(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16),r=oh(e,G.__wbindgen_malloc),i=J;G.ephemeralstorewasm_apply(n,this.__wbg_ptr,r,i);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}delete(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;G.ephemeralstorewasm_delete(this.__wbg_ptr,t,n)}encode(e){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.ephemeralstorewasm_encode(i,this.__wbg_ptr,a,o);var t=X().getInt32(i+0,!0),n=X().getInt32(i+4,!0),r=ph(t,n).slice();return G.__wbindgen_free(t,n*1,1),r}finally{G.__wbindgen_add_to_stack_pointer(16)}}isEmpty(){return G.ephemeralstorewasm_isEmpty(this.__wbg_ptr)!==0}encodeAll(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.ephemeralstorewasm_encodeAll(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=ph(e,t).slice();return G.__wbindgen_free(e,t*1,1),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){return $(G.ephemeralstorewasm_subscribe(this.__wbg_ptr,Z(e)))}},jh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorocounter_free(e>>>0,1)),Mh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,jh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,jh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorocounter_free(e,0)}isAttached(){return G.lorocounter_isAttached(this.__wbg_ptr)!==0}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_getShallowValue(n,this.__wbg_ptr);var e=X().getFloat64(n+0,!0),t=X().getInt32(n+8,!0);if(X().getInt32(n+12,!0))throw $(t);return e}finally{G.__wbindgen_add_to_stack_pointer(16)}}get id(){return $(G.lorocounter_id(this.__wbg_ptr))}constructor(){let e=G.lorocounter_new();return this.__wbg_ptr=e>>>0,jh.register(this,this.__wbg_ptr,this),this}kind(){return $(G.lorocounter_kind(this.__wbg_ptr))}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_getShallowValue(n,this.__wbg_ptr);var e=X().getFloat64(n+0,!0),t=X().getInt32(n+8,!0);if(X().getInt32(n+12,!0))throw $(t);return e}finally{G.__wbindgen_add_to_stack_pointer(16)}}decrement(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_decrement(n,this.__wbg_ptr,e);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get value(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_getShallowValue(n,this.__wbg_ptr);var e=X().getFloat64(n+0,!0),t=X().getInt32(n+8,!0);if(X().getInt32(n+12,!0))throw $(t);return e}finally{G.__wbindgen_add_to_stack_pointer(16)}}increment(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_increment(n,this.__wbg_ptr,e);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},Nh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorodoc_free(e>>>0,1)),Ph=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Nh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Nh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorodoc_free(e,0)}applyDiff(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_applyDiff(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isShallow(){return G.lorodoc_isShallow(this.__wbg_ptr)!==0}changeCount(){return G.lorodoc_changeCount(this.__wbg_ptr)>>>0}getByPath(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorodoc_getByPath(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getCounter(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getCounter(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Mh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}isDetached(){return G.lorodoc_isDetached(this.__wbg_ptr)!==0}get peerIdStr(){return $(G.lorodoc_peerIdStr(this.__wbg_ptr))}setPeerId(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_setPeerId(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getCursorPos(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);yh(e,Oh),G.lorodoc_getCursorPos(r,this.__wbg_ptr,e.__wbg_ptr);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}hasContainer(e){return G.lorodoc_hasContainer(this.__wbg_ptr,Z(e))!==0}importBatch(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_importBatch(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}cmpFrontiers(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=fh(e,G.__wbindgen_malloc),o=J,s=fh(t,G.__wbindgen_malloc),c=J;G.lorodoc_cmpFrontiers(i,this.__wbg_ptr,a,o,s,c);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}debugHistory(){G.lorodoc_debugHistory(this.__wbg_ptr)}static fromSnapshot(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=oh(t,G.__wbindgen_malloc),o=J;G.lorodoc_fromSnapshot(i,a,o);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getChangeAt(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getChangeAt(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}oplogVersion(){let e=G.lorodoc_oplogVersion(this.__wbg_ptr);return Xh.__wrap(e)}getMovableList(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getMovableList(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Bh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}frontiersToVV(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=fh(e,G.__wbindgen_malloc),a=J;G.lorodoc_frontiersToVV(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Xh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getAllChanges(){return $(G.lorodoc_getAllChanges(this.__wbg_ptr))}oplogFrontiers(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_oplogFrontiers(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}vvToFrontiers(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);yh(e,Xh),G.lorodoc_vvToFrontiers(r,this.__wbg_ptr,e.__wbg_ptr);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}shallowSinceVV(){let e=G.lorodoc_shallowSinceVV(this.__wbg_ptr);return Xh.__wrap(e)}configTextStyle(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_configTextStyle(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getOpsInChange(e){try{let a=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getOpsInChange(a,this.__wbg_ptr,Z(e));var t=X().getInt32(a+0,!0),n=X().getInt32(a+4,!0),r=X().getInt32(a+8,!0);if(X().getInt32(a+12,!0))throw $(r);var i=bh(t,n).slice();return G.__wbindgen_free(t,n*4,4),i}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getShallowValue(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}checkoutToLatest(){try{let t=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_checkoutToLatest(t,this.__wbg_ptr);var e=X().getInt32(t+0,!0);if(X().getInt32(t+4,!0))throw $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}cmpWithFrontiers(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=fh(e,G.__wbindgen_malloc),a=J;G.lorodoc_cmpWithFrontiers(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return t}finally{G.__wbindgen_add_to_stack_pointer(16)}}exportJsonInIdSpan(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_exportJsonInIdSpan(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}subscribeJsonpath(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.lorodoc_subscribeJsonpath(i,this.__wbg_ptr,a,o,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}deleteRootContainer(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_deleteRootContainer(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}exportJsonUpdates(e,t,n){try{let a=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_exportJsonUpdates(a,this.__wbg_ptr,Z(e),Z(t),th(n)?16777215:+!!n);var r=X().getInt32(a+0,!0),i=X().getInt32(a+4,!0);if(X().getInt32(a+8,!0))throw $(i);return $(r)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getContainerById(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getContainerById(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getPendingTxnLength(){return G.lorodoc_getPendingTxnLength(this.__wbg_ptr)>>>0}importJsonUpdates(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_importJsonUpdates(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}importUpdateBatch(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_importBatch(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}setDetachedEditing(e){G.lorodoc_setDetachedEditing(this.__wbg_ptr,e)}setRecordTimestamp(e){G.lorodoc_setRecordTimestamp(this.__wbg_ptr,e)}subscribePreCommit(e){return $(G.lorodoc_subscribePreCommit(this.__wbg_ptr,Z(e)))}findIdSpansBetween(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=fh(e,G.__wbindgen_malloc),o=J,s=fh(t,G.__wbindgen_malloc),c=J;G.lorodoc_findIdSpansBetween(i,this.__wbg_ptr,a,o,s,c);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getChangeAtLamport(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.lorodoc_getChangeAtLamport(i,this.__wbg_ptr,a,o,t);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getPathToContainer(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getPathToContainer(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getChangedContainersIn(e,t){try{let o=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getChangedContainersIn(o,this.__wbg_ptr,Z(e),t);var n=X().getInt32(o+0,!0),r=X().getInt32(o+4,!0),i=X().getInt32(o+8,!0);if(X().getInt32(o+12,!0))throw $(i);var a=bh(n,r).slice();return G.__wbindgen_free(n,r*4,4),a}finally{G.__wbindgen_add_to_stack_pointer(16)}}getDeepValueWithID(){return $(G.lorodoc_getDeepValueWithID(this.__wbg_ptr))}setNextCommitOrigin(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;G.lorodoc_setNextCommitOrigin(this.__wbg_ptr,t,n)}getUncommittedOpsAsJson(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getUncommittedOpsAsJson(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}setNextCommitMessage(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;G.lorodoc_setNextCommitMessage(this.__wbg_ptr,t,n)}setNextCommitOptions(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_setNextCommitOptions(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}shallowSinceFrontiers(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_shallowSinceFrontiers(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}subscribeLocalUpdates(e){return $(G.lorodoc_subscribeLocalUpdates(this.__wbg_ptr,Z(e)))}travelChangeAncestors(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=fh(e,G.__wbindgen_malloc),a=J;G.lorodoc_travelChangeAncestors(r,this.__wbg_ptr,i,a,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}clearNextCommitOptions(){G.lorodoc_clearNextCommitOptions(this.__wbg_ptr)}configDefaultTextStyle(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_configDefaultTextStyle(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}setChangeMergeInterval(e){G.lorodoc_setChangeMergeInterval(this.__wbg_ptr,e)}setNextCommitTimestamp(e){G.lorodoc_setNextCommitTimestamp(this.__wbg_ptr,e)}setHideEmptyRootContainers(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_setHideEmptyRootContainers(n,this.__wbg_ptr,e);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDetachedEditingEnabled(){return G.lorodoc_isDetachedEditingEnabled(this.__wbg_ptr)!==0}subscribeFirstCommitFromPeer(e){return $(G.lorodoc_subscribeFirstCommitFromPeer(this.__wbg_ptr,Z(e)))}constructor(){let e=G.lorodoc_new();return this.__wbg_ptr=e>>>0,Nh.register(this,this.__wbg_ptr,this),this}diff(e,t,n){try{let a=G.__wbindgen_add_to_stack_pointer(-16),o=fh(e,G.__wbindgen_malloc),s=J,c=fh(t,G.__wbindgen_malloc),l=J;G.lorodoc_diff(a,this.__wbg_ptr,o,s,c,l,th(n)?16777215:+!!n);var r=X().getInt32(a+0,!0),i=X().getInt32(a+4,!0);if(X().getInt32(a+8,!0))throw $(i);return $(r)}finally{G.__wbindgen_add_to_stack_pointer(16)}}fork(){let t=G.lorodoc_fork(this.__wbg_ptr);return e.__wrap(t)}attach(){G.lorodoc_attach(this.__wbg_ptr)}commit(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_commit(n,this.__wbg_ptr,th(e)?0:Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}detach(){G.lorodoc_detach(this.__wbg_ptr)}export(e){try{let a=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_export(a,this.__wbg_ptr,Z(e));var t=X().getInt32(a+0,!0),n=X().getInt32(a+4,!0),r=X().getInt32(a+8,!0);if(X().getInt32(a+12,!0))throw $(r);var i=ph(t,n).slice();return G.__wbindgen_free(t,n*1,1),i}finally{G.__wbindgen_add_to_stack_pointer(16)}}import(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=oh(e,G.__wbindgen_malloc),a=J;G.lorodoc_import(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}forkAt(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=fh(t,G.__wbindgen_malloc),o=J;G.lorodoc_forkAt(i,this.__wbg_ptr,a,o);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getMap(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getMap(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Rh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}opCount(){return G.lorodoc_opCount(this.__wbg_ptr)>>>0}get peerId(){let e=G.lorodoc_peerId(this.__wbg_ptr);return BigInt.asUintN(64,e)}toJSON(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_toJSON(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}version(){let e=G.lorodoc_version(this.__wbg_ptr);return Xh.__wrap(e)}checkout(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16),r=fh(e,G.__wbindgen_malloc),i=J;G.lorodoc_checkout(n,this.__wbg_ptr,r,i);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getList(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getList(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Ih.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}getText(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getText(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Hh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}getTree(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getTree(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Wh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}frontiers(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_frontiers(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}JSONPath(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorodoc_JSONPath(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}revertTo(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16),r=fh(e,G.__wbindgen_malloc),i=J;G.lorodoc_revertTo(n,this.__wbg_ptr,r,i);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){return $(G.lorodoc_subscribe(this.__wbg_ptr,Z(e)))}},Fh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorolist_free(e>>>0,1)),Ih=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Fh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Fh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorolist_free(e,0)}isAttached(){return G.lorolist_isAttached(this.__wbg_ptr)!==0}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_pushContainer(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}insertContainer(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_insertContainer(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){return $(G.lorolist_getShallowValue(this.__wbg_ptr))}get id(){return $(G.lorolist_id(this.__wbg_ptr))}get(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_get(r,this.__wbg_ptr,e);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}constructor(){let e=G.lorolist_new();return this.__wbg_ptr=e>>>0,Fh.register(this,this.__wbg_ptr,this),this}pop(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_pop(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}kind(){return $(G.lorolist_kind(this.__wbg_ptr))}push(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_push(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}clear(){try{let t=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_clear(t,this.__wbg_ptr);var e=X().getInt32(t+0,!0);if(X().getInt32(t+4,!0))throw $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}delete(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_delete(r,this.__wbg_ptr,e,t);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}insert(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_insert(r,this.__wbg_ptr,e,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get length(){return G.lorolist_length(this.__wbg_ptr)>>>0}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getIdAt(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_getIdAt(r,this.__wbg_ptr,e);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.lorolist_toJSON(this.__wbg_ptr))}toArray(){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_toArray(i,this.__wbg_ptr);var e=X().getInt32(i+0,!0),t=X().getInt32(i+4,!0),n=X().getInt32(i+8,!0);if(X().getInt32(i+12,!0))throw $(n);var r=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),r}finally{G.__wbindgen_add_to_stack_pointer(16)}}getCursor(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_getCursor(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return n===0?void 0:Oh.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDeleted(){return G.lorolist_isDeleted(this.__wbg_ptr)!==0}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},Lh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_loromap_free(e>>>0,1)),Rh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Lh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Lh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_loromap_free(e,0)}isAttached(){return G.loromap_isAttached(this.__wbg_ptr)!==0}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getLastEditor(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;return $(G.loromap_getLastEditor(this.__wbg_ptr,t,n))}setContainer(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.loromap_setContainer(i,this.__wbg_ptr,a,o,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){return $(G.loromap_getShallowValue(this.__wbg_ptr))}ensureMergeableMap(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.loromap_ensureMergeableMap(i,this.__wbg_ptr,a,o);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}ensureMergeableList(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_ensureMergeableList(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Ih.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}ensureMergeableText(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_ensureMergeableText(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Hh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}ensureMergeableTree(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_ensureMergeableTree(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Wh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getOrCreateContainer(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.loromap_getOrCreateContainer(i,this.__wbg_ptr,a,o,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}ensureMergeableCounter(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_ensureMergeableCounter(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Mh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}ensureMergeableMovableList(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_ensureMergeableMovableList(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Bh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get id(){return $(G.loromap_id(this.__wbg_ptr))}get(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_get(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}constructor(){let e=G.loromap_new();return this.__wbg_ptr=e>>>0,Lh.register(this,this.__wbg_ptr,this),this}keys(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_keys(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}kind(){return $(G.loromap_kind(this.__wbg_ptr))}get size(){return G.loromap_size(this.__wbg_ptr)>>>0}clear(){try{let t=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_clear(t,this.__wbg_ptr);var e=X().getInt32(t+0,!0);if(X().getInt32(t+4,!0))throw $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}delete(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16),r=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),i=J;G.loromap_delete(n,this.__wbg_ptr,r,i);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}set(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_set(r,this.__wbg_ptr,i,a,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}values(){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_values(i,this.__wbg_ptr);var e=X().getInt32(i+0,!0),t=X().getInt32(i+4,!0),n=X().getInt32(i+8,!0);if(X().getInt32(i+12,!0))throw $(n);var r=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),r}finally{G.__wbindgen_add_to_stack_pointer(16)}}entries(){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_entries(i,this.__wbg_ptr);var e=X().getInt32(i+0,!0),t=X().getInt32(i+4,!0),n=X().getInt32(i+8,!0);if(X().getInt32(i+12,!0))throw $(n);var r=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),r}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.loromap_toJSON(this.__wbg_ptr))}isDeleted(){return G.loromap_isDeleted(this.__wbg_ptr)!==0}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},zh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_loromovablelist_free(e>>>0,1)),Bh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,zh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,zh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_loromovablelist_free(e,0)}isAttached(){return G.loromovablelist_isAttached(this.__wbg_ptr)!==0}getCreatorAt(e){return $(G.loromovablelist_getCreatorAt(this.__wbg_ptr,e))}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}setContainer(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_setContainer(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getLastMoverAt(e){return $(G.loromovablelist_getLastMoverAt(this.__wbg_ptr,e))}pushContainer(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_pushContainer(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getLastEditorAt(e){return $(G.loromovablelist_getLastEditorAt(this.__wbg_ptr,e))}insertContainer(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_insertContainer(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){return $(G.loromovablelist_getShallowValue(this.__wbg_ptr))}get id(){return $(G.loromovablelist_id(this.__wbg_ptr))}get(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_get(r,this.__wbg_ptr,e);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}move(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_move(r,this.__wbg_ptr,e,t);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}constructor(){let e=G.loromovablelist_new();return this.__wbg_ptr=e>>>0,zh.register(this,this.__wbg_ptr,this),this}pop(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_pop(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}set(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_set(r,this.__wbg_ptr,e,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}kind(){return $(G.loromovablelist_kind(this.__wbg_ptr))}push(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_push(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}clear(){try{let t=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_clear(t,this.__wbg_ptr);var e=X().getInt32(t+0,!0);if(X().getInt32(t+4,!0))throw $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}delete(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_delete(r,this.__wbg_ptr,e,t);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}insert(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_insert(r,this.__wbg_ptr,e,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get length(){return G.loromovablelist_length(this.__wbg_ptr)>>>0}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.loromovablelist_toJSON(this.__wbg_ptr))}toArray(){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_toArray(i,this.__wbg_ptr);var e=X().getInt32(i+0,!0),t=X().getInt32(i+4,!0),n=X().getInt32(i+8,!0);if(X().getInt32(i+12,!0))throw $(n);var r=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),r}finally{G.__wbindgen_add_to_stack_pointer(16)}}getCursor(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_getCursor(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return n===0?void 0:Oh.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDeleted(){return G.loromovablelist_isDeleted(this.__wbg_ptr)!==0}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},Vh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorotext_free(e>>>0,1)),Hh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Vh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Vh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorotext_free(e,0)}applyDelta(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_applyDelta(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}convertPos(e,t,n){let r=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),i=J,a=Y(n,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;return $(G.lorotext_convertPos(this.__wbg_ptr,e,r,i,a,o))}deleteUtf8(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_deleteUtf8(r,this.__wbg_ptr,e,t);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getEditorOf(e){return $(G.lorotext_getEditorOf(this.__wbg_ptr,e))}insertUtf8(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorotext_insertUtf8(r,this.__wbg_ptr,e,i,a);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isAttached(){return G.lorotext_isAttached(this.__wbg_ptr)!==0}sliceDelta(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_sliceDelta(i,this.__wbg_ptr,e,t);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}updateByLine(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorotext_updateByLine(r,this.__wbg_ptr,i,a,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}sliceDeltaUtf8(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_sliceDeltaUtf8(i,this.__wbg_ptr,e,t);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){let e,t;try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_getShallowValue(i,this.__wbg_ptr);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);return e=n,t=r,Q(n,r)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(e,t,1)}}get id(){return $(G.lorotext_id(this.__wbg_ptr))}constructor(){let e=G.lorotext_new();return this.__wbg_ptr=e>>>0,Vh.register(this,this.__wbg_ptr,this),this}iter(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_iter(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}kind(){return $(G.lorotext_kind(this.__wbg_ptr))}mark(e,t,n){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.lorotext_mark(i,this.__wbg_ptr,Z(e),a,o,Z(n));var r=X().getInt32(i+0,!0);if(X().getInt32(i+4,!0))throw $(r)}finally{G.__wbindgen_add_to_stack_pointer(16)}}push(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16),r=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),i=J;G.lorotext_push(n,this.__wbg_ptr,r,i);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}slice(e,t){let n,r;try{let u=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_slice(u,this.__wbg_ptr,e,t);var i=X().getInt32(u+0,!0),a=X().getInt32(u+4,!0),o=X().getInt32(u+8,!0),s=X().getInt32(u+12,!0),c=i,l=a;if(s)throw c=0,l=0,$(o);return n=c,r=l,Q(c,l)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(n,r,1)}}delete(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_delete(r,this.__wbg_ptr,e,t);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}insert(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorotext_insert(r,this.__wbg_ptr,e,i,a);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get length(){return G.lorotext_length(this.__wbg_ptr)>>>0}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}splice(e,t,n){let r,i;try{let d=G.__wbindgen_add_to_stack_pointer(-16),f=Y(n,G.__wbindgen_malloc,G.__wbindgen_realloc),p=J;G.lorotext_splice(d,this.__wbg_ptr,e,t,f,p);var a=X().getInt32(d+0,!0),o=X().getInt32(d+4,!0),s=X().getInt32(d+8,!0),c=X().getInt32(d+12,!0),l=a,u=o;if(c)throw l=0,u=0,$(s);return r=l,i=u,Q(l,u)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(r,i,1)}}unmark(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorotext_unmark(r,this.__wbg_ptr,Z(e),i,a);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}update(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorotext_update(r,this.__wbg_ptr,i,a,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}charAt(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_charAt(r,this.__wbg_ptr,e);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return String.fromCodePoint(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.lorotext_toJSON(this.__wbg_ptr))}toDelta(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_toDelta(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getCursor(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_getCursor(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return n===0?void 0:Oh.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDeleted(){return G.lorotext_isDeleted(this.__wbg_ptr)!==0}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toString(){let e,t;try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_toString(i,this.__wbg_ptr);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);return e=n,t=r,Q(n,r)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(e,t,1)}}},Uh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorotree_free(e>>>0,1)),Wh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Uh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Uh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorotree_free(e,0)}createNode(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_createNode(i,this.__wbg_ptr,vh(e),th(t)?4294967297:t>>>0);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return Kh.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}isAttached(){return G.lorotree_isAttached(this.__wbg_ptr)!==0}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getNodeByID(e){try{let t=G.lorotree_getNodeByID(this.__wbg_ptr,vh(e));return t===0?void 0:Kh.__wrap(t)}finally{K[_h++]=void 0}}isNodeDeleted(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_isNodeDeleted(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return t!==0}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}getShallowValue(){return $(G.lorotree_getShallowValue(this.__wbg_ptr))}enableFractionalIndex(e){G.lorotree_enableFractionalIndex(this.__wbg_ptr,e)}disableFractionalIndex(){G.lorotree_disableFractionalIndex(this.__wbg_ptr)}isFractionalIndexEnabled(){return G.lorotree_isFractionalIndexEnabled(this.__wbg_ptr)!==0}get id(){return $(G.lorotree_id(this.__wbg_ptr))}move(e,t,n){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_move(i,this.__wbg_ptr,vh(e),vh(t),th(n)?4294967297:n>>>0);var r=X().getInt32(i+0,!0);if(X().getInt32(i+4,!0))throw $(r)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0,K[_h++]=void 0}}constructor(){let e=G.lorotree_new();return this.__wbg_ptr=e>>>0,Uh.register(this,this.__wbg_ptr,this),this}kind(){return $(G.lorotree_kind(this.__wbg_ptr))}nodes(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_nodes(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}roots(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_roots(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}delete(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_delete(n,this.__wbg_ptr,vh(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.lorotree_toJSON(this.__wbg_ptr))}has(e){try{return G.lorotree_has(this.__wbg_ptr,vh(e))!==0}finally{K[_h++]=void 0}}toArray(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_toArray(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getNodes(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_getNodes(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDeleted(){return G.lorotree_isDeleted(this.__wbg_ptr)!==0}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},Gh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorotreenode_free(e>>>0,1)),Kh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Gh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Gh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorotreenode_free(e,0)}__getClassname(){let e,t;try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode___getClassname(i,this.__wbg_ptr);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);return e=n,t=r,Q(n,r)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(e,t,1)}}creationId(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_creationId(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDeleted(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_isDeleted(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return e!==0}finally{G.__wbindgen_add_to_stack_pointer(16)}}moveBefore(t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);yh(t,e),G.lorotreenode_moveBefore(r,this.__wbg_ptr,t.__wbg_ptr);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}createNode(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_createNode(i,this.__wbg_ptr,th(t)?4294967297:t>>>0);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getLastMoveId(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_getLastMoveId(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_toJSON(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}fractionalIndex(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_fractionalIndex(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get id(){return $(G.lorotreenode_id(this.__wbg_ptr))}move(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_move(r,this.__wbg_ptr,vh(e),th(t)?4294967297:t>>>0);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}get data(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_data(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return Rh.__wrap(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}index(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_index(n,this.__wbg_ptr);var e=X().getFloat64(n+0,!0),t=X().getInt32(n+8,!0);if(X().getInt32(n+12,!0))throw $(t);return e===4294967297?void 0:e}finally{G.__wbindgen_add_to_stack_pointer(16)}}parent(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_parent(r,this.__wbg_ptr);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return t===0?void 0:e.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}creator(){return $(G.lorotreenode_creator(this.__wbg_ptr))}children(){return $(G.lorotreenode_children(this.__wbg_ptr))}moveAfter(t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);yh(t,e),G.lorotreenode_moveAfter(r,this.__wbg_ptr,t.__wbg_ptr);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},qh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_undomanager_free(e>>>0,1)),Jh=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,qh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_undomanager_free(e,0)}groupStart(){try{let t=G.__wbindgen_add_to_stack_pointer(-16);G.undomanager_groupStart(t,this.__wbg_ptr);var e=X().getInt32(t+0,!0);if(X().getInt32(t+4,!0))throw $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}topRedoValue(){return $(G.undomanager_topRedoValue(this.__wbg_ptr))}topUndoValue(){return $(G.undomanager_topUndoValue(this.__wbg_ptr))}setMaxUndoSteps(e){G.undomanager_setMaxUndoSteps(this.__wbg_ptr,e)}setMergeInterval(e){G.undomanager_setMergeInterval(this.__wbg_ptr,e)}addExcludeOriginPrefix(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;G.undomanager_addExcludeOriginPrefix(this.__wbg_ptr,t,n)}constructor(e,t){yh(e,Ph);let n=G.undomanager_new(e.__wbg_ptr,Z(t));return this.__wbg_ptr=n>>>0,qh.register(this,this.__wbg_ptr,this),this}peer(){return $(G.undomanager_peer(this.__wbg_ptr))}redo(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.undomanager_redo(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return e!==0}finally{G.__wbindgen_add_to_stack_pointer(16)}}undo(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.undomanager_undo(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return e!==0}finally{G.__wbindgen_add_to_stack_pointer(16)}}clear(){G.undomanager_clear(this.__wbg_ptr)}pause(){G.undomanager_pause(this.__wbg_ptr)}resume(){G.undomanager_resume(this.__wbg_ptr)}canRedo(){return G.undomanager_canRedo(this.__wbg_ptr)!==0}canUndo(){return G.undomanager_canUndo(this.__wbg_ptr)!==0}groupEnd(){G.undomanager_groupEnd(this.__wbg_ptr)}isPaused(){return G.undomanager_isPaused(this.__wbg_ptr)!==0}setOnPop(e){G.undomanager_setOnPop(this.__wbg_ptr,Z(e))}clearRedo(){G.undomanager_clearRedo(this.__wbg_ptr)}clearUndo(){G.undomanager_clearUndo(this.__wbg_ptr)}setOnPush(e){G.undomanager_setOnPush(this.__wbg_ptr,Z(e))}},Yh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_versionvector_free(e>>>0,1)),Xh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Yh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Yh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_versionvector_free(e,0)}get(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_get(r,this.__wbg_ptr,Z(e));var t=X().getFloat64(r+0,!0),n=X().getInt32(r+8,!0);if(X().getInt32(r+12,!0))throw $(n);return t===4294967297?void 0:t}finally{G.__wbindgen_add_to_stack_pointer(16)}}constructor(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_new(r,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return this.__wbg_ptr=t>>>0,Yh.register(this,this.__wbg_ptr,this),this}finally{G.__wbindgen_add_to_stack_pointer(16)}}static decode(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=oh(t,G.__wbindgen_malloc),o=J;G.versionvector_decode(i,a,o);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}encode(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_encode(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=ph(e,t).slice();return G.__wbindgen_free(e,t*1,1),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}length(){return G.versionvector_length(this.__wbg_ptr)>>>0}remove(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_remove(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}setEnd(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_setEnd(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}compare(t){yh(t,e);let n=G.versionvector_compare(this.__wbg_ptr,t.__wbg_ptr);return n===4294967297?void 0:n}setLast(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_setLast(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.versionvector_toJSON(this.__wbg_ptr))}static parseJSON(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_parseJSON(i,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}};function Zh(e,t){let n=Y(String(q(t)),G.__wbindgen_malloc,G.__wbindgen_realloc),r=J;X().setInt32(e+4,r,!0),X().setInt32(e+0,n,!0)}function Qh(){return Qm(function(e,t,n){return Z(q(e).apply(q(t),q(n)))},arguments)}function $h(){return Qm(function(e,t,n){return Z(Reflect.apply(q(e),q(t),q(n)))},arguments)}function eg(e){let t=q(e).buffer;return Z(t)}function tg(){return Qm(function(e,t){return Z(q(e).call(q(t)))},arguments)}function ng(){return Qm(function(e,t,n){return Z(q(e).call(q(t),q(n)))},arguments)}function rg(){return Qm(function(e,t,n,r){return Z(q(e).call(q(t),q(n),q(r)))},arguments)}function ig(){return Qm(function(e,t,n,r,i){return Z(q(e).call(q(t),q(n),q(r),q(i)))},arguments)}function ag(e){return Z(Eh.__wrap(e))}function og(e){let t=q(e).crypto;return Z(t)}function sg(e){return Z(Oh.__wrap(e))}function cg(e){return q(e).done}function lg(e){return Z(Object.entries(q(e)))}function ug(e){return Z(q(e).entries())}function dg(e,t){console.error(Q(e,t))}function fg(e){return Z(Array.from(q(e)))}function pg(e){return Z(Object.getOwnPropertySymbols(q(e)))}function mg(){return Qm(function(e,t){q(e).getRandomValues(q(t))},arguments)}function hg(){return Qm(function(e,t){return Z(Reflect.get(q(e),q(t)))},arguments)}function gg(e,t){let n=q(e)[t>>>0];return Z(n)}function _g(e,t){return q(e)[t>>>0]}function vg(e,t){let n=q(e)[q(t)];return Z(n)}function yg(e){let t;try{t=q(e)instanceof ArrayBuffer}catch{t=!1}return t}function bg(e){let t;try{t=q(e)instanceof Map}catch{t=!1}return t}function xg(e){let t;try{t=q(e)instanceof Object}catch{t=!1}return t}function Sg(e){let t;try{t=q(e)instanceof Uint8Array}catch{t=!1}return t}function Cg(e){return Array.isArray(q(e))}function wg(e){return Number.isSafeInteger(q(e))}function Tg(){let e=Symbol.iterator;return Z(e)}function Eg(e){return q(e).length}function Dg(e){return q(e).length}function Og(e,t,n,r,i,a,o,s){let c,l;try{c=e,l=t,console.log(Q(e,t),Q(n,r),Q(i,a),Q(o,s))}finally{G.__wbindgen_free(c,l,1)}}function kg(e,t){console.log(Q(e,t))}function Ag(e,t){let n,r;try{n=e,r=t,console.log(Q(e,t))}finally{G.__wbindgen_free(n,r,1)}}function jg(e){return Z(Mh.__wrap(e))}function Mg(e){return Z(Ih.__wrap(e))}function Ng(e){return Z(Rh.__wrap(e))}function Pg(e){return Z(Bh.__wrap(e))}function Fg(e){return Z(Hh.__wrap(e))}function Ig(e){return Z(Wh.__wrap(e))}function Lg(e){return Z(Kh.__wrap(e))}function Rg(e,t){performance.mark(Q(e,t))}function zg(){return Qm(function(e,t,n,r){let i,a,o,s;try{i=e,a=t,o=n,s=r,performance.measure(Q(e,t),Q(n,r))}finally{G.__wbindgen_free(i,a,1),G.__wbindgen_free(o,s,1)}},arguments)}function Bg(e){let t=q(e).msCrypto;return Z(t)}function Vg(){return Z({})}function Hg(){return Z(new Map)}function Ug(){return Z([])}function Wg(e){return Z(new Uint8Array(q(e)))}function Gg(e,t){return Z(Error(Q(e,t)))}function Kg(e,t){return Z(Function(Q(e,t)))}function qg(e,t,n){return Z(new Uint8Array(q(e),t>>>0,n>>>0))}function Jg(e){return Z(new Uint8Array(e>>>0))}function Yg(e){return Z(Array(e>>>0))}function Xg(e){let t=q(e).next;return Z(t)}function Zg(){return Qm(function(e){return Z(q(e).next())},arguments)}function Qg(e){let t=q(e).node;return Z(t)}function $g(){return Date.now()}function e_(){return Qm(function(e){return Z(Reflect.ownKeys(q(e)))},arguments)}function t_(e){let t=q(e).process;return Z(t)}function n_(e,t){return q(e).push(q(t))}function r_(){return Qm(function(e,t){q(e).randomFillSync($(t))},arguments)}function i_(){return Qm(function(){let e=module.require;return Z(e)},arguments)}function a_(e){return Z(Promise.resolve(q(e)))}function o_(e,t,n){q(e)[t>>>0]=$(n)}function s_(e,t,n){q(e)[$(t)]=$(n)}function c_(e,t,n){q(e).set(q(t),n>>>0)}function l_(e,t,n){return Z(q(e).set(q(t),q(n)))}function u_(){return Qm(function(e,t,n){return Reflect.set(q(e),q(t),q(n))},arguments)}function d_(e,t,n){q(e)[t>>>0]=n}function f_(){let e=typeof global>`u`?null:global;return th(e)?0:Z(e)}function p_(){let e=typeof globalThis>`u`?null:globalThis;return th(e)?0:Z(e)}function m_(){let e=typeof self>`u`?null:self;return th(e)?0:Z(e)}function h_(){let e=typeof window>`u`?null:window;return th(e)?0:Z(e)}function g_(e,t,n){return Z(q(e).subarray(t>>>0,n>>>0))}function __(e,t){return Z(q(e).then(q(t)))}function v_(e){let t=q(e).value;return Z(t)}function y_(e){let t=q(e).versions;return Z(t)}function b_(e){return Z(Xh.__wrap(e))}function x_(e,t){console.warn(Q(e,t))}function S_(e){return+q(e)}function C_(e){return Z(e)}function w_(e){return Z(BigInt.asUintN(64,e))}function T_(e,t){let n=q(t),r=typeof n==`bigint`?n:void 0;X().setBigInt64(e+8,th(r)?BigInt(0):r,!0),X().setInt32(e+0,!th(r),!0)}function E_(e){let t=q(e);return typeof t==`boolean`?+!!t:2}function D_(e){let t=$(e).original;return t.cnt--==1&&(t.a=0,!0)}function O_(e,t,n){return Z(rh(e,t,14,xh))}function k_(e,t,n){return Z(rh(e,t,14,Sh))}function A_(e,t){let n=Y(ih(q(t)),G.__wbindgen_malloc,G.__wbindgen_realloc),r=J;X().setInt32(e+4,r,!0),X().setInt32(e+0,n,!0)}function j_(e,t){return Z(Error(Q(e,t)))}function M_(e,t){return q(e)in q(t)}function N_(e){return Array.isArray(q(e))}function P_(e){return typeof q(e)==`bigint`}function F_(e){return typeof q(e)==`function`}function I_(e){return q(e)===null}function L_(e){let t=q(e);return typeof t==`object`&&!!t}function R_(e){return typeof q(e)==`string`}function z_(e){return q(e)===void 0}function B_(e,t){return q(e)===q(t)}function V_(e,t){return q(e)==q(t)}function H_(){let e=G.memory;return Z(e)}function U_(e,t){let n=q(t),r=typeof n==`number`?n:void 0;X().setFloat64(e+8,th(r)?0:r,!0),X().setInt32(e+0,!th(r),!0)}function W_(e){return Z(e)}function G_(e){return Z(q(e))}function K_(e){$(e)}function q_(e){throw $(e)}function J_(e,t){let n=q(t),r=typeof n==`string`?n:void 0;var i=th(r)?0:Y(r,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;X().setInt32(e+4,a,!0),X().setInt32(e+0,i,!0)}function Y_(e,t){return Z(Q(e,t))}function X_(e,t){throw Error(Q(e,t))}function Z_(e){return Z(typeof q(e))}var Q_=Symbol(`loroContainerId`);function $_(e){let t=e.prototype,n=Object.getOwnPropertyDescriptor(t,`id`),r=n&&n.get,i=Object.getOwnPropertyDescriptor(t,`__destroy_into_raw`),a=i&&i.value;if(!r||!i||!a)throw Error(`Unexpected wasm-bindgen container wrapper shape`);Object.defineProperty(t,"id",{...n,get(){if(this.__wbg_ptr===0)return r.call(this);let e=this[Q_];if(e!==void 0)return e;let t=r.call(this);try{Object.defineProperty(this,Q_,{configurable:!0,value:t})}catch{}return t}}),Object.defineProperty(t,"__destroy_into_raw",{...i,value(){try{delete this[Q_]}catch{}return a.call(this)}})}for(let e of[Rh,Hh,Ih,Wh,Bh,Mh])$_(e);var ev={AwarenessWasm:wh,ChangeModifier:Eh,Cursor:Oh,EphemeralStoreWasm:Ah,LORO_VERSION:ah,LoroCounter:Mh,LoroDoc:Ph,LoroList:Ih,LoroMap:Rh,LoroMovableList:Bh,LoroText:Hh,LoroTree:Wh,LoroTreeNode:Kh,UndoManager:Jh,VersionVector:Xh,__wbg_String_8f0eb39a4a4c2f66:Zh,__wbg_apply_36be6a55257c99bf:Qh,__wbg_apply_eb9e9b97497f91e4:$h,__wbg_buffer_609cc3eee51ed158:eg,__wbg_call_672a4d21634d4a24:tg,__wbg_call_7cccdd69e0791ae2:ng,__wbg_call_833bed5770ea2041:rg,__wbg_call_b8adc8b1d0a0d8eb:ig,__wbg_changemodifier_new:ag,__wbg_crypto_574e78ad8b13b65f:og,__wbg_cursor_new:sg,__wbg_done_769e5ede4b31c67b:cg,__wbg_entries_3265d4158b33e5dc:lg,__wbg_entries_c8a90a7ed73e84ce:ug,__wbg_error_d558b831e4af4f7b:dg,__wbg_from_2a5d3e218e67aa85:fg,__wbg_getOwnPropertySymbols_97eebed6fe6e08be:pg,__wbg_getRandomValues_b8f5dbd5f3995a9e:mg,__wbg_get_67b2ba62fc30de12:hg,__wbg_get_b9b93047fe3cf45b:gg,__wbg_getindex_5b00c274b05714aa:_g,__wbg_getwithrefkey_1dc361bd10053bfe:vg,__wbg_instanceof_ArrayBuffer_e14585432e3737fc:yg,__wbg_instanceof_Map_f3469ce2244d2430:bg,__wbg_instanceof_Object_7f2dcef8f78644a4:xg,__wbg_instanceof_Uint8Array_17156bcf118086a9:Sg,__wbg_isArray_a1eab7e0d067391b:Cg,__wbg_isSafeInteger_343e2beeeece1bb0:wg,__wbg_iterator_9a24c88df860dc65:Tg,__wbg_length_a446193dc22c12f8:Eg,__wbg_length_e2d2a49132c1b256:Dg,__wbg_log_0cc1b7768397bcfe:Og,__wbg_log_5772acf6639674b3:kg,__wbg_log_cb9e190acc5753fb:Ag,__wbg_lorocounter_new:jg,__wbg_lorolist_new:Mg,__wbg_loromap_new:Ng,__wbg_loromovablelist_new:Pg,__wbg_lorotext_new:Fg,__wbg_lorotree_new:Ig,__wbg_lorotreenode_new:Lg,__wbg_mark_7438147ce31e9d4b:Rg,__wbg_measure_fb7825c11612c823:zg,__wbg_msCrypto_a61aeb35a24c1329:Bg,__wbg_new_405e22f390576ce2:Vg,__wbg_new_5e0be73521bc8c17:Hg,__wbg_new_78feb108b6472713:Ug,__wbg_new_a12002a7f91c75be:Wg,__wbg_new_c68d7209be747379:Gg,__wbg_newnoargs_105ed471475aaf50:Kg,__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a:qg,__wbg_newwithlength_a381634e90c276d4:Jg,__wbg_newwithlength_c4c419ef0bc8a1f8:Yg,__wbg_next_25feadfc0913fea9:Xg,__wbg_next_6574e1a8a62d1055:Zg,__wbg_node_905d3e251edff8a2:Qg,__wbg_now_86f00deda9ebf073:$g,__wbg_ownKeys_3930041068756f1f:e_,__wbg_process_dc0fbacc7c1c06f7:t_,__wbg_push_737cfc8c1432c2c6:n_,__wbg_randomFillSync_ac0988aba3254290:r_,__wbg_require_60cc747a6bc5215a:i_,__wbg_resolve_4851785c9c5f573d:a_,__wbg_set_37837023f3d740e8:o_,__wbg_set_3f1d0b984ed272ed:s_,__wbg_set_65595bdd868b3009:c_,__wbg_set_8fc6bf8a5b1071d1:l_,__wbg_set_bb8cecf6a62b9f46:u_,__wbg_set_wasm:Gm,__wbg_setindex_dcd71eabf405bde1:d_,__wbg_static_accessor_GLOBAL_88a902d13a557d07:f_,__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0:p_,__wbg_static_accessor_SELF_37c5d418e4bf5819:m_,__wbg_static_accessor_WINDOW_5de37043a91a9c40:h_,__wbg_subarray_aa9065fa9dc5df96:g_,__wbg_then_44b73946d2fb3e7d:__,__wbg_value_cd1ffa7b1ab794f1:v_,__wbg_versions_c01dfd4722a88165:y_,__wbg_versionvector_new:b_,__wbg_warn_d0f9203c8c814d40:x_,__wbindgen_as_number:S_,__wbindgen_bigint_from_i64:C_,__wbindgen_bigint_from_u64:w_,__wbindgen_bigint_get_as_i64:T_,__wbindgen_boolean_get:E_,__wbindgen_cb_drop:D_,__wbindgen_closure_wrapper246:O_,__wbindgen_closure_wrapper496:k_,__wbindgen_debug_string:A_,__wbindgen_error_new:j_,__wbindgen_in:M_,__wbindgen_is_array:N_,__wbindgen_is_bigint:P_,__wbindgen_is_function:F_,__wbindgen_is_null:I_,__wbindgen_is_object:L_,__wbindgen_is_string:R_,__wbindgen_is_undefined:z_,__wbindgen_jsval_eq:B_,__wbindgen_jsval_loose_eq:V_,__wbindgen_memory:H_,__wbindgen_number_get:U_,__wbindgen_number_new:W_,__wbindgen_object_clone_ref:G_,__wbindgen_object_drop_ref:K_,__wbindgen_rethrow:q_,__wbindgen_string_get:J_,__wbindgen_string_new:Y_,__wbindgen_throw:X_,__wbindgen_typeof:Z_,callPendingEvents:ch,decodeFrontiers:hh,decodeImportBlobMeta:sh,encodeFrontiers:mh,isValidContainerId:uh,redactJsonUpdates:lh,run:dh,setDebug:gh},tv={"./loro_wasm_bg.js":ev},nv=e=>{ev.__wbg_set_wasm(e),rv(e)};function rv(e){typeof e.__wbindgen_start==`function`&&e.__wbindgen_start()}function iv(e){if(typeof XMLHttpRequest!=`function`)throw Error(`loro-crdt browser build requires XMLHttpRequest for synchronous WASM loading. Use the nodejs, web, base64, or bundler entry for this runtime.`);let t=new XMLHttpRequest;if(t.open(`GET`,e,!1),t.overrideMimeType(`text/plain; charset=x-user-defined`),t.send(null),t.status!==0&&(t.status<200||t.status>=300))throw Error(`Failed to load loro-crdt WASM from ${e}: ${t.status} ${t.statusText}`);let n=t.responseText,r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e)&255;return r}function av(e,t){let n=new WebAssembly.Module(e);return new WebAssembly.Instance(n,t)}nv(av(iv(new URL(``+new URL(`loro_wasm_bg-BwsqTTze.wasm`,import.meta.url).href,``+import.meta.url).href),tv).exports);var ov=[`Map`,`Text`,`List`,`Tree`,`MovableList`,`Counter`];function sv(e){return uh(e)}function cv(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return typeof t!=`object`||!t||typeof t.kind!=`function`?!1:ov.includes(e.kind())}var lv=class{constructor(e,t=3e4){this.listeners=new Set,this.inner=new wh(e,t),this.peer=e,this.timeout=t}apply(e,t=`remote`){let{updated:n,added:r}=this.inner.apply(e);this.listeners.forEach(e=>{e({updated:n,added:r,removed:[]},t)}),this.startTimerIfNotEmpty()}setLocalState(e){let t=this.inner.getState(this.peer)==null;this.inner.setLocalState(e),t?this.listeners.forEach(e=>{e({updated:[],added:[this.inner.peer()],removed:[]},`local`)}):this.listeners.forEach(e=>{e({updated:[this.inner.peer()],added:[],removed:[]},`local`)}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(e){return this.inner.encode(e)}encodeAll(){return this.inner.encodeAll()}addListener(e){this.listeners.add(e)}removeListener(e){this.listeners.delete(e)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{let e=this.inner.removeOutdated();e.length>0&&this.listeners.forEach(t=>{t({updated:[],added:[],removed:e},`timeout`)}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}};Ph.prototype.toJsonWithReplacer=function(e){let t=new Set,n=this,r=(r,a)=>{if(typeof a==`string`&&sv(a)&&!t.has(a)){t.add(a);let o=n.getContainerById(a);if(o==null)throw Error(`ContainerID not found: ${a}`);let s=e(r,o);if(s===o){let e=o.getShallowValue();return typeof e==`object`?i(e):e}if(cv(s))throw Error(`Using new container is not allowed in toJsonWithReplacer`);return typeof s==`object`&&s?i(s):s}if(typeof a==`object`&&a)return i(a);let o=e(r,a);if(cv(o))throw Error(`Using new container is not allowed in toJsonWithReplacer`);return o},i=e=>{if(Array.isArray(e))return e.map((e,t)=>r(t,e)).filter(e=>e!==void 0);let t={};for(let[n,i]of Object.entries(e)){let e=r(n,i);e!==void 0&&(t[n]=e)}return t};return i(n.getShallowValue())};var uv=Symbol(`loro.callPendingEventsWrapped`);function dv(e,t){let n=Object.getOwnPropertyDescriptor(e,t);if(!n||typeof n.value!=`function`)return;let r=n.value;if(r[uv])return;let i=function(...e){let t;try{return t=r.apply(this,e),t}finally{t&&typeof t.then==`function`?t.finally(()=>{ch()}):ch()}};i[uv]=!0,Object.defineProperty(e,t,{...n,value:i})}function fv(e,t){for(let n of t)dv(e,n)}fv(Ph.prototype,[`setDetachedEditing`,`attach`,`detach`,`fork`,`forkAt`,`checkoutToLatest`,`checkout`,`commit`,`getCursorPos`,`revertTo`,`export`,`exportJsonUpdates`,`exportJsonInIdSpan`,`importJsonUpdates`,`import`,`importUpdateBatch`,`importBatch`,`travelChangeAncestors`,`getChangedContainersIn`,`diff`,`applyDiff`,`setPeerId`]),fv(Ah.prototype,[`set`,`delete`,`apply`,`removeOutdated`]),fv(Jh.prototype,[`undo`,`redo`]);var pv=N.baseTheme({".loro-cursor":{position:`absolute`,width:`2px`,display:`inline-block`,height:`1.2em`},".loro-cursor::before":{position:`absolute`,top:`1.3em`,left:`0`,content:`var(--rtc-name)`,padding:`2px 6px`,fontSize:`12px`,borderRadius:`3px`,whiteSpace:`nowrap`,userSelect:`none`,backgroundColor:`inherit`,opacity:`0.7`},".loro-selection":{opacity:`0.5`}});Qr.define();var mv=j.define(),hv=Zr.define({create(){return{remoteCursors:new Map,isCheckout:!1}},update(e,t){for(let n of t.effects)if(n.is(mv))switch(n.value.type){case`update`:{let{peer:t,user:r,cursor:i}=n.value;e.remoteCursors.set(t,{uid:t,cursor:i,user:r});break}case`delete`:e.remoteCursors.delete(n.value.peer);break;case`checkout`:e.isCheckout=n.value.checkout}return e}}),gv=e=>{let t=e.transactions.flatMap(e=>e.effects).filter(e=>e.is(mv));return e.docChanged||e.viewportChanged||t.length>0},_v=()=>Rr({above:!0,class:`loro-cursor-layer`,update:gv,markers:e=>{let{remoteCursors:t,isCheckout:n}=e.state.field(hv);return n?[]:[...t.values()].flatMap(t=>{let n=ti.cursor(t.cursor.anchor);return yv.createCursor(e,n,t.user?.name||`unknown`,t.user?.colorClassName||``)})}}),vv=()=>Rr({above:!1,class:`loro-selection-layer`,update:gv,markers:e=>{let{remoteCursors:t,isCheckout:n}=e.state.field(hv);return n?[]:[...t.entries()].filter(([,e])=>e.cursor.head!==void 0&&e.cursor.anchor!==e.cursor.head).flatMap(([,t])=>{let n=ti.range(t.cursor.anchor,t.cursor.head);return fi.forRange(e,`loro-selection ${t.user?.colorClassName||``}`,n)})}}),yv=class e{left;top;height;name;colorClassName;constructor(e,t,n,r,i){this.left=e,this.top=t,this.height=n,this.name=r,this.colorClassName=i}draw(){let e=document.createElement(`div`);return this.adjust(e),e}update(e){return this.adjust(e),!0}adjust(e){e.style.left=`${this.left}px`,e.style.top=`${this.top}px`,e.style.height=`${this.height}px`,e.className=`loro-cursor ${this.colorClassName}`,e.style.setProperty(`--rtc-name`,`"${this.name}"`)}eq(e){return this.left===e.left&&this.top===e.top&&this.height===e.height&&this.name===e.name}static createCursor(t,n,r,i){let a=e.calculateAbsoluteCursorPosition(n,t);if(!a)return[];let o=t.scrollDOM.getBoundingClientRect(),s=(t.textDirection===mi.LTR?o.left:o.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,c=o.top-t.scrollDOM.scrollTop;return[new e(a.left-s,a.top-c,a.bottom-a.top,r,i)]}static calculateAbsoluteCursorPosition(e,t){let n=Math.max(0,Math.min(t.state.doc.length,e.anchor));return t.coordsAtPos(n,e.assoc||1)}},bv=(e,t,n,r)=>{let i=[],{updated:a,added:o}=n;for(let n of[...a,...o]){let a=xv(e,t,n,r);a&&i.push(a)}return i},xv=(e,t,n,r)=>{let i=t.getAllStates()[n];if(!i||n===e.peerIdStr||i.scopeId!==r)return;if(i.type===`delete`)return mv.of({type:`delete`,peer:i.uid,scopeId:i.scopeId});let a=Oh.decode(i.cursor.anchor),o=e.getCursorPos(a)?.offset??0,s=o;if(i.cursor.head){let t=Oh.decode(i.cursor.head);s=e.getCursorPos(t)?.offset??0}return mv.of({type:`update`,peer:i.uid,scopeId:i.scopeId,cursor:{anchor:o,head:s},user:i.user})},Sv=class{sub;view;doc;user;awareness;getTextFromDoc;scopeId;getUserId;constructor(e,t,n,r,i,a,o){this.view=e,this.doc=t,this.user=n,this.awareness=r,this.getTextFromDoc=i,this.scopeId=a,this.getUserId=o,this.sub=this.doc.subscribe(e=>{if(e.by===`local`){let e=[];for(let t of this.awareness.peers()){let n=xv(this.doc,this.awareness,t,this.scopeId);n&&e.push(n)}this.view.dispatch({effects:e})}else e.by===`checkout`&&this.view.dispatch({effects:[mv.of({type:`checkout`,checkout:this.doc.isDetached()})]})})}update(e){if(!e.selectionSet&&!e.focusChanged&&!e.docChanged)return;let t=e.state.selection.main;if(this.view.hasFocus&&!this.doc.isDetached()){let e=wv({doc:this.doc,getTextFromDoc:this.getTextFromDoc,anchor:t.anchor,head:t.head});this.awareness.setLocalState({type:`update`,uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId,cursor:e,user:this.user})}else this.awareness.setLocalState({type:`delete`,uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}destroy(){this.sub?.(),this.awareness.setLocalState({type:`delete`,uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}},Cv=class{_awarenessListener;view;doc;awareness;scopeId;constructor(e,t,n,r){this.view=e,this.doc=t,this.awareness=n,this.scopeId=r;let i=async(e,t)=>{t!==`local`&&this.view.dispatch({effects:bv(this.doc,this.awareness,e,this.scopeId)})};this._awarenessListener=i,this.awareness.addListener(i)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}},wv=({doc:e,getTextFromDoc:t,anchor:n,head:r})=>{n===r&&(r=void 0);let i=t(e).getCursor(n)?.encode();if(!i)throw Error(`cursor head not found`);let a;return r!==void 0&&(a=t(e).getCursor(r)?.encode()),{anchor:i,head:a}},Tv=[`bg-(--amber-6)`,`bg-(--blue-6)`,`bg-(--crimson-6)`,`bg-(--cyan-6)`,`bg-(--grass-6)`,`bg-(--gray-6)`,`bg-(--green-6)`,`bg-(--lime-6)`,`bg-(--orange-6)`,`bg-(--purple-6)`,`bg-(--red-6)`,`bg-(--sage-6)`,`bg-(--sky-6)`,`bg-(--slate-6)`],Ev=e=>{if(typeof e==`string`){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t=Math.trunc(t);return Tv[Math.abs(t)%Tv.length]}return Tv[e%Tv.length]},Dv=rn.get(`rtc`),Ov=Dv.get(`awareness`).disabled(),kv=`awareness:`;function Av(e,t){let n=new TextEncoder().encode(e);return new Uint8Array([...n,...t])}function jv(e,t){return new TextDecoder().decode(e.slice(0,t.length))===t}function Mv(e,t){return e.slice(t.length)}var Nv=r(void 0),Pv=new Ph,Fv=new lv(Pv.peerIdStr),Iv=ji(()=>{Dv.debug(`creating websocket`);let e=yn().getWsSyncURL(Ji()).toString(),t=new Pn(e,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await pn(),ln()===`edit`&&t.reconnect()}),t.addEventListener(`message`,async e=>{let t=await e.data.arrayBuffer(),n=new Uint8Array(t);if(jv(n,kv)){let e=Mv(n,kv);Fv.apply(e),Ov.debug(`applied awareness update`);return}Pv.import(n),Dv.debug(`imported doc change. new doc:`,Pv.toJSON()),o.get(Nv)!==Pv&&o.set(Nv,Pv)}),t.addEventListener(`open`,()=>{Dv.debug(`websocket open`)}),t.addEventListener(`close`,e=>{Dv.warn(`websocket close`,e),o.get(Nv)===Pv&&o.set(Nv,void 0)}),t});xe()&&Iv(),Pv.subscribeLocalUpdates(e=>{Dv.debug(`local update, sending to server`),Iv().send(new Uint8Array(e))}),Fv.addListener((e,t)=>{let n=[...e.added,...e.removed,...e.updated];t===`local`&&(Ov.debug(`awareness changes`,n),Iv().send(Av(kv,Fv.encode(n))))});function Lv(e,t,n=``){if(xn())return{extension:[],code:n};let r=Pv.getByPath(`codes/${e}`)!==void 0,i=Pv.getMap(`codes`).getOrCreateContainer(e,new Hh);return r||(Dv.log(`initializing code for new cell`,n),i.insert(0,n)),{code:n.toString(),extension:[Rv(e),zv(e),Bv(Pv,Fv,{get name(){return o.get(tt)||`Anonymous`},get colorClassName(){return Ev(this.name)}},()=>i,e),De(Pv,[`codes`,e],()=>i)]}}function Rv(e){let t=(e,t)=>{let n=e.state.field(Ue).type,r=t.toString();r&&r!==n&&(Dv.debug(`[incoming] setting language type: ${n} -> ${r}`),yt(e,{language:r,keepCodeAsIs:!0}))},n=(e,t)=>{let n=e.state.field(dt),r=t.toJSON();a(n,r)||e.dispatch({effects:[ot.of(r)],annotations:[ct.of(!0)]})};return _i.define(r=>{let i;return Promise.resolve().then(()=>{let a=Pv.getByPath(`languages/${e}`);if(!a){Dv.error(`no language container found for cell`,e);return}cn(a instanceof Hh,`language type is not a LoroText`);let o=Pv.getByPath(`language_metadata/${e}`);if(!o){Dv.error(`no language metadata container found for cell`,e);return}cn(o instanceof Rh,`language metadata is not a LoroMap`),t(r,a),n(r,o),i=Pv.subscribe(e=>{if(e.origin===`local`)return;let i=e.events.some(e=>e.target===a.id),s=e.events.some(e=>e.target===o.id);i&&t(r,a),s&&n(r,o)})}),{destroy(){i()}}})}function zv(e){let t=Pv.getMap(`languages`).getOrCreateContainer(e,new Hh),n=Pv.getMap(`language_metadata`).getOrCreateContainer(e,new Rh);return N.updateListener.of(e=>{let r=t.toString()!==``;if(!e.docChanged&&r)return;if(!r){let r=Ze(e.state).type;yt(e.view,{language:r}),Dv.debug(`no initial language, setting default to`,r),t.delete(0,t.length),t.insert(0,r),Dv.debug(`no initial language metadata, setting default to`,e.state.field(dt));let i=e.state.field(dt);for(let e of Object.keys(i))n.set(e,i[e]);Pv.commit();return}let i=!1;for(let r of e.transactions)if(!r.annotation(ct)){for(let e of r.effects)if(e.is(_e)&&t.toString()!==e.value.type&&(Dv.debug(`[outgoing] language change: ${t} -> ${e.value.type}`),t.delete(0,t.length),t.insert(0,e.value.type),i=!0),e.is(ot)||e.is($e)){let t=e.value;e.is($e)?(Dv.debug(`[outgoing] setting language metadata: `,t),n.clear()):Dv.debug(`[outgoing] updating language metadata: `,t);for(let e of Object.keys(t))n.set(e,t[e]);i=!0}}i&&Pv.commit()})}function Bv(e,t,n,r,i,a){let o=`loro:cell:${i}`;return[hv,_v(),vv(),_i.define(i=>new Sv(i,e,n,t,r,o,a)),_i.define(n=>new Cv(n,e,t,o)),pv]}var Vv=Ie,Hv=e=>{let t=(0,I.c)(41),{resetOnBlur:n,placeholderText:r,initialValue:i,flexibleWidth:a,onNameChange:o,className:s}=e,c=n!==void 0&&n,l=i===void 0?null:i,u=a!==void 0&&a,{sendListFiles:d}=Ui(),[f,p]=(0,F.useState)(l),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=[],t[0]=m):m=t[0];let[h,g]=(0,F.useState)(m),[_,v]=(0,F.useState)(!1),y=(0,F.useRef)(null),b=(0,F.useRef)(!1),x,S;t[1]===l?(x=t[2],S=t[3]):(x=()=>{p(l)},S=[l],t[1]=l,t[2]=x,t[3]=S),(0,F.useEffect)(x,S);let C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{v(!0)},t[4]=C):C=t[4];let w=C,ee;t[5]!==l||t[6]!==c?(ee=e=>{e.relatedTarget?.closest(`.filename-input`)||(v(!1),c&&p(l))},t[5]=l,t[6]=c,t[7]=ee):ee=t[7];let te=ee,T;t[8]===f?T=t[9]:(T=Mn.dirname(f||``),t[8]=f,t[9]=T);let E=T,ne=Mn.basename(f||``),D=h.filter(e=>Mn.basename(e.path).startsWith(ne)),re;t[10]!==E||t[11]!==_||t[12]!==d?(re=async()=>{if(!_){g([]);return}let e=await d({path:E});g(e.files)},t[10]=E,t[11]=_,t[12]=d,t[13]=re):re=t[13];let ie;t[14]!==E||t[15]!==_?(ie=[E,_],t[14]=E,t[15]=_,t[16]=ie):ie=t[16];let{isPending:ae}=Qi(re,ie),O=Uv(f,h,l),k=(O||D.length>0)&&(0,L.jsxs)(_t,{className:`font-mono`,children:[!ae&&(0,L.jsx)(Xe,{children:`No files`}),O&&(0,L.jsxs)(ge,{variant:`success`,className:`py-2 px-3`,onSelect:()=>{O&&(b.current=!0,o(O),y.current?.blur())},children:[(0,L.jsx)(Va,{className:`w-4 h-4 mr-2`}),` `,(0,L.jsxs)(`span`,{className:`text-sm`,children:[l?`Rename to: `:`Save as: `,(0,L.jsx)(`span`,{className:`font-medium text-sm`,children:Mn.basename(O)})]})]},`_rename_`),D.map(e=>{let t=e.isDirectory?`directory`:ya(e.path),n=wa[t];return(0,L.jsxs)(ge,{variant:e.isDirectory?`default`:`muted`,className:`py-2 px-3`,onSelect:()=>{e.isDirectory?p(`${e.path}/`):p(e.path)},children:[(0,L.jsx)(n,{className:`w-4 h-4 mr-2`}),` `,Mn.basename(e.path)]},e.path)})]}),oe=Math.max(20,f?.length||r?.length||0)*10,se=_?f||``:l||``,ce;t[17]!==u||t[18]!==oe?(ce=u?{maxWidth:oe}:void 0,t[17]=u,t[18]=oe,t[19]=ce):ce=t[19];let le;t[20]===s?le=t[21]:(le=wn(s,`w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60`),t[20]=s,t[21]=le);let ue;t[22]!==r||t[23]!==se||t[24]!==ce||t[25]!==le?(ue=(0,L.jsx)(Vv,{children:(0,L.jsx)(ze,{"data-testid":`dir-completion-input`,tabIndex:-1,rootClassName:`border-none justify-center px-1`,spellCheck:`false`,value:se,onKeyDown:Wv,icon:null,ref:y,onValueChange:p,placeholder:r,autoComplete:`off`,style:ce,className:le})}),t[22]=r,t[23]=se,t[24]=ce,t[25]=le,t[26]=ue):ue=t[26];let de=k&&`group-focus-within:block`,fe;t[27]===de?fe=t[28]:(fe=wn(`p-0 w-full min-w-80 max-w-80vw hidden`,de),t[27]=de,t[28]=fe);let pe;t[29]!==k||t[30]!==fe?(pe=(0,L.jsx)(ht,{side:`bottom`,className:fe,portal:!1,children:k}),t[29]=k,t[30]=fe,t[31]=pe):pe=t[31];let me;t[32]!==ue||t[33]!==pe?(me=(0,L.jsxs)(_t,{children:[ue,pe]}),t[32]=ue,t[33]=pe,t[34]=me):me=t[34];let he;t[35]!==te||t[36]!==me?(he=(0,L.jsx)(Fe,{onFocus:w,onBlur:te,shouldFilter:!1,id:`filename-input`,className:`bg-transparent group filename-input`,children:me}),t[35]=te,t[36]=me,t[37]=he):he=t[37];let _e;return t[38]!==_||t[39]!==he?(_e=(0,L.jsx)(Sn,{children:(0,L.jsx)(Oe,{open:_,modal:!1,children:he})}),t[38]=_,t[39]=he,t[40]=_e):_e=t[40],_e};function Uv(e,t,n){if(e&&!e.endsWith(`/`)&&((ye(`markdown`)?new Set([`py`,`md`,`markdown`,`qmd`]):new Set([`py`])).has(Mn.extension(e))||(e=e.endsWith(`.`)?`${e}py`:e.endsWith(`.p`)?`${e}y`:`${e}.py`),!t.some(t=>t.path===e||Mn.basename(t.path)===e)&&!(n&&(n===e||Mn.basename(n)===e))))return e}function Wv(e){e.key===`Escape`&&e.currentTarget.blur()}var Gv=e=>{let t=(0,I.c)(33),n=()=>{Fa(new Blob([r()],{type:`text/plain`}),`${e.proposedName}.json`)},r=c(Jv),i;t[0]!==n||t[1]!==e?(i=t=>{t.preventDefault(),n(),e.closeModal()},t[0]=n,t[1]=e,t[2]=i):i=t[2];let a;t[3]===e?a=t[4]:(a=t=>{t.key===`Escape`&&e.closeModal()},t[3]=e,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,L.jsx)(Dr,{className:`text-accent-foreground mb-6`,children:`Download unsaved changes?`}),t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s={wordBreak:`break-word`},t[6]=s):s=t[6];let l,u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(`p`,{children:`This app has unsaved changes. To recover:`}),u={paddingBottom:`10px`},t[7]=l,t[8]=u):(l=t[7],u=t[8]);let d;t[9]===e.proposedName?d=t[10]:(d=(0,L.jsxs)(`li`,{style:u,children:[`Click the "Download" button. This will download a file called\xA0`,(0,L.jsxs)(`code`,{children:[e.proposedName,`.json`]}),`. This file contains your code.`]}),t[9]=e.proposedName,t[10]=d);let f;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(f={paddingBottom:`10px`},t[11]=f):f=t[11];let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p={display:`block`,padding:`10px`},t[12]=p):p=t[12];let m;t[13]===e.proposedName?m=t[14]:(m=(0,L.jsxs)(`code`,{style:p,children:[`marimo recover `,e.proposedName,`.json `,`>`,` `,e.proposedName,`.py`]}),t[13]=e.proposedName,t[14]=m);let h;t[15]===e.proposedName?h=t[16]:(h=(0,L.jsxs)(`code`,{children:[e.proposedName,`.py`]}),t[15]=e.proposedName,t[16]=h);let g;t[17]!==h||t[18]!==m?(g=(0,L.jsxs)(`li`,{style:f,children:[`In your terminal, type`,m,`to overwrite `,h,` with the recovered changes.`]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]!==g||t[21]!==d?(_=(0,L.jsx)(vr,{className:`markdown wrap-break-word`,style:s,children:(0,L.jsxs)(`div`,{className:`prose dark:prose-invert`,children:[l,(0,L.jsxs)(`ol`,{children:[d,g]})]})}),t[20]=g,t[21]=d,t[22]=_):_=t[22];let v;t[23]===e.closeModal?v=t[24]:(v=(0,L.jsx)(kn,{"aria-label":`Cancel`,variant:`secondary`,"data-testid":`cancel-recovery-button`,onClick:e.closeModal,children:`Cancel`}),t[23]=e.closeModal,t[24]=v);let y;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,L.jsx)(kn,{"data-testid":`download-recovery-button`,"aria-label":`Download`,variant:`default`,type:`submit`,children:`Download`}),t[25]=y):y=t[25];let b;t[26]===v?b=t[27]:(b=(0,L.jsxs)(xr,{children:[v,y]}),t[26]=v,t[27]=b);let x;return t[28]!==i||t[29]!==a||t[30]!==_||t[31]!==b?(x=(0,L.jsx)(Er,{className:`w-fit`,children:(0,L.jsxs)(`form`,{onSubmit:i,onKeyDown:a,children:[o,_,b]})}),t[28]=i,t[29]=a,t[30]=_,t[31]=b,t[32]=x):x=t[32],x},Kv=e=>{let t=(0,I.c)(12),{filename:n,needsSave:r}=e,{openModal:i,closeModal:a}=ur(),o;t[0]===n?o=t[1]:(o=n===null?`app`:Mn.basename(n).split(`.`)[0],t[0]=n,t[1]=o);let s=o,c;t[2]!==a||t[3]!==r||t[4]!==i||t[5]!==s?(c=()=>{r&&i((0,L.jsx)(Gv,{proposedName:s,closeModal:a}))},t[2]=a,t[3]=r,t[4]=i,t[5]=s,t[6]=c):c=t[6];let l=c;Kt(`global.save`,l);let u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=ra(`global.save`),t[7]=u):u=t[7];let d=r?`yellow`:`gray`,f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,L.jsx)(Wa,{strokeWidth:1.5,size:18}),t[8]=f):f=t[8];let p;return t[9]!==l||t[10]!==d?(p=(0,L.jsx)(Dn,{content:u,children:(0,L.jsx)(Ra,{onClick:l,id:`save-button`,"aria-label":`Save`,className:`rectangle`,color:d,children:f})}),t[9]=l,t[10]=d,t[11]=p):p=t[11],p};function qv(e){return{id:e.id,name:e.name,code:e.code,code_hash:null,config:{column:0,...e.config}}}function Jv(){let e=Ve(),t=Ee(e),n={version:`1`,metadata:{marimo_version:Ma()},cells:t.map(qv)};return JSON.stringify(n,null,2)}var Yv=class{capturedInputs=new Map;inFlight=new Map;cancelEntry(e){e.controller.abort(),e.deferred.status===`pending`&&e.deferred.resolve(void 0)}needsCapture(e,t){if(this.capturedInputs.get(e)===t)return!1;let n=this.inFlight.get(e);return!(n&&n.inputValue===t)}waitForInFlight(e,t){let n=this.inFlight.get(e);return n&&n.inputValue===t?n.deferred.promise:null}startCapture(e,t){let n=this.inFlight.get(e);n&&this.cancelEntry(n);let r=new AbortController,i=new qi,a={controller:r,inputValue:t,deferred:i};return this.inFlight.set(e,a),{signal:r.signal,markCaptured:n=>{this.inFlight.get(e)===a&&(i.resolve(n),this.capturedInputs.set(e,t),this.inFlight.delete(e))},markFailed:()=>{this.inFlight.get(e)===a&&(i.resolve(void 0),this.inFlight.delete(e))}}}prune(e){for(let t of this.capturedInputs.keys())e.has(t)||this.capturedInputs.delete(t);for(let[t,n]of this.inFlight)e.has(t)||(this.cancelEntry(n),this.inFlight.delete(t))}get isCapturing(){return this.inFlight.size>0}abort(){for(let e of this.inFlight.values())this.cancelEntry(e);this.inFlight.clear()}reset(){this.abort(),this.capturedInputs.clear()}},Xv=5e3;function Zv(){let e=(0,I.c)(20),t=i(Ut),{state:n}=i(hn),r;e[0]===t.auto_download?r=e[1]:(r=t.auto_download.includes(`markdown`),e[0]=t.auto_download,e[1]=r);let a=r,o;e[2]===t.auto_download?o=e[3]:(o=t.auto_download.includes(`html`),e[2]=t.auto_download,e[3]=o);let s=o,c;e[4]===t.auto_download?c=e[5]:(c=t.auto_download.includes(`ipynb`),e[4]=t.auto_download,e[5]=c);let l=c,u=n===mn.OPEN,d=!a||!u,f=!s||!u,p=!l||!u,{autoExportAsHTML:m,autoExportAsIPYNB:h,autoExportAsMarkdown:g,updateCellOutputs:_}=Ui(),v=ey(),y;e[6]===g?y=e[7]:(y=async()=>{await g({download:!1})},e[6]=g,e[7]=y);let b;e[8]===d?b=e[9]:(b={delayMs:Xv,whenVisible:!0,disabled:d},e[8]=d,e[9]=b),za(y,b);let x;e[10]===m?x=e[11]:(x=async()=>{await m({download:!1,includeCode:!0,files:In.INSTANCE.filenames(),layout:await Fn()})},e[10]=m,e[11]=x);let S;e[12]===f?S=e[13]:(S={delayMs:Xv,whenVisible:!0,disabled:f},e[12]=f,e[13]=S),za(x,S);let C;e[14]!==h||e[15]!==v||e[16]!==_?(C=async()=>{await ty({takeScreenshots:()=>v({progress:ia.indeterminate()}),updateCellOutputs:_}),await h({download:!1})},e[14]=h,e[15]=v,e[16]=_,e[17]=C):C=e[17];let w;e[18]===p?w=e[19]:(w={delayMs:Xv,whenVisible:!0,disabled:p,skipIfRunning:!0},e[18]=p,e[19]=w),za(C,w)}var Qv=new Set([`text/html`,`application/vnd.vegalite.v5+json`,`application/vnd.vega.v5+json`,`application/vnd.vegalite.v6+json`,`application/vnd.vega.v6+json`]),$v=new Yv;function ey(){let e=i(ve);return async t=>{let{progress:n}=t,r=new Set(sn.keys(e));$v.prune(r);let i=[],a=[];for(let[t,n]of sn.entries(e)){let e=n.output?.data;if(n.output?.mimetype&&Qv.has(n.output.mimetype)&&e){if($v.needsCapture(t,e))i.push([t,e]);else{let n=$v.waitForInFlight(t,e);n&&a.push({cellId:t,promise:n})}}}if(i.length===0&&a.length===0)return{};i.length>0&&n.addTotal(i.length);let o={};for(let[e,t]of i){let r=$v.startCapture(e,t);try{let t=await pa(e);if(r.signal.aborted)continue;if(!t){rn.error(`Failed to capture screenshot for cell ${e}`),r.markFailed();continue}let n=[`image/png`,t];o[e]=n,r.markCaptured(n)}catch(t){rn.error(`Error screenshotting cell ${e}:`,t),r.markFailed()}finally{n.increment(1)}}let s=await Promise.allSettled(a.map(({promise:e})=>e));for(let[e,{cellId:t}]of a.entries()){let n=s[e];n.status===`fulfilled`&&n.value&&(o[t]=n.value)}return o}}async function ty(e){let{takeScreenshots:t,updateCellOutputs:n}=e;try{let e=await t();sn.size(e)>0&&await n({cellIdsToOutput:e})}catch(e){rn.error(`Error updating cell outputs with screenshots:`,e),jr({title:`Failed to capture cell outputs`,description:`Some outputs may be missing from the export. Continuing.`,variant:`danger`})}}var ny=r(void 0),ry=r(e=>{let t=e(ny);return iy({state:e(Se),layout:e(ua),lastSavedNotebook:t})});function iy({state:e,layout:t,lastSavedNotebook:n}){if(!n)return!1;let{cellIds:r,cellData:i}=e,o=r.inOrderIds.map(e=>i[e]),s=o.map(e=>e.code),c=o.map(e=>e.config),l=o.map(e=>e.name);return!Ai(s,n.codes)||!Ai(l,n.names)||!a(c,n.configs)||!a(t.selectedLayout,n.layout.selectedLayout)||!a(t.layoutData,n.layout.layoutData)}function ay(e){let t=(0,I.c)(21),{codes:n,cellConfigs:r,config:i,connStatus:a,cellNames:o,needsSave:s,kioskMode:c,onSave:l}=e,u=(0,F.useRef)(null),d;t[0]===n?d=t[1]:(d=n.join(`:`),t[0]=n,t[1]=d);let f=d,p;t[2]===r?p=t[3]:(p=r.map(oy).join(`:`),t[2]=r,t[3]=p);let m=p,h;t[4]===o?h=t[5]:(h=o.join(`:`),t[4]=o,t[5]=h);let g=h,_;t[6]!==i||t[7]!==a.state||t[8]!==c||t[9]!==s||t[10]!==l?(_=()=>{if(!c)return i.autosave===`after_delay`&&(u.current!==null&&clearTimeout(u.current),s&&a.state===mn.OPEN&&(u.current=setTimeout(l,i.autosave_delay))),()=>{u.current!==null&&clearTimeout(u.current)}},t[6]=i,t[7]=a.state,t[8]=c,t[9]=s,t[10]=l,t[11]=_):_=t[11];let v;t[12]!==m||t[13]!==g||t[14]!==f||t[15]!==i||t[16]!==a.state||t[17]!==c||t[18]!==s||t[19]!==l?(v=[f,m,g,i,a.state,l,c,s],t[12]=m,t[13]=g,t[14]=f,t[15]=i,t[16]=a.state,t[17]=c,t[18]=s,t[19]=l,t[20]=v):v=t[20],(0,F.useEffect)(_,v)}function oy(e){return JSON.stringify(e)}var sy=Promise.resolve();function cy(e){let t=sy.then(e);return sy=t.then(()=>void 0,()=>void 0),t}var ly=e=>{let t=(0,I.c)(15),{kioskMode:n}=e,r=_a(),a=i(ry),o=i(hn).state===mn.CLOSED,{saveOrNameNotebook:s,saveIfNotebookIsPersistent:c}=uy(),l;t[0]!==n||t[1]!==c?(l={onSave:c,kioskMode:n},t[0]=n,t[1]=c,t[2]=l):l=t[2],hy(l),Zv();let u;t[3]===a?u=t[4]:(u=e=>{if(a)return e.preventDefault(),e.returnValue=`You have unsaved changes. Are you sure you want to leave?`,e.returnValue},t[3]=a,t[4]=u),on(window,`beforeunload`,u);let d;t[5]===s?d=t[6]:(d=e=>{e.preventDefault(),e.stopPropagation(),s()},t[5]=s,t[6]=d);let f=d;if(Kt(`global.save`,s),o){let e;return t[7]!==r||t[8]!==a?(e=(0,L.jsx)(Kv,{filename:r,needsSave:a}),t[7]=r,t[8]=a,t[9]=e):e=t[9],e}let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=ra(`global.save`),t[10]=p):p=t[10];let m=a?`yellow`:`hint-green`,h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,L.jsx)(Wa,{strokeWidth:1.5,size:18}),t[11]=h):h=t[11];let g;return t[12]!==f||t[13]!==m?(g=(0,L.jsx)(Dn,{content:p,children:(0,L.jsx)(Ra,{"data-testid":`save-button`,id:`save-button`,shape:`rectangle`,color:m,onClick:f,children:h})}),t[12]=f,t[13]=m,t[14]=g):g=t[14],g};function uy(){let e=(0,I.c)(21),{sendSave:t}=Ui(),{openModal:r,closeModal:i,openAlert:a}=ur(),o=l(ny),s=Ca(),u=n(),d;e[0]!==a||e[1]!==t||e[2]!==o||e[3]!==u?(d=(e,n)=>cy(async()=>{let r=u.get(hn),i=u.get(Ht);if(u.get(dn))return;if(r.state!==mn.OPEN){a(`Failed to save notebook: not connected to a kernel.`);return}if(rn.log(`saving to `,e),n&&i.format_on_save&&(rn.log(`formatting notebook (onSave)`),await he()),Ee(Ve()).length===0)return;let s=await ft(async()=>{let n=Ve(),r=Ee(n),i=r.map(py),a=r.map(fy),o=r.map(dy),s=Ae(n),c=u.get(ua);return await t({cellIds:i,codes:a,names:o,filename:e,configs:s,layout:Ln(),persist:!0}),{names:o,codes:a,configs:s,layout:c}});o(s)}),e[0]=a,e[1]=t,e[2]=o,e[3]=u,e[4]=d):d=e[4];let f=c(d),p;e[5]!==f||e[6]!==u?(p=e=>{let t=e!==void 0&&e,n=u.get(Et),r=u.get(hn);my(n)&&r.state===mn.OPEN&&f(n,t)},e[5]=f,e[6]=u,e[7]=p):p=e[7];let m=c(p),h;e[8]!==f||e[9]!==s?(h=e=>{s(e).then(e=>{e!==null&&f(e,!0)})},e[8]=f,e[9]=s,e[10]=h):h=e[10];let g=h,_;e[11]!==i||e[12]!==g||e[13]!==r||e[14]!==m||e[15]!==u?(_=()=>{let e=u.get(Et),t=u.get(hn);m(!0),!my(e)&&t.state!==mn.CLOSED&&r((0,L.jsx)(vy,{onClose:i,onSave:g}))},e[11]=i,e[12]=g,e[13]=r,e[14]=m,e[15]=u,e[16]=_):_=e[16];let v=c(_),y;return e[17]!==m||e[18]!==f||e[19]!==v?(y={saveOrNameNotebook:v,saveIfNotebookIsPersistent:m,saveNotebook:f},e[17]=m,e[18]=f,e[19]=v,e[20]=y):y=e[20],y}function dy(e){return e.name}function fy(e){return e.code}function py(e){return e.id}function my(e){return e!==null&&!e.startsWith(`/tmp/`)&&!e.startsWith(`/var/folders`)&&!e.includes(`AppData\\Local\\Temp`)}function hy(e){let n=(0,I.c)(14),r=i(Ht),a=C(),[o]=t(hn),s=i(ry),c,l;if(n[0]!==a){let e=Ee(a);c=e.map(_y),l=e.map(gy),n[0]=a,n[1]=c,n[2]=l}else c=n[1],l=n[2];let u=l,d;n[3]===a?d=n[4]:(d=Ae(a),n[3]=a,n[4]=d);let f=d,p;n[5]!==r||n[6]!==u||n[7]!==c||n[8]!==f||n[9]!==o||n[10]!==s||n[11]!==e.kioskMode||n[12]!==e.onSave?(p={onSave:e.onSave,needsSave:s,codes:c,cellConfigs:f,cellNames:u,connStatus:o,config:r,kioskMode:e.kioskMode},n[5]=r,n[6]=u,n[7]=c,n[8]=f,n[9]=o,n[10]=s,n[11]=e.kioskMode,n[12]=e.onSave,n[13]=p):p=n[13],ay(p)}function gy(e){return e.name}function _y(e){return e.code}var vy=e=>{let t=(0,I.c)(17),{onClose:n,onSave:r}=e,[i,a]=(0,F.useState)(),o;t[0]!==n||t[1]!==r?(o=e=>{a(e),e.trim()&&(r(e),n())},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,L.jsx)(Dr,{children:`Save notebook`}),t[3]=c):c=t[3];let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(En,{className:`text-md pt-6 px-1`,children:`Save as`}),t[4]=l):l=t[4];let u;t[5]===s?u=t[6]:(u=(0,L.jsxs)(`div`,{className:`flex flex-col`,children:[l,(0,L.jsx)(Hv,{onNameChange:s,placeholderText:`filename`,className:`missing-filename`})]}),t[5]=s,t[6]=u);let d;t[7]===n?d=t[8]:(d=(0,L.jsx)(kn,{"data-testid":`cancel-save-dialog-button`,"aria-label":`Cancel`,variant:`secondary`,onClick:n,children:`Cancel`}),t[7]=n,t[8]=d);let f=!i,p;t[9]===f?p=t[10]:(p=(0,L.jsx)(kn,{"data-testid":`submit-save-dialog-button`,"aria-label":`Save`,variant:`default`,disabled:f,type:`submit`,children:`Save`}),t[9]=f,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,L.jsxs)(xr,{children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,L.jsxs)(Er,{children:[c,u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h};function yy(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var by={modified:{doc:``},original:{doc:``}},xy=(0,F.createContext)(by);function Sy(e,t){return P({},e,t,{modified:P({},e.modified,t.modified),original:P({},e.original,t.original)})}var Cy=()=>(0,F.useContext)(xy),wy=e=>{var t=e.children,n=e.theme,r=(0,F.useReducer)(Sy,P({},by,{theme:n})),i=r[0],a=r[1];return(0,F.useEffect)(()=>a({theme:n}),[n]),(0,L.jsx)(xy.Provider,{value:P({},i,{dispatch:a}),children:t})},Ty=[`extensions`,`value`,`selection`,`onChange`],Ey=e=>{var t=e.extensions,n=t===void 0?[]:t,r=e.value,i=e.selection,a=e.onChange,o=ta(e,Ty),s=Cy(),c=s.theme,l=s.dispatch,u=ka(P({},o,{theme:c}));return(0,F.useEffect)(()=>l({original:{doc:r,selection:i,extensions:[...u,...n]},originalExtension:{onChange:a,option:o,extension:[n]}}),[e]),null};Ey.displayName=`CodeMirrorMerge.Original`;var Dy=[`extensions`,`value`,`selection`,`onChange`],Oy=e=>{var t=e.extensions,n=t===void 0?[]:t,r=e.value,i=e.selection,a=e.onChange,o=ta(e,Dy),s=Cy(),c=s.theme,l=s.dispatch,u=ka(P({},o,{theme:c}));return(0,F.useEffect)(()=>{l({modified:{doc:r,selection:i,extensions:[...u,...n]},modifiedExtension:{onChange:a,option:o,extension:[n]}})},[e]),null};Oy.displayName=`CodeMirrorMerge.Modified`;var ky=[`className`,`children`,`orientation`,`revertControls`,`highlightChanges`,`gutter`,`collapseUnchanged`,`destroyRerender`,`renderRevertControl`,`diffConfig`,`root`],Ay=[`modified`,`modifiedExtension`,`original`,`originalExtension`,`theme`,`dispatch`],jy=F.forwardRef((e,t)=>{var n=e.className,r=e.children,i=e.orientation,a=e.revertControls,o=e.highlightChanges,s=e.gutter,c=e.collapseUnchanged,l=e.destroyRerender,u=l===void 0||l,d=e.renderRevertControl,f=e.diffConfig,p=e.root,m=ta(e,ky),h=Cy(),g=h.modified,_=h.modifiedExtension,v=h.original,y=h.originalExtension,b=h.theme,x=h.dispatch,S=ta(h,Ay),C=(0,F.useRef)(null),w=(0,F.useRef)(),ee={orientation:i,revertControls:a,highlightChanges:o,gutter:s,collapseUnchanged:c,renderRevertControl:d,diffConfig:f,root:p};(0,F.useImperativeHandle)(t,()=>({container:C.current,view:w.current,modified:g,original:v,config:P({a:v,b:g,parent:C.current},ee)}),[C,w,g,v,ee]);var te=N.updateListener.of(e=>{if(e.docChanged&&typeof y?.onChange==`function`){var t=e.state.doc.toString();y?.onChange(t,e)}}),T=N.updateListener.of(e=>{if(e.docChanged&&typeof _?.onChange==`function`){var t=e.state.doc.toString();_?.onChange(t,e)}});return(0,F.useEffect)(()=>{!w.current&&C.current&&y&&_&&(w.current=new js(P({a:P({},v,{extensions:[...y?.extension||[],...ka(P({},y?.option,{theme:b})),te]}),b:P({},g,{extensions:[..._?.extension||[],...ka(P({},_?.option,{theme:b})),T]}),parent:C.current},ee)),x({view:w.current}))},[w,C,y,_]),(0,F.useEffect)(()=>{if(v&&v.doc&&w.current){var e=w.current?.a.state.doc.toString();if(e!==v.doc){var t;(t=w.current)==null||t.a.dispatch({changes:{from:0,to:e.length,insert:v.doc||``}})}}if(g&&g.doc&&w.current){var n=w.current?.b.state.doc.toString();if(n!==g.doc){var r;(r=w.current)==null||r.b.dispatch({changes:{from:0,to:n.length,insert:g.doc||``}})}}if(u&&w.current){var i=w.current.a.state.selection.ranges[0].from,a=w.current.b.state.selection.ranges[0].from;w.current.destroy(),w.current=new js(P({a:P({},v,{extensions:[...y?.extension||[],...ka(P({},y?.option,{theme:b}))]}),b:P({},g,{extensions:[..._?.extension||[],...ka(P({},_?.option,{theme:b}))]}),parent:C.current},ee)),i&&(w.current.a.focus(),w.current.a.dispatch({selection:{anchor:i,head:i}})),a&&(w.current.b.focus(),w.current.b.dispatch({selection:{anchor:a,head:a}}))}},[w,b,C.current,v,g,y,_,u]),(0,F.useEffect)(()=>()=>w.current&&w.current.destroy(),[]),(0,F.useEffect)(()=>{if(w.current){var e={};S.orientation!==i&&(e.orientation=i),S.revertControls!==a&&(e.revertControls=a),S.highlightChanges!==o&&(e.highlightChanges=o),S.gutter!==s&&(e.gutter=s),S.collapseUnchanged!==c&&(e.collapseUnchanged=c),S.renderRevertControl!==d&&(e.collapseUnchanged=c),Object.keys(e).length&&x&&w.current&&(w.current.reconfigure(P({},e)),x(P({},e)))}},[x,w,i,a,o,s,c,d]),(0,L.jsx)(`div`,P({ref:C,className:`cm-merge-theme`+(n?` `+n:``)},m,{children:r}))});jy.displayName=`CodeMirrorMerge.Internal`;var My=[`theme`],Ny=F.forwardRef((e,t)=>{var n=e.theme,r=ta(e,My);return(0,L.jsx)(wy,{theme:n,children:(0,L.jsx)(jy,P({},r,{ref:t}))})});Ny.Original=Ey,Ny.Modified=Oy,Ny.displayName=`CodeMirrorMerge`;var Py=Ny.Original,Fy=Ny.Modified,Iy=[pe(),N.lineWrapping],Ly=({cellId:e,aiCompletionCell:n,className:r,onChange:i,currentLanguageAdapter:a,currentCode:o,declineChange:s,acceptChange:c,runCell:l,outputArea:u,children:d})=>{let[p,m]=(0,F.useState)(!1),[h,g]=t(ba),_=(0,F.useId)(),v=_n(),{initialPrompt:y,triggerImmediately:x,cellId:C}=n??{},w=C===e,ee=Un(e),te;ee?.type===`update_cell`&&(te=ee.previousCode);let[T,E]=(0,F.useState)(``),[ne,D]=(0,F.useState)(y??``),re=F.useMemo(()=>new Rn({api:v.getAiURL(`completion`).toString(),headers:()=>v.headers(),prepareSendMessagesRequest:({body:e,id:t})=>({body:{...e,id:t}})}),[v]),{sendMessage:ie,stop:ae,status:O}=rr({throttle:100,transport:re,onData:e=>{if(e.type===zn){let t=Vn.parse(e.data);E(t.code.trimEnd())}},onError:e=>{E(``),jr({title:`Completion failed`,description:$i(e)})},onFinish:({isAbort:e,isDisconnect:t,isError:n,finishReason:r})=>{(e||t||n||r!==`stop`)&&E(``)}}),k=O===`submitted`||O===`streaming`,oe=(0,F.useCallback)(()=>{E(``),ae()},[ae]),se=(0,F.useCallback)(async e=>{await ae(),E(``);let t={...Gn({input:e}),prompt:e,includeOtherCode:h?me(o):``,code:o,language:a??`python`};await ie({text:e},{body:t})},[o,a,h,ie,ae]),ce=(0,F.useCallback)(()=>{se(ne)},[se,ne]),le=F.useRef(null),ue=(0,F.useCallback)(()=>{x&&!k&&y&&se(y)},[x]);(0,F.useEffect)(()=>{w&&(S(()=>{let e=le.current;return e?.view?(e.view.focus(),ue(),!0):!1},{retries:3,delay:100,initialDelay:100}),b(le.current?.view))},[w,ue]),(0,F.useEffect)(()=>{w&&D(y||``)},[w,y,D]);let{theme:de}=Yi(),fe=()=>{c(T),E(``)},pe=()=>{oe(),m(!0),le.current?.view?.focus()},he=w&&x&&(T||k);u??=`below`;let ge=w&&(!x||p),_e=(0,L.jsx)(`div`,{className:wn(`w-full bg-(--cm-background) flex justify-center transition-all duration-300 ease-in-out overflow-hidden`,he?`max-h-20 opacity-100 translate-y-0`:`max-h-0 opacity-0 -translate-y-2`),children:(0,L.jsx)(Ry,{status:k?`loading`:`generated`,onAccept:fe,onReject:pe,showInputPrompt:p,setShowInputPrompt:m,runCell:l,className:`mt-4 mb-3 w-lg`})}),ve=(e,t)=>(0,L.jsxs)(Ny,{className:`cm`,theme:de,children:[(0,L.jsx)(Py,{onChange:i,value:e,extensions:Iy}),(0,L.jsx)(Fy,{value:t,editable:!1,readOnly:!0,extensions:Iy})]}),ye=()=>{if(T&&w)return ve(o,T);if(!T&&te)return ve(te,o)},be=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Zn,{isLoading:k,onAccept:fe,size:`xs`,multipleCompletions:!1,label:er.accept,acceptShortcut:`Mod-↵`,runCell:l}),(0,L.jsx)($n,{onDecline:pe,size:`xs`,multipleCompletions:!1,label:er.decline,declineShortcut:`Shift-Mod-Delete`})]});return(0,L.jsxs)(`div`,{"data-ai-input-open":ge,className:wn(`flex flex-col w-full rounded-[inherit]`,r),children:[(0,L.jsx)(`div`,{className:wn(`flex items-center gap-2 px-3 transition-all rounded-[inherit] rounded-b-none duration-300`,ge&&`max-h-[400px] border-b min-h-11 visible`,!ge&&`max-h-0 min-h-0 invisible`),children:w&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(it,{className:`text-(--blue-10) shrink-0`,size:16}),(0,L.jsx)(Qn,{inputRef:le,className:`h-full my-0 py-2 flex items-center`,onClose:()=>{oe(),s()},value:ne,onChange:D,onSubmit:()=>{k||(le.current?.view&&Wn(le.current.view),ce())},onKeyDown:tr({handleAcceptCompletion:fe,handleDeclineCompletion:pe,isLoading:k,hasCompletion:T.trim().length>0})}),(0,L.jsxs)(`div`,{className:`-mr-1.5 py-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-row items-center justify-end gap-0.5`,children:[(0,L.jsx)(Xn,{isLoading:k,onStop:oe,onSendClick:ce,isEmpty:!ne.trim(),showStopLabel:!0}),(0,L.jsx)(Yn,{handleAddContext:()=>nr(le),isLoading:k}),(0,L.jsx)($t,{triggerClassName:`h-7 text-xs`,iconSize:`small`,forRole:`edit`,displayIconOnly:!0,placeholder:`Edit model`})]}),T&&(0,L.jsx)(`div`,{className:`mt-1 flex items-center gap-1`,children:be})]}),(0,L.jsx)(`div`,{className:`h-full w-px bg-border mx-2`}),(0,L.jsx)(Dn,{content:`Include code from other cells`,children:(0,L.jsxs)(`div`,{className:`flex flex-row items-start gap-1 overflow-hidden`,children:[(0,L.jsx)(f,{"data-testid":`include-other-cells-checkbox`,id:_,checked:h,onCheckedChange:e=>g(!!e)}),(0,L.jsx)(En,{htmlFor:_,className:`text-muted-foreground text-xs whitespace-nowrap ellipsis`,children:`All code`})]})}),(0,L.jsx)(kn,{"data-testid":`decline-completion-button`,variant:`text`,size:`icon`,disabled:k,onClick:()=>{oe(),s()},children:(0,L.jsx)(ir,{className:`text-(--red-10)`,size:16})})]})}),u===`above`&&_e,ye(),(!T||!w)&&!te&&d,u===`below`&&_e]})},Ry=e=>{let t=(0,I.c)(27),{status:n,onAccept:r,onReject:i,className:a,showInputPrompt:o,setShowInputPrompt:s,runCell:c}=e,l=n===`loading`,u;t[0]===a?u=t[1]:(u=wn(`flex flex-row items-center gap-6 rounded-md py-2 px-2.5 text-sm border border-border bg-(--gray-2) dark:bg-(--gray-3)`,a),t[0]=a,t[1]=u);let d;t[2]===l?d=t[3]:(d=l?(0,L.jsx)(ha,{className:`animate-spin text-blue-600 mb-px`,size:15,strokeWidth:2,"aria-label":`Generating fix`}):(0,L.jsx)(Ba,{className:`text-green-600 mb-px`,size:15,strokeWidth:2,"aria-label":`Fix generated`}),t[2]=l,t[3]=d);let f=l?`Generating fix...`:`Showing fix`,p;t[4]===f?p=t[5]:(p=(0,L.jsx)(`p`,{className:`transition-opacity duration-200 text-muted-foreground`,children:f}),t[4]=f,t[5]=p);let m;t[6]!==d||t[7]!==p?(m=(0,L.jsxs)(`div`,{className:`flex flex-row items-center gap-2`,children:[d,p]}),t[6]=d,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,L.jsx)(En,{htmlFor:`show-input-prompt`,className:`text-muted-foreground text-xs whitespace-nowrap ellipsis`,children:`Show prompt`}),t[9]=h):h=t[9];let g;t[10]!==s||t[11]!==o?(g=(0,L.jsxs)(`div`,{className:`flex flex-row items-center gap-1`,children:[h,(0,L.jsx)(ga,{checked:o,onCheckedChange:s,size:`xs`})]}),t[10]=s,t[11]=o,t[12]=g):g=t[12];let _;t[13]!==l||t[14]!==r||t[15]!==c?(_=(0,L.jsx)(Zn,{isLoading:l,onAccept:r,size:`xs`,label:er.accept,runCell:c}),t[13]=l,t[14]=r,t[15]=c,t[16]=_):_=t[16];let v;t[17]===i?v=t[18]:(v=(0,L.jsx)($n,{onDecline:i,size:`xs`,label:er.decline}),t[17]=i,t[18]=v);let y;t[19]!==_||t[20]!==v?(y=(0,L.jsxs)(`div`,{className:`flex flex-row items-center gap-2 ml-auto`,children:[_,v]}),t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;return t[22]!==u||t[23]!==y||t[24]!==m||t[25]!==g?(b=(0,L.jsxs)(`div`,{className:u,children:[m,g,y]}),t[22]=u,t[23]=y,t[24]=m,t[25]=g,t[26]=b):b=t[26],b},zy=`web application/x-marimo-cell`,By=Nt({cells:Pt(Nt({code:jt(),name:jt().optional(),config:Nt({column:At([Ot(),Ft()]).optional(),disabled:Mt().optional(),hide_code:Mt().optional(),expand_output:Mt().optional()}).optional()})),version:kt(`1.0`)});function Vy(e){return e.map(e=>e.code).join(`
19
+ `).trim()}function Lm(e,t,n,r){return r!==`{`||t!==n||!Hr(e.state).resolveInner(t,-1)?.type.name.includes(`String`)?!1:(e.dispatch({changes:{from:t,to:n,insert:`{}`},selection:{anchor:t+1},userEvent:`input.type`}),!0)}function Rm(){return N.inputHandler.of(Lm)}function zm(e){let{showPlaceholder:t,enableAI:n}=e;return t?`marimo-import`:n?`ai`:`none`}var Bm=`cm-tooltip-portal`;function Vm(e){if(e==null)return document.querySelector(`#App`)??void 0;let t=document.querySelector(e);if(t==null)return;let n=t.querySelector(`:scope > .${Bm}`);if(n!=null)return n;let r=document.createElement(`div`);return r.className=`${Bm} not-prose contents`,t.append(r),r}var Hm=e=>{let{cellId:t,keymapConfig:n,hotkeys:r,enableAI:i,cellActions:a,completionConfig:o,lspConfig:s,diagnosticsConfig:c,displayConfig:l,inlineAiTooltip:u}=e,d=zm(e);return[Gt(n,r),Mm(),Nm(),Jl(),Re({cellId:t,completionConfig:o,hotkeys:r,placeholderType:d,lspConfig:s,diagnosticsConfig:c}),Ye({cellId:t,hotkeys:r,cellActions:a,keymapConfig:n}),Wm(e),jm(),c?.enabled?Di():[],i&&u?[zc({prompt:e=>ol({prompt:e.prompt,selection:e.selection,codeBefore:e.codeBefore,codeAfter:e.codeAfter,language:at(e.editorView)})}),Nc.of({hideOnBlur:!0})]:[],re(t,l.reference_highlighting??!0),Gl(t,l.code_lens??!0)]},Um=e=>{let{from:t,to:n}=e.state.selection.main;if(t!==n)return!1;let r=e.state.doc.lineAt(n);return r.text.slice(0,n-r.from).trim()!==``&&Li(e)},Wm=e=>{let{theme:t,hotkeys:n,completionConfig:r,acceptCompletionOnEnter:i,cellId:a,lspConfig:o,diagnosticsConfig:s,tooltipParentSelector:c}=e,l=zm(e),u=r.auto_close_pairs!==!1;return[N.lineWrapping,fi(),di(),bi(),ei(),Ir(),Lr(),Pr(),Br({position:`fixed`,parent:Vm(c)}),Qe(),t===`dark`?Ma:ja,qe(o),sm(r),yi(),Rm(),u?Ri():[],Zl(i),u?gi.high(ti.of(Pi)):[],mi(),Xr(),Wr.of(` `),ri(oi,{fallback:!0}),ti.of(Rr),rt({placeholderType:l,completionConfig:r,hotkeys:n,cellId:a,lspConfig:{...o,diagnostics:s}}),He.of(Ti()),ii.allowMultipleSelections.of(!0),Cm(n),ti.of([{key:`Tab`,run:e=>Bi(e)||Um(e)||Si(e),preventDefault:!0},{key:n.getHotkey(`completion.moveDown`).key,run:e=>zi(e.state)!==null&&(Ii(!0)(e),!0),preventDefault:!0},{key:n.getHotkey(`completion.moveUp`).key,run:e=>zi(e.state)!==null&&(Ii(!1)(e),!0),preventDefault:!0}]),ti.of([...Ai,wi])]},G;function Gm(e){G=e}var K=Array(128).fill(void 0);K.push(void 0,null,!0,!1);function q(e){return K[e]}var J=0,Km=null;function qm(){return(Km===null||Km.byteLength===0)&&(Km=new Uint8Array(G.memory.buffer)),Km}var Jm=new(typeof TextEncoder>`u`?(0,module.require)(`util`).TextEncoder:TextEncoder)(`utf-8`),Ym=typeof Jm.encodeInto==`function`?function(e,t){return Jm.encodeInto(e,t)}:function(e,t){let n=Jm.encode(e);return t.set(n),{read:e.length,written:n.length}};function Y(e,t,n){if(n===void 0){let n=Jm.encode(e),r=t(n.length,1)>>>0;return qm().subarray(r,r+n.length).set(n),J=n.length,r}let r=e.length,i=t(r,1)>>>0,a=qm(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=qm().subarray(i+o,i+r),a=Ym(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return J=o,i}var Xm=null;function X(){return(Xm===null||Xm.buffer.detached===!0||Xm.buffer.detached===void 0&&Xm.buffer!==G.memory.buffer)&&(Xm=new DataView(G.memory.buffer)),Xm}var Zm=K.length;function Z(e){Zm===K.length&&K.push(K.length+1);let t=Zm;return Zm=K[t],K[t]=e,t}function Qm(e,t){try{return e.apply(this,t)}catch(e){G.__wbindgen_exn_store(Z(e))}}var $m=new(typeof TextDecoder>`u`?(0,module.require)(`util`).TextDecoder:TextDecoder)(`utf-8`,{ignoreBOM:!0,fatal:!0});$m.decode();function Q(e,t){return e>>>=0,$m.decode(qm().subarray(e,e+t))}function eh(e){e<132||(K[e]=Zm,Zm=e)}function $(e){let t=q(e);return eh(e),t}function th(e){return e==null}var nh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>{G.__wbindgen_export_4.get(e.dtor)(e.a,e.b)});function rh(e,t,n,r){let i={a:e,b:t,cnt:1,dtor:n},a=(...e)=>{i.cnt++;let t=i.a;i.a=0;try{return r(t,i.b,...e)}finally{--i.cnt===0?(G.__wbindgen_export_4.get(i.dtor)(t,i.b),nh.unregister(i)):i.a=t}};return a.original=i,nh.register(a,i,i),a}function ih(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=ih(e[0]));for(let r=1;r<t;r++)n+=`, `+ih(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}function ah(){let e,t;try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.LORO_VERSION(i);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);return e=n,t=r,Q(n,r)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(e,t,1)}}function oh(e,t){let n=t(e.length*1,1)>>>0;return qm().set(e,n/1),J=e.length,n}function sh(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=oh(e,G.__wbindgen_malloc),o=J;G.decodeImportBlobMeta(i,a,o,t);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}function ch(){G.callPendingEvents()}function lh(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.redactJsonUpdates(i,Z(e),Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}function uh(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;return G.isValidContainerId(t,n)!==0}function dh(){G.run()}function fh(e,t){let n=t(e.length*4,4)>>>0,r=X();for(let t=0;t<e.length;t++)r.setUint32(n+4*t,Z(e[t]),!0);return J=e.length,n}function ph(e,t){return e>>>=0,qm().subarray(e/1,e/1+t)}function mh(e){try{let a=G.__wbindgen_add_to_stack_pointer(-16),o=fh(e,G.__wbindgen_malloc),s=J;G.encodeFrontiers(a,o,s);var t=X().getInt32(a+0,!0),n=X().getInt32(a+4,!0),r=X().getInt32(a+8,!0);if(X().getInt32(a+12,!0))throw $(r);var i=ph(t,n).slice();return G.__wbindgen_free(t,n*1,1),i}finally{G.__wbindgen_add_to_stack_pointer(16)}}function hh(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=oh(e,G.__wbindgen_malloc),a=J;G.decodeFrontiers(r,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}function gh(){G.setDebug()}var _h=128;function vh(e){if(_h==1)throw Error(`out of js stack`);return K[--_h]=e,_h}function yh(e,t){if(!(e instanceof t))throw Error(`expected instance of ${t.name}`)}function bh(e,t){e>>>=0;let n=X(),r=[];for(let i=e;i<e+4*t;i+=4)r.push($(n.getUint32(i,!0)));return r}function xh(e,t,n){G._dyn_core_9b3796e30d99ddb7___ops__function__FnMut_______Output______as_wasm_bindgen_c71729c74976bed3___closure__WasmClosure___describe__invoke___wasm_bindgen_c71729c74976bed3___JsValue_____(e,t,Z(n))}function Sh(e,t){G._dyn_core_9b3796e30d99ddb7___ops__function__FnMut_____Output______as_wasm_bindgen_c71729c74976bed3___closure__WasmClosure___describe__invoke______(e,t)}var Ch=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_awarenesswasm_free(e>>>0,1)),wh=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ch.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_awarenesswasm_free(e,0)}getAllStates(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_getAllStates(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getTimestamp(e){try{let i=G.__wbindgen_add_to_stack_pointer(-32);G.awarenesswasm_getTimestamp(i,this.__wbg_ptr,Z(e));var t=X().getInt32(i+0,!0),n=X().getFloat64(i+8,!0),r=X().getInt32(i+16,!0);if(X().getInt32(i+20,!0))throw $(r);return t===0?void 0:n}finally{G.__wbindgen_add_to_stack_pointer(32)}}setLocalState(e){G.awarenesswasm_setLocalState(this.__wbg_ptr,Z(e))}removeOutdated(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_removeOutdated(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}constructor(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_new(i,Z(e),t);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return this.__wbg_ptr=n>>>0,Ch.register(this,this.__wbg_ptr,this),this}finally{G.__wbindgen_add_to_stack_pointer(16)}}peer(){return $(G.awarenesswasm_peer(this.__wbg_ptr))}apply(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=oh(e,G.__wbindgen_malloc),a=J;G.awarenesswasm_apply(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}peers(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_peers(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}encode(e){try{let a=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_encode(a,this.__wbg_ptr,Z(e));var t=X().getInt32(a+0,!0),n=X().getInt32(a+4,!0),r=X().getInt32(a+8,!0);if(X().getInt32(a+12,!0))throw $(r);var i=ph(t,n).slice();return G.__wbindgen_free(t,n*1,1),i}finally{G.__wbindgen_add_to_stack_pointer(16)}}length(){return G.awarenesswasm_length(this.__wbg_ptr)}isEmpty(){return G.awarenesswasm_isEmpty(this.__wbg_ptr)!==0}getState(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_getState(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}encodeAll(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.awarenesswasm_encodeAll(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=ph(e,t).slice();return G.__wbindgen_free(e,t*1,1),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}},Th=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_changemodifier_free(e>>>0,1)),Eh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Th.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Th.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_changemodifier_free(e,0)}setMessage(t){let n=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),r=J,i=G.changemodifier_setMessage(this.__wbg_ptr,n,r);return e.__wrap(i)}setTimestamp(t){let n=G.changemodifier_setTimestamp(this.__wbg_ptr,t);return e.__wrap(n)}},Dh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_cursor_free(e>>>0,1)),Oh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Dh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Dh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_cursor_free(e,0)}containerId(){return $(G.cursor_containerId(this.__wbg_ptr))}pos(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.cursor_pos(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}kind(){return $(G.cursor_kind(this.__wbg_ptr))}side(){return $(G.cursor_side(this.__wbg_ptr))}static decode(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=oh(t,G.__wbindgen_malloc),o=J;G.cursor_decode(i,a,o);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}encode(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.cursor_encode(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=ph(e,t).slice();return G.__wbindgen_free(e,t*1,1),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}},kh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_ephemeralstorewasm_free(e>>>0,1)),Ah=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,kh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_ephemeralstorewasm_free(e,0)}getAllStates(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.ephemeralstorewasm_getAllStates(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}removeOutdated(){G.ephemeralstorewasm_removeOutdated(this.__wbg_ptr)}subscribeLocalUpdates(e){return $(G.ephemeralstorewasm_subscribeLocalUpdates(this.__wbg_ptr,Z(e)))}get(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;return $(G.ephemeralstorewasm_get(this.__wbg_ptr,t,n))}constructor(e){let t=G.ephemeralstorewasm_new(e);return this.__wbg_ptr=t>>>0,kh.register(this,this.__wbg_ptr,this),this}set(e,t){let n=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),r=J;G.ephemeralstorewasm_set(this.__wbg_ptr,n,r,Z(t))}keys(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.ephemeralstorewasm_keys(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}apply(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16),r=oh(e,G.__wbindgen_malloc),i=J;G.ephemeralstorewasm_apply(n,this.__wbg_ptr,r,i);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}delete(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;G.ephemeralstorewasm_delete(this.__wbg_ptr,t,n)}encode(e){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.ephemeralstorewasm_encode(i,this.__wbg_ptr,a,o);var t=X().getInt32(i+0,!0),n=X().getInt32(i+4,!0),r=ph(t,n).slice();return G.__wbindgen_free(t,n*1,1),r}finally{G.__wbindgen_add_to_stack_pointer(16)}}isEmpty(){return G.ephemeralstorewasm_isEmpty(this.__wbg_ptr)!==0}encodeAll(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.ephemeralstorewasm_encodeAll(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=ph(e,t).slice();return G.__wbindgen_free(e,t*1,1),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){return $(G.ephemeralstorewasm_subscribe(this.__wbg_ptr,Z(e)))}},jh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorocounter_free(e>>>0,1)),Mh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,jh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,jh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorocounter_free(e,0)}isAttached(){return G.lorocounter_isAttached(this.__wbg_ptr)!==0}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_getShallowValue(n,this.__wbg_ptr);var e=X().getFloat64(n+0,!0),t=X().getInt32(n+8,!0);if(X().getInt32(n+12,!0))throw $(t);return e}finally{G.__wbindgen_add_to_stack_pointer(16)}}get id(){return $(G.lorocounter_id(this.__wbg_ptr))}constructor(){let e=G.lorocounter_new();return this.__wbg_ptr=e>>>0,jh.register(this,this.__wbg_ptr,this),this}kind(){return $(G.lorocounter_kind(this.__wbg_ptr))}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_getShallowValue(n,this.__wbg_ptr);var e=X().getFloat64(n+0,!0),t=X().getInt32(n+8,!0);if(X().getInt32(n+12,!0))throw $(t);return e}finally{G.__wbindgen_add_to_stack_pointer(16)}}decrement(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_decrement(n,this.__wbg_ptr,e);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get value(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_getShallowValue(n,this.__wbg_ptr);var e=X().getFloat64(n+0,!0),t=X().getInt32(n+8,!0);if(X().getInt32(n+12,!0))throw $(t);return e}finally{G.__wbindgen_add_to_stack_pointer(16)}}increment(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_increment(n,this.__wbg_ptr,e);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorocounter_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},Nh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorodoc_free(e>>>0,1)),Ph=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Nh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Nh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorodoc_free(e,0)}applyDiff(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_applyDiff(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isShallow(){return G.lorodoc_isShallow(this.__wbg_ptr)!==0}changeCount(){return G.lorodoc_changeCount(this.__wbg_ptr)>>>0}getByPath(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorodoc_getByPath(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getCounter(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getCounter(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Mh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}isDetached(){return G.lorodoc_isDetached(this.__wbg_ptr)!==0}get peerIdStr(){return $(G.lorodoc_peerIdStr(this.__wbg_ptr))}setPeerId(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_setPeerId(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getCursorPos(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);yh(e,Oh),G.lorodoc_getCursorPos(r,this.__wbg_ptr,e.__wbg_ptr);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}hasContainer(e){return G.lorodoc_hasContainer(this.__wbg_ptr,Z(e))!==0}importBatch(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_importBatch(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}cmpFrontiers(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=fh(e,G.__wbindgen_malloc),o=J,s=fh(t,G.__wbindgen_malloc),c=J;G.lorodoc_cmpFrontiers(i,this.__wbg_ptr,a,o,s,c);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}debugHistory(){G.lorodoc_debugHistory(this.__wbg_ptr)}static fromSnapshot(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=oh(t,G.__wbindgen_malloc),o=J;G.lorodoc_fromSnapshot(i,a,o);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getChangeAt(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getChangeAt(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}oplogVersion(){let e=G.lorodoc_oplogVersion(this.__wbg_ptr);return Xh.__wrap(e)}getMovableList(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getMovableList(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Bh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}frontiersToVV(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=fh(e,G.__wbindgen_malloc),a=J;G.lorodoc_frontiersToVV(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Xh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getAllChanges(){return $(G.lorodoc_getAllChanges(this.__wbg_ptr))}oplogFrontiers(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_oplogFrontiers(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}vvToFrontiers(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);yh(e,Xh),G.lorodoc_vvToFrontiers(r,this.__wbg_ptr,e.__wbg_ptr);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}shallowSinceVV(){let e=G.lorodoc_shallowSinceVV(this.__wbg_ptr);return Xh.__wrap(e)}configTextStyle(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_configTextStyle(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getOpsInChange(e){try{let a=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getOpsInChange(a,this.__wbg_ptr,Z(e));var t=X().getInt32(a+0,!0),n=X().getInt32(a+4,!0),r=X().getInt32(a+8,!0);if(X().getInt32(a+12,!0))throw $(r);var i=bh(t,n).slice();return G.__wbindgen_free(t,n*4,4),i}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getShallowValue(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}checkoutToLatest(){try{let t=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_checkoutToLatest(t,this.__wbg_ptr);var e=X().getInt32(t+0,!0);if(X().getInt32(t+4,!0))throw $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}cmpWithFrontiers(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=fh(e,G.__wbindgen_malloc),a=J;G.lorodoc_cmpWithFrontiers(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return t}finally{G.__wbindgen_add_to_stack_pointer(16)}}exportJsonInIdSpan(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_exportJsonInIdSpan(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}subscribeJsonpath(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.lorodoc_subscribeJsonpath(i,this.__wbg_ptr,a,o,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}deleteRootContainer(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_deleteRootContainer(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}exportJsonUpdates(e,t,n){try{let a=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_exportJsonUpdates(a,this.__wbg_ptr,Z(e),Z(t),th(n)?16777215:+!!n);var r=X().getInt32(a+0,!0),i=X().getInt32(a+4,!0);if(X().getInt32(a+8,!0))throw $(i);return $(r)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getContainerById(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getContainerById(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getPendingTxnLength(){return G.lorodoc_getPendingTxnLength(this.__wbg_ptr)>>>0}importJsonUpdates(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_importJsonUpdates(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}importUpdateBatch(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_importBatch(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}setDetachedEditing(e){G.lorodoc_setDetachedEditing(this.__wbg_ptr,e)}setRecordTimestamp(e){G.lorodoc_setRecordTimestamp(this.__wbg_ptr,e)}subscribePreCommit(e){return $(G.lorodoc_subscribePreCommit(this.__wbg_ptr,Z(e)))}findIdSpansBetween(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=fh(e,G.__wbindgen_malloc),o=J,s=fh(t,G.__wbindgen_malloc),c=J;G.lorodoc_findIdSpansBetween(i,this.__wbg_ptr,a,o,s,c);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getChangeAtLamport(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.lorodoc_getChangeAtLamport(i,this.__wbg_ptr,a,o,t);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getPathToContainer(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getPathToContainer(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getChangedContainersIn(e,t){try{let o=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getChangedContainersIn(o,this.__wbg_ptr,Z(e),t);var n=X().getInt32(o+0,!0),r=X().getInt32(o+4,!0),i=X().getInt32(o+8,!0);if(X().getInt32(o+12,!0))throw $(i);var a=bh(n,r).slice();return G.__wbindgen_free(n,r*4,4),a}finally{G.__wbindgen_add_to_stack_pointer(16)}}getDeepValueWithID(){return $(G.lorodoc_getDeepValueWithID(this.__wbg_ptr))}setNextCommitOrigin(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;G.lorodoc_setNextCommitOrigin(this.__wbg_ptr,t,n)}getUncommittedOpsAsJson(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getUncommittedOpsAsJson(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}setNextCommitMessage(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;G.lorodoc_setNextCommitMessage(this.__wbg_ptr,t,n)}setNextCommitOptions(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_setNextCommitOptions(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}shallowSinceFrontiers(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_shallowSinceFrontiers(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}subscribeLocalUpdates(e){return $(G.lorodoc_subscribeLocalUpdates(this.__wbg_ptr,Z(e)))}travelChangeAncestors(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=fh(e,G.__wbindgen_malloc),a=J;G.lorodoc_travelChangeAncestors(r,this.__wbg_ptr,i,a,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}clearNextCommitOptions(){G.lorodoc_clearNextCommitOptions(this.__wbg_ptr)}configDefaultTextStyle(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_configDefaultTextStyle(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}setChangeMergeInterval(e){G.lorodoc_setChangeMergeInterval(this.__wbg_ptr,e)}setNextCommitTimestamp(e){G.lorodoc_setNextCommitTimestamp(this.__wbg_ptr,e)}setHideEmptyRootContainers(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_setHideEmptyRootContainers(n,this.__wbg_ptr,e);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDetachedEditingEnabled(){return G.lorodoc_isDetachedEditingEnabled(this.__wbg_ptr)!==0}subscribeFirstCommitFromPeer(e){return $(G.lorodoc_subscribeFirstCommitFromPeer(this.__wbg_ptr,Z(e)))}constructor(){let e=G.lorodoc_new();return this.__wbg_ptr=e>>>0,Nh.register(this,this.__wbg_ptr,this),this}diff(e,t,n){try{let a=G.__wbindgen_add_to_stack_pointer(-16),o=fh(e,G.__wbindgen_malloc),s=J,c=fh(t,G.__wbindgen_malloc),l=J;G.lorodoc_diff(a,this.__wbg_ptr,o,s,c,l,th(n)?16777215:+!!n);var r=X().getInt32(a+0,!0),i=X().getInt32(a+4,!0);if(X().getInt32(a+8,!0))throw $(i);return $(r)}finally{G.__wbindgen_add_to_stack_pointer(16)}}fork(){let t=G.lorodoc_fork(this.__wbg_ptr);return e.__wrap(t)}attach(){G.lorodoc_attach(this.__wbg_ptr)}commit(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_commit(n,this.__wbg_ptr,th(e)?0:Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}detach(){G.lorodoc_detach(this.__wbg_ptr)}export(e){try{let a=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_export(a,this.__wbg_ptr,Z(e));var t=X().getInt32(a+0,!0),n=X().getInt32(a+4,!0),r=X().getInt32(a+8,!0);if(X().getInt32(a+12,!0))throw $(r);var i=ph(t,n).slice();return G.__wbindgen_free(t,n*1,1),i}finally{G.__wbindgen_add_to_stack_pointer(16)}}import(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=oh(e,G.__wbindgen_malloc),a=J;G.lorodoc_import(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}forkAt(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=fh(t,G.__wbindgen_malloc),o=J;G.lorodoc_forkAt(i,this.__wbg_ptr,a,o);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getMap(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getMap(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Rh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}opCount(){return G.lorodoc_opCount(this.__wbg_ptr)>>>0}get peerId(){let e=G.lorodoc_peerId(this.__wbg_ptr);return BigInt.asUintN(64,e)}toJSON(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_toJSON(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}version(){let e=G.lorodoc_version(this.__wbg_ptr);return Xh.__wrap(e)}checkout(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16),r=fh(e,G.__wbindgen_malloc),i=J;G.lorodoc_checkout(n,this.__wbg_ptr,r,i);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getList(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getList(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Ih.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}getText(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getText(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Hh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}getTree(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_getTree(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Wh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}frontiers(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorodoc_frontiers(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}JSONPath(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorodoc_JSONPath(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}revertTo(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16),r=fh(e,G.__wbindgen_malloc),i=J;G.lorodoc_revertTo(n,this.__wbg_ptr,r,i);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}subscribe(e){return $(G.lorodoc_subscribe(this.__wbg_ptr,Z(e)))}},Fh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorolist_free(e>>>0,1)),Ih=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Fh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Fh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorolist_free(e,0)}isAttached(){return G.lorolist_isAttached(this.__wbg_ptr)!==0}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}pushContainer(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_pushContainer(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}insertContainer(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_insertContainer(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){return $(G.lorolist_getShallowValue(this.__wbg_ptr))}get id(){return $(G.lorolist_id(this.__wbg_ptr))}get(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_get(r,this.__wbg_ptr,e);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}constructor(){let e=G.lorolist_new();return this.__wbg_ptr=e>>>0,Fh.register(this,this.__wbg_ptr,this),this}pop(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_pop(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}kind(){return $(G.lorolist_kind(this.__wbg_ptr))}push(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_push(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}clear(){try{let t=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_clear(t,this.__wbg_ptr);var e=X().getInt32(t+0,!0);if(X().getInt32(t+4,!0))throw $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}delete(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_delete(r,this.__wbg_ptr,e,t);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}insert(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_insert(r,this.__wbg_ptr,e,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get length(){return G.lorolist_length(this.__wbg_ptr)>>>0}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getIdAt(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_getIdAt(r,this.__wbg_ptr,e);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.lorolist_toJSON(this.__wbg_ptr))}toArray(){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_toArray(i,this.__wbg_ptr);var e=X().getInt32(i+0,!0),t=X().getInt32(i+4,!0),n=X().getInt32(i+8,!0);if(X().getInt32(i+12,!0))throw $(n);var r=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),r}finally{G.__wbindgen_add_to_stack_pointer(16)}}getCursor(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_getCursor(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return n===0?void 0:Oh.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDeleted(){return G.lorolist_isDeleted(this.__wbg_ptr)!==0}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorolist_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},Lh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_loromap_free(e>>>0,1)),Rh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Lh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Lh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_loromap_free(e,0)}isAttached(){return G.loromap_isAttached(this.__wbg_ptr)!==0}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getLastEditor(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;return $(G.loromap_getLastEditor(this.__wbg_ptr,t,n))}setContainer(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.loromap_setContainer(i,this.__wbg_ptr,a,o,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){return $(G.loromap_getShallowValue(this.__wbg_ptr))}ensureMergeableMap(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.loromap_ensureMergeableMap(i,this.__wbg_ptr,a,o);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}ensureMergeableList(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_ensureMergeableList(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Ih.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}ensureMergeableText(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_ensureMergeableText(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Hh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}ensureMergeableTree(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_ensureMergeableTree(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Wh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getOrCreateContainer(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.loromap_getOrCreateContainer(i,this.__wbg_ptr,a,o,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}ensureMergeableCounter(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_ensureMergeableCounter(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Mh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}ensureMergeableMovableList(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_ensureMergeableMovableList(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return Bh.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get id(){return $(G.loromap_id(this.__wbg_ptr))}get(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_get(r,this.__wbg_ptr,i,a);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}constructor(){let e=G.loromap_new();return this.__wbg_ptr=e>>>0,Lh.register(this,this.__wbg_ptr,this),this}keys(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_keys(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}kind(){return $(G.loromap_kind(this.__wbg_ptr))}get size(){return G.loromap_size(this.__wbg_ptr)>>>0}clear(){try{let t=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_clear(t,this.__wbg_ptr);var e=X().getInt32(t+0,!0);if(X().getInt32(t+4,!0))throw $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}delete(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16),r=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),i=J;G.loromap_delete(n,this.__wbg_ptr,r,i);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}set(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.loromap_set(r,this.__wbg_ptr,i,a,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}values(){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_values(i,this.__wbg_ptr);var e=X().getInt32(i+0,!0),t=X().getInt32(i+4,!0),n=X().getInt32(i+8,!0);if(X().getInt32(i+12,!0))throw $(n);var r=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),r}finally{G.__wbindgen_add_to_stack_pointer(16)}}entries(){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_entries(i,this.__wbg_ptr);var e=X().getInt32(i+0,!0),t=X().getInt32(i+4,!0),n=X().getInt32(i+8,!0);if(X().getInt32(i+12,!0))throw $(n);var r=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),r}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.loromap_toJSON(this.__wbg_ptr))}isDeleted(){return G.loromap_isDeleted(this.__wbg_ptr)!==0}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromap_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},zh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_loromovablelist_free(e>>>0,1)),Bh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,zh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,zh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_loromovablelist_free(e,0)}isAttached(){return G.loromovablelist_isAttached(this.__wbg_ptr)!==0}getCreatorAt(e){return $(G.loromovablelist_getCreatorAt(this.__wbg_ptr,e))}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}setContainer(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_setContainer(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getLastMoverAt(e){return $(G.loromovablelist_getLastMoverAt(this.__wbg_ptr,e))}pushContainer(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_pushContainer(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getLastEditorAt(e){return $(G.loromovablelist_getLastEditorAt(this.__wbg_ptr,e))}insertContainer(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_insertContainer(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){return $(G.loromovablelist_getShallowValue(this.__wbg_ptr))}get id(){return $(G.loromovablelist_id(this.__wbg_ptr))}get(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_get(r,this.__wbg_ptr,e);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}move(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_move(r,this.__wbg_ptr,e,t);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}constructor(){let e=G.loromovablelist_new();return this.__wbg_ptr=e>>>0,zh.register(this,this.__wbg_ptr,this),this}pop(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_pop(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}set(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_set(r,this.__wbg_ptr,e,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}kind(){return $(G.loromovablelist_kind(this.__wbg_ptr))}push(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_push(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}clear(){try{let t=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_clear(t,this.__wbg_ptr);var e=X().getInt32(t+0,!0);if(X().getInt32(t+4,!0))throw $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}delete(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_delete(r,this.__wbg_ptr,e,t);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}insert(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_insert(r,this.__wbg_ptr,e,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get length(){return G.loromovablelist_length(this.__wbg_ptr)>>>0}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.loromovablelist_toJSON(this.__wbg_ptr))}toArray(){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_toArray(i,this.__wbg_ptr);var e=X().getInt32(i+0,!0),t=X().getInt32(i+4,!0),n=X().getInt32(i+8,!0);if(X().getInt32(i+12,!0))throw $(n);var r=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),r}finally{G.__wbindgen_add_to_stack_pointer(16)}}getCursor(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_getCursor(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return n===0?void 0:Oh.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDeleted(){return G.loromovablelist_isDeleted(this.__wbg_ptr)!==0}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.loromovablelist_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},Vh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorotext_free(e>>>0,1)),Hh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Vh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Vh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorotext_free(e,0)}applyDelta(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_applyDelta(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}convertPos(e,t,n){let r=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),i=J,a=Y(n,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;return $(G.lorotext_convertPos(this.__wbg_ptr,e,r,i,a,o))}deleteUtf8(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_deleteUtf8(r,this.__wbg_ptr,e,t);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getEditorOf(e){return $(G.lorotext_getEditorOf(this.__wbg_ptr,e))}insertUtf8(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorotext_insertUtf8(r,this.__wbg_ptr,e,i,a);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isAttached(){return G.lorotext_isAttached(this.__wbg_ptr)!==0}sliceDelta(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_sliceDelta(i,this.__wbg_ptr,e,t);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}updateByLine(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorotext_updateByLine(r,this.__wbg_ptr,i,a,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}sliceDeltaUtf8(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_sliceDeltaUtf8(i,this.__wbg_ptr,e,t);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getShallowValue(){let e,t;try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_getShallowValue(i,this.__wbg_ptr);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);return e=n,t=r,Q(n,r)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(e,t,1)}}get id(){return $(G.lorotext_id(this.__wbg_ptr))}constructor(){let e=G.lorotext_new();return this.__wbg_ptr=e>>>0,Vh.register(this,this.__wbg_ptr,this),this}iter(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_iter(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}kind(){return $(G.lorotext_kind(this.__wbg_ptr))}mark(e,t,n){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),o=J;G.lorotext_mark(i,this.__wbg_ptr,Z(e),a,o,Z(n));var r=X().getInt32(i+0,!0);if(X().getInt32(i+4,!0))throw $(r)}finally{G.__wbindgen_add_to_stack_pointer(16)}}push(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16),r=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),i=J;G.lorotext_push(n,this.__wbg_ptr,r,i);var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}slice(e,t){let n,r;try{let u=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_slice(u,this.__wbg_ptr,e,t);var i=X().getInt32(u+0,!0),a=X().getInt32(u+4,!0),o=X().getInt32(u+8,!0),s=X().getInt32(u+12,!0),c=i,l=a;if(s)throw c=0,l=0,$(o);return n=c,r=l,Q(c,l)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(n,r,1)}}delete(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_delete(r,this.__wbg_ptr,e,t);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}insert(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorotext_insert(r,this.__wbg_ptr,e,i,a);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get length(){return G.lorotext_length(this.__wbg_ptr)>>>0}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}splice(e,t,n){let r,i;try{let d=G.__wbindgen_add_to_stack_pointer(-16),f=Y(n,G.__wbindgen_malloc,G.__wbindgen_realloc),p=J;G.lorotext_splice(d,this.__wbg_ptr,e,t,f,p);var a=X().getInt32(d+0,!0),o=X().getInt32(d+4,!0),s=X().getInt32(d+8,!0),c=X().getInt32(d+12,!0),l=a,u=o;if(c)throw l=0,u=0,$(s);return r=l,i=u,Q(l,u)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(r,i,1)}}unmark(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(t,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorotext_unmark(r,this.__wbg_ptr,Z(e),i,a);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}update(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16),i=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;G.lorotext_update(r,this.__wbg_ptr,i,a,Z(t));var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}charAt(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_charAt(r,this.__wbg_ptr,e);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return String.fromCodePoint(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.lorotext_toJSON(this.__wbg_ptr))}toDelta(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_toDelta(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getCursor(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_getCursor(i,this.__wbg_ptr,e,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return n===0?void 0:Oh.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDeleted(){return G.lorotext_isDeleted(this.__wbg_ptr)!==0}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toString(){let e,t;try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotext_toString(i,this.__wbg_ptr);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);return e=n,t=r,Q(n,r)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(e,t,1)}}},Uh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorotree_free(e>>>0,1)),Wh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Uh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Uh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorotree_free(e,0)}createNode(e,t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_createNode(i,this.__wbg_ptr,vh(e),th(t)?4294967297:t>>>0);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return Kh.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}isAttached(){return G.lorotree_isAttached(this.__wbg_ptr)!==0}getAttached(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_getAttached(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getNodeByID(e){try{let t=G.lorotree_getNodeByID(this.__wbg_ptr,vh(e));return t===0?void 0:Kh.__wrap(t)}finally{K[_h++]=void 0}}isNodeDeleted(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_isNodeDeleted(r,this.__wbg_ptr,vh(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return t!==0}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}getShallowValue(){return $(G.lorotree_getShallowValue(this.__wbg_ptr))}enableFractionalIndex(e){G.lorotree_enableFractionalIndex(this.__wbg_ptr,e)}disableFractionalIndex(){G.lorotree_disableFractionalIndex(this.__wbg_ptr)}isFractionalIndexEnabled(){return G.lorotree_isFractionalIndexEnabled(this.__wbg_ptr)!==0}get id(){return $(G.lorotree_id(this.__wbg_ptr))}move(e,t,n){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_move(i,this.__wbg_ptr,vh(e),vh(t),th(n)?4294967297:n>>>0);var r=X().getInt32(i+0,!0);if(X().getInt32(i+4,!0))throw $(r)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0,K[_h++]=void 0}}constructor(){let e=G.lorotree_new();return this.__wbg_ptr=e>>>0,Uh.register(this,this.__wbg_ptr,this),this}kind(){return $(G.lorotree_kind(this.__wbg_ptr))}nodes(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_nodes(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}roots(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_roots(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=bh(e,t).slice();return G.__wbindgen_free(e,t*4,4),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}delete(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_delete(n,this.__wbg_ptr,vh(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}parent(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_parent(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.lorotree_toJSON(this.__wbg_ptr))}has(e){try{return G.lorotree_has(this.__wbg_ptr,vh(e))!==0}finally{K[_h++]=void 0}}toArray(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_toArray(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getNodes(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_getNodes(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDeleted(){return G.lorotree_isDeleted(this.__wbg_ptr)!==0}subscribe(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotree_subscribe(r,this.__wbg_ptr,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},Gh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_lorotreenode_free(e>>>0,1)),Kh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Gh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Gh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_lorotreenode_free(e,0)}__getClassname(){let e,t;try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode___getClassname(i,this.__wbg_ptr);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);return e=n,t=r,Q(n,r)}finally{G.__wbindgen_add_to_stack_pointer(16),G.__wbindgen_free(e,t,1)}}creationId(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_creationId(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}isDeleted(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_isDeleted(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return e!==0}finally{G.__wbindgen_add_to_stack_pointer(16)}}moveBefore(t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);yh(t,e),G.lorotreenode_moveBefore(r,this.__wbg_ptr,t.__wbg_ptr);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}createNode(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_createNode(i,this.__wbg_ptr,th(t)?4294967297:t>>>0);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}getLastMoveId(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_getLastMoveId(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_toJSON(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}fractionalIndex(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_fractionalIndex(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}get id(){return $(G.lorotreenode_id(this.__wbg_ptr))}move(e,t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_move(r,this.__wbg_ptr,vh(e),th(t)?4294967297:t>>>0);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16),K[_h++]=void 0}}get data(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_data(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return Rh.__wrap(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}index(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_index(n,this.__wbg_ptr);var e=X().getFloat64(n+0,!0),t=X().getInt32(n+8,!0);if(X().getInt32(n+12,!0))throw $(t);return e===4294967297?void 0:e}finally{G.__wbindgen_add_to_stack_pointer(16)}}parent(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.lorotreenode_parent(r,this.__wbg_ptr);var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return t===0?void 0:e.__wrap(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}creator(){return $(G.lorotreenode_creator(this.__wbg_ptr))}children(){return $(G.lorotreenode_children(this.__wbg_ptr))}moveAfter(t){try{let r=G.__wbindgen_add_to_stack_pointer(-16);yh(t,e),G.lorotreenode_moveAfter(r,this.__wbg_ptr,t.__wbg_ptr);var n=X().getInt32(r+0,!0);if(X().getInt32(r+4,!0))throw $(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}},qh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_undomanager_free(e>>>0,1)),Jh=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,qh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_undomanager_free(e,0)}groupStart(){try{let t=G.__wbindgen_add_to_stack_pointer(-16);G.undomanager_groupStart(t,this.__wbg_ptr);var e=X().getInt32(t+0,!0);if(X().getInt32(t+4,!0))throw $(e)}finally{G.__wbindgen_add_to_stack_pointer(16)}}topRedoValue(){return $(G.undomanager_topRedoValue(this.__wbg_ptr))}topUndoValue(){return $(G.undomanager_topUndoValue(this.__wbg_ptr))}setMaxUndoSteps(e){G.undomanager_setMaxUndoSteps(this.__wbg_ptr,e)}setMergeInterval(e){G.undomanager_setMergeInterval(this.__wbg_ptr,e)}addExcludeOriginPrefix(e){let t=Y(e,G.__wbindgen_malloc,G.__wbindgen_realloc),n=J;G.undomanager_addExcludeOriginPrefix(this.__wbg_ptr,t,n)}constructor(e,t){yh(e,Ph);let n=G.undomanager_new(e.__wbg_ptr,Z(t));return this.__wbg_ptr=n>>>0,qh.register(this,this.__wbg_ptr,this),this}peer(){return $(G.undomanager_peer(this.__wbg_ptr))}redo(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.undomanager_redo(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return e!==0}finally{G.__wbindgen_add_to_stack_pointer(16)}}undo(){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.undomanager_undo(n,this.__wbg_ptr);var e=X().getInt32(n+0,!0),t=X().getInt32(n+4,!0);if(X().getInt32(n+8,!0))throw $(t);return e!==0}finally{G.__wbindgen_add_to_stack_pointer(16)}}clear(){G.undomanager_clear(this.__wbg_ptr)}pause(){G.undomanager_pause(this.__wbg_ptr)}resume(){G.undomanager_resume(this.__wbg_ptr)}canRedo(){return G.undomanager_canRedo(this.__wbg_ptr)!==0}canUndo(){return G.undomanager_canUndo(this.__wbg_ptr)!==0}groupEnd(){G.undomanager_groupEnd(this.__wbg_ptr)}isPaused(){return G.undomanager_isPaused(this.__wbg_ptr)!==0}setOnPop(e){G.undomanager_setOnPop(this.__wbg_ptr,Z(e))}clearRedo(){G.undomanager_clearRedo(this.__wbg_ptr)}clearUndo(){G.undomanager_clearUndo(this.__wbg_ptr)}setOnPush(e){G.undomanager_setOnPush(this.__wbg_ptr,Z(e))}},Yh=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>G.__wbg_versionvector_free(e>>>0,1)),Xh=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Yh.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Yh.unregister(this),e}free(){let e=this.__destroy_into_raw();G.__wbg_versionvector_free(e,0)}get(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_get(r,this.__wbg_ptr,Z(e));var t=X().getFloat64(r+0,!0),n=X().getInt32(r+8,!0);if(X().getInt32(r+12,!0))throw $(n);return t===4294967297?void 0:t}finally{G.__wbindgen_add_to_stack_pointer(16)}}constructor(e){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_new(r,Z(e));var t=X().getInt32(r+0,!0),n=X().getInt32(r+4,!0);if(X().getInt32(r+8,!0))throw $(n);return this.__wbg_ptr=t>>>0,Yh.register(this,this.__wbg_ptr,this),this}finally{G.__wbindgen_add_to_stack_pointer(16)}}static decode(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16),a=oh(t,G.__wbindgen_malloc),o=J;G.versionvector_decode(i,a,o);var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}encode(){try{let r=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_encode(r,this.__wbg_ptr);var e=X().getInt32(r+0,!0),t=X().getInt32(r+4,!0),n=ph(e,t).slice();return G.__wbindgen_free(e,t*1,1),n}finally{G.__wbindgen_add_to_stack_pointer(16)}}length(){return G.versionvector_length(this.__wbg_ptr)>>>0}remove(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_remove(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}setEnd(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_setEnd(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}compare(t){yh(t,e);let n=G.versionvector_compare(this.__wbg_ptr,t.__wbg_ptr);return n===4294967297?void 0:n}setLast(e){try{let n=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_setLast(n,this.__wbg_ptr,Z(e));var t=X().getInt32(n+0,!0);if(X().getInt32(n+4,!0))throw $(t)}finally{G.__wbindgen_add_to_stack_pointer(16)}}toJSON(){return $(G.versionvector_toJSON(this.__wbg_ptr))}static parseJSON(t){try{let i=G.__wbindgen_add_to_stack_pointer(-16);G.versionvector_parseJSON(i,Z(t));var n=X().getInt32(i+0,!0),r=X().getInt32(i+4,!0);if(X().getInt32(i+8,!0))throw $(r);return e.__wrap(n)}finally{G.__wbindgen_add_to_stack_pointer(16)}}};function Zh(e,t){let n=Y(String(q(t)),G.__wbindgen_malloc,G.__wbindgen_realloc),r=J;X().setInt32(e+4,r,!0),X().setInt32(e+0,n,!0)}function Qh(){return Qm(function(e,t,n){return Z(q(e).apply(q(t),q(n)))},arguments)}function $h(){return Qm(function(e,t,n){return Z(Reflect.apply(q(e),q(t),q(n)))},arguments)}function eg(e){let t=q(e).buffer;return Z(t)}function tg(){return Qm(function(e,t){return Z(q(e).call(q(t)))},arguments)}function ng(){return Qm(function(e,t,n){return Z(q(e).call(q(t),q(n)))},arguments)}function rg(){return Qm(function(e,t,n,r){return Z(q(e).call(q(t),q(n),q(r)))},arguments)}function ig(){return Qm(function(e,t,n,r,i){return Z(q(e).call(q(t),q(n),q(r),q(i)))},arguments)}function ag(e){return Z(Eh.__wrap(e))}function og(e){let t=q(e).crypto;return Z(t)}function sg(e){return Z(Oh.__wrap(e))}function cg(e){return q(e).done}function lg(e){return Z(Object.entries(q(e)))}function ug(e){return Z(q(e).entries())}function dg(e,t){console.error(Q(e,t))}function fg(e){return Z(Array.from(q(e)))}function pg(e){return Z(Object.getOwnPropertySymbols(q(e)))}function mg(){return Qm(function(e,t){q(e).getRandomValues(q(t))},arguments)}function hg(){return Qm(function(e,t){return Z(Reflect.get(q(e),q(t)))},arguments)}function gg(e,t){let n=q(e)[t>>>0];return Z(n)}function _g(e,t){return q(e)[t>>>0]}function vg(e,t){let n=q(e)[q(t)];return Z(n)}function yg(e){let t;try{t=q(e)instanceof ArrayBuffer}catch{t=!1}return t}function bg(e){let t;try{t=q(e)instanceof Map}catch{t=!1}return t}function xg(e){let t;try{t=q(e)instanceof Object}catch{t=!1}return t}function Sg(e){let t;try{t=q(e)instanceof Uint8Array}catch{t=!1}return t}function Cg(e){return Array.isArray(q(e))}function wg(e){return Number.isSafeInteger(q(e))}function Tg(){let e=Symbol.iterator;return Z(e)}function Eg(e){return q(e).length}function Dg(e){return q(e).length}function Og(e,t,n,r,i,a,o,s){let c,l;try{c=e,l=t,console.log(Q(e,t),Q(n,r),Q(i,a),Q(o,s))}finally{G.__wbindgen_free(c,l,1)}}function kg(e,t){console.log(Q(e,t))}function Ag(e,t){let n,r;try{n=e,r=t,console.log(Q(e,t))}finally{G.__wbindgen_free(n,r,1)}}function jg(e){return Z(Mh.__wrap(e))}function Mg(e){return Z(Ih.__wrap(e))}function Ng(e){return Z(Rh.__wrap(e))}function Pg(e){return Z(Bh.__wrap(e))}function Fg(e){return Z(Hh.__wrap(e))}function Ig(e){return Z(Wh.__wrap(e))}function Lg(e){return Z(Kh.__wrap(e))}function Rg(e,t){performance.mark(Q(e,t))}function zg(){return Qm(function(e,t,n,r){let i,a,o,s;try{i=e,a=t,o=n,s=r,performance.measure(Q(e,t),Q(n,r))}finally{G.__wbindgen_free(i,a,1),G.__wbindgen_free(o,s,1)}},arguments)}function Bg(e){let t=q(e).msCrypto;return Z(t)}function Vg(){return Z({})}function Hg(){return Z(new Map)}function Ug(){return Z([])}function Wg(e){return Z(new Uint8Array(q(e)))}function Gg(e,t){return Z(Error(Q(e,t)))}function Kg(e,t){return Z(Function(Q(e,t)))}function qg(e,t,n){return Z(new Uint8Array(q(e),t>>>0,n>>>0))}function Jg(e){return Z(new Uint8Array(e>>>0))}function Yg(e){return Z(Array(e>>>0))}function Xg(e){let t=q(e).next;return Z(t)}function Zg(){return Qm(function(e){return Z(q(e).next())},arguments)}function Qg(e){let t=q(e).node;return Z(t)}function $g(){return Date.now()}function e_(){return Qm(function(e){return Z(Reflect.ownKeys(q(e)))},arguments)}function t_(e){let t=q(e).process;return Z(t)}function n_(e,t){return q(e).push(q(t))}function r_(){return Qm(function(e,t){q(e).randomFillSync($(t))},arguments)}function i_(){return Qm(function(){let e=module.require;return Z(e)},arguments)}function a_(e){return Z(Promise.resolve(q(e)))}function o_(e,t,n){q(e)[t>>>0]=$(n)}function s_(e,t,n){q(e)[$(t)]=$(n)}function c_(e,t,n){q(e).set(q(t),n>>>0)}function l_(e,t,n){return Z(q(e).set(q(t),q(n)))}function u_(){return Qm(function(e,t,n){return Reflect.set(q(e),q(t),q(n))},arguments)}function d_(e,t,n){q(e)[t>>>0]=n}function f_(){let e=typeof global>`u`?null:global;return th(e)?0:Z(e)}function p_(){let e=typeof globalThis>`u`?null:globalThis;return th(e)?0:Z(e)}function m_(){let e=typeof self>`u`?null:self;return th(e)?0:Z(e)}function h_(){let e=typeof window>`u`?null:window;return th(e)?0:Z(e)}function g_(e,t,n){return Z(q(e).subarray(t>>>0,n>>>0))}function __(e,t){return Z(q(e).then(q(t)))}function v_(e){let t=q(e).value;return Z(t)}function y_(e){let t=q(e).versions;return Z(t)}function b_(e){return Z(Xh.__wrap(e))}function x_(e,t){console.warn(Q(e,t))}function S_(e){return+q(e)}function C_(e){return Z(e)}function w_(e){return Z(BigInt.asUintN(64,e))}function T_(e,t){let n=q(t),r=typeof n==`bigint`?n:void 0;X().setBigInt64(e+8,th(r)?BigInt(0):r,!0),X().setInt32(e+0,!th(r),!0)}function E_(e){let t=q(e);return typeof t==`boolean`?+!!t:2}function D_(e){let t=$(e).original;return t.cnt--==1&&(t.a=0,!0)}function O_(e,t,n){return Z(rh(e,t,14,xh))}function k_(e,t,n){return Z(rh(e,t,14,Sh))}function A_(e,t){let n=Y(ih(q(t)),G.__wbindgen_malloc,G.__wbindgen_realloc),r=J;X().setInt32(e+4,r,!0),X().setInt32(e+0,n,!0)}function j_(e,t){return Z(Error(Q(e,t)))}function M_(e,t){return q(e)in q(t)}function N_(e){return Array.isArray(q(e))}function P_(e){return typeof q(e)==`bigint`}function F_(e){return typeof q(e)==`function`}function I_(e){return q(e)===null}function L_(e){let t=q(e);return typeof t==`object`&&!!t}function R_(e){return typeof q(e)==`string`}function z_(e){return q(e)===void 0}function B_(e,t){return q(e)===q(t)}function V_(e,t){return q(e)==q(t)}function H_(){let e=G.memory;return Z(e)}function U_(e,t){let n=q(t),r=typeof n==`number`?n:void 0;X().setFloat64(e+8,th(r)?0:r,!0),X().setInt32(e+0,!th(r),!0)}function W_(e){return Z(e)}function G_(e){return Z(q(e))}function K_(e){$(e)}function q_(e){throw $(e)}function J_(e,t){let n=q(t),r=typeof n==`string`?n:void 0;var i=th(r)?0:Y(r,G.__wbindgen_malloc,G.__wbindgen_realloc),a=J;X().setInt32(e+4,a,!0),X().setInt32(e+0,i,!0)}function Y_(e,t){return Z(Q(e,t))}function X_(e,t){throw Error(Q(e,t))}function Z_(e){return Z(typeof q(e))}var Q_=Symbol(`loroContainerId`);function $_(e){let t=e.prototype,n=Object.getOwnPropertyDescriptor(t,`id`),r=n&&n.get,i=Object.getOwnPropertyDescriptor(t,`__destroy_into_raw`),a=i&&i.value;if(!r||!i||!a)throw Error(`Unexpected wasm-bindgen container wrapper shape`);Object.defineProperty(t,"id",{...n,get(){if(this.__wbg_ptr===0)return r.call(this);let e=this[Q_];if(e!==void 0)return e;let t=r.call(this);try{Object.defineProperty(this,Q_,{configurable:!0,value:t})}catch{}return t}}),Object.defineProperty(t,"__destroy_into_raw",{...i,value(){try{delete this[Q_]}catch{}return a.call(this)}})}for(let e of[Rh,Hh,Ih,Wh,Bh,Mh])$_(e);var ev={AwarenessWasm:wh,ChangeModifier:Eh,Cursor:Oh,EphemeralStoreWasm:Ah,LORO_VERSION:ah,LoroCounter:Mh,LoroDoc:Ph,LoroList:Ih,LoroMap:Rh,LoroMovableList:Bh,LoroText:Hh,LoroTree:Wh,LoroTreeNode:Kh,UndoManager:Jh,VersionVector:Xh,__wbg_String_8f0eb39a4a4c2f66:Zh,__wbg_apply_36be6a55257c99bf:Qh,__wbg_apply_eb9e9b97497f91e4:$h,__wbg_buffer_609cc3eee51ed158:eg,__wbg_call_672a4d21634d4a24:tg,__wbg_call_7cccdd69e0791ae2:ng,__wbg_call_833bed5770ea2041:rg,__wbg_call_b8adc8b1d0a0d8eb:ig,__wbg_changemodifier_new:ag,__wbg_crypto_574e78ad8b13b65f:og,__wbg_cursor_new:sg,__wbg_done_769e5ede4b31c67b:cg,__wbg_entries_3265d4158b33e5dc:lg,__wbg_entries_c8a90a7ed73e84ce:ug,__wbg_error_d558b831e4af4f7b:dg,__wbg_from_2a5d3e218e67aa85:fg,__wbg_getOwnPropertySymbols_97eebed6fe6e08be:pg,__wbg_getRandomValues_b8f5dbd5f3995a9e:mg,__wbg_get_67b2ba62fc30de12:hg,__wbg_get_b9b93047fe3cf45b:gg,__wbg_getindex_5b00c274b05714aa:_g,__wbg_getwithrefkey_1dc361bd10053bfe:vg,__wbg_instanceof_ArrayBuffer_e14585432e3737fc:yg,__wbg_instanceof_Map_f3469ce2244d2430:bg,__wbg_instanceof_Object_7f2dcef8f78644a4:xg,__wbg_instanceof_Uint8Array_17156bcf118086a9:Sg,__wbg_isArray_a1eab7e0d067391b:Cg,__wbg_isSafeInteger_343e2beeeece1bb0:wg,__wbg_iterator_9a24c88df860dc65:Tg,__wbg_length_a446193dc22c12f8:Eg,__wbg_length_e2d2a49132c1b256:Dg,__wbg_log_0cc1b7768397bcfe:Og,__wbg_log_5772acf6639674b3:kg,__wbg_log_cb9e190acc5753fb:Ag,__wbg_lorocounter_new:jg,__wbg_lorolist_new:Mg,__wbg_loromap_new:Ng,__wbg_loromovablelist_new:Pg,__wbg_lorotext_new:Fg,__wbg_lorotree_new:Ig,__wbg_lorotreenode_new:Lg,__wbg_mark_7438147ce31e9d4b:Rg,__wbg_measure_fb7825c11612c823:zg,__wbg_msCrypto_a61aeb35a24c1329:Bg,__wbg_new_405e22f390576ce2:Vg,__wbg_new_5e0be73521bc8c17:Hg,__wbg_new_78feb108b6472713:Ug,__wbg_new_a12002a7f91c75be:Wg,__wbg_new_c68d7209be747379:Gg,__wbg_newnoargs_105ed471475aaf50:Kg,__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a:qg,__wbg_newwithlength_a381634e90c276d4:Jg,__wbg_newwithlength_c4c419ef0bc8a1f8:Yg,__wbg_next_25feadfc0913fea9:Xg,__wbg_next_6574e1a8a62d1055:Zg,__wbg_node_905d3e251edff8a2:Qg,__wbg_now_86f00deda9ebf073:$g,__wbg_ownKeys_3930041068756f1f:e_,__wbg_process_dc0fbacc7c1c06f7:t_,__wbg_push_737cfc8c1432c2c6:n_,__wbg_randomFillSync_ac0988aba3254290:r_,__wbg_require_60cc747a6bc5215a:i_,__wbg_resolve_4851785c9c5f573d:a_,__wbg_set_37837023f3d740e8:o_,__wbg_set_3f1d0b984ed272ed:s_,__wbg_set_65595bdd868b3009:c_,__wbg_set_8fc6bf8a5b1071d1:l_,__wbg_set_bb8cecf6a62b9f46:u_,__wbg_set_wasm:Gm,__wbg_setindex_dcd71eabf405bde1:d_,__wbg_static_accessor_GLOBAL_88a902d13a557d07:f_,__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0:p_,__wbg_static_accessor_SELF_37c5d418e4bf5819:m_,__wbg_static_accessor_WINDOW_5de37043a91a9c40:h_,__wbg_subarray_aa9065fa9dc5df96:g_,__wbg_then_44b73946d2fb3e7d:__,__wbg_value_cd1ffa7b1ab794f1:v_,__wbg_versions_c01dfd4722a88165:y_,__wbg_versionvector_new:b_,__wbg_warn_d0f9203c8c814d40:x_,__wbindgen_as_number:S_,__wbindgen_bigint_from_i64:C_,__wbindgen_bigint_from_u64:w_,__wbindgen_bigint_get_as_i64:T_,__wbindgen_boolean_get:E_,__wbindgen_cb_drop:D_,__wbindgen_closure_wrapper246:O_,__wbindgen_closure_wrapper496:k_,__wbindgen_debug_string:A_,__wbindgen_error_new:j_,__wbindgen_in:M_,__wbindgen_is_array:N_,__wbindgen_is_bigint:P_,__wbindgen_is_function:F_,__wbindgen_is_null:I_,__wbindgen_is_object:L_,__wbindgen_is_string:R_,__wbindgen_is_undefined:z_,__wbindgen_jsval_eq:B_,__wbindgen_jsval_loose_eq:V_,__wbindgen_memory:H_,__wbindgen_number_get:U_,__wbindgen_number_new:W_,__wbindgen_object_clone_ref:G_,__wbindgen_object_drop_ref:K_,__wbindgen_rethrow:q_,__wbindgen_string_get:J_,__wbindgen_string_new:Y_,__wbindgen_throw:X_,__wbindgen_typeof:Z_,callPendingEvents:ch,decodeFrontiers:hh,decodeImportBlobMeta:sh,encodeFrontiers:mh,isValidContainerId:uh,redactJsonUpdates:lh,run:dh,setDebug:gh},tv={"./loro_wasm_bg.js":ev},nv=e=>{ev.__wbg_set_wasm(e),rv(e)};function rv(e){typeof e.__wbindgen_start==`function`&&e.__wbindgen_start()}function iv(e){if(typeof XMLHttpRequest!=`function`)throw Error(`loro-crdt browser build requires XMLHttpRequest for synchronous WASM loading. Use the nodejs, web, base64, or bundler entry for this runtime.`);let t=new XMLHttpRequest;if(t.open(`GET`,e,!1),t.overrideMimeType(`text/plain; charset=x-user-defined`),t.send(null),t.status!==0&&(t.status<200||t.status>=300))throw Error(`Failed to load loro-crdt WASM from ${e}: ${t.status} ${t.statusText}`);let n=t.responseText,r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e)&255;return r}function av(e,t){let n=new WebAssembly.Module(e);return new WebAssembly.Instance(n,t)}nv(av(iv(new URL(``+new URL(`loro_wasm_bg-BwsqTTze.wasm`,import.meta.url).href,``+import.meta.url).href),tv).exports);var ov=[`Map`,`Text`,`List`,`Tree`,`MovableList`,`Counter`];function sv(e){return uh(e)}function cv(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return typeof t!=`object`||!t||typeof t.kind!=`function`?!1:ov.includes(e.kind())}var lv=class{constructor(e,t=3e4){this.listeners=new Set,this.inner=new wh(e,t),this.peer=e,this.timeout=t}apply(e,t=`remote`){let{updated:n,added:r}=this.inner.apply(e);this.listeners.forEach(e=>{e({updated:n,added:r,removed:[]},t)}),this.startTimerIfNotEmpty()}setLocalState(e){let t=this.inner.getState(this.peer)==null;this.inner.setLocalState(e),t?this.listeners.forEach(e=>{e({updated:[],added:[this.inner.peer()],removed:[]},`local`)}):this.listeners.forEach(e=>{e({updated:[this.inner.peer()],added:[],removed:[]},`local`)}),this.startTimerIfNotEmpty()}getLocalState(){return this.inner.getState(this.peer)}getAllStates(){return this.inner.getAllStates()}encode(e){return this.inner.encode(e)}encodeAll(){return this.inner.encodeAll()}addListener(e){this.listeners.add(e)}removeListener(e){this.listeners.delete(e)}peers(){return this.inner.peers()}destroy(){clearInterval(this.timer),this.listeners.clear()}startTimerIfNotEmpty(){this.inner.isEmpty()||this.timer!=null||(this.timer=setInterval(()=>{let e=this.inner.removeOutdated();e.length>0&&this.listeners.forEach(t=>{t({updated:[],added:[],removed:e},`timeout`)}),this.inner.isEmpty()&&(clearInterval(this.timer),this.timer=void 0)},this.timeout/2))}};Ph.prototype.toJsonWithReplacer=function(e){let t=new Set,n=this,r=(r,a)=>{if(typeof a==`string`&&sv(a)&&!t.has(a)){t.add(a);let o=n.getContainerById(a);if(o==null)throw Error(`ContainerID not found: ${a}`);let s=e(r,o);if(s===o){let e=o.getShallowValue();return typeof e==`object`?i(e):e}if(cv(s))throw Error(`Using new container is not allowed in toJsonWithReplacer`);return typeof s==`object`&&s?i(s):s}if(typeof a==`object`&&a)return i(a);let o=e(r,a);if(cv(o))throw Error(`Using new container is not allowed in toJsonWithReplacer`);return o},i=e=>{if(Array.isArray(e))return e.map((e,t)=>r(t,e)).filter(e=>e!==void 0);let t={};for(let[n,i]of Object.entries(e)){let e=r(n,i);e!==void 0&&(t[n]=e)}return t};return i(n.getShallowValue())};var uv=Symbol(`loro.callPendingEventsWrapped`);function dv(e,t){let n=Object.getOwnPropertyDescriptor(e,t);if(!n||typeof n.value!=`function`)return;let r=n.value;if(r[uv])return;let i=function(...e){let t;try{return t=r.apply(this,e),t}finally{t&&typeof t.then==`function`?t.finally(()=>{ch()}):ch()}};i[uv]=!0,Object.defineProperty(e,t,{...n,value:i})}function fv(e,t){for(let n of t)dv(e,n)}fv(Ph.prototype,[`setDetachedEditing`,`attach`,`detach`,`fork`,`forkAt`,`checkoutToLatest`,`checkout`,`commit`,`getCursorPos`,`revertTo`,`export`,`exportJsonUpdates`,`exportJsonInIdSpan`,`importJsonUpdates`,`import`,`importUpdateBatch`,`importBatch`,`travelChangeAncestors`,`getChangedContainersIn`,`diff`,`applyDiff`,`setPeerId`]),fv(Ah.prototype,[`set`,`delete`,`apply`,`removeOutdated`]),fv(Jh.prototype,[`undo`,`redo`]);var pv=N.baseTheme({".loro-cursor":{position:`absolute`,width:`2px`,display:`inline-block`,height:`1.2em`},".loro-cursor::before":{position:`absolute`,top:`1.3em`,left:`0`,content:`var(--rtc-name)`,padding:`2px 6px`,fontSize:`12px`,borderRadius:`3px`,whiteSpace:`nowrap`,userSelect:`none`,backgroundColor:`inherit`,opacity:`0.7`},".loro-selection":{opacity:`0.5`}});$r.define();var mv=j.define(),hv=Qr.define({create(){return{remoteCursors:new Map,isCheckout:!1}},update(e,t){for(let n of t.effects)if(n.is(mv))switch(n.value.type){case`update`:{let{peer:t,user:r,cursor:i}=n.value;e.remoteCursors.set(t,{uid:t,cursor:i,user:r});break}case`delete`:e.remoteCursors.delete(n.value.peer);break;case`checkout`:e.isCheckout=n.value.checkout}return e}}),gv=e=>{let t=e.transactions.flatMap(e=>e.effects).filter(e=>e.is(mv));return e.docChanged||e.viewportChanged||t.length>0},_v=()=>zr({above:!0,class:`loro-cursor-layer`,update:gv,markers:e=>{let{remoteCursors:t,isCheckout:n}=e.state.field(hv);return n?[]:[...t.values()].flatMap(t=>{let n=ni.cursor(t.cursor.anchor);return yv.createCursor(e,n,t.user?.name||`unknown`,t.user?.colorClassName||``)})}}),vv=()=>zr({above:!1,class:`loro-selection-layer`,update:gv,markers:e=>{let{remoteCursors:t,isCheckout:n}=e.state.field(hv);return n?[]:[...t.entries()].filter(([,e])=>e.cursor.head!==void 0&&e.cursor.anchor!==e.cursor.head).flatMap(([,t])=>{let n=ni.range(t.cursor.anchor,t.cursor.head);return pi.forRange(e,`loro-selection ${t.user?.colorClassName||``}`,n)})}}),yv=class e{left;top;height;name;colorClassName;constructor(e,t,n,r,i){this.left=e,this.top=t,this.height=n,this.name=r,this.colorClassName=i}draw(){let e=document.createElement(`div`);return this.adjust(e),e}update(e){return this.adjust(e),!0}adjust(e){e.style.left=`${this.left}px`,e.style.top=`${this.top}px`,e.style.height=`${this.height}px`,e.className=`loro-cursor ${this.colorClassName}`,e.style.setProperty(`--rtc-name`,`"${this.name}"`)}eq(e){return this.left===e.left&&this.top===e.top&&this.height===e.height&&this.name===e.name}static createCursor(t,n,r,i){let a=e.calculateAbsoluteCursorPosition(n,t);if(!a)return[];let o=t.scrollDOM.getBoundingClientRect(),s=(t.textDirection===hi.LTR?o.left:o.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,c=o.top-t.scrollDOM.scrollTop;return[new e(a.left-s,a.top-c,a.bottom-a.top,r,i)]}static calculateAbsoluteCursorPosition(e,t){let n=Math.max(0,Math.min(t.state.doc.length,e.anchor));return t.coordsAtPos(n,e.assoc||1)}},bv=(e,t,n,r)=>{let i=[],{updated:a,added:o}=n;for(let n of[...a,...o]){let a=xv(e,t,n,r);a&&i.push(a)}return i},xv=(e,t,n,r)=>{let i=t.getAllStates()[n];if(!i||n===e.peerIdStr||i.scopeId!==r)return;if(i.type===`delete`)return mv.of({type:`delete`,peer:i.uid,scopeId:i.scopeId});let a=Oh.decode(i.cursor.anchor),o=e.getCursorPos(a)?.offset??0,s=o;if(i.cursor.head){let t=Oh.decode(i.cursor.head);s=e.getCursorPos(t)?.offset??0}return mv.of({type:`update`,peer:i.uid,scopeId:i.scopeId,cursor:{anchor:o,head:s},user:i.user})},Sv=class{sub;view;doc;user;awareness;getTextFromDoc;scopeId;getUserId;constructor(e,t,n,r,i,a,o){this.view=e,this.doc=t,this.user=n,this.awareness=r,this.getTextFromDoc=i,this.scopeId=a,this.getUserId=o,this.sub=this.doc.subscribe(e=>{if(e.by===`local`){let e=[];for(let t of this.awareness.peers()){let n=xv(this.doc,this.awareness,t,this.scopeId);n&&e.push(n)}this.view.dispatch({effects:e})}else e.by===`checkout`&&this.view.dispatch({effects:[mv.of({type:`checkout`,checkout:this.doc.isDetached()})]})})}update(e){if(!e.selectionSet&&!e.focusChanged&&!e.docChanged)return;let t=e.state.selection.main;if(this.view.hasFocus&&!this.doc.isDetached()){let e=wv({doc:this.doc,getTextFromDoc:this.getTextFromDoc,anchor:t.anchor,head:t.head});this.awareness.setLocalState({type:`update`,uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId,cursor:e,user:this.user})}else this.awareness.setLocalState({type:`delete`,uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}destroy(){this.sub?.(),this.awareness.setLocalState({type:`delete`,uid:this.getUserId?this.getUserId():this.doc.peerIdStr,scopeId:this.scopeId})}},Cv=class{_awarenessListener;view;doc;awareness;scopeId;constructor(e,t,n,r){this.view=e,this.doc=t,this.awareness=n,this.scopeId=r;let i=async(e,t)=>{t!==`local`&&this.view.dispatch({effects:bv(this.doc,this.awareness,e,this.scopeId)})};this._awarenessListener=i,this.awareness.addListener(i)}destroy(){this._awarenessListener&&this.awareness.removeListener(this._awarenessListener)}},wv=({doc:e,getTextFromDoc:t,anchor:n,head:r})=>{n===r&&(r=void 0);let i=t(e).getCursor(n)?.encode();if(!i)throw Error(`cursor head not found`);let a;return r!==void 0&&(a=t(e).getCursor(r)?.encode()),{anchor:i,head:a}},Tv=[`bg-(--amber-6)`,`bg-(--blue-6)`,`bg-(--crimson-6)`,`bg-(--cyan-6)`,`bg-(--grass-6)`,`bg-(--gray-6)`,`bg-(--green-6)`,`bg-(--lime-6)`,`bg-(--orange-6)`,`bg-(--purple-6)`,`bg-(--red-6)`,`bg-(--sage-6)`,`bg-(--sky-6)`,`bg-(--slate-6)`],Ev=e=>{if(typeof e==`string`){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t=Math.trunc(t);return Tv[Math.abs(t)%Tv.length]}return Tv[e%Tv.length]},Dv=rn.get(`rtc`),Ov=Dv.get(`awareness`).disabled(),kv=`awareness:`;function Av(e,t){let n=new TextEncoder().encode(e);return new Uint8Array([...n,...t])}function jv(e,t){return new TextDecoder().decode(e.slice(0,t.length))===t}function Mv(e,t){return e.slice(t.length)}var Nv=r(void 0),Pv=new Ph,Fv=new lv(Pv.peerIdStr),Iv=Mi(()=>{Dv.debug(`creating websocket`);let e=xn().getWsSyncURL(un()).toString(),t=new Fn(e,void 0,{maxRetries:10,debug:!1,startClosed:!0,connectionTimeout:1e4});return Promise.resolve().then(async()=>{await hn(),dn()===`edit`&&t.reconnect()}),t.addEventListener(`message`,async e=>{let t=await e.data.arrayBuffer(),n=new Uint8Array(t);if(jv(n,kv)){let e=Mv(n,kv);Fv.apply(e),Ov.debug(`applied awareness update`);return}Pv.import(n),Dv.debug(`imported doc change. new doc:`,Pv.toJSON()),o.get(Nv)!==Pv&&o.set(Nv,Pv)}),t.addEventListener(`open`,()=>{Dv.debug(`websocket open`)}),t.addEventListener(`close`,e=>{Dv.warn(`websocket close`,e),o.get(Nv)===Pv&&o.set(Nv,void 0)}),t});xe()&&Iv(),Pv.subscribeLocalUpdates(e=>{Dv.debug(`local update, sending to server`),Iv().send(new Uint8Array(e))}),Fv.addListener((e,t)=>{let n=[...e.added,...e.removed,...e.updated];t===`local`&&(Ov.debug(`awareness changes`,n),Iv().send(Av(kv,Fv.encode(n))))});function Lv(e,t,n=``){if(pn())return{extension:[],code:n};let r=Pv.getByPath(`codes/${e}`)!==void 0,i=Pv.getMap(`codes`).getOrCreateContainer(e,new Hh);return r||(Dv.log(`initializing code for new cell`,n),i.insert(0,n)),{code:n.toString(),extension:[Rv(e),zv(e),Bv(Pv,Fv,{get name(){return o.get(tt)||`Anonymous`},get colorClassName(){return Ev(this.name)}},()=>i,e),De(Pv,[`codes`,e],()=>i)]}}function Rv(e){let t=(e,t)=>{let n=e.state.field(Ue).type,r=t.toString();r&&r!==n&&(Dv.debug(`[incoming] setting language type: ${n} -> ${r}`),yt(e,{language:r,keepCodeAsIs:!0}))},n=(e,t)=>{let n=e.state.field(dt),r=t.toJSON();a(n,r)||e.dispatch({effects:[ot.of(r)],annotations:[ct.of(!0)]})};return vi.define(r=>{let i;return Promise.resolve().then(()=>{let a=Pv.getByPath(`languages/${e}`);if(!a){Dv.error(`no language container found for cell`,e);return}cn(a instanceof Hh,`language type is not a LoroText`);let o=Pv.getByPath(`language_metadata/${e}`);if(!o){Dv.error(`no language metadata container found for cell`,e);return}cn(o instanceof Rh,`language metadata is not a LoroMap`),t(r,a),n(r,o),i=Pv.subscribe(e=>{if(e.origin===`local`)return;let i=e.events.some(e=>e.target===a.id),s=e.events.some(e=>e.target===o.id);i&&t(r,a),s&&n(r,o)})}),{destroy(){i()}}})}function zv(e){let t=Pv.getMap(`languages`).getOrCreateContainer(e,new Hh),n=Pv.getMap(`language_metadata`).getOrCreateContainer(e,new Rh);return N.updateListener.of(e=>{let r=t.toString()!==``;if(!e.docChanged&&r)return;if(!r){let r=Ze(e.state).type;yt(e.view,{language:r}),Dv.debug(`no initial language, setting default to`,r),t.delete(0,t.length),t.insert(0,r),Dv.debug(`no initial language metadata, setting default to`,e.state.field(dt));let i=e.state.field(dt);for(let e of Object.keys(i))n.set(e,i[e]);Pv.commit();return}let i=!1;for(let r of e.transactions)if(!r.annotation(ct)){for(let e of r.effects)if(e.is(_e)&&t.toString()!==e.value.type&&(Dv.debug(`[outgoing] language change: ${t} -> ${e.value.type}`),t.delete(0,t.length),t.insert(0,e.value.type),i=!0),e.is(ot)||e.is($e)){let t=e.value;e.is($e)?(Dv.debug(`[outgoing] setting language metadata: `,t),n.clear()):Dv.debug(`[outgoing] updating language metadata: `,t);for(let e of Object.keys(t))n.set(e,t[e]);i=!0}}i&&Pv.commit()})}function Bv(e,t,n,r,i,a){let o=`loro:cell:${i}`;return[hv,_v(),vv(),vi.define(i=>new Sv(i,e,n,t,r,o,a)),vi.define(n=>new Cv(n,e,t,o)),pv]}var Vv=Ie,Hv=e=>{let t=(0,I.c)(41),{resetOnBlur:n,placeholderText:r,initialValue:i,flexibleWidth:a,onNameChange:o,className:s}=e,c=n!==void 0&&n,l=i===void 0?null:i,u=a!==void 0&&a,{sendListFiles:d}=Wi(),[f,p]=(0,F.useState)(l),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=[],t[0]=m):m=t[0];let[h,g]=(0,F.useState)(m),[_,v]=(0,F.useState)(!1),y=(0,F.useRef)(null),b=(0,F.useRef)(!1),x,S;t[1]===l?(x=t[2],S=t[3]):(x=()=>{p(l)},S=[l],t[1]=l,t[2]=x,t[3]=S),(0,F.useEffect)(x,S);let C;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{v(!0)},t[4]=C):C=t[4];let w=C,ee;t[5]!==l||t[6]!==c?(ee=e=>{e.relatedTarget?.closest(`.filename-input`)||(v(!1),c&&p(l))},t[5]=l,t[6]=c,t[7]=ee):ee=t[7];let te=ee,T;t[8]===f?T=t[9]:(T=Nn.dirname(f||``),t[8]=f,t[9]=T);let E=T,ne=Nn.basename(f||``),D=h.filter(e=>Nn.basename(e.path).startsWith(ne)),re;t[10]!==E||t[11]!==_||t[12]!==d?(re=async()=>{if(!_){g([]);return}let e=await d({path:E});g(e.files)},t[10]=E,t[11]=_,t[12]=d,t[13]=re):re=t[13];let ie;t[14]!==E||t[15]!==_?(ie=[E,_],t[14]=E,t[15]=_,t[16]=ie):ie=t[16];let{isPending:ae}=Qi(re,ie),O=Uv(f,h,l),k=(O||D.length>0)&&(0,L.jsxs)(_t,{className:`font-mono`,children:[!ae&&(0,L.jsx)(Xe,{children:`No files`}),O&&(0,L.jsxs)(ge,{variant:`success`,className:`py-2 px-3`,onSelect:()=>{O&&(b.current=!0,o(O),y.current?.blur())},children:[(0,L.jsx)(Va,{className:`w-4 h-4 mr-2`}),` `,(0,L.jsxs)(`span`,{className:`text-sm`,children:[l?`Rename to: `:`Save as: `,(0,L.jsx)(`span`,{className:`font-medium text-sm`,children:Nn.basename(O)})]})]},`_rename_`),D.map(e=>{let t=e.isDirectory?`directory`:ka(e.path),n=Ea[t];return(0,L.jsxs)(ge,{variant:e.isDirectory?`default`:`muted`,className:`py-2 px-3`,onSelect:()=>{e.isDirectory?p(`${e.path}/`):p(e.path)},children:[(0,L.jsx)(n,{className:`w-4 h-4 mr-2`}),` `,Nn.basename(e.path)]},e.path)})]}),oe=Math.max(20,f?.length||r?.length||0)*10,se=_?f||``:l||``,ce;t[17]!==u||t[18]!==oe?(ce=u?{maxWidth:oe}:void 0,t[17]=u,t[18]=oe,t[19]=ce):ce=t[19];let le;t[20]===s?le=t[21]:(le=Tn(s,`w-full px-4 py-1 my-1 h-9 font-mono text-foreground/60`),t[20]=s,t[21]=le);let ue;t[22]!==r||t[23]!==se||t[24]!==ce||t[25]!==le?(ue=(0,L.jsx)(Vv,{children:(0,L.jsx)(ze,{"data-testid":`dir-completion-input`,tabIndex:-1,rootClassName:`border-none justify-center px-1`,spellCheck:`false`,value:se,onKeyDown:Wv,icon:null,ref:y,onValueChange:p,placeholder:r,autoComplete:`off`,style:ce,className:le})}),t[22]=r,t[23]=se,t[24]=ce,t[25]=le,t[26]=ue):ue=t[26];let de=k&&`group-focus-within:block`,fe;t[27]===de?fe=t[28]:(fe=Tn(`p-0 w-full min-w-80 max-w-80vw hidden`,de),t[27]=de,t[28]=fe);let pe;t[29]!==k||t[30]!==fe?(pe=(0,L.jsx)(ht,{side:`bottom`,className:fe,portal:!1,children:k}),t[29]=k,t[30]=fe,t[31]=pe):pe=t[31];let me;t[32]!==ue||t[33]!==pe?(me=(0,L.jsxs)(_t,{children:[ue,pe]}),t[32]=ue,t[33]=pe,t[34]=me):me=t[34];let he;t[35]!==te||t[36]!==me?(he=(0,L.jsx)(Fe,{onFocus:w,onBlur:te,shouldFilter:!1,id:`filename-input`,className:`bg-transparent group filename-input`,children:me}),t[35]=te,t[36]=me,t[37]=he):he=t[37];let _e;return t[38]!==_||t[39]!==he?(_e=(0,L.jsx)(Cn,{children:(0,L.jsx)(Oe,{open:_,modal:!1,children:he})}),t[38]=_,t[39]=he,t[40]=_e):_e=t[40],_e};function Uv(e,t,n){if(e&&!e.endsWith(`/`)&&((ye(`markdown`)?new Set([`py`,`md`,`markdown`,`qmd`]):new Set([`py`])).has(Nn.extension(e))||(e=e.endsWith(`.`)?`${e}py`:e.endsWith(`.p`)?`${e}y`:`${e}.py`),!t.some(t=>t.path===e||Nn.basename(t.path)===e)&&!(n&&(n===e||Nn.basename(n)===e))))return e}function Wv(e){e.key===`Escape`&&e.currentTarget.blur()}var Gv=e=>{let t=(0,I.c)(33),n=()=>{Fa(new Blob([r()],{type:`text/plain`}),`${e.proposedName}.json`)},r=c(Jv),i;t[0]!==n||t[1]!==e?(i=t=>{t.preventDefault(),n(),e.closeModal()},t[0]=n,t[1]=e,t[2]=i):i=t[2];let a;t[3]===e?a=t[4]:(a=t=>{t.key===`Escape`&&e.closeModal()},t[3]=e,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,L.jsx)(Or,{className:`text-accent-foreground mb-6`,children:`Download unsaved changes?`}),t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s={wordBreak:`break-word`},t[6]=s):s=t[6];let l,u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(`p`,{children:`This app has unsaved changes. To recover:`}),u={paddingBottom:`10px`},t[7]=l,t[8]=u):(l=t[7],u=t[8]);let d;t[9]===e.proposedName?d=t[10]:(d=(0,L.jsxs)(`li`,{style:u,children:[`Click the "Download" button. This will download a file called\xA0`,(0,L.jsxs)(`code`,{children:[e.proposedName,`.json`]}),`. This file contains your code.`]}),t[9]=e.proposedName,t[10]=d);let f;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(f={paddingBottom:`10px`},t[11]=f):f=t[11];let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p={display:`block`,padding:`10px`},t[12]=p):p=t[12];let m;t[13]===e.proposedName?m=t[14]:(m=(0,L.jsxs)(`code`,{style:p,children:[`marimo recover `,e.proposedName,`.json `,`>`,` `,e.proposedName,`.py`]}),t[13]=e.proposedName,t[14]=m);let h;t[15]===e.proposedName?h=t[16]:(h=(0,L.jsxs)(`code`,{children:[e.proposedName,`.py`]}),t[15]=e.proposedName,t[16]=h);let g;t[17]!==h||t[18]!==m?(g=(0,L.jsxs)(`li`,{style:f,children:[`In your terminal, type`,m,`to overwrite `,h,` with the recovered changes.`]}),t[17]=h,t[18]=m,t[19]=g):g=t[19];let _;t[20]!==g||t[21]!==d?(_=(0,L.jsx)(yr,{className:`markdown wrap-break-word`,style:s,children:(0,L.jsxs)(`div`,{className:`prose dark:prose-invert`,children:[l,(0,L.jsxs)(`ol`,{children:[d,g]})]})}),t[20]=g,t[21]=d,t[22]=_):_=t[22];let v;t[23]===e.closeModal?v=t[24]:(v=(0,L.jsx)(An,{"aria-label":`Cancel`,variant:`secondary`,"data-testid":`cancel-recovery-button`,onClick:e.closeModal,children:`Cancel`}),t[23]=e.closeModal,t[24]=v);let y;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,L.jsx)(An,{"data-testid":`download-recovery-button`,"aria-label":`Download`,variant:`default`,type:`submit`,children:`Download`}),t[25]=y):y=t[25];let b;t[26]===v?b=t[27]:(b=(0,L.jsxs)(Sr,{children:[v,y]}),t[26]=v,t[27]=b);let x;return t[28]!==i||t[29]!==a||t[30]!==_||t[31]!==b?(x=(0,L.jsx)(Dr,{className:`w-fit`,children:(0,L.jsxs)(`form`,{onSubmit:i,onKeyDown:a,children:[o,_,b]})}),t[28]=i,t[29]=a,t[30]=_,t[31]=b,t[32]=x):x=t[32],x},Kv=e=>{let t=(0,I.c)(12),{filename:n,needsSave:r}=e,{openModal:i,closeModal:a}=dr(),o;t[0]===n?o=t[1]:(o=n===null?`app`:Nn.basename(n).split(`.`)[0],t[0]=n,t[1]=o);let s=o,c;t[2]!==a||t[3]!==r||t[4]!==i||t[5]!==s?(c=()=>{r&&i((0,L.jsx)(Gv,{proposedName:s,closeModal:a}))},t[2]=a,t[3]=r,t[4]=i,t[5]=s,t[6]=c):c=t[6];let l=c;Xt(`global.save`,l);let u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=ba(`global.save`),t[7]=u):u=t[7];let d=r?`yellow`:`gray`,f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,L.jsx)(Wa,{strokeWidth:1.5,size:18}),t[8]=f):f=t[8];let p;return t[9]!==l||t[10]!==d?(p=(0,L.jsx)(On,{content:u,children:(0,L.jsx)(Ra,{onClick:l,id:`save-button`,"aria-label":`Save`,className:`rectangle`,color:d,children:f})}),t[9]=l,t[10]=d,t[11]=p):p=t[11],p};function qv(e){return{id:e.id,name:e.name,code:e.code,code_hash:null,config:{column:0,...e.config}}}function Jv(){let e=Ve(),t=Ee(e),n={version:`1`,metadata:{marimo_version:ha()},cells:t.map(qv)};return JSON.stringify(n,null,2)}var Yv=class{capturedInputs=new Map;inFlight=new Map;cancelEntry(e){e.controller.abort(),e.deferred.status===`pending`&&e.deferred.resolve(void 0)}needsCapture(e,t){if(this.capturedInputs.get(e)===t)return!1;let n=this.inFlight.get(e);return!(n&&n.inputValue===t)}waitForInFlight(e,t){let n=this.inFlight.get(e);return n&&n.inputValue===t?n.deferred.promise:null}startCapture(e,t){let n=this.inFlight.get(e);n&&this.cancelEntry(n);let r=new AbortController,i=new Ji,a={controller:r,inputValue:t,deferred:i};return this.inFlight.set(e,a),{signal:r.signal,markCaptured:n=>{this.inFlight.get(e)===a&&(i.resolve(n),this.capturedInputs.set(e,t),this.inFlight.delete(e))},markFailed:()=>{this.inFlight.get(e)===a&&(i.resolve(void 0),this.inFlight.delete(e))}}}prune(e){for(let t of this.capturedInputs.keys())e.has(t)||this.capturedInputs.delete(t);for(let[t,n]of this.inFlight)e.has(t)||(this.cancelEntry(n),this.inFlight.delete(t))}get isCapturing(){return this.inFlight.size>0}abort(){for(let e of this.inFlight.values())this.cancelEntry(e);this.inFlight.clear()}reset(){this.abort(),this.capturedInputs.clear()}},Xv=5e3;function Zv(){let e=(0,I.c)(20),t=i(Bt),{state:n}=i(_n),r;e[0]===t.auto_download?r=e[1]:(r=t.auto_download.includes(`markdown`),e[0]=t.auto_download,e[1]=r);let a=r,o;e[2]===t.auto_download?o=e[3]:(o=t.auto_download.includes(`html`),e[2]=t.auto_download,e[3]=o);let s=o,c;e[4]===t.auto_download?c=e[5]:(c=t.auto_download.includes(`ipynb`),e[4]=t.auto_download,e[5]=c);let l=c,u=n===gn.OPEN,d=!a||!u,f=!s||!u,p=!l||!u,{autoExportAsHTML:m,autoExportAsIPYNB:h,autoExportAsMarkdown:g,updateCellOutputs:_}=Wi(),v=ey(),y;e[6]===g?y=e[7]:(y=async()=>{await g({download:!1})},e[6]=g,e[7]=y);let b;e[8]===d?b=e[9]:(b={delayMs:Xv,whenVisible:!0,disabled:d},e[8]=d,e[9]=b),za(y,b);let x;e[10]===m?x=e[11]:(x=async()=>{await m({download:!1,includeCode:!0,files:Ln.INSTANCE.filenames(),layout:await In()})},e[10]=m,e[11]=x);let S;e[12]===f?S=e[13]:(S={delayMs:Xv,whenVisible:!0,disabled:f},e[12]=f,e[13]=S),za(x,S);let C;e[14]!==h||e[15]!==v||e[16]!==_?(C=async()=>{await ty({takeScreenshots:()=>v({progress:la.indeterminate()}),updateCellOutputs:_}),await h({download:!1})},e[14]=h,e[15]=v,e[16]=_,e[17]=C):C=e[17];let w;e[18]===p?w=e[19]:(w={delayMs:Xv,whenVisible:!0,disabled:p,skipIfRunning:!0},e[18]=p,e[19]=w),za(C,w)}var Qv=new Set([`text/html`,`application/vnd.vegalite.v5+json`,`application/vnd.vega.v5+json`,`application/vnd.vegalite.v6+json`,`application/vnd.vega.v6+json`]),$v=new Yv;function ey(){let e=i(ve);return async t=>{let{progress:n}=t,r=new Set(sn.keys(e));$v.prune(r);let i=[],a=[];for(let[t,n]of sn.entries(e)){let e=n.output?.data;if(n.output?.mimetype&&Qv.has(n.output.mimetype)&&e){if($v.needsCapture(t,e))i.push([t,e]);else{let n=$v.waitForInFlight(t,e);n&&a.push({cellId:t,promise:n})}}}if(i.length===0&&a.length===0)return{};i.length>0&&n.addTotal(i.length);let o={};for(let[e,t]of i){let r=$v.startCapture(e,t);try{let t=await xa(e);if(r.signal.aborted)continue;if(!t){rn.error(`Failed to capture screenshot for cell ${e}`),r.markFailed();continue}let n=[`image/png`,t];o[e]=n,r.markCaptured(n)}catch(t){rn.error(`Error screenshotting cell ${e}:`,t),r.markFailed()}finally{n.increment(1)}}let s=await Promise.allSettled(a.map(({promise:e})=>e));for(let[e,{cellId:t}]of a.entries()){let n=s[e];n.status===`fulfilled`&&n.value&&(o[t]=n.value)}return o}}async function ty(e){let{takeScreenshots:t,updateCellOutputs:n}=e;try{let e=await t();sn.size(e)>0&&await n({cellIdsToOutput:e})}catch(e){rn.error(`Error updating cell outputs with screenshots:`,e),Mr({title:`Failed to capture cell outputs`,description:`Some outputs may be missing from the export. Continuing.`,variant:`danger`})}}var ny=r(void 0),ry=r(e=>{let t=e(ny);return iy({state:e(Se),layout:e(Sa),lastSavedNotebook:t})});function iy({state:e,layout:t,lastSavedNotebook:n}){if(!n)return!1;let{cellIds:r,cellData:i}=e,o=r.inOrderIds.map(e=>i[e]),s=o.map(e=>e.code),c=o.map(e=>e.config),l=o.map(e=>e.name);return!ji(s,n.codes)||!ji(l,n.names)||!a(c,n.configs)||!a(t.selectedLayout,n.layout.selectedLayout)||!a(t.layoutData,n.layout.layoutData)}function ay(e){let t=(0,I.c)(21),{codes:n,cellConfigs:r,config:i,connStatus:a,cellNames:o,needsSave:s,kioskMode:c,onSave:l}=e,u=(0,F.useRef)(null),d;t[0]===n?d=t[1]:(d=n.join(`:`),t[0]=n,t[1]=d);let f=d,p;t[2]===r?p=t[3]:(p=r.map(oy).join(`:`),t[2]=r,t[3]=p);let m=p,h;t[4]===o?h=t[5]:(h=o.join(`:`),t[4]=o,t[5]=h);let g=h,_;t[6]!==i||t[7]!==a.state||t[8]!==c||t[9]!==s||t[10]!==l?(_=()=>{if(!c)return i.autosave===`after_delay`&&(u.current!==null&&clearTimeout(u.current),s&&a.state===gn.OPEN&&(u.current=setTimeout(l,i.autosave_delay))),()=>{u.current!==null&&clearTimeout(u.current)}},t[6]=i,t[7]=a.state,t[8]=c,t[9]=s,t[10]=l,t[11]=_):_=t[11];let v;t[12]!==m||t[13]!==g||t[14]!==f||t[15]!==i||t[16]!==a.state||t[17]!==c||t[18]!==s||t[19]!==l?(v=[f,m,g,i,a.state,l,c,s],t[12]=m,t[13]=g,t[14]=f,t[15]=i,t[16]=a.state,t[17]=c,t[18]=s,t[19]=l,t[20]=v):v=t[20],(0,F.useEffect)(_,v)}function oy(e){return JSON.stringify(e)}var sy=Promise.resolve();function cy(e){let t=sy.then(e);return sy=t.then(()=>void 0,()=>void 0),t}var ly=e=>{let t=(0,I.c)(15),{kioskMode:n}=e,r=ta(),a=i(ry),o=i(_n).state===gn.CLOSED,{saveOrNameNotebook:s,saveIfNotebookIsPersistent:c}=uy(),l;t[0]!==n||t[1]!==c?(l={onSave:c,kioskMode:n},t[0]=n,t[1]=c,t[2]=l):l=t[2],hy(l),Zv();let u;t[3]===a?u=t[4]:(u=e=>{if(a)return e.preventDefault(),e.returnValue=`You have unsaved changes. Are you sure you want to leave?`,e.returnValue},t[3]=a,t[4]=u),on(window,`beforeunload`,u);let d;t[5]===s?d=t[6]:(d=e=>{e.preventDefault(),e.stopPropagation(),s()},t[5]=s,t[6]=d);let f=d;if(Xt(`global.save`,s),o){let e;return t[7]!==r||t[8]!==a?(e=(0,L.jsx)(Kv,{filename:r,needsSave:a}),t[7]=r,t[8]=a,t[9]=e):e=t[9],e}let p;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(p=ba(`global.save`),t[10]=p):p=t[10];let m=a?`yellow`:`hint-green`,h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,L.jsx)(Wa,{strokeWidth:1.5,size:18}),t[11]=h):h=t[11];let g;return t[12]!==f||t[13]!==m?(g=(0,L.jsx)(On,{content:p,children:(0,L.jsx)(Ra,{"data-testid":`save-button`,id:`save-button`,shape:`rectangle`,color:m,onClick:f,children:h})}),t[12]=f,t[13]=m,t[14]=g):g=t[14],g};function uy(){let e=(0,I.c)(21),{sendSave:t}=Wi(),{openModal:r,closeModal:i,openAlert:a}=dr(),o=l(ny),s=ea(),u=n(),d;e[0]!==a||e[1]!==t||e[2]!==o||e[3]!==u?(d=(e,n)=>cy(async()=>{let r=u.get(_n),i=u.get(Vt);if(u.get(ln))return;if(r.state!==gn.OPEN){a(`Failed to save notebook: not connected to a kernel.`);return}if(rn.log(`saving to `,e),n&&i.format_on_save&&(rn.log(`formatting notebook (onSave)`),await he()),Ee(Ve()).length===0)return;let s=await ft(async()=>{let n=Ve(),r=Ee(n),i=r.map(py),a=r.map(fy),o=r.map(dy),s=Ae(n),c=u.get(Sa);return await t({cellIds:i,codes:a,names:o,filename:e,configs:s,layout:Rn(),persist:!0}),{names:o,codes:a,configs:s,layout:c}});o(s)}),e[0]=a,e[1]=t,e[2]=o,e[3]=u,e[4]=d):d=e[4];let f=c(d),p;e[5]!==f||e[6]!==u?(p=e=>{let t=e!==void 0&&e,n=u.get(Et),r=u.get(_n);my(n)&&r.state===gn.OPEN&&f(n,t)},e[5]=f,e[6]=u,e[7]=p):p=e[7];let m=c(p),h;e[8]!==f||e[9]!==s?(h=e=>{s(e).then(e=>{e!==null&&f(e,!0)})},e[8]=f,e[9]=s,e[10]=h):h=e[10];let g=h,_;e[11]!==i||e[12]!==g||e[13]!==r||e[14]!==m||e[15]!==u?(_=()=>{let e=u.get(Et),t=u.get(_n);m(!0),!my(e)&&t.state!==gn.CLOSED&&r((0,L.jsx)(vy,{onClose:i,onSave:g}))},e[11]=i,e[12]=g,e[13]=r,e[14]=m,e[15]=u,e[16]=_):_=e[16];let v=c(_),y;return e[17]!==m||e[18]!==f||e[19]!==v?(y={saveOrNameNotebook:v,saveIfNotebookIsPersistent:m,saveNotebook:f},e[17]=m,e[18]=f,e[19]=v,e[20]=y):y=e[20],y}function dy(e){return e.name}function fy(e){return e.code}function py(e){return e.id}function my(e){return e!==null&&!e.startsWith(`/tmp/`)&&!e.startsWith(`/var/folders`)&&!e.includes(`AppData\\Local\\Temp`)}function hy(e){let n=(0,I.c)(14),r=i(Vt),a=C(),[o]=t(_n),s=i(ry),c,l;if(n[0]!==a){let e=Ee(a);c=e.map(_y),l=e.map(gy),n[0]=a,n[1]=c,n[2]=l}else c=n[1],l=n[2];let u=l,d;n[3]===a?d=n[4]:(d=Ae(a),n[3]=a,n[4]=d);let f=d,p;n[5]!==r||n[6]!==u||n[7]!==c||n[8]!==f||n[9]!==o||n[10]!==s||n[11]!==e.kioskMode||n[12]!==e.onSave?(p={onSave:e.onSave,needsSave:s,codes:c,cellConfigs:f,cellNames:u,connStatus:o,config:r,kioskMode:e.kioskMode},n[5]=r,n[6]=u,n[7]=c,n[8]=f,n[9]=o,n[10]=s,n[11]=e.kioskMode,n[12]=e.onSave,n[13]=p):p=n[13],ay(p)}function gy(e){return e.name}function _y(e){return e.code}var vy=e=>{let t=(0,I.c)(17),{onClose:n,onSave:r}=e,[i,a]=(0,F.useState)(),o;t[0]!==n||t[1]!==r?(o=e=>{a(e),e.trim()&&(r(e),n())},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,L.jsx)(Or,{children:`Save notebook`}),t[3]=c):c=t[3];let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(Dn,{className:`text-md pt-6 px-1`,children:`Save as`}),t[4]=l):l=t[4];let u;t[5]===s?u=t[6]:(u=(0,L.jsxs)(`div`,{className:`flex flex-col`,children:[l,(0,L.jsx)(Hv,{onNameChange:s,placeholderText:`filename`,className:`missing-filename`})]}),t[5]=s,t[6]=u);let d;t[7]===n?d=t[8]:(d=(0,L.jsx)(An,{"data-testid":`cancel-save-dialog-button`,"aria-label":`Cancel`,variant:`secondary`,onClick:n,children:`Cancel`}),t[7]=n,t[8]=d);let f=!i,p;t[9]===f?p=t[10]:(p=(0,L.jsx)(An,{"data-testid":`submit-save-dialog-button`,"aria-label":`Save`,variant:`default`,disabled:f,type:`submit`,children:`Save`}),t[9]=f,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,L.jsxs)(Sr,{children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,L.jsxs)(Dr,{children:[c,u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h};function yy(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var by={modified:{doc:``},original:{doc:``}},xy=(0,F.createContext)(by);function Sy(e,t){return P({},e,t,{modified:P({},e.modified,t.modified),original:P({},e.original,t.original)})}var Cy=()=>(0,F.useContext)(xy),wy=e=>{var t=e.children,n=e.theme,r=(0,F.useReducer)(Sy,P({},by,{theme:n})),i=r[0],a=r[1];return(0,F.useEffect)(()=>a({theme:n}),[n]),(0,L.jsx)(xy.Provider,{value:P({},i,{dispatch:a}),children:t})},Ty=[`extensions`,`value`,`selection`,`onChange`],Ey=e=>{var t=e.extensions,n=t===void 0?[]:t,r=e.value,i=e.selection,a=e.onChange,o=_a(e,Ty),s=Cy(),c=s.theme,l=s.dispatch,u=va(P({},o,{theme:c}));return(0,F.useEffect)(()=>l({original:{doc:r,selection:i,extensions:[...u,...n]},originalExtension:{onChange:a,option:o,extension:[n]}}),[e]),null};Ey.displayName=`CodeMirrorMerge.Original`;var Dy=[`extensions`,`value`,`selection`,`onChange`],Oy=e=>{var t=e.extensions,n=t===void 0?[]:t,r=e.value,i=e.selection,a=e.onChange,o=_a(e,Dy),s=Cy(),c=s.theme,l=s.dispatch,u=va(P({},o,{theme:c}));return(0,F.useEffect)(()=>{l({modified:{doc:r,selection:i,extensions:[...u,...n]},modifiedExtension:{onChange:a,option:o,extension:[n]}})},[e]),null};Oy.displayName=`CodeMirrorMerge.Modified`;var ky=[`className`,`children`,`orientation`,`revertControls`,`highlightChanges`,`gutter`,`collapseUnchanged`,`destroyRerender`,`renderRevertControl`,`diffConfig`,`root`],Ay=[`modified`,`modifiedExtension`,`original`,`originalExtension`,`theme`,`dispatch`],jy=F.forwardRef((e,t)=>{var n=e.className,r=e.children,i=e.orientation,a=e.revertControls,o=e.highlightChanges,s=e.gutter,c=e.collapseUnchanged,l=e.destroyRerender,u=l===void 0||l,d=e.renderRevertControl,f=e.diffConfig,p=e.root,m=_a(e,ky),h=Cy(),g=h.modified,_=h.modifiedExtension,v=h.original,y=h.originalExtension,b=h.theme,x=h.dispatch,S=_a(h,Ay),C=(0,F.useRef)(null),w=(0,F.useRef)(),ee={orientation:i,revertControls:a,highlightChanges:o,gutter:s,collapseUnchanged:c,renderRevertControl:d,diffConfig:f,root:p};(0,F.useImperativeHandle)(t,()=>({container:C.current,view:w.current,modified:g,original:v,config:P({a:v,b:g,parent:C.current},ee)}),[C,w,g,v,ee]);var te=N.updateListener.of(e=>{if(e.docChanged&&typeof y?.onChange==`function`){var t=e.state.doc.toString();y?.onChange(t,e)}}),T=N.updateListener.of(e=>{if(e.docChanged&&typeof _?.onChange==`function`){var t=e.state.doc.toString();_?.onChange(t,e)}});return(0,F.useEffect)(()=>{!w.current&&C.current&&y&&_&&(w.current=new js(P({a:P({},v,{extensions:[...y?.extension||[],...va(P({},y?.option,{theme:b})),te]}),b:P({},g,{extensions:[..._?.extension||[],...va(P({},_?.option,{theme:b})),T]}),parent:C.current},ee)),x({view:w.current}))},[w,C,y,_]),(0,F.useEffect)(()=>{if(v&&v.doc&&w.current){var e=w.current?.a.state.doc.toString();if(e!==v.doc){var t;(t=w.current)==null||t.a.dispatch({changes:{from:0,to:e.length,insert:v.doc||``}})}}if(g&&g.doc&&w.current){var n=w.current?.b.state.doc.toString();if(n!==g.doc){var r;(r=w.current)==null||r.b.dispatch({changes:{from:0,to:n.length,insert:g.doc||``}})}}if(u&&w.current){var i=w.current.a.state.selection.ranges[0].from,a=w.current.b.state.selection.ranges[0].from;w.current.destroy(),w.current=new js(P({a:P({},v,{extensions:[...y?.extension||[],...va(P({},y?.option,{theme:b}))]}),b:P({},g,{extensions:[..._?.extension||[],...va(P({},_?.option,{theme:b}))]}),parent:C.current},ee)),i&&(w.current.a.focus(),w.current.a.dispatch({selection:{anchor:i,head:i}})),a&&(w.current.b.focus(),w.current.b.dispatch({selection:{anchor:a,head:a}}))}},[w,b,C.current,v,g,y,_,u]),(0,F.useEffect)(()=>()=>w.current&&w.current.destroy(),[]),(0,F.useEffect)(()=>{if(w.current){var e={};S.orientation!==i&&(e.orientation=i),S.revertControls!==a&&(e.revertControls=a),S.highlightChanges!==o&&(e.highlightChanges=o),S.gutter!==s&&(e.gutter=s),S.collapseUnchanged!==c&&(e.collapseUnchanged=c),S.renderRevertControl!==d&&(e.collapseUnchanged=c),Object.keys(e).length&&x&&w.current&&(w.current.reconfigure(P({},e)),x(P({},e)))}},[x,w,i,a,o,s,c,d]),(0,L.jsx)(`div`,P({ref:C,className:`cm-merge-theme`+(n?` `+n:``)},m,{children:r}))});jy.displayName=`CodeMirrorMerge.Internal`;var My=[`theme`],Ny=F.forwardRef((e,t)=>{var n=e.theme,r=_a(e,My);return(0,L.jsx)(wy,{theme:n,children:(0,L.jsx)(jy,P({},r,{ref:t}))})});Ny.Original=Ey,Ny.Modified=Oy,Ny.displayName=`CodeMirrorMerge`;var Py=Ny.Original,Fy=Ny.Modified,Iy=[pe(),N.lineWrapping],Ly=({cellId:e,aiCompletionCell:n,className:r,onChange:i,currentLanguageAdapter:a,currentCode:o,declineChange:s,acceptChange:c,runCell:l,outputArea:u,children:d})=>{let[p,m]=(0,F.useState)(!1),[h,g]=t(Oa),_=(0,F.useId)(),v=yn(),{initialPrompt:y,triggerImmediately:x,cellId:C}=n??{},w=C===e,ee=Wn(e),te;ee?.type===`update_cell`&&(te=ee.previousCode);let[T,E]=(0,F.useState)(``),[ne,D]=(0,F.useState)(y??``),re=F.useMemo(()=>new zn({api:v.getAiURL(`completion`).toString(),headers:()=>v.headers(),prepareSendMessagesRequest:({body:e,id:t})=>({body:{...e,id:t}})}),[v]),{sendMessage:ie,stop:ae,status:O}=ir({throttle:100,transport:re,onData:e=>{if(e.type===Bn){let t=Hn.parse(e.data);E(t.code.trimEnd())}},onError:e=>{E(``),Mr({title:`Completion failed`,description:$i(e)})},onFinish:({isAbort:e,isDisconnect:t,isError:n,finishReason:r})=>{(e||t||n||r!==`stop`)&&E(``)}}),k=O===`submitted`||O===`streaming`,oe=(0,F.useCallback)(()=>{E(``),ae()},[ae]),se=(0,F.useCallback)(async e=>{await ae(),E(``);let t={...Kn({input:e}),prompt:e,includeOtherCode:h?me(o):``,code:o,language:a??`python`};await ie({text:e},{body:t})},[o,a,h,ie,ae]),ce=(0,F.useCallback)(()=>{se(ne)},[se,ne]),le=F.useRef(null),ue=(0,F.useCallback)(()=>{x&&!k&&y&&se(y)},[x]);(0,F.useEffect)(()=>{w&&(S(()=>{let e=le.current;return e?.view?(e.view.focus(),ue(),!0):!1},{retries:3,delay:100,initialDelay:100}),b(le.current?.view))},[w,ue]),(0,F.useEffect)(()=>{w&&D(y||``)},[w,y,D]);let{theme:de}=Yi(),fe=()=>{c(T),E(``)},pe=()=>{oe(),m(!0),le.current?.view?.focus()},he=w&&x&&(T||k);u??=`below`;let ge=w&&(!x||p),_e=(0,L.jsx)(`div`,{className:Tn(`w-full bg-(--cm-background) flex justify-center transition-all duration-300 ease-in-out overflow-hidden`,he?`max-h-20 opacity-100 translate-y-0`:`max-h-0 opacity-0 -translate-y-2`),children:(0,L.jsx)(Ry,{status:k?`loading`:`generated`,onAccept:fe,onReject:pe,showInputPrompt:p,setShowInputPrompt:m,runCell:l,className:`mt-4 mb-3 w-lg`})}),ve=(e,t)=>(0,L.jsxs)(Ny,{className:`cm`,theme:de,children:[(0,L.jsx)(Py,{onChange:i,value:e,extensions:Iy}),(0,L.jsx)(Fy,{value:t,editable:!1,readOnly:!0,extensions:Iy})]}),ye=()=>{if(T&&w)return ve(o,T);if(!T&&te)return ve(te,o)},be=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Qn,{isLoading:k,onAccept:fe,size:`xs`,multipleCompletions:!1,label:tr.accept,acceptShortcut:`Mod-↵`,runCell:l}),(0,L.jsx)(er,{onDecline:pe,size:`xs`,multipleCompletions:!1,label:tr.decline,declineShortcut:`Shift-Mod-Delete`})]});return(0,L.jsxs)(`div`,{"data-ai-input-open":ge,className:Tn(`flex flex-col w-full rounded-[inherit]`,r),children:[(0,L.jsx)(`div`,{className:Tn(`flex items-center gap-2 px-3 transition-all rounded-[inherit] rounded-b-none duration-300`,ge&&`max-h-[400px] border-b min-h-11 visible`,!ge&&`max-h-0 min-h-0 invisible`),children:w&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(it,{className:`text-(--blue-10) shrink-0`,size:16}),(0,L.jsx)($n,{inputRef:le,className:`h-full my-0 py-2 flex items-center`,onClose:()=>{oe(),s()},value:ne,onChange:D,onSubmit:()=>{k||(le.current?.view&&Gn(le.current.view),ce())},onKeyDown:nr({handleAcceptCompletion:fe,handleDeclineCompletion:pe,isLoading:k,hasCompletion:T.trim().length>0})}),(0,L.jsxs)(`div`,{className:`-mr-1.5 py-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-row items-center justify-end gap-0.5`,children:[(0,L.jsx)(Zn,{isLoading:k,onStop:oe,onSendClick:ce,isEmpty:!ne.trim(),showStopLabel:!0}),(0,L.jsx)(Xn,{handleAddContext:()=>rr(le),isLoading:k}),(0,L.jsx)(Zt,{triggerClassName:`h-7 text-xs`,iconSize:`small`,forRole:`edit`,displayIconOnly:!0,placeholder:`Edit model`})]}),T&&(0,L.jsx)(`div`,{className:`mt-1 flex items-center gap-1`,children:be})]}),(0,L.jsx)(`div`,{className:`h-full w-px bg-border mx-2`}),(0,L.jsx)(On,{content:`Include code from other cells`,children:(0,L.jsxs)(`div`,{className:`flex flex-row items-start gap-1 overflow-hidden`,children:[(0,L.jsx)(f,{"data-testid":`include-other-cells-checkbox`,id:_,checked:h,onCheckedChange:e=>g(!!e)}),(0,L.jsx)(Dn,{htmlFor:_,className:`text-muted-foreground text-xs whitespace-nowrap ellipsis`,children:`All code`})]})}),(0,L.jsx)(An,{"data-testid":`decline-completion-button`,variant:`text`,size:`icon`,disabled:k,onClick:()=>{oe(),s()},children:(0,L.jsx)(ar,{className:`text-(--red-10)`,size:16})})]})}),u===`above`&&_e,ye(),(!T||!w)&&!te&&d,u===`below`&&_e]})},Ry=e=>{let t=(0,I.c)(27),{status:n,onAccept:r,onReject:i,className:a,showInputPrompt:o,setShowInputPrompt:s,runCell:c}=e,l=n===`loading`,u;t[0]===a?u=t[1]:(u=Tn(`flex flex-row items-center gap-6 rounded-md py-2 px-2.5 text-sm border border-border bg-(--gray-2) dark:bg-(--gray-3)`,a),t[0]=a,t[1]=u);let d;t[2]===l?d=t[3]:(d=l?(0,L.jsx)(Da,{className:`animate-spin text-blue-600 mb-px`,size:15,strokeWidth:2,"aria-label":`Generating fix`}):(0,L.jsx)(Ba,{className:`text-green-600 mb-px`,size:15,strokeWidth:2,"aria-label":`Fix generated`}),t[2]=l,t[3]=d);let f=l?`Generating fix...`:`Showing fix`,p;t[4]===f?p=t[5]:(p=(0,L.jsx)(`p`,{className:`transition-opacity duration-200 text-muted-foreground`,children:f}),t[4]=f,t[5]=p);let m;t[6]!==d||t[7]!==p?(m=(0,L.jsxs)(`div`,{className:`flex flex-row items-center gap-2`,children:[d,p]}),t[6]=d,t[7]=p,t[8]=m):m=t[8];let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,L.jsx)(Dn,{htmlFor:`show-input-prompt`,className:`text-muted-foreground text-xs whitespace-nowrap ellipsis`,children:`Show prompt`}),t[9]=h):h=t[9];let g;t[10]!==s||t[11]!==o?(g=(0,L.jsxs)(`div`,{className:`flex flex-row items-center gap-1`,children:[h,(0,L.jsx)(fa,{checked:o,onCheckedChange:s,size:`xs`})]}),t[10]=s,t[11]=o,t[12]=g):g=t[12];let _;t[13]!==l||t[14]!==r||t[15]!==c?(_=(0,L.jsx)(Qn,{isLoading:l,onAccept:r,size:`xs`,label:tr.accept,runCell:c}),t[13]=l,t[14]=r,t[15]=c,t[16]=_):_=t[16];let v;t[17]===i?v=t[18]:(v=(0,L.jsx)(er,{onDecline:i,size:`xs`,label:tr.decline}),t[17]=i,t[18]=v);let y;t[19]!==_||t[20]!==v?(y=(0,L.jsxs)(`div`,{className:`flex flex-row items-center gap-2 ml-auto`,children:[_,v]}),t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;return t[22]!==u||t[23]!==y||t[24]!==m||t[25]!==g?(b=(0,L.jsxs)(`div`,{className:u,children:[m,g,y]}),t[22]=u,t[23]=y,t[24]=m,t[25]=g,t[26]=b):b=t[26],b},zy=`web application/x-marimo-cell`,By=Nt({cells:Pt(Nt({code:jt(),name:jt().optional(),config:Nt({column:At([Ot(),Ft()]).optional(),disabled:Mt().optional(),hide_code:Mt().optional(),expand_output:Mt().optional()}).optional()})),version:kt(`1.0`)});function Vy(e){return e.map(e=>e.code).join(`
20
20
 
21
- `)}async function Hy(e){let t={cells:e.map(e=>({code:e.code,name:e.name,config:e.config})),version:`1.0`},n=new Jy().add(zy,t).add(`text/plain`,Vy(e)).build();await navigator.clipboard.write([n])}function Uy(){let e=(0,I.c)(13),t=y(),n=Pe(),r=nt(),i;e[0]===n?i=e[1]:(i=async e=>{let t=Ve(),r=e.map(e=>t.cellData[e]).filter(Boolean);if(r.length!==0)try{await Hy(r),n.clear(),Wy(r.length)}catch(e){let t=e;rn.error(`Failed to copy cells to clipboard`,t);try{await Ar(Vy(r)),n.clear(),Wy(r.length)}catch{Gy()}}},e[0]=n,e[1]=i);let a=c(i),o;e[2]===n?o=e[3]:(o=async e=>{let t=Ve(),r=e.filter(e=>t.cellData[e]),i=r.map(e=>t.cellData[e]);if(i.length!==0)try{await Hy(i),n.markForCut({cellIds:r})}catch(e){let t=e;rn.error(`Failed to cut cells to clipboard`,t);try{await Ar(Vy(i)),n.markForCut({cellIds:r})}catch{Gy()}}},e[2]=n,e[3]=o);let s=c(o),l;e[4]!==t||e[5]!==n||e[6]!==r.cellIds?(l=async(e,i)=>{let{before:a}=i??{},o=a!==void 0&&a;if(r.cellIds.size>0){let i=[...r.cellIds],a=Ve(),s=i.map(e=>{let t=a.cellIds.findWithId(e);return{columnId:t.id,index:t.indexOfOrThrow(e)}});t.moveCellsRelativeTo({cellIds:i,targetCellId:e,position:o?`before`:`after`,previousPlacements:s}),n.clear();return}try{let n=await navigator.clipboard.read();for(let r of n)if(r.types.includes(zy)){let n=await(await r.getType(zy)).text();try{let r=By.parse(JSON.parse(n));if(r.cells.length===0)break;let i=e,a=r.cells.toReversed();for(let e of a)t.createNewCell({cellId:i,before:o,code:e.code,name:e.name,config:e.config,hideCode:e.config?.hide_code,autoFocus:!0});return}catch(e){let t=e;rn.warn(`Failed to parse clipboard cell data`,t)}}let r=await navigator.clipboard.readText();r.trim()?t.createNewCell({cellId:e,before:o,code:r,autoFocus:!0}):Ky()}catch(e){let t=e;rn.error(`Failed to paste from clipboard`,t),qy()}},e[4]=t,e[5]=n,e[6]=r.cellIds,e[7]=l):l=e[7];let u=c(l),d;return e[8]!==a||e[9]!==s||e[10]!==u||e[11]!==n.clear?(d={copyCells:a,cutCells:s,pasteAtCell:u,clearPendingCut:n.clear},e[8]=a,e[9]=s,e[10]=u,e[11]=n.clear,e[12]=d):d=e[12],d}var Wy=e=>{let t=e===1?`Cell`:`${e} cells`;jr({title:`${t} copied`,description:`${t} ${e===1?`has`:`have`} been copied to clipboard.`})},Gy=()=>{jr({title:`Copy failed`,description:`Failed to copy cells to clipboard.`,variant:`danger`})},Ky=()=>{jr({title:`Nothing to paste`,description:`No cell or text found in clipboard.`,variant:`danger`})},qy=()=>{jr({title:`Paste failed`,description:`Failed to read from clipboard`,variant:`danger`})},Jy=class{items={};add(e,t){return ClipboardItem.supports(e)?typeof t==`string`?(this.items[e]=new Blob([t],{type:e}),this):(this.items[e]=new Blob([JSON.stringify(t)],{type:e}),this):(rn.warn(`ClipboardItem does not support ${e}`),this)}build(){return new ClipboardItem(this.items)}};function Yy(){return{selectionStart:null,selectionEnd:null,selected:new Set}}var{reducer:Xy,createActions:Zy,valueAtom:Qy,useActions:$y}=Mi(Yy,{select:(e,t)=>({selectionStart:t.cellId,selectionEnd:t.cellId,selected:new Set([t.cellId])}),extend:(e,t)=>{if(!e.selectionStart)return{selectionStart:t.cellId,selectionEnd:t.cellId,selected:new Set([t.cellId])};let{cellId:n,allCellIds:r}=t;try{let t=r.findWithId(e.selectionStart),i=t.indexOfOrThrow(e.selectionStart),a=t.indexOfOrThrow(n),[o,s]=i<a?[i,a]:[a,i],c=t.slice(o,s+1);return{selectionStart:e.selectionStart,selectionEnd:n,selected:new Set(c)}}catch{return{selectionStart:n,selectionEnd:n,selected:new Set([n])}}},clear:e=>e.selected.size===0?e:Yy()}),eb=()=>i(Qy);function tb(e){let t=(0,I.c)(2),n;return t[0]===e?n=t[1]:(n=r(t=>t(Qy).selected.has(e)),t[0]=e,t[1]=n),i(n)}function nb(){return $y()}function rb(e){return e.get(Qy).selected}var{valueAtom:ib,useActions:ab}=Mi(()=>new Set,{add:(e,t)=>{if(e.has(t))return e;let n=new Set(e);return n.add(t),n},remove:(e,t)=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),ee(()=>{let e=document.activeElement;if(!e)return;let t=wt.findElementThroughShadowDOMs(e);t&&le(wt.parse(t.id))}),n}}),ob=e=>r(t=>t(ib).has(e));function sb(e){let t=(0,I.c)(2),n;return t[0]===e?n=t[1]:(n=ob(e),t[0]=e,t[1]=n),i(n)}var cb=new WeakMap,lb=500;function ub(e){if(e.ctrlKey||e.metaKey||e.altKey)return``;let t=e.key.toLowerCase();return e.shiftKey?`shift+${t}`:t}function db(e,t){let n=ub(e),r=e.target;if(!n||!r)return!1;let i=cb.get(r),a=n;i?.timeout&&clearTimeout(i.timeout),i&&(a=`${i.sequence} ${n}`);let o=t[a];if(o)return cb.delete(r),o();if(!i){let e=t[n];if(e)return e()}if(Object.keys(t).some(e=>e.startsWith(`${a} `))){let e=window.setTimeout(()=>{cb.delete(r)},lb);return cb.set(r,{sequence:a,timeout:e}),!0}return cb.delete(r),!1}function fb(e){return{handle:t=>e(t),bulkHandle:t=>{let n=!0;try{for(let r of t)n&&=e(r);return n}catch{return!1}}}}function pb(e){return{handle:t=>e([t]),bulkHandle:t=>e(t)}}function mb(e,t){let n=(0,I.c)(12),r=T(),i=y(),a=ab(),o;n[0]!==e||n[1]!==r?(o=()=>{r.focusCell({cellId:e})},n[0]=e,n[1]=r,n[2]=o):o=n[2];let s;n[3]!==i||n[4]!==e||n[5]!==t||n[6]!==r||n[7]!==a?(s=n=>{hb(n.relatedTarget)||hb(n.target)||gb(n.relatedTarget)!==e&&gb(n.relatedTarget?.closest(`[data-for-cell-id]`))!==e&&(a.remove(e),i.markTouched({cellId:e}),r.blurCell(),t.current&&xb(t.current))},n[3]=i,n[4]=e,n[5]=t,n[6]=r,n[7]=a,n[8]=s):s=n[8];let c;n[9]!==o||n[10]!==s?(c={onFocusWithin:o,onBlurWithin:s},n[9]=o,n[10]=s,n[11]=c):c=n[11];let{focusWithinProps:l}=Cr(c);return l}function hb(e){return e?e instanceof HTMLElement&&e.closest(`.cm-vim-panel`)!==null:!1}function gb(e){return e&&e.getAttribute(ne)||null}function _b(e,t){let r=(0,I.c)(34),{canMoveX:a,editorView:o,cellActionDropdownRef:s}=t,{saveOrNameNotebook:c}=uy(),{saveCellConfig:u}=Ui(),d=l(ca),f=y(),p=n(),h=ab(),g=oa(),_=i(Wt),{copyCells:v,pasteAtCell:b,cutCells:x}=Uy(),S=nb(),C=tb(e),w=nl(),ee=mr(),te=i(Rt),T;r[0]===te?T=r[1]:(T=zt(te),r[0]=te,r[1]=T);let E=T,ne;r[2]!==w||r[3]!==S?(ne={clear:()=>{w.clear(),S.clear()},extend:e=>{w.clear(),S.extend(e)},select:e=>{w.clear(),S.select(e)}},r[2]=w,r[3]=S,r[4]=ne):ne=r[4];let D=ne,re=i(Vt),ie;r[5]===re?ie=r[6]:(ie=(e,t)=>an(re.getHotkey(e).key)(t.nativeEvent||t),r[5]=re,r[6]=ie);let ae=ie,O=mb(e,o),k;r[7]!==f||r[8]!==E||r[9]!==a||r[10]!==s||r[11]!==e||r[12]!==v||r[13]!==x||r[14]!==ee||r[15]!==o||r[16]!==C||r[17]!==ae||r[18]!==_||r[19]!==b||r[20]!==w||r[21]!==g||r[22]!==u||r[23]!==c||r[24]!==D||r[25]!==d||r[26]!==p||r[27]!==h||r[28]!==te?(k={onKeyDown:t=>{if(On.fromInput(t)){t.continuePropagation();return}let n={"Mod+ArrowUp":()=>(f.focusTopCell(),D.clear(),!0),"Mod+ArrowDown":()=>(f.focusBottomCell(),D.clear(),!0),ArrowUp:()=>(f.focusCell({cellId:e,where:`before`}),D.clear(),!0),ArrowDown:()=>(f.focusCell({cellId:e,where:`after`}),D.clear(),!0),ArrowLeft:()=>{if(a){let t=p.get(Se),n=t.cellIds.findWithId(e),r=t.cellIds.indexOf(n),i=t.cellIds.at(r-1);if(i&&i.length>0){let t=bb(e,i);return f.focusCell({cellId:t,where:`exact`}),D.clear(),!0}}return!1},ArrowRight:()=>{if(a){let t=p.get(Se),n=t.cellIds.findWithId(e),r=t.cellIds.indexOf(n),i=t.cellIds.at(r+1);if(i&&i.length>0){let t=bb(e,i);return f.focusCell({cellId:t,where:`exact`}),D.clear(),!0}}return!1},"Shift+ArrowUp":()=>{let t=p.get(We);D.extend({cellId:e,allCellIds:t});let n=t.findWithId(e).before(e);return n&&D.extend({cellId:n,allCellIds:t}),f.focusCell({cellId:e,where:`before`}),!0},"Shift+ArrowDown":()=>{let t=p.get(We);D.extend({cellId:e,allCellIds:t});let n=t.findWithId(e).after(e);return n&&D.extend({cellId:n,allCellIds:t}),f.focusCell({cellId:e,where:`after`}),!0},Escape:()=>p.get(mt).size>0?(p.set(Je),!0):C?(D.clear(),!0):!1,Enter:()=>(h.add(e),de(p,e),D.clear(),!0),s:()=>(c(),!0)};for(let[e,r]of Object.entries(n))if(an(e)(t)&&r()){t.preventDefault();return}let r={"cell.run":pb(e=>(g(e),!0)),"cell.runAndNewBelow":pb(e=>{g(e);let t=e[e.length-1];return f.moveToNextCell({cellId:t,before:!1}),!0}),"cell.runAndNewAbove":pb(e=>{g(e);let t=e[0];return f.moveToNextCell({cellId:t,before:!0}),!0}),"cell.createAbove":e=>(f.createNewCell({cellId:e,before:!0}),!0),"cell.createBelow":e=>(f.createNewCell({cellId:e,before:!1}),!0),"cell.moveUp":pb(e=>{let t=e[0];return p.get(Se).cellIds.findWithId(t).first()!==t&&(e.forEach(e=>{f.moveCell({cellId:e,before:!0})}),!0)}),"cell.moveDown":pb(e=>{let t=e[e.length-1];return p.get(Se).cellIds.findWithId(t).last()!==t&&(e.toReversed().forEach(e=>{f.moveCell({cellId:e,before:!1})}),!0)}),"cell.moveLeft":fb(e=>a?(f.moveCell({cellId:e,direction:`left`}),!0):!1),"cell.moveRight":fb(e=>a?(f.moveCell({cellId:e,direction:`right`}),!0):!1),"cell.hideCode":pb(e=>{let t=!e.map(e=>p.get(Se).cellData[e]?.config||null).every(vb);u({configs:Object.fromEntries(e.map(e=>[e,{hide_code:t}]))});for(let n of e)f.updateCellConfig({cellId:n,config:{hide_code:t}});if(e.length===1){let n=e[0];f.focusCell({cellId:n,where:`after`}),t?(o.current?.contentDOM.blur(),se(n)):de(p,n)}return!0}),"cell.focusDown":e=>(f.focusCell({cellId:e,where:`after`}),!0),"cell.focusUp":e=>(f.focusCell({cellId:e,where:`before`}),!0),"cell.sendToBottom":pb(e=>(e.forEach(e=>{f.sendToBottom({cellId:e})}),!0)),"cell.sendToTop":pb(e=>(e.toReversed().forEach(e=>{f.sendToTop({cellId:e})}),!0)),"cell.aiCompletion":e=>{if(!E)return!1;let t=!1;return d(n=>n?.cellId===e?(t=!0,null):{cellId:e}),t&&o.current?.focus(),!0},"cell.cellActions":()=>(s.current?.toggle(),!0),"command.copyCell":pb(e=>(v(e),!0)),"command.cutCell":pb(e=>(x(e),!0)),"command.pasteCell":e=>(b(e),!0),"command.createCellBefore":e=>!On.hasModifier(t)&&(f.createNewCell({cellId:e,before:!0,autoFocus:!0}),!0),"command.createCellAfter":e=>!On.hasModifier(t)&&(f.createNewCell({cellId:e,before:!1,autoFocus:!0}),!0),"command.createSqlCellAfter":e=>!On.hasModifier(t)&&(m({autoInstantiate:!0,createNewCell:f.createNewCell,fromCellId:e,before:!0}),f.createNewCell({cellId:e,before:!1,autoFocus:!0,code:ue.sql.defaultCode}),!0),"cell.delete":()=>{if(!te.keymap.destructive_delete)return!1;let t=i.size>=2?[...i]:[e],n=p.get(Se);return t.some(e=>{let{status:t}=n.cellRuntime[e];return t===`running`||t===`queued`})?!1:w.idle?(w.submit(t),!0):(ee({cellIds:t}),w.clear(),!0)}},i=rb(p);if(_===`vim`&&db(t.nativeEvent||t,{j:n.ArrowDown,k:n.ArrowUp,h:n.ArrowLeft,l:n.ArrowRight,i:n.Enter,"shift+j":n[`Shift+ArrowDown`],"shift+k":n[`Shift+ArrowUp`],"g g":n[`Mod+ArrowUp`],"shift+g":n[`Mod+ArrowDown`],"d d":()=>r[`cell.delete`](),"y y":()=>(v(i.size>=2?[...i]:[e]),!0),p:()=>(b(e,{before:!1}),!0),"shift+p":()=>(b(e,{before:!0}),!0),o:()=>(f.createNewCell({cellId:e,before:!1,autoFocus:!0}),!0),"shift+o":()=>(f.createNewCell({cellId:e,before:!0,autoFocus:!0}),!0),u:()=>(f.undoDeleteCell(),!0)})){t.preventDefault();return}for(let[n,a]of Object.entries(r))if(ae(n,t)){if(typeof a==`function`){if(a(e)){t.preventDefault();return}}else if(i.size>=2?a.bulkHandle([...i]):a.handle(e)){t.preventDefault();return}return}t.continuePropagation()}},r[7]=f,r[8]=E,r[9]=a,r[10]=s,r[11]=e,r[12]=v,r[13]=x,r[14]=ee,r[15]=o,r[16]=C,r[17]=ae,r[18]=_,r[19]=b,r[20]=w,r[21]=g,r[22]=u,r[23]=c,r[24]=D,r[25]=d,r[26]=p,r[27]=h,r[28]=te,r[29]=k):k=r[29];let{keyboardProps:oe}=br(k),ce;return r[30]!==O||r[31]!==C||r[32]!==oe?(ce=Or(O,oe,{"data-selected":C,className:`data-[selected=true]:ring-1 data-[selected=true]:ring-(--blue-8) data-[selected=true]:ring-offset-1`}),r[30]=O,r[31]=C,r[32]=oe,r[33]=ce):ce=r[33],ce}function vb(e){return e?.hide_code}function yb(e,t){let n=(0,I.c)(12),r=ab(),a=i(Wt),o=i(Vt),s;if(n[0]!==o){let e=o.getHotkey(`command.vimEnterCommandMode`);s=an(e.key),n[0]=o,n[1]=s}else s=n[1];let c=s,l;n[2]!==e||n[3]!==r?(l=()=>{r.remove(e),se(e),ee(()=>{le(e)})},n[2]=e,n[3]=r,n[4]=l):l=n[4];let u=l,d;n[5]!==t||n[6]!==u?(d=()=>{if(!t.current){u();return}let e=t.current,n=e.state;if(Si(e))return;let r=!!n.field(St,!1)||!!n.field(ke,!1),i=Ri(n)!==null;r&&xb(e),i&&Bi(e),!(r||i)&&u()},n[5]=t,n[6]=u,n[7]=d):d=n[7];let f=d,p;n[8]!==f||n[9]!==a||n[10]!==c?(p={onKeyDown:e=>{a===`vim`?c(e)&&f():e.key===`Escape`&&f(),e.continuePropagation()}},n[8]=f,n[9]=a,n[10]=c,n[11]=p):p=n[11];let{keyboardProps:m}=br(p);return m}function bb(e,t){let n=document.getElementById(wt.create(e));if(!n)return t.first();let r=n.getBoundingClientRect();for(let e of t.topLevelIds){let t=document.getElementById(wt.create(e));if(t){let n=t.getBoundingClientRect();if(r.top<=n.bottom&&r.bottom>=n.top)return e}}return t.last()}function xb(e){e.state.field(St,!1)&&e.dispatch({effects:Ce.of(null)}),lt(e)}var Sb=50,Cb=4,wb=60;function Tb(e){return Math.min(wb,Math.max(Cb,e))}var Eb=e=>{let t=(0,I.c)(13),{code:n,className:r}=e,i,a,o,s;if(t[0]!==r||t[1]!==n){let e=n.split(`
22
- `,Sb);t[6]===r?i=t[7]:(i=wn(`cm`,`mo-code-placeholder`,r),t[6]=r,t[7]=i),a=`cell-editor-placeholder`,o=!0,s=e.map(Db),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s}else i=t[2],a=t[3],o=t[4],s=t[5];let c;return t[8]!==i||t[9]!==a||t[10]!==o||t[11]!==s?(c=(0,L.jsx)(`div`,{className:i,"data-testid":a,"aria-hidden":o,children:s}),t[8]=i,t[9]=a,t[10]=o,t[11]=s,t[12]=c):c=t[12],c};function Db(e,t){let n=e.trimEnd().length;return(0,L.jsx)(`div`,{className:`mo-code-placeholder-line`,children:n>0&&(0,L.jsx)(Ia,{className:`mo-code-placeholder-bar`,style:{width:`${Tb(n)}ch`}})},t)}var Ob=e=>{let t=(0,I.c)(25),{editorView:n,code:r,currentLanguageAdapter:i,onAfterToggle:a,className:o}=e,s=o===void 0?`absolute right-3 top-2 z-20 flex hover-action gap-1`:o,c;t[0]===r?c=t[1]:(c=ue.markdown.isSupported(r)||r.trim()===``,t[0]=r,t[1]=c);let l=c,u;t[2]===r?u=t[3]:(u=ue.sql.isSupported(r)||r.trim()===``,t[2]=r,t[3]=u);let d=u&&i===`python`,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,L.jsx)(jn,{color:`var(--sky-11)`,strokeWidth:2.5,className:`w-4 h-4`}),t[4]=f):f=t[4];let p;t[5]!==i||t[6]!==n||t[7]!==a||t[8]!==d?(p=(0,L.jsx)(kb,{editorView:n,currentLanguageAdapter:i,canSwitchToLanguage:d,icon:f,toType:`sql`,displayName:`SQL`,onAfterToggle:a}),t[5]=i,t[6]=n,t[7]=a,t[8]=d,t[9]=p):p=t[9];let m=l&&i===`python`,h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,L.jsx)(sa,{fill:`var(--sky-11)`,color:`black`,className:`w-4 h-4`}),t[10]=h):h=t[10];let g;t[11]!==i||t[12]!==n||t[13]!==a||t[14]!==m?(g=(0,L.jsx)(kb,{editorView:n,currentLanguageAdapter:i,canSwitchToLanguage:m,icon:h,toType:`markdown`,displayName:`Markdown`,onAfterToggle:a}),t[11]=i,t[12]=n,t[13]=a,t[14]=m,t[15]=g):g=t[15];let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,L.jsx)(xa,{fill:`var(--sky-11)`,color:`black`,className:`w-4 h-4`}),t[16]=_):_=t[16];let v;t[17]!==i||t[18]!==n?(v=(0,L.jsx)(kb,{editorView:n,currentLanguageAdapter:i,canSwitchToLanguage:!0,icon:_,toType:`python`,displayName:`Python`,onAfterToggle:tn.NOOP}),t[17]=i,t[18]=n,t[19]=v):v=t[19];let y;return t[20]!==s||t[21]!==v||t[22]!==p||t[23]!==g?(y=(0,L.jsxs)(`div`,{className:s,children:[p,g,v]}),t[20]=s,t[21]=v,t[22]=p,t[23]=g,t[24]=y):y=t[24],y},kb=e=>{let t=(0,I.c)(10),{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:i,icon:a,toType:o,displayName:s,onAfterToggle:c}=e,l;t[0]!==n||t[1]!==c||t[2]!==o?(l=()=>{n&&(yt(n,{language:o}),c())},t[0]=n,t[1]=c,t[2]=o,t[3]=l):l=t[3];let u=l;if(!i||r===o)return null;let d=`View as ${s}`,f;t[4]!==u||t[5]!==a?(f=(0,L.jsx)(kn,{"data-testid":`language-toggle-button`,variant:`text`,size:`xs`,className:`opacity-80 px-1`,onClick:u,children:a}),t[4]=u,t[5]=a,t[6]=f):f=t[6];let p;return t[7]!==d||t[8]!==f?(p=(0,L.jsx)(Dn,{content:d,children:f}),t[7]=d,t[8]=f,t[9]=p):p=t[9],p};function Ab(e,t,n){return n?{code:n.code,extensions:[...t,n.extension]}:{code:e,extensions:t}}var jb=({theme:e,showPlaceholder:n,id:r,config:a,code:o,status:s,serializedEditorState:l,setEditorView:u,runCell:d,userConfig:f,editorViewRef:p,editorViewParentRef:h,hidden:g,hasOutput:v,showHiddenCode:b,languageAdapter:x,setLanguageAdapter:S,showLanguageToggles:C=!0,inlineAiTooltip:w,outputArea:ee,tooltipParentSelector:te})=>{let[T,E]=t(ca),ne=pr(),{saveOrNameNotebook:D}=uy(),re=nl(),{saveCellConfig:ie}=Ui(),ae=s===`running`||s===`queued`,O=y(),k=qc(),oe=x===`markdown`,se=c(()=>ae?!1:re.idle&&f.keymap.destructive_delete?(re.submit([r]),!0):(ne({cellId:r}),!0)),ce=c(()=>!ae&&(d(),p.current&&xb(p.current),!0)),le=c(()=>{let e=!a.hide_code;return ie({configs:{[r]:{hide_code:e}}}),O.updateCellConfig({cellId:r,config:{hide_code:e}}),e}),ue=i(Bt),de=i(Gt),fe=c(()=>{m({autoInstantiate:ue,createNewCell:O.createNewCell}),a.hide_code||(ie({configs:{[r]:{hide_code:!0}}}),O.updateCellConfig({cellId:r,config:{hide_code:!0}}),O.markUntouched({cellId:r}))}),pe=c(()=>{m({autoInstantiate:ue,createNewCell:O.createNewCell})}),me=zt(f),he=(0,F.useMemo)(()=>{let t=Hm({cellId:r,showPlaceholder:n,enableAI:me,cellActions:{...O,afterToggleMarkdown:fe,afterToggleSQL:pe,onRun:ce,deleteCell:se,saveNotebook:D,createManyBelow:e=>{for(let t of e.toReversed())O.createNewCell({code:t,before:!1,cellId:r,skipIfCodeExists:!0})},addOrAppendSetupCell:e=>{let t=Ve();if(!t.cellIds.setupCellExists()){O.addSetupCellIfDoesntExist({code:e});return}let n=st(t)[_],r=n?Me(n):t.cellData[_].code,i=r.trim()?`${r.trimEnd()}\n\n${e}`:e;n&&Le(n,i),O.updateCellCode({cellId:_,code:i,formattingChange:!1})},splitCell:k,toggleHideCode:le,aiCellCompletion:()=>{if(!me)return!1;let e=!1;return E(t=>t?.cellId===r?(e=!0,null):{cellId:r}),e}},completionConfig:f.completion,acceptCompletionOnEnter:de,keymapConfig:f.keymap,lspConfig:f.language_servers,theme:e,hotkeys:new nn(f.keymap.overrides??{}),diagnosticsConfig:f.diagnostics,displayConfig:f.display,inlineAiTooltip:w??f.ai?.inline_tooltip??!1,tooltipParentSelector:te});return t.push(_i.define(e=>(S(e.state.field(Ue).type),{update(e){S(e.state.field(Ue).type)}})),N.updateListener.of(e=>{e.selectionSet&&e.state.selection.ranges.some(e=>e.from!==e.to)&&b({focus:!1})}),N.domEventHandlers({focus:()=>{b({focus:!1})}})),t},[r,de,f.keymap,f.completion,f.language_servers,f.display,f.diagnostics,f.ai?.inline_tooltip,w,te,me,e,n,O,k,le,se,ce,E,fe,pe,S,b,D]),ge=xe()&&Ge(r),_e=e=>{if(!ge)return Ab(o,he,void 0);let t=Lv(r,e=>{O.updateCellCode({cellId:r,code:e,formattingChange:!0})},e);return Ab(o,he,t)},ve=c(()=>{let e=_e(o),t=new N({state:ri.create({doc:e.code,extensions:e.extensions})});u(t),ge||yt(t,{language:Ze(t.state).type})}),ye=c(()=>{cn(p.current!==null,`Editor view is not initialized`);let e=_e();p.current.dispatch({effects:[j.reconfigure.of([e.extensions]),Be(p.current,{completionConfig:f.completion,hotkeysProvider:new nn(f.keymap.overrides??{}),lspConfig:{...f.language_servers,diagnostics:f.diagnostics}})]})}),be=c(()=>{cn(l,`Editor view is not initialized`);let e=_e(o),t=new N({state:ri.fromJSON(l,{doc:e.code,extensions:e.extensions},{history:bi})});ge||yt(t,{language:Ze(t.state).type}),u(t),O.clearSerializedEditorState({cellId:r})}),[Se,Ce]=(0,F.useState)(l!==null);(0,F.useEffect)(()=>{if(p.current!==null){Ce(!0);return}if(Ce(!1),l!==null){be(),Ce(!0);return}return bt.request(r,()=>{p.current===null&&(ve(),Ce(!0))}),()=>bt.cancel(r)},[r,p,be,ve,l]),(0,F.useEffect)(()=>{p.current!==null&&ye()},[ye,he,p]),(0,F.useEffect)(()=>()=>{p.current?.destroy(),p.current=null},[p]);let[we,Te]=na({rootMargin:`300px 0px`,threshold:0});(0,F.useEffect)(()=>{Se||(Te?.isIntersecting?bt.prioritize(r):bt.deprioritize(r))},[Se,Te?.isIntersecting,r]);let Ee=yb(r,p),De=``;return oe&&g&&v?De=`h-0 overflow-hidden`:g&&(De=`opacity-20 h-8 [&>div.cm-editor]:h-full [&>div.cm-editor]:overflow-hidden [&_.cm-panels]:hidden`),(0,L.jsx)(Ly,{cellId:r,aiCompletionCell:T,currentCode:p.current?.state.doc.toString()??o,currentLanguageAdapter:x,declineChange:c(()=>{E(null),p.current?.focus()}),onChange:c(e=>{p.current?.dispatch({changes:{from:0,to:p.current.state.doc.length,insert:e}})}),acceptChange:c(e=>{p.current?.dispatch({changes:{from:0,to:p.current.state.doc.length,insert:e}}),p.current?.focus(),E(null)}),runCell:ce,outputArea:ee,children:(0,L.jsxs)(`div`,{className:`relative w-full`,ref:we,...Ee,children:[Se?(0,L.jsx)(Mb,{className:De,editorView:p.current,ref:h,hidden:g,showHiddenCode:b}):(0,L.jsx)(Eb,{code:o,className:De}),!g&&C&&(0,L.jsx)(`div`,{className:`absolute top-1 right-5`,children:(0,L.jsx)(Ob,{code:o,editorView:p.current,currentLanguageAdapter:x,onAfterToggle:fe})})]})})},Mb=F.forwardRef((e,t)=>{let n=(0,I.c)(14),{className:r,editorView:i,hidden:a,showHiddenCode:o}=e,s=(0,F.useRef)(null),c,l;n[0]===i?(c=n[1],l=n[2]):(c=()=>{i!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(i.dom)},l=[i,s],n[0]=i,n[1]=c,n[2]=l),(0,F.useEffect)(c,l);let u;n[3]===r?u=n[4]:(u=wn(`cm mathjax_ignore`,r),n[3]=r,n[4]=u);let d;n[5]!==a||n[6]!==o?(d=e=>{a&&o&&(e.stopPropagation(),o({focus:!0}))},n[5]=a,n[6]=o,n[7]=d):d=n[7];let f;n[8]===t?f=n[9]:(f=e=>{t?yy(t,s)(e):yy(s)(e)},n[8]=t,n[9]=f);let p;return n[10]!==u||n[11]!==d||n[12]!==f?(p=(0,L.jsx)(`div`,{className:u,onDoubleClick:d,ref:f,"data-testid":`cell-editor`}),n[10]=u,n[11]=d,n[12]=f,n[13]=p):p=n[13],p});Mb.displayName=`CellCodeMirrorEditor`;function Nb(e){let n=n=>{let r=(0,I.c)(5),a=i(hn),[o,s]=t(Nv);if(xe()&&Ge(n.id)&&(vn(a.state)||o===void 0)){let e;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`Waiting for real-time collaboration connection...`}),r[0]=e):e=r[0];let t;return r[1]===s?t=r[2]:(t=(0,L.jsx)(`div`,{className:`flex h-full w-full items-baseline p-4`,children:(0,L.jsxs)(da,{milliseconds:1e3,fallback:null,children:[e,(0,L.jsx)(kn,{variant:`link`,onClick:()=>{s(`disabled`)},children:`Turn off real-time collaboration`})]})}),r[1]=s,r[2]=t),t}let c;return r[3]===n?c=r[4]:(c=(0,L.jsx)(e,{...n}),r[3]=n,r[4]=c),c};return n.displayName=`WithWaitUntilConnected(${e.displayName})`,n}var Pb=xe()?Nb((0,F.memo)(jb)):(0,F.memo)(jb),Fb=200;function Ib(e){let t=(0,I.c)(3),[n,r]=(0,F.useState)(!1),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;r(!1);let t=setTimeout(()=>{r(!0)},Fb);return()=>clearTimeout(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,F.useEffect)(i,a),e&&n}var Lb=Cn(`rounded-full shadow-xs-solid border p-[5px] transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>svg]:size-3 active:shadow-none bg-background`,{variants:{variant:{default:`hover:bg-accent hover:text-accent-foreground`,stale:`bg-(--yellow-3) hover:bg-(--yellow-4) text-(--yellow-11)`,green:`hover:bg-(--grass-2) hover:text-(--grass-11) hover:border-[var(--grass-7)],`,disabled:`opacity-50 cursor-not-allowed`,danger:`hover:bg-(--red-3) hover:text-(--red-11)`}},defaultVariants:{variant:`default`}}),Rb=e=>{let t=(0,I.c)(22),n,r,i,a,o,s,c,l,u;if(t[0]!==e){let{children:d,tooltip:f,disabled:p,variant:m,...h}=e;n=d,u=f;let g=p!==void 0&&p;r=`button`,i=g,a=h,o=e=>{!On.hasModifier(e)&&(e.key===`Enter`||e.key===` `)&&e.stopPropagation(),h.onKeyDown?.(e)},s=e=>{g||h.onClick?.(e)},c=On.preventFocus,l=wn(Lb({variant:m}),h.className),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9];let d;t[10]!==n||t[11]!==r||t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==c||t[17]!==l?(d=(0,L.jsx)(`button`,{type:r,disabled:i,...a,onKeyDown:o,onClick:s,onMouseDown:c,className:l,children:n}),t[10]=n,t[11]=r,t[12]=i,t[13]=a,t[14]=o,t[15]=s,t[16]=c,t[17]=l,t[18]=d):d=t[18];let f=d;if(u){let e;return t[19]!==f||t[20]!==u?(e=(0,L.jsx)(Dn,{content:u,side:`top`,delayDuration:200,usePortal:!1,children:f}),t[19]=f,t[20]=u,t[21]=e):e=t[21],e}return f},zb=e=>{let t=(0,I.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=wn(`flex items-center gap-1 bg-background m-[2px] rounded-full`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,L.jsx)(Ja,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},Bb=e=>{let t=(0,I.c)(9),{connectionState:n,status:r}=e,{sendInterrupt:i}=Ui(),a=Ib(r===`running`),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=ra(`global.interrupt`),t[0]=o):o=t[0];let s;t[1]!==n||t[2]!==a?(s=gn(n)||!a,t[1]=n,t[2]=a,t[3]=s):s=t[3];let c=a?i:tn.NOOP,l=a?`stale`:`disabled`,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,L.jsx)(Oa,{strokeWidth:1.5}),t[4]=u):u=t[4];let d;return t[5]!==s||t[6]!==c||t[7]!==l?(d=(0,L.jsx)(Rb,{tooltip:o,disabled:s,onClick:c,variant:l,"data-testid":`run-button`,children:u}),t[5]=s,t[6]=c,t[7]=l,t[8]=d):d=t[8],d};function Vb(e){let t=(0,F.useRef)(e),[n,r]=(0,F.useState)(e);return(0,F.useEffect)(()=>{let e=setInterval(()=>{r(gt.now().toMilliseconds())},17);return()=>clearInterval(e)},[]),n-t.current}var Hb=e=>{let t=(0,I.c)(79),{editing:n,status:r,disabled:i,staleInputs:a,edited:o,interrupted:s,elapsedTime:c,runStartTimestamp:l,lastRunStartTimestamp:u,uninstantiated:d}=e;if(!n)return null;let f=l??u,p;t[0]===f?p=t[1]:(p=f?(0,L.jsx)(Wb,{lastRanTime:f}):null,t[0]=f,t[1]=p);let m=p;if(i&&r===`running`)return rn.error(`CellStatusComponent: disabled and running`),null;if(i&&a){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is stale, but it's disabled and can't be run`}),t[2]=e):e=t[2];let n;t[3]===m?n=t[4]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[3]=m,t[4]=n);let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-stale`,"data-testid":`cell-status`,"data-status":`stale`,children:(0,L.jsxs)(Kc,{children:[(0,L.jsx)(Jn,{className:`h-5 w-5`,strokeWidth:1.5}),(0,L.jsx)(Ta,{className:`h-3 w-3`,strokeWidth:2.5})]})}),t[5]=r):r=t[5];let i;return t[6]===n?i=t[7]:(i=(0,L.jsx)(Dn,{content:n,usePortal:!0,children:r}),t[6]=n,t[7]=i),i}if(i){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is disabled`}),t[8]=e):e=t[8];let n;t[9]===m?n=t[10]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[9]=m,t[10]=n);let r;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-disabled`,"data-testid":`cell-status`,"data-status":`disabled`,children:(0,L.jsx)(Jn,{className:`h-5 w-5`,strokeWidth:1.5})}),t[11]=r):r=t[11];let i;return t[12]===n?i=t[13]:(i=(0,L.jsx)(Dn,{content:n,usePortal:!0,children:r}),t[12]=n,t[13]=i),i}if(!a&&r===`disabled-transitively`){let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`An ancestor of this cell is disabled, so it can't be run`}),t[14]=e):e=t[14];let n;t[15]===m?n=t[16]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[15]=m,t[16]=n);let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-stale`,"data-testid":`cell-status`,"data-status":`disabled-transitively`,children:(0,L.jsxs)(Kc,{layerTop:!0,children:[(0,L.jsx)(Ga,{className:`h-5 w-5`,strokeWidth:1.5}),(0,L.jsx)(Jn,{className:`h-3 w-3`,strokeWidth:2.5})]})}),t[17]=r):r=t[17];let i;return t[18]===n?i=t[19]:(i=(0,L.jsx)(Dn,{content:n,usePortal:!0,children:r}),t[18]=n,t[19]=i),i}if(a&&r===`disabled-transitively`){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is stale, but an ancestor is disabled so it can't be run`}),t[20]=e):e=t[20];let n;t[21]===m?n=t[22]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[21]=m,t[22]=n);let r;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-stale`,"data-testid":`cell-status`,"data-status":`stale`,children:(0,L.jsxs)(Kc,{children:[(0,L.jsx)(Ta,{className:`h-5 w-5`,strokeWidth:1}),(0,L.jsx)(Jn,{className:`h-3 w-3`,strokeWidth:2.5})]})}),t[23]=r):r=t[23];let i;return t[24]===n?i=t[25]:(i=(0,L.jsx)(Dn,{content:n,usePortal:!0,children:r}),t[24]=n,t[25]=i),i}if(r===`running`){let e;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is running`}),t[26]=e):e=t[26];let n;t[27]===m?n=t[28]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[27]=m,t[28]=n);let r;t[29]===l?r=t[30]:(r=gt.fromSeconds(l)||gt.now(),t[29]=l,t[30]=r);let i;t[31]===r?i=t[32]:(i=(0,L.jsx)(`div`,{className:`cell-status-icon elapsed-time running`,"data-testid":`cell-status`,"data-status":`running`,children:(0,L.jsx)(Gb,{startTime:r})}),t[31]=r,t[32]=i);let a;return t[33]!==n||t[34]!==i?(a=(0,L.jsx)(Dn,{content:n,usePortal:!0,children:i}),t[33]=n,t[34]=i,t[35]=a):a=t[35],a}if(r===`queued`){let e;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is queued to run`}),t[36]=e):e=t[36];let n;t[37]===m?n=t[38]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[37]=m,t[38]=n);let r;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-queued`,"data-testid":`cell-status`,"data-status":`queued`,children:(0,L.jsx)(Sa,{className:`h-5 w-5`,strokeWidth:1.5})}),t[39]=r):r=t[39];let i;return t[40]===n?i=t[41]:(i=(0,L.jsx)(Dn,{content:n,usePortal:!0,children:r}),t[40]=n,t[41]=i),i}if(o||s||a||d){let e;t[42]===c?e=t[43]:(e=je(c),t[42]=c,t[43]=e);let n=e,r;t[44]!==c||t[45]!==n?(r=c?(0,L.jsx)(Ub,{elapsedTime:n}):null,t[44]=c,t[45]=n,t[46]=r):r=t[46];let i=r,a,l=``;if(d)a=`This cell has not yet been run`;else if(s){a=`This cell was interrupted when it was last run`;let e;t[47]===i?e=t[48]:(e=(0,L.jsxs)(`span`,{children:[`This cell ran for `,i,` before being interrupted`]}),t[47]=i,t[48]=e),l=e}else if(o){a=`This cell has been modified since it was last run`;let e;t[49]===i?e=t[50]:(e=(0,L.jsxs)(`span`,{children:[`This cell took `,i,` to run`]}),t[49]=i,t[50]=e),l=e}else{a=`This cell has not been run with the latest inputs`;let e;t[51]===i?e=t[52]:(e=(0,L.jsxs)(`span`,{children:[`This cell took `,i,` to run`]}),t[51]=i,t[52]=e),l=e}let u;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,L.jsx)(`div`,{className:`cell-status-stale`,"data-testid":`cell-status`,"data-status":`outdated`,children:(0,L.jsx)(Ta,{className:`h-5 w-5`,strokeWidth:1.5})}),t[53]=u):u=t[53];let f;t[54]===a?f=t[55]:(f=(0,L.jsx)(Dn,{content:a,usePortal:!0,children:u}),t[54]=a,t[55]=f);let p;t[56]!==c||t[57]!==n||t[58]!==m||t[59]!==l?(p=c&&(0,L.jsx)(Dn,{content:(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[l,m]}),usePortal:!0,children:(0,L.jsx)(`div`,{className:`elapsed-time hover-action`,"data-testid":`cell-status`,"data-status":`outdated`,children:(0,L.jsx)(`span`,{children:n})})}),t[56]=c,t[57]=n,t[58]=m,t[59]=l,t[60]=p):p=t[60];let h;return t[61]!==f||t[62]!==p?(h=(0,L.jsxs)(`div`,{className:`cell-status-icon flex items-center gap-2`,children:[f,p]}),t[61]=f,t[62]=p,t[63]=h):h=t[63],h}if(c!==null){let e;t[64]===c?e=t[65]:(e=je(c),t[64]=c,t[65]=e);let n=e,r;t[66]!==c||t[67]!==n?(r=c?(0,L.jsx)(Ub,{elapsedTime:n}):null,t[66]=c,t[67]=n,t[68]=r):r=t[68];let i=r,a;t[69]===i?a=t[70]:(a=(0,L.jsxs)(`span`,{children:[`This cell took `,i,` to run`]}),t[69]=i,t[70]=a);let o;t[71]!==m||t[72]!==a?(o=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[a,m]}),t[71]=m,t[72]=a,t[73]=o):o=t[73];let s;t[74]===n?s=t[75]:(s=(0,L.jsx)(`div`,{className:`cell-status-icon elapsed-time hover-action`,"data-testid":`cell-status`,"data-status":`idle`,children:(0,L.jsx)(`span`,{children:n})}),t[74]=n,t[75]=s);let l;return t[76]!==o||t[77]!==s?(l=(0,L.jsx)(Dn,{content:o,usePortal:!0,children:s}),t[76]=o,t[77]=s,t[78]=l):l=t[78],l}return null},Ub=e=>{let t=(0,I.c)(2),n;return t[0]===e.elapsedTime?n=t[1]:(n=(0,L.jsx)(`span`,{className:`tracking-wide font-semibold`,children:e.elapsedTime}),t[0]=e.elapsedTime,t[1]=n),n},Wb=e=>{let t=(0,I.c)(4),n=new Date(e.lastRanTime*1e3),r=new Date,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={hour:`numeric`,minute:`numeric`,second:`numeric`,fractionalSecondDigits:3,hour12:!0},t[0]=i):i=t[0];let a=ma(i),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o={month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,fractionalSecondDigits:3,hour12:!0},t[1]=o):o=t[1];let s=ma(o),c=n.toDateString()===r.toDateString()?a:s,l=oo(n),u;return t[2]===l?u=t[3]:(u=(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,l,` ago)`]}),t[2]=l,t[3]=u),(0,L.jsxs)(`span`,{children:[`Ran at`,` `,(0,L.jsx)(`strong`,{className:`tracking-wide font-semibold`,children:c.format(n)}),` `,u]})},Gb=e=>{let t=(0,I.c)(6),n;t[0]===e.startTime?n=t[1]:(n=e.startTime.toMilliseconds(),t[0]=e.startTime,t[1]=n);let r=Vb(n),i;t[2]===r?i=t[3]:(i=je(r),t[2]=r,t[3]=i);let a;return t[4]===i?a=t[5]:(a=(0,L.jsx)(`span`,{children:i}),t[4]=i,t[5]=a),a};function Kb({connectionState:e,needsRun:t,loading:n,inactive:r}){return gn(e)?`disabled`:t&&!n?`stale`:n||r?`disabled`:`green`}var qb=e=>{let t=(0,I.c)(27),{onClick:n,connectionState:r,needsRun:i,status:a,config:o,edited:s}=e,c=a===`disabled-transitively`,l=a===`running`||a===`queued`,u,d;t[0]!==c||t[1]!==o.disabled||t[2]!==r||t[3]!==s||t[4]!==l||t[5]!==i?(u=gn(r)||l||!o.disabled&&c&&!s,d=Kb({connectionState:r,needsRun:i,loading:l,inactive:u}),t[0]=c,t[1]=o.disabled,t[2]=r,t[3]=s,t[4]=l,t[5]=i,t[6]=u,t[7]=d):(u=t[6],d=t[7]);let f=d;if(o.disabled){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(Ha,{}),t[8]=e):e=t[8];let r;return t[9]!==u||t[10]!==n||t[11]!==f?(r=(0,L.jsx)(Rb,{tooltip:`Add code to notebook`,disabled:u,onClick:n,variant:f,"data-testid":`run-button`,children:e}),t[9]=u,t[10]=n,t[11]=f,t[12]=r):r=t[12],r}if(!o.disabled&&c&&!s){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(dr,{strokeWidth:1.2}),t[13]=e):e=t[13];let r;return t[14]!==u||t[15]!==n||t[16]!==f?(r=(0,L.jsx)(Rb,{disabled:u,tooltip:`This cell can't be run because it has a disabled ancestor`,onClick:n,variant:f,"data-testid":`run-button`,children:e}),t[14]=u,t[15]=n,t[16]=f,t[17]=r):r=t[17],r}let p;if(gn(r)){let e;t[18]===r?e=t[19]:(e=bn(r),t[18]=r,t[19]=e),p=e}else if(a===`queued`)p=`This cell is already queued to run`;else if(a===`running`)p=`This cell is already running.`;else{let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=ra(`cell.run`),t[20]=e):e=t[20],p=e}let m;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,L.jsx)(dr,{strokeWidth:1.2}),t[21]=m):m=t[21];let h;return t[22]!==u||t[23]!==n||t[24]!==p||t[25]!==f?(h=(0,L.jsx)(Rb,{tooltip:p,disabled:u,onClick:n,variant:f,"data-testid":`run-button`,children:m}),t[22]=u,t[23]=n,t[24]=p,t[25]=f,t[26]=h):h=t[26],h};export{Zc as A,Ua as B,_m as C,dm as D,pm as E,Wc as F,Gc as I,Fs as L,Yc as M,qc as N,rl as O,Kc as P,Ga as R,Nv as S,fm as T,Ba as V,uy as _,zb as a,ey as b,Pb as c,sb as d,ab as f,ly as g,yy as h,Bb as i,Xc as j,nl as k,Ob as l,eb as m,Hb as n,Rb as o,nb as p,Ub as r,Ib as s,qb as t,_b as u,ny as v,gm as w,Hv as x,ty as y,Wa as z};
21
+ `)}async function Hy(e){let t={cells:e.map(e=>({code:e.code,name:e.name,config:e.config})),version:`1.0`},n=new Jy().add(zy,t).add(`text/plain`,Vy(e)).build();await navigator.clipboard.write([n])}function Uy(){let e=(0,I.c)(13),t=y(),n=Pe(),r=nt(),i;e[0]===n?i=e[1]:(i=async e=>{let t=Ve(),r=e.map(e=>t.cellData[e]).filter(Boolean);if(r.length!==0)try{await Hy(r),n.clear(),Wy(r.length)}catch(e){let t=e;rn.error(`Failed to copy cells to clipboard`,t);try{await jr(Vy(r)),n.clear(),Wy(r.length)}catch{Gy()}}},e[0]=n,e[1]=i);let a=c(i),o;e[2]===n?o=e[3]:(o=async e=>{let t=Ve(),r=e.filter(e=>t.cellData[e]),i=r.map(e=>t.cellData[e]);if(i.length!==0)try{await Hy(i),n.markForCut({cellIds:r})}catch(e){let t=e;rn.error(`Failed to cut cells to clipboard`,t);try{await jr(Vy(i)),n.markForCut({cellIds:r})}catch{Gy()}}},e[2]=n,e[3]=o);let s=c(o),l;e[4]!==t||e[5]!==n||e[6]!==r.cellIds?(l=async(e,i)=>{let{before:a}=i??{},o=a!==void 0&&a;if(r.cellIds.size>0){let i=[...r.cellIds],a=Ve(),s=i.map(e=>{let t=a.cellIds.findWithId(e);return{columnId:t.id,index:t.indexOfOrThrow(e)}});t.moveCellsRelativeTo({cellIds:i,targetCellId:e,position:o?`before`:`after`,previousPlacements:s}),n.clear();return}try{let n=await navigator.clipboard.read();for(let r of n)if(r.types.includes(zy)){let n=await(await r.getType(zy)).text();try{let r=By.parse(JSON.parse(n));if(r.cells.length===0)break;let i=e,a=r.cells.toReversed();for(let e of a)t.createNewCell({cellId:i,before:o,code:e.code,name:e.name,config:e.config,hideCode:e.config?.hide_code,autoFocus:!0});return}catch(e){let t=e;rn.warn(`Failed to parse clipboard cell data`,t)}}let r=await navigator.clipboard.readText();r.trim()?t.createNewCell({cellId:e,before:o,code:r,autoFocus:!0}):Ky()}catch(e){let t=e;rn.error(`Failed to paste from clipboard`,t),qy()}},e[4]=t,e[5]=n,e[6]=r.cellIds,e[7]=l):l=e[7];let u=c(l),d;return e[8]!==a||e[9]!==s||e[10]!==u||e[11]!==n.clear?(d={copyCells:a,cutCells:s,pasteAtCell:u,clearPendingCut:n.clear},e[8]=a,e[9]=s,e[10]=u,e[11]=n.clear,e[12]=d):d=e[12],d}var Wy=e=>{let t=e===1?`Cell`:`${e} cells`;Mr({title:`${t} copied`,description:`${t} ${e===1?`has`:`have`} been copied to clipboard.`})},Gy=()=>{Mr({title:`Copy failed`,description:`Failed to copy cells to clipboard.`,variant:`danger`})},Ky=()=>{Mr({title:`Nothing to paste`,description:`No cell or text found in clipboard.`,variant:`danger`})},qy=()=>{Mr({title:`Paste failed`,description:`Failed to read from clipboard`,variant:`danger`})},Jy=class{items={};add(e,t){return ClipboardItem.supports(e)?typeof t==`string`?(this.items[e]=new Blob([t],{type:e}),this):(this.items[e]=new Blob([JSON.stringify(t)],{type:e}),this):(rn.warn(`ClipboardItem does not support ${e}`),this)}build(){return new ClipboardItem(this.items)}};function Yy(){return{selectionStart:null,selectionEnd:null,selected:new Set}}var{reducer:Xy,createActions:Zy,valueAtom:Qy,useActions:$y}=Ni(Yy,{select:(e,t)=>({selectionStart:t.cellId,selectionEnd:t.cellId,selected:new Set([t.cellId])}),extend:(e,t)=>{if(!e.selectionStart)return{selectionStart:t.cellId,selectionEnd:t.cellId,selected:new Set([t.cellId])};let{cellId:n,allCellIds:r}=t;try{let t=r.findWithId(e.selectionStart),i=t.indexOfOrThrow(e.selectionStart),a=t.indexOfOrThrow(n),[o,s]=i<a?[i,a]:[a,i],c=t.slice(o,s+1);return{selectionStart:e.selectionStart,selectionEnd:n,selected:new Set(c)}}catch{return{selectionStart:n,selectionEnd:n,selected:new Set([n])}}},clear:e=>e.selected.size===0?e:Yy()}),eb=()=>i(Qy);function tb(e){let t=(0,I.c)(2),n;return t[0]===e?n=t[1]:(n=r(t=>t(Qy).selected.has(e)),t[0]=e,t[1]=n),i(n)}function nb(){return $y()}function rb(e){return e.get(Qy).selected}var{valueAtom:ib,useActions:ab}=Ni(()=>new Set,{add:(e,t)=>{if(e.has(t))return e;let n=new Set(e);return n.add(t),n},remove:(e,t)=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),ee(()=>{let e=document.activeElement;if(!e)return;let t=wt.findElementThroughShadowDOMs(e);t&&le(wt.parse(t.id))}),n}}),ob=e=>r(t=>t(ib).has(e));function sb(e){let t=(0,I.c)(2),n;return t[0]===e?n=t[1]:(n=ob(e),t[0]=e,t[1]=n),i(n)}var cb=new WeakMap,lb=500;function ub(e){if(e.ctrlKey||e.metaKey||e.altKey)return``;let t=e.key.toLowerCase();return e.shiftKey?`shift+${t}`:t}function db(e,t){let n=ub(e),r=e.target;if(!n||!r)return!1;let i=cb.get(r),a=n;i?.timeout&&clearTimeout(i.timeout),i&&(a=`${i.sequence} ${n}`);let o=t[a];if(o)return cb.delete(r),o();if(!i){let e=t[n];if(e)return e()}if(Object.keys(t).some(e=>e.startsWith(`${a} `))){let e=window.setTimeout(()=>{cb.delete(r)},lb);return cb.set(r,{sequence:a,timeout:e}),!0}return cb.delete(r),!1}function fb(e){return{handle:t=>e(t),bulkHandle:t=>{let n=!0;try{for(let r of t)n&&=e(r);return n}catch{return!1}}}}function pb(e){return{handle:t=>e([t]),bulkHandle:t=>e(t)}}function mb(e,t){let n=(0,I.c)(12),r=T(),i=y(),a=ab(),o;n[0]!==e||n[1]!==r?(o=()=>{r.focusCell({cellId:e})},n[0]=e,n[1]=r,n[2]=o):o=n[2];let s;n[3]!==i||n[4]!==e||n[5]!==t||n[6]!==r||n[7]!==a?(s=n=>{hb(n.relatedTarget)||hb(n.target)||gb(n.relatedTarget)!==e&&gb(n.relatedTarget?.closest(`[data-for-cell-id]`))!==e&&(a.remove(e),i.markTouched({cellId:e}),r.blurCell(),t.current&&xb(t.current))},n[3]=i,n[4]=e,n[5]=t,n[6]=r,n[7]=a,n[8]=s):s=n[8];let c;n[9]!==o||n[10]!==s?(c={onFocusWithin:o,onBlurWithin:s},n[9]=o,n[10]=s,n[11]=c):c=n[11];let{focusWithinProps:l}=wr(c);return l}function hb(e){return e?e instanceof HTMLElement&&e.closest(`.cm-vim-panel`)!==null:!1}function gb(e){return e&&e.getAttribute(ne)||null}function _b(e,t){let r=(0,I.c)(34),{canMoveX:a,editorView:o,cellActionDropdownRef:s}=t,{saveOrNameNotebook:c}=uy(),{saveCellConfig:u}=Wi(),d=l(oa),f=y(),p=n(),h=ab(),g=na(),_=i(zt),{copyCells:v,pasteAtCell:b,cutCells:x}=Uy(),S=nb(),C=tb(e),w=nl(),ee=hr(),te=i(Rt),T;r[0]===te?T=r[1]:(T=Ht(te),r[0]=te,r[1]=T);let E=T,ne;r[2]!==w||r[3]!==S?(ne={clear:()=>{w.clear(),S.clear()},extend:e=>{w.clear(),S.extend(e)},select:e=>{w.clear(),S.select(e)}},r[2]=w,r[3]=S,r[4]=ne):ne=r[4];let D=ne,re=i(Ut),ie;r[5]===re?ie=r[6]:(ie=(e,t)=>an(re.getHotkey(e).key)(t.nativeEvent||t),r[5]=re,r[6]=ie);let ae=ie,O=mb(e,o),k;r[7]!==f||r[8]!==E||r[9]!==a||r[10]!==s||r[11]!==e||r[12]!==v||r[13]!==x||r[14]!==ee||r[15]!==o||r[16]!==C||r[17]!==ae||r[18]!==_||r[19]!==b||r[20]!==w||r[21]!==g||r[22]!==u||r[23]!==c||r[24]!==D||r[25]!==d||r[26]!==p||r[27]!==h||r[28]!==te?(k={onKeyDown:t=>{if(kn.fromInput(t)){t.continuePropagation();return}let n={"Mod+ArrowUp":()=>(f.focusTopCell(),D.clear(),!0),"Mod+ArrowDown":()=>(f.focusBottomCell(),D.clear(),!0),ArrowUp:()=>(f.focusCell({cellId:e,where:`before`}),D.clear(),!0),ArrowDown:()=>(f.focusCell({cellId:e,where:`after`}),D.clear(),!0),ArrowLeft:()=>{if(a){let t=p.get(Se),n=t.cellIds.findWithId(e),r=t.cellIds.indexOf(n),i=t.cellIds.at(r-1);if(i&&i.length>0){let t=bb(e,i);return f.focusCell({cellId:t,where:`exact`}),D.clear(),!0}}return!1},ArrowRight:()=>{if(a){let t=p.get(Se),n=t.cellIds.findWithId(e),r=t.cellIds.indexOf(n),i=t.cellIds.at(r+1);if(i&&i.length>0){let t=bb(e,i);return f.focusCell({cellId:t,where:`exact`}),D.clear(),!0}}return!1},"Shift+ArrowUp":()=>{let t=p.get(We);D.extend({cellId:e,allCellIds:t});let n=t.findWithId(e).before(e);return n&&D.extend({cellId:n,allCellIds:t}),f.focusCell({cellId:e,where:`before`}),!0},"Shift+ArrowDown":()=>{let t=p.get(We);D.extend({cellId:e,allCellIds:t});let n=t.findWithId(e).after(e);return n&&D.extend({cellId:n,allCellIds:t}),f.focusCell({cellId:e,where:`after`}),!0},Escape:()=>p.get(mt).size>0?(p.set(Je),!0):C?(D.clear(),!0):!1,Enter:()=>(h.add(e),de(p,e),D.clear(),!0),s:()=>(c(),!0)};for(let[e,r]of Object.entries(n))if(an(e)(t)&&r()){t.preventDefault();return}let r={"cell.run":pb(e=>(g(e),!0)),"cell.runAndNewBelow":pb(e=>{g(e);let t=e[e.length-1];return f.moveToNextCell({cellId:t,before:!1}),!0}),"cell.runAndNewAbove":pb(e=>{g(e);let t=e[0];return f.moveToNextCell({cellId:t,before:!0}),!0}),"cell.createAbove":e=>(f.createNewCell({cellId:e,before:!0}),!0),"cell.createBelow":e=>(f.createNewCell({cellId:e,before:!1}),!0),"cell.moveUp":pb(e=>{let t=e[0];return p.get(Se).cellIds.findWithId(t).first()!==t&&(e.forEach(e=>{f.moveCell({cellId:e,before:!0})}),!0)}),"cell.moveDown":pb(e=>{let t=e[e.length-1];return p.get(Se).cellIds.findWithId(t).last()!==t&&(e.toReversed().forEach(e=>{f.moveCell({cellId:e,before:!1})}),!0)}),"cell.moveLeft":fb(e=>a?(f.moveCell({cellId:e,direction:`left`}),!0):!1),"cell.moveRight":fb(e=>a?(f.moveCell({cellId:e,direction:`right`}),!0):!1),"cell.hideCode":pb(e=>{let t=!e.map(e=>p.get(Se).cellData[e]?.config||null).every(vb);u({configs:Object.fromEntries(e.map(e=>[e,{hide_code:t}]))});for(let n of e)f.updateCellConfig({cellId:n,config:{hide_code:t}});if(e.length===1){let n=e[0];f.focusCell({cellId:n,where:`after`}),t?(o.current?.contentDOM.blur(),se(n)):de(p,n)}return!0}),"cell.focusDown":e=>(f.focusCell({cellId:e,where:`after`}),!0),"cell.focusUp":e=>(f.focusCell({cellId:e,where:`before`}),!0),"cell.sendToBottom":pb(e=>(e.forEach(e=>{f.sendToBottom({cellId:e})}),!0)),"cell.sendToTop":pb(e=>(e.toReversed().forEach(e=>{f.sendToTop({cellId:e})}),!0)),"cell.aiCompletion":e=>{if(!E)return!1;let t=!1;return d(n=>n?.cellId===e?(t=!0,null):{cellId:e}),t&&o.current?.focus(),!0},"cell.cellActions":()=>(s.current?.toggle(),!0),"command.copyCell":pb(e=>(v(e),!0)),"command.cutCell":pb(e=>(x(e),!0)),"command.pasteCell":e=>(b(e),!0),"command.createCellBefore":e=>!kn.hasModifier(t)&&(f.createNewCell({cellId:e,before:!0,autoFocus:!0}),!0),"command.createCellAfter":e=>!kn.hasModifier(t)&&(f.createNewCell({cellId:e,before:!1,autoFocus:!0}),!0),"command.createSqlCellAfter":e=>!kn.hasModifier(t)&&(m({autoInstantiate:!0,createNewCell:f.createNewCell,fromCellId:e,before:!0}),f.createNewCell({cellId:e,before:!1,autoFocus:!0,code:ue.sql.defaultCode}),!0),"cell.delete":()=>{if(!te.keymap.destructive_delete)return!1;let t=i.size>=2?[...i]:[e],n=p.get(Se);return t.some(e=>{let{status:t}=n.cellRuntime[e];return t===`running`||t===`queued`})?!1:w.idle?(w.submit(t),!0):(ee({cellIds:t}),w.clear(),!0)}},i=rb(p);if(_===`vim`&&db(t.nativeEvent||t,{j:n.ArrowDown,k:n.ArrowUp,h:n.ArrowLeft,l:n.ArrowRight,i:n.Enter,"shift+j":n[`Shift+ArrowDown`],"shift+k":n[`Shift+ArrowUp`],"g g":n[`Mod+ArrowUp`],"shift+g":n[`Mod+ArrowDown`],"d d":()=>r[`cell.delete`](),"y y":()=>(v(i.size>=2?[...i]:[e]),!0),p:()=>(b(e,{before:!1}),!0),"shift+p":()=>(b(e,{before:!0}),!0),o:()=>(f.createNewCell({cellId:e,before:!1,autoFocus:!0}),!0),"shift+o":()=>(f.createNewCell({cellId:e,before:!0,autoFocus:!0}),!0),u:()=>(f.undoDeleteCell(),!0)})){t.preventDefault();return}for(let[n,a]of Object.entries(r))if(ae(n,t)){if(typeof a==`function`){if(a(e)){t.preventDefault();return}}else if(i.size>=2?a.bulkHandle([...i]):a.handle(e)){t.preventDefault();return}return}t.continuePropagation()}},r[7]=f,r[8]=E,r[9]=a,r[10]=s,r[11]=e,r[12]=v,r[13]=x,r[14]=ee,r[15]=o,r[16]=C,r[17]=ae,r[18]=_,r[19]=b,r[20]=w,r[21]=g,r[22]=u,r[23]=c,r[24]=D,r[25]=d,r[26]=p,r[27]=h,r[28]=te,r[29]=k):k=r[29];let{keyboardProps:oe}=xr(k),ce;return r[30]!==O||r[31]!==C||r[32]!==oe?(ce=kr(O,oe,{"data-selected":C,className:`data-[selected=true]:ring-1 data-[selected=true]:ring-(--blue-8) data-[selected=true]:ring-offset-1`}),r[30]=O,r[31]=C,r[32]=oe,r[33]=ce):ce=r[33],ce}function vb(e){return e?.hide_code}function yb(e,t){let n=(0,I.c)(12),r=ab(),a=i(zt),o=i(Ut),s;if(n[0]!==o){let e=o.getHotkey(`command.vimEnterCommandMode`);s=an(e.key),n[0]=o,n[1]=s}else s=n[1];let c=s,l;n[2]!==e||n[3]!==r?(l=()=>{r.remove(e),se(e),ee(()=>{le(e)})},n[2]=e,n[3]=r,n[4]=l):l=n[4];let u=l,d;n[5]!==t||n[6]!==u?(d=()=>{if(!t.current){u();return}let e=t.current,n=e.state;if(Ci(e))return;let r=!!n.field(St,!1)||!!n.field(ke,!1),i=zi(n)!==null;r&&xb(e),i&&Vi(e),!(r||i)&&u()},n[5]=t,n[6]=u,n[7]=d):d=n[7];let f=d,p;n[8]!==f||n[9]!==a||n[10]!==c?(p={onKeyDown:e=>{a===`vim`?c(e)&&f():e.key===`Escape`&&f(),e.continuePropagation()}},n[8]=f,n[9]=a,n[10]=c,n[11]=p):p=n[11];let{keyboardProps:m}=xr(p);return m}function bb(e,t){let n=document.getElementById(wt.create(e));if(!n)return t.first();let r=n.getBoundingClientRect();for(let e of t.topLevelIds){let t=document.getElementById(wt.create(e));if(t){let n=t.getBoundingClientRect();if(r.top<=n.bottom&&r.bottom>=n.top)return e}}return t.last()}function xb(e){e.state.field(St,!1)&&e.dispatch({effects:Ce.of(null)}),lt(e)}var Sb=50,Cb=4,wb=60;function Tb(e){return Math.min(wb,Math.max(Cb,e))}var Eb=e=>{let t=(0,I.c)(13),{code:n,className:r}=e,i,a,o,s;if(t[0]!==r||t[1]!==n){let e=n.split(`
22
+ `,Sb);t[6]===r?i=t[7]:(i=Tn(`cm`,`mo-code-placeholder`,r),t[6]=r,t[7]=i),a=`cell-editor-placeholder`,o=!0,s=e.map(Db),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s}else i=t[2],a=t[3],o=t[4],s=t[5];let c;return t[8]!==i||t[9]!==a||t[10]!==o||t[11]!==s?(c=(0,L.jsx)(`div`,{className:i,"data-testid":a,"aria-hidden":o,children:s}),t[8]=i,t[9]=a,t[10]=o,t[11]=s,t[12]=c):c=t[12],c};function Db(e,t){let n=e.trimEnd().length;return(0,L.jsx)(`div`,{className:`mo-code-placeholder-line`,children:n>0&&(0,L.jsx)(Ia,{className:`mo-code-placeholder-bar`,style:{width:`${Tb(n)}ch`}})},t)}var Ob=e=>{let t=(0,I.c)(25),{editorView:n,code:r,currentLanguageAdapter:i,onAfterToggle:a,className:o}=e,s=o===void 0?`absolute right-3 top-2 z-20 flex hover-action gap-1`:o,c;t[0]===r?c=t[1]:(c=ue.markdown.isSupported(r)||r.trim()===``,t[0]=r,t[1]=c);let l=c,u;t[2]===r?u=t[3]:(u=ue.sql.isSupported(r)||r.trim()===``,t[2]=r,t[3]=u);let d=u&&i===`python`,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,L.jsx)(Mn,{color:`var(--sky-11)`,strokeWidth:2.5,className:`w-4 h-4`}),t[4]=f):f=t[4];let p;t[5]!==i||t[6]!==n||t[7]!==a||t[8]!==d?(p=(0,L.jsx)(kb,{editorView:n,currentLanguageAdapter:i,canSwitchToLanguage:d,icon:f,toType:`sql`,displayName:`SQL`,onAfterToggle:a}),t[5]=i,t[6]=n,t[7]=a,t[8]=d,t[9]=p):p=t[9];let m=l&&i===`python`,h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,L.jsx)(ra,{fill:`var(--sky-11)`,color:`black`,className:`w-4 h-4`}),t[10]=h):h=t[10];let g;t[11]!==i||t[12]!==n||t[13]!==a||t[14]!==m?(g=(0,L.jsx)(kb,{editorView:n,currentLanguageAdapter:i,canSwitchToLanguage:m,icon:h,toType:`markdown`,displayName:`Markdown`,onAfterToggle:a}),t[11]=i,t[12]=n,t[13]=a,t[14]=m,t[15]=g):g=t[15];let _;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,L.jsx)(ma,{fill:`var(--sky-11)`,color:`black`,className:`w-4 h-4`}),t[16]=_):_=t[16];let v;t[17]!==i||t[18]!==n?(v=(0,L.jsx)(kb,{editorView:n,currentLanguageAdapter:i,canSwitchToLanguage:!0,icon:_,toType:`python`,displayName:`Python`,onAfterToggle:tn.NOOP}),t[17]=i,t[18]=n,t[19]=v):v=t[19];let y;return t[20]!==s||t[21]!==v||t[22]!==p||t[23]!==g?(y=(0,L.jsxs)(`div`,{className:s,children:[p,g,v]}),t[20]=s,t[21]=v,t[22]=p,t[23]=g,t[24]=y):y=t[24],y},kb=e=>{let t=(0,I.c)(10),{editorView:n,currentLanguageAdapter:r,canSwitchToLanguage:i,icon:a,toType:o,displayName:s,onAfterToggle:c}=e,l;t[0]!==n||t[1]!==c||t[2]!==o?(l=()=>{n&&(yt(n,{language:o}),c())},t[0]=n,t[1]=c,t[2]=o,t[3]=l):l=t[3];let u=l;if(!i||r===o)return null;let d=`View as ${s}`,f;t[4]!==u||t[5]!==a?(f=(0,L.jsx)(An,{"data-testid":`language-toggle-button`,variant:`text`,size:`xs`,className:`opacity-80 px-1`,onClick:u,children:a}),t[4]=u,t[5]=a,t[6]=f):f=t[6];let p;return t[7]!==d||t[8]!==f?(p=(0,L.jsx)(On,{content:d,children:f}),t[7]=d,t[8]=f,t[9]=p):p=t[9],p};function Ab(e,t,n){return n?{code:n.code,extensions:[...t,n.extension]}:{code:e,extensions:t}}var jb=({theme:e,showPlaceholder:n,id:r,config:a,code:o,status:s,serializedEditorState:l,setEditorView:u,runCell:d,userConfig:f,editorViewRef:p,editorViewParentRef:h,hidden:g,hasOutput:v,showHiddenCode:b,languageAdapter:x,setLanguageAdapter:S,showLanguageToggles:C=!0,inlineAiTooltip:w,outputArea:ee,tooltipParentSelector:te})=>{let[T,E]=t(oa),ne=mr(),{saveOrNameNotebook:D}=uy(),re=nl(),{saveCellConfig:ie}=Wi(),ae=s===`running`||s===`queued`,O=y(),k=qc(),oe=x===`markdown`,se=c(()=>ae?!1:re.idle&&f.keymap.destructive_delete?(re.submit([r]),!0):(ne({cellId:r}),!0)),ce=c(()=>!ae&&(d(),p.current&&xb(p.current),!0)),le=c(()=>{let e=!a.hide_code;return ie({configs:{[r]:{hide_code:e}}}),O.updateCellConfig({cellId:r,config:{hide_code:e}}),e}),ue=i(Wt),de=i(Kt),fe=c(()=>{m({autoInstantiate:ue,createNewCell:O.createNewCell}),a.hide_code||(ie({configs:{[r]:{hide_code:!0}}}),O.updateCellConfig({cellId:r,config:{hide_code:!0}}),O.markUntouched({cellId:r}))}),pe=c(()=>{m({autoInstantiate:ue,createNewCell:O.createNewCell})}),me=Ht(f),he=(0,F.useMemo)(()=>{let t=Hm({cellId:r,showPlaceholder:n,enableAI:me,cellActions:{...O,afterToggleMarkdown:fe,afterToggleSQL:pe,onRun:ce,deleteCell:se,saveNotebook:D,createManyBelow:e=>{for(let t of e.toReversed())O.createNewCell({code:t,before:!1,cellId:r,skipIfCodeExists:!0})},addOrAppendSetupCell:e=>{let t=Ve();if(!t.cellIds.setupCellExists()){O.addSetupCellIfDoesntExist({code:e});return}let n=st(t)[_],r=n?Me(n):t.cellData[_].code,i=r.trim()?`${r.trimEnd()}\n\n${e}`:e;n&&Le(n,i),O.updateCellCode({cellId:_,code:i,formattingChange:!1})},splitCell:k,toggleHideCode:le,aiCellCompletion:()=>{if(!me)return!1;let e=!1;return E(t=>t?.cellId===r?(e=!0,null):{cellId:r}),e}},completionConfig:f.completion,acceptCompletionOnEnter:de,keymapConfig:f.keymap,lspConfig:f.language_servers,theme:e,hotkeys:new nn(f.keymap.overrides??{}),diagnosticsConfig:f.diagnostics,displayConfig:f.display,inlineAiTooltip:w??f.ai?.inline_tooltip??!1,tooltipParentSelector:te});return t.push(vi.define(e=>(S(e.state.field(Ue).type),{update(e){S(e.state.field(Ue).type)}})),N.updateListener.of(e=>{e.selectionSet&&e.state.selection.ranges.some(e=>e.from!==e.to)&&b({focus:!1})}),N.domEventHandlers({focus:()=>{b({focus:!1})}})),t},[r,de,f.keymap,f.completion,f.language_servers,f.display,f.diagnostics,f.ai?.inline_tooltip,w,te,me,e,n,O,k,le,se,ce,E,fe,pe,S,b,D]),ge=xe()&&Ge(r),_e=e=>{if(!ge)return Ab(o,he,void 0);let t=Lv(r,e=>{O.updateCellCode({cellId:r,code:e,formattingChange:!0})},e);return Ab(o,he,t)},ve=c(()=>{let e=_e(o),t=new N({state:ii.create({doc:e.code,extensions:e.extensions})});u(t),ge||yt(t,{language:Ze(t.state).type})}),ye=c(()=>{cn(p.current!==null,`Editor view is not initialized`);let e=_e();p.current.dispatch({effects:[j.reconfigure.of([e.extensions]),Be(p.current,{completionConfig:f.completion,hotkeysProvider:new nn(f.keymap.overrides??{}),lspConfig:{...f.language_servers,diagnostics:f.diagnostics}})]})}),be=c(()=>{cn(l,`Editor view is not initialized`);let e=_e(o),t=new N({state:ii.fromJSON(l,{doc:e.code,extensions:e.extensions},{history:xi})});ge||yt(t,{language:Ze(t.state).type}),u(t),O.clearSerializedEditorState({cellId:r})}),[Se,Ce]=(0,F.useState)(l!==null);(0,F.useEffect)(()=>{if(p.current!==null){Ce(!0);return}if(Ce(!1),l!==null){be(),Ce(!0);return}return bt.request(r,()=>{p.current===null&&(ve(),Ce(!0))}),()=>bt.cancel(r)},[r,p,be,ve,l]),(0,F.useEffect)(()=>{p.current!==null&&ye()},[ye,he,p]),(0,F.useEffect)(()=>()=>{p.current?.destroy(),p.current=null},[p]);let[we,Te]=aa({rootMargin:`300px 0px`,threshold:0});(0,F.useEffect)(()=>{Se||(Te?.isIntersecting?bt.prioritize(r):bt.deprioritize(r))},[Se,Te?.isIntersecting,r]);let Ee=yb(r,p),De=``;return oe&&g&&v?De=`h-0 overflow-hidden`:g&&(De=`opacity-20 h-8 [&>div.cm-editor]:h-full [&>div.cm-editor]:overflow-hidden [&_.cm-panels]:hidden`),(0,L.jsx)(Ly,{cellId:r,aiCompletionCell:T,currentCode:p.current?.state.doc.toString()??o,currentLanguageAdapter:x,declineChange:c(()=>{E(null),p.current?.focus()}),onChange:c(e=>{p.current?.dispatch({changes:{from:0,to:p.current.state.doc.length,insert:e}})}),acceptChange:c(e=>{p.current?.dispatch({changes:{from:0,to:p.current.state.doc.length,insert:e}}),p.current?.focus(),E(null)}),runCell:ce,outputArea:ee,children:(0,L.jsxs)(`div`,{className:`relative w-full`,ref:we,...Ee,children:[Se?(0,L.jsx)(Mb,{className:De,editorView:p.current,ref:h,hidden:g,showHiddenCode:b}):(0,L.jsx)(Eb,{code:o,className:De}),!g&&C&&(0,L.jsx)(`div`,{className:`absolute top-1 right-5`,children:(0,L.jsx)(Ob,{code:o,editorView:p.current,currentLanguageAdapter:x,onAfterToggle:fe})})]})})},Mb=F.forwardRef((e,t)=>{let n=(0,I.c)(14),{className:r,editorView:i,hidden:a,showHiddenCode:o}=e,s=(0,F.useRef)(null),c,l;n[0]===i?(c=n[1],l=n[2]):(c=()=>{i!==null&&s.current!==null&&s.current.children.length===0&&s.current.append(i.dom)},l=[i,s],n[0]=i,n[1]=c,n[2]=l),(0,F.useEffect)(c,l);let u;n[3]===r?u=n[4]:(u=Tn(`cm mathjax_ignore`,r),n[3]=r,n[4]=u);let d;n[5]!==a||n[6]!==o?(d=e=>{a&&o&&(e.stopPropagation(),o({focus:!0}))},n[5]=a,n[6]=o,n[7]=d):d=n[7];let f;n[8]===t?f=n[9]:(f=e=>{t?yy(t,s)(e):yy(s)(e)},n[8]=t,n[9]=f);let p;return n[10]!==u||n[11]!==d||n[12]!==f?(p=(0,L.jsx)(`div`,{className:u,onDoubleClick:d,ref:f,"data-testid":`cell-editor`}),n[10]=u,n[11]=d,n[12]=f,n[13]=p):p=n[13],p});Mb.displayName=`CellCodeMirrorEditor`;function Nb(e){let n=n=>{let r=(0,I.c)(5),a=i(_n),[o,s]=t(Nv);if(xe()&&Ge(n.id)&&(bn(a.state)||o===void 0)){let e;r[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`Waiting for real-time collaboration connection...`}),r[0]=e):e=r[0];let t;return r[1]===s?t=r[2]:(t=(0,L.jsx)(`div`,{className:`flex h-full w-full items-baseline p-4`,children:(0,L.jsxs)(ya,{milliseconds:1e3,fallback:null,children:[e,(0,L.jsx)(An,{variant:`link`,onClick:()=>{s(`disabled`)},children:`Turn off real-time collaboration`})]})}),r[1]=s,r[2]=t),t}let c;return r[3]===n?c=r[4]:(c=(0,L.jsx)(e,{...n}),r[3]=n,r[4]=c),c};return n.displayName=`WithWaitUntilConnected(${e.displayName})`,n}var Pb=xe()?Nb((0,F.memo)(jb)):(0,F.memo)(jb),Fb=200;function Ib(e){let t=(0,I.c)(3),[n,r]=(0,F.useState)(!1),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;r(!1);let t=setTimeout(()=>{r(!0)},Fb);return()=>clearTimeout(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,F.useEffect)(i,a),e&&n}var Lb=wn(`rounded-full shadow-xs-solid border p-[5px] transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 [&>svg]:size-3 active:shadow-none bg-background`,{variants:{variant:{default:`hover:bg-accent hover:text-accent-foreground`,stale:`bg-(--yellow-3) hover:bg-(--yellow-4) text-(--yellow-11)`,green:`hover:bg-(--grass-2) hover:text-(--grass-11) hover:border-[var(--grass-7)],`,disabled:`opacity-50 cursor-not-allowed`,danger:`hover:bg-(--red-3) hover:text-(--red-11)`}},defaultVariants:{variant:`default`}}),Rb=e=>{let t=(0,I.c)(22),n,r,i,a,o,s,c,l,u;if(t[0]!==e){let{children:d,tooltip:f,disabled:p,variant:m,...h}=e;n=d,u=f;let g=p!==void 0&&p;r=`button`,i=g,a=h,o=e=>{!kn.hasModifier(e)&&(e.key===`Enter`||e.key===` `)&&e.stopPropagation(),h.onKeyDown?.(e)},s=e=>{g||h.onClick?.(e)},c=kn.preventFocus,l=Tn(Lb({variant:m}),h.className),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9];let d;t[10]!==n||t[11]!==r||t[12]!==i||t[13]!==a||t[14]!==o||t[15]!==s||t[16]!==c||t[17]!==l?(d=(0,L.jsx)(`button`,{type:r,disabled:i,...a,onKeyDown:o,onClick:s,onMouseDown:c,className:l,children:n}),t[10]=n,t[11]=r,t[12]=i,t[13]=a,t[14]=o,t[15]=s,t[16]=c,t[17]=l,t[18]=d):d=t[18];let f=d;if(u){let e;return t[19]!==f||t[20]!==u?(e=(0,L.jsx)(On,{content:u,side:`top`,delayDuration:200,usePortal:!1,children:f}),t[19]=f,t[20]=u,t[21]=e):e=t[21],e}return f},zb=e=>{let t=(0,I.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=Tn(`flex items-center gap-1 bg-background m-[2px] rounded-full`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,L.jsx)(Ja,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},Bb=e=>{let t=(0,I.c)(9),{connectionState:n,status:r}=e,{sendInterrupt:i}=Wi(),a=Ib(r===`running`),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=ba(`global.interrupt`),t[0]=o):o=t[0];let s;t[1]!==n||t[2]!==a?(s=vn(n)||!a,t[1]=n,t[2]=a,t[3]=s):s=t[3];let c=a?i:tn.NOOP,l=a?`stale`:`disabled`,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,L.jsx)(Ca,{strokeWidth:1.5}),t[4]=u):u=t[4];let d;return t[5]!==s||t[6]!==c||t[7]!==l?(d=(0,L.jsx)(Rb,{tooltip:o,disabled:s,onClick:c,variant:l,"data-testid":`run-button`,children:u}),t[5]=s,t[6]=c,t[7]=l,t[8]=d):d=t[8],d};function Vb(e){let t=(0,F.useRef)(e),[n,r]=(0,F.useState)(e);return(0,F.useEffect)(()=>{let e=setInterval(()=>{r(gt.now().toMilliseconds())},17);return()=>clearInterval(e)},[]),n-t.current}var Hb=e=>{let t=(0,I.c)(79),{editing:n,status:r,disabled:i,staleInputs:a,edited:o,interrupted:s,elapsedTime:c,runStartTimestamp:l,lastRunStartTimestamp:u,uninstantiated:d}=e;if(!n)return null;let f=l??u,p;t[0]===f?p=t[1]:(p=f?(0,L.jsx)(Wb,{lastRanTime:f}):null,t[0]=f,t[1]=p);let m=p;if(i&&r===`running`)return rn.error(`CellStatusComponent: disabled and running`),null;if(i&&a){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is stale, but it's disabled and can't be run`}),t[2]=e):e=t[2];let n;t[3]===m?n=t[4]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[3]=m,t[4]=n);let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-stale`,"data-testid":`cell-status`,"data-status":`stale`,children:(0,L.jsxs)(Kc,{children:[(0,L.jsx)(Yn,{className:`h-5 w-5`,strokeWidth:1.5}),(0,L.jsx)(wa,{className:`h-3 w-3`,strokeWidth:2.5})]})}),t[5]=r):r=t[5];let i;return t[6]===n?i=t[7]:(i=(0,L.jsx)(On,{content:n,usePortal:!0,children:r}),t[6]=n,t[7]=i),i}if(i){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is disabled`}),t[8]=e):e=t[8];let n;t[9]===m?n=t[10]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[9]=m,t[10]=n);let r;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-disabled`,"data-testid":`cell-status`,"data-status":`disabled`,children:(0,L.jsx)(Yn,{className:`h-5 w-5`,strokeWidth:1.5})}),t[11]=r):r=t[11];let i;return t[12]===n?i=t[13]:(i=(0,L.jsx)(On,{content:n,usePortal:!0,children:r}),t[12]=n,t[13]=i),i}if(!a&&r===`disabled-transitively`){let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`An ancestor of this cell is disabled, so it can't be run`}),t[14]=e):e=t[14];let n;t[15]===m?n=t[16]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[15]=m,t[16]=n);let r;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-stale`,"data-testid":`cell-status`,"data-status":`disabled-transitively`,children:(0,L.jsxs)(Kc,{layerTop:!0,children:[(0,L.jsx)(Ga,{className:`h-5 w-5`,strokeWidth:1.5}),(0,L.jsx)(Yn,{className:`h-3 w-3`,strokeWidth:2.5})]})}),t[17]=r):r=t[17];let i;return t[18]===n?i=t[19]:(i=(0,L.jsx)(On,{content:n,usePortal:!0,children:r}),t[18]=n,t[19]=i),i}if(a&&r===`disabled-transitively`){let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is stale, but an ancestor is disabled so it can't be run`}),t[20]=e):e=t[20];let n;t[21]===m?n=t[22]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[21]=m,t[22]=n);let r;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-stale`,"data-testid":`cell-status`,"data-status":`stale`,children:(0,L.jsxs)(Kc,{children:[(0,L.jsx)(wa,{className:`h-5 w-5`,strokeWidth:1}),(0,L.jsx)(Yn,{className:`h-3 w-3`,strokeWidth:2.5})]})}),t[23]=r):r=t[23];let i;return t[24]===n?i=t[25]:(i=(0,L.jsx)(On,{content:n,usePortal:!0,children:r}),t[24]=n,t[25]=i),i}if(r===`running`){let e;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is running`}),t[26]=e):e=t[26];let n;t[27]===m?n=t[28]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[27]=m,t[28]=n);let r;t[29]===l?r=t[30]:(r=gt.fromSeconds(l)||gt.now(),t[29]=l,t[30]=r);let i;t[31]===r?i=t[32]:(i=(0,L.jsx)(`div`,{className:`cell-status-icon elapsed-time running`,"data-testid":`cell-status`,"data-status":`running`,children:(0,L.jsx)(Gb,{startTime:r})}),t[31]=r,t[32]=i);let a;return t[33]!==n||t[34]!==i?(a=(0,L.jsx)(On,{content:n,usePortal:!0,children:i}),t[33]=n,t[34]=i,t[35]=a):a=t[35],a}if(r===`queued`){let e;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`span`,{children:`This cell is queued to run`}),t[36]=e):e=t[36];let n;t[37]===m?n=t[38]:(n=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e,m]}),t[37]=m,t[38]=n);let r;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,L.jsx)(`div`,{className:`cell-status-icon cell-status-queued`,"data-testid":`cell-status`,"data-status":`queued`,children:(0,L.jsx)(ia,{className:`h-5 w-5`,strokeWidth:1.5})}),t[39]=r):r=t[39];let i;return t[40]===n?i=t[41]:(i=(0,L.jsx)(On,{content:n,usePortal:!0,children:r}),t[40]=n,t[41]=i),i}if(o||s||a||d){let e;t[42]===c?e=t[43]:(e=je(c),t[42]=c,t[43]=e);let n=e,r;t[44]!==c||t[45]!==n?(r=c?(0,L.jsx)(Ub,{elapsedTime:n}):null,t[44]=c,t[45]=n,t[46]=r):r=t[46];let i=r,a,l=``;if(d)a=`This cell has not yet been run`;else if(s){a=`This cell was interrupted when it was last run`;let e;t[47]===i?e=t[48]:(e=(0,L.jsxs)(`span`,{children:[`This cell ran for `,i,` before being interrupted`]}),t[47]=i,t[48]=e),l=e}else if(o){a=`This cell has been modified since it was last run`;let e;t[49]===i?e=t[50]:(e=(0,L.jsxs)(`span`,{children:[`This cell took `,i,` to run`]}),t[49]=i,t[50]=e),l=e}else{a=`This cell has not been run with the latest inputs`;let e;t[51]===i?e=t[52]:(e=(0,L.jsxs)(`span`,{children:[`This cell took `,i,` to run`]}),t[51]=i,t[52]=e),l=e}let u;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,L.jsx)(`div`,{className:`cell-status-stale`,"data-testid":`cell-status`,"data-status":`outdated`,children:(0,L.jsx)(wa,{className:`h-5 w-5`,strokeWidth:1.5})}),t[53]=u):u=t[53];let f;t[54]===a?f=t[55]:(f=(0,L.jsx)(On,{content:a,usePortal:!0,children:u}),t[54]=a,t[55]=f);let p;t[56]!==c||t[57]!==n||t[58]!==m||t[59]!==l?(p=c&&(0,L.jsx)(On,{content:(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[l,m]}),usePortal:!0,children:(0,L.jsx)(`div`,{className:`elapsed-time hover-action`,"data-testid":`cell-status`,"data-status":`outdated`,children:(0,L.jsx)(`span`,{children:n})})}),t[56]=c,t[57]=n,t[58]=m,t[59]=l,t[60]=p):p=t[60];let h;return t[61]!==f||t[62]!==p?(h=(0,L.jsxs)(`div`,{className:`cell-status-icon flex items-center gap-2`,children:[f,p]}),t[61]=f,t[62]=p,t[63]=h):h=t[63],h}if(c!==null){let e;t[64]===c?e=t[65]:(e=je(c),t[64]=c,t[65]=e);let n=e,r;t[66]!==c||t[67]!==n?(r=c?(0,L.jsx)(Ub,{elapsedTime:n}):null,t[66]=c,t[67]=n,t[68]=r):r=t[68];let i=r,a;t[69]===i?a=t[70]:(a=(0,L.jsxs)(`span`,{children:[`This cell took `,i,` to run`]}),t[69]=i,t[70]=a);let o;t[71]!==m||t[72]!==a?(o=(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[a,m]}),t[71]=m,t[72]=a,t[73]=o):o=t[73];let s;t[74]===n?s=t[75]:(s=(0,L.jsx)(`div`,{className:`cell-status-icon elapsed-time hover-action`,"data-testid":`cell-status`,"data-status":`idle`,children:(0,L.jsx)(`span`,{children:n})}),t[74]=n,t[75]=s);let l;return t[76]!==o||t[77]!==s?(l=(0,L.jsx)(On,{content:o,usePortal:!0,children:s}),t[76]=o,t[77]=s,t[78]=l):l=t[78],l}return null},Ub=e=>{let t=(0,I.c)(2),n;return t[0]===e.elapsedTime?n=t[1]:(n=(0,L.jsx)(`span`,{className:`tracking-wide font-semibold`,children:e.elapsedTime}),t[0]=e.elapsedTime,t[1]=n),n},Wb=e=>{let t=(0,I.c)(4),n=new Date(e.lastRanTime*1e3),r=new Date,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={hour:`numeric`,minute:`numeric`,second:`numeric`,fractionalSecondDigits:3,hour12:!0},t[0]=i):i=t[0];let a=Aa(i),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o={month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,fractionalSecondDigits:3,hour12:!0},t[1]=o):o=t[1];let s=Aa(o),c=n.toDateString()===r.toDateString()?a:s,l=oo(n),u;return t[2]===l?u=t[3]:(u=(0,L.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,l,` ago)`]}),t[2]=l,t[3]=u),(0,L.jsxs)(`span`,{children:[`Ran at`,` `,(0,L.jsx)(`strong`,{className:`tracking-wide font-semibold`,children:c.format(n)}),` `,u]})},Gb=e=>{let t=(0,I.c)(6),n;t[0]===e.startTime?n=t[1]:(n=e.startTime.toMilliseconds(),t[0]=e.startTime,t[1]=n);let r=Vb(n),i;t[2]===r?i=t[3]:(i=je(r),t[2]=r,t[3]=i);let a;return t[4]===i?a=t[5]:(a=(0,L.jsx)(`span`,{children:i}),t[4]=i,t[5]=a),a};function Kb({connectionState:e,needsRun:t,loading:n,inactive:r}){return vn(e)?`disabled`:t&&!n?`stale`:n||r?`disabled`:`green`}var qb=e=>{let t=(0,I.c)(27),{onClick:n,connectionState:r,needsRun:i,status:a,config:o,edited:s}=e,c=a===`disabled-transitively`,l=a===`running`||a===`queued`,u,d;t[0]!==c||t[1]!==o.disabled||t[2]!==r||t[3]!==s||t[4]!==l||t[5]!==i?(u=vn(r)||l||!o.disabled&&c&&!s,d=Kb({connectionState:r,needsRun:i,loading:l,inactive:u}),t[0]=c,t[1]=o.disabled,t[2]=r,t[3]=s,t[4]=l,t[5]=i,t[6]=u,t[7]=d):(u=t[6],d=t[7]);let f=d;if(o.disabled){let e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(Ha,{}),t[8]=e):e=t[8];let r;return t[9]!==u||t[10]!==n||t[11]!==f?(r=(0,L.jsx)(Rb,{tooltip:`Add code to notebook`,disabled:u,onClick:n,variant:f,"data-testid":`run-button`,children:e}),t[9]=u,t[10]=n,t[11]=f,t[12]=r):r=t[12],r}if(!o.disabled&&c&&!s){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(fr,{strokeWidth:1.2}),t[13]=e):e=t[13];let r;return t[14]!==u||t[15]!==n||t[16]!==f?(r=(0,L.jsx)(Rb,{disabled:u,tooltip:`This cell can't be run because it has a disabled ancestor`,onClick:n,variant:f,"data-testid":`run-button`,children:e}),t[14]=u,t[15]=n,t[16]=f,t[17]=r):r=t[17],r}let p;if(vn(r)){let e;t[18]===r?e=t[19]:(e=Sn(r),t[18]=r,t[19]=e),p=e}else if(a===`queued`)p=`This cell is already queued to run`;else if(a===`running`)p=`This cell is already running.`;else{let e;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(e=ba(`cell.run`),t[20]=e):e=t[20],p=e}let m;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,L.jsx)(fr,{strokeWidth:1.2}),t[21]=m):m=t[21];let h;return t[22]!==u||t[23]!==n||t[24]!==p||t[25]!==f?(h=(0,L.jsx)(Rb,{tooltip:p,disabled:u,onClick:n,variant:f,"data-testid":`run-button`,children:m}),t[22]=u,t[23]=n,t[24]=p,t[25]=f,t[26]=h):h=t[26],h};export{Zc as A,Ua as B,_m as C,dm as D,pm as E,Wc as F,Gc as I,Fs as L,Yc as M,qc as N,rl as O,Kc as P,Ga as R,Nv as S,fm as T,Ba as V,uy as _,zb as a,ey as b,Pb as c,sb as d,ab as f,ly as g,yy as h,Bb as i,Xc as j,nl as k,Ob as l,eb as m,Hb as n,Rb as o,nb as p,Ub as r,Ib as s,qb as t,_b as u,ny as v,gm as w,Hv as x,ty as y,Wa as z};