@marimo-team/frontend 0.25.3-dev13 → 0.25.3-dev135

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 (568) hide show
  1. package/dist/assets/CellStatus-Bu_cFOaf.js +1 -0
  2. package/dist/assets/{ConnectedDataExplorerComponent-TprnxZeJ.js → ConnectedDataExplorerComponent-BV1mVpaE.js} +1 -1
  3. package/dist/assets/{ErrorBoundary-CM13wrd8.js → ErrorBoundary-Cy4lxM4U.js} +2 -2
  4. package/dist/assets/JsonOutput-Dnd0uzN4.js +11 -0
  5. package/dist/assets/{LazyAnyLanguageCodeMirror-B4fCknq1.js → LazyAnyLanguageCodeMirror-DoxWX_Wp.js} +2 -2
  6. package/dist/assets/MarimoErrorOutput-DWgmERpO.js +10 -0
  7. package/dist/assets/{RenderHTML-DX6i99Op.js → RenderHTML-BuZ8DdVv.js} +2 -2
  8. package/dist/assets/RunButton-BXXDV5w-.js +1 -0
  9. package/dist/assets/__vite-browser-external-BynxqS4w.js +1 -0
  10. package/dist/assets/__vite-browser-external-DTOT9NDN.js +1 -0
  11. package/dist/assets/{add-cell-with-ai-BpD_790A.js → add-cell-with-ai-DYahRMb_.js} +26 -26
  12. package/dist/assets/{add-connection-dialog-B1BXCjex.js → add-connection-dialog-CjRaQbDW.js} +51 -51
  13. package/dist/assets/{agent-panel-CDFUc1uu.js → agent-panel-Cb9PZdDM.js} +4 -4
  14. package/dist/assets/ai-model-dropdown-Bbr2oylS.js +13 -0
  15. package/dist/assets/alert-dialog-8YiYLrfr.js +1 -0
  16. package/dist/assets/any-language-editor-BWmz0P_C.js +1 -0
  17. package/dist/assets/{app-config-button-AdV-QDD7.js → app-config-button-CPNc_---.js} +1 -1
  18. package/dist/assets/arrays-0R2reF2y.js +1 -0
  19. package/dist/assets/{blob-BG8yoQmx.js → blob-CQAkRxR1.js} +1 -1
  20. package/dist/assets/{button-COI-NGrx.js → button-Cl7haVNh.js} +1 -1
  21. package/dist/assets/{cache-panel-DTY1dqvi.js → cache-panel-DuBsA6oO.js} +1 -1
  22. package/dist/assets/{capabilities-BJvf-MD4.js → capabilities-DcB-Dd0T.js} +1 -1
  23. package/dist/assets/cell-editor-CjvWSYDB.js +42 -0
  24. package/dist/assets/cell-link-DIOanEQB.js +1 -0
  25. package/dist/assets/cells-lwP9-xsQ.js +220 -0
  26. package/dist/assets/{chat-display-DhgI2MS9.js → chat-display-DpCQoui-.js} +1 -1
  27. package/dist/assets/chat-panel-C79_pWxF.js +4 -0
  28. package/dist/assets/chat-ui-DOOiaOcb.js +4 -0
  29. package/dist/assets/circle-B0vOU-Dh.js +1 -0
  30. package/dist/assets/{code-visibility-BJImdpDi.js → code-visibility-D1Wf7-vD.js} +1 -1
  31. package/dist/assets/column-preview-DIvrCqra.js +1 -0
  32. package/dist/assets/command-palette-BYgBVslq.js +1 -0
  33. package/dist/assets/{common-Sl3uthjg.js → common-B7U2CeDc.js} +1 -1
  34. package/dist/assets/{components-CskjK6xZ.js → components-9p_w2C6e.js} +1 -1
  35. package/dist/assets/components-B6gDDccL.js +1 -0
  36. package/dist/assets/{components-3cou6Mka.js → components-Vz1pD133.js} +1 -1
  37. package/dist/assets/config-7IjqNuVp.js +1 -0
  38. package/dist/assets/config-BC32AAdw.js +1 -0
  39. package/dist/assets/{config-CA1V-wjh.js → config-CXnC3MRv.js} +1 -1
  40. package/dist/assets/{copy-D8O_CYCG.js → copy-74EjuZso.js} +1 -1
  41. package/dist/assets/{copy-icon-BIiRXh_3.js → copy-icon-Craaocbu.js} +1 -1
  42. package/dist/assets/{createReducer-DgRODTW6.js → createReducer-B04CIO-e.js} +1 -1
  43. package/dist/assets/{datasource-DfbNb83e.js → datasource-Bp8TnG7a.js} +2 -2
  44. package/dist/assets/{dates-CfmdTL6B.js → dates-CaPZVGtm.js} +1 -1
  45. package/dist/assets/{dependency-graph-panel-L5cBE5sl.js → dependency-graph-panel-B31-YcSF.js} +3 -3
  46. package/dist/assets/dist-gaK_BThd.js +1 -0
  47. package/dist/assets/{documentation-panel-D7S8JIc2.js → documentation-panel-C2MJwSef.js} +1 -1
  48. package/dist/assets/download-J6sWXUJR.js +9 -0
  49. package/dist/assets/dropdown-menu-Cwi17BoX.js +1 -0
  50. package/dist/assets/edit-page-DfxHDnWP.js +9 -0
  51. package/dist/assets/{error-banner-COZ7SfYV.js → error-banner-m3mastc-.js} +1 -1
  52. package/dist/assets/{error-entries-CLnPDv7b.js → error-entries-BcRbOxwK.js} +1 -1
  53. package/dist/assets/{error-panel-D2xrYLue.js → error-panel-jZlFCjdy.js} +1 -1
  54. package/dist/assets/{es-Cqst59WX.js → es-Rg27gAEy.js} +1 -1
  55. package/dist/assets/feedback-button-94vZrmBy.js +1 -0
  56. package/dist/assets/{feedback-button-DzPunIqU.js → feedback-button-C2XmZw_y.js} +2 -2
  57. package/dist/assets/file-explorer-panel-Cg9UovsS.js +1 -0
  58. package/dist/assets/{file-name-input-B4fRaQkI.js → file-name-input-y9ggAMGJ.js} +2 -2
  59. package/dist/assets/floating-outline-CE1olGl0.js +1 -0
  60. package/dist/assets/{formats-yZ06h1Pl.js → formats-CYyvbiZA.js} +1 -1
  61. package/dist/assets/{formatting-BqrP-n49.js → formatting-DW2u7HXI.js} +1 -1
  62. package/dist/assets/fullscreen-D-ldV-19.js +41 -0
  63. package/dist/assets/{gallery-page-BefvdsM7.js → gallery-page-ClEnoAT-.js} +1 -1
  64. package/dist/assets/{ganttDiagram-EL5Y4UJY-2n7Ig5Jm.js → ganttDiagram-EL5Y4UJY-CYqkCfFG.js} +1 -1
  65. package/dist/assets/{glide-data-editor-C3eaYlXg.js → glide-data-editor-Cp0q28Zz.js} +2 -2
  66. package/dist/assets/{glide-utils-CIrAxdjv.js → glide-utils-DsTeJ7WA.js} +2 -2
  67. package/dist/assets/home-page-DJsI6Od_.js +1 -0
  68. package/dist/assets/{hooks-DzML9nez.js → hooks-DGSryuSD.js} +1 -1
  69. package/dist/assets/{html-to-image-DK9Zl1lU.js → html-to-image-BW0fcUS8.js} +1 -1
  70. package/dist/assets/index-BjNf54kO.js +30 -0
  71. package/dist/assets/index-u08m0hQE.css +2 -0
  72. package/dist/assets/{input-BoBxR50a.js → input-DLA5Dhn3.js} +2 -2
  73. package/dist/assets/kiosk-mode-Cbxffiz9.js +1 -0
  74. package/dist/assets/{layout-Ck1RoL1B.js → layout-DRVIFud8.js} +5 -5
  75. package/dist/assets/linear-Bma8J3iM.js +1 -0
  76. package/dist/assets/links-UwsB2RA1.js +1 -0
  77. package/dist/assets/{logs-panel-BRytaWaO.js → logs-panel-Db38azhc.js} +1 -1
  78. package/dist/assets/{markdown-renderer-DX0Xrrfy.js → markdown-renderer-D2td9eFc.js} +1 -1
  79. package/dist/assets/menu-items-yD7IV3V4.js +1 -0
  80. package/dist/assets/{mermaid-C4EiVqcd.js → mermaid-DmekSy8J.js} +2 -2
  81. package/dist/assets/{name-cell-input-DlpTvPLa.js → name-cell-input-CJpi0Kvu.js} +1 -1
  82. package/dist/assets/numbers-DJK15_4S.js +1 -0
  83. package/dist/assets/{objects-snlMn4yk.js → objects-rLPlQ3X_.js} +1 -1
  84. package/dist/assets/{once-Haz_uxEL.js → once-6KNTRW0u.js} +1 -1
  85. package/dist/assets/{outline-panel-B2WIpz-1.js → outline-panel-DxQKP4eN.js} +1 -1
  86. package/dist/assets/{package-data-dv4FBHxR.js → package-data-CKPmBDtg.js} +1 -1
  87. package/dist/assets/packages-panel-BFzN4mNb.js +1 -0
  88. package/dist/assets/{panel-accordion-state-BqSH5ttk.js → panel-accordion-state-D3RiRniG.js} +1 -1
  89. package/dist/assets/panels-CpUpLOy4.js +1 -0
  90. package/dist/assets/precisionRound-BxlUs8G4.js +1 -0
  91. package/dist/assets/process-output-B6v1FE29.js +1 -0
  92. package/dist/assets/{quadrantDiagram-AXDQQJYC-yBhCDI7E.js → quadrantDiagram-AXDQQJYC-D9KH5Zge.js} +1 -1
  93. package/dist/assets/react-vega-BTNeboR2.js +189 -0
  94. package/dist/assets/{readonly-code-display-MnMEoYW5.js → readonly-code-display-Deg2hzFh.js} +1 -1
  95. package/dist/assets/{readonly-python-code-ggs4hAzC.js → readonly-python-code-DPGknu49.js} +1 -1
  96. package/dist/assets/{renderShortcut-C1JwYcqW.js → renderShortcut-Bxv9ZLnD.js} +1 -1
  97. package/dist/assets/{requests-lt0JK8Jt.js → requests-BIFR-h4M.js} +1 -1
  98. package/dist/assets/requests-DuLJN9Tf.js +1 -0
  99. package/dist/assets/{reveal-component-PiV1eQk9.js → reveal-component-CXkDpGxy.js} +37 -37
  100. package/dist/assets/run-page-qp2KKYgs.js +1 -0
  101. package/dist/assets/{runs-BLp5jezv.js → runs-C8uOPNAW.js} +1 -1
  102. package/dist/assets/{runtime-details-state-CoL-p0MC.js → runtime-details-state-BiGF299n.js} +1 -1
  103. package/dist/assets/{save-worker-BbUSwZRG.js → save-worker-UwdGcNK5.js} +2 -1
  104. package/dist/assets/scratchpad-panel-QV0lacAe.js +1 -0
  105. package/dist/assets/{scroll-to-bottom-button-1FyowpWV.js → scroll-to-bottom-button-CidjyqiH.js} +1 -1
  106. package/dist/assets/secrets-panel-ConQpchl.js +1 -0
  107. package/dist/assets/select-CgWQvW1F.js +1 -0
  108. package/dist/assets/{session-DqoWmb7X.js → session-BHgGkjDm.js} +1 -1
  109. package/dist/assets/session-panel-CrWluawa.js +1 -0
  110. package/dist/assets/snippets-panel-CM7g9b6c.js +1 -0
  111. package/dist/assets/{spec-BfSBcO5B.js → spec-DFtwOyXT.js} +1 -1
  112. package/dist/assets/state-BYETGwDZ.js +1 -0
  113. package/dist/assets/{state-uwRvJLb8.js → state-CZu2E2Lb.js} +1 -1
  114. package/dist/assets/{state-C3oDoyFe.js → state-ClBFtZxn.js} +1 -1
  115. package/dist/assets/{state-DxQnC_1I.js → state-CrLrURYG.js} +1 -1
  116. package/dist/assets/{state-DtGB7xeJ.js → state-DhMztz1E.js} +1 -1
  117. package/dist/assets/state-lEPoZS4k.js +107 -0
  118. package/dist/assets/{strings-B2vv-ENv.js → strings-3lNX212T.js} +1 -1
  119. package/dist/assets/{swiper-component-a07domrZ.js → swiper-component-BwGv-Pu1.js} +1 -1
  120. package/dist/assets/switch-D2gdC_ep.js +1 -0
  121. package/dist/assets/tabs-BLczoY3k.js +1 -0
  122. package/dist/assets/{terminal-wnSHYT8N.js → terminal-DLgGyFIP.js} +1 -1
  123. package/dist/assets/{time-MgToa8VM.js → time-DswSXBDk.js} +1 -1
  124. package/dist/assets/toast-trUlkvx3.js +1 -0
  125. package/dist/assets/tooltip-B5lAA_jn.js +1 -0
  126. package/dist/assets/tooltip-BiQdpXA0.js +61 -0
  127. package/dist/assets/tracing-DRA8maZB.js +1 -0
  128. package/dist/assets/tracing-panel-DLxPRadV.js +2 -0
  129. package/dist/assets/{tree-actions-DnUokmva.js → tree-actions-COtU5qy_.js} +1 -1
  130. package/dist/assets/use-restore-focus-DMSzeuUr.js +1 -0
  131. package/dist/assets/{useAddCell-IN24thff.js → useAddCell-BAEOA87M.js} +1 -1
  132. package/dist/assets/useAsyncData-qvoPYHtx.js +1 -0
  133. package/dist/assets/useBoolean-BkeUcn1n.js +1 -0
  134. package/dist/assets/useCellActionButton-BobjsJfu.js +1 -0
  135. package/dist/assets/useDebounce-DwTQ_1Pu.js +1 -0
  136. package/dist/assets/{useDeepCompareMemoize-DFIVN9dn.js → useDeepCompareMemoize-B2DVK2De.js} +1 -1
  137. package/dist/assets/useDelayElapsed-BlsDT4TV.js +1 -0
  138. package/dist/assets/{useDeleteCell-fQlM46Y2.js → useDeleteCell-gedazkBF.js} +1 -1
  139. package/dist/assets/{useDependencyPanelTab-ImXYINm_.js → useDependencyPanelTab-DAJ6BOUm.js} +1 -1
  140. package/dist/assets/{useEvent-Dfcbgjhg.js → useEvent-BDjgaBtz.js} +1 -1
  141. package/dist/assets/{useEventListener-D9cftcHj.js → useEventListener-DPOTkksd.js} +1 -1
  142. package/dist/assets/{useIframeCapabilities-CwTkczVN.js → useIframeCapabilities-sHeZt_EA.js} +1 -1
  143. package/dist/assets/{useInstallPackage-BW06eter.js → useInstallPackage-BfNKN33w.js} +1 -1
  144. package/dist/assets/{useInterval--x3s1VpI.js → useInterval-BcdwHHB5.js} +1 -1
  145. package/dist/assets/useNotebookActions-CnLArLoz.js +1 -0
  146. package/dist/assets/{useRunCells-DSJPXE-j.js → useRunCells-CUknep7p.js} +1 -1
  147. package/dist/assets/{useSplitCell-DQyMF5gd.js → useSplitCell-DeXniINv.js} +1 -1
  148. package/dist/assets/useStateForKey-CGMJQT8x.js +1 -0
  149. package/dist/assets/{useTheme-n8Dj1zH7.js → useTheme-C2dnh2vM.js} +1 -1
  150. package/dist/assets/{utils-CaQYvazl.js → utils-DfElfBpz.js} +1 -1
  151. package/dist/assets/vega-component-DJf6ho22.js +1 -0
  152. package/dist/assets/{vega-embed-container-DJPNkHPb.js → vega-embed-container-DtArSJz1.js} +1 -1
  153. package/dist/assets/vega-loader.browser-Bu25TKax.js +6 -0
  154. package/dist/assets/worker-jm2VC7pS.js +159 -0
  155. package/dist/assets/{write-secret-modal-DzKAInL2.js → write-secret-modal-CBi2vNK_.js} +1 -1
  156. package/dist/assets/{xychartDiagram-S5SC5T6Z-KbGzG6-u.js → xychartDiagram-S5SC5T6Z-CeRnBS5e.js} +1 -1
  157. package/dist/index.html +81 -79
  158. package/package.json +14 -14
  159. package/src/__tests__/host-imports.test.ts +1 -0
  160. package/src/__tests__/module-entry.test.ts +32 -0
  161. package/src/__tests__/mount.test.ts +0 -20
  162. package/src/components/ai/__tests__/ai-model-dropdown.test.tsx +63 -0
  163. package/src/components/ai/ai-model-dropdown.tsx +11 -6
  164. package/src/components/app-config/ai-config.tsx +7 -2
  165. package/src/components/chat/__tests__/message-queue.test.tsx +17 -0
  166. package/src/components/chat/acp/__tests__/session-tabs.test.tsx +43 -0
  167. package/src/components/chat/acp/__tests__/state.test.ts +2 -2
  168. package/src/components/chat/acp/blocks.tsx +3 -2
  169. package/src/components/chat/acp/session-tabs.tsx +8 -3
  170. package/src/components/chat/chat-components.tsx +2 -0
  171. package/src/components/chat/chat-panel.tsx +9 -8
  172. package/src/components/chat/chat-utils.ts +4 -8
  173. package/src/components/data-table/TableTopBar.tsx +2 -0
  174. package/src/components/data-table/__tests__/chart-spec-model.test.ts +195 -195
  175. package/src/components/data-table/__tests__/column-explorer.test.tsx +27 -1
  176. package/src/components/data-table/__tests__/columns.test.tsx +105 -0
  177. package/src/components/data-table/__tests__/context-menu-interaction.test.tsx +130 -0
  178. package/src/components/data-table/__tests__/data-table.test.tsx +1 -0
  179. package/src/components/data-table/__tests__/date-popover.test.tsx +72 -0
  180. package/src/components/data-table/__tests__/export-actions.test.tsx +105 -0
  181. package/src/components/data-table/__tests__/keyboard-selection.test.tsx +188 -0
  182. package/src/components/data-table/__tests__/search-highlight.test.tsx +109 -0
  183. package/src/components/data-table/__tests__/url-detector.test.tsx +74 -0
  184. package/src/components/data-table/cell-selection/feature.ts +2 -2
  185. package/src/components/data-table/cell-selection/types.ts +2 -2
  186. package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +74 -1
  187. package/src/components/data-table/charts/__tests__/spec-snapshot.test.ts +20 -20
  188. package/src/components/data-table/charts/__tests__/spec.test.ts +78 -52
  189. package/src/components/data-table/charts/__tests__/storage.test.ts +4 -1
  190. package/src/components/data-table/charts/chart-spec/spec.ts +68 -43
  191. package/src/components/data-table/charts/charts.tsx +40 -30
  192. package/src/components/data-table/charts/storage.ts +16 -5
  193. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +1 -1
  194. package/src/components/data-table/column-summary/chart-spec-model.tsx +23 -16
  195. package/src/components/data-table/column-summary/column-summary.tsx +2 -4
  196. package/src/components/data-table/column-visibility-dropdown.tsx +8 -13
  197. package/src/components/data-table/columns.tsx +45 -46
  198. package/src/components/data-table/context-menu.tsx +36 -20
  199. package/src/components/data-table/data-table.tsx +13 -1
  200. package/src/components/data-table/date-popover.tsx +6 -4
  201. package/src/components/data-table/export-actions.tsx +76 -48
  202. package/src/components/data-table/range-focus/atoms.ts +4 -6
  203. package/src/components/data-table/range-focus/use-cell-range-selection.ts +65 -38
  204. package/src/components/data-table/range-focus/use-scroll-into-view.ts +21 -2
  205. package/src/components/data-table/renderers.tsx +16 -7
  206. package/src/components/data-table/row-viewer-panel/__tests__/row-viewer.test.tsx +24 -1
  207. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +4 -4
  208. package/src/components/data-table/search-highlight.tsx +79 -0
  209. package/src/components/data-table/types.ts +1 -0
  210. package/src/components/data-table/url-detector.tsx +49 -9
  211. package/src/components/datasources/__tests__/column-actions.test.tsx +97 -0
  212. package/src/components/datasources/__tests__/column-preview.test.tsx +98 -5
  213. package/src/components/datasources/__tests__/datasources-interactions.test.tsx +181 -0
  214. package/src/components/datasources/__tests__/table-list.test.tsx +118 -0
  215. package/src/components/datasources/__tests__/utils.test.ts +57 -6
  216. package/src/components/datasources/column-preview.tsx +13 -4
  217. package/src/components/datasources/datasources.tsx +51 -39
  218. package/src/components/datasources/utils.ts +32 -23
  219. package/src/components/debugger/debugger-code.tsx +5 -0
  220. package/src/components/dependency-graph/dependency-graph-tree.tsx +8 -8
  221. package/src/components/dependency-graph/elements.ts +24 -21
  222. package/src/components/dependency-graph/panels.tsx +2 -1
  223. package/src/components/dependency-graph/utils/__tests__/layout.test.ts +18 -11
  224. package/src/components/editor/SortableCell.tsx +1 -3
  225. package/src/components/editor/__tests__/dynamic-favicon.test.tsx +111 -18
  226. package/src/components/editor/__tests__/package-alert.test.tsx +22 -1
  227. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +24 -0
  228. package/src/components/editor/actions/pair-with-agent-modal.tsx +18 -15
  229. package/src/components/editor/ai/add-cell-with-ai.tsx +3 -3
  230. package/src/components/editor/ai/ai-completion-editor.tsx +1 -0
  231. package/src/components/editor/alerts/startup-logs-alert.tsx +1 -0
  232. package/src/components/editor/cell/CreateCellButton.tsx +8 -10
  233. package/src/components/editor/cell/DeleteButton.tsx +1 -0
  234. package/src/components/editor/cell/__tests__/useShouldShowInterrupt.test.ts +39 -0
  235. package/src/components/editor/cell/code/__tests__/language-toggle.test.tsx +54 -0
  236. package/src/components/editor/cell/code/cell-editor.tsx +1 -1
  237. package/src/components/editor/cell/code/language-toggle.tsx +8 -7
  238. package/src/components/editor/cell/collapse.tsx +5 -3
  239. package/src/components/editor/cell/useShouldShowInterrupt.ts +2 -12
  240. package/src/components/editor/chrome/panels/__tests__/packages-panel.test.tsx +30 -1
  241. package/src/components/editor/chrome/panels/cache-panel.tsx +1 -0
  242. package/src/components/editor/chrome/panels/outline/__tests__/outline-keyboard.test.tsx +84 -0
  243. package/src/components/editor/chrome/panels/outline/floating-outline.tsx +39 -14
  244. package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +3 -2
  245. package/src/components/editor/chrome/panels/packages-panel.tsx +4 -7
  246. package/src/components/editor/chrome/panels/secrets-panel.tsx +1 -0
  247. package/src/components/editor/chrome/panels/snippets-panel.tsx +5 -1
  248. package/src/components/editor/chrome/wrapper/__tests__/attachment-status.test.tsx +12 -18
  249. package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +58 -1
  250. package/src/components/editor/chrome/wrapper/footer-items/runtime-settings.tsx +1 -7
  251. package/src/components/editor/chrome/wrapper/pending-ai-cells.tsx +12 -2
  252. package/src/components/editor/chrome/wrapper/storage.ts +1 -1
  253. package/src/components/editor/connections/components.tsx +1 -1
  254. package/src/components/editor/controls/__tests__/command-palette.test.tsx +53 -0
  255. package/src/components/editor/controls/__tests__/keyboard-shortcuts.test.tsx +61 -0
  256. package/src/components/editor/controls/command-palette.tsx +22 -10
  257. package/src/components/editor/controls/keyboard-shortcuts.tsx +14 -5
  258. package/src/components/editor/dynamic-favicon.tsx +21 -40
  259. package/src/components/editor/errors/__tests__/send-error-report-button.test.tsx +12 -23
  260. package/src/components/editor/file-tree/__tests__/file-explorer-interactions.test.tsx +6 -0
  261. package/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx +47 -0
  262. package/src/components/editor/file-tree/__tests__/use-file-search.test.tsx +91 -0
  263. package/src/components/editor/file-tree/file-explorer.tsx +45 -8
  264. package/src/components/editor/file-tree/file-name-input.tsx +1 -0
  265. package/src/components/editor/file-tree/file-viewer.tsx +4 -2
  266. package/src/components/editor/file-tree/use-file-search.ts +35 -21
  267. package/src/components/editor/header/status.tsx +28 -5
  268. package/src/components/editor/links/__tests__/cell-link.test.tsx +146 -0
  269. package/src/components/editor/links/cell-link.tsx +14 -5
  270. package/src/components/editor/navigation/focus-utils.ts +4 -4
  271. package/src/components/editor/notebook-banner.tsx +1 -0
  272. package/src/components/editor/notebook-cell.tsx +11 -2
  273. package/src/components/editor/output/MarimoTracebackOutput.tsx +19 -17
  274. package/src/components/editor/output/__tests__/traceback.test.tsx +27 -1
  275. package/src/components/editor/output/ansi-reduce.ts +33 -20
  276. package/src/components/editor/output/console/ConsoleOutput.tsx +19 -25
  277. package/src/components/editor/package-alert.tsx +14 -7
  278. package/src/components/editor/renderers/grid-layout/grid-layout.tsx +12 -6
  279. package/src/components/editor/renderers/vertical-layout/sidebar/toggle.tsx +7 -1
  280. package/src/components/home/components.tsx +17 -31
  281. package/src/components/icons/__tests__/large-spinner.test.tsx +39 -0
  282. package/src/components/icons/large-spinner.tsx +3 -14
  283. package/src/components/icons/spinner.tsx +1 -1
  284. package/src/components/mcp/mcp-status-indicator.tsx +1 -1
  285. package/src/components/pages/__tests__/home-page.test.tsx +116 -0
  286. package/src/components/pages/home-page.tsx +164 -91
  287. package/src/components/scratchpad/scratchpad.test.tsx +95 -0
  288. package/src/components/scratchpad/scratchpad.tsx +16 -3
  289. package/src/components/slides/reveal-component.tsx +4 -2
  290. package/src/components/slides/slide-cell-view.tsx +1 -1
  291. package/src/components/slides/slide-form.tsx +1 -0
  292. package/src/components/tracing/tracing-keyboard.test.tsx +85 -0
  293. package/src/components/tracing/tracing.tsx +45 -41
  294. package/src/components/ui/__tests__/draggable-popover.test.tsx +24 -0
  295. package/src/components/ui/alert-dialog.tsx +1 -1
  296. package/src/components/ui/draggable-popover.tsx +24 -2
  297. package/src/core/ai/context/providers/datasource.ts +6 -2
  298. package/src/core/ai/tools/base.ts +16 -7
  299. package/src/core/ai/tools/edit-notebook-tool.ts +47 -45
  300. package/src/core/ai/tools/registry.ts +13 -8
  301. package/src/core/ai/tools/sample-tool.ts +6 -7
  302. package/src/core/attachments/state.ts +5 -8
  303. package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +4 -0
  304. package/src/core/cells/__tests__/cell.test.ts +39 -0
  305. package/src/core/cells/__tests__/cells.test.ts +3 -1
  306. package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +54 -0
  307. package/src/core/cells/__tests__/notebook-outline.test.ts +113 -0
  308. package/src/core/cells/__tests__/session.test.ts +117 -36
  309. package/src/core/cells/cell.ts +14 -3
  310. package/src/core/cells/cells.ts +3 -1
  311. package/src/core/cells/pending-delete-service.ts +2 -6
  312. package/src/core/cells/session.ts +1 -1
  313. package/src/core/cells/types.ts +10 -1
  314. package/src/core/codemirror/__tests__/setup.test.ts +29 -29
  315. package/src/core/codemirror/cells/__tests__/extensions.test.ts +15 -0
  316. package/src/core/codemirror/cells/extensions.ts +7 -3
  317. package/src/core/codemirror/keymaps/vim.ts +2 -6
  318. package/src/core/codemirror/language/__tests__/sql.test.ts +22 -20
  319. package/src/core/codemirror/language/extension.ts +8 -8
  320. package/src/core/codemirror/language/languages/markdown.ts +8 -6
  321. package/src/core/codemirror/language/languages/python.ts +16 -10
  322. package/src/core/codemirror/language/languages/sql/sql.ts +9 -7
  323. package/src/core/codemirror/language/panel/panel.tsx +1 -0
  324. package/src/core/codemirror/language/types.ts +7 -7
  325. package/src/core/codemirror/rtc/extension.ts +24 -12
  326. package/src/core/codemirror/rtc/loro/awareness.ts +34 -19
  327. package/src/core/codemirror/rtc/loro/sync.ts +1 -0
  328. package/src/core/codemirror/utils.ts +1 -0
  329. package/src/core/datasets/__tests__/data-source-discovery.test.ts +4 -4
  330. package/src/core/datasets/data-source-discovery.ts +4 -6
  331. package/src/core/document/__tests__/codemirror.test.ts +485 -0
  332. package/src/core/document/__tests__/draft.test.ts +322 -0
  333. package/src/core/document/__tests__/fixtures.ts +92 -0
  334. package/src/core/document/__tests__/hooks.test.tsx +386 -0
  335. package/src/core/document/__tests__/lifecycle-scenarios.test.ts +61 -0
  336. package/src/core/document/__tests__/model.test.ts +191 -0
  337. package/src/core/document/__tests__/protocol-fixtures.ts +38 -0
  338. package/src/core/document/__tests__/recovery-scenarios.test.ts +230 -0
  339. package/src/core/document/__tests__/scenario-fixture.ts +43 -0
  340. package/src/core/document/__tests__/scenarios.test.ts +205 -0
  341. package/src/core/document/__tests__/state.test.ts +438 -0
  342. package/src/core/document/__tests__/submission.test.ts +203 -0
  343. package/src/core/document/__tests__/test-host.test.ts +92 -0
  344. package/src/core/document/__tests__/test-host.ts +247 -0
  345. package/src/core/document/__tests__/test-notebook.ts +149 -0
  346. package/src/core/document/__tests__/user.ts +61 -0
  347. package/src/core/document/codemirror.ts +311 -0
  348. package/src/core/document/draft.ts +472 -0
  349. package/src/core/document/hooks.tsx +118 -0
  350. package/src/core/document/index.ts +15 -0
  351. package/src/core/document/model.ts +55 -0
  352. package/src/core/document/select.ts +41 -0
  353. package/src/core/document/state.ts +374 -0
  354. package/src/core/document/sync.ts +369 -0
  355. package/src/core/host/AGENTS.md +8 -2
  356. package/src/core/host/__tests__/attachments.test.ts +56 -0
  357. package/src/core/host/__tests__/document.test.ts +126 -0
  358. package/src/core/host/__tests__/fixtures.ts +71 -0
  359. package/src/core/host/__tests__/replica.test.ts +550 -0
  360. package/src/core/host/__tests__/static.test.ts +169 -0
  361. package/src/core/host/__tests__/wasm.test.ts +162 -0
  362. package/src/core/host/backend.ts +19 -0
  363. package/src/core/host/connection.ts +1 -40
  364. package/src/core/host/index.ts +14 -0
  365. package/src/core/host/replica.ts +286 -0
  366. package/src/core/host/resources/attachments.ts +22 -0
  367. package/src/core/host/resources/document.ts +101 -0
  368. package/src/core/host/static.ts +72 -0
  369. package/src/core/host/wasm.ts +102 -0
  370. package/src/core/hotkeys/actions.ts +2 -4
  371. package/src/core/islands/__tests__/bootstrap.test.ts +0 -26
  372. package/src/core/islands/bootstrap.ts +0 -1
  373. package/src/core/islands/components/__tests__/IslandControls.test.tsx +7 -5
  374. package/src/core/kernel/__tests__/RuntimeState.test.ts +1 -1
  375. package/src/core/network/connection.ts +4 -2
  376. package/src/core/network/useConnectionNotice.ts +8 -2
  377. package/src/core/runtime/__tests__/createWsUrl.test.ts +77 -7
  378. package/src/core/runtime/__tests__/runtime.test.ts +32 -58
  379. package/src/core/runtime/runtime.ts +38 -42
  380. package/src/core/runtime/types.ts +0 -2
  381. package/src/core/state/__tests__/jotai.test.tsx +108 -0
  382. package/src/core/state/jotai.ts +1 -1
  383. package/src/core/static/__tests__/files.test.ts +38 -10
  384. package/src/core/static/files.ts +2 -0
  385. package/src/core/wasm/bridge.ts +38 -10
  386. package/src/core/wasm/store.ts +3 -3
  387. package/src/core/wasm/worker/bootstrap.ts +2 -1
  388. package/src/core/wasm/worker/getMarimoWheel.ts +1 -1
  389. package/src/core/wasm/worker/types.ts +11 -0
  390. package/src/core/wasm/worker/worker.ts +48 -0
  391. package/src/core/websocket/__tests__/backend.test.ts +200 -0
  392. package/src/core/websocket/__tests__/connection-state.test.ts +0 -12
  393. package/src/core/websocket/__tests__/useNotebookReplica.hook.test.tsx +141 -0
  394. package/src/core/websocket/__tests__/useNotebookSession.hook.test.tsx +154 -428
  395. package/src/core/websocket/backend.ts +106 -0
  396. package/src/core/websocket/connection-state.ts +1 -11
  397. package/src/core/websocket/state.ts +7 -0
  398. package/src/core/websocket/transports/__tests__/notebook.test.ts +445 -0
  399. package/src/core/websocket/transports/notebook.ts +190 -0
  400. package/src/core/websocket/types.ts +2 -2
  401. package/src/core/websocket/useNotebookReplica.ts +69 -0
  402. package/src/core/websocket/useNotebookSession.tsx +10 -22
  403. package/src/css/globals.css +5 -0
  404. package/src/hooks/__tests__/useAsyncData.test.tsx +148 -0
  405. package/src/hooks/__tests__/useDebounce.test.tsx +51 -0
  406. package/src/hooks/__tests__/useDeepCompareMemoize.test.tsx +39 -0
  407. package/src/hooks/__tests__/useDelayElapsed.test.tsx +28 -0
  408. package/src/hooks/__tests__/useInternalStateWithSync.test.tsx +20 -0
  409. package/src/hooks/__tests__/useScript.test.tsx +77 -0
  410. package/src/hooks/__tests__/useStateForKey.test.tsx +257 -0
  411. package/src/hooks/useAsyncData.ts +3 -3
  412. package/src/hooks/useDataSourceDiscovery.ts +6 -4
  413. package/src/hooks/useDebounce.ts +6 -10
  414. package/src/hooks/useDeepCompareMemoize.ts +1 -1
  415. package/src/hooks/useDelayElapsed.ts +14 -10
  416. package/src/hooks/useElapsedTime.ts +3 -3
  417. package/src/hooks/useEventListener.ts +1 -2
  418. package/src/hooks/useInputHistory.ts +4 -7
  419. package/src/hooks/useInternalStateWithSync.ts +6 -6
  420. package/src/hooks/useResizeObserver.ts +4 -7
  421. package/src/hooks/useScript.ts +67 -70
  422. package/src/hooks/useStateForKey.ts +93 -0
  423. package/src/mount.tsx +0 -4
  424. package/src/plugins/__tests__/plugin-object-schemas.test.ts +104 -0
  425. package/src/plugins/core/registerReactComponent.tsx +1 -1
  426. package/src/plugins/impl/CodeEditorPlugin.tsx +1 -1
  427. package/src/plugins/impl/DataEditorPlugin.tsx +1 -1
  428. package/src/plugins/impl/DataTablePlugin.tsx +29 -33
  429. package/src/plugins/impl/DropdownPlugin.tsx +2 -6
  430. package/src/plugins/impl/FileBrowserPlugin.tsx +4 -16
  431. package/src/plugins/impl/FormPlugin.tsx +1 -1
  432. package/src/plugins/impl/RangeSliderPlugin.tsx +0 -1
  433. package/src/plugins/impl/RefreshPlugin.tsx +1 -0
  434. package/src/plugins/impl/SliderPlugin.tsx +6 -8
  435. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +117 -1
  436. package/src/plugins/impl/__tests__/FileBrowserPlugin.test.tsx +45 -0
  437. package/src/plugins/impl/__tests__/SliderPlugin.test.tsx +24 -3
  438. package/src/plugins/impl/anywidget/__tests__/registry.test.ts +2 -0
  439. package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +241 -2
  440. package/src/plugins/impl/anywidget/runtime.ts +21 -9
  441. package/src/plugins/impl/anywidget/widget-binding.ts +160 -82
  442. package/src/plugins/impl/chat/__tests__/chat-prompts.test.tsx +93 -0
  443. package/src/plugins/impl/chat/chat-ui.tsx +14 -11
  444. package/src/plugins/impl/code/any-language-editor.tsx +2 -2
  445. package/src/plugins/impl/data-editor/glide-data-editor.tsx +8 -5
  446. package/src/plugins/impl/data-editor/glide-utils.ts +3 -1
  447. package/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx +1 -1
  448. package/src/plugins/impl/data-explorer/components/column-summary.tsx +4 -2
  449. package/src/plugins/impl/data-explorer/state/reducer.ts +1 -1
  450. package/src/plugins/impl/data-frames/DataFramePlugin.tsx +1 -2
  451. package/src/plugins/impl/data-frames/__tests__/sidebar.test.tsx +160 -0
  452. package/src/plugins/impl/data-frames/forms/__tests__/__snapshots__/form.test.tsx.snap +66 -66
  453. package/src/plugins/impl/data-frames/panel.tsx +43 -16
  454. package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +5 -3
  455. package/src/plugins/impl/panel/PanelPlugin.tsx +16 -17
  456. package/src/plugins/impl/panel/__tests__/utils.test.ts +39 -1
  457. package/src/plugins/impl/panel/utils.ts +17 -0
  458. package/src/plugins/impl/plotly/PlotlyPlugin.tsx +2 -5
  459. package/src/plugins/impl/plotly/selection.ts +25 -19
  460. package/src/plugins/impl/vega/VegaPlugin.tsx +2 -3
  461. package/src/plugins/impl/vega/make-selectable.ts +4 -7
  462. package/src/plugins/layout/RoutesPlugin.tsx +1 -1
  463. package/src/stories/__tests__/editor-story.test.tsx +33 -0
  464. package/src/stories/button.stories.tsx +1 -0
  465. package/src/stories/editor.stories.tsx +24 -17
  466. package/src/stories/form-wrapper.stories.tsx +2 -2
  467. package/src/stories/select.stories.tsx +2 -2
  468. package/src/stories/switchable-multi-select.stories.tsx +1 -1
  469. package/src/utils/__tests__/arrays.test.ts +35 -0
  470. package/src/utils/__tests__/batch-requests.test.ts +3 -3
  471. package/src/utils/__tests__/numbers.test.ts +48 -1
  472. package/src/utils/__tests__/objects.test.ts +21 -0
  473. package/src/utils/arrays.ts +10 -0
  474. package/src/utils/blob.ts +1 -1
  475. package/src/utils/numbers.ts +28 -17
  476. package/src/utils/objects.ts +3 -7
  477. package/src/utils/once.ts +19 -19
  478. package/src/utils/tracer.ts +9 -5
  479. package/src/utils/zod-utils.ts +1 -3
  480. package/dist/assets/CellStatus-DVOHpdeJ.js +0 -1
  481. package/dist/assets/JsonOutput-Cx1iyibB.js +0 -11
  482. package/dist/assets/MarimoErrorOutput-s_5GOX8k.js +0 -10
  483. package/dist/assets/RunButton-BKoh0zYG.js +0 -1
  484. package/dist/assets/__vite-browser-external-CYO_P3S8.js +0 -1
  485. package/dist/assets/__vite-browser-external-FeDVGZU8.js +0 -1
  486. package/dist/assets/ai-model-dropdown-i1vfGeVi.js +0 -13
  487. package/dist/assets/alert-dialog-BaPGzeOK.js +0 -1
  488. package/dist/assets/any-language-editor-BdTWdMCI.js +0 -1
  489. package/dist/assets/arrays-BqUx5USx.js +0 -1
  490. package/dist/assets/cell-editor-BKJ06H5F.js +0 -21
  491. package/dist/assets/cell-link-8Auigi8P.js +0 -1
  492. package/dist/assets/cells-C6YGYGdi.js +0 -220
  493. package/dist/assets/chat-panel-Cau71Ygr.js +0 -4
  494. package/dist/assets/chat-ui-C5ql1Up-.js +0 -4
  495. package/dist/assets/circle-DXf-VWZG.js +0 -1
  496. package/dist/assets/circle-play-CYIb0qT6.js +0 -1
  497. package/dist/assets/column-preview-BZ_iNhtJ.js +0 -1
  498. package/dist/assets/command-palette-DDC3kBet.js +0 -1
  499. package/dist/assets/components-YBmtV0p6.js +0 -1
  500. package/dist/assets/config-DRIpOKqh.js +0 -1
  501. package/dist/assets/config-Dy28fDwn.js +0 -1
  502. package/dist/assets/dist-iaThVDkA.js +0 -1
  503. package/dist/assets/download-C03FOElq.js +0 -9
  504. package/dist/assets/dropdown-menu-C1rnl-0o.js +0 -1
  505. package/dist/assets/edit-page-D_Rg0gQO.js +0 -9
  506. package/dist/assets/feedback-button-Kla7i5RT.js +0 -1
  507. package/dist/assets/file-explorer-panel-Uk4_QIJQ.js +0 -1
  508. package/dist/assets/floating-outline-B5MaM1JS.js +0 -1
  509. package/dist/assets/fullscreen-B9tHcfpV.js +0 -41
  510. package/dist/assets/home-page-hmvKlc1w.js +0 -4
  511. package/dist/assets/index-6b4mf8Ai.css +0 -2
  512. package/dist/assets/index-ptK1gxmo.js +0 -30
  513. package/dist/assets/kiosk-mode-BZECfg9k.js +0 -1
  514. package/dist/assets/linear-0eij_aAG.js +0 -1
  515. package/dist/assets/link-NuFVR7G9.js +0 -1
  516. package/dist/assets/links-DkkL9DVa.js +0 -1
  517. package/dist/assets/menu-items-BrwnTgyK.js +0 -1
  518. package/dist/assets/numbers-Mk3-CcoU.js +0 -1
  519. package/dist/assets/packages-panel-CI5ff9b-.js +0 -1
  520. package/dist/assets/panels-BCcZ_yLK.js +0 -107
  521. package/dist/assets/precisionRound-Bq_nmf5u.js +0 -1
  522. package/dist/assets/process-output-f3C3PD0Z.js +0 -1
  523. package/dist/assets/react-vega-C3rYGtP6.js +0 -189
  524. package/dist/assets/requests-CgSY1X4a.js +0 -1
  525. package/dist/assets/run-page-AfZhtEh1.js +0 -1
  526. package/dist/assets/scratchpad-panel-D2rWg4k8.js +0 -1
  527. package/dist/assets/secrets-panel-D7KN4tVs.js +0 -1
  528. package/dist/assets/select-DTBn5eTb.js +0 -1
  529. package/dist/assets/session-panel-CnANhcTo.js +0 -1
  530. package/dist/assets/snippets-panel-ClGHtEKQ.js +0 -1
  531. package/dist/assets/state-BAJYRhmO.js +0 -1
  532. package/dist/assets/state-CbjBtkdd.js +0 -3
  533. package/dist/assets/switch-CTaiAjrz.js +0 -1
  534. package/dist/assets/tabs-BuQlZFbt.js +0 -1
  535. package/dist/assets/toast-BGzLGnvw.js +0 -1
  536. package/dist/assets/tooltip-C9TuY18o.js +0 -1
  537. package/dist/assets/tooltip-mT3CGest.js +0 -61
  538. package/dist/assets/tracing-Dz2rYOFL.js +0 -1
  539. package/dist/assets/tracing-panel-DqQY9V91.js +0 -2
  540. package/dist/assets/use-restore-focus-BxEGwIbk.js +0 -1
  541. package/dist/assets/useAsyncData-C7aJJz0Y.js +0 -1
  542. package/dist/assets/useBoolean-d0Tty94N.js +0 -1
  543. package/dist/assets/useCellActionButton-DmaFZ4oF.js +0 -1
  544. package/dist/assets/useDebounce-B_ccBZTp.js +0 -1
  545. package/dist/assets/useNotebookActions-DHt3s-ia.js +0 -1
  546. package/dist/assets/vega-component-IouMe13t.js +0 -1
  547. package/dist/assets/vega-loader.browser-CLRkNgm7.js +0 -6
  548. package/dist/assets/worker-DTQ7oH2A.js +0 -158
  549. package/dist/assets/ws-BXWY541V.js +0 -22
  550. package/src/core/host/__tests__/events.test.ts +0 -46
  551. package/src/core/host/__tests__/notebook-client.test.ts +0 -191
  552. package/src/core/host/__tests__/protocol.test.ts +0 -214
  553. package/src/core/host/events.ts +0 -60
  554. package/src/core/host/notebook-client.ts +0 -226
  555. package/src/core/host/protocol.ts +0 -1943
  556. package/src/core/state/__tests__/jotai.test.ts +0 -25
  557. package/src/core/websocket/__tests__/createConnectionTransport.test.ts +0 -49
  558. package/src/core/websocket/__tests__/useNotebookClient.hook.test.tsx +0 -140
  559. package/src/core/websocket/transports/__tests__/basic.test.ts +0 -275
  560. package/src/core/websocket/transports/__tests__/sse.test.ts +0 -335
  561. package/src/core/websocket/transports/__tests__/transport.test.ts +0 -308
  562. package/src/core/websocket/transports/__tests__/ws.test.ts +0 -125
  563. package/src/core/websocket/transports/basic.ts +0 -102
  564. package/src/core/websocket/transports/create.ts +0 -31
  565. package/src/core/websocket/transports/sse.ts +0 -308
  566. package/src/core/websocket/transports/transport.ts +0 -50
  567. package/src/core/websocket/transports/ws.ts +0 -98
  568. package/src/core/websocket/useNotebookClient.ts +0 -80
@@ -1,158 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),l=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});function u(e){return e}function d(e,t){let n=e.map(e=>`"${e}"`).join(`, `);return Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${n}`)}function f(e={}){let t={};function n(e){t=e}let r={};function i(e){r.unregisterHandler&&r.unregisterHandler(),r=e,r.registerHandler?.(oe)}let a;function o(e){if(typeof e==`function`){a=e;return}a=(t,n)=>{let r=e[t];if(r)return r(n);let i=e._;if(!i)throw Error(`The requested method has no handler: ${t}`);return i(t,n)}}let{maxRequestTime:s=1e3}=e;e.transport&&i(e.transport),e.requestHandler&&o(e.requestHandler),e._debugHooks&&n(e._debugHooks);let c=0;function l(){return c<=1e10?++c:c=0}let u=new Map,f=new Map;function p(e,...n){let i=n[0];return new Promise((n,a)=>{if(!r.send)throw d([`send`],`make requests`);let o=l(),c={type:`request`,id:o,method:e,params:i};u.set(o,{resolve:n,reject:a}),s!==1/0&&f.set(o,setTimeout(()=>{f.delete(o),a(Error(`RPC request timed out.`))},s)),t.onSend?.(c),r.send(c)})}let m=new Proxy(p,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>p(t,e)}),h=m;function ee(e,...n){let i=n[0];if(!r.send)throw d([`send`],`send messages`);let a={type:`message`,id:e,payload:i};t.onSend?.(a),r.send(a)}let te=new Proxy(ee,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>ee(t,e)}),ne=te,g=new Map,re=new Set;function ie(e,t){if(!r.registerHandler)throw d([`registerHandler`],`register message listeners`);if(e===`*`){re.add(t);return}g.has(e)||g.set(e,new Set),g.get(e)?.add(t)}function ae(e,t){if(e===`*`){re.delete(t);return}g.get(e)?.delete(t),g.get(e)?.size===0&&g.delete(e)}async function oe(e){if(t.onReceive?.(e),!(`type`in e))throw Error(`Message does not contain a type.`);if(e.type===`request`){if(!r.send||!a)throw d([`send`,`requestHandler`],`handle requests`);let{id:n,method:i,params:o}=e,s;try{s={type:`response`,id:n,success:!0,payload:await a(i,o)}}catch(e){if(!(e instanceof Error))throw e;s={type:`response`,id:n,success:!1,error:e.message}}t.onSend?.(s),r.send(s);return}if(e.type===`response`){let t=f.get(e.id);t!=null&&clearTimeout(t);let{resolve:n,reject:r}=u.get(e.id)??{};e.success?n?.(e.payload):r?.(Error(e.error));return}if(e.type===`message`){for(let t of re)t(e.id,e.payload);let t=g.get(e.id);if(!t)return;for(let n of t)n(e.payload);return}throw Error(`Unexpected RPC message type: ${e.type}`)}return{setTransport:i,setRequestHandler:o,request:m,requestProxy:h,send:te,sendProxy:ne,addMessageListener:ie,removeMessageListener:ae,proxy:{send:ne,request:h},_setDebugHooks:n}}function p(e){return f(e)}const m=`[transport-id]`;function h(e,t){let{transportId:n}=t;return n==null?e:{[m]:n,data:e}}function ee(e,t){let{transportId:n,filter:r}=t,i=r?.();if(n!=null&&i!=null)throw Error("Cannot use both `transportId` and `filter` at the same time");let a=e;if(n){if(e[m]!==n)return[!0];a=e.data}return i===!1?[!0]:[!1,a]}function te(e,t={}){let{transportId:n,filter:r,remotePort:i}=t,a=e,o=i??e,s;return{send(e){o.postMessage(h(e,{transportId:n}))},registerHandler(e){s=t=>{let i=t.data,[a,o]=ee(i,{transportId:n,filter:()=>r?.(t)});a||e(o)},a.addEventListener(`message`,s)},unregisterHandler(){s&&a.removeEventListener(`message`,s)}}}function ne(e){return te(self,e)}function g(e,t){if(!e)throw Error(t)}function re(e){let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}}const ie={NOOP:()=>{},ASYNC_NOOP:async()=>{},THROW:()=>{throw Error(`Should not be called`)},asUpdater:e=>typeof e==`function`?e:()=>e,identity:e=>e},ae=(e,t)=>{let n=`[${e}]`;return{debug:(...e)=>console.debug(n,...e),log:(...e)=>t.log(n,...e),warn:(...e)=>t.warn(n,...e),error:(...e)=>t.error(n,...e),trace:(...e)=>t.trace(n,...e),get:n=>ae(`${e}:${n}`,t),disabled:(e=!0)=>e?se:t}},oe={debug:(...e)=>{console.debug(...e)},log:(...e)=>{console.log(...e)},warn:(...e)=>{console.warn(...e)},error:(...e)=>{console.error(...e)},trace:(...e)=>{console.trace(...e)},get:e=>ae(`marimo:${e}`,oe),disabled:(e=!0)=>e?se:oe},se={debug:()=>ie.NOOP,log:()=>ie.NOOP,warn:()=>ie.NOOP,error:()=>ie.NOOP,trace:()=>ie.NOOP,get:()=>se,disabled:()=>se};function ce(){return typeof window<`u`&&window.Logger||oe}const _=ce(),le=e=>new TextDecoder().decode(e);var ue=class{promise;resolve;reject;status=`pending`;value=void 0;constructor(){this.promise=new Promise((e,t)=>{this.reject=e=>{this.status=`rejected`,t(e)},this.resolve=t=>{this.status=`resolved`,de(t)||(this.value=t),e(t)}})}};function de(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function fe(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function pe(e,t=`|`){return e.map(e=>Me(e)).join(t)}function me(e,t){return typeof t==`bigint`?t.toString():t}var he=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ge(e){return new he(e)}function _e(e){return e==null}function ve(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function v(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ye(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function y(e){return ye(e._zod.def)??e._zod.def.shape}function be(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return v(this,t,e),e},enumerable:!0,configurable:!0})}function xe(e,t,n){t in e?v(e,t,n):e[t]=n}function b(e,t,n,r){let i=y(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?be(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):xe(e,a,r?r(n.value,a):n.value))}}function Se(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?be(e,n,()=>t[n]):xe(e,n,r.value))}}function x(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Ce(e){return JSON.stringify(e)}function we(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Te=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ee(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const De=ge(()=>{if(A.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Oe(e){if(Ee(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Ee(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ke(e){return Oe(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Ae=new Set([`string`,`number`,`symbol`]);function je(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function S(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function C(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Me(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ne(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const Pe={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Fe={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Ie(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return b(i,e,Le(e,t)),S(e,x(n,{shape:i,checks:[]}))}function Le(e,t){let n=y(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Re(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Le(e,t)),a={};return b(a,e,Reflect.ownKeys(y(e)).filter(e=>!i.has(e))),S(e,x(n,{shape:a,checks:[]}))}function ze(e,t){if(!Oe(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=y(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return S(e,x(e._zod.def,{shape:Be(e,t)}))}function Be(e,t){let n={};return b(n,e,Reflect.ownKeys(y(e))),Se(n,t),n}function Ve(e,t){if(!Oe(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return S(e,x(e._zod.def,{shape:Be(e,t)}))}function He(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return b(n,e,Reflect.ownKeys(y(e))),b(n,t,Reflect.ownKeys(y(t))),S(e,x(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Ue(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Le(t,n)):void 0,o={};return b(o,t,Reflect.ownKeys(y(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),S(t,x(t._zod.def,{shape:o,checks:[]}))}function We(e,t,n){let r=n?new Set(Le(t,n)):void 0,i={};return b(i,t,Reflect.ownKeys(y(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),S(t,x(t._zod.def,{shape:i}))}function w(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ge(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Ke(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function qe(e){return typeof e==`string`?e:e?.message}function Je(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function T(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:qe(e.inst?._zod.def?.error?.(e))??qe(a?.(e))??qe(t?.error?.(e))??qe(n.customError?.(e))??qe(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}const Ye=/[\uD800-\uDBFF]/;function Xe(e){let t=e.length;if(!Ye.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Ze(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Qe(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function $e(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function et(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):rt(e,n,r.value)}}function E(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function tt(e,t,n){return E(e,t,n,!1)}function nt(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return E(this,n,r(this))},set(e){E(this,n,e)}})}return t}function rt(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:E(this,t,n.bind(this))},set(e){E(this,t,e)}})}function it(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let at,ot=!1;const st={configurable:!0,get(){ot=!0}};function D(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&at!==e._zod){at=void 0;return}at=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,st);let e=ot;ot=!1;try{let r=n(this);return ot?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),ot||=e,r}catch(n){throw delete this[t],ot||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function ct(e,t,n,r){let i=it(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}function lt(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var ut;const dt={value:void 0,enumerable:!1};let ft=`captureStackTrace`in Error?Error:null;function pt(e){let t=ft;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ft=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function O(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){dt.value=new a(r);try{Object.defineProperty(n,"_zod",dt)}finally{dt.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),et(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?pt(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var k=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},mt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ut=globalThis).__zod_globalConfig??(ut.__zod_globalConfig={});const A=globalThis.__zod_globalConfig;function j(e){return e&&Object.assign(A,e),A}function ht(){let e=this._zod;return e.message??=JSON.stringify(e.def,me,2),e.message}function gt(e){this._zod.message=e}const _t={get:ht,set:gt,enumerable:!0,configurable:!0},vt={value:void 0,enumerable:!1},yt=new WeakSet([Object.prototype,Error.prototype]),bt=(e,t)=>{e.name=`$ZodError`,vt.value=t,Object.defineProperty(e,"issues",vt),vt.value=void 0,Object.defineProperty(e,"message",_t);let n=Object.getPrototypeOf(e);yt.has(n)||(yt.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},xt=O(`$ZodError`,bt);O(`$ZodError`,bt,void 0,{Parent:Error});function St(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Ct(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?St(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function wt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Tt(e,t){return{callee:t?.callee??e,Err:t?.Err}}const Et=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new k;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>T(e,o,j())));throw Te(n,a?.callee??t),n}return s.value};return t},Dt=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>T(e,o,j())));throw Te(n,a?.callee??t),n}return s.value};return t},Ot=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new k;return a.issues.length?kt(e,a.issues,i):{success:!0,data:a.value}};function kt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>T(e,n,j()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const At=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?kt(e,a.issues,i):{success:!0,data:a.value}},jt=Symbol.for(`zod.compile.invalid`),Mt=Symbol.for(`zod.compile.fallback`),Nt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==jt)return!0;if(r.definite===!0&&n===void 0)return!1}return Pt(e,t,n)});function Pt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Mt]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new k;return a.issues.length===0}const Ft=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},It=e=>{let t=Et(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Tt(n,a))};return n},Lt=e=>{let t=Et(e),n=(e,r,i,a)=>t(e,r,i,Tt(n,a));return n},Rt=e=>{let t=Dt(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Tt(n,a))};return n},zt=e=>{let t=Dt(e),n=async(e,r,i,a)=>await t(e,r,i,Tt(n,a));return n},Bt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ot(e)(t,n,i)},Vt=e=>(t,n,r)=>Ot(e)(t,n,r),Ht=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return At(e)(t,n,i)},Ut=e=>async(t,n,r)=>At(e)(t,n,r),Wt=/^[cC][0-9a-z]{6,}$/,Gt=/^[0-9a-z]+$/,Kt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,qt=/^[0-9a-vA-V]{20}$/,Jt=/^[A-Za-z0-9]{27}$/,Yt=/^[a-zA-Z0-9_-]{21}$/;function Xt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const Zt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Qt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$t=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,en=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function tn(){return RegExp(`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const nn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,an=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,on=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ln=/^https?$/,un=/^\+[1-9]\d{6,14}$/,dn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function fn(e){return RegExp(`^${e}$`)}const pn=fn(dn);function mn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function hn(e){return RegExp(`^${mn(e)}$`)}function gn(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${mn({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${mn({precision:e.precision})}`:n;return RegExp(`^${dn}T(?:${r})$`)}const _n=/^[\s\S]{0,}$/,vn=/^[^A-Z]*$/,yn=/^[^a-z]*$/,M=O(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bn=e=>{let t=e.value;return!_e(t)&&t.length!==void 0},xn=O(`$ZodCheckMaxLength`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=bn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Xe(r):i)<=t.maximum)return;let a=Ze(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Sn=O(`$ZodCheckMinLength`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=bn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Xe(r):i)>=t.minimum)return;let a=Ze(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cn=O(`$ZodCheckLengthEquals`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=bn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Xe(r):i;if(a===t.length)return;let o=Ze(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),wn=O(`$ZodCheckStringFormat`,(e,t)=>{var n,r;M.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Tn=O(`$ZodCheckRegex`,(e,t)=>{wn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),En=O(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=vn,wn.init(e,t)}),Dn=O(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=yn,wn.init(e,t)}),On=O(`$ZodCheckIncludes`,(e,t)=>{M.init(e,t);let n=je(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),kn=O(`$ZodCheckStartsWith`,(e,t)=>{M.init(e,t);let n=RegExp(`^${je(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),An=O(`$ZodCheckEndsWith`,(e,t)=>{M.init(e,t);let n=RegExp(`.*${je(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),jn=O(`$ZodCheckOverwrite`,(e,t)=>{M.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Mn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
- `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
3
- `)}\n};`)(...Object.values(this.closed))}};const Nn={major:4,minor:6,patch:5},N=O(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Nn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=w(t),a;for(let o of n){if(o._zod.def.when){if(Ge(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new k;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Je(t.issues,n,e),i||=w(t,n))});else{if(t.issues.length===n)continue;Je(t.issues,n,e),i||=w(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(w(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new k;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return tt(this,`~standard`,In(this))},set"~standard"(e){E(this,`~standard`,e)}}),Pn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>T(e,t,j()))}:{value:e.value};async function Fn(e,t){let n={async:!0};return Pn(await e._zod.run({value:t,issues:[]},n),n)}function In(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Pn(r,n)}catch{}return Fn(e,t)},vendor:`zod`,version:1}}const Ln=O(`$ZodString`,(e,t)=>{N.init(e,t),e._zod.pattern=t.pattern??_n,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),P=O(`$ZodStringFormat`,(e,t)=>{wn.init(e,t),Ln.init(e,t)}),Rn=O(`$ZodGUID`,(e,t)=>{t.pattern??=Qt,P.init(e,t)}),zn=O(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=$t(e)}else t.pattern??=$t();P.init(e,t)}),Bn=O(`$ZodEmail`,(e,t)=>{t.pattern??=en,P.init(e,t)});function Vn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Hn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Vn(e)||2:Un(e,t)}function Un(e,t){if(!t.normalize&&t.protocol?.source===ln.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}const Wn=/[\t\n\r]/g;function Gn(e){return e.replace(Wn,``)}function Kn(e,t){return t.lastIndex=0,t.test(e.hostname)}function qn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const Jn=O(`$ZodURL`,(e,t)=>{P.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Hn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Gn(r);return}t.hostname&&!Kn(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!qn(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Gn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Yn=O(`$ZodEmoji`,(e,t)=>{t.pattern??=tn(),P.init(e,t)}),Xn=O(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Yt:Xt(t.length),P.init(e,t)}),Zn=O(`$ZodCUID`,(e,t)=>{t.pattern??=Wt,P.init(e,t)}),Qn=O(`$ZodCUID2`,(e,t)=>{t.pattern??=Gt,P.init(e,t)}),$n=O(`$ZodULID`,(e,t)=>{t.pattern??=Kt,P.init(e,t)}),er=O(`$ZodXID`,(e,t)=>{t.pattern??=qt,P.init(e,t)}),tr=O(`$ZodKSUID`,(e,t)=>{t.pattern??=Jt,P.init(e,t)}),nr=O(`$ZodISODateTime`,(e,t)=>{t.pattern??=gn(t),P.init(e,t)}),rr=O(`$ZodISODate`,(e,t)=>{t.pattern??=pn,P.init(e,t)}),ir=O(`$ZodISOTime`,(e,t)=>{t.pattern??=hn(t),P.init(e,t)}),ar=O(`$ZodISODuration`,(e,t)=>{t.pattern??=Zt,P.init(e,t)}),or=O(`$ZodIPv4`,(e,t)=>{t.pattern??=nn,P.init(e,t)}),sr=/^[0-9a-fA-F:.]+$/;function cr(e){return sr.test(e)?Vn(`http://[${e}]`):!1}const lr=O(`$ZodIPv6`,(e,t)=>{t.pattern??=rn,P.init(e,t),e._zod.check=n=>{cr(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),ur=O(`$ZodCIDRv4`,(e,t)=>{t.pattern??=an,P.init(e,t)});function dr(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:cr(n)}const fr=O(`$ZodCIDRv6`,(e,t)=>{t.pattern??=on,P.init(e,t),e._zod.check=n=>{dr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function pr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const mr=/^[0-9a-zA-Z+/]*={0,2}$/,hr=O(`$ZodBase64`,(e,t)=>{t.pattern??=mr,P.init(e,t),e._zod.check=n=>{pr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),gr=/^[A-Za-z0-9_-]*$/;function _r(e){if(!gr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return pr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const vr=O(`$ZodBase64URL`,(e,t)=>{t.pattern??=gr,P.init(e,t),e._zod.check=n=>{_r(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),yr=O(`$ZodE164`,(e,t)=>{t.pattern??=un,P.init(e,t)});function br(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const xr=O(`$ZodJWT`,(e,t)=>{P.init(e,t),e._zod.check=n=>{br(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Sr=O(`$ZodUnknown`,(e,t)=>{N.init(e,t),e._zod.parse=e=>e}),Cr=O(`$ZodNever`,(e,t)=>{N.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function wr(e,t,n){e.issues.length&&t.issues.push(...Ke(n,e.issues)),t.value[n]=e.value}const Tr=O(`$ZodArray`,(e,t)=>{N.init(e,t);let n=A.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>wr(t,r,e)));else if(wr(c,r,e),s&&c.issues.length!==0&&w(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Er(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Ke(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}const Dr=[];function Or(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Dr,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Ne(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function kr(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(w(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Er(e,n,i,t,d,f))):Er(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const Ar=O(`$ZodObject`,(e,t)=>{N.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=ge(()=>Or(t));D(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||v(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Ee,o=t.catchall,s,c=A.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(w(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Er(n,t,e,r,a,o))):Er(s,t,e,r,a,o)}return o?kr(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),jr=O(`$ZodObjectJIT`,(e,t)=>{Ar.init(e,t);let n=e._zod.parse,r=ge(()=>Or(t)),i=A.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Mn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
4
- let ${e}_ab = false;
5
- for (let i = 0; i < ${e}.issues.length; i++) {
6
- const iss = ${e}.issues[i];
7
- iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
8
- payload.issues.push(iss);
9
- if (iss.continue !== true) ${e}_ab = true;
10
- }
11
- if (${e}_ab && ctx && ctx.abortEarly) {
12
- payload.value = newResult;
13
- return payload;
14
- }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Ce(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
15
- const ${n}_present = ${i};
16
- if (!${n}.issues.length || ${n}_present) {
17
- if (${n}.issues.length) {${c(n,r)}
18
- }
19
-
20
- if (${e}) {
21
- newResult[${r}] = ${n}.value;
22
- }
23
- }
24
-
25
- `)}else f?(o.write(`
26
- if (${n}.issues.length) {${c(n,r)}
27
- }
28
- `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
29
- if (${n}.value !== undefined || ${i}) {
30
- newResult[${r}] = ${n}.value;
31
- }
32
- `)):o.write(`
33
- const ${n}_present = ${i};
34
- if (${n}.issues.length) {${c(n,r)}
35
- }
36
- if (!${n}_present && !${n}.issues.length) {
37
- payload.issues.push({
38
- code: "invalid_type",
39
- expected: "nonoptional",
40
- input: undefined,
41
- path: [${r}]
42
- });
43
- if (ctx && ctx.abortEarly) {
44
- payload.value = newResult;
45
- return payload;
46
- }
47
- }
48
-
49
- if (${n}_present) {
50
- newResult[${r}] = ${n}.value;
51
- }
52
-
53
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Ee,c=!A.jitless,l=c&&De.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?kr([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Mr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!w(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>T(e,r,j())))}),t)}const Nr=O(`$ZodUnion`,(e,t)=>{N.init(e,t),D(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),D(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),D(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),D(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>ve(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Mr(t,r,e,i)):Mr(o,r,e,i)}}),Pr=O(`$ZodIntersection`,(e,t)=>{N.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ir(e,t,n)):Ir(e,i,a)}});function Fr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Oe(e)&&Oe(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Fr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Fr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ir(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Fr(t.value,n.value);if(!c.valid){if(w(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const Lr=O(`$ZodEnum`,(e,t)=>{N.init(e,t);let n=fe(t.entries),r=new Set(n);e._zod.values=r,D(e,`pattern`,e=>{let t=fe(e.def.entries).filter(e=>Ae.has(typeof e));return RegExp(t.length?`^(${t.map(e=>je(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Rr=O(`$ZodTransform`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,A.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new mt(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new k;return n.value=i,n}});function zr(e,t){return e.value=t.issues.length?void 0:t.value,e}const Br=O(`$ZodOptional`,(e,t)=>{N.init(e,t),D(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,D(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),D(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ve(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>zr(e,t)):zr(e,r)}return t.innerType._zod.run(e,n)}}),Vr=O(`$ZodExactOptional`,(e,t)=>{Br.init(e,t),D(e,`values`,e=>e.def.innerType._zod.values),D(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Hr=O(`$ZodNullable`,(e,t)=>{N.init(e,t),D(e,`optin`,e=>e.def.innerType._zod.optin),D(e,`optout`,e=>e.def.innerType._zod.optout),D(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ve(t.source)}|null)$`):void 0}),D(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Ur=O(`$ZodDefault`,(e,t)=>{N.init(e,t),e._zod.optin=`defaulted`,D(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Wr(e,t)):Wr(r,t)}});function Wr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Gr=O(`$ZodPrefault`,(e,t)=>{N.init(e,t),e._zod.optin=`defaulted`,D(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Kr=O(`$ZodNonOptional`,(e,t)=>{N.init(e,t),D(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>qr(t,e)):qr(i,e)}});function qr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Jr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>T(e,r,j()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Yr=O(`$ZodCatch`,(e,t)=>{N.init(e,t),D(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),D(e,`optout`,e=>e.def.innerType._zod.optout),D(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Jr(e,r,t,n)):Jr(e,r,t,n)}}),Xr=O(`$ZodPipe`,(e,t)=>{N.init(e,t),D(e,`values`,e=>e.def.in._zod.values),D(e,`optin`,e=>e.def.in._zod.optin),D(e,`optout`,e=>e.def.out._zod.optout),D(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Zr(e,t.in,n)):Zr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Zr(e,t.out,n)):Zr(r,t.out,n)}});function Zr(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Qr=O(`$ZodReadonly`,(e,t)=>{N.init(e,t),D(e,`propValues`,e=>e.def.innerType._zod.propValues),D(e,`values`,e=>e.def.innerType._zod.values),D(e,`optin`,e=>e.def.innerType?._zod?.optin),D(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then($r):$r(r)}});function $r(e){return e.memo||(e.value=Object.freeze(e.value)),e}const ei=O(`$ZodCustom`,(e,t)=>{M.init(e,t),N.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ti(t,n,r,e));ti(i,n,r,e)}});function ti(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push($e(e))}}var ni=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};const ri=`~memo`,ii=[];function ai(e){return typeof e==`object`&&!!e}function oi(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const si=new WeakMap;function ci(e,t,n){let r=si.get(e);if(r!==void 0)return r?2:0;if(t.has(e))return 2;t.add(e);let i=0,a=e=>{if(i!==2&&e?._zod){let r=ci(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=0;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?1:o.value?._zod?ci(o.value,t,n):0;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ye(c);s(e?o(e,!0):1),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?ci(r,t,!1):1);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),li(e,i)}function li(e,t){return t!==1&&si.set(e,t===2),t}function ui(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}let di;const fi=[],pi={alloc(e,t,n){let r=di;if(!r)return n;di=void 0;let i={value:n,issues:null};return r.set(t.value,i),fi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&hi(n,e.value))throw new ni;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=ci(e,new Set,!1);if(i===0)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===2||r?n=!0:r=!0}let l=s.value;if(!ai(l))return t(s,c);let u=c[ri];u||(u={buckets:new WeakMap,backEdges:void 0},c[ri]=u);let d;i===c?d=a:(d=ui(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...oi(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;di=d;let p=fi.length,m=t(s,c);di=void 0;let h=fi.length>p?fi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?oi(e.issues):ii),e)):(h&&(h.issues=m.issues.length?oi(m.issues):ii),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function mi(){return pi}function hi(e,t){let n=e[ri]?.backEdges;return n!==void 0&&ai(t)&&n.has(t)}const gi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Qe(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Me(e.values[0])}`:`Invalid option: expected one of ${pe(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${pe(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function _i(){return{localeError:gi()}}var vi,yi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function bi(){return new yi}(vi=globalThis).__zod_globalRegistry??(vi.__zod_globalRegistry=bi());const xi=globalThis.__zod_globalRegistry;function Si(e){return e.checks&&=[...e.checks],e}function Ci(e,t){return new e(Si({type:`string`,...C(t)}))}function wi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...C(t)})}function Ti(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...C(t)})}function Ei(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...C(t)})}function Di(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...C(t)})}function Oi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...C(t)})}function ki(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...C(t)})}function Ai(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...C(t)})}function ji(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...C(t)})}function Mi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...C(t)})}function Ni(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...C(t)})}function Pi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...C(t)})}function Fi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...C(t)})}function Ii(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...C(t)})}function Li(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...C(t)})}function Ri(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...C(t)})}function zi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...C(t)})}function Bi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...C(t)})}function Vi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...C(t)})}function Hi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...C(t)})}function Ui(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...C(t)})}function Wi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...C(t)})}function Gi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...C(t)})}function Ki(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...C(t)})}function qi(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...C(t)})}function Ji(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...C(t)})}function Yi(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...C(t)})}function Xi(e){return new e({type:`unknown`})}function Zi(e,t){return new e({type:`never`,...C(t)})}function Qi(e,t){return new xn({check:`max_length`,...C(t),maximum:e})}function $i(e,t){return new Sn({check:`min_length`,...C(t),minimum:e})}function ea(e,t){return new Cn({check:`length_equals`,...C(t),length:e})}function ta(e,t){return new Tn({check:`string_format`,format:`regex`,...C(t),pattern:e})}function na(e){return new En({check:`string_format`,format:`lowercase`,...C(e)})}function ra(e){return new Dn({check:`string_format`,format:`uppercase`,...C(e)})}function ia(e,t){return new On({check:`string_format`,format:`includes`,...C(t),includes:e})}function aa(e,t){return new kn({check:`string_format`,format:`starts_with`,...C(t),prefix:e})}function oa(e,t){return new An({check:`string_format`,format:`ends_with`,...C(t),suffix:e})}function sa(e){return new jn({check:`overwrite`,tx:e})}function ca(e){return sa(t=>t.normalize(e))}function la(){return sa(e=>e.trim())}function ua(){return sa(e=>e.toLowerCase())}function da(){return sa(e=>e.toUpperCase())}function fa(){return sa(e=>we(e))}function pa(e,t,n){return new e({type:`array`,element:t,...C(n)})}function ma(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...C(n)})}function ha(e,t){let n=ga(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push($e(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push($e(r))}},e(t.value,t)),t);return n}function ga(e,t){let n=new M({check:`custom`,...C(t)});return n._zod.check=e,n}function _a(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&v(e,t,n[t]);return e}function va(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??xi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function ya(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function F(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,F(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&_a(o.schema,c),t.io===`input`&&I(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ba(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function xa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${ba(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+ba(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
54
-
55
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Sa(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Sa(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const Ca=new Set([`type`,`properties`,`required`,`additionalProperties`]),wa=[`oneOf`,`anyOf`];function Ta(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ea(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ca.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ta(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}v(n,r,e.length===1?e[0]:Ea(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ta(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Da(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ca)if(t in e)return;let n=t.filter(e=>wa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ea(t);else{let e=n[0],i=wa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ea([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,_a(e,r))}function Oa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):_a(i,s),_a(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Sa(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Da(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}_a(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,v(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Aa(t,`input`,e.processors),output:Aa(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function I(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return I(r.element,n);if(r.type===`set`)return I(r.valueType,n);if(r.type===`lazy`)return I(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return I(r.innerType,n);if(r.type===`intersection`)return I(r.left,n)||I(r.right,n);if(r.type===`record`||r.type===`map`)return I(r.keyType,n)||I(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:I(r.in,n)||I(r.out,n);if(r.type===`object`){for(let e in r.shape)if(I(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(I(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(I(e,n))return!0;return!!(r.rest&&I(r.rest,n))}return!1}const ka=(e,t={})=>n=>{let r=va({...n,processors:t});return F(e,r),xa(r,e),Oa(r,e)},Aa=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=va({...i??{},target:a,io:t,processors:n});return F(e,o),xa(o,e),Oa(o,e)},L=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},R=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},ja=(e,t)=>{L(e,`minimum`,t),R(e,`maximum`,t)},Ma=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Na=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Pa=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Fa=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ia=(e,t)=>L(e,`minimum`,t.minimum),La=(e,t)=>R(e,`maximum`,t.maximum),Ra=e=>(t,n)=>{Fa(t,n.format);let[r,i]=e[n.format];L(t,`minimum`,r),R(t,`maximum`,i)},za={greater_than:(e,t)=>L(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>R(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Ma(e,t.value),number_format:Ra(Pe),bigint_format:Ra(Fe),min_length:Ia,max_length:La,length_equals:(e,t)=>ja(e,t.length),min_size:Ia,max_size:La,size_equals:(e,t)=>ja(e,t.size),string_format:(e,t)=>{Fa(e,t.format),t.pattern&&Na(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Pa(e,t.mime)};function Ba(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)za[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&L(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&L(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&R(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&R(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Ma(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Pa(t,i.mime);for(let e of i.patterns??[])Na(t,e);return t}const Va={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ha=new Map([[mr,sn],[gr,cn]]),Ua=e=>Ha.get(e)??e,Wa=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Ba(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Va[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Ua);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Ga=(e,t,n,r)=>{n.not={}},Ka=(e,t,n,r)=>{let i=e._zod.def,a=fe(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},qa=(e,t,n,r)=>{ya(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ja=(e,t,n,r)=>{ya(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Ya=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Ba(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=F(a.element,t,{...r,path:[...r.path,`items`]})};function Xa(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Xa(t.out):t.type===`catch`?Xa(t.innerType):e._zod.optin}const Za=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&ya(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)v(i.properties,e,F(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Xa(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=F(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Qa=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>F(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},$a=(e,t,n,r)=>{let i=e._zod.def,a=F(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=F(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},eo=(e,t,n,r)=>{let i=e._zod.def,a=F(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},to=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},no=Symbol();function ro(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(ya(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),no):JSON.parse(o)}const io=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=ro(i.defaultValue,e,t,n,r);o!==no&&(n.default=o)},ao=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=ro(i.defaultValue,e,t,n,r);o!==no&&(n._prefault=o)},oo=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{ya(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},so=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;F(o,t,r);let s=t.seen.get(e);s.ref=o},co=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},lo=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},uo=new WeakSet([Object.prototype,Error.prototype]);function fo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}const z=O(`ZodError`,(e,t)=>{xt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);uo.has(n)||(uo.add(n),fo(n,`format`,e=>t=>wt(e,t)),fo(n,`flatten`,e=>t=>Ct(e,t)),fo(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,me,2)}),fo(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,me,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),po=Et(z),mo=Dt(z),ho=Ot(z),go=At(z),_o=It(z),vo=Lt(z),yo=Rt(z),bo=zt(z),xo=Bt(z),So=Vt(z),Co=Ht(z),wo=Ut(z);function To(){A.localeError||j(_i())}function Eo(){A.memoizer||j({memoizer:mi()})}const B=O(`ZodType`,(e,t)=>(To(),N.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(x(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return S(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ps(e,t))},superRefine(e,t){return this.check(Fs(e,t))},overwrite(e){return this.check(sa(e))},optional(){return gs(this)},exactOptional(){return vs(this)},nullable(){return bs(this)},nullish(){return gs(bs(this))},nonoptional(e){return Es(this,e)},array(){return is(this)},or(e){return cs([this,e])},and(e){return us(this,e)},transform(e){return As(this,ms(e))},default(e){return Ss(this,e)},prefault(e){return ws(this,e)},catch(e){return Os(this,e)},pipe(e){return As(this,e)},readonly(){return Ms(this)},describe(e){let t=this.clone();return xi.add(t,{description:e}),t},meta(...e){if(e.length===0)return xi.get(this);let t=this.clone();return xi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return tt(this,`~standard`,{...In(this),jsonSchema:{input:Aa(this,`input`),output:Aa(this,`output`)}})},set"~standard"(e){E(this,`~standard`,e)},parse:function e(t,n){return po(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await mo(this,t,n,{callee:e})},safeParse(e,t){return ho(this,e,t)},async safeParseAsync(e,t){return go(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){E(this,`spa`,e)},validate(e,t){return Nt(this,e,t)},validateAsync(e,t){return Ft(this,e,t)},encode:function e(t,n){return _o(this,t,n,{callee:e})},decode:function e(t,n){return vo(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await yo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await bo(this,t,n,{callee:e})},safeEncode(e,t){return xo(this,e,t)},safeDecode(e,t){return So(this,e,t)},async safeEncodeAsync(e,t){return Co(this,e,t)},async safeDecodeAsync(e,t){return wo(this,e,t)},toJSONSchema(e){return ka(this,{})(e)},get description(){return xi.get(this)?.description},get _def(){return this._zod.def}}),Do=O(`_ZodString`,(e,t)=>{Ln.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wa(e,t,n,r)},nt({format:e=>Ba(e).format??null,minLength:e=>Ba(e).minimum??null,maxLength:e=>Ba(e).maximum??null},{regex(...e){return this.check(ta(...e))},includes(...e){return this.check(ia(...e))},startsWith(...e){return this.check(aa(...e))},endsWith(...e){return this.check(oa(...e))},min(...e){return this.check($i(...e))},max(...e){return this.check(Qi(...e))},length(...e){return this.check(ea(...e))},nonempty(...e){return this.check($i(1,...e))},lowercase(e){return this.check(na(e))},uppercase(e){return this.check(ra(e))},trim(){return this.check(la())},normalize(...e){return this.check(ca(...e))},toLowerCase(){return this.check(ua())},toUpperCase(){return this.check(da())},slugify(){return this.check(fa())}})),Oo=O(`ZodString`,(e,t)=>{Ln.init(e,t),Do.init(e,t)},{email(e){return this.check(wi(Po,e))},url(e){return this.check(Ai(Lo,e))},jwt(e){return this.check(Gi(Qo,e))},emoji(e){return this.check(ji(Ro,e))},guid(e){return this.check(Ti(Fo,e))},uuid(e){return this.check(Ei(Io,e))},uuidv4(e){return this.check(Di(Io,e))},uuidv6(e){return this.check(Oi(Io,e))},uuidv7(e){return this.check(ki(Io,e))},nanoid(e){return this.check(Mi(zo,e))},cuid(e){return this.check(Ni(Bo,e))},cuid2(e){return this.check(Pi(Vo,e))},ulid(e){return this.check(Fi(Ho,e))},base64(e){return this.check(Hi(Yo,e))},base64url(e){return this.check(Ui(Xo,e))},xid(e){return this.check(Ii(Uo,e))},ksuid(e){return this.check(Li(Wo,e))},ipv4(e){return this.check(Ri(Go,e))},ipv6(e){return this.check(zi(Ko,e))},cidrv4(e){return this.check(Bi(qo,e))},cidrv6(e){return this.check(Vi(Jo,e))},e164(e){return this.check(Wi(Zo,e))},datetime(e){return this.check(Ki(Ao,e))},date(e){return this.check(qi(jo,e))},time(e){return this.check(Ji(Mo,e))},duration(e){return this.check(Yi(No,e))}});function ko(e){return Ci(Oo,e)}const V=O(`ZodStringFormat`,(e,t)=>{P.init(e,t),Do.init(e,t)}),Ao=O(`ZodISODateTime`,(e,t)=>{nr.init(e,t),V.init(e,t)}),jo=O(`ZodISODate`,(e,t)=>{rr.init(e,t),V.init(e,t)}),Mo=O(`ZodISOTime`,(e,t)=>{ir.init(e,t),V.init(e,t)}),No=O(`ZodISODuration`,(e,t)=>{ar.init(e,t),V.init(e,t)}),Po=O(`ZodEmail`,(e,t)=>{Bn.init(e,t),V.init(e,t)}),Fo=O(`ZodGUID`,(e,t)=>{Rn.init(e,t),V.init(e,t)}),Io=O(`ZodUUID`,(e,t)=>{zn.init(e,t),V.init(e,t)}),Lo=O(`ZodURL`,(e,t)=>{Jn.init(e,t),V.init(e,t)}),Ro=O(`ZodEmoji`,(e,t)=>{Yn.init(e,t),V.init(e,t)}),zo=O(`ZodNanoID`,(e,t)=>{Xn.init(e,t),V.init(e,t)}),Bo=O(`ZodCUID`,(e,t)=>{Zn.init(e,t),V.init(e,t)}),Vo=O(`ZodCUID2`,(e,t)=>{Qn.init(e,t),V.init(e,t)}),Ho=O(`ZodULID`,(e,t)=>{$n.init(e,t),V.init(e,t)}),Uo=O(`ZodXID`,(e,t)=>{er.init(e,t),V.init(e,t)}),Wo=O(`ZodKSUID`,(e,t)=>{tr.init(e,t),V.init(e,t)}),Go=O(`ZodIPv4`,(e,t)=>{or.init(e,t),V.init(e,t)}),Ko=O(`ZodIPv6`,(e,t)=>{lr.init(e,t),V.init(e,t)}),qo=O(`ZodCIDRv4`,(e,t)=>{ur.init(e,t),V.init(e,t)}),Jo=O(`ZodCIDRv6`,(e,t)=>{fr.init(e,t),V.init(e,t)}),Yo=O(`ZodBase64`,(e,t)=>{hr.init(e,t),V.init(e,t)}),Xo=O(`ZodBase64URL`,(e,t)=>{vr.init(e,t),V.init(e,t)}),Zo=O(`ZodE164`,(e,t)=>{yr.init(e,t),V.init(e,t)}),Qo=O(`ZodJWT`,(e,t)=>{xr.init(e,t),V.init(e,t)}),$o=O(`ZodUnknown`,(e,t)=>{Sr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function es(){return Xi($o)}const ts=O(`ZodNever`,(e,t)=>{Cr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ga(e,t,n,r)});function ns(e){return Zi(ts,e)}const rs=O(`ZodArray`,(e,t)=>{Eo(),Tr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ya(e,t,n,r),e.element=t.element},{min(e,t){return this.check($i(e,t))},nonempty(e){return this.check($i(1,e))},max(e,t){return this.check(Qi(e,t))},length(e,t){return this.check(ea(e,t))},unwrap(){return this.element}});function is(e,t){return pa(rs,e,t)}const as=O(`ZodObject`,(e,t)=>{Eo(),jr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Za(e,t,n,r),ct(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return fs(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(x(this._zod.def,{catchall:e}))},passthrough(){return this.clone(x(this._zod.def,{catchall:es()}))},loose(){return this.clone(x(this._zod.def,{catchall:es()}))},strict(){return this.clone(x(this._zod.def,{catchall:ns()}))},strip(){return this.clone(x(this._zod.def,{catchall:void 0}))},extend(e){return ze(this,e)},safeExtend(e){return Ve(this,e)},merge(e){return He(this,e)},pick(e){return Ie(this,e)},omit(e){return Re(this,e)},partial(...e){return Ue(hs,this,e[0])},exactPartial(...e){return Ue(_s,this,e[0],`exactPartial`)},required(...e){return We(Ts,this,e[0])}});function os(e,t){let n={type:`object`,shape:e??{},...C(t)};return new as(n)}const ss=O(`ZodUnion`,(e,t)=>{Nr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qa(e,t,n,r),e.options=t.options});function cs(e,t){return new ss({type:`union`,options:e,...C(t)})}const ls=O(`ZodIntersection`,(e,t)=>{Pr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$a(e,t,n,r)});function us(e,t){return new ls({type:`intersection`,left:e,right:t})}const ds=O(`ZodEnum`,(e,t)=>{Lr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ka(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ds({...t,checks:[],...C(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ds({...t,checks:[],...C(r),entries:i})}});function fs(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new ds({type:`enum`,entries:n,...C(t)})}const ps=O(`ZodTransform`,(e,t)=>{Eo(),Rr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ja(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new mt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push($e(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push($e(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function ms(e){return new ps({type:`transform`,transform:e})}const hs=O(`ZodOptional`,(e,t)=>{Br.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gs(e){return new hs({type:`optional`,innerType:e})}const _s=O(`ZodExactOptional`,(e,t)=>{Vr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vs(e){return new _s({type:`optional`,innerType:e})}const ys=O(`ZodNullable`,(e,t)=>{Hr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bs(e){return new ys({type:`nullable`,innerType:e})}const xs=O(`ZodDefault`,(e,t)=>{Ur.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>io(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ss(e,t){return new xs({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ke(t)}})}const Cs=O(`ZodPrefault`,(e,t)=>{Gr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ws(e,t){return new Cs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ke(t)}})}const Ts=O(`ZodNonOptional`,(e,t)=>{Kr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>to(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Es(e,t){return new Ts({type:`nonoptional`,innerType:e,...C(t)})}const Ds=O(`ZodCatch`,(e,t)=>{Yr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Os(e,t){return new Ds({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:lt(t)})}const ks=O(`ZodPipe`,(e,t)=>{Xr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.in=t.in,e.out=t.out});function As(e,t){return new ks({type:`pipe`,in:e,out:t})}const js=O(`ZodReadonly`,(e,t)=>{Qr.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ms(e){return new js({type:`readonly`,innerType:e})}const Ns=O(`ZodCustom`,(e,t)=>{ei.init(e,t),B.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qa(e,t,n,r)});function Ps(e,t={}){return ma(Ns,e,t)}function Fs(e,t){return ha(e,t)}const Is=os({detail:ko()}),Ls=os({error:ko()});function Rs(e){if(!e)return`Unknown error`;if(e instanceof Error){let t=Is.safeParse(e.cause);return t.success?t.data.detail:zs(e.message)}if(typeof e==`object`){let t=Is.safeParse(e);if(t.success)return t.data.detail;let n=Ls.safeParse(e);if(n.success)return n.data.error}try{return JSON.stringify(e)}catch{return String(e)}}function zs(e){let t=Bs(e);if(!t)return e;let n=Is.safeParse(t);if(n.success)return n.data.detail;let r=Ls.safeParse(t);return r.success?r.data.error:e}function Bs(e){try{return JSON.parse(e)}catch{return e}}function Vs(e){return e.FS}const Hs=`notebook.py`,Us=`/marimo`,H={NOTEBOOK_FILENAME:Hs,HOME_DIR:Us,createHomeDir:e=>{let t=Vs(e);try{t.mkdirTree(Us)}catch{}t.chdir(Us)},mountFS:e=>{globalThis.origin!==`null`&&Vs(e).mount(e.FS.filesystems.IDBFS,{root:`.`},Us)},populateFilesToMemory:async e=>{await Ws(e,!0)},persistFilesToRemote:async e=>{await Ws(e,!1)},readNotebook:e=>{let t=Vs(e),n=`${Us}/${Hs}`;return le(t.readFile(n))},initNotebookCode:e=>{let{pyodide:t,filename:n,code:r}=e,i=Vs(t),a=e=>{try{return le(i.readFile(e))}catch{return null}};if(n&&n!==Hs){let e=a(n);if(e)return{code:e,filename:n}}return i.writeFile(Hs,r),{code:r,filename:Hs}}};function Ws(e,t){return new Promise((n,r)=>{Vs(e).syncfs(t,e=>{if(e instanceof Error){r(e);return}n()})})}var Gs=Object.defineProperty,U=(e,t)=>Gs(e,`name`,{value:t,configurable:!0}),Ks=(e=>typeof l<`u`?l:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof l<`u`?l:e)[t]}):e)(function(e){if(typeof l<`u`)return l.apply(this,arguments);throw Error(`Dynamic require of "`+e+`" is not supported`)}),qs=(()=>{for(var e=new Uint8Array(128),t=0;t<64;t++)e[t<26?t+65:t<52?t+71:t<62?t-4:t*4-205]=t;return t=>{for(var n=t.length,r=new Uint8Array((n-(t[n-1]==`=`)-(t[n-2]==`=`))*3/4|0),i=0,a=0;i<n;){var o=e[t.charCodeAt(i++)],s=e[t.charCodeAt(i++)],c=e[t.charCodeAt(i++)],l=e[t.charCodeAt(i++)];r[a++]=o<<2|s>>4,r[a++]=s<<4|c>>2,r[a++]=c<<6|l}return r}})();function Js(e){return!isNaN(parseFloat(e))&&isFinite(e)}U(Js,`_isNumber`);function W(e){return e.charAt(0).toUpperCase()+e.substring(1)}U(W,`_capitalize`);function Ys(e){return function(){return this[e]}}U(Ys,`_getter`);var G=[`isConstructor`,`isEval`,`isNative`,`isToplevel`],Xs=[`columnNumber`,`lineNumber`],Zs=[`fileName`,`functionName`,`source`],Qs=G.concat(Xs,Zs,[`args`],[`evalOrigin`]);function K(e){if(e)for(var t=0;t<Qs.length;t++)e[Qs[t]]!==void 0&&this[`set`+W(Qs[t])](e[Qs[t]])}for(U(K,`StackFrame`),K.prototype={getArgs:U(function(){return this.args},`getArgs`),setArgs:U(function(e){if(Object.prototype.toString.call(e)!==`[object Array]`)throw TypeError(`Args must be an Array`);this.args=e},`setArgs`),getEvalOrigin:U(function(){return this.evalOrigin},`getEvalOrigin`),setEvalOrigin:U(function(e){if(e instanceof K)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new K(e);else throw TypeError(`Eval Origin must be an Object or StackFrame`)},`setEvalOrigin`),toString:U(function(){var e=this.getFileName()||``,t=this.getLineNumber()||``,n=this.getColumnNumber()||``,r=this.getFunctionName()||``;return this.getIsEval()?e?`[eval] (`+e+`:`+t+`:`+n+`)`:`[eval]:`+t+`:`+n:r?r+` (`+e+`:`+t+`:`+n+`)`:e+`:`+t+`:`+n},`toString`)},K.fromString=U(function(e){var t=e.indexOf(`(`),n=e.lastIndexOf(`)`),r=e.substring(0,t),i=e.substring(t+1,n).split(`,`),a=e.substring(n+1);if(a.indexOf(`@`)===0)var o=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(a,``),s=o[1],c=o[2],l=o[3];return new K({functionName:r,args:i||void 0,fileName:s,lineNumber:c||void 0,columnNumber:l||void 0})},`StackFrame$$fromString`),q=0;q<G.length;q++)K.prototype[`get`+W(G[q])]=Ys(G[q]),K.prototype[`set`+W(G[q])]=function(e){return function(t){this[e]=!!t}}(G[q]);var q;for(J=0;J<Xs.length;J++)K.prototype[`get`+W(Xs[J])]=Ys(Xs[J]),K.prototype[`set`+W(Xs[J])]=function(e){return function(t){if(!Js(t))throw TypeError(e+` must be a Number`);this[e]=Number(t)}}(Xs[J]);var J;for(Y=0;Y<Zs.length;Y++)K.prototype[`get`+W(Zs[Y])]=Ys(Zs[Y]),K.prototype[`set`+W(Zs[Y])]=function(e){return function(t){this[e]=String(t)}}(Zs[Y]);var Y,$s=K;function ec(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:U(function(t){if(t.stack&&t.stack.match(e))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw Error(`Cannot parse given Error object`)},`ErrorStackParser$$parse`),extractLocation:U(function(e){if(e.indexOf(`:`)===-1)return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,``));return[t[1],t[2]||void 0,t[3]||void 0]},`ErrorStackParser$$extractLocation`),parseV8OrIE:U(function(t){return t.stack.split(`
56
- `).filter(function(t){return!!t.match(e)},this).map(function(e){e.indexOf(`(eval `)>-1&&(e=e.replace(/eval code/g,`eval`).replace(/(\(eval at [^()]*)|(,.*$)/g,``));var t=e.replace(/^\s+/,``).replace(/\(eval code/g,`(`).replace(/^.*?\s+/,``),n=t.match(/ (\(.+\)$)/);t=n?t.replace(n[0],``):t;var r=this.extractLocation(n?n[1]:t);return new $s({functionName:n&&t||void 0,fileName:[`eval`,`<anonymous>`].indexOf(r[0])>-1?void 0:r[0],lineNumber:r[1],columnNumber:r[2],source:e})},this)},`ErrorStackParser$$parseV8OrIE`),parseFFOrSafari:U(function(e){return e.stack.split(`
57
- `).filter(function(e){return!e.match(t)},this).map(function(e){if(e.indexOf(` > eval`)>-1&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,`:$1`)),e.indexOf(`@`)===-1&&e.indexOf(`:`)===-1)return new $s({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,``));return new $s({functionName:r,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:e})},this)},`ErrorStackParser$$parseFFOrSafari`)}}U(ec,`ErrorStackParser`);var tc=new ec;function nc(){return typeof API<`u`&&API!==globalThis.API?API.runtimeEnv:rc({IN_BUN:typeof Bun<`u`,IN_DENO:typeof Deno<`u`,IN_NODE:typeof process==`object`&&typeof process.versions==`object`&&typeof process.versions.node==`string`&&!process.browser,IN_SAFARI:typeof navigator==`object`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Chrome`)===-1&&navigator.userAgent.indexOf(`Safari`)>-1,IN_SHELL:typeof read==`function`&&typeof load==`function`,IN_WORKERD:typeof navigator==`object`&&navigator.userAgent?.includes(`Cloudflare-Workers`)})}U(nc,`getGlobalRuntimeEnv`);var X=nc();function rc(e){let t=e.IN_NODE&&typeof module<`u`&&module.exports&&typeof Ks==`function`&&typeof __dirname==`string`,n=e.IN_NODE&&!t,r=!e.IN_NODE&&!e.IN_DENO&&!e.IN_BUN,i=r&&typeof window<`u`&&typeof window.document<`u`&&typeof document.createElement==`function`&&`sessionStorage`in window&&typeof globalThis.importScripts!=`function`,a=r&&typeof globalThis.WorkerGlobalScope<`u`&&typeof globalThis.self<`u`&&globalThis.self instanceof globalThis.WorkerGlobalScope;if(a&&ic())throw Error(`Classic web workers are not supported`);let o={...e,IN_BROWSER:r,IN_BROWSER_MAIN_THREAD:i,IN_BROWSER_WEB_WORKER:a,IN_NODE_COMMONJS:t,IN_NODE_ESM:n};if(!(o.IN_BROWSER_MAIN_THREAD||o.IN_BROWSER_WEB_WORKER||o.IN_NODE||o.IN_SHELL||o.IN_WORKERD))throw Error(`Cannot determine runtime environment: ${JSON.stringify(o)}`);return o}U(rc,`calculateDerivedFlags`);function ic(){try{return globalThis.importScripts(`data:text/javascript,`),!0}catch{return!1}}U(ic,`isClassicWorker`);var ac,oc,sc,cc;async function lc(){if(!X.IN_NODE||(ac=(await import(`./__vite-browser-external-FeDVGZU8.js`).then(e=>c(e.default,1))).default,sc=await import(`./__vite-browser-external-FeDVGZU8.js`).then(e=>c(e.default,1)),cc=await import(`./__vite-browser-external-FeDVGZU8.js`).then(e=>c(e.default,1)),(await import(`./__vite-browser-external-FeDVGZU8.js`).then(e=>c(e.default,1))).default,oc=await import(`./__vite-browser-external-FeDVGZU8.js`).then(e=>c(e.default,1)),pc=oc.sep,typeof Ks<`u`))return;let e={fs:sc,crypto:await import(`./__vite-browser-external-FeDVGZU8.js`).then(e=>c(e.default,1)),ws:await import(`./__vite-browser-external-FeDVGZU8.js`).then(e=>c(e.default,1)),child_process:await import(`./__vite-browser-external-FeDVGZU8.js`).then(e=>c(e.default,1))};globalThis.require=function(t){return e[t]}}U(lc,`initNodeModules`);function uc(e,t){return oc.resolve(t||`.`,e)}U(uc,`node_resolvePath`);function dc(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}U(dc,`browser_resolvePath`);var fc=X.IN_NODE?uc:X.IN_SHELL?U(e=>e,`resolvePath`):dc,pc;X.IN_NODE||(pc=`/`);function mc(e,t){return e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`://`)?{response:fetch(e)}:{binary:cc.readFile(e).then(e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}}U(mc,`node_getBinaryResponse`);function hc(e,t){if(e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`://`))throw Error(`Shell cannot fetch urls`);return{binary:Promise.resolve(new Uint8Array(readbuffer(e)))}}U(hc,`shell_getBinaryResponse`);function gc(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}U(gc,`browser_getBinaryResponse`);var _c=X.IN_NODE?mc:X.IN_SHELL?hc:gc;async function vc(e,t){let{response:n,binary:r}=_c(e,t);if(r)return r;let i=await n;if(!i.ok)throw Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await i.arrayBuffer())}U(vc,`loadBinaryFile`);var yc=X.IN_NODE?bc:U(async e=>await import(e),`loadScript`);async function bc(e){return e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`://`)?await import(e):await import(ac.pathToFileURL(e).href)}U(bc,`nodeLoadScript`);async function xc(e){if(X.IN_NODE){await lc();let t=await cc.readFile(e,{encoding:`utf8`});return JSON.parse(t)}if(X.IN_SHELL){let t=read(e);return JSON.parse(t)}return await(await fetch(e)).json()}U(xc,`loadLockFile`);async function Sc(){if(X.IN_NODE_COMMONJS)return __dirname;let e;try{throw Error()}catch(t){e=t}let t=tc.parse(e)[0].fileName;if(X.IN_NODE&&!t.startsWith(`file://`)&&(t=`file://${t}`),X.IN_NODE_ESM){let e=await import(`./__vite-browser-external-FeDVGZU8.js`).then(e=>c(e.default,1));return(await import(`./__vite-browser-external-FeDVGZU8.js`).then(e=>c(e.default,1))).fileURLToPath(e.dirname(t))}let n=t.lastIndexOf(pc);if(n===-1)throw Error(`Could not extract indexURL path from pyodide module location. Please pass the indexURL explicitly to loadPyodide.`);return t.slice(0,n)}U(Sc,`calculateDirname`);function Cc(e){return e.substring(0,e.lastIndexOf(`/`)+1)||globalThis.location?.toString()||`.`}U(Cc,`calculateInstallBaseUrl`);function wc(e){let t=e.FS,n=e.FS.filesystems.MEMFS,r=e.PATH,i={DIR_MODE:16895,FILE_MODE:33279,mount:U(function(e){if(!e.opts.fileSystemHandle)throw Error(`opts.fileSystemHandle is required`);return n.mount.apply(null,arguments)},`mount`),syncfs:U(async(e,t,n)=>{try{let r=i.getLocalSet(e),a=await i.getRemoteSet(e),o=t?a:r,s=t?r:a;await i.reconcile(e,o,s),n(null)}catch(e){n(e)}},`syncfs`),getLocalSet:U(e=>{let n=Object.create(null);function i(e){return e!==`.`&&e!==`..`}U(i,`isRealDir`);function a(e){return t=>r.join2(e,t)}U(a,`toAbsolute`);let o=t.readdir(e.mountpoint).filter(i).map(a(e.mountpoint));for(;o.length;){let e=o.pop(),r=t.stat(e);t.isDir(r.mode)&&o.push.apply(o,t.readdir(e).filter(i).map(a(e))),n[e]={timestamp:r.mtime,mode:r.mode}}return{type:`local`,entries:n}},`getLocalSet`),getRemoteSet:U(async e=>{let t=Object.create(null),n=await Tc(e.opts.fileSystemHandle);for(let[a,o]of n)a!==`.`&&(t[r.join2(e.mountpoint,a)]={timestamp:o.kind===`file`?new Date((await o.getFile()).lastModified):new Date,mode:o.kind===`file`?i.FILE_MODE:i.DIR_MODE});return{type:`remote`,entries:t,handles:n}},`getRemoteSet`),loadLocalEntry:U(e=>{let r=t.lookupPath(e,{}).node,i=t.stat(e);if(t.isDir(i.mode))return{timestamp:i.mtime,mode:i.mode};if(t.isFile(i.mode))return r.contents=n.getFileDataAsTypedArray(r),{timestamp:i.mtime,mode:i.mode,contents:r.contents};throw Error(`node type not supported`)},`loadLocalEntry`),storeLocalEntry:U((e,n)=>{if(t.isDir(n.mode))t.mkdirTree(e,n.mode);else if(t.isFile(n.mode))t.writeFile(e,n.contents,{canOwn:!0});else throw Error(`node type not supported`);t.chmod(e,n.mode),t.utime(e,n.timestamp,n.timestamp)},`storeLocalEntry`),removeLocalEntry:U(e=>{var n=t.stat(e);t.isDir(n.mode)?t.rmdir(e):t.isFile(n.mode)&&t.unlink(e)},`removeLocalEntry`),loadRemoteEntry:U(async e=>{if(e.kind===`file`){let t=await e.getFile();return{contents:new Uint8Array(await t.arrayBuffer()),mode:i.FILE_MODE,timestamp:new Date(t.lastModified)}}if(e.kind===`directory`)return{mode:i.DIR_MODE,timestamp:new Date};throw Error(`unknown kind: `+e.kind)},`loadRemoteEntry`),storeRemoteEntry:U(async(e,n,i)=>{let a=e.get(r.dirname(n)),o=t.isFile(i.mode)?await a.getFileHandle(r.basename(n),{create:!0}):await a.getDirectoryHandle(r.basename(n),{create:!0});if(o.kind===`file`){let e=await o.createWritable();await e.write(i.contents),await e.close()}e.set(n,o)},`storeRemoteEntry`),removeRemoteEntry:U(async(e,t)=>{await e.get(r.dirname(t)).removeEntry(r.basename(t)),e.delete(t)},`removeRemoteEntry`),reconcile:U(async(e,n,a)=>{let o=0,s=[];Object.keys(n.entries).forEach(function(e){let r=n.entries[e],i=a.entries[e];(!i||t.isFile(r.mode)&&r.timestamp.getTime()>i.timestamp.getTime())&&(s.push(e),o++)}),s.sort();let c=[];if(Object.keys(a.entries).forEach(function(e){n.entries[e]||(c.push(e),o++)}),c.sort().reverse(),!o)return;let l=n.type===`remote`?n.handles:a.handles;for(let t of s){let n=r.normalize(t.replace(e.mountpoint,`/`)).substring(1);if(a.type===`local`){let e=l.get(n),r=await i.loadRemoteEntry(e);i.storeLocalEntry(t,r)}else{let e=i.loadLocalEntry(t);await i.storeRemoteEntry(l,n,e)}}for(let t of c)if(a.type===`local`)i.removeLocalEntry(t);else{let n=r.normalize(t.replace(e.mountpoint,`/`)).substring(1);await i.removeRemoteEntry(l,n)}},`reconcile`)};e.FS.filesystems.NATIVEFS_ASYNC=i}U(wc,`initializeNativeFS`);var Tc=U(async e=>{let t=[];async function n(e){for await(let r of e.values())t.push(r),r.kind===`directory`&&await n(r)}U(n,`collect`),await n(e);let r=new Map;r.set(`.`,e);for(let n of t){let t=(await e.resolve(n)).join(`/`);r.set(t,n)}return r},`getFsHandles`),Ec=qs(`AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECBygCE0pzdl9HZXRFcnJvcl9pbXBvcnQAAA5Kc3ZFcnJvcl9DaGVjawABChMCBwD7AQD7GwsJACAA+xr7FAAL`),Dc=async function(){if(!(globalThis.navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&typeof navigator.maxTouchPoints<`u`&&navigator.maxTouchPoints>1)))try{let e=await WebAssembly.compile(Ec);return await WebAssembly.instantiate(e)}catch(e){if(e instanceof WebAssembly.CompileError)return;throw e}}();async function Oc(){let e=await Dc;if(e)return e.exports;let t=Symbol(`error marker`);return{Jsv_GetError_import:U(()=>t,`Jsv_GetError_import`),JsvError_Check:U(e=>e===t,`JsvError_Check`)}}U(Oc,`getJsvErrorImport`);function kc(e){let t={config:e,runtimeEnv:X},n={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Fc(e),print:e.stdout,printErr:e.stderr,onExit(e){n.exitCode=e},thisProgram:e._sysExecutable,arguments:e.args,API:t,locateFile:U(t=>e.indexURL+t,`locateFile`),instantiateWasm:Ic(e.indexURL)};return n}U(kc,`createSettings`);function Ac(e){return function(t){try{t.FS.mkdirTree(e)}catch(t){console.error(`Error occurred while making a home directory '${e}':`),console.error(t),console.error(`Using '/' for a home directory instead`),e=`/`}t.FS.chdir(e)}}U(Ac,`createHomeDirectory`);function jc(e){return function(t){Object.assign(t.ENV,e)}}U(jc,`setEnvironment`);function Mc(e){return e?[async t=>{t.addRunDependency(`fsInitHook`);try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency(`fsInitHook`)}}]:[]}U(Mc,`callFsInitHook`);function Nc(e){let t=e.HEAPU32[e._Py_Version>>>2];return[t>>>24&255,t>>>16&255,t>>>8&255]}U(Nc,`computeVersionTuple`);function Pc(e){let t=vc(e);return async e=>{e.API.pyVersionTuple=Nc(e);let[n,r]=e.API.pyVersionTuple;e.FS.mkdirTree(`/lib`),e.API.sitePackages=`/lib/python${n}.${r}/site-packages`,e.FS.mkdirTree(e.API.sitePackages),e.addRunDependency(`install-stdlib`);try{let i=await t;e.FS.writeFile(`/lib/python${n}${r}.zip`,i)}catch(e){console.error(`Error occurred while installing the standard library:`),console.error(e)}finally{e.removeRunDependency(`install-stdlib`)}}}U(Pc,`installStdlib`);function Fc(e){let t;return t=e.stdLibURL==null?e.indexURL+`python_stdlib.zip`:e.stdLibURL,[Pc(t),Ac(e.env.HOME),jc(e.env),wc,...Mc(e.fsInit)]}U(Fc,`getFileSystemInitializationFuncs`);function Ic(e){if(typeof WasmOffsetConverter<`u`)return;let{binary:t,response:n}=_c(e+`pyodide.asm.wasm`),r=Oc();return function(e,i){return async function(){let{Jsv_GetError_import:a,JsvError_Check:o}=await r;e.env.Jsv_GetError_import=a,e.env.JsvError_Check=o;try{let r;r=n?await WebAssembly.instantiateStreaming(n,e):await WebAssembly.instantiate(await t,e);let{instance:a,module:o}=r;i(a,o)}catch(e){console.warn(`wasm instantiation failed!`),console.warn(e)}}(),{}}}U(Ic,`getInstantiateWasmFunc`);var Lc=`314.0.0`;function Rc(e){return e===void 0||e.endsWith(`/`)?e:e+`/`}U(Rc,`withTrailingSlash`);var zc=Lc;async function Bc(e={}){if(await lc(),e.lockFileContents&&e.lockFileURL)throw Error(`Can't pass both lockFileContents and lockFileURL`);let t=e.indexURL||await Sc();if(t=Rc(fc(t)),e.packageBaseUrl=Rc(e.packageBaseUrl),e.cdnUrl=Rc(e.packageBaseUrl??`https://cdn.jsdelivr.net/pyodide/v314.0.0/full/`),!e.lockFileContents){let n=e.lockFileURL??t+`pyodide-lock.json`;e.lockFileContents=xc(n),e.packageBaseUrl??=Cc(n)}e.indexURL=t,e.packageCacheDir&&=Rc(fc(e.packageCacheDir));let n={jsglobals:globalThis,stdin:globalThis.prompt?()=>globalThis.prompt():void 0,args:[],env:{},packages:[],packageCacheDir:e.packageBaseUrl,enableRunUntilComplete:!0,checkAPIVersion:!0,BUILD_ID:`2ff9f3fe6c88624a7e283d5651688da7f6169834ab51663b07be67c0bd43e53e`},r=Object.assign(n,e);return r.env.HOME??=`/home/pyodide`,r.env.PYTHONINSPECT??=`1`,r}U(Bc,`initializeConfiguration`);function Vc(e){let t=kc(e),n=t.API;return n.lockFilePromise=Promise.resolve(e.lockFileContents),t}U(Vc,`createEmscriptenSettings`);async function Hc(e){return e.createPyodideModule?e.createPyodideModule:(await yc(`${e.indexURL}pyodide.asm.mjs`)).default}U(Hc,`loadWasmScript`);async function Uc(e,t){if(!e._loadSnapshot)return;let n=await e._loadSnapshot,r=ArrayBuffer.isView(n)?n:new Uint8Array(n);return t.noInitialRun=!0,t.INITIAL_MEMORY=r.length,r}U(Uc,`prepareSnapshot`);async function Wc(e,t){let n=await e(t);if(t.exitCode!==void 0)throw new n.ExitStatus(t.exitCode);return n}U(Wc,`instantiatePyodideModule`);function Gc(e,t){let n=e.API;if(t.pyproxyToStringRepr&&n.setPyProxyToStringMethod(!0),t.convertNullToNone&&n.setCompatNullToNone(!0),t.toJsLiteralMap&&n.setCompatToJsLiteralMap(!0),n.version!==`314.0.0`&&t.checkAPIVersion)throw Error(`Pyodide version does not match: '${zc}' <==> '${n.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);e.locateFile=e=>{throw e.endsWith(`.so`)?Error(`Failed to find dynamic library "${e}"`):Error(`Unexpected call to locateFile("${e}")`)}}U(Gc,`configureAPI`);function Kc(e,t,n){let r=e.API,i;return t&&(i=r.restoreSnapshot(t)),r.finalizeBootstrap(i,n._snapshotDeserializer)}U(Kc,`bootstrapPyodide`);async function qc(e,t){let n=e._api;return n.sys.path.insert(0,``),n._pyodide.set_excepthook(),await n.packageIndexReady,n.initializeStreams(t.stdin,t.stdout,t.stderr),e}U(qc,`finalizeSetup`);async function Jc(e={}){let t=await Bc(e),n=Vc(t),r=await Hc(t),i=await Uc(t,n),a=await Wc(r,n);return Gc(a,t),await qc(Kc(a,i,t),t)}U(Jc,`loadPyodide`);function Yc(e){return`marimo-base`}const Z=new class{spans=[];startSpan(e,t={}){let n={name:e,startTime:Date.now(),attributes:t,end:(e=`ok`)=>this.endSpan(n,e)};return this.spans.push(n),n}endSpan(e,t=`ok`){e.endTime=Date.now(),e.status=t}getSpans(){return this.spans}wrap(e,t,n={}){let r=this.startSpan(t||e.name,n);try{let t=e();return this.endSpan(r),t}catch(e){throw this.endSpan(r,`error`),e}}wrapAsync(e,t,n={}){return(async(...r)=>{let i=this.startSpan(t||e.name,n);try{let t=await e(...r);return this.endSpan(i),t}catch(e){throw this.endSpan(i,`error`),e}})}logSpans(){}};globalThis.t=Z;const Xc=/(^|\n)\s*(?:import\s+[^\n#]*\bduckdb\b|from\s+duckdb\b|[^\n#]*\bduckdb\s*\.)/;function Zc(e,t){return e.includes(`mo.sql`)||Xc.test(e)||t?.has(`duckdb`)===!0}function Qc(e){return e.trim().split(/[[<>=!~;@\s]/)[0]}var $c=class{pyodide=null;packageLoadQueue=Promise.resolve();sessionGeneration=0;activeSessionStops=new Set;get requirePyodide(){return g(this.pyodide,`Pyodide not loaded`),this.pyodide}async bootstrap(e){return await this.loadPyodideAndPackages(e)}async loadPyodideAndPackages(e){if(!Jc)throw Error(`loadPyodide is not defined`);let t=Z.startSpan(`loadPyodide`);try{let n=e.pyodideIndexUrl??`https://cdn.jsdelivr.net/pyodide/${e.pyodideVersion}/full/`,r=await Jc({packages:[`micropip`,`msgspec`,Yc(e.version),`Markdown`,`pymdown-extensions`,`narwhals`,`packaging`],_makeSnapshot:!1,lockFileURL:e.pyodideLockfileUrl??`https://wasm.marimo.app/pyodide-lock.json?v=${e.version}&pyodide=${e.pyodideVersion}`,indexURL:n,packageBaseUrl:n,convertNullToNone:!0});if(e.pypiIndexUrl){let t=r.pyimport(`micropip`);try{t.set_index_urls(e.pypiIndexUrl)}finally{t.destroy()}}return this.pyodide=r,t.end(`ok`),r}catch(e){throw _.error(`Failed to load Pyodide`,e),e}}async mountFilesystem(e){let t=Z.startSpan(`mountFilesystem`);return H.createHomeDir(this.requirePyodide),H.mountFS(this.requirePyodide),await H.populateFilesToMemory(this.requirePyodide),t.end(`ok`),H.initNotebookCode({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){let t=this.sessionGeneration,{code:n,filename:r,onMessage:i,queryParameters:a,userConfig:o}=e;self.messenger={callback:i},self.query_params=a,self.user_config=o;let s=Z.startSpan(`startSession.runPython`),c=r||H.NOTEBOOK_FILENAME,l=this.requirePyodide.runPython(`
58
- print("[py] Starting marimo...")
59
- import asyncio
60
- import gc
61
- import js
62
- from marimo._pyodide.bootstrap import create_session, instantiate
63
-
64
- assert js.messenger, "messenger is not defined"
65
- assert js.query_params, "query_params is not defined"
66
-
67
- def create_session_resources():
68
- session, bridge = create_session(
69
- filename="${c}",
70
- query_params=js.query_params.to_py(),
71
- message_callback=js.messenger.callback,
72
- user_config=js.user_config.to_py(),
73
- )
74
- session_task = None
75
-
76
- def init(auto_instantiate=True):
77
- nonlocal session_task
78
- instantiate(session, auto_instantiate)
79
- session_task = asyncio.create_task(session.start())
80
-
81
- async def stop():
82
- nonlocal bridge, session, session_task
83
- task = session_task
84
- kernel_task = getattr(session, "kernel_task", None)
85
- if kernel_task is None:
86
- if task is not None:
87
- task.cancel()
88
- else:
89
- kernel_task.stop()
90
- if task is not None:
91
- await asyncio.gather(task, return_exceptions=True)
92
- if bridge is not None:
93
- bridge.session = None
94
- task = None
95
- kernel_task = None
96
- session_task = None
97
- session = None
98
- bridge = None
99
- gc.collect()
100
-
101
- with open("${c}", "r") as f:
102
- packages = session.find_packages(f.read())
103
-
104
- return bridge, init, packages, stop
105
-
106
- create_session_resources()`);s.end();let u,d,f,p;try{[u,d,f,p]=l}finally{l.destroy()}let m;try{m=new Set(f.toJs())}catch(e){throw u.destroy(),d.destroy(),p.destroy(),e}finally{f.destroy()}this.activeSessionStops.add(p);let h=this.packageLoadQueue.then(()=>{if(t===this.sessionGeneration)return this.loadNotebookDeps(n,m)});return this.packageLoadQueue=h.catch(()=>void 0),h.then(()=>{if(t===this.sessionGeneration)return d(o.runtime.auto_instantiate)}).catch(e=>{_.error(`Failed to load notebook dependencies`,e)}).finally(()=>d.destroy()),u}async stopSession(){this.sessionGeneration+=1;let e=[...this.activeSessionStops],t=!1,n;for(let r of e)try{await r(),this.activeSessionStops.delete(r),r.destroy()}catch(e){t||(t=!0,n=e)}if(t)throw n}async loadNotebookDeps(e,t){let n=this.requirePyodide;Zc(e,t)&&(e=`import pandas\n${e}`,e=`import duckdb\n${e}`,e=`import sqlglot\n${e}`,e.includes(`polars`)&&(e=`import pyarrow\n${e}`)),e=`import docutils\n${e}`,e=`import pygments\n${e}`,e=`import jedi\n${e}`,e=`import pyodide_http\n${e}`;let r=[...t],i=Z.startSpan(`pyodide.loadPackage`);await n.loadPackagesFromImports(e,{errorCallback:_.error,messageCallback:_.log}),i.end(),i=Z.startSpan(`micropip.install`);let a=r.filter(e=>!n.loadedPackages[Qc(e)]);if(a.length>0){let e=a.map(e=>[Qc(e),e]);await n.runPythonAsync(`
107
- import micropip
108
- import sys
109
- # Filter out builtins
110
- missing = [req for name, req in ${JSON.stringify(e)} if name not in sys.modules]
111
- if len(missing) > 0:
112
- print("Loading from micropip:", missing)
113
- await micropip.install(missing)
114
- `).catch(e=>{_.error(`Failed to load packages from micropip`,e)})}i.end()}};async function el(e){if(!(self.name?.includes(`::controller`)??!1))return new $c;try{return await import(`/wasm/controller.js?version=${e}`)}catch{return new $c}}function tl(e){return e.includes(`dev`),`v${zc}`}var nl=class{buffer;started=!1;onMessage;constructor(e){this.onMessage=e,this.buffer=[]}push=e=>{this.started?this.onMessage(e):this.buffer.push(e)};start=()=>{this.started=!0,this.buffer.forEach(e=>this.onMessage(e)),this.buffer=[]}};const rl=Z.startSpan(`worker:init`),il=new ue;async function al(){try{let e=await il.promise,t=tl(e.version),n=await Z.wrapAsync(el)(e.version);self.controller=n,Q.send.initializingMessage({message:`Loading marimo...`}),self.pyodide=await Z.wrapAsync(n.bootstrap.bind(n))({...e,pyodideVersion:t})}catch(e){_.error(`Error bootstrapping`,e),Q.send.initializedError({error:Rs(e)})}}const ol=new nl(e=>{Q.send.kernelMessage({message:e})}),sl=new ue;let cl=!1;const ll=u({startSession:async e=>{if(await $,cl){_.warn(`Session already started`);return}cl=!0;try{g(self.controller,`Controller not loaded`),await self.controller.mountFilesystem?.({code:e.code,filename:e.filename});let t=Z.wrapAsync(self.controller.startSession.bind(self.controller)),n=re(()=>{Q.send.initializingMessage({message:`Initializing notebook...`}),Q.send.initialized({})});Q.send.initializingMessage({message:`Loading notebook and dependencies...`});let r=await t({code:e.code,filename:e.filename,queryParameters:e.queryParameters,userConfig:e.userConfig,onMessage:e=>{n(),ol.push(e)}});sl.resolve(r),rl.end(`ok`)}catch(e){Q.send.initializedError({error:Rs(e)}),rl.end(`error`)}},loadPackages:async e=>{let t=Z.startSpan(`loadPackages`);await $,Zc(e)&&(e=`import pandas\n${e}`,e=`import duckdb\n${e}`,e=`import sqlglot\n${e}`,e.includes(`polars`)&&(e=`import pyarrow\n${e}`)),await self.pyodide.loadPackagesFromImports(e,{messageCallback:_.log,errorCallback:_.error}),t.end()},readFile:async e=>{let t=Z.startSpan(`readFile`);await $;let n=le(self.pyodide.FS.readFile(e));return t.end(),n},setInterruptBuffer:async e=>{await $,self.pyodide.setInterruptBuffer(e)},addPackage:async e=>{await $;let{package:t}=e,n=t.split(` `).map(e=>e.trim()),r=await self.pyodide.runPythonAsync(`
115
- import micropip
116
- import json
117
- response = None
118
- try:
119
- await micropip.install(${JSON.stringify(n)})
120
- response = {"success": True}
121
- except Exception as e:
122
- response = {"success": False, "error": str(e)}
123
- json.dumps(response)
124
- `);return JSON.parse(r)},removePackage:async e=>{await $;let{package:t}=e,n=await self.pyodide.runPythonAsync(`
125
- import micropip
126
- import json
127
- response = None
128
- try:
129
- micropip.uninstall("${t}")
130
- response = {"success": True}
131
- except Exception as e:
132
- response = {"success": False, "error": str(e)}
133
- json.dumps(response)
134
- `);return JSON.parse(n)},listPackages:async()=>{let e=Z.startSpan(`listPackages`);await $;let t=await self.pyodide.runPythonAsync(`
135
- import json
136
- import micropip
137
-
138
- packages = micropip.list()
139
- packages = [
140
- {"name": p.name, "version": p.version}
141
- for p in packages.values()
142
- ]
143
- json.dumps(sorted(packages, key=lambda pkg: pkg["name"]))
144
- `);return e.end(),{packages:JSON.parse(t)}},saveNotebook:async e=>{await $,await(await sl.promise).save(JSON.stringify(e))},async bridge(e){let t=Z.startSpan(`bridge`,{functionName:e.functionName});await $;let{functionName:n,payload:r}=e;n===`format`&&await self.pyodide.runPythonAsync(`
145
- import micropip
146
-
147
- try:
148
- import black
149
- except ModuleNotFoundError:
150
- await micropip.install("black")
151
- `),(n===`export_markdown`||n===`export_script`)&&await self.pyodide.runPythonAsync(`
152
- import micropip
153
-
154
- try:
155
- import yaml
156
- except ModuleNotFoundError:
157
- await micropip.install("pyyaml")
158
- `);let i=await sl.promise,a=r==null?null:typeof r==`string`?r:JSON.stringify(r),o=a==null?await i[n]():await i[n](a);return ul.has(n)&&H.persistFilesToRemote(self.pyodide),t.end(),typeof o==`string`?JSON.parse(o):o}}),Q=p({transport:ne({transportId:`marimo-transport`}),requestHandler:ll});Q.addMessageListener(`bootstrap`,e=>il.resolve(e)),Q.send(`ready`,{}),Q.addMessageListener(`consumerReady`,async()=>{await $,ol.start()});const ul=new Set([`save`,`save_app_config`,`rename_file`,`create_file_or_directory`,`delete_file_or_directory`,`copy_file_or_directory`,`move_file_or_directory`,`update_file`]),$=Z.wrapAsync(al)();export{o as t};
@@ -1,22 +0,0 @@
1
- (!globalThis.EventTarget||!globalThis.Event)&&console.error(`
2
- PartySocket requires a global 'EventTarget' class to be available!
3
- You can polyfill this global by adding this to your code before any partysocket imports:
4
-
5
- \`\`\`
6
- import 'partysocket/event-target-polyfill';
7
- \`\`\`
8
- Please file an issue at https://github.com/partykit/partykit if you're still having trouble.
9
- `);var e=class extends Event{message;error;constructor(e,t){super(`error`,t),this.message=e.message,this.error=e}},t=class extends Event{code;reason;wasClean=!0;constructor(e=1e3,t=``,n){super(`close`,n),this.code=e,this.reason=t}},n={Event,ErrorEvent:e,CloseEvent:t};function r(e,t){if(!e)throw Error(t)}function i(e){return new e.constructor(e.type,e)}function a(n){return`data`in n?new MessageEvent(n.type,n):`code`in n||`reason`in n?new t(n.code||1999,n.reason||`unknown reason`,n):`error`in n?new e(n.error,n):new Event(n.type,n)}var o=typeof process<`u`&&process.versions?.node!==void 0,s=typeof navigator<`u`&&navigator.product===`ReactNative`,c=o||s?a:i,l={maxReconnectionDelay:1e4,minReconnectionDelay:3e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},u=!1;function d(){}var f=class e extends EventTarget{_ws;_retryCount=-1;_uptimeTimeout;_connectTimeout;_shouldReconnect=!0;_connectLock=!1;_binaryType=`blob`;_closeCalled=!1;_didWarnAboutClosedSend=!1;_messageQueue=[];_debugLogger=console.log.bind(console);_url;_protocols;_options;constructor(e,t,n={}){super(),this._url=e,this._protocols=t,this._options=n,this._options.startClosed&&(this._shouldReconnect=!1),this._options.debugLogger&&(this._debugLogger=this._options.debugLogger),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return e.CONNECTING}get OPEN(){return e.OPEN}get CLOSING(){return e.CLOSING}get CLOSED(){return e.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((e,t)=>(typeof t==`string`?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e),0)+(this._ws?this._ws.bufferedAmount:0)}get extensions(){return this._ws?this._ws.extensions:``}get protocol(){return this._ws?this._ws.protocol:``}get readyState(){return this._closeCalled?e.CLOSED:this._ws?this._ws.readyState:this._options.startClosed?e.CLOSED:e.CONNECTING}get url(){return this._ws?this._ws.url:``}get shouldReconnect(){return this._shouldReconnect}onclose=null;onerror=null;onmessage=null;onopen=null;close(e=1e3,t){if(this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug(`close enqueued: no ws instance`);return}if(this._ws.readyState===this.CLOSED||this._ws.readyState===this.CLOSING){this._debug(`close: already closing or closed`);return}this._disconnect(e,t)}reconnect(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._didWarnAboutClosedSend=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED||this._ws.readyState===this.CLOSING||this._disconnect(e,t),this._connect()}send(e){if(this._ws&&this._ws.readyState===this.OPEN)return this._debug(`send`,e),this._ws.send(e),!0;this._closeCalled&&!this._didWarnAboutClosedSend&&(this._didWarnAboutClosedSend=!0,console.warn(`ReconnectingWebSocket: send() was called after close(). The message has been buffered, but it will only be delivered if reconnect() is called on this socket. If this socket has been discarded, the message is lost — this usually means a stale socket reference is being used.`));let{maxEnqueuedMessages:t=l.maxEnqueuedMessages}=this._options;return this._messageQueue.length<t&&(this._debug(`enqueue`,e),this._messageQueue.push(e)),!1}drainQueuedMessages(){let e=this._messageQueue;return this._messageQueue=[],e}_debug(...e){this._options.debug&&this._debugLogger(`RWS>`,...e)}_getNextDelay(){let{reconnectionDelayGrowFactor:e=l.reconnectionDelayGrowFactor,minReconnectionDelay:t=l.minReconnectionDelay,maxReconnectionDelay:n=l.maxReconnectionDelay}=this._options,r=0;return this._retryCount>0&&(r=t*e**(this._retryCount-1),r>n&&(r=n)),this._debug(`next delay`,r),r}_wait(){return new Promise(e=>{setTimeout(e,this._getNextDelay())})}_getNextProtocols(e){if(!e)return Promise.resolve(null);if(typeof e==`string`||Array.isArray(e))return Promise.resolve(e);if(typeof e==`function`){let t=e();if(!t)return Promise.resolve(null);if(typeof t==`string`||Array.isArray(t))return Promise.resolve(t);if(t.then)return t}throw Error(`Invalid protocols`)}_getNextUrl(e){if(typeof e==`string`)return Promise.resolve(e);if(typeof e==`function`){let t=e();if(typeof t==`string`)return Promise.resolve(t);if(t.then)return t}throw Error(`Invalid URL`)}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;let{maxRetries:e=l.maxRetries,connectionTimeout:t=l.connectionTimeout}=this._options;if(this._retryCount>=e){this._debug(`max retries reached`,this._retryCount,`>=`,e),this._connectLock=!1;return}this._retryCount++,this._debug(`connect`,this._retryCount),this._removeListeners(),this._wait().then(()=>Promise.all([this._getNextUrl(this._url),this._getNextProtocols(this._protocols||null)])).then(([e,n])=>{if(this._closeCalled){this._connectLock=!1;return}!this._options.WebSocket&&typeof WebSocket>`u`&&!u&&(console.error(`‼️ No WebSocket implementation available. You should define options.WebSocket.
10
-
11
- For example, if you're using node.js, run \`npm install ws\`, and then in your code:
12
-
13
- import PartySocket from 'partysocket';
14
- import WS from 'ws';
15
-
16
- const partysocket = new PartySocket({
17
- host: "127.0.0.1:1999",
18
- room: "test-room",
19
- WebSocket: WS
20
- });
21
-
22
- `),u=!0);let r=this._options.WebSocket||WebSocket;this._debug(`connect`,{url:e,protocols:n}),this._ws=n?new r(e,n):new r(e),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),t)}).catch(e=>{this._connectLock=!1,this._handleError(new n.ErrorEvent(Error(e.message),this))})}_handleTimeout(){this._debug(`timeout event`),this._handleError(new n.ErrorEvent(Error(`TIMEOUT`),this))}_disconnect(e=1e3,t){if(this._clearTimeouts(),this._ws){this._removeListeners();try{(this._ws.readyState===this.OPEN||this._ws.readyState===this.CONNECTING)&&this._ws.close(e,t),this._handleClose(new n.CloseEvent(e,t,this))}catch{}}}_acceptOpen(){this._debug(`accept open`),this._retryCount=0}_handleOpen=e=>{this._debug(`open event`);let{minUptime:t=l.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),t),r(this._ws,`WebSocket is not defined`),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(e=>{this._ws?.send(e)}),this._messageQueue=[],this.onopen&&this.onopen(e),this.dispatchEvent(c(e))};_handleMessage=e=>{this._debug(`message event`),this.onmessage&&this.onmessage(e),this.dispatchEvent(c(e))};_handleError=e=>{this._debug(`error event`,e.message),this._disconnect(void 0,e.message===`TIMEOUT`?`timeout`:void 0),this.onerror&&this.onerror(e),this._debug(`exec error listeners`),this.dispatchEvent(c(e)),this._connect()};_handleClose=e=>{this._debug(`close event`),this._clearTimeouts(),this._options.shouldReconnectOnClose&&!this._options.shouldReconnectOnClose(e)&&(this._shouldReconnect=!1),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(e),this.dispatchEvent(c(e))};_removeListeners(){this._ws&&(this._debug(`removeListeners`),this._ws.removeEventListener(`open`,this._handleOpen),this._ws.removeEventListener(`close`,this._handleClose),this._ws.removeEventListener(`message`,this._handleMessage),this._ws.removeEventListener(`error`,this._handleError),this._ws.addEventListener(`error`,d))}_addListeners(){this._ws&&(this._debug(`addListeners`),this._ws.addEventListener(`open`,this._handleOpen),this._ws.addEventListener(`close`,this._handleClose),this._ws.addEventListener(`message`,this._handleMessage),this._ws.addEventListener(`error`,this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}};export{f as t};
@@ -1,46 +0,0 @@
1
- /* Copyright 2026 Marimo. All rights reserved. */
2
-
3
- import { describe, expect, it } from "vitest";
4
- import { z } from "zod";
5
- import { parseNotebookEvent } from "../events";
6
-
7
- describe("notebook messages", () => {
8
- it("normalizes session and host envelopes for native marimo messages", () => {
9
- const notification = {
10
- op: "variables",
11
- variables: [{ name: "x", value: Number.NaN }],
12
- };
13
- const host = { event: "marimo", data: { marimo: notification } };
14
- expect(parseNotebookEvent({ data: notification })).toEqual(host);
15
- expect(parseNotebookEvent({ ...host, id: "42" })).toEqual({
16
- ...host,
17
- id: "42",
18
- });
19
- });
20
-
21
- it("retains unknown event cursors without interpreting their payloads", () => {
22
- expect(
23
- parseNotebookEvent({ event: "future", id: "42", data: null }),
24
- ).toEqual({ event: "unknown", name: "future", id: "42" });
25
- });
26
-
27
- it("decodes known events outside the client's subscription filters", () => {
28
- const event = {
29
- event: "run.removed",
30
- id: "42",
31
- data: { id: "r1", time: "2026-10-19T12:00:00Z" },
32
- };
33
- expect(parseNotebookEvent(event)).toEqual(event);
34
- });
35
-
36
- it.each([
37
- { event: "cell", id: "42", data: { cell: { id: "c1" } } },
38
- { event: "run.removed", id: "42", data: {} },
39
- { event: "ready", data: {} },
40
- { event: "marimo", data: {} },
41
- {},
42
- null,
43
- ])("rejects malformed known messages: %j", (message) => {
44
- expect(() => parseNotebookEvent(message)).toThrow(z.ZodError);
45
- });
46
- });