@marimo-team/islands 0.24.3-dev9 → 0.25.0

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 (440) hide show
  1. package/dist/{ConnectedDataExplorerComponent-C9OF_75w.js → ConnectedDataExplorerComponent-KVhjDMSe.js} +1066 -1066
  2. package/dist/ErrorBoundary-DnNkbB_U.js +200 -0
  3. package/dist/{ImageComparisonComponent-2a9TMMm2.js → ImageComparisonComponent-Dlm5aWnH.js} +4 -4
  4. package/dist/{Plot-C-9MQeGP.js → Plot-CTyjbQDT.js} +21032 -20666
  5. package/dist/_baseMerge-BiGRwuqv.js +165 -0
  6. package/dist/{abnfDiagram-N423BO3Z-CQKwzX8t.js → abnfDiagram-VCTEODGH-CpN0FRda.js} +17 -18
  7. package/dist/{any-language-editor-DmQ7dyCx.js → any-language-editor-CycIVIeP.js} +17 -17
  8. package/dist/arc-7ra3iNdN.js +81 -0
  9. package/dist/architecture-7GRP2DOG-BWLylgiA.js +3 -0
  10. package/dist/{architectureDiagram-T3A2C74G-CncrDpfa.js → architectureDiagram-5GKGNRK7-DDyj5SRB.js} +25 -25
  11. package/dist/assets/__vite-browser-external-C9iR87Zl.js +1 -0
  12. package/dist/assets/worker-D7hWi02M.js +109 -0
  13. package/dist/blockDiagram-I7D4REHJ-BbXEXJRu.js +1922 -0
  14. package/dist/{button-CKBkqR9J.js → button-DdXAm8iz.js} +5 -5
  15. package/dist/{c4Diagram-5PPSVZJV-DarUk3Yq.js → c4Diagram-7LVT6UL2-DcLsbQmR.js} +696 -668
  16. package/dist/{capabilities-CMBBJTcc.js → capabilities-B3ce_GNu.js} +1 -1
  17. package/dist/{html-to-image-BtFMe_Nq.js → cells-DYIkSxs6.js} +6757 -10137
  18. package/dist/{channel-CyiYUzJv.js → channel-B5XnTarr.js} +1 -1
  19. package/dist/chat-ui-BXj3uYjy.js +5786 -0
  20. package/dist/{check-CHig47QV.js → check-B7cIK6gb.js} +1 -1
  21. package/dist/{chunk-2Q5K7J3B-BMuJl2jB.js → chunk-2Q5K7J3B-BMkUkeuy.js} +2 -2
  22. package/dist/chunk-4HAMMTFA-D2qv8E0X.js +4188 -0
  23. package/dist/{chunk-5VM5RSS4-Bcq0ftdy.js → chunk-5VM5RSS4-DKsmPCL6.js} +2 -2
  24. package/dist/{chunk-NSK5VX7P-CDTMcJB0.js → chunk-75Z2AOVW-5_HsvXwr.js} +23 -23
  25. package/dist/{chunk-I66GZJ75-BqyTCAPf.js → chunk-DU6HZSFF-BUgAHvnM.js} +21 -4
  26. package/dist/{chunk-2GRJ4B5K-DgO8Qudq.js → chunk-F27PBJKO-DHmYWZXr.js} +4 -4
  27. package/dist/{chunk-KEIR6QF5-C4KX3XYh.js → chunk-FOHPRMQF-BpYR8RqP.js} +4 -4
  28. package/dist/{chunk-WRU74C26-BpWsbiDK.js → chunk-GMAD6QVW-Czynz8aA.js} +486 -258
  29. package/dist/chunk-GVQU2GXP-yQEdulRS.js +37 -0
  30. package/dist/{chunk-5RXB4S5H-tLNUVDdO.js → chunk-IMKFNOWR-BfwTebD0.js} +11 -11
  31. package/dist/{chunk-JWPE2WC7-BJwjGUnF.js → chunk-JWPE2WC7-DJvv1t8U.js} +2 -2
  32. package/dist/chunk-L3NEJ4N5-DwRWnDDK.js +245 -0
  33. package/dist/{chunk-7Z6QIM7H-Dc18hFxH.js → chunk-OSK3NFVY-BBKU_Ign.js} +222 -144
  34. package/dist/{chunk-W5SLKNZC-DLnvpEtV.js → chunk-P2QGCYS3-C0iGU29N.js} +20 -20
  35. package/dist/{chunk-KBJHAD2P-BuqWqkcW.js → chunk-POPQ4Y6H-BCbS3Ozc.js} +4 -4
  36. package/dist/{chunk-4I5QYGJK-DpytHuZQ.js → chunk-PWAF6VOD-CTFCL0jI.js} +4 -4
  37. package/dist/{chunk-JQJVKLGR-CgqCwe8E.js → chunk-SHT3W25Y-BspJEJ5H.js} +109 -63
  38. package/dist/{chunk-6Q2QTUOP-DmTcEBMn.js → chunk-SVP7TREG-DX3rFNTe.js} +5 -5
  39. package/dist/{chunk-GF5L2VYU-B0wgCQgS.js → chunk-TICWLB2K-fVF7Uujg.js} +13 -13
  40. package/dist/{chunk-XXDRQBXY-D73H4IN0.js → chunk-XXDRQBXY-Dnl5VBqG.js} +3 -3
  41. package/dist/{chunk-Y2CYZVJY-DoegUj_e.js → chunk-Y2CYZVJY-DKKS1VyV.js} +1 -1
  42. package/dist/{chunk-5FQGJX7Z-B85XCPv6.js → chunk-YOKDWASO-DrWbKnxA.js} +6925 -5460
  43. package/dist/classDiagram-ZZMXUADV-Fe-V14Sc.js +30 -0
  44. package/dist/classDiagram-v2-VYDZK3BY-xTDg7lOs.js +30 -0
  45. package/dist/code-visibility-DElzk_hh.js +138 -0
  46. package/dist/{common-Cv-4hMa0.js → common-B4-ih9IA.js} +8838 -12645
  47. package/dist/{compiler-runtime-CAH9RLw2.js → compiler-runtime-Cj8ZWiNS.js} +2 -2
  48. package/dist/copy-icon-CLdENY__.js +190 -0
  49. package/dist/{cose-bilkent-JH36ORCC-FUWHkXFX.js → cose-bilkent-JH36ORCC-_LyRKVqm.js} +2 -2
  50. package/dist/cubic-OaEBhQPK.js +1404 -0
  51. package/dist/cynefin-OW5HDTMX-obq-i80l.js +3 -0
  52. package/dist/{cynefinDiagram-MW4NZA55-BXSFK93J.js → cynefinDiagram-5FMLGOSQ-CFQrqzSX.js} +10 -10
  53. package/dist/{dagre-CGyalH38.js → dagre-BGSfXNEb.js} +678 -537
  54. package/dist/dagre-GXQ25YYZ-xHNAUTyG.js +425 -0
  55. package/dist/{data-grid-overlay-editor-DZM4BAaI.js → data-grid-overlay-editor-CRH6JQPE.js} +8 -9
  56. package/dist/{data-grid-types-BnZwWG8z.js → data-grid-types-BucVmDDp.js} +1 -1
  57. package/dist/{defaultLocale-DKaU_opG.js → defaultLocale-JI_lnoCe.js} +1 -1
  58. package/dist/{diagram-7IWD3JNH-BjfzDNvj.js → diagram-S7CK7UJ4-Bt1rPbAx.js} +40 -39
  59. package/dist/{diagram-UB23O5K3-DDg-7wLA.js → diagram-UQ7AKVKN-D1sq5FoZ.js} +10 -10
  60. package/dist/{diagram-B4RE2ZJO-CKccR9eE.js → diagram-VSXAHHWV-BKpmG23x.js} +10 -10
  61. package/dist/{diagram-Q27KOJAE-Zhz01ss7.js → diagram-VX7I27RA-BMwGFVD6.js} +21 -21
  62. package/dist/{diagram-LBJQPF4R-CJ-bOruh.js → diagram-Z3DM3KII--KLDR9Pl.js} +10 -10
  63. package/dist/dialog-CgNq6y9-.js +94 -0
  64. package/dist/{dist-dAqZAPcF.js → dist-1HDa70oE.js} +3 -3
  65. package/dist/{dist-Re9sOPOx.js → dist-9x1ZRe-e.js} +2 -2
  66. package/dist/{dist-DEeLqRlU.js → dist-B1vYLK28.js} +1 -1
  67. package/dist/{dist-C5Bn52W4.js → dist-B8D7McG3.js} +3 -3
  68. package/dist/{dist-_XvgytiS.js → dist-BHCHt1NI.js} +1 -1
  69. package/dist/{dist-CRjAdnqF.js → dist-BRxfaJgs.js} +3 -3
  70. package/dist/{dist-Byj2bV8o.js → dist-BVGtK7Ht.js} +1 -1
  71. package/dist/{dist-BIN5LKyE.js → dist-BaHjhkpZ.js} +2 -2
  72. package/dist/{dist-DVFbIwc5.js → dist-BtKIs9N-.js} +1 -1
  73. package/dist/{dist-BrQGcfQ9.js → dist-C2KzV-vf.js} +2 -2
  74. package/dist/{dist-DJFiGP2k.js → dist-C2wDlYdD.js} +2 -2
  75. package/dist/{dist-BVRM2y1P.js → dist-C8xMLVYi.js} +2 -2
  76. package/dist/dist-CMh_W4y4.js +538 -0
  77. package/dist/{extends-BPB6_lTK.js → dist-CO1AwwG_.js} +516 -561
  78. package/dist/{dist-BzN60Z2s.js → dist-CPGxfVGX.js} +1 -1
  79. package/dist/{dist-C7v-9nUK.js → dist-Cm3iAFMD.js} +3 -3
  80. package/dist/{dist-CGAxEiaM.js → dist-Cs2FijYk.js} +2 -2
  81. package/dist/{dist-hXd65f0_.js → dist-D1PpnuZB.js} +1 -1
  82. package/dist/{dist-VdvbxG72.js → dist-DHOTQar0.js} +1 -1
  83. package/dist/{dist-DcgzXCfy.js → dist-DPcEtqmG.js} +2 -2
  84. package/dist/{dist-D4Z_qdP4.js → dist-Df0wKI0F.js} +1 -1
  85. package/dist/{dist-qhLI-SHd.js → dist-DszxuxS1.js} +2 -2
  86. package/dist/{dist-BEmkrGoQ.js → dist-Kxgjxakw.js} +1 -1
  87. package/dist/{dist-BbSMhhD2.js → dist-KzZ7WELx.js} +2 -2
  88. package/dist/{dist-jWUab2d1.js → dist-lA1Cttkb.js} +1 -1
  89. package/dist/dropdown-menu-CZgjYSAh.js +4502 -0
  90. package/dist/{ebnfDiagram-BXEA7PRR-Dm75pCAS.js → ebnfDiagram-PWID7BFC-WnG4cvSQ.js} +17 -18
  91. package/dist/{erDiagram-JOGREHBK-rVDG3VSQ.js → erDiagram-RLTQ6QDP-DhzKiYHc.js} +1037 -798
  92. package/dist/error-banner-B94dcDmP.js +391 -0
  93. package/dist/error-entries-C0NsUqXl.js +56 -0
  94. package/dist/{esm-CR1nhb1c.js → esm-BElI3qKH.js} +22 -22
  95. package/dist/{esm-C1d0g6Bv.js → esm-G4Fhsgng.js} +51 -37
  96. package/dist/{esm-CesmlDrs.js → esm-h8f7-1CJ.js} +423 -423
  97. package/dist/eventmodeling-NTZA5JFV-D7nP7Uyu.js +3 -0
  98. package/dist/feedback-button-cQcMqpEP.js +380 -0
  99. package/dist/flowDiagram-HODETNUW-6dMdB8pR.js +16 -0
  100. package/dist/{formats-CslNOKy0.js → formats-BR5iGb4s.js} +8 -8
  101. package/dist/{ganttDiagram-PKOTCBZU-9D-LXF6P.js → ganttDiagram-EL5Y4UJY-DbzEBLbl.js} +15 -15
  102. package/dist/gitGraph-4MIJSDKK-Dy9uQXGh.js +3 -0
  103. package/dist/{gitGraphDiagram-DS77QQ5N-BfpsXTLf.js → gitGraphDiagram-WWUBYQGX-BMf0iKi1.js} +10 -10
  104. package/dist/{glide-data-editor-sPZ8fUFn.js → glide-data-editor-DYOxfSzI.js} +2143 -1910
  105. package/dist/{glide-utils-NShAPPtn.js → glide-utils-B3rUT5PI.js} +15 -15
  106. package/dist/globals-BOoLHa7X.js +19 -0
  107. package/dist/highlighted-body-KPVGNVTW-Ad3MKZ18.js +38 -0
  108. package/dist/html-to-image-CeYYvQNb.js +3272 -0
  109. package/dist/info-A6RAGUB7-DKoayiHY.js +3 -0
  110. package/dist/{infoDiagram-6WML65LV-DqCTXHVy.js → infoDiagram-27XIBGKW-BagtCX_5.js} +7 -7
  111. package/dist/{ishikawaDiagram-WSZJBQD7-BCUYmZ1v.js → ishikawaDiagram-5VMMS53U-DByDehYy.js} +8 -8
  112. package/dist/{journeyDiagram-NVQOT4AX-BXB6M4zN.js → journeyDiagram-3NMN7TZE-D2LcKDUO.js} +8 -8
  113. package/dist/{jsx-runtime-CpoKNRgu.js → jsx-runtime-DgDPJV9S.js} +1 -1
  114. package/dist/{kanban-definition-27J2QSJJ-CGRhrDUX.js → kanban-definition-UXKFOSKX-BxwkbBI_.js} +29 -29
  115. package/dist/katex-DFBiSucW.js +21840 -0
  116. package/dist/{label-lwzzBHUW.js → label-BJ49YTvk.js} +6 -6
  117. package/dist/{linear-D5r_1YqD.js → linear-Cnaq3Tfb.js} +4 -4
  118. package/dist/{loader-VZ__bv4g.js → loader-D2W4oM-3.js} +15 -15
  119. package/dist/main.js +8113 -13475
  120. package/dist/mermaid-DPNuhemn.js +3084 -0
  121. package/dist/mermaid-HWGCJPDP-DYCzSILp.js +2 -0
  122. package/dist/mermaid-parser.core-DxuSfYwJ.js +638 -0
  123. package/dist/{mhchem-BjwrxcV-.js → mhchem-DWCF06w9.js} +1 -1
  124. package/dist/{micromark-factory-space-DruVGzeG.js → micromark-factory-space-DGxAzmw8.js} +2 -2
  125. package/dist/{mindmap-definition-FAOFIHXS-C9gRhzZq.js → mindmap-definition-YA3MSWOX-Cgvojw3y.js} +17 -17
  126. package/dist/{node-sql-parser-DesT1xNw.js → node-sql-parser-BiZOJ-FS.js} +0 -3
  127. package/dist/{number-overlay-editor-De2CabLL.js → number-overlay-editor-DZp5bEmI.js} +5 -5
  128. package/dist/objectWithoutPropertiesLoose-BRDcTsfB.js +23 -0
  129. package/dist/packet-AYTQ26CC-Yw7ajchJ.js +3 -0
  130. package/dist/{pegDiagram-VL7TDLO6-Df9IUjMD.js → pegDiagram-XKGWAZYB-DahHhYyN.js} +19 -20
  131. package/dist/{pick-SnHlmIBN.js → pick-CJeoxYOS.js} +1 -1
  132. package/dist/pie-WAS4IAKB-BKdKOAkL.js +3 -0
  133. package/dist/{pieDiagram-7S7Q4E2Y-BmRzQ8ZP.js → pieDiagram-E7YTZNPT-CCtX0oCK.js} +29 -31
  134. package/dist/{process-output-CPy0YKUe.js → process-output-BCTjlyuH.js} +7 -6
  135. package/dist/purify.es-DgKyQviY.js +805 -0
  136. package/dist/{quadrantDiagram-CIZ2JOQS-wFBvWcxS.js → quadrantDiagram-AXDQQJYC-DftINo6g.js} +5 -5
  137. package/dist/radar-RG4KPBEZ-ScR_D_Ts.js +3 -0
  138. package/dist/railroad-74A4TZTK-DQvPSdo5.js +3 -0
  139. package/dist/railroad-abnf-HS5TGJTU-CsJQG2O8.js +3 -0
  140. package/dist/railroad-ebnf-LZEXJU2U-BgEobkSn.js +3 -0
  141. package/dist/railroad-peg-WCYAUIDC-DjLAjofI.js +3 -0
  142. package/dist/{railroadDiagram-AXF67PYL-DxbIatiN.js → railroadDiagram-O6MQD6OU-Du5NsPUb.js} +17 -18
  143. package/dist/{react-dom-C94wmq5w.js → react-dom-BUgJ-ab_.js} +3 -3
  144. package/dist/{react-DMWcHin-.js → react-ofJbxM4x.js} +2 -2
  145. package/dist/{react-vega-DSD5aT7_.js → react-vega-5AcMW8gG.js} +10012 -9369
  146. package/dist/{requirementDiagram-LRYGKXZP-X_x-Y713.js → requirementDiagram-BXWQKSXE-0pmmxL6_.js} +20 -19
  147. package/dist/{reveal-component-CVsYlb9J.js → reveal-component-C9h2Lubu.js} +1303 -1237
  148. package/dist/{sankeyDiagram-W5VNT64P-BYJALbbm.js → sankeyDiagram-P5KCCOFB-CDKR5TJH.js} +4 -4
  149. package/dist/{select-3qHpFKF9.js → select-C6plhmZr.js} +317 -562
  150. package/dist/{sequenceDiagram-SI44F4Z6-BiPBe3Sv.js → sequenceDiagram-WJ2MYXX4-DB-ChWwU.js} +11 -11
  151. package/dist/{sizeCapture-X5ZJPWSS-BKLDeh5H.js → sizeCapture-INFHLROL-Dx5SpkQF.js} +2 -2
  152. package/dist/{spec-CutWdqo3.js → spec-CAYwFeV6.js} +4 -4
  153. package/dist/{src-C31ngt98.js → src-CA_m4ONl.js} +298 -303
  154. package/dist/{stateDiagram-OKZ733FA-B7QyNBxH.js → stateDiagram-D77RDMKH-orN6AwMx.js} +19 -20
  155. package/dist/stateDiagram-v2-MP3YSRHH-o05_rJN8.js +30 -0
  156. package/dist/style.css +2 -2
  157. package/dist/{swimlanes-SLNWSIFB-B4f8VP3b.js → swimlanes-42K2YHIH-BkSDcqDT.js} +1501 -1591
  158. package/dist/swimlanesDiagram-VR7AAH4N-D_nFQfRc.js +30 -0
  159. package/dist/{swiper-component-C90YjhaV.js → swiper-component-IOUowglM.js} +39 -26
  160. package/dist/{time-aWGfjN8x.js → time-BieKwdYS.js} +42 -42
  161. package/dist/{timeline-definition-Z64GVDOM-Dacq_5lr.js → timeline-definition-24CTP7MA-BuqJUIRZ.js} +7 -7
  162. package/dist/{toDate-CpXBeDq0.js → toDate-WXg1yLcI.js} +7 -7
  163. package/dist/toast-DvY70eFX.js +1834 -0
  164. package/dist/tooltip-qB8NlSqV.js +1742 -0
  165. package/dist/treeView-Q6P3EWNA-DuRV97YF.js +3 -0
  166. package/dist/treemap-WGGIJYW6-AsLq-uwC.js +3 -0
  167. package/dist/use-restore-focus-D5D9xEjZ.js +5946 -0
  168. package/dist/{use-vega-container-remeasure-DUW4tRxq.js → use-vega-container-remeasure-4DwJbPWu.js} +2 -2
  169. package/dist/{useAsyncData-CH6-CgJF.js → useAsyncData-BD6AStMt.js} +3 -3
  170. package/dist/{useDateFormatter-Cp9Jdxls.js → useDateFormatter-BRTPsUK7.js} +8 -8
  171. package/dist/{useDeepCompareMemoize-JC87C_jO.js → useDeepCompareMemoize-D_HNdyvI.js} +2 -2
  172. package/dist/{useIframeCapabilities-De3C-9b4.js → useIframeCapabilities-CVtNkI3Y.js} +2 -2
  173. package/dist/{useLifecycle-B4RGlyf0.js → useLifecycle-DPgiiwwU.js} +6 -6
  174. package/dist/useNumberFormatter-BfDpa21j.js +251 -0
  175. package/dist/useTheme-DzXmYZ5V.js +904 -0
  176. package/dist/{vega-component-ovBXgp91.js → vega-component-D0QXopU8.js} +34 -34
  177. package/dist/{vega-embed-container-TJ5z5dZw.js → vega-embed-container-CbnTccZi.js} +6 -6
  178. package/dist/vega-loader.browser-D95WfUcj.js +1139 -0
  179. package/dist/{vennDiagram-T6HMQDX7-D-Rcq3Iu.js → vennDiagram-4TSXK5OY-CTUlJ2PK.js} +9 -9
  180. package/dist/wardley-WFR3VGLG-Na-tFhQJ.js +3 -0
  181. package/dist/{wardleyDiagram-T6FBY63Y-Z-Og7_Wd.js → wardleyDiagram-VM6X3IG4-3evLUb0M.js} +10 -10
  182. package/dist/{xychartDiagram-ELKLHX3M-BDJ2dITA.js → xychartDiagram-S5SC5T6Z-DL2E3K8-.js} +248 -139
  183. package/package.json +54 -57
  184. package/src/__mocks__/notebook.ts +1 -0
  185. package/src/__mocks__/requests.ts +7 -0
  186. package/src/__tests__/__snapshots__/CellStatus.test.tsx.snap +12 -12
  187. package/src/__tests__/fixtures/pair-preview.ts +19 -0
  188. package/src/__tests__/mount.test.ts +18 -0
  189. package/src/components/app-config/optional-features.tsx +6 -0
  190. package/src/components/chat/acp/__tests__/agent-panel-initialization.test.tsx +394 -0
  191. package/src/components/chat/acp/__tests__/agent-panel.test.tsx +272 -0
  192. package/src/components/chat/acp/__tests__/state.test.ts +2 -2
  193. package/src/components/chat/acp/agent-panel.tsx +115 -74
  194. package/src/components/chat/acp/state.ts +1 -1
  195. package/src/components/data-table/__tests__/filters.test.ts +21 -21
  196. package/src/components/data-table/charts/__tests__/spec.test.ts +5 -10
  197. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +2 -6
  198. package/src/components/data-table/column-summary/chart-spec-model.tsx +1 -1
  199. package/src/components/data-table/columns.tsx +64 -67
  200. package/src/components/editor/RecoveryButton.tsx +1 -0
  201. package/src/components/editor/__tests__/dynamic-favicon.test.tsx +36 -2
  202. package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +115 -0
  203. package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +218 -0
  204. package/src/components/editor/actions/pair-with-agent-commands.ts +46 -9
  205. package/src/components/editor/actions/pair-with-agent-modal.tsx +49 -23
  206. package/src/components/editor/ai/add-cell-with-ai.tsx +1 -0
  207. package/src/components/editor/ai/ai-completion-editor.tsx +3 -1
  208. package/src/components/editor/alerts/__tests__/connection-notice.test.tsx +186 -0
  209. package/src/components/editor/alerts/__tests__/startup-progress.test.tsx +185 -0
  210. package/src/components/editor/alerts/connecting-alert.tsx +1 -66
  211. package/src/components/editor/alerts/connection-notice.tsx +186 -0
  212. package/src/components/editor/alerts/startup-output.tsx +173 -0
  213. package/src/components/editor/alerts/startup-progress.tsx +204 -0
  214. package/src/components/editor/app-container.tsx +9 -3
  215. package/src/components/editor/boundary/ErrorBoundary.tsx +38 -16
  216. package/src/components/editor/boundary/__tests__/ErrorBoundary.test.tsx +311 -0
  217. package/src/components/editor/cell/__tests__/toolbar.test.tsx +73 -0
  218. package/src/components/editor/cell/code/__tests__/rtc-editor-config.test.ts +50 -0
  219. package/src/components/editor/cell/code/cell-editor.tsx +41 -42
  220. package/src/components/editor/cell/toolbar.tsx +11 -0
  221. package/src/components/editor/chrome/components/__tests__/feedback-button.test.tsx +94 -0
  222. package/src/components/editor/chrome/components/feedback-button.tsx +63 -42
  223. package/src/components/editor/chrome/panels/__tests__/packages-panel.test.tsx +164 -8
  224. package/src/components/editor/chrome/panels/__tests__/sandbox-details.test.tsx +358 -0
  225. package/src/components/editor/chrome/panels/__tests__/sandbox-recovery.test.tsx +168 -0
  226. package/src/components/editor/chrome/panels/packages-panel.tsx +113 -175
  227. package/src/components/editor/chrome/panels/sandbox-controller.tsx +106 -0
  228. package/src/components/editor/chrome/panels/sandbox-details-state.ts +38 -0
  229. package/src/components/editor/chrome/panels/sandbox-panel.tsx +230 -0
  230. package/src/components/editor/chrome/panels/sandbox-toggle.tsx +52 -0
  231. package/src/components/editor/chrome/wrapper/app-chrome.tsx +7 -0
  232. package/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx +3 -1
  233. package/src/components/editor/code/__tests__/readonly-diff.test.tsx +65 -0
  234. package/src/components/editor/code/readonly-diff.tsx +1 -1
  235. package/src/components/editor/connections/database/__tests__/__snapshots__/as-code.test.ts.snap +98 -98
  236. package/src/components/editor/connections/database/__tests__/as-code.test.ts +11 -5
  237. package/src/components/editor/dynamic-favicon.tsx +17 -10
  238. package/src/components/editor/file-tree/__tests__/file-explorer-navigation.test.tsx +13 -11
  239. package/src/components/editor/file-tree/__tests__/tree-actions.test.tsx +54 -0
  240. package/src/components/editor/file-tree/tree-actions.tsx +11 -14
  241. package/src/components/editor/header/__tests__/status.test.tsx +8 -20
  242. package/src/components/editor/header/filename-input.tsx +2 -0
  243. package/src/components/editor/header/status.tsx +5 -3
  244. package/src/components/editor/navigation/clipboard.ts +1 -0
  245. package/src/components/editor/notebook-cell.tsx +4 -2
  246. package/src/components/editor/output/JsonOutput.tsx +182 -632
  247. package/src/components/editor/output/Outputs.css +49 -17
  248. package/src/components/editor/output/__tests__/JsonOutput-interactions.test.tsx +254 -0
  249. package/src/components/editor/output/__tests__/JsonOutput-mimetype.test.tsx +41 -46
  250. package/src/components/editor/output/__tests__/{json-output.test.ts → json-output-formatting.test.ts} +113 -75
  251. package/src/components/editor/output/__tests__/json-output-pagination.test.ts +252 -0
  252. package/src/components/editor/output/json-output/formatting.ts +167 -0
  253. package/src/components/editor/output/json-output/pagination.ts +155 -0
  254. package/src/components/editor/output/json-output/renderers.tsx +196 -0
  255. package/src/components/editor/output/json-output/themes.ts +52 -0
  256. package/src/components/editor/package-alert.tsx +112 -66
  257. package/src/components/editor/renderers/cell-array.tsx +1 -5
  258. package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +3 -7
  259. package/src/components/slides/slide-form.tsx +1 -0
  260. package/src/components/slides/slide-notes-editor.tsx +1 -0
  261. package/src/components/tracing/tracing-spec.ts +1 -1
  262. package/src/components/ui/__tests__/badge.test.ts +6 -4
  263. package/src/components/ui/use-toast.ts +8 -0
  264. package/src/core/MarimoApp.tsx +0 -2
  265. package/src/core/ai/context/providers/__tests__/error.test.ts +16 -22
  266. package/src/core/alerts/__tests__/environment.test.ts +183 -0
  267. package/src/core/alerts/__tests__/state.test.tsx +240 -0
  268. package/src/core/alerts/environment.ts +57 -0
  269. package/src/core/alerts/state.ts +155 -99
  270. package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +296 -259
  271. package/src/core/cells/__tests__/apply-transaction.test.ts +34 -0
  272. package/src/core/cells/__tests__/cell.test.ts +61 -0
  273. package/src/core/cells/__tests__/cells.test.ts +182 -37
  274. package/src/core/cells/__tests__/document-changes.test.ts +39 -1
  275. package/src/core/cells/__tests__/outputs.test.tsx +117 -0
  276. package/src/core/cells/__tests__/pending-delete-service.test.tsx +4 -3
  277. package/src/core/cells/__tests__/session.test.ts +7 -0
  278. package/src/core/cells/cell.ts +9 -1
  279. package/src/core/cells/cells.ts +13 -18
  280. package/src/core/cells/document-changes.ts +11 -1
  281. package/src/core/cells/outputs.ts +66 -9
  282. package/src/core/cells/pending-delete-service.ts +12 -16
  283. package/src/core/cells/session.ts +2 -0
  284. package/src/core/cells/types.ts +2 -0
  285. package/src/core/codemirror/find-replace/__tests__/navigate.test.ts +8 -16
  286. package/src/core/codemirror/language/__tests__/sql.test.ts +70 -2
  287. package/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts +4 -8
  288. package/src/core/codemirror/language/languages/sql/sql.ts +16 -1
  289. package/src/core/codemirror/rtc/extension.ts +5 -2
  290. package/src/core/config/pair.ts +19 -0
  291. package/src/core/datasets/__tests__/data-source.test.ts +2 -0
  292. package/src/core/datasets/data-source-connections.ts +15 -10
  293. package/src/core/edit-app.tsx +8 -5
  294. package/src/core/errors/state.ts +1 -2
  295. package/src/core/export/__tests__/hooks.test.ts +1 -6
  296. package/src/core/islands/bootstrap.ts +3 -1
  297. package/src/core/islands/bridge.ts +3 -0
  298. package/src/core/islands/worker-factory.ts +2 -12
  299. package/src/core/kernel/messages.ts +2 -2
  300. package/src/core/network/__tests__/requests-network.test.ts +4 -3
  301. package/src/core/network/connection-notice.ts +117 -0
  302. package/src/core/network/connection.ts +19 -0
  303. package/src/core/network/requests-lazy.ts +3 -0
  304. package/src/core/network/requests-network.ts +12 -0
  305. package/src/core/network/requests-static.ts +3 -0
  306. package/src/core/network/requests-toasting.tsx +3 -0
  307. package/src/core/network/resolve.ts +2 -1
  308. package/src/core/network/types.ts +7 -0
  309. package/src/core/network/useConnectionNotice.ts +53 -0
  310. package/src/core/packages/__tests__/usePackageAction.test.tsx +129 -0
  311. package/src/core/packages/__tests__/useSandboxController.test.tsx +246 -0
  312. package/src/core/packages/package-data.ts +35 -0
  313. package/src/core/packages/sandbox-state.ts +67 -0
  314. package/src/core/packages/toast-components.tsx +11 -0
  315. package/src/core/packages/useInstallPackage.ts +1 -1
  316. package/src/core/packages/usePackageAction.ts +51 -0
  317. package/src/core/packages/usePackageDependencies.ts +22 -0
  318. package/src/core/packages/useSandboxController.ts +208 -0
  319. package/src/core/run-app.tsx +2 -0
  320. package/src/core/static/__tests__/files.test.ts +12 -30
  321. package/src/core/wasm/__tests__/bootstrap.test.ts +63 -0
  322. package/src/core/wasm/__tests__/bridge.test.ts +13 -4
  323. package/src/core/wasm/__tests__/fs.test.ts +22 -0
  324. package/src/core/wasm/__tests__/runtime-config.test.ts +65 -0
  325. package/src/core/wasm/bridge.ts +35 -23
  326. package/src/core/wasm/rpc.ts +2 -0
  327. package/src/core/wasm/runtime-config.ts +31 -0
  328. package/src/core/wasm/worker/bootstrap.ts +21 -11
  329. package/src/core/wasm/worker/constants.ts +1 -0
  330. package/src/core/wasm/worker/fs.ts +4 -0
  331. package/src/core/wasm/worker/getController.ts +3 -1
  332. package/src/core/wasm/worker/save-worker.ts +10 -9
  333. package/src/core/wasm/worker/types.ts +6 -4
  334. package/src/core/wasm/worker/worker.ts +9 -9
  335. package/src/core/websocket/__tests__/useMarimoKernelConnection.hook.test.tsx +404 -3
  336. package/src/core/websocket/__tests__/useMarimoKernelConnection.test.ts +8 -6
  337. package/src/core/websocket/transports/transport.ts +1 -1
  338. package/src/core/websocket/transports/ws.ts +1 -1
  339. package/src/core/websocket/types.ts +11 -1
  340. package/src/core/websocket/useMarimoKernelConnection.tsx +63 -16
  341. package/src/hooks/useDebounce.ts +2 -0
  342. package/src/mount.tsx +3 -0
  343. package/src/plugins/core/BadPlugin.tsx +3 -14
  344. package/src/plugins/core/RenderHTML.tsx +22 -2
  345. package/src/plugins/core/__test__/RenderHTML.test.ts +187 -0
  346. package/src/plugins/core/registerReactComponent.tsx +0 -1
  347. package/src/plugins/impl/FileBrowserPlugin.tsx +10 -4
  348. package/src/plugins/impl/FormPlugin.tsx +2 -0
  349. package/src/plugins/impl/MatrixPlugin.tsx +2 -0
  350. package/src/plugins/impl/RangeSliderPlugin.tsx +2 -0
  351. package/src/plugins/impl/SliderPlugin.tsx +2 -0
  352. package/src/plugins/impl/__tests__/FileBrowserPlugin.test.tsx +50 -1
  353. package/src/plugins/impl/data-editor/__tests__/glide-data-editor.test.tsx +23 -18
  354. package/src/plugins/impl/data-frames/panel.tsx +1 -0
  355. package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +1 -1
  356. package/src/plugins/impl/image-comparison/__tests__/ImageComparisonComponent.test.tsx +15 -0
  357. package/src/plugins/impl/vega/__tests__/make-selectable.test.ts +42 -48
  358. package/src/plugins/layout/AccordionPlugin.tsx +7 -2
  359. package/src/plugins/layout/JsonOutputPlugin.tsx +7 -10
  360. package/src/plugins/layout/__test__/AccordionPlugin.test.tsx +66 -0
  361. package/src/stories/sandbox.stories.tsx +488 -0
  362. package/src/utils/__tests__/path.test.ts +6 -5
  363. package/src/utils/__tests__/worker.test.ts +81 -0
  364. package/src/utils/worker.ts +22 -0
  365. package/dist/ErrorBoundary-CR-ZQN_c.js +0 -125
  366. package/dist/_baseMerge-Dv8bBloN.js +0 -73
  367. package/dist/_initCloneObject---vediN2.js +0 -95
  368. package/dist/arc-DOVLrCPd.js +0 -82
  369. package/dist/architecture-TIHT7OUA-MiJpPpQW.js +0 -3
  370. package/dist/array-CApNbSU9.js +0 -6
  371. package/dist/assets/__vite-browser-external-BdKGjRZ4.js +0 -1
  372. package/dist/assets/worker-DlIBfp9S.js +0 -98
  373. package/dist/blockDiagram-VBNYF7ZC-Bc--I65C.js +0 -3158
  374. package/dist/chat-ui-BSwr409J.js +0 -8455
  375. package/dist/chunk-3NCLNEKW-BIp_lB_4.js +0 -14
  376. package/dist/chunk-5FCAYU7R-C_HO9A1J.js +0 -23
  377. package/dist/chunk-5HE753X5-Bixm_MV-.js +0 -38
  378. package/dist/chunk-5JV3BV7I-CH5J3iZY.js +0 -54
  379. package/dist/chunk-5TONJI2A-DG6gDiSS.js +0 -62
  380. package/dist/chunk-7BUUIJ7U-5afmIPeo.js +0 -82
  381. package/dist/chunk-BIQX33UG-7TMBUf89.js +0 -23
  382. package/dist/chunk-CQNSW5MT-Cnqqsxt-.js +0 -38
  383. package/dist/chunk-CYSBUYHQ-BAbymFHR.js +0 -23
  384. package/dist/chunk-EMLP6XTP-Bsz-QL77.js +0 -23
  385. package/dist/chunk-J7OUQ5F2-CM_meqZH.js +0 -57
  386. package/dist/chunk-JG7HCLWE-DUnCDgPk.js +0 -62
  387. package/dist/chunk-MOZMSUNE-BG6IHvzT.js +0 -35
  388. package/dist/chunk-OSBZ3O6U-CYwj_bvR.js +0 -23
  389. package/dist/chunk-QBLGF6JB-B4vJ4j8J.js +0 -23
  390. package/dist/chunk-QR6OTTB3-D4wH2ldi.js +0 -3738
  391. package/dist/chunk-R7FJI6CG-Blf8FcmZ.js +0 -64
  392. package/dist/chunk-RYQCIY6F-BWbIlBIH.js +0 -241
  393. package/dist/chunk-U6XO7XAA-COw445DS.js +0 -63
  394. package/dist/chunk-UBXNYLIW-BHigVU4H.js +0 -32
  395. package/dist/chunk-YOTPTUD7-Dn044Q_d.js +0 -30
  396. package/dist/chunk-ZIRB5QZD-BR4TMfOa.js +0 -1153
  397. package/dist/classDiagram-JCYQIIEL-DmXSLxe_.js +0 -30
  398. package/dist/classDiagram-v2-OCEON4UE-CooqVexA.js +0 -30
  399. package/dist/click-outside-container-D_URcm3D.js +0 -167
  400. package/dist/code-block-37QAKDTI-CQrzBOr-.js +0 -107
  401. package/dist/copy-CD7S58CY.js +0 -141
  402. package/dist/cynefin-VYW2F7L2-CeHAxOEX.js +0 -3
  403. package/dist/dagre-VZM6K2ZE-CJggWPTJ.js +0 -328
  404. package/dist/dist-3_o3T78I.js +0 -1360
  405. package/dist/dist-ABQjhuek.js +0 -64
  406. package/dist/dist-CO5R6VMi.js +0 -538
  407. package/dist/dropdown-menu-DhCfcscX.js +0 -5858
  408. package/dist/emotion-is-prop-valid.esm-M57VsT8j.js +0 -14
  409. package/dist/error-banner-CsXbEEjo.js +0 -611
  410. package/dist/eventmodeling-45OFAUF4-B_lWZ-Pd.js +0 -3
  411. package/dist/flowDiagram-UKHOOZJN-g1AmrZzM.js +0 -17
  412. package/dist/gitGraph-TEB2WS4Q-Dj-eXUph.js +0 -3
  413. package/dist/info-DKCQHKI2-Bhb-pe2e.js +0 -3
  414. package/dist/line-CuKjIQa1.js +0 -34
  415. package/dist/map-BJpOfPlL.js +0 -149
  416. package/dist/math-BXtKgYah.js +0 -10
  417. package/dist/mermaid-4DMBBIKO-Ddp9TgNp.js +0 -2
  418. package/dist/mermaid-Bi23Ibnw.js +0 -1173
  419. package/dist/mermaid-parser.core-Din9FvSi.js +0 -99
  420. package/dist/packet-7NZHBO7P-fbkIIyKE.js +0 -3
  421. package/dist/path-BNHuHZP8.js +0 -87
  422. package/dist/pie-RZYD4A2V-CLRIsxY1.js +0 -3
  423. package/dist/purify.es-CB-YO1Hn.js +0 -774
  424. package/dist/radar-I7S5WNFK-BGzCbgXu.js +0 -3
  425. package/dist/railroad-3IZDKUUU-CvQIIcuU.js +0 -3
  426. package/dist/railroad-abnf-AHOZXSZD-CMwtlNtu.js +0 -3
  427. package/dist/railroad-ebnf-EBAXGLYW-n1QUOAsh.js +0 -3
  428. package/dist/railroad-peg-LSFZ7HO6-PjnrpmCs.js +0 -3
  429. package/dist/schemas-DzK6U94N.js +0 -6057
  430. package/dist/stateDiagram-v2-UEYNNEHI-BTRUs8Il.js +0 -30
  431. package/dist/step-CKczO72Q.js +0 -670
  432. package/dist/swimlanesDiagram-ULZ7WXOC-NBmgBl9G.js +0 -31
  433. package/dist/timer-DpDyj9G0.js +0 -596
  434. package/dist/tooltip-Dt77sBeT.js +0 -390
  435. package/dist/treeView-QDETBFTQ-DU8LwHuf.js +0 -3
  436. package/dist/treemap-6X3UGDF4-DUk4-k_O.js +0 -3
  437. package/dist/useTheme-CVJ0UOf2.js +0 -841
  438. package/dist/vega-loader.browser-DEggZzni.js +0 -1083
  439. package/dist/wardley-OPB4EBWU-Db-AaGas.js +0 -3
  440. package/src/components/editor/output/EmotionCacheProvider.tsx +0 -32
@@ -0,0 +1,109 @@
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)}),ee=m;function te(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 ne=new Proxy(te,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>te(t,e)}),re=ne,h=new Map,ie=new Set;function ae(e,t){if(!r.registerHandler)throw d([`registerHandler`],`register message listeners`);if(e===`*`){ie.add(t);return}h.has(e)||h.set(e,new Set),h.get(e)?.add(t)}function g(e,t){if(e===`*`){ie.delete(t);return}h.get(e)?.delete(t),h.get(e)?.size===0&&h.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 ie)t(e.id,e.payload);let t=h.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:ee,send:ne,sendProxy:re,addMessageListener:ae,removeMessageListener:g,proxy:{send:re,request:ee},_setDebugHooks:n}}function p(e){return f(e)}const m=`[transport-id]`;function ee(e,t){let{transportId:n}=t;return n==null?e:{[m]:n,data:e}}function te(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 ne(e,t={}){let{transportId:n,filter:r,remotePort:i}=t,a=e,o=i??e,s;return{send(e){o.postMessage(ee(e,{transportId:n}))},registerHandler(e){s=t=>{let i=t.data,[a,o]=te(i,{transportId:n,filter:()=>r?.(t)});a||e(o)},a.addEventListener(`message`,s)},unregisterHandler(){s&&a.removeEventListener(`message`,s)}}}function re(e){return ne(self,e)}const h=/(^|\n)\s*(?:import\s+[^\n#]*\bduckdb\b|from\s+duckdb\b|[^\n#]*\bduckdb\s*\.)/;function ie(e,t){return e.includes(`mo.sql`)||h.test(e)||t?.has(`duckdb`)===!0}var ae=Object.defineProperty,g=(e,t)=>ae(e,`name`,{value:t,configurable:!0}),oe=(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`)}),se=(()=>{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 ce(e){return!isNaN(parseFloat(e))&&isFinite(e)}g(ce,`_isNumber`);function _(e){return e.charAt(0).toUpperCase()+e.substring(1)}g(_,`_capitalize`);function le(e){return function(){return this[e]}}g(le,`_getter`);var ue=[`isConstructor`,`isEval`,`isNative`,`isToplevel`],de=[`columnNumber`,`lineNumber`],fe=[`fileName`,`functionName`,`source`],pe=ue.concat(de,fe,[`args`],[`evalOrigin`]);function v(e){if(e)for(var t=0;t<pe.length;t++)e[pe[t]]!==void 0&&this[`set`+_(pe[t])](e[pe[t]])}for(g(v,`StackFrame`),v.prototype={getArgs:g(function(){return this.args},`getArgs`),setArgs:g(function(e){if(Object.prototype.toString.call(e)!==`[object Array]`)throw TypeError(`Args must be an Array`);this.args=e},`setArgs`),getEvalOrigin:g(function(){return this.evalOrigin},`getEvalOrigin`),setEvalOrigin:g(function(e){if(e instanceof v)this.evalOrigin=e;else if(e instanceof Object)this.evalOrigin=new v(e);else throw TypeError(`Eval Origin must be an Object or StackFrame`)},`setEvalOrigin`),toString:g(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`)},v.fromString=g(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 v({functionName:r,args:i||void 0,fileName:s,lineNumber:c||void 0,columnNumber:l||void 0})},`StackFrame$$fromString`),y=0;y<ue.length;y++)v.prototype[`get`+_(ue[y])]=le(ue[y]),v.prototype[`set`+_(ue[y])]=function(e){return function(t){this[e]=!!t}}(ue[y]);var y;for(b=0;b<de.length;b++)v.prototype[`get`+_(de[b])]=le(de[b]),v.prototype[`set`+_(de[b])]=function(e){return function(t){if(!ce(t))throw TypeError(e+` must be a Number`);this[e]=Number(t)}}(de[b]);var b;for(x=0;x<fe.length;x++)v.prototype[`get`+_(fe[x])]=le(fe[x]),v.prototype[`set`+_(fe[x])]=function(e){return function(t){this[e]=String(t)}}(fe[x]);var x,me=v;function he(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:g(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:g(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:g(function(t){return t.stack.split(`
2
+ `).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 me({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:g(function(e){return e.stack.split(`
3
+ `).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 me({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,i=this.extractLocation(e.replace(t,``));return new me({functionName:r,fileName:i[0],lineNumber:i[1],columnNumber:i[2],source:e})},this)},`ErrorStackParser$$parseFFOrSafari`)}}g(he,`ErrorStackParser`);var ge=new he;function _e(){return typeof API<`u`&&API!==globalThis.API?API.runtimeEnv:ve({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`)})}g(_e,`getGlobalRuntimeEnv`);var S=_e();function ve(e){let t=e.IN_NODE&&typeof module<`u`&&module.exports&&typeof oe==`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&&ye())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}g(ve,`calculateDerivedFlags`);function ye(){try{return globalThis.importScripts(`data:text/javascript,`),!0}catch{return!1}}g(ye,`isClassicWorker`);var be,xe,Se,Ce;async function we(){if(!S.IN_NODE||(be=(await import(`./__vite-browser-external-C9iR87Zl.js`).then(e=>c(e.default,1))).default,Se=await import(`./__vite-browser-external-C9iR87Zl.js`).then(e=>c(e.default,1)),Ce=await import(`./__vite-browser-external-C9iR87Zl.js`).then(e=>c(e.default,1)),(await import(`./__vite-browser-external-C9iR87Zl.js`).then(e=>c(e.default,1))).default,xe=await import(`./__vite-browser-external-C9iR87Zl.js`).then(e=>c(e.default,1)),Oe=xe.sep,typeof oe<`u`))return;let e={fs:Se,crypto:await import(`./__vite-browser-external-C9iR87Zl.js`).then(e=>c(e.default,1)),ws:await import(`./__vite-browser-external-C9iR87Zl.js`).then(e=>c(e.default,1)),child_process:await import(`./__vite-browser-external-C9iR87Zl.js`).then(e=>c(e.default,1))};globalThis.require=function(t){return e[t]}}g(we,`initNodeModules`);function Te(e,t){return xe.resolve(t||`.`,e)}g(Te,`node_resolvePath`);function Ee(e,t){return t===void 0&&(t=location),new URL(e,t).toString()}g(Ee,`browser_resolvePath`);var De=S.IN_NODE?Te:S.IN_SHELL?g(e=>e,`resolvePath`):Ee,Oe;S.IN_NODE||(Oe=`/`);function ke(e,t){return e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`://`)?{response:fetch(e)}:{binary:Ce.readFile(e).then(e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}}g(ke,`node_getBinaryResponse`);function Ae(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)))}}g(Ae,`shell_getBinaryResponse`);function je(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}g(je,`browser_getBinaryResponse`);var Me=S.IN_NODE?ke:S.IN_SHELL?Ae:je;async function Ne(e,t){let{response:n,binary:r}=Me(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())}g(Ne,`loadBinaryFile`);var Pe=S.IN_NODE?Fe:g(async e=>await import(e),`loadScript`);async function Fe(e){return e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`://`)?await import(e):await import(be.pathToFileURL(e).href)}g(Fe,`nodeLoadScript`);async function Ie(e){if(S.IN_NODE){await we();let t=await Ce.readFile(e,{encoding:`utf8`});return JSON.parse(t)}if(S.IN_SHELL){let t=read(e);return JSON.parse(t)}return await(await fetch(e)).json()}g(Ie,`loadLockFile`);async function Le(){if(S.IN_NODE_COMMONJS)return __dirname;let e;try{throw Error()}catch(t){e=t}let t=ge.parse(e)[0].fileName;if(S.IN_NODE&&!t.startsWith(`file://`)&&(t=`file://${t}`),S.IN_NODE_ESM){let e=await import(`./__vite-browser-external-C9iR87Zl.js`).then(e=>c(e.default,1));return(await import(`./__vite-browser-external-C9iR87Zl.js`).then(e=>c(e.default,1))).fileURLToPath(e.dirname(t))}let n=t.lastIndexOf(Oe);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)}g(Le,`calculateDirname`);function Re(e){return e.substring(0,e.lastIndexOf(`/`)+1)||globalThis.location?.toString()||`.`}g(Re,`calculateInstallBaseUrl`);function ze(e){let t=e.FS,n=e.FS.filesystems.MEMFS,r=e.PATH,i={DIR_MODE:16895,FILE_MODE:33279,mount:g(function(e){if(!e.opts.fileSystemHandle)throw Error(`opts.fileSystemHandle is required`);return n.mount.apply(null,arguments)},`mount`),syncfs:g(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:g(e=>{let n=Object.create(null);function i(e){return e!==`.`&&e!==`..`}g(i,`isRealDir`);function a(e){return t=>r.join2(e,t)}g(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:g(async e=>{let t=Object.create(null),n=await Be(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:g(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:g((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:g(e=>{var n=t.stat(e);t.isDir(n.mode)?t.rmdir(e):t.isFile(n.mode)&&t.unlink(e)},`removeLocalEntry`),loadRemoteEntry:g(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:g(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:g(async(e,t)=>{await e.get(r.dirname(t)).removeEntry(r.basename(t)),e.delete(t)},`removeRemoteEntry`),reconcile:g(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}g(ze,`initializeNativeFS`);var Be=g(async e=>{let t=[];async function n(e){for await(let r of e.values())t.push(r),r.kind===`directory`&&await n(r)}g(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`),Ve=se(`AGFzbQEAAAABDANfAGAAAW9gAW8BfwMDAgECBygCE0pzdl9HZXRFcnJvcl9pbXBvcnQAAA5Kc3ZFcnJvcl9DaGVjawABChMCBwD7AQD7GwsJACAA+xr7FAAL`),He=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(Ve);return await WebAssembly.instantiate(e)}catch(e){if(e instanceof WebAssembly.CompileError)return;throw e}}();async function Ue(){let e=await He;if(e)return e.exports;let t=Symbol(`error marker`);return{Jsv_GetError_import:g(()=>t,`Jsv_GetError_import`),JsvError_Check:g(e=>e===t,`JsvError_Check`)}}g(Ue,`getJsvErrorImport`);function We(e){let t={config:e,runtimeEnv:S},n={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Xe(e),print:e.stdout,printErr:e.stderr,onExit(e){n.exitCode=e},thisProgram:e._sysExecutable,arguments:e.args,API:t,locateFile:g(t=>e.indexURL+t,`locateFile`),instantiateWasm:Ze(e.indexURL)};return n}g(We,`createSettings`);function Ge(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)}}g(Ge,`createHomeDirectory`);function Ke(e){return function(t){Object.assign(t.ENV,e)}}g(Ke,`setEnvironment`);function qe(e){return e?[async t=>{t.addRunDependency(`fsInitHook`);try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency(`fsInitHook`)}}]:[]}g(qe,`callFsInitHook`);function Je(e){let t=e.HEAPU32[e._Py_Version>>>2];return[t>>>24&255,t>>>16&255,t>>>8&255]}g(Je,`computeVersionTuple`);function Ye(e){let t=Ne(e);return async e=>{e.API.pyVersionTuple=Je(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`)}}}g(Ye,`installStdlib`);function Xe(e){let t;return t=e.stdLibURL==null?e.indexURL+`python_stdlib.zip`:e.stdLibURL,[Ye(t),Ge(e.env.HOME),Ke(e.env),ze,...qe(e.fsInit)]}g(Xe,`getFileSystemInitializationFuncs`);function Ze(e){if(typeof WasmOffsetConverter<`u`)return;let{binary:t,response:n}=Me(e+`pyodide.asm.wasm`),r=Ue();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)}}(),{}}}g(Ze,`getInstantiateWasmFunc`);var Qe=`314.0.0`;function $e(e){return e===void 0||e.endsWith(`/`)?e:e+`/`}g($e,`withTrailingSlash`);var et=Qe;async function tt(e={}){if(await we(),e.lockFileContents&&e.lockFileURL)throw Error(`Can't pass both lockFileContents and lockFileURL`);let t=e.indexURL||await Le();if(t=$e(De(t)),e.packageBaseUrl=$e(e.packageBaseUrl),e.cdnUrl=$e(e.packageBaseUrl??`https://cdn.jsdelivr.net/pyodide/v314.0.0/full/`),!e.lockFileContents){let n=e.lockFileURL??t+`pyodide-lock.json`;e.lockFileContents=Ie(n),e.packageBaseUrl??=Re(n)}e.indexURL=t,e.packageCacheDir&&=$e(De(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}g(tt,`initializeConfiguration`);function nt(e){let t=We(e),n=t.API;return n.lockFilePromise=Promise.resolve(e.lockFileContents),t}g(nt,`createEmscriptenSettings`);async function rt(e){return e.createPyodideModule?e.createPyodideModule:(await Pe(`${e.indexURL}pyodide.asm.mjs`)).default}g(rt,`loadWasmScript`);async function it(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}g(it,`prepareSnapshot`);async function at(e,t){let n=await e(t);if(t.exitCode!==void 0)throw new n.ExitStatus(t.exitCode);return n}g(at,`instantiatePyodideModule`);function ot(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: '${et}' <==> '${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}")`)}}g(ot,`configureAPI`);function st(e,t,n){let r=e.API,i;return t&&(i=r.restoreSnapshot(t)),r.finalizeBootstrap(i,n._snapshotDeserializer)}g(st,`bootstrapPyodide`);async function ct(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}g(ct,`finalizeSetup`);async function lt(e={}){let t=await tt(e),n=nt(t),r=await rt(t),i=await it(t,n),a=await at(r,n);return ot(a,t),await ct(st(a,i,t),t)}g(lt,`loadPyodide`);function ut(e){return e.includes(`dev`),`v${et}`}var dt=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 ft={NOOP:()=>{},ASYNC_NOOP:async()=>{},THROW:()=>{throw Error(`Should not be called`)},asUpdater:e=>typeof e==`function`?e:()=>e,identity:e=>e},pt=(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=>pt(`${e}:${n}`,t),disabled:(e=!0)=>e?ht:t}},mt={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=>pt(`marimo:${e}`,mt),disabled:(e=!0)=>e?ht:mt},ht={debug:()=>ft.NOOP,log:()=>ft.NOOP,warn:()=>ft.NOOP,error:()=>ft.NOOP,trace:()=>ft.NOOP,get:()=>ht,disabled:()=>ht};function gt(){return typeof window<`u`&&window.Logger||mt}const C=gt();function _t(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 vt(e,t=`|`){return e.map(e=>Mt(e)).join(t)}function yt(e,t){return typeof t==`bigint`?t.toString():t}function bt(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function xt(e){return e==null}function St(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ct(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function w(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function T(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function wt(e){return JSON.stringify(e)}function Tt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const Et=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Dt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Ot=bt(()=>{if(P.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function E(e){if(Dt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Dt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function kt(e){return E(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const At=new Set([`string`,`number`,`symbol`]);function jt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function D(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function O(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 Mt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Nt(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const Pt={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ft(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`);return D(e,T(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&w(e,r,n.shape[r])}return w(this,`shape`,e),e},checks:[]}))}function It(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`);return D(e,T(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return w(this,`shape`,r),r},checks:[]}))}function Lt(e,t){if(!E(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;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 D(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return w(this,`shape`,n),n}}))}function Rt(e,t){if(!E(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return D(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return w(this,`shape`,n),n}}))}function zt(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.`);return D(e,T(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return w(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Bt(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`);return D(t,T(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return w(this,`shape`,i),i},checks:[]}))}function Vt(e,t,n){return D(t,T(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return w(this,`shape`,i),i}}))}function k(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 Ht(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 A(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ut(e){return typeof e==`string`?e:e?.message}function Wt(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function j(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:Ut(e.inst?._zod.def?.error?.(e))??Ut(a?.(e))??Ut(t?.error?.(e))??Ut(n.customError?.(e))??Ut(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}const Gt=/[\uD800-\uDBFF]/;function Kt(e){let t=e.length;if(!Gt.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 qt(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Jt(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 Yt(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Xt(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):$t(e,n,r.value)}}function Zt(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Qt(e,t,n){return Zt(e,t,n,!1)}function $t(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Zt(this,t,n.bind(this))},set(e){Zt(this,t,e)}})}function en(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let tn,nn=!1;const rn={configurable:!0,get(){nn=!0}};function M(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&tn!==e._zod){tn=void 0;return}tn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,rn);let e=nn;nn=!1;try{let r=n(this);return nn?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),nn||=e,r}catch(n){throw delete this[t],nn||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function an(e,t,n,r){let i=en(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 on(e){let t=()=>e;return t[`~constantCatch`]=!0,t}var sn;const cn={value:void 0,enumerable:!1};let ln=`captureStackTrace`in Error?Error:null;function un(e){let t=ln;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ln=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function N(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){cn.value=new a(r);try{Object.defineProperty(n,"_zod",cn)}finally{cn.value=void 0}}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),Xt(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?un(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 dn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},fn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(sn=globalThis).__zod_globalConfig??(sn.__zod_globalConfig={});const P=globalThis.__zod_globalConfig;function F(e){return e&&Object.assign(P,e),P}function pn(){let e=this._zod;return e.message??=JSON.stringify(e.def,yt,2),e.message}function mn(e){this._zod.message=e}const hn={get:pn,set:mn,enumerable:!0,configurable:!0},gn={value:void 0,enumerable:!1},_n={value:void 0,enumerable:!1},vn=new WeakSet([Object.prototype,Error.prototype]),yn=(e,t)=>{e.name=`$ZodError`,gn.value=e._zod,Object.defineProperty(e,"_zod",gn),_n.value=t,Object.defineProperty(e,"issues",_n),gn.value=void 0,_n.value=void 0,Object.defineProperty(e,"message",hn);let n=Object.getPrototypeOf(e);vn.has(n)||(vn.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})}}))},bn=N(`$ZodError`,yn),xn=N(`$ZodError`,yn,void 0,{Parent:Error});function Sn(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 Cn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Sn(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function wn(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 Tn(e,t){return{callee:t?.callee??e,Err:t?.Err}}const En=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 dn;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>j(e,o,F())));throw Et(n,a?.callee??t),n}return s.value};return t},Dn=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=>j(e,o,F())));throw Et(n,a?.callee??t),n}return s.value};return t},On=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 dn;return a.issues.length?{success:!1,error:new(e??bn)(a.issues.map(e=>j(e,i,F())))}:{success:!0,data:a.value}},kn=On(xn),An=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?{success:!1,error:new e(a.issues.map(e=>j(e,i,F())))}:{success:!0,data:a.value}},jn=An(xn),Mn=e=>{let t=En(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Tn(n,a))};return n},Nn=e=>{let t=En(e),n=(e,r,i,a)=>t(e,r,i,Tn(n,a));return n},Pn=e=>{let t=Dn(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Tn(n,a))};return n},Fn=e=>{let t=Dn(e),n=async(e,r,i,a)=>await t(e,r,i,Tn(n,a));return n},In=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return On(e)(t,n,i)},Ln=e=>(t,n,r)=>On(e)(t,n,r),Rn=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return An(e)(t,n,i)},zn=e=>async(t,n,r)=>An(e)(t,n,r),Bn=/^[cC][0-9a-z]{6,}$/,Vn=/^[0-9a-z]+$/,Hn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Un=/^[0-9a-vA-V]{20}$/,Wn=/^[A-Za-z0-9]{27}$/,Gn=/^[a-zA-Z0-9_-]{21}$/;function Kn(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const qn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Jn=/^([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})$/,Yn=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)$/,Xn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Zn(){return RegExp(`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const Qn=/^(?:(?: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])$/,$n=/^(([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}|:))$/,er=/^((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])$/,tr=/^(([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])$/,nr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rr=/^[A-Za-z0-9_-]*$/,ir=/^https?$/,ar=/^\+[1-9]\d{6,14}$/,or=`(?:(?:\\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 sr(e){return RegExp(`^${e}$`)}const cr=sr(or);function lr(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 ur(e){return RegExp(`^${lr(e)}$`)}function dr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${lr({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${lr({precision:e.precision})}`:n;return RegExp(`^${or}T(?:${r})$`)}const fr=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},pr=/^-?\d+$/,mr=/^-?\d+(?:\.\d+)?$/,hr=/^(?:true|false)$/i,gr=/^[^A-Z]*$/,_r=/^[^a-z]*$/,I=N(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),vr=e=>{let t=e.value;return!xt(t)&&t.length!==void 0},yr={number:`number`,bigint:`bigint`,object:`date`},br=N(`$ZodCheckLessThan`,(e,t)=>{I.init(e,t);let n=yr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:yr[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xr=N(`$ZodCheckGreaterThan`,(e,t)=>{I.init(e,t);let n=yr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:yr[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sr=N(`$ZodCheckMultipleOf`,(e,t)=>{I.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):Ct(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Cr=N(`$ZodCheckNumberFormat`,(e,t)=>{I.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Pt[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=pr)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),wr=N(`$ZodCheckMaxLength`,(e,t)=>{var n;I.init(e,t),(n=e._zod.def).when??(n.when=vr),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Kt(r):i)<=t.maximum)return;let a=qt(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Tr=N(`$ZodCheckMinLength`,(e,t)=>{var n;I.init(e,t),(n=e._zod.def).when??(n.when=vr),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Kt(r):i)>=t.minimum)return;let a=qt(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Er=N(`$ZodCheckLengthEquals`,(e,t)=>{var n;I.init(e,t),(n=e._zod.def).when??(n.when=vr),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Kt(r):i;if(a===t.length)return;let o=qt(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})}}),Dr=N(`$ZodCheckStringFormat`,(e,t)=>{var n,r;I.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),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=()=>{})}),Or=N(`$ZodCheckRegex`,(e,t)=>{Dr.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})}}),kr=N(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=gr,Dr.init(e,t)}),Ar=N(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=_r,Dr.init(e,t)}),jr=N(`$ZodCheckIncludes`,(e,t)=>{I.init(e,t);let n=jt(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),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})}}),Mr=N(`$ZodCheckStartsWith`,(e,t)=>{I.init(e,t);let n=RegExp(`^${jt(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),Nr=N(`$ZodCheckEndsWith`,(e,t)=>{I.init(e,t);let n=RegExp(`.*${jt(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(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})}}),Pr=N(`$ZodCheckOverwrite`,(e,t)=>{I.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Fr=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
4
+ `).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(`
5
+ `)}\n};`)(...Object.values(this.closed))}};const Ir={major:4,minor:5,patch:4},L=N(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ir;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=k(t),a;for(let o of n){if(o._zod.def.when){if(Ht(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 dn;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Wt(t.issues,n,e),i||=k(t,n))});else{if(t.issues.length===n)continue;Wt(t.issues,n,e),i||=k(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(k(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new dn;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 dn;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Qt(this,`~standard`,Rr(this))},set"~standard"(e){Zt(this,`~standard`,e)}}),Lr=e=>e.success?{value:e.data}:{issues:e.error?.issues};function Rr(e){return{validate:t=>{try{return Lr(kn(e,t))}catch{return jn(e,t).then(Lr)}},vendor:`zod`,version:1}}const zr=N(`$ZodString`,(e,t)=>{L.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??fr(e._zod.bag),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}}),R=N(`$ZodStringFormat`,(e,t)=>{Dr.init(e,t),zr.init(e,t)}),Br=N(`$ZodGUID`,(e,t)=>{t.pattern??=Jn,R.init(e,t)}),Vr=N(`$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??=Yn(e)}else t.pattern??=Yn();R.init(e,t)}),Hr=N(`$ZodEmail`,(e,t)=>{t.pattern??=Xn,R.init(e,t)});function Ur(e,t){if(!t.normalize&&t.protocol?.source===ir.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}const Wr=/[\t\n\r]/g;function Gr(e){return e.replace(Wr,``)}function Kr(e,t){return t.lastIndex=0,t.test(e.hostname)}function qr(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const Jr=N(`$ZodURL`,(e,t)=>{R.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Ur(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}t.hostname&&!Kr(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&&!qr(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:Gr(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Yr=N(`$ZodEmoji`,(e,t)=>{t.pattern??=Zn(),R.init(e,t)}),Xr=N(`$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?Gn:Kn(t.length),R.init(e,t)}),Zr=N(`$ZodCUID`,(e,t)=>{t.pattern??=Bn,R.init(e,t)}),Qr=N(`$ZodCUID2`,(e,t)=>{t.pattern??=Vn,R.init(e,t)}),$r=N(`$ZodULID`,(e,t)=>{t.pattern??=Hn,R.init(e,t)}),ei=N(`$ZodXID`,(e,t)=>{t.pattern??=Un,R.init(e,t)}),ti=N(`$ZodKSUID`,(e,t)=>{t.pattern??=Wn,R.init(e,t)}),ni=N(`$ZodISODateTime`,(e,t)=>{t.pattern??=dr(t),R.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),ri=N(`$ZodISODate`,(e,t)=>{t.pattern??=cr,R.init(e,t)}),ii=N(`$ZodISOTime`,(e,t)=>{t.pattern??=ur(t),R.init(e,t)}),ai=N(`$ZodISODuration`,(e,t)=>{t.pattern??=qn,R.init(e,t)}),oi=N(`$ZodIPv4`,(e,t)=>{t.pattern??=Qn,R.init(e,t),e._zod.bag.format=`ipv4`}),si=/^[0-9a-fA-F:.]+$/;function ci(e){if(!si.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}const li=N(`$ZodIPv6`,(e,t)=>{t.pattern??=$n,R.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{ci(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),ui=N(`$ZodCIDRv4`,(e,t)=>{t.pattern??=er,R.init(e,t)});function di(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:ci(n)}const fi=N(`$ZodCIDRv6`,(e,t)=>{t.pattern??=tr,R.init(e,t),e._zod.check=n=>{di(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function pi(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const mi=N(`$ZodBase64`,(e,t)=>{t.pattern??=nr,R.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{pi(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function hi(e){if(!rr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return pi(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const gi=N(`$ZodBase64URL`,(e,t)=>{t.pattern??=rr,R.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{hi(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),_i=N(`$ZodE164`,(e,t)=>{t.pattern??=ar,R.init(e,t)});function vi(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 yi=N(`$ZodJWT`,(e,t)=>{R.init(e,t),e._zod.check=n=>{vi(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),bi=N(`$ZodNumber`,(e,t)=>{L.init(e,t),e._zod.pattern=e._zod.bag.pattern??mr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),xi=N(`$ZodNumberFormat`,(e,t)=>{Cr.init(e,t),bi.init(e,t)}),Si=N(`$ZodBoolean`,(e,t)=>{L.init(e,t),e._zod.pattern=hr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Ci=N(`$ZodUnknown`,(e,t)=>{L.init(e,t),e._zod.parse=e=>e}),wi=N(`$ZodNever`,(e,t)=>{L.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Ti(e,t,n){e.issues.length&&t.issues.push(...A(n,e.issues)),t.value[n]=e.value}const Ei=N(`$ZodArray`,(e,t)=>{L.init(e,t);let n=P.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=[];for(let e=0;e<a.length;e++){let n=a[e],s=t.element._zod.run({value:n,issues:[]},i);s instanceof Promise?o.push(s.then(t=>Ti(t,r,e))):Ti(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function Di(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(...A(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&&(t.value[n]=void 0):t.value[n]=e.value}}const Oi=[];function ki(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Oi,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=Nt(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Ai(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin,d=c.optout;for(let i in t){if(s.has(i))continue;if(i===`__proto__`){l===`never`&&o.push(i);continue}if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Di(e,n,i,t,u,d))):Di(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const ji=new WeakMap,Mi=N(`$ZodObject`,(e,t)=>{if(L.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;ji.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),ji.set(t,n),n}})}let n=bt(()=>ki(t));M(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)||w(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 r=Dt,i=t.catchall,a,o=P.memoizer;o?.attach(e),e._zod.parse=(t,s)=>{a??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=o?o.alloc(e,t,{},s):{};let l=[],u=a.shape;for(let e of a.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,a=n._zod.run({value:c[e],issues:[]},s);a instanceof Promise?l.push(a.then(n=>Di(n,t,e,c,r,i))):Di(a,t,e,c,r,i)}return i?Ai(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),Ni=N(`$ZodObjectJIT`,(e,t)=>{Mi.init(e,t);let n=e._zod.parse,r=bt(()=>ki(t)),i=P.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Fr([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
6
+ for (let i = 0; i < ${e}.issues.length; i++) {
7
+ const iss = ${e}.issues[i];
8
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
9
+ payload.issues.push(iss);
10
+ }`;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)}]`:wt(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(`
11
+ const ${n}_present = ${i};
12
+ if (!${n}.issues.length || ${n}_present) {
13
+ if (${n}.issues.length) {${c(n,r)}
14
+ }
15
+
16
+ if (${e}) {
17
+ newResult[${r}] = ${n}.value;
18
+ }
19
+ }
20
+
21
+ `)}else f?o.write(`
22
+ if (${n}.issues.length) {${c(n,r)}
23
+ }
24
+
25
+ if (${n}.value === undefined) {
26
+ if (${i}) {
27
+ newResult[${r}] = undefined;
28
+ }
29
+ } else {
30
+ newResult[${r}] = ${n}.value;
31
+ }
32
+
33
+ `):o.write(`
34
+ const ${n}_present = ${i};
35
+ if (${n}.issues.length) {${c(n,r)}
36
+ }
37
+ if (!${n}_present && !${n}.issues.length) {
38
+ payload.issues.push({
39
+ code: "invalid_type",
40
+ expected: "nonoptional",
41
+ input: undefined,
42
+ path: [${r}]
43
+ });
44
+ }
45
+
46
+ if (${n}_present) {
47
+ newResult[${r}] = ${n}.value;
48
+ }
49
+
50
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Dt,c=!P.jitless,l=c&&Ot.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?Ai([],p,i,f,d,e):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Pi(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=>!k(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=>j(e,r,F())))}),t)}const Fi=N(`$ZodUnion`,(e,t)=>{L.init(e,t),M(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),M(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),M(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)))}),M(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=>St(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=>Pi(t,r,e,i)):Pi(o,r,e,i)}}),Ii=N(`$ZodIntersection`,(e,t)=>{L.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])=>Ri(e,t,n)):Ri(e,i,a)}});function Li(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(E(e)&&E(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=Li(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=Li(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 Ri(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=Li(t.value,n.value);if(!c.valid){if(k(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}const zi=N(`$ZodRecord`,(e,t)=>{L.init(e,t);let n=P.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!E(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>j(e,i,F())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...A(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...A(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&mr.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>j(e,i,F())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...A(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...A(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Bi=N(`$ZodEnum`,(e,t)=>{L.init(e,t);let n=_t(t.entries),r=new Set(n);e._zod.values=r;let i=n.filter(e=>At.has(typeof e));e._zod.pattern=RegExp(i.length?`^(${i.map(e=>jt(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}}),Vi=N(`$ZodTransform`,(e,t)=>{L.init(e,t),e._zod.optin=`optional`,P.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new fn(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 dn;return n.value=i,n}});function Hi(e,t){return e.value=t.issues.length?void 0:t.value,e}const Ui=N(`$ZodOptional`,(e,t)=>{L.init(e,t),M(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,M(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),M(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${St(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=>Hi(e,t)):Hi(e,r)}return t.innerType._zod.run(e,n)}}),Wi=N(`$ZodExactOptional`,(e,t)=>{Ui.init(e,t),M(e,`values`,e=>e.def.innerType._zod.values),M(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Gi=N(`$ZodNullable`,(e,t)=>{L.init(e,t),M(e,`optin`,e=>e.def.innerType._zod.optin),M(e,`optout`,e=>e.def.innerType._zod.optout),M(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${St(t.source)}|null)$`):void 0}),M(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)}),Ki=N(`$ZodDefault`,(e,t)=>{L.init(e,t),e._zod.optin=`defaulted`,M(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=>qi(e,t)):qi(r,t)}});function qi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ji=N(`$ZodPrefault`,(e,t)=>{L.init(e,t),e._zod.optin=`defaulted`,M(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))}),Yi=N(`$ZodNonOptional`,(e,t)=>{L.init(e,t),M(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=>Xi(t,e)):Xi(i,e)}});function Xi(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 Zi(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>j(e,r,F()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const Qi=N(`$ZodCatch`,(e,t)=>{L.init(e,t),M(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),M(e,`optout`,e=>e.def.innerType._zod.optout),M(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=>Zi(e,r,t,n)):Zi(e,r,t,n)}}),$i=N(`$ZodPipe`,(e,t)=>{L.init(e,t),M(e,`values`,e=>e.def.in._zod.values),M(e,`optin`,e=>e.def.in._zod.optin),M(e,`optout`,e=>e.def.out._zod.optout),M(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=>ea(e,t.in,n)):ea(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ea(e,t.out,n)):ea(r,t.out,n)}});function ea(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 ta=N(`$ZodReadonly`,(e,t)=>{L.init(e,t),M(e,`propValues`,e=>e.def.innerType._zod.propValues),M(e,`values`,e=>e.def.innerType._zod.values),M(e,`optin`,e=>e.def.innerType?._zod?.optin),M(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(na):na(r)}});function na(e){return e.memo||(e.value=Object.freeze(e.value)),e}const ra=N(`$ZodCustom`,(e,t)=>{I.init(e,t),L.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=>ia(t,n,r,e));ia(i,n,r,e)}});function ia(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(Yt(e))}}var aa=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}};const oa=`~memo`,sa=[];function ca(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}const la=new WeakMap;function ua(e,t){let n=la.get(e);if(n!==void 0)return n;if(t.has(e))return!0;t.add(e);let r=!1,i=e=>{!r&&e?._zod&&ua(e,t)&&(r=!0)},a=e._zod.def;switch(a.type){case`object`:for(let e of Reflect.ownKeys(a.shape))i(a.shape[e]);i(a.catchall);break;case`array`:i(a.element);break;case`tuple`:for(let e of a.items)i(e);i(a.rest);break;case`record`:case`map`:i(a.keyType),i(a.valueType);break;case`set`:i(a.valueType);break;case`union`:for(let e of a.options)i(e);break;case`intersection`:i(a.left),i(a.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:i(a.innerType);break;case`pipe`:i(a.in),i(a.out);break;case`function`:i(a.input),i(a.output);break;case`lazy`:i(e._zod.innerType);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 a){let t=Object.getOwnPropertyDescriptor(a,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)i(n);else if(Array.isArray(n))for(let e of n)i(e)}}}return t.delete(e),la.set(e,r),r}function da(e,t){let n=e.buckets.get(t);return n||(n=new Map,e.buckets.set(t,n)),n}let fa;const pa=[],ma={alloc(e,t,n){let r=fa;if(!r)return n;fa=void 0;let i={value:n,issues:null};return r.set(t.value,i),pa.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`&&ga(n,e.value))throw new aa;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,a=(o,s)=>{if(n===void 0&&(n=ua(e,new Set),!n))return e._zod.parse=t,e._zod.run===a&&(e._zod.run=t),t(o,s);let c=o.value;if(typeof c!=`object`||!c)return t(o,s);let l=s[oa];l||(l={buckets:new Map,backEdges:void 0},s[oa]=l);let u;r===s?u=i:(u=da(l,e),r=s,i=u);let d=u.get(c);if(d)return o.value=d.value,d.issues?d.issues.length&&o.issues.push(...ca(d.issues)):(o.memo=!0,l.backEdges??(l.backEdges=new Set),l.backEdges.add(d.value)),o;fa=u;let f=pa.length,p=t(o,s);fa=void 0;let m=pa.length>f?pa.pop():void 0;return p instanceof Promise?p.then(e=>(m&&(m.issues=e.issues.length?ca(e.issues):sa),e)):(m&&(m.issues=p.issues.length?ca(p.issues):sa),p)};e._zod.parse=a,e._zod.run===t&&(e._zod.run=a)})}};function ha(){return ma}function ga(e,t){let n=e[oa]?.backEdges;return n!==void 0&&typeof t==`object`&&!!t&&n.has(t)}const _a=()=>{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`,credit_card:`credit card number`,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(Jt(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Mt(e.values[0])}`:`Invalid option: expected one of ${vt(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`:``}: ${vt(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 va(){return{localeError:_a()}}var ya,ba=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 xa(){return new ba}(ya=globalThis).__zod_globalRegistry??(ya.__zod_globalRegistry=xa());const Sa=globalThis.__zod_globalRegistry;function Ca(e,t){return new e({type:`string`,...O(t)})}function wa(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...O(t)})}function Ta(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...O(t)})}function Ea(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...O(t)})}function Da(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...O(t)})}function Oa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...O(t)})}function ka(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...O(t)})}function Aa(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...O(t)})}function ja(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...O(t)})}function Ma(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...O(t)})}function Na(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...O(t)})}function Pa(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...O(t)})}function Fa(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...O(t)})}function Ia(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...O(t)})}function La(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...O(t)})}function Ra(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...O(t)})}function za(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...O(t)})}function Ba(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...O(t)})}function Va(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...O(t)})}function Ha(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...O(t)})}function Ua(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...O(t)})}function Wa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...O(t)})}function Ga(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...O(t)})}function Ka(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...O(t)})}function qa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...O(t)})}function Ja(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...O(t)})}function Ya(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...O(t)})}function Xa(e,t){return new e({type:`number`,checks:[],...O(t)})}function Za(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...O(t)})}function Qa(e,t){return new e({type:`boolean`,...O(t)})}function $a(e){return new e({type:`unknown`})}function eo(e,t){return new e({type:`never`,...O(t)})}function to(e,t){return new br({check:`less_than`,...O(t),value:e,inclusive:!1})}function no(e,t){return new br({check:`less_than`,...O(t),value:e,inclusive:!0})}function ro(e,t){return new xr({check:`greater_than`,...O(t),value:e,inclusive:!1})}function io(e,t){return new xr({check:`greater_than`,...O(t),value:e,inclusive:!0})}function ao(e,t){return new Sr({check:`multiple_of`,...O(t),value:e})}function oo(e,t){return new wr({check:`max_length`,...O(t),maximum:e})}function so(e,t){return new Tr({check:`min_length`,...O(t),minimum:e})}function co(e,t){return new Er({check:`length_equals`,...O(t),length:e})}function lo(e,t){return new Or({check:`string_format`,format:`regex`,...O(t),pattern:e})}function uo(e){return new kr({check:`string_format`,format:`lowercase`,...O(e)})}function fo(e){return new Ar({check:`string_format`,format:`uppercase`,...O(e)})}function po(e,t){return new jr({check:`string_format`,format:`includes`,...O(t),includes:e})}function mo(e,t){return new Mr({check:`string_format`,format:`starts_with`,...O(t),prefix:e})}function ho(e,t){return new Nr({check:`string_format`,format:`ends_with`,...O(t),suffix:e})}function go(e){return new Pr({check:`overwrite`,tx:e})}function _o(e){return go(t=>t.normalize(e))}function vo(){return go(e=>e.trim())}function yo(){return go(e=>e.toLowerCase())}function bo(){return go(e=>e.toUpperCase())}function xo(){return go(e=>Tt(e))}function So(e,t,n){return new e({type:`array`,element:t,...O(n)})}function Co(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...O(n)})}function wo(e,t){let n=To(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Yt(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(Yt(r))}},e(t.value,t)),t);return n}function To(e,t){let n=new I({check:`custom`,...O(t)});return n._zod.check=e,n}function Eo(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&w(e,t,n[t]);return e}function Do(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??Sa,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 Oo(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 z(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,z(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Eo(o.schema,c),t.io===`input`&&B(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 ko(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ao(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}/${ko(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+ko(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>
51
+
52
+ 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}if(r.count>1&&e.reused===`ref`){a(n);continue}}e.external&&(e.sharedDefsExtractedFor=e.external)}function jo(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;jo(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 Mo=new Set([`type`,`properties`,`required`,`additionalProperties`]),No=[`oneOf`,`anyOf`];function Po(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Fo(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Mo.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]??Po(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}w(n,r,e.length===1?e[0]:Fo(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=Po(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 Io(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Mo)if(t in e)return;let n=t.filter(e=>No.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Fo(t);else{let e=n[0],i=No.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=>Fo([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Eo(e,r))}function Lo(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)):Eo(i,s),Eo(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())jo(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)??[])Io(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)}Eo(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,w(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:zo(t,`input`,e.processors),output:zo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function B(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 B(r.element,n);if(r.type===`set`)return B(r.valueType,n);if(r.type===`lazy`)return B(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 B(r.innerType,n);if(r.type===`intersection`)return B(r.left,n)||B(r.right,n);if(r.type===`record`||r.type===`map`)return B(r.keyType,n)||B(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:B(r.in,n)||B(r.out,n);if(r.type===`object`){for(let e in r.shape)if(B(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(B(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(B(e,n))return!0;return!!(r.rest&&B(r.rest,n))}return!1}const Ro=(e,t={})=>n=>{let r=Do({...n,processors:t});return z(e,r),Ao(r,e),Lo(r,e)},zo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Do({...i??{},target:a,io:t,processors:n});return z(e,o),Ao(o,e),Lo(o,e)},Bo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Vo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Bo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];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}))])}},Ho=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(Number.isFinite(c)&&c!==0?i.multipleOf=Math.abs(c):Oo(e,t,i,r,`A multipleOf divisor of ${c} cannot be represented in JSON Schema`))},Uo=(e,t,n,r)=>{n.type=`boolean`},Wo=(e,t,n,r)=>{n.not={}},Go=(e,t,n,r)=>{let i=e._zod.def,a=_t(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},Ko=(e,t,n,r)=>{Oo(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},qo=(e,t,n,r)=>{Oo(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Jo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=z(a.element,t,{...r,path:[...r.path,`items`]})};function Yo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Yo(t.out):t.type===`catch`?Yo(t.innerType):e._zod.optin}const Xo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Oo(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)w(i.properties,e,z(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e];return t.io===`input`?Yo(n)===void 0:n._zod.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=z(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Zo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>z(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Qo=(e,t,n,r)=>{let i=e._zod.def,a=z(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=z(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)};function $o(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=$o(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>$o(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?mr:pr).source),p):p}const es=new WeakMap;function ts(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of es.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=$o(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}const ns=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=z(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)w(i.patternProperties,t.source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=z(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=es.get(t);n||(n=[],es.set(t,n),t.deferred.push(()=>ts(t))),n.push(e)}i.additionalProperties=z(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Yo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},rs=(e,t,n,r)=>{let i=e._zod.def,a=z(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`}]},is=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},as=Symbol();function os(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Oo(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),as):JSON.parse(o)}const ss=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=os(i.defaultValue,e,t,n,r);o!==as&&(n.default=o)},cs=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=os(i.defaultValue,e,t,n,r);o!==as&&(n._prefault=o)},ls=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Oo(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},us=(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;z(o,t,r);let s=t.seen.get(e);s.ref=o},ds=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},fs=(e,t,n,r)=>{let i=e._zod.def;z(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ps=new WeakSet([Object.prototype,Error.prototype]);function ms(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 V=N(`ZodError`,(e,t)=>{bn.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ps.has(n)||(ps.add(n),ms(n,`format`,e=>t=>wn(e,t)),ms(n,`flatten`,e=>t=>Cn(e,t)),ms(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,yt,2)}),ms(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,yt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),hs=En(V),gs=Dn(V),_s=On(V),vs=An(V),ys=Mn(V),bs=Nn(V),xs=Pn(V),Ss=Fn(V),Cs=In(V),ws=Ln(V),Ts=Rn(V),Es=zn(V);function Ds(){P.localeError||F(va())}function Os(){P.memoizer||F({memoizer:ha()})}const H=N(`ZodType`,(e,t)=>(Ds(),L.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(T(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 D(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(zc(e,t))},superRefine(e,t){return this.check(Bc(e,t))},overwrite(e){return this.check(go(e))},optional(){return xc(this)},exactOptional(){return Cc(this)},nullable(){return Tc(this)},nullish(){return xc(Tc(this))},nonoptional(e){return jc(this,e)},array(){return K(this)},or(e){return fc([this,e])},and(e){return mc(this,e)},transform(e){return Fc(this,yc(e))},default(e){return Dc(this,e)},prefault(e){return kc(this,e)},catch(e){return Nc(this,e)},pipe(e){return Fc(this,e)},readonly(){return Lc(this)},describe(e){let t=this.clone();return Sa.add(t,{description:e}),t},meta(...e){if(e.length===0)return Sa.get(this);let t=this.clone();return Sa.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 Qt(this,`~standard`,{...Rr(this),jsonSchema:{input:zo(this,`input`),output:zo(this,`output`)}})},set"~standard"(e){Zt(this,`~standard`,e)},parse:function e(t,n){return hs(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await gs(this,t,n,{callee:e})},safeParse(e,t){return _s(this,e,t)},async safeParseAsync(e,t){return vs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Zt(this,`spa`,e)},encode:function e(t,n){return ys(this,t,n,{callee:e})},decode:function e(t,n){return bs(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await xs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Ss(this,t,n,{callee:e})},safeEncode(e,t){return Cs(this,e,t)},safeDecode(e,t){return ws(this,e,t)},async safeEncodeAsync(e,t){return Ts(this,e,t)},async safeDecodeAsync(e,t){return Es(this,e,t)},toJSONSchema(e){return Ro(this,{})(e)},get description(){return Sa.get(this)?.description},get _def(){return this._zod.def}}),ks=N(`_ZodString`,(e,t)=>{zr.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vo(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null},{regex(...e){return this.check(lo(...e))},includes(...e){return this.check(po(...e))},startsWith(...e){return this.check(mo(...e))},endsWith(...e){return this.check(ho(...e))},min(...e){return this.check(so(...e))},max(...e){return this.check(oo(...e))},length(...e){return this.check(co(...e))},nonempty(...e){return this.check(so(1,...e))},lowercase(e){return this.check(uo(e))},uppercase(e){return this.check(fo(e))},trim(){return this.check(vo())},normalize(...e){return this.check(_o(...e))},toLowerCase(){return this.check(yo())},toUpperCase(){return this.check(bo())},slugify(){return this.check(xo())}}),As=N(`ZodString`,(e,t)=>{zr.init(e,t),ks.init(e,t)},{email(e){return this.check(wa(Fs,e))},url(e){return this.check(Aa(Rs,e))},jwt(e){return this.check(Ga($s,e))},emoji(e){return this.check(ja(zs,e))},guid(e){return this.check(Ta(Is,e))},uuid(e){return this.check(Ea(Ls,e))},uuidv4(e){return this.check(Da(Ls,e))},uuidv6(e){return this.check(Oa(Ls,e))},uuidv7(e){return this.check(ka(Ls,e))},nanoid(e){return this.check(Ma(Bs,e))},cuid(e){return this.check(Na(Vs,e))},cuid2(e){return this.check(Pa(Hs,e))},ulid(e){return this.check(Fa(Us,e))},base64(e){return this.check(Ha(Xs,e))},base64url(e){return this.check(Ua(Zs,e))},xid(e){return this.check(Ia(Ws,e))},ksuid(e){return this.check(La(Gs,e))},ipv4(e){return this.check(Ra(Ks,e))},ipv6(e){return this.check(za(qs,e))},cidrv4(e){return this.check(Ba(Js,e))},cidrv6(e){return this.check(Va(Ys,e))},e164(e){return this.check(Wa(Qs,e))},datetime(e){return this.check(Ka(js,e))},date(e){return this.check(qa(Ms,e))},time(e){return this.check(Ja(Ns,e))},duration(e){return this.check(Ya(Ps,e))}});function U(e){return Ca(As,e)}const W=N(`ZodStringFormat`,(e,t)=>{R.init(e,t),ks.init(e,t)}),js=N(`ZodISODateTime`,(e,t)=>{ni.init(e,t),W.init(e,t)}),Ms=N(`ZodISODate`,(e,t)=>{ri.init(e,t),W.init(e,t)}),Ns=N(`ZodISOTime`,(e,t)=>{ii.init(e,t),W.init(e,t)}),Ps=N(`ZodISODuration`,(e,t)=>{ai.init(e,t),W.init(e,t)}),Fs=N(`ZodEmail`,(e,t)=>{Hr.init(e,t),W.init(e,t)}),Is=N(`ZodGUID`,(e,t)=>{Br.init(e,t),W.init(e,t)}),Ls=N(`ZodUUID`,(e,t)=>{Vr.init(e,t),W.init(e,t)}),Rs=N(`ZodURL`,(e,t)=>{Jr.init(e,t),W.init(e,t)}),zs=N(`ZodEmoji`,(e,t)=>{Yr.init(e,t),W.init(e,t)}),Bs=N(`ZodNanoID`,(e,t)=>{Xr.init(e,t),W.init(e,t)}),Vs=N(`ZodCUID`,(e,t)=>{Zr.init(e,t),W.init(e,t)}),Hs=N(`ZodCUID2`,(e,t)=>{Qr.init(e,t),W.init(e,t)}),Us=N(`ZodULID`,(e,t)=>{$r.init(e,t),W.init(e,t)}),Ws=N(`ZodXID`,(e,t)=>{ei.init(e,t),W.init(e,t)}),Gs=N(`ZodKSUID`,(e,t)=>{ti.init(e,t),W.init(e,t)}),Ks=N(`ZodIPv4`,(e,t)=>{oi.init(e,t),W.init(e,t)}),qs=N(`ZodIPv6`,(e,t)=>{li.init(e,t),W.init(e,t)}),Js=N(`ZodCIDRv4`,(e,t)=>{ui.init(e,t),W.init(e,t)}),Ys=N(`ZodCIDRv6`,(e,t)=>{fi.init(e,t),W.init(e,t)}),Xs=N(`ZodBase64`,(e,t)=>{mi.init(e,t),W.init(e,t)}),Zs=N(`ZodBase64URL`,(e,t)=>{gi.init(e,t),W.init(e,t)}),Qs=N(`ZodE164`,(e,t)=>{_i.init(e,t),W.init(e,t)}),$s=N(`ZodJWT`,(e,t)=>{yi.init(e,t),W.init(e,t)}),ec=N(`ZodNumber`,(e,t)=>{bi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ho(e,t,n,r);let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null},{gt(e,t){return this.check(ro(e,t))},gte(e,t){return this.check(io(e,t))},min(e,t){return this.check(io(e,t))},lt(e,t){return this.check(to(e,t))},lte(e,t){return this.check(no(e,t))},max(e,t){return this.check(no(e,t))},int(e){return this.check(rc(e))},safe(e){return this.check(rc(e))},positive(e){return this.check(ro(0,e))},nonnegative(e){return this.check(io(0,e))},negative(e){return this.check(to(0,e))},nonpositive(e){return this.check(no(0,e))},multipleOf(e,t){return this.check(ao(e,t))},step(e,t){return this.check(ao(e,t))},finite(){return this}});function tc(e){return Xa(ec,e)}const nc=N(`ZodNumberFormat`,(e,t)=>{xi.init(e,t),ec.init(e,t)});function rc(e){return Za(nc,e)}const ic=N(`ZodBoolean`,(e,t)=>{Si.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r)});function G(e){return Qa(ic,e)}const ac=N(`ZodUnknown`,(e,t)=>{Ci.init(e,t),H.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function oc(){return $a(ac)}const sc=N(`ZodNever`,(e,t)=>{wi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r)});function cc(e){return eo(sc,e)}const lc=N(`ZodArray`,(e,t)=>{Os(),Ei.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(so(e,t))},nonempty(e){return this.check(so(1,e))},max(e,t){return this.check(oo(e,t))},length(e,t){return this.check(co(e,t))},unwrap(){return this.element}});function K(e,t){return So(lc,e,t)}const uc=N(`ZodObject`,(e,t)=>{Os(),Ni.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),an(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Y(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:oc()})},loose(){return this.clone({...this._zod.def,catchall:oc()})},strict(){return this.clone({...this._zod.def,catchall:cc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Lt(this,e)},safeExtend(e){return Rt(this,e)},merge(e){return zt(this,e)},pick(e){return Ft(this,e)},omit(e){return It(this,e)},partial(...e){return Bt(bc,this,e[0])},exactPartial(...e){return Bt(Sc,this,e[0],`exactPartial`)},required(...e){return Vt(Ac,this,e[0])}});function q(e,t){let n={type:`object`,shape:e??{},...O(t)};return new uc(n)}function J(e,t){return new uc({type:`object`,shape:e,catchall:oc(),...O(t)})}const dc=N(`ZodUnion`,(e,t)=>{Fi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.options=t.options});function fc(e,t){return new dc({type:`union`,options:e,...O(t)})}const pc=N(`ZodIntersection`,(e,t)=>{Ii.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qo(e,t,n,r)});function mc(e,t){return new pc({type:`intersection`,left:e,right:t})}const hc=N(`ZodRecord`,(e,t)=>{Os(),zi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ns(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function gc(e,t,n){return!t||!t._zod?new hc({type:`record`,keyType:U(),valueType:e,...O(t)}):new hc({type:`record`,keyType:e,valueType:t,...O(n)})}const _c=N(`ZodEnum`,(e,t)=>{Bi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);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 _c({...t,checks:[],...O(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 _c({...t,checks:[],...O(r),entries:i})}});function Y(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new _c({type:`enum`,entries:n,...O(t)})}const vc=N(`ZodTransform`,(e,t)=>{Os(),Vi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new fn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Yt(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(Yt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function yc(e){return new vc({type:`transform`,transform:e})}const bc=N(`ZodOptional`,(e,t)=>{Ui.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e){return new bc({type:`optional`,innerType:e})}const Sc=N(`ZodExactOptional`,(e,t)=>{Wi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cc(e){return new Sc({type:`optional`,innerType:e})}const wc=N(`ZodNullable`,(e,t)=>{Gi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tc(e){return new wc({type:`nullable`,innerType:e})}const Ec=N(`ZodDefault`,(e,t)=>{Ki.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ss(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Dc(e,t){return new Ec({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():kt(t)}})}const Oc=N(`ZodPrefault`,(e,t)=>{Ji.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kc(e,t){return new Oc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():kt(t)}})}const Ac=N(`ZodNonOptional`,(e,t)=>{Yi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jc(e,t){return new Ac({type:`nonoptional`,innerType:e,...O(t)})}const Mc=N(`ZodCatch`,(e,t)=>{Qi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Nc(e,t){return new Mc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:on(t)})}const Pc=N(`ZodPipe`,(e,t)=>{$i.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>us(e,t,n,r),e.in=t.in,e.out=t.out});function Fc(e,t){return new Pc({type:`pipe`,in:e,out:t})}const Ic=N(`ZodReadonly`,(e,t)=>{ta.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ds(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lc(e){return new Ic({type:`readonly`,innerType:e})}const Rc=N(`ZodCustom`,(e,t)=>{ra.init(e,t),H.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r)});function zc(e,t={}){return Co(Rc,e,t)}function Bc(e,t){return wo(e,t)}const Vc=q({detail:U()}),Hc=q({error:U()});function Uc(e){if(!e)return`Unknown error`;if(e instanceof Error){let t=Vc.safeParse(e.cause);return t.success?t.data.detail:Wc(e.message)}if(typeof e==`object`){let t=Vc.safeParse(e);if(t.success)return t.data.detail;let n=Hc.safeParse(e);if(n.success)return n.data.error}try{return JSON.stringify(e)}catch{return String(e)}}function Wc(e){let t=Gc(e);if(!t)return e;let n=Vc.safeParse(t);if(n.success)return n.data.detail;let r=Hc.safeParse(t);return r.success?r.data.error:e}function Gc(e){try{return JSON.parse(e)}catch{return e}}function Kc(e,t){if(!e)throw Error(t)}const qc=[`pip`,`uv`,`rye`,`poetry`,`pixi`],Jc=[`normal`,`compact`,`medium`,`full`,`columns`],Yc=[`auto`,`native`,`polars`,`lazy-polars`,`pandas`],Xc=[`html`,`markdown`,`ipynb`],Zc=[`manual`,`ask`,`agent`,`code_mode`],X=q({api_key:U().optional(),base_url:U().optional(),project:U().optional()}).loose(),Qc=q({chat_model:U().nullish(),edit_model:U().nullish(),autocomplete_model:U().nullish(),displayed_models:K(U()).default([]),custom_models:K(U()).default([])}),$c=J({completion:q({activate_on_typing:G().prefault(!0),signature_hint_on_typing:G().prefault(!1),auto_close_pairs:G().prefault(!0),copilot:fc([G(),Y([`github`,`codeium`,`custom`])]).prefault(!1).transform(e=>e===!0?`github`:e),codeium_api_key:U().nullish()}).prefault({}),save:J({autosave:Y([`off`,`after_delay`]).prefault(`after_delay`),autosave_delay:tc().nonnegative().transform(e=>Math.max(e,1e3)).prefault(1e3),format_on_save:G().prefault(!1)}).prefault({}),formatting:J({line_length:tc().nonnegative().prefault(79).transform(e=>Math.min(e,1e3))}).prefault({}),keymap:J({preset:Y([`default`,`vim`]).prefault(`default`),overrides:gc(U(),U()).prefault({}),destructive_delete:G().prefault(!0)}).prefault({}),runtime:J({auto_instantiate:G().prefault(!0),on_cell_change:Y([`lazy`,`autorun`]).prefault(`autorun`),auto_reload:Y([`off`,`lazy`,`autorun`]).prefault(`off`),reactive_tests:G().prefault(!0),watcher_on_save:Y([`lazy`,`autorun`]).prefault(`lazy`),default_sql_output:Y(Yc).prefault(`auto`),default_auto_download:K(Y(Xc)).prefault([]),show_tracebacks:G().prefault(!1)}).prefault({}),display:J({theme:Y([`light`,`dark`,`system`]).prefault(`light`),code_editor_font_size:tc().nonnegative().prefault(14),cell_output:Y([`above`,`below`]).prefault(`below`),dataframes:Y([`rich`,`plain`]).prefault(`rich`),default_table_page_size:tc().prefault(10),default_table_max_columns:tc().prefault(50),default_width:Y(Jc).prefault(`medium`).transform(e=>e===`normal`?`compact`:e),locale:U().nullable().optional(),reference_highlighting:G().prefault(!0),code_lens:G().prefault(!0)}).prefault({}),package_management:J({manager:Y(qc).prefault(`pip`)}).prefault({}),ai:J({enabled:G().prefault(!0),rules:U().prefault(``),max_tokens:tc().int().positive().nullable().optional(),mode:Y(Zc).prefault(`manual`),inline_tooltip:G().prefault(!1),allow_provider_config:G().prefault(!0),open_ai:X.optional(),github:X.optional(),anthropic:X.optional(),google:X.optional(),ollama:X.optional(),openrouter:X.optional(),wandb:X.optional(),opencode_go:X.optional(),open_ai_compatible:X.optional(),azure:X.optional(),bedrock:J({region_name:U().optional(),profile_name:U().optional(),aws_access_key_id:U().optional(),aws_secret_access_key:U().optional()}).optional(),custom_providers:gc(U(),X).prefault({}),models:Qc.prefault({displayed_models:[],custom_models:[]})}).prefault({}),experimental:J({markdown:G().optional(),rtc:G().optional()}).prefault(()=>({})),server:J({disable_file_downloads:G().optional(),transport:Y([`websocket`,`sse`]).optional()}).prefault(()=>({})),diagnostics:J({enabled:G().optional(),sql_linter:G().optional()}).prefault(()=>({})),file_browser:J({folders:K(q({path:U(),name:U().optional()})).optional()}).optional().prefault({}),sharing:J({html:G().optional(),wasm:G().optional(),molab:G().optional()}).optional(),mcp:J({presets:K(Y([`marimo`,`context7`])).optional()}).optional().prefault({})}).partial().prefault(()=>({completion:{},save:{},formatting:{},keymap:{},runtime:{},display:{},diagnostics:{},file_browser:{},experimental:{},server:{},ai:{},package_management:{},mcp:{}})),el=U(),tl=Y(Yc).prefault(`auto`);q({width:Y(Jc).prefault(`medium`).transform(e=>e===`normal`?`compact`:e),app_title:el.nullish(),css_file:U().nullish(),html_head_file:U().nullish(),auto_download:K(Y(Xc)).prefault([]),sql_output:tl}).prefault(()=>({width:`medium`,auto_download:[],sql_output:`auto`}));function nl(){return $c.parse({completion:{},save:{},formatting:{},keymap:{},runtime:{},display:{},diagnostics:{},file_browser:{},experimental:{},server:{},ai:{},package_management:{},mcp:{}})}const rl=e=>new TextDecoder().decode(e);function il(e){return e.FS}const al=`notebook.py`,ol=`/marimo`,Z={NOTEBOOK_FILENAME:al,HOME_DIR:ol,createHomeDir:e=>{let t=il(e);try{t.mkdirTree(ol)}catch{}t.chdir(ol)},mountFS:e=>{globalThis.origin!==`null`&&il(e).mount(e.FS.filesystems.IDBFS,{root:`.`},ol)},populateFilesToMemory:async e=>{await sl(e,!0)},persistFilesToRemote:async e=>{await sl(e,!1)},readNotebook:e=>{let t=il(e),n=`${ol}/${al}`;return rl(t.readFile(n))},initNotebookCode:e=>{let{pyodide:t,filename:n,code:r}=e,i=il(t),a=e=>{try{return rl(i.readFile(e))}catch{return null}};if(n&&n!==al){let e=a(n);if(e)return{code:e,filename:n}}return i.writeFile(al,r),{code:r,filename:al}}};function sl(e,t){return new Promise((n,r)=>{il(e).syncfs(t,e=>{if(e instanceof Error){r(e);return}n()})})}function cl(e){return`marimo-base`}const ll=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=ll;var ul=class{pyodide=null;packageLoadQueue=Promise.resolve();sessionGeneration=0;activeSessionStops=new Set;get requirePyodide(){return Kc(this.pyodide,`Pyodide not loaded`),this.pyodide}async bootstrap(e){return await this.loadPyodideAndPackages(e)}async loadPyodideAndPackages(e){if(!lt)throw Error(`loadPyodide is not defined`);let t=ll.startSpan(`loadPyodide`);try{let n=e.pyodideIndexUrl??`https://cdn.jsdelivr.net/pyodide/${e.pyodideVersion}/full/`,r=await lt({packages:[`micropip`,`msgspec`,cl(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 C.error(`Failed to load Pyodide`,e),e}}async mountFilesystem(e){let t=ll.startSpan(`mountFilesystem`);return Z.createHomeDir(this.requirePyodide),Z.mountFS(this.requirePyodide),await Z.populateFilesToMemory(this.requirePyodide),t.end(`ok`),Z.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=ll.startSpan(`startSession.runPython`),c=r||Z.NOTEBOOK_FILENAME,l=this.requirePyodide.runPython(`
53
+ print("[py] Starting marimo...")
54
+ import asyncio
55
+ import gc
56
+ import js
57
+ from marimo._pyodide.bootstrap import create_session, instantiate
58
+
59
+ assert js.messenger, "messenger is not defined"
60
+ assert js.query_params, "query_params is not defined"
61
+
62
+ def create_session_resources():
63
+ session, bridge = create_session(
64
+ filename="${c}",
65
+ query_params=js.query_params.to_py(),
66
+ message_callback=js.messenger.callback,
67
+ user_config=js.user_config.to_py(),
68
+ )
69
+ session_task = None
70
+
71
+ def init(auto_instantiate=True):
72
+ nonlocal session_task
73
+ instantiate(session, auto_instantiate)
74
+ session_task = asyncio.create_task(session.start())
75
+
76
+ async def stop():
77
+ nonlocal bridge, session, session_task
78
+ task = session_task
79
+ kernel_task = getattr(session, "kernel_task", None)
80
+ if kernel_task is None:
81
+ if task is not None:
82
+ task.cancel()
83
+ else:
84
+ kernel_task.stop()
85
+ if task is not None:
86
+ await asyncio.gather(task, return_exceptions=True)
87
+ if bridge is not None:
88
+ bridge.session = None
89
+ task = None
90
+ kernel_task = None
91
+ session_task = None
92
+ session = None
93
+ bridge = None
94
+ gc.collect()
95
+
96
+ with open("${c}", "r") as f:
97
+ packages = session.find_packages(f.read())
98
+
99
+ return bridge, init, packages, stop
100
+
101
+ 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 ee=this.packageLoadQueue.then(()=>{if(t===this.sessionGeneration)return this.loadNotebookDeps(n,m)});return this.packageLoadQueue=ee.catch(()=>void 0),ee.then(()=>{if(t===this.sessionGeneration)return d(o.runtime.auto_instantiate)}).catch(e=>{C.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;ie(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=ll.startSpan(`pyodide.loadPackage`);await n.loadPackagesFromImports(e,{errorCallback:C.error,messageCallback:C.log}),i.end(),i=ll.startSpan(`micropip.install`);let a=r.filter(e=>!n.loadedPackages[e]);a.length>0&&await n.runPythonAsync(`
102
+ import micropip
103
+ import sys
104
+ # Filter out builtins
105
+ missing = [p for p in ${JSON.stringify(a)} if p not in sys.modules]
106
+ if len(missing) > 0:
107
+ print("Loading from micropip:", missing)
108
+ await micropip.install(missing)
109
+ `).catch(e=>{C.error(`Failed to load packages from micropip`,e)}),i.end()}},dl=class extends ul{async bootstrap(e){return await super.bootstrap(e)}async mountFilesystem(e){let{code:t,filename:n}=e;try{return Z.createHomeDir(this.requirePyodide),Z.initNotebookCode({pyodide:this.requirePyodide,code:t,filename:n})}catch(e){C.error(e)}return{code:t,filename:n}}async startSession(e){return super.startSession({queryParameters:{},code:e.code,filename:e.filename,onMessage:e.onMessage,userConfig:nl()})}};async function fl(){let e=xl(),t=ut(e);try{self.controller=new dl,self.pyodide=await self.controller.bootstrap({version:e,pyodideVersion:t})}catch(e){C.error(`Error bootstrapping`,e),$.send.initializedError({error:Uc(e)})}}const pl=fl(),ml=new dt(e=>{$.send.kernelMessage(e)});let Q,hl=Promise.resolve();async function gl(e,t){await pl;try{Kc(self.controller,`Controller not loaded`),t&&await _l();let n=await self.controller.mountFilesystem({code:e.code,filename:`app-${e.appId}.py`}),r=await self.controller.startSession({...n,onMessage:t=>{ml.push({message:t,sessionGeneration:e.sessionGeneration})}});Q?r.destroy():Q={appId:e.appId,bridge:r,sessionGeneration:e.sessionGeneration},$.send.initialized({})}catch(e){throw $.send.initializedError({error:Uc(e)}),e}}async function _l(){let e=Q;await self.controller.stopSession(),Q=void 0,(e?.bridge)?.destroy()}function vl(e){let t=hl.then(e);return hl=t.then(()=>void 0,()=>void 0),t}const yl=u({startSession:async e=>{await vl(()=>gl(e,!1))},replaceSession:async e=>{await vl(()=>gl(e,!0))},stopSession:async e=>{await vl(async()=>{Q?.appId===e.appId&&Q?.sessionGeneration===e.sessionGeneration&&(Kc(self.controller,`Controller not loaded`),await _l())})},loadPackages:async e=>{await pl,await vl(async()=>{bl(e);let{code:t}=e;ie(t)&&(t=`import pandas\n${t}`,t=`import duckdb\n${t}`,t=`import sqlglot\n${t}`,t.includes(`polars`)&&(t=`import pyarrow\n${t}`)),await self.pyodide.loadPackagesFromImports(t,{messageCallback:C.log,errorCallback:C.error})})},bridge:async e=>{await pl;let{functionName:t,payload:n}=e;return vl(async()=>{let r=bl(e),i=n==null?null:typeof n==`string`?n:JSON.stringify(n),a=i==null?await r[t]():await r[t](i);return typeof a==`string`?JSON.parse(a):a})}});function bl(e){let t=Q;if(!t||e.appId!==t.appId||e.sessionGeneration!==t.sessionGeneration)throw Error(`The marimo app session is no longer active.`);return t.bridge}const $=p({transport:re({transportId:`marimo-transport`}),requestHandler:yl});$.send(`ready`,{}),$.addMessageListener(`consumerReady`,async()=>{await pl,ml.start()});function xl(){return self.name}export{o as t};