@marimo-team/frontend 0.14.11-dev7 → 0.14.11-dev72

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 (150) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-C0P31a5y.js → ConnectedDataExplorerComponent-QNSg3r9O.js} +3 -3
  2. package/dist/assets/{ImageComparisonComponent-DXDeGx2f.js → ImageComparisonComponent-CP5Cy_nl.js} +1 -1
  3. package/dist/assets/{VegaLite-CUqFyetE.js → VegaLite-Dfe0Urmt.js} +8 -8
  4. package/dist/assets/_baseEach-Oq1b6Vj7.js +1 -0
  5. package/dist/assets/_baseMap-NO7KiGEP.js +1 -0
  6. package/dist/assets/_baseUniq-B_mvr7GI.js +1 -0
  7. package/dist/assets/{_createAggregator-SoA2y5HH.js → _createAggregator-DYHbrJKw.js} +1 -1
  8. package/dist/assets/{any-language-editor-Bw2cdBsS.js → any-language-editor-Bz6ZWwU_.js} +1 -1
  9. package/dist/assets/arc-ZB5pDULS.js +1 -0
  10. package/dist/assets/architectureDiagram-NQ2NVSRB-dvHYur4M.js +36 -0
  11. package/dist/assets/blockDiagram-PHRCVELO-DuGlfCPb.js +122 -0
  12. package/dist/assets/{c4Diagram-VJAJSXHY-BHtN7uMz.js → c4Diagram-6F6E4RAY-C1bcLnUs.js} +2 -2
  13. package/dist/assets/channel-DO4c6oXE.js +1 -0
  14. package/dist/assets/{chunk-4BMEZGHF-BO5DiwLV.js → chunk-353BL4L5-Z9QK1Sy2.js} +1 -1
  15. package/dist/assets/{chunk-D6G4REZN-CbYGlbyQ.js → chunk-67H74DCK-BfbQjnIB.js} +1 -1
  16. package/dist/assets/chunk-6OLS64BW-DwBkid2_.js +220 -0
  17. package/dist/assets/{chunk-XZIHB7SX-COKmet6t.js → chunk-AACKK3MU-EMbcCDOG.js} +1 -1
  18. package/dist/assets/chunk-BFAMUDN2-Smdd-nnU.js +1 -0
  19. package/dist/assets/chunk-E2GYISFI-CkjiRzlT.js +15 -0
  20. package/dist/assets/{chunk-A2AXSNBT-B07L-F60.js → chunk-QEP2MXWD-DXF9XFhg.js} +4 -3
  21. package/dist/assets/chunk-SKB7J2MH-amgUtKom.js +1 -0
  22. package/dist/assets/{circle-play-DSXPiHO0.js → circle-play-DXMV_zw8.js} +2 -2
  23. package/dist/assets/classDiagram-BGRH5UQR-CqrI7fcr.js +1 -0
  24. package/dist/assets/classDiagram-v2-O24JOBDK-CqrI7fcr.js +1 -0
  25. package/dist/assets/clone-DmicZLVp.js +1 -0
  26. package/dist/assets/compile-OQmqyn3d.js +10 -0
  27. package/dist/assets/dagre-FFZHY6LT-Dm7KedkK.js +4 -0
  28. package/dist/assets/data-grid-overlay-editor-0MMb3ORz.js +1 -0
  29. package/dist/assets/diagram-3EMPZRKU-D4ptO8ZX.js +24 -0
  30. package/dist/assets/diagram-5UYTHUR4-DBDXUsko.js +24 -0
  31. package/dist/assets/diagram-ZTM2IBQH-DwVHm-a7.js +43 -0
  32. package/dist/assets/edit-page-rhiVKwbK.js +148 -0
  33. package/dist/assets/{erDiagram-Q7BY3M3F-l-V_9Yws.js → erDiagram-R3QVA2FD-CF2j_ghF.js} +1 -1
  34. package/dist/assets/flowDiagram-PKI6S5ZS-J8Af8aQY.js +162 -0
  35. package/dist/assets/ganttDiagram-EK5VF46D-BvmXCoQK.js +267 -0
  36. package/dist/assets/gitGraphDiagram-GW3U2K7C-Cr7iejkN.js +65 -0
  37. package/dist/assets/glide-data-editor-DcmjcDkq.css +1 -0
  38. package/dist/assets/glide-data-editor-dRdzyJuS.js +132 -0
  39. package/dist/assets/{graph-DpLAfWzk.js → graph-DQMI2Eqq.js} +1 -1
  40. package/dist/assets/home-page-DnThjRcD.js +9 -0
  41. package/dist/assets/{index-Bz3Lb65G.js → index-8OV_Dw5k.js} +1 -1
  42. package/dist/assets/{index-CxQo8Qlm.js → index-8PMBSacA.js} +1 -1
  43. package/dist/assets/{index-DAMc4rP9.js → index-B7HBR2mZ.js} +1 -1
  44. package/dist/assets/{index-C9EbJL5c.js → index-BDA641Ri.js} +1 -1
  45. package/dist/assets/index-BEQfoZiP.js +1 -0
  46. package/dist/assets/{index-DP4HiwTU.js → index-BRkwCtw_.js} +1 -1
  47. package/dist/assets/index-BYFCOF0M.js +1 -0
  48. package/dist/assets/{index-Cs9jrmWP.js → index-BgVLJCds.js} +1 -1
  49. package/dist/assets/{index-DQwFB8dN.js → index-C1UTJg_P.js} +2 -2
  50. package/dist/assets/{index-DZWCSqpf.js → index-C75-E0Wz.js} +1 -1
  51. package/dist/assets/index-CfmtzcxT.js +1 -0
  52. package/dist/assets/index-Cj-dQTQ3.js +1 -0
  53. package/dist/assets/{index-DbunLlvf.js → index-Cn4DIfCi.js} +1 -1
  54. package/dist/assets/index-CsdFJkJw.css +1 -0
  55. package/dist/assets/index-D6n-fNiw.js +1 -0
  56. package/dist/assets/{index-Czo055fo.js → index-DMYp6bTi.js} +1 -1
  57. package/dist/assets/index-DUfE3Ygv.js +507 -0
  58. package/dist/assets/{index-Cig6xGYH.js → index-DcLIgqZD.js} +1 -1
  59. package/dist/assets/index-DntrNFd9.js +1 -0
  60. package/dist/assets/{index-CmVTfWOx.js → index-T57zmtXp.js} +1 -1
  61. package/dist/assets/{index-N67HDT2u.js → index-nJgUkZhZ.js} +1 -1
  62. package/dist/assets/infoDiagram-RLU2ROGC-6ayEwNHi.js +2 -0
  63. package/dist/assets/journeyDiagram-EWQZEKCU-CufyRuPd.js +139 -0
  64. package/dist/assets/{kanban-definition-NDS4AKOZ-Cw4Vh4wD.js → kanban-definition-ILFWEQ3N-BMVZp5Z-.js} +9 -8
  65. package/dist/assets/{layout-DodQLUx6.js → layout-D6cZFix-.js} +1 -1
  66. package/dist/assets/linear-CwIDADia.js +1 -0
  67. package/dist/assets/links-BNNDBIJj.js +17 -0
  68. package/dist/assets/loro_wasm_bg-bPYKkGLG.wasm +0 -0
  69. package/dist/assets/mermaid-Bhkvxu54.js +152 -0
  70. package/dist/assets/min-BCL-6Bwx.js +1 -0
  71. package/dist/assets/{mindmap-definition-ALO5MXBD-C0KGo_i_.js → mindmap-definition-CZNETY7S-C_MYXj4X.js} +4 -4
  72. package/dist/assets/number-overlay-editor-Df2FevAR.js +9 -0
  73. package/dist/assets/{pieDiagram-IB7DONF6-DCnELF9y.js → pieDiagram-NIOCPIFQ-Bk9T2le2.js} +1 -1
  74. package/dist/assets/{quadrantDiagram-7GDLP6J5-D0cP5ixt.js → quadrantDiagram-2OG54O6I-NgH_B06m.js} +1 -1
  75. package/dist/assets/{react-plotly-BmDAcz3M.js → react-plotly-CXOmDiE0.js} +1 -1
  76. package/dist/assets/{requirementDiagram-KVF5MWMF-BTksN04O.js → requirementDiagram-SO3GGRV7-HvEJIPC2.js} +3 -3
  77. package/dist/assets/run-page-Mq0VpxGL.js +1 -0
  78. package/dist/assets/{sankeyDiagram-QLVOVGJD-DECOJIMC.js → sankeyDiagram-4UZDY2LN-CBGiR7n-.js} +4 -4
  79. package/dist/assets/save-worker-B8gk1S9x.js +1 -0
  80. package/dist/assets/sequenceDiagram-ZIKVLSP4-C7hXviAB.js +122 -0
  81. package/dist/assets/slides-component-1Y9n5Gm1.js +1 -0
  82. package/dist/assets/sortBy-DvcUtmWI.js +1 -0
  83. package/dist/assets/stateDiagram-XX37X6EN-BDbxDzSy.js +1 -0
  84. package/dist/assets/stateDiagram-v2-GD6S3NHB-omlXEd8A.js +1 -0
  85. package/dist/assets/storage-lmv2DjR1.js +25 -0
  86. package/dist/assets/{terminal-MtCDBvKs.js → terminal-DKZoyrP7.js} +1 -1
  87. package/dist/assets/{time-BoP93jle.js → time-y8i94pyX.js} +1 -1
  88. package/dist/assets/timeline-definition-RI47OAVP-DYNkDwyx.js +61 -0
  89. package/dist/assets/tracing-DGevMtzp.js +2 -0
  90. package/dist/assets/trash-CtRVuIVX.js +6 -0
  91. package/dist/assets/treemap-FKARHQ26-BVbfYHyM.js +126 -0
  92. package/dist/assets/vega-component-DQf7Z9TU.js +1 -0
  93. package/dist/assets/worker-BYA2ASe8.js +1 -0
  94. package/dist/assets/worker-Ch6cKXnI.js +1 -0
  95. package/dist/assets/xychartDiagram-H2YORKM3-BZbRNiRy.js +7 -0
  96. package/dist/index.html +4 -2
  97. package/package.json +45 -44
  98. package/dist/assets/_baseEach-BHb51vC7.js +0 -1
  99. package/dist/assets/_baseMap--rH4lBFQ.js +0 -1
  100. package/dist/assets/_baseUniq-CABXtSlj.js +0 -1
  101. package/dist/assets/arc-CfyY4LWz.js +0 -1
  102. package/dist/assets/architectureDiagram-IEHRJDOE-rGoAHYH8.js +0 -36
  103. package/dist/assets/blockDiagram-JOT3LUYC-ZBJWq8Z_.js +0 -121
  104. package/dist/assets/channel-C96bdTqW.js +0 -1
  105. package/dist/assets/chunk-AEK57VVT-DN2-tsCz.js +0 -220
  106. package/dist/assets/chunk-RZ5BOZE2-DVex9AD8.js +0 -1
  107. package/dist/assets/classDiagram-GIVACNV2-CehC5H1T.js +0 -1
  108. package/dist/assets/classDiagram-v2-COTLJTTW-CehC5H1T.js +0 -1
  109. package/dist/assets/clone-H0gxlZXI.js +0 -1
  110. package/dist/assets/compile-DEz1Y6_F.js +0 -10
  111. package/dist/assets/dagre-OKDRZEBW-CymbL2JX.js +0 -4
  112. package/dist/assets/data-editor-CTGVBJdC.js +0 -142
  113. package/dist/assets/diagram-SSKATNLV-DY5vs_Bj.js +0 -43
  114. package/dist/assets/diagram-VNBRO52H-ZuQiOKh8.js +0 -24
  115. package/dist/assets/edit-page-DcQ6ZhfW.js +0 -144
  116. package/dist/assets/flowDiagram-4HSFHLVR-BsHIJJTe.js +0 -161
  117. package/dist/assets/ganttDiagram-APWFNJXF-2gy5YbWU.js +0 -257
  118. package/dist/assets/gitGraphDiagram-7IBYFJ6S-B_ELHLbw.js +0 -65
  119. package/dist/assets/home-page-6auHzaGk.js +0 -9
  120. package/dist/assets/index-8IZtaDUn.css +0 -1
  121. package/dist/assets/index-B-mClP__.js +0 -1
  122. package/dist/assets/index-BuqjbKw0.js +0 -1
  123. package/dist/assets/index-C9EPiaCd.js +0 -1
  124. package/dist/assets/index-DDVWq6NK.js +0 -501
  125. package/dist/assets/index-FYYNNs_X.js +0 -1
  126. package/dist/assets/index-kmp97oxc.js +0 -1
  127. package/dist/assets/infoDiagram-PH2N3AL5-BwbaSo89.js +0 -2
  128. package/dist/assets/journeyDiagram-U35MCT3I-NKSvtlZA.js +0 -138
  129. package/dist/assets/linear-B_OPGLLI.js +0 -1
  130. package/dist/assets/loro_wasm_bg-DHBNbovs.wasm +0 -0
  131. package/dist/assets/mermaid-CVRC4Ruz.js +0 -152
  132. package/dist/assets/min-VmgWsmJ_.js +0 -1
  133. package/dist/assets/radar-MK3ICKWK-D8LhkSau.js +0 -126
  134. package/dist/assets/run-page-17VQxU3e.js +0 -1
  135. package/dist/assets/save-worker-DZnx0AG9.js +0 -1
  136. package/dist/assets/sequenceDiagram-X6HHIX6F-C5eDWwoH.js +0 -122
  137. package/dist/assets/shutdown-button-QvkERkPd.js +0 -17
  138. package/dist/assets/slides-component-DchvPU9C.js +0 -1
  139. package/dist/assets/sortBy-7ke7bFD2.js +0 -1
  140. package/dist/assets/stateDiagram-DGXRK772-D6Kwy963.js +0 -1
  141. package/dist/assets/stateDiagram-v2-YXO3MK2T-Bk10XR94.js +0 -1
  142. package/dist/assets/storage-BeNhlsrY.js +0 -27
  143. package/dist/assets/timeline-definition-BDJGKUSR-T1la59d1.js +0 -61
  144. package/dist/assets/tracing-CCltm96L.js +0 -2
  145. package/dist/assets/vega-component-j1BDb2QJ.js +0 -1
  146. package/dist/assets/worker-BbdB3qWL.js +0 -1
  147. package/dist/assets/worker-CnoOKJWk.js +0 -1
  148. package/dist/assets/xychartDiagram-VJFVF3MP-CoJqer7_.js +0 -7
  149. /package/dist/assets/{shutdown-button-C1rhMrxo.css → links-C1rhMrxo.css} +0 -0
  150. /package/dist/assets/{transform-DetRMEbJ.js → transform-CDNfLgV5.js} +0 -0
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-B-mClP__.js","./VegaLite-CUqFyetE.js","./index-DDVWq6NK.js","./index-8IZtaDUn.css","./compile-DEz1Y6_F.js","./time-BoP93jle.js","./timer-Bqd5yn_a.js","./linear-B_OPGLLI.js","./init-DLRA0X12.js","./range-CtcPcB_L.js","./zoom-COrs4lFh.js","./ordinal-DDUp3AbE.js","./colors-bszWmPJw.js","./step-BwsUM5iJ.js","./arc-CfyY4LWz.js","./index-DbunLlvf.js"])))=>i.map(i=>d[i]);
2
- import{u as G,c as b,Z as O,_ as J,U as K,Q as k,j as s,a as W,$ as X,a0 as ee,a1 as U,a2 as te,V as re,a3 as se,a4 as A,a5 as ie,a6 as oe,a7 as ae,a8 as le,__tla as ne}from"./index-DDVWq6NK.js";import{c as me}from"./compile-DEz1Y6_F.js";import{r as pe,u as ce,__tla as de}from"./storage-BeNhlsrY.js";import{P as ue,C as he,f as Q,E as xe,a as ge,__tla as fe}from"./edit-page-DcQ6ZhfW.js";import{A as ve}from"./shutdown-button-QvkERkPd.js";import{C as je}from"./circle-play-DSXPiHO0.js";import"./time-BoP93jle.js";import"./timer-Bqd5yn_a.js";import"./linear-B_OPGLLI.js";import"./init-DLRA0X12.js";import"./range-CtcPcB_L.js";import"./zoom-COrs4lFh.js";import"./ordinal-DDUp3AbE.js";import"./colors-bszWmPJw.js";import"./step-BwsUM5iJ.js";import"./arc-CfyY4LWz.js";import"./index-CmVTfWOx.js";import"./index-Bz3Lb65G.js";import"./index-FYYNNs_X.js";import"./index-C9EPiaCd.js";import"./index-N67HDT2u.js";import"./index-Cs9jrmWP.js";import"./index-Cig6xGYH.js";import"./index-DZWCSqpf.js";import"./index-DP4HiwTU.js";import"./index-Czo055fo.js";import"./index-C9EbJL5c.js";import"./index-BuqjbKw0.js";import"./index-CxQo8Qlm.js";import"./apl-CXdQSnD-.js";import"./asciiarmor-D5V0T9Cu.js";import"./asterisk-B46aRdXb.js";import"./brainfuck-CtZaYBKt.js";import"./clike-BgBwzOhw.js";import"./cmake-DXn5xaP-.js";import"./cobol-stawOqaz.js";import"./coffeescript-BTDxI-eT.js";import"./commonlisp-vq6DHwts.js";import"./crystal-CRzZ78HM.js";import"./cypher-gJDei3ni.js";import"./d-BShv7fp-.js";import"./diff-UJJ5BM9S.js";import"./dockerfile-knGOOxt4.js";import"./simple-mode-C3vEBAcb.js";import"./dtd-DI9Herc-.js";import"./dylan-DkEP81N9.js";import"./ebnf-B-Df8AvO.js";import"./ecl-DPFc0Uaf.js";import"./eiffel-DR5c0IrL.js";import"./elm-DompmV0j.js";import"./erlang-BuqgqA5h.js";import"./factor-CFXhaUWb.js";import"./fcl-CVaBTCzQ.js";import"./forth-POgR1ypr.js";import"./fortran-DL7KluxX.js";import"./gas-bV0CklSb.js";import"./gherkin-B6X1vGSW.js";import"./groovy-DnIzCrpZ.js";import"./haskell-CLQs6EAM.js";import"./haxe-D25e-2l-.js";import"./http-BKJkqRj4.js";import"./idl-pcmmZuaN.js";import"./jinja2-DhgKlfW7.js";import"./julia-DjdwvFuI.js";import"./livescript-HO6ttBFx.js";import"./lua-8DXOpKDz.js";import"./mathematica-IIbmv7SK.js";import"./mbox-z_N2Mo3d.js";import"./mirc-DkvFAiy5.js";import"./modelica-DSrSSXCg.js";import"./mscgen-B2igx18G.js";import"./mumps-zvxmGV4l.js";import"./nginx-B4hAVlXN.js";import"./nsis-BvKfQ9lQ.js";import"./ntriples-BSwWqoLa.js";import"./octave-C4hdQ5Hf.js";import"./oz-qQq7irPq.js";import"./pascal-CafrKXZF.js";import"./perl-tdMlh9QA.js";import"./pig-CwGJVRC4.js";import"./powershell-D1ly3AHC.js";import"./properties-_nPj978X.js";import"./protobuf-B4y9do6W.js";import"./puppet-Bc-yJKzi.js";import"./q-B0kTJ4cI.js";import"./r-BA4EbLKE.js";import"./ruby-CR-u2WLS.js";import"./sas-Bqaci40L.js";import"./scheme-qjP0V5Ag.js";import"./shell-BLav31RL.js";import"./sieve-r025o_jW.js";import"./smalltalk-C7J3IyEP.js";import"./solr-78MBEUkU.js";import"./sparql-BRLJFz69.js";import"./spreadsheet-CGlWr0eM.js";import"./stylus-Bdo_Aemu.js";import"./swift-B_XXVlXX.js";import"./tcl-B2fODqDH.js";import"./textile-BuVhTOzU.js";import"./tiddlywiki-BgR6AEZu.js";import"./tiki-CI-ztowC.js";import"./toml-wcPdHu67.js";import"./troff-Ce85hlLp.js";import"./ttcn-BxnYHtq8.js";import"./turtle-BkSuIpt-.js";import"./vb-BHgjm0DN.js";import"./vbscript-Dawdd5GZ.js";import"./velocity-BdD_26Jv.js";import"./verilog-B4LBqg_1.js";import"./vhdl-CWWH2SUo.js";import"./webidl-CGwyPRYs.js";import"./xquery-CVDBqZPY.js";import"./yacas-I8QjZlxf.js";import"./z80-D8p3gKXp.js";import"./_createAggregator-SoA2y5HH.js";import"./_baseEach-BHb51vC7.js";import"./transform-DetRMEbJ.js";import"./sortBy-7ke7bFD2.js";import"./_baseMap--rH4lBFQ.js";import"./index-DbunLlvf.js";let Y,w,ye=Promise.all([(()=>{try{return ne}catch{}})(),(()=>{try{return de}catch{}})(),(()=>{try{return fe}catch{}})()]).then(async()=>{const Z=G("circle-ellipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]),M="hoveredCellId",P="cellHover",C="cell",R="startTimestamp",L="endTimestamp",z="status";let E,B,$,H,V,q,D,F;E=J(new Map),Y=()=>{const t=b.c(28),{runIds:e,runMap:r}=O(pe),l=O(E),{clearRuns:o}=ce(),{theme:a}=K(),[i,u]=k.useState("above");let m;t[0]!==i?(m=()=>{u(i==="above"?"sideBySide":"above")},t[0]=i,t[1]=m):m=t[1];const x=m;if(e.length===0){let h;return t[2]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(ue,{title:"No traces",description:s.jsx("span",{children:"Cells that have ran will appear here."}),icon:s.jsx(ve,{})}),t[2]=h):h=t[2],h}let d;t[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("label",{htmlFor:"chartPosition",className:"text-xs",children:"Inline chart"}),t[3]=d):d=t[3];const p=i==="sideBySide";let g,c,y,f,v,I;if(t[4]!==p||t[5]!==x?(g=s.jsxs("div",{className:"flex flex-row gap-1 items-center",children:[d,s.jsx("input",{type:"checkbox",name:"chartPosition","data-testid":"chartPosition",onClick:x,defaultChecked:p,className:"h-3 cursor-pointer"})]}),t[4]=p,t[5]=x,t[6]=g):g=t[6],t[7]!==o?(c=s.jsx(he,{dataTestId:"clear-traces-button",onClick:o}),t[7]=o,t[8]=c):c=t[8],t[9]!==g||t[10]!==c?(y=s.jsxs("div",{className:"flex flex-row justify-end gap-3",children:[g,c]}),t[9]=g,t[10]=c,t[11]=y):y=t[11],t[12]!==i||t[13]!==l||t[14]!==e||t[15]!==r||t[16]!==a){let h;t[18]!==i||t[19]!==l||t[20]!==r||t[21]!==a?(h=(S,n)=>{const j=r.get(S);if(j)return s.jsx(H,{run:j,isExpanded:l.get(j.runId),isMostRecentRun:n===0,chartPosition:i,theme:a},j.runId)},t[18]=i,t[19]=l,t[20]=r,t[21]=a,t[22]=h):h=t[22],f=e.map(h),t[12]=i,t[13]=l,t[14]=e,t[15]=r,t[16]=a,t[17]=f}else f=t[17];return t[23]!==f?(v=s.jsx("div",{className:"flex flex-col gap-3",children:f}),t[23]=f,t[24]=v):v=t[24],t[25]!==y||t[26]!==v?(I=s.jsxs("div",{className:"py-1 px-2 overflow-y-scroll",children:[y,v]}),t[25]=y,t[26]=v,t[27]=I):I=t[27],I},B=W.lazy(()=>X(()=>import("./index-B-mClP__.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(t=>({default:t.Vega}))),$=t=>{const e=b.c(10),{ref:r,width:l}=le(),o=l===void 0?300:l,a=t.theme==="dark"?"dark":void 0,i=o-50;let u,m;return e[0]!==t.height||e[1]!==t.signalListeners||e[2]!==t.vegaSpec||e[3]!==a||e[4]!==i?(u=s.jsx(k.Suspense,{children:s.jsx(B,{spec:t.vegaSpec,theme:a,width:i,height:t.height,signalListeners:t.signalListeners,actions:!1})}),e[0]=t.height,e[1]=t.signalListeners,e[2]=t.vegaSpec,e[3]=a,e[4]=i,e[5]=u):u=e[5],e[6]!==t.className||e[7]!==r||e[8]!==u?(m=s.jsx("div",{className:t.className,ref:r,children:u}),e[6]=t.className,e[7]=r,e[8]=u,e[9]=m):m=e[9],m},H=({run:t,isMostRecentRun:e,chartPosition:r,isExpanded:l,theme:o})=>{const a=ee(E),i=(l=l??e)?ie:oe,u=s.jsx(i,{height:16,className:"inline"}),m=s.jsxs("span",{className:"text-sm cursor-pointer",onClick:()=>{a(x=>{const d=new Map(x);return d.set(t.runId,!l),d})},children:["Run - ",U(t.runStartTime),u]});return l?s.jsx(V,{run:t,chartPosition:r,theme:o,title:m},t.runId):s.jsx("div",{className:"flex flex-col",children:s.jsx("pre",{className:"font-mono font-semibold",children:m})},t.runId)},V=t=>{const e=b.c(32),{run:r,chartPosition:l,theme:o,title:a}=t,[i,u]=k.useState();let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={[P]:(S,n)=>{var _;const j=n,N=(_=j.cell)==null?void 0:_[0];u(N??null)}},e[0]=m):m=e[0];const x=m,d=te();let p,g;if(e[1]!==d||e[2]!==l||e[3]!==r.cellRuns||e[4]!==r.runId||e[5]!==o){const S=[...r.cellRuns.values()].map(n=>{const j=n.elapsedTime??0;return{cell:n.cellId,cellNum:d.inOrderIds.indexOf(n.cellId),startTimestamp:w(n.startTime),endTimestamp:w(n.startTime+j),elapsedTime:Q(1e3*j),status:n.status}});p=`hiddenInputElement-${r.runId}`,g=me(function(n,j,N,_){return{$schema:"https://vega.github.io/schema/vega-lite/v5.json",background:_==="dark"?"black":void 0,mark:{type:"bar",cornerRadius:2},params:[{name:M,bind:{element:`#${j}`}},{name:P,select:{type:"point",on:"mouseover",fields:[C],clear:"mouseout"}}],height:{step:23},encoding:{y:{field:"cellNum",scale:{paddingInner:.2},sort:{field:"sortPriority"},title:"cell",axis:N==="sideBySide"?null:void 0},x:{field:R,type:"temporal",axis:{orient:"top",title:null}},x2:{field:L,type:"temporal"},tooltip:[{field:R,type:"temporal",timeUnit:"hoursminutessecondsmilliseconds",title:"Start"},{field:L,type:"temporal",timeUnit:"hoursminutessecondsmilliseconds",title:"End"}],size:{value:{expr:`${M} == toString(datum.${C}) ? 19.5 : 18`}},color:{field:z,scale:{domain:["success","error"],range:["#37BE5F","red"]},legend:null}},data:{values:n},transform:[{calculate:`datum.${z} === 'queued' ? 9999999999999 : datum.${R}`,as:"sortPriority"}],config:{view:{stroke:"transparent"}}}}(S,p,l,o)),e[1]=d,e[2]=l,e[3]=r.cellRuns,e[4]=r.runId,e[5]=o,e[6]=p,e[7]=g}else p=e[6],g=e[7];const c=g.spec;let y;e[8]!==p||e[9]!==i||e[10]!==r?(y=s.jsx(q,{run:r,hoveredCellId:i,hiddenInputElementId:p}),e[8]=p,e[9]=i,e[10]=r,e[11]=y):y=e[11];const f=y;if(l==="above"){let S,n,j;return e[12]!==o||e[13]!==c?(S=s.jsx($,{vegaSpec:c,height:120,signalListeners:x,theme:o}),e[12]=o,e[13]=c,e[14]=S):S=e[14],e[15]!==S||e[16]!==a||e[17]!==f?(n=s.jsxs("pre",{className:"font-mono font-semibold",children:[a,S,f]}),e[15]=S,e[16]=a,e[17]=f,e[18]=n):n=e[18],e[19]!==r.runId||e[20]!==n?(j=s.jsx("div",{className:"flex flex-col",children:n},r.runId),e[19]=r.runId,e[20]=n,e[21]=j):j=e[21],j}let v,I,h;return e[22]!==a||e[23]!==f?(v=s.jsxs("pre",{className:"font-mono font-semibold",children:[a,f]}),e[22]=a,e[23]=f,e[24]=v):v=e[24],e[25]!==o||e[26]!==c?(I=s.jsx($,{className:"-mt-0.5 flex-1",vegaSpec:c,height:100,signalListeners:x,theme:o}),e[25]=o,e[26]=c,e[27]=I):I=e[27],e[28]!==r.runId||e[29]!==v||e[30]!==I?(h=s.jsxs("div",{className:"flex flex-row",children:[v,I]},r.runId),e[28]=r.runId,e[29]=v,e[30]=I,e[31]=h):h=e[31],h},q=t=>{const e=b.c(12),{run:r,hoveredCellId:l,hiddenInputElementId:o}=t,a=k.useRef(null);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=c=>{a.current&&(a.current.value=String(c),a.current.dispatchEvent(new Event("input",{bubbles:!0})))},e[0]=i):i=e[0];const u=i,m=l||"";let x,d,p,g;return e[1]!==o||e[2]!==m?(x=s.jsx("input",{type:"text",id:o,defaultValue:m,hidden:!0,ref:a}),e[1]=o,e[2]=m,e[3]=x):x=e[3],e[4]!==r.cellRuns?(d=[...r.cellRuns.values()],e[4]=r.cellRuns,e[5]=d):d=e[5],e[6]!==l||e[7]!==d?(p=d.map(c=>s.jsx(F,{cellRun:c,hovered:c.cellId===l,dispatchHoverEvent:u},c.cellId)),e[6]=l,e[7]=d,e[8]=p):p=e[8],e[9]!==x||e[10]!==p?(g=s.jsxs("div",{className:"text-xs mt-0.5 ml-3 flex flex-col gap-0.5",children:[x,p]}),e[9]=x,e[10]=p,e[11]=g):g=e[11],g},D={success:s.jsx(ge,{color:"green",size:14}),running:s.jsx(je,{color:"var(--blue-10)",size:14}),error:s.jsx(ae,{color:"red",size:14}),queued:s.jsx(Z,{color:"grey",size:14})},F=t=>{const e=b.c(39),{cellRun:r,hovered:l,dispatchHoverEvent:o}=t;let a;e[0]!==r.elapsedTime?(a=r.elapsedTime?Q(1e3*r.elapsedTime):"-",e[0]=r.elapsedTime,e[1]=a):a=e[1];const i=a;let u;e[2]!==r.elapsedTime||e[3]!==i?(u=r.elapsedTime?s.jsxs("span",{children:["This cell took ",s.jsx(xe,{elapsedTime:i})," to run"]}):s.jsx("span",{children:"This cell has not been run"}),e[2]=r.elapsedTime,e[3]=i,e[4]=u):u=e[4];const m=u;let x;e[5]!==r.cellId||e[6]!==o?(x=()=>{o(r.cellId)},e[5]=r.cellId,e[6]=o,e[7]=x):x=e[7];const d=x;let p;e[8]!==o?(p=()=>{o(null)},e[8]=o,e[9]=p):p=e[9];const g=p,c=l&&"bg-[var(--gray-3)] opacity-100";let y,f,v,I,h,S,n;e[10]!==c?(y=re("flex flex-row gap-2 py-1 px-1 opacity-70 hover:bg-[var(--gray-3)] hover:opacity-100",c),e[10]=c,e[11]=y):y=e[11],e[12]!==r.startTime?(f=U(r.startTime),e[12]=r.startTime,e[13]=f):f=e[13],e[14]!==f?(v=s.jsxs("span",{className:"text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:["[",f,"]"]}),e[14]=f,e[15]=v):v=e[15],e[16]!==r.cellId?(I=s.jsxs("span",{className:"text-[var(--gray-10)] w-16",children:["(",s.jsx(se,{cellId:r.cellId}),")"]}),e[16]=r.cellId,e[17]=I):I=e[17],e[18]!==r.code?(h=s.jsx("span",{className:"w-40 truncate -ml-1",children:r.code}),e[18]=r.code,e[19]=h):h=e[19],e[20]!==i?(S=s.jsx("span",{className:"text-[var(--gray-10)] dark:text-[var(--gray-11)]",children:i}),e[20]=i,e[21]=S):S=e[21],e[22]!==m||e[23]!==S?(n=s.jsx(A,{content:m,children:S}),e[22]=m,e[23]=S,e[24]=n):n=e[24];const j=D[r.status];let N,_,T;return e[25]!==r.status||e[26]!==j?(N=s.jsx(A,{content:r.status,children:j}),e[25]=r.status,e[26]=j,e[27]=N):N=e[27],e[28]!==n||e[29]!==N?(_=s.jsxs("div",{className:"flex flex-row gap-1 w-16 justify-end -ml-2",children:[n,N]}),e[28]=n,e[29]=N,e[30]=_):_=e[30],e[31]!==d||e[32]!==g||e[33]!==h||e[34]!==_||e[35]!==y||e[36]!==v||e[37]!==I?(T=s.jsxs("div",{className:y,onMouseEnter:d,onMouseLeave:g,children:[v,I,h,_]}),e[31]=d,e[32]=g,e[33]=h,e[34]=_,e[35]=y,e[36]=v,e[37]=I,e[38]=T):T=e[38],T},w=function(t){try{const e=new Date(1e3*t),r=e.getFullYear(),l=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),a=String(e.getHours()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0"),u=String(e.getSeconds()).padStart(2,"0");return`${r}-${l}-${o} ${a}:${i}:${u}.${String(e.getMilliseconds()).padStart(3,"0")}`}catch{return""}}});export{Y as Tracing,ye as __tla,w as formatChartTime};
@@ -1 +0,0 @@
1
- import{aH as K,aI as F,c as E,aJ as D,aK as G,aL as W,j as g,E as $,U as C,Q as j,aM as L,aN as I,aO as Q,L as _,aP as V,aQ as R,aR as U,aS as q,aT as J,a4 as B,aU as X}from"./index-DDVWq6NK.js";import{M as y}from"./compile-DEz1Y6_F.js";import{a as Y}from"./VegaLite-CUqFyetE.js";import"./time-BoP93jle.js";import"./timer-Bqd5yn_a.js";import"./linear-B_OPGLLI.js";import"./init-DLRA0X12.js";import"./range-CtcPcB_L.js";import"./zoom-COrs4lFh.js";import"./ordinal-DDUp3AbE.js";import"./colors-bszWmPJw.js";import"./step-BwsUM5iJ.js";import"./arc-CfyY4LWz.js";import"./index-DbunLlvf.js";const z=new Set(["boxplot","errorband","errorbar"]),S={getMarkType(t){const e=typeof t=="string"?t:t.type;if(z.has(e))throw new Error("Not supported");return e},isInteractive(t){const e=typeof t=="string"?t:t.type;return!z.has(e)},makeClickable(t){const e=typeof t=="string"?t:t.type;return e in y?typeof t=="string"?{type:t,cursor:"pointer",tooltip:!0}:{...t,type:e,cursor:"pointer",tooltip:!0}:t},getOpacity:t=>typeof t=="string"?null:"opacity"in t&&typeof t.opacity=="number"?t.opacity:null},tt=new Set(["color","fill","fillOpacity","opacity","shape","size"]);function et(t,e,r,i){const u={and:r.map(d=>({param:d}))};if(t==="opacity"){const d=S.getOpacity(i)||1;return{...e,opacity:{condition:{test:u,value:d},value:d/5}}}return e}const w={point:t=>t==null?"select_point":`select_point_${t}`,interval:t=>t==null?"select_interval":`select_interval_${t}`,legendSelection:t=>`legend_selection_${t}`,HIGHLIGHT:"highlight",PAN_ZOOM:"pan_zoom",hasPoint:t=>t.some(e=>e.startsWith("select_point")),hasInterval:t=>t.some(e=>e.startsWith("select_interval")),hasLegend:t=>t.some(e=>e.startsWith("legend_selection")),hasPanZoom:t=>t.some(e=>e.startsWith("pan_zoom"))},P={highlight:()=>({name:w.HIGHLIGHT,select:{type:"point",on:"mouseover"}}),interval:(t,e)=>({name:w.interval(e),select:{type:"interval",encodings:T(t),mark:{fill:"#669EFF",fillOpacity:.07,stroke:"#669EFF",strokeOpacity:.4},on:"[mousedown[!event.metaKey], mouseup] > mousemove[!event.metaKey]",translate:"[mousedown[!event.metaKey], mouseup] > mousemove[!event.metaKey]"}}),point:(t,e)=>({name:w.point(e),select:{type:"point",encodings:T(t),on:"click[!event.metaKey]"}}),legend:t=>({name:w.legendSelection(t),select:{type:"point",fields:[t]},bind:"legend"}),panZoom:()=>({name:w.PAN_ZOOM,bind:"scales",select:{type:"interval",on:"[mousedown[event.metaKey], window:mouseup] > window:mousemove!",translate:"[mousedown[event.metaKey], window:mouseup] > window:mousemove!",zoom:"wheel![event.metaKey]"}})};function T(t){switch(S.getMarkType(t.mark)){case y.image:case y.trail:return;case y.area:case y.arc:return["color"];case y.bar:{const e=function(r){var d,l;if(!r||!("mark"in r))return;const i=(d=r.encoding)==null?void 0:d.x,u=(l=r.encoding)==null?void 0:l.y;if(i&&"type"in i&&i.type==="nominal")return"vertical";if(u&&"type"in u&&u.type==="nominal"||i&&"aggregate"in i)return"horizontal";if(u&&"aggregate"in u)return"vertical"}(t);return e==="horizontal"?["y"]:e==="vertical"?["x"]:void 0}case y.circle:case y.geoshape:case y.line:case y.point:case y.rect:case y.rule:case y.square:case y.text:case y.tick:return["x","y"]}}function Z(t){return"params"in t&&t.params&&t.params.length>0?t.params.filter(e=>e!=null&&"select"in e&&e.select!==void 0).map(e=>e.name):"layer"in t?[...new Set(t.layer.flatMap(Z))]:[]}function at(t,e){var f,v;let{chartSelection:r=!0,fieldSelection:i=!0}=e;if(!r&&!i)return t;if(((f=t.params)==null?void 0:f.some(c=>c.bind==="legend"))&&(i=!1),((v=t.params)==null?void 0:v.some(c=>!c.bind))&&(r=!1),"vconcat"in t){const c=t.vconcat.map(o=>"mark"in o?O(o):o);return{...t,vconcat:c}}if("hconcat"in t){const c=t.hconcat.map(o=>"mark"in o?O(o):o);return{...t,hconcat:c}}if("layer"in t){const c=t.layer.map((o,p)=>{if(!("mark"in o))return o;let s=o;return s=A(s,r,p),s=O(s),p===0&&(s=H(s)),s});return{...t,layer:c}}if(!("mark"in t)||!S.isInteractive(t.mark))return t;let l=t;return l=function(c,o){if(o===!1)return c;let p=function(h){if(!h||!("encoding"in h))return[];const{encoding:b}=h;return b?Object.entries(b).flatMap(a=>{const[n,m]=a;return m&&tt.has(n)?"field"in m&&typeof m.field=="string"?[m.field]:"condition"in m&&m.condition&&typeof m.condition=="object"&&"field"in m.condition&&m.condition.field&&typeof m.condition.field=="string"?[m.condition.field]:[]:[]}):[]}(c);Array.isArray(o)&&(p=p.filter(h=>o.includes(h)));const s=p.map(h=>P.legend(h)),x=[...c.params||[],...s];return{...c,params:x}}(l,i),l=A(l,r,void 0),l=O(l),l=H(l),l}function A(t,e,r){if(e===!1)return t;let i;try{i=S.getMarkType(t.mark)}catch{return t}if(i==="geoshape")return t;const u=e===!0?function(f){switch(f){case"arc":case"area":return["point"];case"text":case"bar":default:return["point","interval"];case"line":return}}(i):[e];if(!u)return t;const d=u.map(f=>f==="interval"?P.interval(t,r):P.point(t,r)),l=[...t.params||[],...d];return{...t,params:l}}function H(t){let e;try{e=S.getMarkType(t.mark)}catch{}if(e==="geoshape")return t;const r=t.params||[];return r.some(i=>i.bind==="scales")?t:{...t,params:[...r,P.panZoom()]}}function O(t){const e="encoding"in t?t.encoding:void 0,r=t.params||[],i=r.map(u=>u.name);return r.length===0?t:S.isInteractive(t.mark)?{...t,mark:S.makeClickable(t.mark),encoding:et("opacity",e||{},i,t.mark)}:t}G("arrow",W);const nt=t=>{const e=E.c(11),{value:r,setValue:i,chartSelection:u,fieldSelection:d,spec:l}=t;let f,v;e[0]!==l?(f=async()=>async function(s){if(!s)return s;const x="datasets"in s?{...s.datasets}:{},h=async a=>{if(!a)return a;if("layer"in a){const k=await Promise.all(a.layer.map(h));a={...a,layer:k}}if("hconcat"in a){const k=await Promise.all(a.hconcat.map(h));a={...a,hconcat:k}}if("vconcat"in a){const k=await Promise.all(a.vconcat.map(h));a={...a,vconcat:k}}if("spec"in a&&(a={...a,spec:await h(a.spec)}),!a.data||!("url"in a.data))return a;let n;try{n=K(a.data.url)}catch{return a}const m=await F(n.href,a.data.format);return x[n.pathname]=m,{...a,data:{name:n.pathname}}},b=await h(s);return Object.keys(x).length===0?b:{...b,datasets:x}}(l),v=[l],e[0]=l,e[1]=f,e[2]=v):(f=e[1],v=e[2]);const{data:c,error:o}=D(f,v);if(o){let s;return e[3]!==o?(s=g.jsx($,{error:o}),e[3]=o,e[4]=s):s=e[4],s}if(!c)return null;let p;return e[5]!==u||e[6]!==d||e[7]!==c||e[8]!==i||e[9]!==r?(p=g.jsx(rt,{value:r,setValue:i,chartSelection:u,fieldSelection:d,spec:c}),e[5]=u,e[6]=d,e[7]=c,e[8]=i,e[9]=r,e[10]=p):p=e[10],p},rt=({value:t,setValue:e,chartSelection:r,fieldSelection:i,spec:u})=>{const{theme:d}=C(),l=j.useRef(void 0),[f,v]=j.useState(),c=L(u),o=j.useMemo(()=>at(function(n){return n.data&&"url"in n.data&&(n.data.url=K(n.data.url).href),n}(c),{chartSelection:r,fieldSelection:i}),[c,r,i]),p=j.useMemo(()=>Z(o),[o]),s=I(n=>{e({...t,...n})}),x=L(p),h=j.useMemo(()=>x.reduce((n,m)=>(w.PAN_ZOOM===m||(n[m]=Q((k,N)=>{_.debug("[Vega signal]",k,N);let M=V.mapValues(N,st);M=V.mapValues(M,ot),s({[k]:M})},100)),n),{}),[x,s]),b=I(n=>{_.error(n),_.debug(o),v(n)}),a=I(n=>{_.debug("[Vega view] created",n),l.current=n,v(void 0)});return g.jsxs(g.Fragment,{children:[f&&g.jsxs(R,{variant:"destructive",children:[g.jsx(U,{children:f.message}),g.jsx("div",{className:"text-md",children:f.stack})]}),g.jsxs("div",{className:"relative",onPointerDown:q.stopPropagation(),children:[g.jsx(Y,{spec:o,theme:d==="dark"?"dark":void 0,actions:it,signalListeners:h,onError:b,onNewView:a}),(()=>{const n=[];return w.hasPoint(p)&&n.push(["Point selection","click to select a point; hold shift for multi-select"]),w.hasInterval(p)&&n.push(["Interval selection","click and drag to select an interval"]),w.hasLegend(p)&&n.push(["Legend selection","click to select a legend item; hold shift for multi-select"]),w.hasPanZoom(p)&&n.push(["Pan","hold the meta key and drag"],["Zoom","hold the meta key and scroll"]),n.length===0?null:g.jsx(B,{delayDuration:300,side:"left",content:g.jsx("div",{className:"text-xs flex flex-col",children:n.map((m,k)=>g.jsxs("div",{children:[g.jsxs("span",{className:"font-bold tracking-wide",children:[m[0],":"]})," ",m[1]]},k))}),children:g.jsx(X,{className:"absolute bottom-1 right-0 m-2 h-4 w-4 cursor-help text-muted-foreground hover:text-foreground"})})})()]})]})},it={source:!1,compiled:!1};function ot(t){return t instanceof Set?[...t]:t}function st(t){return Array.isArray(t)?t.map(e=>e instanceof Date&&J(e)?new Date(e).getTime():e):t}export{nt as default};
@@ -1 +0,0 @@
1
- const e=1e3;function t(e,t){const n=e.map(e=>`"${e}"`).join(", ");return new Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${n}`)}function n(n={}){let r={};function a(e){r=e}let s,i={};function o(e){i.unregisterHandler&&i.unregisterHandler(),i=e,i.registerHandler?.(b)}function d(e){s="function"!=typeof e?(t,n)=>{const r=e[t];if(r)return r(n);const a=e._;if(!a)throw new Error(`The requested method has no handler: ${t}`);return a(t,n)}:e}const{maxRequestTime:c=e}=n;n.transport&&o(n.transport),n.requestHandler&&d(n.requestHandler),n._debugHooks&&a(n._debugHooks);let u=0;const l=new Map,p=new Map;function h(e,...n){const a=n[0];return new Promise((n,s)=>{if(!i.send)throw t(["send"],"make requests");const o=u<=1e10?++u:u=0,d={type:"request",id:o,method:e,params:a};l.set(o,{resolve:n,reject:s}),c!==1/0&&p.set(o,setTimeout(()=>{p.delete(o),s(new Error("RPC request timed out."))},c)),r.onSend?.(d),i.send(d)})}const m=new Proxy(h,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>h(t,e)}),f=m;function y(e,...n){const a=n[0];if(!i.send)throw t(["send"],"send messages");const s={type:"message",id:e,payload:a};r.onSend?.(s),i.send(s)}const g=new Proxy(y,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>y(t,e)}),v=g,_=new Map,w=new Set;async function b(e){if(r.onReceive?.(e),!("type"in e))throw new Error("Message does not contain a type.");if("request"===e.type){if(!i.send||!s)throw t(["send","requestHandler"],"handle requests");const{id:a,method:o,params:d}=e;let c;try{c={type:"response",id:a,success:!0,payload:await s(o,d)}}catch(n){if(!(n instanceof Error))throw n;c={type:"response",id:a,success:!1,error:n.message}}return r.onSend?.(c),void i.send(c)}if("response"===e.type){const t=p.get(e.id);null!=t&&clearTimeout(t);const{resolve:n,reject:r}=l.get(e.id)??{};return void(e.success?n?.(e.payload):r?.(new Error(e.error)))}if("message"===e.type){for(const n of w)n(e.id,e.payload);const t=_.get(e.id);if(!t)return;for(const n of t)n(e.payload);return}throw new Error(`Unexpected RPC message type: ${e.type}`)}return{setTransport:o,setRequestHandler:d,request:m,requestProxy:f,send:g,sendProxy:v,addMessageListener:function(e,n){if(!i.registerHandler)throw t(["registerHandler"],"register message listeners");"*"!==e?(_.has(e)||_.set(e,new Set),_.get(e)?.add(n)):w.add(n)},removeMessageListener:function(e,t){"*"!==e?(_.get(e)?.delete(t),0===_.get(e)?.size&&_.delete(e)):w.delete(t)},proxy:{send:v,request:f},_setDebugHooks:a}}const r="[transport-id]";function a(e,t={}){const{transportId:n,filter:a,remotePort:s}=t,i=e,o=s??e;let d;return{send(e){o.postMessage(function(e,t){const{transportId:n}=t;return null!=n?{[r]:n,data:e}:e}(e,{transportId:n}))},registerHandler(e){d=t=>{const s=t.data,[i,o]=function(e,t){const{transportId:n,filter:a}=t,s=a?.();if(null!=n&&null!=s)throw new Error("Cannot use both `transportId` and `filter` at the same time");let i=e;if(n){if(e[r]!==n)return[!0];i=e.data}return!1===s?[!0]:[!1,i]}(s,{transportId:n,filter:()=>a?.(t)});i||e(o)},i.addEventListener("message",d)},unregisterHandler(){d&&i.removeEventListener("message",d)}}}const s=()=>{},i=(e,t)=>{const n=`[${e}]`;return{debug:(...e)=>t.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=>i(`${e}.${n}`,t),disabled:(e=!0)=>e?d:t}},o={debug:(...e)=>{},log:(...e)=>{console.log(...e)},warn:(...e)=>{console.warn(...e)},error:(...e)=>{console.error(...e)},trace:(...e)=>{console.trace(...e)},get:e=>i(e,o),disabled:(e=!0)=>e?d:o},d={debug:()=>s,log:()=>s,warn:()=>s,error:()=>s,trace:()=>s,get:()=>d,disabled:()=>d};const c="undefined"!=typeof window&&window.Logger||o,u=e=>(new TextDecoder).decode(e);var l,p;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(l||(l={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(p||(p={}));const h=l.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m=e=>{switch(typeof e){case"undefined":return h.undefined;case"string":return h.string;case"number":return isNaN(e)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(e)?h.array:null===e?h.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?h.promise:"undefined"!=typeof Map&&e instanceof Map?h.map:"undefined"!=typeof Set&&e instanceof Set?h.set:"undefined"!=typeof Date&&e instanceof Date?h.date:h.object;default:return h.unknown}},f=l.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class y extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(r);else if("invalid_return_type"===a.code)r(a.returnTypeError);else if("invalid_arguments"===a.code)r(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,r=0;for(;r<a.path.length;){const n=a.path[r];r===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,l.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const g=(e,t)=>{let n;switch(e.code){case f.invalid_type:n=e.received===h.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,l.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${l.joinValues(e.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${l.joinValues(e.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${l.joinValues(e.options)}, received '${e.received}'`;break;case f.invalid_arguments:n="Invalid function arguments";break;case f.invalid_return_type:n="Invalid function return type";break;case f.invalid_date:n="Invalid date";break;case f.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:l.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case f.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case f.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case f.custom:n="Invalid input";break;case f.invalid_intersection_types:n="Intersection results could not be merged";break;case f.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case f.not_finite:n="Number must be finite";break;default:n=t.defaultError,l.assertNever(e)}return{message:n}};let v=g;function _(){return v}const w=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,s=[...n,...a.path||[]],i={...a,path:s};if(void 0!==a.message)return{...a,path:s,message:a.message};let o="";const d=r.filter(e=>!!e).slice().reverse();for(const c of d)o=c(i,{data:t,defaultError:o}).message;return{...a,path:s,message:o}};function b(e,t){const n=_(),r=w({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===g?void 0:g].filter(e=>!!e)});e.common.issues.push(r)}class k{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return x;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return k.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:a}=r;if("aborted"===t.status)return x;if("aborted"===a.status)return x;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!r.alwaysSet||(n[t.value]=a.value)}return{status:e.value,value:n}}}const x=Object.freeze({status:"aborted"}),S=e=>({status:"dirty",value:e}),T=e=>({status:"valid",value:e}),E=e=>"aborted"===e.status,O=e=>"dirty"===e.status,Z=e=>"valid"===e.status,N=e=>"undefined"!=typeof Promise&&e instanceof Promise;function j(e,t,n,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function P(e,t,n,r,a){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var A,C,I;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(A||(A={}));class R{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const F=(e,t)=>{if(Z(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new y(e.common.issues);return this._error=t,this._error}}};function $(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:a};return{errorMap:(t,a)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!==(s=null!=o?o:r)&&void 0!==s?s:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(i=null!=o?o:n)&&void 0!==i?i:a.defaultError}},description:a}}class M{get description(){return this._def.description}_getType(e){return m(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new k,ctx:{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(N(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},a=this._parseSync({data:e,path:r.path,parent:r});return F(r,a)}"~validate"(e){var t,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return Z(t)?{value:t.value}:{issues:r.common.issues}}catch(a){(null===(n=null===(t=null==a?void 0:a.message)||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(e=>Z(e)?{value:e.value}:{issues:r.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(N(r)?r:Promise.resolve(r));return F(n,a)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const a=e(t),s=()=>r.addIssue({code:f.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then(e=>!!e||(s(),!1)):!!a||(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new De({schema:this,typeName:Qe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ze.create(this,this._def)}nullable(){return Ue.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return be.create(this)}promise(){return Le.create(this,this._def)}or(e){return Se.create([this,e],this._def)}and(e){return Ze.create(this,e,this._def)}transform(e){return new De({...$(this._def),schema:this,typeName:Qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new qe({...$(this._def),innerType:this,defaultValue:t,typeName:Qe.ZodDefault})}brand(){return new We({typeName:Qe.ZodBranded,type:this,...$(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ve({...$(this._def),innerType:this,catchValue:t,typeName:Qe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ke.create(this,e)}readonly(){return Je.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const L=/^c[^\s-]{8,}$/i,D=/^[0-9a-z]+$/,z=/^[0-9A-HJKMNP-TV-Z]{26}$/i,U=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,q=/^[a-z0-9_-]{21}$/i,V=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,H=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,B=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let W;const K=/^(?:(?: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])$/,J=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Y=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,G=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,X=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Q=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ee="((\\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])))",te=new RegExp(`^${ee}$`);function ne(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function re(e){return new RegExp(`^${ne(e)}$`)}function ae(e){let t=`${ee}T${ne(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function se(e,t){return!("v4"!==t&&t||!K.test(e))||!("v6"!==t&&t||!Y.test(e))}function ie(e,t){if(!V.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return"object"==typeof a&&null!==a&&(!(!a.typ||!a.alg)&&(!t||a.alg===t))}catch(n){return!1}}function oe(e,t){return!("v4"!==t&&t||!J.test(e))||!("v6"!==t&&t||!G.test(e))}class de extends M{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==h.string){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.string,received:t.parsedType}),x}const t=new k;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const r=e.data.length>a.value,s=e.data.length<a.value;(r||s)&&(n=this._getOrReturnCtx(e,n),r?b(n,{code:f.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&b(n,{code:f.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)B.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"email",code:f.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)W||(W=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),W.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"emoji",code:f.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)U.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"uuid",code:f.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)q.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"nanoid",code:f.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)L.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid",code:f.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)D.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cuid2",code:f.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)z.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ulid",code:f.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),b(n,{validation:"url",code:f.invalid_string,message:a.message}),t.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"regex",code:f.invalid_string,message:a.message}),t.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty());else if("datetime"===a.kind){ae(a).test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:"datetime",message:a.message}),t.dirty())}else if("date"===a.kind){te.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:"date",message:a.message}),t.dirty())}else if("time"===a.kind){re(a).test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:f.invalid_string,validation:"time",message:a.message}),t.dirty())}else"duration"===a.kind?H.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"duration",code:f.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?se(e.data,a.version)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"ip",code:f.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?ie(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"jwt",code:f.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?oe(e.data,a.version)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"cidr",code:f.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?X.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"base64",code:f.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?Q.test(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{validation:"base64url",code:f.invalid_string,message:a.message}),t.dirty()):l.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:f.invalid_string,...A.errToObj(n)})}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...A.errToObj(e)})}url(e){return this._addCheck({kind:"url",...A.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...A.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...A.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...A.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...A.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...A.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...A.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...A.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...A.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...A.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...A.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...A.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...A.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...A.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...A.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...A.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...A.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...A.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...A.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...A.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...A.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...A.errToObj(t)})}nonempty(e){return this.min(1,A.errToObj(e))}trim(){return new de({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ce(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}de.create=e=>{var t;return new de({checks:[],typeName:Qe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$(e)})};class ue extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==h.number){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.number,received:t.parsedType}),x}let t;const n=new k;for(const r of this._def.checks)if("int"===r.kind)l.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:f.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==ce(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),b(t,{code:f.not_finite,message:r.message}),n.dirty()):l.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,n,r){return new ue({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:A.toString(r)}]})}_addCheck(e){return new ue({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:A.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:A.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&l.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ue.create=e=>new ue({checks:[],typeName:Qe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$(e)});class le extends M{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(r){return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let t;const n=new k;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),b(t,{code:f.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):l.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.bigint,received:t.parsedType}),x}gte(e,t){return this.setLimit("min",e,!0,A.toString(t))}gt(e,t){return this.setLimit("min",e,!1,A.toString(t))}lte(e,t){return this.setLimit("max",e,!0,A.toString(t))}lt(e,t){return this.setLimit("max",e,!1,A.toString(t))}setLimit(e,t,n,r){return new le({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:A.toString(r)}]})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:A.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}le.create=e=>{var t;return new le({checks:[],typeName:Qe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$(e)})};class pe extends M{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==h.boolean){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.boolean,received:t.parsedType}),x}return T(e.data)}}pe.create=e=>new pe({typeName:Qe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$(e)});class he extends M{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==h.date){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.date,received:t.parsedType}),x}if(isNaN(e.data.getTime())){return b(this._getOrReturnCtx(e),{code:f.invalid_date}),x}const t=new k;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),b(n,{code:f.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):l.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:A.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:A.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}he.create=e=>new he({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Qe.ZodDate,...$(e)});class me extends M{_parse(e){if(this._getType(e)!==h.symbol){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.symbol,received:t.parsedType}),x}return T(e.data)}}me.create=e=>new me({typeName:Qe.ZodSymbol,...$(e)});class fe extends M{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.undefined,received:t.parsedType}),x}return T(e.data)}}fe.create=e=>new fe({typeName:Qe.ZodUndefined,...$(e)});class ye extends M{_parse(e){if(this._getType(e)!==h.null){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.null,received:t.parsedType}),x}return T(e.data)}}ye.create=e=>new ye({typeName:Qe.ZodNull,...$(e)});class ge extends M{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}}ge.create=e=>new ge({typeName:Qe.ZodAny,...$(e)});class ve extends M{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}}ve.create=e=>new ve({typeName:Qe.ZodUnknown,...$(e)});class _e extends M{_parse(e){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.never,received:t.parsedType}),x}}_e.create=e=>new _e({typeName:Qe.ZodNever,...$(e)});class we extends M{_parse(e){if(this._getType(e)!==h.undefined){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.void,received:t.parsedType}),x}return T(e.data)}}we.create=e=>new we({typeName:Qe.ZodVoid,...$(e)});class be extends M{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==h.array)return b(t,{code:f.invalid_type,expected:h.array,received:t.parsedType}),x;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(e||a)&&(b(t,{code:e?f.too_big:f.too_small,minimum:a?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(b(t,{code:f.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(b(t,{code:f.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new R(t,e,t.path,n)))).then(e=>k.mergeArray(n,e));const a=[...t.data].map((e,n)=>r.type._parseSync(new R(t,e,t.path,n)));return k.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new be({...this._def,minLength:{value:e,message:A.toString(t)}})}max(e,t){return new be({...this._def,maxLength:{value:e,message:A.toString(t)}})}length(e,t){return new be({...this._def,exactLength:{value:e,message:A.toString(t)}})}nonempty(e){return this.min(1,e)}}function ke(e){if(e instanceof xe){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ze.create(ke(r))}return new xe({...e._def,shape:()=>t})}return e instanceof be?new be({...e._def,type:ke(e.element)}):e instanceof ze?ze.create(ke(e.unwrap())):e instanceof Ue?Ue.create(ke(e.unwrap())):e instanceof Ne?Ne.create(e.items.map(e=>ke(e))):e}be.create=(e,t)=>new be({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Qe.ZodArray,...$(t)});class xe extends M{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=l.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==h.object){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.object,received:t.parsedType}),x}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof _e&&"strip"===this._def.unknownKeys))for(const o in n.data)a.includes(o)||s.push(o);const i=[];for(const o of a){const e=r[o],t=n.data[o];i.push({key:{status:"valid",value:o},value:e._parse(new R(n,t,n.path,o)),alwaysSet:o in n.data})}if(this._def.catchall instanceof _e){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of s)i.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)s.length>0&&(b(n,{code:f.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new R(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>k.mergeObjectSync(t,e)):k.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return A.errToObj,new xe({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,a,s,i;const o=null!==(s=null===(a=(r=this._def).errorMap)||void 0===a?void 0:a.call(r,t,n).message)&&void 0!==s?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=A.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new xe({...this._def,unknownKeys:"strip"})}passthrough(){return new xe({...this._def,unknownKeys:"passthrough"})}extend(e){return new xe({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new xe({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Qe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new xe({...this._def,catchall:e})}pick(e){const t={};return l.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new xe({...this._def,shape:()=>t})}omit(e){const t={};return l.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new xe({...this._def,shape:()=>t})}deepPartial(){return ke(this)}partial(e){const t={};return l.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}),new xe({...this._def,shape:()=>t})}required(e){const t={};return l.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof ze;)e=e._def.innerType;t[n]=e}}),new xe({...this._def,shape:()=>t})}keyof(){return Fe(l.objectKeys(this.shape))}}xe.create=(e,t)=>new xe({shape:()=>e,unknownKeys:"strip",catchall:_e.create(),typeName:Qe.ZodObject,...$(t)}),xe.strictCreate=(e,t)=>new xe({shape:()=>e,unknownKeys:"strict",catchall:_e.create(),typeName:Qe.ZodObject,...$(t)}),xe.lazycreate=(e,t)=>new xe({shape:e,unknownKeys:"strip",catchall:_e.create(),typeName:Qe.ZodObject,...$(t)});class Se extends M{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map(e=>new y(e.ctx.common.issues));return b(t,{code:f.invalid_union,unionErrors:n}),x});{let e;const r=[];for(const s of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=s._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=r.map(e=>new y(e));return b(t,{code:f.invalid_union,unionErrors:a}),x}}get options(){return this._def.options}}Se.create=(e,t)=>new Se({options:e,typeName:Qe.ZodUnion,...$(t)});const Te=e=>e instanceof Ie?Te(e.schema):e instanceof De?Te(e.innerType()):e instanceof Re?[e.value]:e instanceof $e?e.options:e instanceof Me?l.objectValues(e.enum):e instanceof qe?Te(e._def.innerType):e instanceof fe?[void 0]:e instanceof ye?[null]:e instanceof ze?[void 0,...Te(e.unwrap())]:e instanceof Ue?[null,...Te(e.unwrap())]:e instanceof We||e instanceof Je?Te(e.unwrap()):e instanceof Ve?Te(e._def.innerType):[];class Ee extends M{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return b(t,{code:f.invalid_type,expected:h.object,received:t.parsedType}),x;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(b(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const a of t){const t=Te(a.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);r.set(n,a)}}return new Ee({typeName:Qe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...$(n)})}}function Oe(e,t){const n=m(e),r=m(t);if(e===t)return{valid:!0,data:e};if(n===h.object&&r===h.object){const n=l.objectKeys(t),r=l.objectKeys(e).filter(e=>-1!==n.indexOf(e)),a={...e,...t};for(const s of r){const n=Oe(e[s],t[s]);if(!n.valid)return{valid:!1};a[s]=n.data}return{valid:!0,data:a}}if(n===h.array&&r===h.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const a=Oe(e[r],t[r]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}return n===h.date&&r===h.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class Ze extends M{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(E(e)||E(r))return x;const a=Oe(e.value,r.value);return a.valid?((O(e)||O(r))&&t.dirty(),{status:t.value,value:a.data}):(b(n,{code:f.invalid_intersection_types}),x)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Ze.create=(e,t,n)=>new Ze({left:e,right:t,typeName:Qe.ZodIntersection,...$(n)});class Ne extends M{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.array)return b(n,{code:f.invalid_type,expected:h.array,received:n.parsedType}),x;if(n.data.length<this._def.items.length)return b(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&n.data.length>this._def.items.length&&(b(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new R(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>k.mergeArray(t,e)):k.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Ne({...this._def,rest:e})}}Ne.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ne({items:e,typeName:Qe.ZodTuple,rest:null,...$(t)})};class je extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.object)return b(n,{code:f.invalid_type,expected:h.object,received:n.parsedType}),x;const r=[],a=this._def.keyType,s=this._def.valueType;for(const i in n.data)r.push({key:a._parse(new R(n,i,n.path,i)),value:s._parse(new R(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?k.mergeObjectAsync(t,r):k.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new je(t instanceof M?{keyType:e,valueType:t,typeName:Qe.ZodRecord,...$(n)}:{keyType:de.create(),valueType:e,typeName:Qe.ZodRecord,...$(t)})}}class Pe extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.map)return b(n,{code:f.invalid_type,expected:h.map,received:n.parsedType}),x;const r=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:r._parse(new R(n,e,n.path,[s,"key"])),value:a._parse(new R(n,t,n.path,[s,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of s){const r=await n.key,a=await n.value;if("aborted"===r.status||"aborted"===a.status)return x;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of s){const r=n.key,a=n.value;if("aborted"===r.status||"aborted"===a.status)return x;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}}}Pe.create=(e,t,n)=>new Pe({valueType:t,keyType:e,typeName:Qe.ZodMap,...$(n)});class Ae extends M{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.set)return b(n,{code:f.invalid_type,expected:h.set,received:n.parsedType}),x;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(b(n,{code:f.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(b(n,{code:f.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return x;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const i=[...n.data.values()].map((e,t)=>a._parse(new R(n,e,n.path,t)));return n.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(e,t){return new Ae({...this._def,minSize:{value:e,message:A.toString(t)}})}max(e,t){return new Ae({...this._def,maxSize:{value:e,message:A.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ae.create=(e,t)=>new Ae({valueType:e,minSize:null,maxSize:null,typeName:Qe.ZodSet,...$(t)});class Ce extends M{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return b(t,{code:f.invalid_type,expected:h.function,received:t.parsedType}),x;function n(e,n){return w({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_(),g].filter(e=>!!e),issueData:{code:f.invalid_arguments,argumentsError:n}})}function r(e,n){return w({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_(),g].filter(e=>!!e),issueData:{code:f.invalid_return_type,returnTypeError:n}})}const a={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Le){const e=this;return T(async function(...t){const i=new y([]),o=await e._def.args.parseAsync(t,a).catch(e=>{throw i.addIssue(n(t,e)),i}),d=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(d,a).catch(e=>{throw i.addIssue(r(d,e)),i})})}{const e=this;return T(function(...t){const i=e._def.args.safeParse(t,a);if(!i.success)throw new y([n(t,i.error)]);const o=Reflect.apply(s,this,i.data),d=e._def.returns.safeParse(o,a);if(!d.success)throw new y([r(o,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ce({...this._def,args:Ne.create(e).rest(ve.create())})}returns(e){return new Ce({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Ce({args:e||Ne.create([]).rest(ve.create()),returns:t||ve.create(),typeName:Qe.ZodFunction,...$(n)})}}class Ie extends M{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ie.create=(e,t)=>new Ie({getter:e,typeName:Qe.ZodLazy,...$(t)});class Re extends M{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return b(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Fe(e,t){return new $e({values:e,typeName:Qe.ZodEnum,...$(t)})}Re.create=(e,t)=>new Re({value:e,typeName:Qe.ZodLiteral,...$(t)});class $e extends M{constructor(){super(...arguments),C.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{expected:l.joinValues(n),received:t.parsedType,code:f.invalid_type}),x}if(j(this,C)||P(this,C,new Set(this._def.values)),!j(this,C).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return b(t,{received:t.data,code:f.invalid_enum_value,options:n}),x}return T(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return $e.create(e,{...this._def,...t})}exclude(e,t=this._def){return $e.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}C=new WeakMap,$e.create=Fe;class Me extends M{constructor(){super(...arguments),I.set(this,void 0)}_parse(e){const t=l.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.string&&n.parsedType!==h.number){const e=l.objectValues(t);return b(n,{expected:l.joinValues(e),received:n.parsedType,code:f.invalid_type}),x}if(j(this,I)||P(this,I,new Set(l.getValidEnumValues(this._def.values))),!j(this,I).has(e.data)){const e=l.objectValues(t);return b(n,{received:n.data,code:f.invalid_enum_value,options:e}),x}return T(e.data)}get enum(){return this._def.values}}I=new WeakMap,Me.create=(e,t)=>new Me({values:e,typeName:Qe.ZodNativeEnum,...$(t)});class Le extends M{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&!1===t.common.async)return b(t,{code:f.invalid_type,expected:h.promise,received:t.parsedType}),x;const n=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return T(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Le.create=(e,t)=>new Le({type:e,typeName:Qe.ZodPromise,...$(t)});class De extends M{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:e=>{b(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===r.type){const e=r.transform(n.data,a);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return x;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?x:"dirty"===r.status||"dirty"===t.value?S(r.value):r});{if("aborted"===t.value)return x;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?x:"dirty"===r.status||"dirty"===t.value?S(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,a);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?x:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?x:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Z(e))return e;const s=r.transform(e.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Z(e)?Promise.resolve(r.transform(e.value,a)).then(e=>({status:t.value,value:e})):e)}l.assertNever(r)}}De.create=(e,t,n)=>new De({schema:e,typeName:Qe.ZodEffects,effect:t,...$(n)}),De.createWithPreprocess=(e,t,n)=>new De({schema:t,effect:{type:"preprocess",transform:e},typeName:Qe.ZodEffects,...$(n)});class ze extends M{_parse(e){return this._getType(e)===h.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ze.create=(e,t)=>new ze({innerType:e,typeName:Qe.ZodOptional,...$(t)});class Ue extends M{_parse(e){return this._getType(e)===h.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ue.create=(e,t)=>new Ue({innerType:e,typeName:Qe.ZodNullable,...$(t)});class qe extends M{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===h.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}qe.create=(e,t)=>new qe({innerType:e,typeName:Qe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$(t)});class Ve extends M{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return N(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new y(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new y(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ve.create=(e,t)=>new Ve({innerType:e,typeName:Qe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$(t)});class He extends M{_parse(e){if(this._getType(e)!==h.nan){const t=this._getOrReturnCtx(e);return b(t,{code:f.invalid_type,expected:h.nan,received:t.parsedType}),x}return{status:"valid",value:e.data}}}He.create=e=>new He({typeName:Qe.ZodNaN,...$(e)});const Be=Symbol("zod_brand");class We extends M{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ke extends M{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?x:"dirty"===e.status?(t.dirty(),S(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?x:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new Ke({in:e,out:t,typeName:Qe.ZodPipeline})}}class Je extends M{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Z(e)&&(e.value=Object.freeze(e.value)),e);return N(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}}function Ye(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Ge(e,t={},n){return e?ge.create().superRefine((r,a)=>{var s,i;const o=e(r);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=Ye(t,r),o=null===(i=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===i||i;a.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=Ye(t,r),o=null===(i=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===i||i;a.addIssue({code:"custom",...e,fatal:o})}}):ge.create()}Je.create=(e,t)=>new Je({innerType:e,typeName:Qe.ZodReadonly,...$(t)});const Xe={object:xe.lazycreate};var Qe;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Qe||(Qe={}));const et=de.create,tt=ue.create,nt=He.create,rt=le.create,at=pe.create,st=he.create,it=me.create,ot=fe.create,dt=ye.create,ct=ge.create,ut=ve.create,lt=_e.create,pt=we.create,ht=be.create,mt=xe.create,ft=xe.strictCreate,yt=Se.create,gt=Ee.create,vt=Ze.create,_t=Ne.create,wt=je.create,bt=Pe.create,kt=Ae.create,xt=Ce.create,St=Ie.create,Tt=Re.create,Et=$e.create,Ot=Me.create,Zt=Le.create,Nt=De.create,jt=ze.create,Pt=Ue.create,At=De.createWithPreprocess,Ct=Ke.create,It={string:e=>de.create({...e,coerce:!0}),number:e=>ue.create({...e,coerce:!0}),boolean:e=>pe.create({...e,coerce:!0}),bigint:e=>le.create({...e,coerce:!0}),date:e=>he.create({...e,coerce:!0})},Rt=x;var Ft=Object.freeze({__proto__:null,defaultErrorMap:g,setErrorMap:function(e){v=e},getErrorMap:_,makeIssue:w,EMPTY_PATH:[],addIssueToContext:b,ParseStatus:k,INVALID:x,DIRTY:S,OK:T,isAborted:E,isDirty:O,isValid:Z,isAsync:N,get util(){return l},get objectUtil(){return p},ZodParsedType:h,getParsedType:m,ZodType:M,datetimeRegex:ae,ZodString:de,ZodNumber:ue,ZodBigInt:le,ZodBoolean:pe,ZodDate:he,ZodSymbol:me,ZodUndefined:fe,ZodNull:ye,ZodAny:ge,ZodUnknown:ve,ZodNever:_e,ZodVoid:we,ZodArray:be,ZodObject:xe,ZodUnion:Se,ZodDiscriminatedUnion:Ee,ZodIntersection:Ze,ZodTuple:Ne,ZodRecord:je,ZodMap:Pe,ZodSet:Ae,ZodFunction:Ce,ZodLazy:Ie,ZodLiteral:Re,ZodEnum:$e,ZodNativeEnum:Me,ZodPromise:Le,ZodEffects:De,ZodTransformer:De,ZodOptional:ze,ZodNullable:Ue,ZodDefault:qe,ZodCatch:Ve,ZodNaN:He,BRAND:Be,ZodBranded:We,ZodPipeline:Ke,ZodReadonly:Je,custom:Ge,Schema:M,ZodSchema:M,late:Xe,get ZodFirstPartyTypeKind(){return Qe},coerce:It,any:ct,array:ht,bigint:rt,boolean:at,date:st,discriminatedUnion:gt,effect:Nt,enum:Et,function:xt,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Ge(t=>t instanceof e,t),intersection:vt,lazy:St,literal:Tt,map:bt,nan:nt,nativeEnum:Ot,never:lt,null:dt,nullable:Pt,number:tt,object:mt,oboolean:()=>at().optional(),onumber:()=>tt().optional(),optional:jt,ostring:()=>et().optional(),pipeline:Ct,preprocess:At,promise:Zt,record:wt,set:kt,strictObject:ft,string:et,symbol:it,transformer:Nt,tuple:_t,undefined:ot,union:yt,unknown:ut,void:pt,NEVER:Rt,ZodIssueCode:f,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:y});const $t=Ft.object({detail:Ft.string()}),Mt=Ft.object({error:Ft.string()});function Lt(e){if(!e)return"Unknown error";if(e instanceof Error){const t=$t.safeParse(e.cause);return t.success?t.data.detail:function(e){const t=function(e){try{return JSON.parse(e)}catch{return e}}(e);if(!t)return e;const n=$t.safeParse(t);if(n.success)return n.data.detail;const r=Mt.safeParse(t);if(r.success)return r.data.error;return e}(e.message)}if("object"==typeof e){const t=$t.safeParse(e);if(t.success)return t.data.detail;const n=Mt.safeParse(e);if(n.success)return n.data.error}try{return JSON.stringify(e)}catch{return String(e)}}function Dt(e,t){if(!e)throw new Error(t)}function zt(e){return e.FS}const Ut="notebook.py",qt="/marimo",Vt=Ut,Ht=e=>{const t=zt(e);try{t.mkdirTree(qt)}catch{}t.chdir(qt)},Bt=e=>{zt(e).mount(e.FS.filesystems.IDBFS,{root:"."},qt)},Wt=async e=>{await Yt(e,!0)},Kt=async e=>{await Yt(e,!1)},Jt=e=>{const{pyodide:t,filename:n,code:r}=e,a=zt(t);if(n&&n!==Ut){const e=(e=>{try{return u(a.readFile(e))}catch{return null}})(n);if(e)return{code:e,filename:n}}return a.writeFile(Ut,r),{code:r,filename:Ut}};function Yt(e,t){return new Promise((n,r)=>{zt(e).syncfs(t,e=>{e instanceof Error?r(e):n()})})}var Gt,Xt=Object.defineProperty,Qt=(e,t)=>Xt(e,"name",{value:t,configurable:!0}),en=(Gt=function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')},typeof require<"u"?require:typeof Proxy<"u"?new Proxy(Gt,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):Gt);function tn(e){return!isNaN(parseFloat(e))&&isFinite(e)}function nn(e){return e.charAt(0).toUpperCase()+e.substring(1)}function rn(e){return function(){return this[e]}}Qt(tn,"_isNumber"),Qt(nn,"_capitalize"),Qt(rn,"_getter");var an,sn,on=["isConstructor","isEval","isNative","isToplevel"],dn=["columnNumber","lineNumber"],cn=["fileName","functionName","source"],un=on.concat(dn,cn,["args"],["evalOrigin"]);function ln(e){if(e)for(var t=0;t<un.length;t++)void 0!==e[un[t]]&&this["set"+nn(un[t])](e[un[t]])}for(Qt(ln,"StackFrame"),ln.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof ln)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new ln(e)}},toString: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}},ln.fromString=Qt(function(e){var t=e.indexOf("("),n=e.lastIndexOf(")"),r=e.substring(0,t),a=e.substring(t+1,n).split(","),s=e.substring(n+1);if(0===s.indexOf("@"))var i=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(s,""),o=i[1],d=i[2],c=i[3];return new ln({functionName:r,args:a||void 0,fileName:o,lineNumber:d||void 0,columnNumber:c||void 0})},"StackFrame$$fromString"),an=0;an<on.length;an++)ln.prototype["get"+nn(on[an])]=rn(on[an]),ln.prototype["set"+nn(on[an])]=function(e){return function(t){this[e]=!!t}}(on[an]);for(sn=0;sn<dn.length;sn++)ln.prototype["get"+nn(dn[sn])]=rn(dn[sn]),ln.prototype["set"+nn(dn[sn])]=function(e){return function(t){if(!tn(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(dn[sn]);for(pn=0;pn<cn.length;pn++)ln.prototype["get"+nn(cn[pn])]=rn(cn[pn]),ln.prototype["set"+nn(cn[pn])]=function(e){return function(t){this[e]=String(t)}}(cn[pn]);var pn,hn=ln;function mn(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:Qt(function(t){if(t.stack&&t.stack.match(e))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:Qt(function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:Qt(function(t){return t.stack.split("\n").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),a=n&&t||void 0,s=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new hn({functionName:a,fileName:s,lineNumber:r[1],columnNumber:r[2],source:e})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:Qt(function(e){return e.stack.split("\n").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")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new hn({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,a=this.extractLocation(e.replace(t,""));return new hn({functionName:r,fileName:a[0],lineNumber:a[1],columnNumber:a[2],source:e})},this)},"ErrorStackParser$$parseFFOrSafari")}}Qt(mn,"ErrorStackParser");var fn,yn,gn,vn,_n,wn,bn,kn,xn,Sn=new mn,Tn="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&!process.browser,En=Tn&&typeof module<"u"&&typeof module.exports<"u"&&typeof en<"u"&&typeof __dirname<"u",On=Tn&&!En,Zn=typeof Deno<"u",Nn=!Tn&&!Zn,jn=Nn&&"object"==typeof window&&"object"==typeof document&&"function"==typeof document.createElement&&"sessionStorage"in window&&"function"!=typeof importScripts,Pn=Nn&&"function"==typeof importScripts&&"object"==typeof self;async function An(){if(!Tn||(fn=(await import("./__vite-browser-external-CIEyP2s7.js")).default,vn=await import("./__vite-browser-external-CIEyP2s7.js"),_n=await import("./__vite-browser-external-CIEyP2s7.js"),gn=(await import("./__vite-browser-external-CIEyP2s7.js")).default,yn=await import("./__vite-browser-external-CIEyP2s7.js"),bn=yn.sep,typeof en<"u"))return;let e={fs:vn,crypto:await import("./__vite-browser-external-CIEyP2s7.js"),ws:await import("./__vite-browser-external-CIEyP2s7.js"),child_process:await import("./__vite-browser-external-CIEyP2s7.js")};globalThis.require=function(t){return e[t]}}function Cn(e,t){return yn.resolve(t||".",e)}function In(e,t){return void 0===t&&(t=location),new URL(e,t).toString()}function Rn(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:_n.readFile(e).then(e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}}function Fn(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}async function $n(e,t){let{response:n,binary:r}=kn(e,t);if(r)return r;let a=await n;if(!a.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await a.arrayBuffer())}if("object"==typeof navigator&&"string"==typeof navigator.userAgent&&-1==navigator.userAgent.indexOf("Chrome")&&navigator.userAgent.indexOf("Safari"),Qt(An,"initNodeModules"),Qt(Cn,"node_resolvePath"),Qt(In,"browser_resolvePath"),wn=Tn?Cn:In,Tn||(bn="/"),Qt(Rn,"node_getBinaryResponse"),Qt(Fn,"browser_getBinaryResponse"),kn=Tn?Rn:Fn,Qt($n,"loadBinaryFile"),jn)xn=Qt(async e=>await import(e),"loadScript");else if(Pn)xn=Qt(async e=>{try{globalThis.importScripts(e)}catch(Xn){if(!(Xn instanceof TypeError))throw Xn;await import(e)}},"loadScript");else{if(!Tn)throw new Error("Cannot determine runtime environment");xn=Mn}async function Mn(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?gn.runInThisContext(await(await fetch(e)).text()):await import(fn.pathToFileURL(e).href)}async function Ln(e){if(Tn){await An();let t=await _n.readFile(e,{encoding:"utf8"});return JSON.parse(t)}return await(await fetch(e)).json()}async function Dn(){if(En)return __dirname;let e;try{throw new Error}catch(r){e=r}let t=Sn.parse(e)[0].fileName;if(Tn&&!t.startsWith("file://")&&(t=`file://${t}`),On){let e=await import("./__vite-browser-external-CIEyP2s7.js");return(await import("./__vite-browser-external-CIEyP2s7.js")).fileURLToPath(e.dirname(t))}let n=t.lastIndexOf(bn);if(-1===n)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,n)}function zn(e){let t=e.FS,n=e.FS.filesystems.MEMFS,r=e.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:function(e){if(!e.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return n.mount.apply(null,arguments)},syncfs:async(e,t,n)=>{try{let r=a.getLocalSet(e),s=await a.getRemoteSet(e),i=t?s:r,o=t?r:s;await a.reconcile(e,i,o),n(null)}catch(r){n(r)}},getLocalSet:e=>{let n=Object.create(null);function a(e){return"."!==e&&".."!==e}function s(e){return t=>r.join2(e,t)}Qt(a,"isRealDir"),Qt(s,"toAbsolute");let i=t.readdir(e.mountpoint).filter(a).map(s(e.mountpoint));for(;i.length;){let e=i.pop(),r=t.stat(e);t.isDir(r.mode)&&i.push.apply(i,t.readdir(e).filter(a).map(s(e))),n[e]={timestamp:r.mtime,mode:r.mode}}return{type:"local",entries:n}},getRemoteSet:async e=>{let t=Object.create(null),n=await Un(e.opts.fileSystemHandle);for(let[s,i]of n)"."!==s&&(t[r.join2(e.mountpoint,s)]={timestamp:"file"===i.kind?new Date((await i.getFile()).lastModified):new Date,mode:"file"===i.kind?a.FILE_MODE:a.DIR_MODE});return{type:"remote",entries:t,handles:n}},loadLocalEntry:e=>{let r=t.lookupPath(e).node,a=t.stat(e);if(t.isDir(a.mode))return{timestamp:a.mtime,mode:a.mode};if(t.isFile(a.mode))return r.contents=n.getFileDataAsTypedArray(r),{timestamp:a.mtime,mode:a.mode,contents:r.contents};throw new Error("node type not supported")},storeLocalEntry:(e,n)=>{if(t.isDir(n.mode))t.mkdirTree(e,n.mode);else{if(!t.isFile(n.mode))throw new Error("node type not supported");t.writeFile(e,n.contents,{canOwn:!0})}t.chmod(e,n.mode),t.utime(e,n.timestamp,n.timestamp)},removeLocalEntry:e=>{var n=t.stat(e);t.isDir(n.mode)?t.rmdir(e):t.isFile(n.mode)&&t.unlink(e)},loadRemoteEntry:async e=>{if("file"===e.kind){let t=await e.getFile();return{contents:new Uint8Array(await t.arrayBuffer()),mode:a.FILE_MODE,timestamp:new Date(t.lastModified)}}if("directory"===e.kind)return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+e.kind)},storeRemoteEntry:async(e,n,a)=>{let s=e.get(r.dirname(n)),i=t.isFile(a.mode)?await s.getFileHandle(r.basename(n),{create:!0}):await s.getDirectoryHandle(r.basename(n),{create:!0});if("file"===i.kind){let e=await i.createWritable();await e.write(a.contents),await e.close()}e.set(n,i)},removeRemoteEntry:async(e,t)=>{await e.get(r.dirname(t)).removeEntry(r.basename(t)),e.delete(t)},reconcile:async(e,n,s)=>{let i=0,o=[];Object.keys(n.entries).forEach(function(e){let r=n.entries[e],a=s.entries[e];(!a||t.isFile(r.mode)&&r.timestamp.getTime()>a.timestamp.getTime())&&(o.push(e),i++)}),o.sort();let d=[];if(Object.keys(s.entries).forEach(function(e){n.entries[e]||(d.push(e),i++)}),d.sort().reverse(),!i)return;let c="remote"===n.type?n.handles:s.handles;for(let t of o){let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);if("local"===s.type){let e=c.get(n),r=await a.loadRemoteEntry(e);a.storeLocalEntry(t,r)}else{let e=a.loadLocalEntry(t);await a.storeRemoteEntry(c,n,e)}}for(let t of d)if("local"===s.type)a.removeLocalEntry(t);else{let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);await a.removeRemoteEntry(c,n)}}};e.FS.filesystems.NATIVEFS_ASYNC=a}Qt(Mn,"nodeLoadScript"),Qt(Ln,"loadLockFile"),Qt(Dn,"calculateDirname"),Qt(zn,"initializeNativeFS");var Un=Qt(async e=>{let t=[];async function n(e){for await(let r of e.values())t.push(r),"directory"===r.kind&&await n(r)}Qt(n,"collect"),await n(e);let r=new Map;r.set(".",e);for(let a of t){let t=(await e.resolve(a)).join("/");r.set(t,a)}return r},"getFsHandles");function qn(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:Kn(e),quit(e,n){throw t.exited={status:e,toThrow:n},n},print:e.stdout,printErr:e.stderr,thisProgram:e._sysExecutable,arguments:e.args,API:{config:e},locateFile:t=>e.indexURL+t,instantiateWasm:Jn(e.indexURL)};return t}function Vn(e){return function(t){try{t.FS.mkdirTree(e)}catch(n){console.error(`Error occurred while making a home directory '${e}':`),console.error(n),console.error("Using '/' for a home directory instead"),e="/"}t.FS.chdir(e)}}function Hn(e){return function(t){Object.assign(t.ENV,e)}}function Bn(e){return e?[async t=>{t.addRunDependency("fsInitHook");try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}}]:[]}function Wn(e){let t=$n(e);return async e=>{let n=e._py_version_major(),r=e._py_version_minor();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 a=await t;e.FS.writeFile(`/lib/python${n}${r}.zip`,a)}catch(a){console.error("Error occurred while installing the standard library:"),console.error(a)}finally{e.removeRunDependency("install-stdlib")}}}function Kn(e){let t;return t=null!=e.stdLibURL?e.stdLibURL:e.indexURL+"python_stdlib.zip",[...Bn(e.fsInit),Wn(t),Vn(e.env.HOME),Hn(e.env),zn]}function Jn(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:n}=kn(e+"pyodide.asm.wasm");return function(e,r){return async function(){try{let a;a=n?await WebAssembly.instantiateStreaming(n,e):await WebAssembly.instantiate(await t,e);let{instance:s,module:i}=a;r(s,i)}catch(a){console.warn("wasm instantiation failed!"),console.warn(a)}}(),{}}}Qt(qn,"createSettings"),Qt(Vn,"createHomeDirectory"),Qt(Hn,"setEnvironment"),Qt(Bn,"callFsInitHook"),Qt(Wn,"installStdlib"),Qt(Kn,"getFileSystemInitializationFuncs"),Qt(Jn,"getInstantiateWasmFunc");var Yn="0.27.5";async function Gn(e={}){var t,n;await An();let r=e.indexURL||await Dn();r=wn(r),r.endsWith("/")||(r+="/"),e.indexURL=r;let a={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:r+"pyodide-lock.json",args:[],env:{},packageCacheDir:r,packages:[],enableRunUntilComplete:!1,checkAPIVersion:!0,BUILD_ID:"bd0388b62e760f8ba04185eb443fec955f25434f49c7b951efe5b1f792dbe5d4"},s=Object.assign(a,e);(t=s.env).HOME??(t.HOME="/home/pyodide"),(n=s.env).PYTHONINSPECT??(n.PYTHONINSPECT="1");let i,o=qn(s),d=o.API;if(d.lockFilePromise=Ln(s.lockFileURL),"function"!=typeof _createPyodideModule){let e=`${s.indexURL}pyodide.asm.js`;await xn(e)}if(e._loadSnapshot){let t=await e._loadSnapshot;i=ArrayBuffer.isView(t)?t:new Uint8Array(t),o.noInitialRun=!0,o.INITIAL_MEMORY=i.length}let c,u=await _createPyodideModule(o);if(o.exited)throw o.exited.toThrow;if(e.pyproxyToStringRepr&&d.setPyProxyToStringMethod(!0),d.version!==Yn&&s.checkAPIVersion)throw new Error(`Pyodide version does not match: '${Yn}' <==> '${d.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);u.locateFile=e=>{throw new Error("Didn't expect to load any more file_packager files!")},i&&(c=d.restoreSnapshot(i));let l=d.finalizeBootstrap(c,e._snapshotDeserializer);return d.sys.path.insert(0,d.config.env.HOME),l.version.includes("dev")||d.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${l.version}/full/`),d._pyodide.set_excepthook(),await d.packageIndexReady,d.initializeStreams(s.stdin,s.stdout,s.stderr),l}Qt(Gn,"loadPyodide");const Xn=new class{spans=[];startSpan(e,t={}){const 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={}){const r=this.startSpan(t||e.name,n);try{const t=e();return this.endSpan(r),t}catch(a){throw this.endSpan(r,"error"),a}}wrapAsync(e,t,n={}){return async(...r)=>{const a=this.startSpan(t||e.name,n);try{const t=await e(...r);return this.endSpan(a),t}catch(s){throw this.endSpan(a,"error"),s}}}logSpans(){}};globalThis.t=Xn;class Qn{pyodide=null;get requirePyodide(){return Dt(this.pyodide,"Pyodide not loaded"),this.pyodide}async bootstrap(e){return await this.loadPyodideAndPackages(e)}async loadPyodideAndPackages(e){if(!Gn)throw new Error("loadPyodide is not defined");const t=Xn.startSpan("loadPyodide");try{const n=await Gn({packages:["micropip","marimo-base","Markdown","pymdown-extensions","narwhals","packaging"],_makeSnapshot:false,lockFileURL:`https://wasm.marimo.app/pyodide-lock.json?v=${e.version}&pyodide=${e.pyodideVersion}`,indexURL:`https://cdn.jsdelivr.net/pyodide/${e.pyodideVersion}/full/`});return this.pyodide=n,t.end("ok"),n}catch(n){throw c.error("Failed to load Pyodide",n),n}}async mountFilesystem(e){const t=Xn.startSpan("mountFilesystem");return Ht(this.requirePyodide),Bt(this.requirePyodide),await Wt(this.requirePyodide),t.end("ok"),Jt({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){const{code:t,filename:n,onMessage:r,queryParameters:a,userConfig:s}=e;self.messenger={callback:r},self.query_params=a,self.user_config=s;const i=Xn.startSpan("startSession.runPython"),o=n||Vt,[d,c,u]=this.requirePyodide.runPython(`\n print("[py] Starting marimo...")\n import asyncio\n import js\n from marimo._pyodide.bootstrap import create_session, instantiate\n\n assert js.messenger, "messenger is not defined"\n assert js.query_params, "query_params is not defined"\n\n session, bridge = create_session(\n filename="${o}",\n query_params=js.query_params.to_py(),\n message_callback=js.messenger.callback,\n user_config=js.user_config.to_py(),\n )\n\n def init(auto_instantiate=True):\n instantiate(session, auto_instantiate)\n asyncio.create_task(session.start())\n\n # Find the packages to install\n with open("${o}", "r") as f:\n packages = session.find_packages(f.read())\n\n bridge, init, packages`);i.end();const l=new Set(u.toJs());return this.loadNotebookDeps(t,l).then(()=>c(s.runtime.auto_instantiate)),d}async loadNotebookDeps(e,t){const n=this.requirePyodide;e.includes("mo.sql")&&(e=`import sqlglot\n${e=`import duckdb\n${e=`import pandas\n${e}`}`}`).includes("polars")&&(e=`import pyarrow\n${e}`),e=`import pyodide_http\n${e=`import jedi\n${e=`import pygments\n${e=`import docutils\n${e}`}`}`}`;const r=[...t];let a=Xn.startSpan("pyodide.loadPackage");await n.loadPackagesFromImports(e,{errorCallback:c.error,messageCallback:c.log}),a.end(),a=Xn.startSpan("micropip.install");const s=r.filter(e=>!n.loadedPackages[e]);s.length>0&&await n.runPythonAsync(`\n import micropip\n import sys\n # Filter out builtins\n missing = [p for p in ${JSON.stringify(s)} if p not in sys.modules]\n if len(missing) > 0:\n print("Loading from micropip:", missing)\n await micropip.install(missing)\n `).catch(e=>{c.error("Failed to load packages from micropip",e)}),a.end()}}async function er(e){try{return await import(`/wasm/controller.js?version=${e}`)}catch{return new Qn}}const tr=Xn.startSpan("worker:init");const nr=new class{constructor(e){this.onMessage=e,this.buffer=[]}buffer;started=!1;push=e=>{this.started?this.onMessage(e):this.buffer.push(e)};start=()=>{this.started=!0,this.buffer.forEach(e=>this.onMessage(e)),this.buffer=[]}}(e=>{ir.send.kernelMessage({message:e})}),rr=new class{promise;resolve;reject;status="pending";constructor(){this.promise=new Promise((e,t)=>{this.reject=e=>{this.status="rejected",t(e)},this.resolve=t=>{this.status="resolved",e(t)}})}};let ar=!1;const sr={startSession:async e=>{if(await cr,ar)c.warn("Session already started");else{ar=!0;try{Dt(self.controller,"Controller not loaded"),await(self.controller.mountFilesystem?.({code:e.code,filename:e.filename}));const t=Xn.wrapAsync(self.controller.startSession.bind(self.controller)),n=function(e){let t,n=!1;return function(...r){return n||(n=!0,t=e.apply(this,r)),t}}(()=>{ir.send.initializingMessage({message:"Initializing notebook..."}),ir.send.initialized({})});ir.send.initializingMessage({message:"Loading notebook and dependencies..."});const r=await t({code:e.code,filename:e.filename,queryParameters:e.queryParameters,userConfig:e.userConfig,onMessage:e=>{n(),nr.push(e)}});rr.resolve(r),tr.end("ok")}catch(t){ir.send.initializedError({error:Lt(t)}),tr.end("error")}}},loadPackages:async e=>{const t=Xn.startSpan("loadPackages");await cr,e.includes("mo.sql")&&(e=`import sqlglot\n${e=`import duckdb\n${e=`import pandas\n${e}`}`}`).includes("polars")&&(e=`import pyarrow\n${e}`),await self.pyodide.loadPackagesFromImports(e,{messageCallback:c.log,errorCallback:c.error}),t.end()},readFile:async e=>{const t=Xn.startSpan("readFile");await cr;const n=u(self.pyodide.FS.readFile(e));return t.end(),n},setInterruptBuffer:async e=>{await cr,self.pyodide.setInterruptBuffer(e)},addPackage:async e=>{await cr;const{package:t}=e,n=t.split(" ").map(e=>e.trim()),r=await self.pyodide.runPythonAsync(`\n import micropip\n import json\n response = None\n try:\n await micropip.install(${JSON.stringify(n)})\n response = {"success": True}\n except Exception as e:\n response = {"success": False, "error": str(e)}\n json.dumps(response)\n `);return JSON.parse(r)},removePackage:async e=>{await cr;const{package:t}=e,n=await self.pyodide.runPythonAsync(`\n import micropip\n import json\n response = None\n try:\n micropip.uninstall("${t}")\n response = {"success": True}\n except Exception as e:\n response = {"success": False, "error": str(e)}\n json.dumps(response)\n `);return JSON.parse(n)},listPackages:async()=>{const e=Xn.startSpan("listPackages");await cr;const t=await self.pyodide.runPythonAsync('\n import json\n import micropip\n\n packages = micropip.list()\n packages = [\n {"name": p.name, "version": p.version}\n for p in packages.values()\n ]\n json.dumps(sorted(packages, key=lambda pkg: pkg["name"]))\n ');return e.end(),{packages:JSON.parse(t)}},saveNotebook:async e=>{await cr;const t=self.pyodide.runPython("\n from marimo._pyodide.bootstrap import save_file\n save_file\n ");await t(JSON.stringify(e),Vt)},bridge:async e=>{const t=Xn.startSpan("bridge",{functionName:e.functionName});await cr;const{functionName:n,payload:r}=e;"format"===n&&await self.pyodide.runPythonAsync('\n import micropip\n\n try:\n import black\n except ModuleNotFoundError:\n await micropip.install("black")\n '),"export_markdown"===n&&await self.pyodide.runPythonAsync('\n import micropip\n\n try:\n import yaml\n except ModuleNotFoundError:\n await micropip.install("pyyaml")\n ');const a=await rr.promise,s=null==r?null:"string"==typeof r?r:JSON.stringify(r),i=null==s?await a[n]():await a[n](s);return dr.has(n)&&Kt(self.pyodide),t.end(),"string"==typeof i?JSON.parse(i):i}},ir=function(e){return n(e)}({transport:(or={transportId:"marimo-transport"},a(self,or)),requestHandler:sr});var or;ir.send("ready",{}),ir.addMessageListener("consumerReady",async()=>{await cr,nr.start()});const dr=new Set(["save","save_app_config","rename_file","create_file_or_directory","delete_file_or_directory","move_file_or_directory","update_file"]);const cr=Xn.wrapAsync(async function(){try{const e=self.name,t=function(e){return e.includes("dev"),`v${Yn}`}(e),n=await Xn.wrapAsync(er)(e);self.controller=n,ir.send.initializingMessage({message:"Loading marimo..."}),self.pyodide=await Xn.wrapAsync(n.bootstrap.bind(n))({version:e,pyodideVersion:t})}catch(e){c.error("Error bootstrapping",e),ir.send.initializedError({error:Lt(e)})}})();
@@ -1 +0,0 @@
1
- const e=1e3;function t(e,t){const n=e.map(e=>`"${e}"`).join(", ");return new Error(`This RPC instance cannot ${t} because the transport did not provide one or more of these methods: ${n}`)}function n(n={}){let r={};function a(e){r=e}let s,i={};function o(e){i.unregisterHandler&&i.unregisterHandler(),i=e,i.registerHandler?.(w)}function d(e){s="function"!=typeof e?(t,n)=>{const r=e[t];if(r)return r(n);const a=e._;if(!a)throw new Error(`The requested method has no handler: ${t}`);return a(t,n)}:e}const{maxRequestTime:c=e}=n;n.transport&&o(n.transport),n.requestHandler&&d(n.requestHandler),n._debugHooks&&a(n._debugHooks);let u=0;const l=new Map,p=new Map;function h(e,...n){const a=n[0];return new Promise((n,s)=>{if(!i.send)throw t(["send"],"make requests");const o=u<=1e10?++u:u=0,d={type:"request",id:o,method:e,params:a};l.set(o,{resolve:n,reject:s}),c!==1/0&&p.set(o,setTimeout(()=>{p.delete(o),s(new Error("RPC request timed out."))},c)),r.onSend?.(d),i.send(d)})}const m=new Proxy(h,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>h(t,e)}),f=m;function y(e,...n){const a=n[0];if(!i.send)throw t(["send"],"send messages");const s={type:"message",id:e,payload:a};r.onSend?.(s),i.send(s)}const g=new Proxy(y,{get:(e,t,n)=>t in e?Reflect.get(e,t,n):e=>y(t,e)}),v=g,_=new Map,b=new Set;async function w(e){if(r.onReceive?.(e),!("type"in e))throw new Error("Message does not contain a type.");if("request"===e.type){if(!i.send||!s)throw t(["send","requestHandler"],"handle requests");const{id:a,method:o,params:d}=e;let c;try{c={type:"response",id:a,success:!0,payload:await s(o,d)}}catch(n){if(!(n instanceof Error))throw n;c={type:"response",id:a,success:!1,error:n.message}}return r.onSend?.(c),void i.send(c)}if("response"===e.type){const t=p.get(e.id);null!=t&&clearTimeout(t);const{resolve:n,reject:r}=l.get(e.id)??{};return void(e.success?n?.(e.payload):r?.(new Error(e.error)))}if("message"===e.type){for(const n of b)n(e.id,e.payload);const t=_.get(e.id);if(!t)return;for(const n of t)n(e.payload);return}throw new Error(`Unexpected RPC message type: ${e.type}`)}return{setTransport:o,setRequestHandler:d,request:m,requestProxy:f,send:g,sendProxy:v,addMessageListener:function(e,n){if(!i.registerHandler)throw t(["registerHandler"],"register message listeners");"*"!==e?(_.has(e)||_.set(e,new Set),_.get(e)?.add(n)):b.add(n)},removeMessageListener:function(e,t){"*"!==e?(_.get(e)?.delete(t),0===_.get(e)?.size&&_.delete(e)):b.delete(t)},proxy:{send:v,request:f},_setDebugHooks:a}}const r="[transport-id]";function a(e,t={}){const{transportId:n,filter:a,remotePort:s}=t,i=e,o=s??e;let d;return{send(e){o.postMessage(function(e,t){const{transportId:n}=t;return null!=n?{[r]:n,data:e}:e}(e,{transportId:n}))},registerHandler(e){d=t=>{const s=t.data,[i,o]=function(e,t){const{transportId:n,filter:a}=t,s=a?.();if(null!=n&&null!=s)throw new Error("Cannot use both `transportId` and `filter` at the same time");let i=e;if(n){if(e[r]!==n)return[!0];i=e.data}return!1===s?[!0]:[!1,i]}(s,{transportId:n,filter:()=>a?.(t)});i||e(o)},i.addEventListener("message",d)},unregisterHandler(){d&&i.removeEventListener("message",d)}}}var s,i=Object.defineProperty,o=(e,t)=>i(e,"name",{value:t,configurable:!0}),d=(s=function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')},typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):s);function c(e){return!isNaN(parseFloat(e))&&isFinite(e)}function u(e){return e.charAt(0).toUpperCase()+e.substring(1)}function l(e){return function(){return this[e]}}o(c,"_isNumber"),o(u,"_capitalize"),o(l,"_getter");var p,h,m=["isConstructor","isEval","isNative","isToplevel"],f=["columnNumber","lineNumber"],y=["fileName","functionName","source"],g=m.concat(f,y,["args"],["evalOrigin"]);function v(e){if(e)for(var t=0;t<g.length;t++)void 0!==e[g[t]]&&this["set"+u(g[t])](e[g[t]])}for(o(v,"StackFrame"),v.prototype={getArgs:function(){return this.args},setArgs:function(e){if("[object Array]"!==Object.prototype.toString.call(e))throw new TypeError("Args must be an Array");this.args=e},getEvalOrigin:function(){return this.evalOrigin},setEvalOrigin:function(e){if(e instanceof v)this.evalOrigin=e;else{if(!(e instanceof Object))throw new TypeError("Eval Origin must be an Object or StackFrame");this.evalOrigin=new v(e)}},toString: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}},v.fromString=o(function(e){var t=e.indexOf("("),n=e.lastIndexOf(")"),r=e.substring(0,t),a=e.substring(t+1,n).split(","),s=e.substring(n+1);if(0===s.indexOf("@"))var i=/@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(s,""),o=i[1],d=i[2],c=i[3];return new v({functionName:r,args:a||void 0,fileName:o,lineNumber:d||void 0,columnNumber:c||void 0})},"StackFrame$$fromString"),p=0;p<m.length;p++)v.prototype["get"+u(m[p])]=l(m[p]),v.prototype["set"+u(m[p])]=function(e){return function(t){this[e]=!!t}}(m[p]);for(h=0;h<f.length;h++)v.prototype["get"+u(f[h])]=l(f[h]),v.prototype["set"+u(f[h])]=function(e){return function(t){if(!c(t))throw new TypeError(e+" must be a Number");this[e]=Number(t)}}(f[h]);for(_=0;_<y.length;_++)v.prototype["get"+u(y[_])]=l(y[_]),v.prototype["set"+u(y[_])]=function(e){return function(t){this[e]=String(t)}}(y[_]);var _,b=v;function w(){var e=/^\s*at .*(\S+:\d+|\(native\))/m,t=/^(eval@)?(\[native code])?$/;return{parse:o(function(t){if(t.stack&&t.stack.match(e))return this.parseV8OrIE(t);if(t.stack)return this.parseFFOrSafari(t);throw new Error("Cannot parse given Error object")},"ErrorStackParser$$parse"),extractLocation:o(function(e){if(-1===e.indexOf(":"))return[e];var t=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));return[t[1],t[2]||void 0,t[3]||void 0]},"ErrorStackParser$$extractLocation"),parseV8OrIE:o(function(t){return t.stack.split("\n").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),a=n&&t||void 0,s=["eval","<anonymous>"].indexOf(r[0])>-1?void 0:r[0];return new b({functionName:a,fileName:s,lineNumber:r[1],columnNumber:r[2],source:e})},this)},"ErrorStackParser$$parseV8OrIE"),parseFFOrSafari:o(function(e){return e.stack.split("\n").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")),-1===e.indexOf("@")&&-1===e.indexOf(":"))return new b({functionName:e});var t=/((.*".+"[^@]*)?[^@]*)(?:@)/,n=e.match(t),r=n&&n[1]?n[1]:void 0,a=this.extractLocation(e.replace(t,""));return new b({functionName:r,fileName:a[0],lineNumber:a[1],columnNumber:a[2],source:e})},this)},"ErrorStackParser$$parseFFOrSafari")}}o(w,"ErrorStackParser");var k,x,S,T,E,O,Z,j,N,P=new w,A="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&!process.browser,C=A&&typeof module<"u"&&typeof module.exports<"u"&&typeof d<"u"&&typeof __dirname<"u",I=A&&!C,R=typeof Deno<"u",$=!A&&!R,F=$&&"object"==typeof window&&"object"==typeof document&&"function"==typeof document.createElement&&"sessionStorage"in window&&"function"!=typeof importScripts,M=$&&"function"==typeof importScripts&&"object"==typeof self;async function L(){if(!A||(k=(await import("./__vite-browser-external-CIEyP2s7.js")).default,T=await import("./__vite-browser-external-CIEyP2s7.js"),E=await import("./__vite-browser-external-CIEyP2s7.js"),S=(await import("./__vite-browser-external-CIEyP2s7.js")).default,x=await import("./__vite-browser-external-CIEyP2s7.js"),Z=x.sep,typeof d<"u"))return;let e={fs:T,crypto:await import("./__vite-browser-external-CIEyP2s7.js"),ws:await import("./__vite-browser-external-CIEyP2s7.js"),child_process:await import("./__vite-browser-external-CIEyP2s7.js")};globalThis.require=function(t){return e[t]}}function D(e,t){return x.resolve(t||".",e)}function z(e,t){return void 0===t&&(t=location),new URL(e,t).toString()}function q(e,t){return e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?{response:fetch(e)}:{binary:E.readFile(e).then(e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}}function U(e,t){let n=new URL(e,location);return{response:fetch(n,t?{integrity:t}:{})}}async function V(e,t){let{response:n,binary:r}=j(e,t);if(r)return r;let a=await n;if(!a.ok)throw new Error(`Failed to load '${e}': request failed.`);return new Uint8Array(await a.arrayBuffer())}if("object"==typeof navigator&&"string"==typeof navigator.userAgent&&-1==navigator.userAgent.indexOf("Chrome")&&navigator.userAgent.indexOf("Safari"),o(L,"initNodeModules"),o(D,"node_resolvePath"),o(z,"browser_resolvePath"),O=A?D:z,A||(Z="/"),o(q,"node_getBinaryResponse"),o(U,"browser_getBinaryResponse"),j=A?q:U,o(V,"loadBinaryFile"),F)N=o(async e=>await import(e),"loadScript");else if(M)N=o(async e=>{try{globalThis.importScripts(e)}catch(nr){if(!(nr instanceof TypeError))throw nr;await import(e)}},"loadScript");else{if(!A)throw new Error("Cannot determine runtime environment");N=H}async function H(e){e.startsWith("file://")&&(e=e.slice(7)),e.includes("://")?S.runInThisContext(await(await fetch(e)).text()):await import(k.pathToFileURL(e).href)}async function B(e){if(A){await L();let t=await E.readFile(e,{encoding:"utf8"});return JSON.parse(t)}return await(await fetch(e)).json()}async function W(){if(C)return __dirname;let e;try{throw new Error}catch(r){e=r}let t=P.parse(e)[0].fileName;if(A&&!t.startsWith("file://")&&(t=`file://${t}`),I){let e=await import("./__vite-browser-external-CIEyP2s7.js");return(await import("./__vite-browser-external-CIEyP2s7.js")).fileURLToPath(e.dirname(t))}let n=t.lastIndexOf(Z);if(-1===n)throw new Error("Could not extract indexURL path from pyodide module location");return t.slice(0,n)}function K(e){let t=e.FS,n=e.FS.filesystems.MEMFS,r=e.PATH,a={DIR_MODE:16895,FILE_MODE:33279,mount:function(e){if(!e.opts.fileSystemHandle)throw new Error("opts.fileSystemHandle is required");return n.mount.apply(null,arguments)},syncfs:async(e,t,n)=>{try{let r=a.getLocalSet(e),s=await a.getRemoteSet(e),i=t?s:r,o=t?r:s;await a.reconcile(e,i,o),n(null)}catch(r){n(r)}},getLocalSet:e=>{let n=Object.create(null);function a(e){return"."!==e&&".."!==e}function s(e){return t=>r.join2(e,t)}o(a,"isRealDir"),o(s,"toAbsolute");let i=t.readdir(e.mountpoint).filter(a).map(s(e.mountpoint));for(;i.length;){let e=i.pop(),r=t.stat(e);t.isDir(r.mode)&&i.push.apply(i,t.readdir(e).filter(a).map(s(e))),n[e]={timestamp:r.mtime,mode:r.mode}}return{type:"local",entries:n}},getRemoteSet:async e=>{let t=Object.create(null),n=await J(e.opts.fileSystemHandle);for(let[s,i]of n)"."!==s&&(t[r.join2(e.mountpoint,s)]={timestamp:"file"===i.kind?new Date((await i.getFile()).lastModified):new Date,mode:"file"===i.kind?a.FILE_MODE:a.DIR_MODE});return{type:"remote",entries:t,handles:n}},loadLocalEntry:e=>{let r=t.lookupPath(e).node,a=t.stat(e);if(t.isDir(a.mode))return{timestamp:a.mtime,mode:a.mode};if(t.isFile(a.mode))return r.contents=n.getFileDataAsTypedArray(r),{timestamp:a.mtime,mode:a.mode,contents:r.contents};throw new Error("node type not supported")},storeLocalEntry:(e,n)=>{if(t.isDir(n.mode))t.mkdirTree(e,n.mode);else{if(!t.isFile(n.mode))throw new Error("node type not supported");t.writeFile(e,n.contents,{canOwn:!0})}t.chmod(e,n.mode),t.utime(e,n.timestamp,n.timestamp)},removeLocalEntry:e=>{var n=t.stat(e);t.isDir(n.mode)?t.rmdir(e):t.isFile(n.mode)&&t.unlink(e)},loadRemoteEntry:async e=>{if("file"===e.kind){let t=await e.getFile();return{contents:new Uint8Array(await t.arrayBuffer()),mode:a.FILE_MODE,timestamp:new Date(t.lastModified)}}if("directory"===e.kind)return{mode:a.DIR_MODE,timestamp:new Date};throw new Error("unknown kind: "+e.kind)},storeRemoteEntry:async(e,n,a)=>{let s=e.get(r.dirname(n)),i=t.isFile(a.mode)?await s.getFileHandle(r.basename(n),{create:!0}):await s.getDirectoryHandle(r.basename(n),{create:!0});if("file"===i.kind){let e=await i.createWritable();await e.write(a.contents),await e.close()}e.set(n,i)},removeRemoteEntry:async(e,t)=>{await e.get(r.dirname(t)).removeEntry(r.basename(t)),e.delete(t)},reconcile:async(e,n,s)=>{let i=0,o=[];Object.keys(n.entries).forEach(function(e){let r=n.entries[e],a=s.entries[e];(!a||t.isFile(r.mode)&&r.timestamp.getTime()>a.timestamp.getTime())&&(o.push(e),i++)}),o.sort();let d=[];if(Object.keys(s.entries).forEach(function(e){n.entries[e]||(d.push(e),i++)}),d.sort().reverse(),!i)return;let c="remote"===n.type?n.handles:s.handles;for(let t of o){let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);if("local"===s.type){let e=c.get(n),r=await a.loadRemoteEntry(e);a.storeLocalEntry(t,r)}else{let e=a.loadLocalEntry(t);await a.storeRemoteEntry(c,n,e)}}for(let t of d)if("local"===s.type)a.removeLocalEntry(t);else{let n=r.normalize(t.replace(e.mountpoint,"/")).substring(1);await a.removeRemoteEntry(c,n)}}};e.FS.filesystems.NATIVEFS_ASYNC=a}o(H,"nodeLoadScript"),o(B,"loadLockFile"),o(W,"calculateDirname"),o(K,"initializeNativeFS");var J=o(async e=>{let t=[];async function n(e){for await(let r of e.values())t.push(r),"directory"===r.kind&&await n(r)}o(n,"collect"),await n(e);let r=new Map;r.set(".",e);for(let a of t){let t=(await e.resolve(a)).join("/");r.set(t,a)}return r},"getFsHandles");function Y(e){let t={noImageDecoding:!0,noAudioDecoding:!0,noWasmDecoding:!1,preRun:te(e),quit(e,n){throw t.exited={status:e,toThrow:n},n},print:e.stdout,printErr:e.stderr,thisProgram:e._sysExecutable,arguments:e.args,API:{config:e},locateFile:t=>e.indexURL+t,instantiateWasm:ne(e.indexURL)};return t}function G(e){return function(t){try{t.FS.mkdirTree(e)}catch(n){console.error(`Error occurred while making a home directory '${e}':`),console.error(n),console.error("Using '/' for a home directory instead"),e="/"}t.FS.chdir(e)}}function X(e){return function(t){Object.assign(t.ENV,e)}}function Q(e){return e?[async t=>{t.addRunDependency("fsInitHook");try{await e(t.FS,{sitePackages:t.API.sitePackages})}finally{t.removeRunDependency("fsInitHook")}}]:[]}function ee(e){let t=V(e);return async e=>{let n=e._py_version_major(),r=e._py_version_minor();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 a=await t;e.FS.writeFile(`/lib/python${n}${r}.zip`,a)}catch(a){console.error("Error occurred while installing the standard library:"),console.error(a)}finally{e.removeRunDependency("install-stdlib")}}}function te(e){let t;return t=null!=e.stdLibURL?e.stdLibURL:e.indexURL+"python_stdlib.zip",[...Q(e.fsInit),ee(t),G(e.env.HOME),X(e.env),K]}function ne(e){if(typeof WasmOffsetConverter<"u")return;let{binary:t,response:n}=j(e+"pyodide.asm.wasm");return function(e,r){return async function(){try{let a;a=n?await WebAssembly.instantiateStreaming(n,e):await WebAssembly.instantiate(await t,e);let{instance:s,module:i}=a;r(s,i)}catch(a){console.warn("wasm instantiation failed!"),console.warn(a)}}(),{}}}o(Y,"createSettings"),o(G,"createHomeDirectory"),o(X,"setEnvironment"),o(Q,"callFsInitHook"),o(ee,"installStdlib"),o(te,"getFileSystemInitializationFuncs"),o(ne,"getInstantiateWasmFunc");var re="0.27.5";async function ae(e={}){var t,n;await L();let r=e.indexURL||await W();r=O(r),r.endsWith("/")||(r+="/"),e.indexURL=r;let a={fullStdLib:!1,jsglobals:globalThis,stdin:globalThis.prompt?globalThis.prompt:void 0,lockFileURL:r+"pyodide-lock.json",args:[],env:{},packageCacheDir:r,packages:[],enableRunUntilComplete:!1,checkAPIVersion:!0,BUILD_ID:"bd0388b62e760f8ba04185eb443fec955f25434f49c7b951efe5b1f792dbe5d4"},s=Object.assign(a,e);(t=s.env).HOME??(t.HOME="/home/pyodide"),(n=s.env).PYTHONINSPECT??(n.PYTHONINSPECT="1");let i,o=Y(s),d=o.API;if(d.lockFilePromise=B(s.lockFileURL),"function"!=typeof _createPyodideModule){let e=`${s.indexURL}pyodide.asm.js`;await N(e)}if(e._loadSnapshot){let t=await e._loadSnapshot;i=ArrayBuffer.isView(t)?t:new Uint8Array(t),o.noInitialRun=!0,o.INITIAL_MEMORY=i.length}let c,u=await _createPyodideModule(o);if(o.exited)throw o.exited.toThrow;if(e.pyproxyToStringRepr&&d.setPyProxyToStringMethod(!0),d.version!==re&&s.checkAPIVersion)throw new Error(`Pyodide version does not match: '${re}' <==> '${d.version}'. If you updated the Pyodide version, make sure you also updated the 'indexURL' parameter passed to loadPyodide.`);u.locateFile=e=>{throw new Error("Didn't expect to load any more file_packager files!")},i&&(c=d.restoreSnapshot(i));let l=d.finalizeBootstrap(c,e._snapshotDeserializer);return d.sys.path.insert(0,d.config.env.HOME),l.version.includes("dev")||d.setCdnUrl(`https://cdn.jsdelivr.net/pyodide/v${l.version}/full/`),d._pyodide.set_excepthook(),await d.packageIndexReady,d.initializeStreams(s.stdin,s.stdout,s.stderr),l}o(ae,"loadPyodide");const se=()=>{},ie=(e,t)=>{const n=`[${e}]`;return{debug:(...e)=>t.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=>ie(`${e}.${n}`,t),disabled:(e=!0)=>e?de:t}},oe={debug:(...e)=>{},log:(...e)=>{console.log(...e)},warn:(...e)=>{console.warn(...e)},error:(...e)=>{console.error(...e)},trace:(...e)=>{console.trace(...e)},get:e=>ie(e,oe),disabled:(e=!0)=>e?de:oe},de={debug:()=>se,log:()=>se,warn:()=>se,error:()=>se,trace:()=>se,get:()=>de,disabled:()=>de};const ce="undefined"!=typeof window&&window.Logger||oe;var ue,le;!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},e.getValidEnumValues=t=>{const n=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),r={};for(const e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(const n of e)if(t(n))return n},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(ue||(ue={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(le||(le={}));const pe=ue.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),he=e=>{switch(typeof e){case"undefined":return pe.undefined;case"string":return pe.string;case"number":return isNaN(e)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.isArray(e)?pe.array:null===e?pe.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?pe.promise:"undefined"!=typeof Map&&e instanceof Map?pe.map:"undefined"!=typeof Set&&e instanceof Set?pe.set:"undefined"!=typeof Date&&e instanceof Date?pe.date:pe.object;default:return pe.unknown}},me=ue.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class fe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(r);else if("invalid_return_type"===a.code)r(a.returnTypeError);else if("invalid_arguments"===a.code)r(a.argumentsError);else if(0===a.path.length)n._errors.push(t(a));else{let e=n,r=0;for(;r<a.path.length;){const n=a.path[r];r===a.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(a))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof fe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ue.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}fe.create=e=>new fe(e);const ye=(e,t)=>{let n;switch(e.code){case me.invalid_type:n=e.received===pe.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case me.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ue.jsonStringifyReplacer)}`;break;case me.unrecognized_keys:n=`Unrecognized key(s) in object: ${ue.joinValues(e.keys,", ")}`;break;case me.invalid_union:n="Invalid input";break;case me.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ue.joinValues(e.options)}`;break;case me.invalid_enum_value:n=`Invalid enum value. Expected ${ue.joinValues(e.options)}, received '${e.received}'`;break;case me.invalid_arguments:n="Invalid function arguments";break;case me.invalid_return_type:n="Invalid function return type";break;case me.invalid_date:n="Invalid date";break;case me.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:ue.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case me.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case me.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case me.custom:n="Invalid input";break;case me.invalid_intersection_types:n="Intersection results could not be merged";break;case me.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case me.not_finite:n="Number must be finite";break;default:n=t.defaultError,ue.assertNever(e)}return{message:n}};let ge=ye;function ve(){return ge}const _e=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,s=[...n,...a.path||[]],i={...a,path:s};if(void 0!==a.message)return{...a,path:s,message:a.message};let o="";const d=r.filter(e=>!!e).slice().reverse();for(const c of d)o=c(i,{data:t,defaultError:o}).message;return{...a,path:s,message:o}};function be(e,t){const n=ve(),r=_e({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ye?void 0:ye].filter(e=>!!e)});e.common.issues.push(r)}class we{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return ke;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return we.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:a}=r;if("aborted"===t.status)return ke;if("aborted"===a.status)return ke;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!r.alwaysSet||(n[t.value]=a.value)}return{status:e.value,value:n}}}const ke=Object.freeze({status:"aborted"}),xe=e=>({status:"dirty",value:e}),Se=e=>({status:"valid",value:e}),Te=e=>"aborted"===e.status,Ee=e=>"dirty"===e.status,Oe=e=>"valid"===e.status,Ze=e=>"undefined"!=typeof Promise&&e instanceof Promise;function je(e,t,n,r){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function Ne(e,t,n,r,a){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Pe,Ae,Ce;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(Pe||(Pe={}));class Ie{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Re=(e,t)=>{if(Oe(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new fe(e.common.issues);return this._error=t,this._error}}};function $e(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:a};return{errorMap:(t,a)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!==(s=null!=o?o:r)&&void 0!==s?s:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(i=null!=o?o:n)&&void 0!==i?i:a.defaultError}},description:a}}class Fe{get description(){return this._def.description}_getType(e){return he(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new we,ctx:{common:e.parent.common,data:e.data,parsedType:he(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ze(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const r={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Re(r,a)}"~validate"(e){var t,n;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return Oe(t)?{value:t.value}:{issues:r.common.issues}}catch(a){(null===(n=null===(t=null==a?void 0:a.message)||void 0===t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(e=>Oe(e)?{value:e.value}:{issues:r.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:he(e)},r=this._parse({data:e,path:n.path,parent:n}),a=await(Ze(r)?r:Promise.resolve(r));return Re(n,a)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const a=e(t),s=()=>r.addIssue({code:me.custom,...n(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then(e=>!!e||(s(),!1)):!!a||(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new Lt({schema:this,typeName:Xt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Dt.create(this,this._def)}nullable(){return zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return bt.create(this)}promise(){return Mt.create(this,this._def)}or(e){return xt.create([this,e],this._def)}and(e){return Ot.create(this,e,this._def)}transform(e){return new Lt({...$e(this._def),schema:this,typeName:Xt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new qt({...$e(this._def),innerType:this,defaultValue:t,typeName:Xt.ZodDefault})}brand(){return new Bt({typeName:Xt.ZodBranded,type:this,...$e(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ut({...$e(this._def),innerType:this,catchValue:t,typeName:Xt.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Wt.create(this,e)}readonly(){return Kt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Me=/^c[^\s-]{8,}$/i,Le=/^[0-9a-z]+$/,De=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ze=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qe=/^[a-z0-9_-]{21}$/i,Ue=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ve=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,He=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Be;const We=/^(?:(?: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])$/,Ke=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Je=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ye=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ge=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xe=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qe="((\\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])))",et=new RegExp(`^${Qe}$`);function tt(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function nt(e){return new RegExp(`^${tt(e)}$`)}function rt(e){let t=`${Qe}T${tt(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function at(e,t){return!("v4"!==t&&t||!We.test(e))||!("v6"!==t&&t||!Je.test(e))}function st(e,t){if(!Ue.test(e))return!1;try{const[n]=e.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return"object"==typeof a&&null!==a&&(!(!a.typ||!a.alg)&&(!t||a.alg===t))}catch(n){return!1}}function it(e,t){return!("v4"!==t&&t||!Ke.test(e))||!("v6"!==t&&t||!Ye.test(e))}class ot extends Fe{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==pe.string){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.string,received:t.parsedType}),ke}const t=new we;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),be(n,{code:me.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),be(n,{code:me.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const r=e.data.length>a.value,s=e.data.length<a.value;(r||s)&&(n=this._getOrReturnCtx(e,n),r?be(n,{code:me.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&be(n,{code:me.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)He.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"email",code:me.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Be||(Be=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Be.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"emoji",code:me.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)ze.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"uuid",code:me.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)qe.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"nanoid",code:me.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)Me.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"cuid",code:me.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)Le.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"cuid2",code:me.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)De.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"ulid",code:me.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),be(n,{validation:"url",code:me.invalid_string,message:a.message}),t.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"regex",code:me.invalid_string,message:a.message}),t.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),be(n,{code:me.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),be(n,{code:me.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),be(n,{code:me.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty());else if("datetime"===a.kind){rt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{code:me.invalid_string,validation:"datetime",message:a.message}),t.dirty())}else if("date"===a.kind){et.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{code:me.invalid_string,validation:"date",message:a.message}),t.dirty())}else if("time"===a.kind){nt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{code:me.invalid_string,validation:"time",message:a.message}),t.dirty())}else"duration"===a.kind?Ve.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"duration",code:me.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?at(e.data,a.version)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"ip",code:me.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?st(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"jwt",code:me.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?it(e.data,a.version)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"cidr",code:me.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?Ge.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"base64",code:me.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?Xe.test(e.data)||(n=this._getOrReturnCtx(e,n),be(n,{validation:"base64url",code:me.invalid_string,message:a.message}),t.dirty()):ue.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:me.invalid_string,...Pe.errToObj(n)})}_addCheck(e){return new ot({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Pe.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Pe.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Pe.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Pe.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Pe.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Pe.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Pe.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Pe.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Pe.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Pe.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Pe.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Pe.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Pe.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...Pe.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Pe.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Pe.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Pe.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Pe.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Pe.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Pe.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Pe.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Pe.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Pe.errToObj(t)})}nonempty(e){return this.min(1,Pe.errToObj(e))}trim(){return new ot({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ot({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ot({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function dt(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}ot.create=e=>{var t;return new ot({checks:[],typeName:Xt.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$e(e)})};class ct extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==pe.number){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.number,received:t.parsedType}),ke}let t;const n=new we;for(const r of this._def.checks)if("int"===r.kind)ue.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),be(t,{code:me.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),be(t,{code:me.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),be(t,{code:me.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==dt(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),be(t,{code:me.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),be(t,{code:me.not_finite,message:r.message}),n.dirty()):ue.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Pe.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Pe.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Pe.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Pe.toString(t))}setLimit(e,t,n,r){return new ct({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Pe.toString(r)}]})}_addCheck(e){return new ct({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Pe.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Pe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Pe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Pe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Pe.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Pe.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Pe.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Pe.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Pe.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&ue.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ct.create=e=>new ct({checks:[],typeName:Xt.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$e(e)});class ut extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(r){return this._getInvalidInput(e)}if(this._getType(e)!==pe.bigint)return this._getInvalidInput(e);let t;const n=new we;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),be(t,{code:me.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),be(t,{code:me.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),be(t,{code:me.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):ue.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.bigint,received:t.parsedType}),ke}gte(e,t){return this.setLimit("min",e,!0,Pe.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Pe.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Pe.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Pe.toString(t))}setLimit(e,t,n,r){return new ut({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:Pe.toString(r)}]})}_addCheck(e){return new ut({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Pe.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Pe.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Pe.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Pe.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Pe.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ut.create=e=>{var t;return new ut({checks:[],typeName:Xt.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$e(e)})};class lt extends Fe{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==pe.boolean){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.boolean,received:t.parsedType}),ke}return Se(e.data)}}lt.create=e=>new lt({typeName:Xt.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$e(e)});class pt extends Fe{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==pe.date){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.date,received:t.parsedType}),ke}if(isNaN(e.data.getTime())){return be(this._getOrReturnCtx(e),{code:me.invalid_date}),ke}const t=new we;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),be(n,{code:me.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),be(n,{code:me.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):ue.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Pe.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Pe.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}pt.create=e=>new pt({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Xt.ZodDate,...$e(e)});class ht extends Fe{_parse(e){if(this._getType(e)!==pe.symbol){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.symbol,received:t.parsedType}),ke}return Se(e.data)}}ht.create=e=>new ht({typeName:Xt.ZodSymbol,...$e(e)});class mt extends Fe{_parse(e){if(this._getType(e)!==pe.undefined){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.undefined,received:t.parsedType}),ke}return Se(e.data)}}mt.create=e=>new mt({typeName:Xt.ZodUndefined,...$e(e)});class ft extends Fe{_parse(e){if(this._getType(e)!==pe.null){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.null,received:t.parsedType}),ke}return Se(e.data)}}ft.create=e=>new ft({typeName:Xt.ZodNull,...$e(e)});class yt extends Fe{constructor(){super(...arguments),this._any=!0}_parse(e){return Se(e.data)}}yt.create=e=>new yt({typeName:Xt.ZodAny,...$e(e)});class gt extends Fe{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Se(e.data)}}gt.create=e=>new gt({typeName:Xt.ZodUnknown,...$e(e)});class vt extends Fe{_parse(e){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.never,received:t.parsedType}),ke}}vt.create=e=>new vt({typeName:Xt.ZodNever,...$e(e)});class _t extends Fe{_parse(e){if(this._getType(e)!==pe.undefined){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.void,received:t.parsedType}),ke}return Se(e.data)}}_t.create=e=>new _t({typeName:Xt.ZodVoid,...$e(e)});class bt extends Fe{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==pe.array)return be(t,{code:me.invalid_type,expected:pe.array,received:t.parsedType}),ke;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(e||a)&&(be(t,{code:e?me.too_big:me.too_small,minimum:a?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(be(t,{code:me.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(be(t,{code:me.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Ie(t,e,t.path,n)))).then(e=>we.mergeArray(n,e));const a=[...t.data].map((e,n)=>r.type._parseSync(new Ie(t,e,t.path,n)));return we.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new bt({...this._def,minLength:{value:e,message:Pe.toString(t)}})}max(e,t){return new bt({...this._def,maxLength:{value:e,message:Pe.toString(t)}})}length(e,t){return new bt({...this._def,exactLength:{value:e,message:Pe.toString(t)}})}nonempty(e){return this.min(1,e)}}function wt(e){if(e instanceof kt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Dt.create(wt(r))}return new kt({...e._def,shape:()=>t})}return e instanceof bt?new bt({...e._def,type:wt(e.element)}):e instanceof Dt?Dt.create(wt(e.unwrap())):e instanceof zt?zt.create(wt(e.unwrap())):e instanceof Zt?Zt.create(e.items.map(e=>wt(e))):e}bt.create=(e,t)=>new bt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Xt.ZodArray,...$e(t)});class kt extends Fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=ue.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==pe.object){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.object,received:t.parsedType}),ke}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof vt&&"strip"===this._def.unknownKeys))for(const o in n.data)a.includes(o)||s.push(o);const i=[];for(const o of a){const e=r[o],t=n.data[o];i.push({key:{status:"valid",value:o},value:e._parse(new Ie(n,t,n.path,o)),alwaysSet:o in n.data})}if(this._def.catchall instanceof vt){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of s)i.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)s.length>0&&(be(n,{code:me.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new Ie(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>we.mergeObjectSync(t,e)):we.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return Pe.errToObj,new kt({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var r,a,s,i;const o=null!==(s=null===(a=(r=this._def).errorMap)||void 0===a?void 0:a.call(r,t,n).message)&&void 0!==s?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=Pe.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new kt({...this._def,unknownKeys:"strip"})}passthrough(){return new kt({...this._def,unknownKeys:"passthrough"})}extend(e){return new kt({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new kt({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Xt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new kt({...this._def,catchall:e})}pick(e){const t={};return ue.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new kt({...this._def,shape:()=>t})}omit(e){const t={};return ue.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new kt({...this._def,shape:()=>t})}deepPartial(){return wt(this)}partial(e){const t={};return ue.objectKeys(this.shape).forEach(n=>{const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}),new kt({...this._def,shape:()=>t})}required(e){const t={};return ue.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof Dt;)e=e._def.innerType;t[n]=e}}),new kt({...this._def,shape:()=>t})}keyof(){return Rt(ue.objectKeys(this.shape))}}kt.create=(e,t)=>new kt({shape:()=>e,unknownKeys:"strip",catchall:vt.create(),typeName:Xt.ZodObject,...$e(t)}),kt.strictCreate=(e,t)=>new kt({shape:()=>e,unknownKeys:"strict",catchall:vt.create(),typeName:Xt.ZodObject,...$e(t)}),kt.lazycreate=(e,t)=>new kt({shape:e,unknownKeys:"strip",catchall:vt.create(),typeName:Xt.ZodObject,...$e(t)});class xt extends Fe{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map(e=>new fe(e.ctx.common.issues));return be(t,{code:me.invalid_union,unionErrors:n}),ke});{let e;const r=[];for(const s of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=s._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=r.map(e=>new fe(e));return be(t,{code:me.invalid_union,unionErrors:a}),ke}}get options(){return this._def.options}}xt.create=(e,t)=>new xt({options:e,typeName:Xt.ZodUnion,...$e(t)});const St=e=>e instanceof Ct?St(e.schema):e instanceof Lt?St(e.innerType()):e instanceof It?[e.value]:e instanceof $t?e.options:e instanceof Ft?ue.objectValues(e.enum):e instanceof qt?St(e._def.innerType):e instanceof mt?[void 0]:e instanceof ft?[null]:e instanceof Dt?[void 0,...St(e.unwrap())]:e instanceof zt?[null,...St(e.unwrap())]:e instanceof Bt||e instanceof Kt?St(e.unwrap()):e instanceof Ut?St(e._def.innerType):[];class Tt extends Fe{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.object)return be(t,{code:me.invalid_type,expected:pe.object,received:t.parsedType}),ke;const n=this.discriminator,r=t.data[n],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(be(t,{code:me.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ke)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const r=new Map;for(const a of t){const t=St(a.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(r.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);r.set(n,a)}}return new Tt({typeName:Xt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...$e(n)})}}function Et(e,t){const n=he(e),r=he(t);if(e===t)return{valid:!0,data:e};if(n===pe.object&&r===pe.object){const n=ue.objectKeys(t),r=ue.objectKeys(e).filter(e=>-1!==n.indexOf(e)),a={...e,...t};for(const s of r){const n=Et(e[s],t[s]);if(!n.valid)return{valid:!1};a[s]=n.data}return{valid:!0,data:a}}if(n===pe.array&&r===pe.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const a=Et(e[r],t[r]);if(!a.valid)return{valid:!1};n.push(a.data)}return{valid:!0,data:n}}return n===pe.date&&r===pe.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class Ot extends Fe{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Te(e)||Te(r))return ke;const a=Et(e.value,r.value);return a.valid?((Ee(e)||Ee(r))&&t.dirty(),{status:t.value,value:a.data}):(be(n,{code:me.invalid_intersection_types}),ke)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Ot.create=(e,t,n)=>new Ot({left:e,right:t,typeName:Xt.ZodIntersection,...$e(n)});class Zt extends Fe{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==pe.array)return be(n,{code:me.invalid_type,expected:pe.array,received:n.parsedType}),ke;if(n.data.length<this._def.items.length)return be(n,{code:me.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ke;!this._def.rest&&n.data.length>this._def.items.length&&(be(n,{code:me.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new Ie(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>we.mergeArray(t,e)):we.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new Zt({...this._def,rest:e})}}Zt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Zt({items:e,typeName:Xt.ZodTuple,rest:null,...$e(t)})};class jt extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==pe.object)return be(n,{code:me.invalid_type,expected:pe.object,received:n.parsedType}),ke;const r=[],a=this._def.keyType,s=this._def.valueType;for(const i in n.data)r.push({key:a._parse(new Ie(n,i,n.path,i)),value:s._parse(new Ie(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?we.mergeObjectAsync(t,r):we.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return new jt(t instanceof Fe?{keyType:e,valueType:t,typeName:Xt.ZodRecord,...$e(n)}:{keyType:ot.create(),valueType:e,typeName:Xt.ZodRecord,...$e(t)})}}class Nt extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==pe.map)return be(n,{code:me.invalid_type,expected:pe.map,received:n.parsedType}),ke;const r=this._def.keyType,a=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:r._parse(new Ie(n,e,n.path,[s,"key"])),value:a._parse(new Ie(n,t,n.path,[s,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of s){const r=await n.key,a=await n.value;if("aborted"===r.status||"aborted"===a.status)return ke;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of s){const r=n.key,a=n.value;if("aborted"===r.status||"aborted"===a.status)return ke;"dirty"!==r.status&&"dirty"!==a.status||t.dirty(),e.set(r.value,a.value)}return{status:t.value,value:e}}}}Nt.create=(e,t,n)=>new Nt({valueType:t,keyType:e,typeName:Xt.ZodMap,...$e(n)});class Pt extends Fe{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==pe.set)return be(n,{code:me.invalid_type,expected:pe.set,received:n.parsedType}),ke;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(be(n,{code:me.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(be(n,{code:me.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function s(e){const n=new Set;for(const r of e){if("aborted"===r.status)return ke;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const i=[...n.data.values()].map((e,t)=>a._parse(new Ie(n,e,n.path,t)));return n.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(e,t){return new Pt({...this._def,minSize:{value:e,message:Pe.toString(t)}})}max(e,t){return new Pt({...this._def,maxSize:{value:e,message:Pe.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Pt.create=(e,t)=>new Pt({valueType:e,minSize:null,maxSize:null,typeName:Xt.ZodSet,...$e(t)});class At extends Fe{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.function)return be(t,{code:me.invalid_type,expected:pe.function,received:t.parsedType}),ke;function n(e,n){return _e({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ve(),ye].filter(e=>!!e),issueData:{code:me.invalid_arguments,argumentsError:n}})}function r(e,n){return _e({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ve(),ye].filter(e=>!!e),issueData:{code:me.invalid_return_type,returnTypeError:n}})}const a={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Mt){const e=this;return Se(async function(...t){const i=new fe([]),o=await e._def.args.parseAsync(t,a).catch(e=>{throw i.addIssue(n(t,e)),i}),d=await Reflect.apply(s,this,o),c=await e._def.returns._def.type.parseAsync(d,a).catch(e=>{throw i.addIssue(r(d,e)),i});return c})}{const e=this;return Se(function(...t){const i=e._def.args.safeParse(t,a);if(!i.success)throw new fe([n(t,i.error)]);const o=Reflect.apply(s,this,i.data),d=e._def.returns.safeParse(o,a);if(!d.success)throw new fe([r(o,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new At({...this._def,args:Zt.create(e).rest(gt.create())})}returns(e){return new At({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new At({args:e||Zt.create([]).rest(gt.create()),returns:t||gt.create(),typeName:Xt.ZodFunction,...$e(n)})}}class Ct extends Fe{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ct.create=(e,t)=>new Ct({getter:e,typeName:Xt.ZodLazy,...$e(t)});class It extends Fe{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return be(t,{received:t.data,code:me.invalid_literal,expected:this._def.value}),ke}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Rt(e,t){return new $t({values:e,typeName:Xt.ZodEnum,...$e(t)})}It.create=(e,t)=>new It({value:e,typeName:Xt.ZodLiteral,...$e(t)});class $t extends Fe{constructor(){super(...arguments),Ae.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return be(t,{expected:ue.joinValues(n),received:t.parsedType,code:me.invalid_type}),ke}if(je(this,Ae)||Ne(this,Ae,new Set(this._def.values)),!je(this,Ae).has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return be(t,{received:t.data,code:me.invalid_enum_value,options:n}),ke}return Se(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return $t.create(e,{...this._def,...t})}exclude(e,t=this._def){return $t.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Ae=new WeakMap,$t.create=Rt;class Ft extends Fe{constructor(){super(...arguments),Ce.set(this,void 0)}_parse(e){const t=ue.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==pe.string&&n.parsedType!==pe.number){const e=ue.objectValues(t);return be(n,{expected:ue.joinValues(e),received:n.parsedType,code:me.invalid_type}),ke}if(je(this,Ce)||Ne(this,Ce,new Set(ue.getValidEnumValues(this._def.values))),!je(this,Ce).has(e.data)){const e=ue.objectValues(t);return be(n,{received:n.data,code:me.invalid_enum_value,options:e}),ke}return Se(e.data)}get enum(){return this._def.values}}Ce=new WeakMap,Ft.create=(e,t)=>new Ft({values:e,typeName:Xt.ZodNativeEnum,...$e(t)});class Mt extends Fe{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==pe.promise&&!1===t.common.async)return be(t,{code:me.invalid_type,expected:pe.promise,received:t.parsedType}),ke;const n=t.parsedType===pe.promise?t.data:Promise.resolve(t.data);return Se(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Mt.create=(e,t)=>new Mt({type:e,typeName:Xt.ZodPromise,...$e(t)});class Lt extends Fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Xt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:e=>{be(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===r.type){const e=r.transform(n.data,a);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return ke;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?ke:"dirty"===r.status||"dirty"===t.value?xe(r.value):r});{if("aborted"===t.value)return ke;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?ke:"dirty"===r.status||"dirty"===t.value?xe(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,a);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?ke:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?ke:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Oe(e))return e;const s=r.transform(e.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Oe(e)?Promise.resolve(r.transform(e.value,a)).then(e=>({status:t.value,value:e})):e)}ue.assertNever(r)}}Lt.create=(e,t,n)=>new Lt({schema:e,typeName:Xt.ZodEffects,effect:t,...$e(n)}),Lt.createWithPreprocess=(e,t,n)=>new Lt({schema:t,effect:{type:"preprocess",transform:e},typeName:Xt.ZodEffects,...$e(n)});class Dt extends Fe{_parse(e){return this._getType(e)===pe.undefined?Se(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Dt.create=(e,t)=>new Dt({innerType:e,typeName:Xt.ZodOptional,...$e(t)});class zt extends Fe{_parse(e){return this._getType(e)===pe.null?Se(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}zt.create=(e,t)=>new zt({innerType:e,typeName:Xt.ZodNullable,...$e(t)});class qt extends Fe{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===pe.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}qt.create=(e,t)=>new qt({innerType:e,typeName:Xt.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...$e(t)});class Ut extends Fe{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ze(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new fe(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new fe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ut.create=(e,t)=>new Ut({innerType:e,typeName:Xt.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...$e(t)});class Vt extends Fe{_parse(e){if(this._getType(e)!==pe.nan){const t=this._getOrReturnCtx(e);return be(t,{code:me.invalid_type,expected:pe.nan,received:t.parsedType}),ke}return{status:"valid",value:e.data}}}Vt.create=e=>new Vt({typeName:Xt.ZodNaN,...$e(e)});const Ht=Symbol("zod_brand");class Bt extends Fe{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Wt extends Fe{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?ke:"dirty"===e.status?(t.dirty(),xe(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?ke:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new Wt({in:e,out:t,typeName:Xt.ZodPipeline})}}class Kt extends Fe{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Oe(e)&&(e.value=Object.freeze(e.value)),e);return Ze(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}}function Jt(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Yt(e,t={},n){return e?yt.create().superRefine((r,a)=>{var s,i;const o=e(r);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=Jt(t,r),o=null===(i=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===i||i;a.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=Jt(t,r),o=null===(i=null!==(s=e.fatal)&&void 0!==s?s:n)||void 0===i||i;a.addIssue({code:"custom",...e,fatal:o})}}):yt.create()}Kt.create=(e,t)=>new Kt({innerType:e,typeName:Xt.ZodReadonly,...$e(t)});const Gt={object:kt.lazycreate};var Xt;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Xt||(Xt={}));const Qt=ot.create,en=ct.create,tn=Vt.create,nn=ut.create,rn=lt.create,an=pt.create,sn=ht.create,on=mt.create,dn=ft.create,cn=yt.create,un=gt.create,ln=vt.create,pn=_t.create,hn=bt.create,mn=kt.create,fn=kt.strictCreate,yn=xt.create,gn=Tt.create,vn=Ot.create,_n=Zt.create,bn=jt.create,wn=Nt.create,kn=Pt.create,xn=At.create,Sn=Ct.create,Tn=It.create,En=$t.create,On=Ft.create,Zn=Mt.create,jn=Lt.create,Nn=Dt.create,Pn=zt.create,An=Lt.createWithPreprocess,Cn=Wt.create,In={string:e=>ot.create({...e,coerce:!0}),number:e=>ct.create({...e,coerce:!0}),boolean:e=>lt.create({...e,coerce:!0}),bigint:e=>ut.create({...e,coerce:!0}),date:e=>pt.create({...e,coerce:!0})},Rn=ke;var $n=Object.freeze({__proto__:null,defaultErrorMap:ye,setErrorMap:function(e){ge=e},getErrorMap:ve,makeIssue:_e,EMPTY_PATH:[],addIssueToContext:be,ParseStatus:we,INVALID:ke,DIRTY:xe,OK:Se,isAborted:Te,isDirty:Ee,isValid:Oe,isAsync:Ze,get util(){return ue},get objectUtil(){return le},ZodParsedType:pe,getParsedType:he,ZodType:Fe,datetimeRegex:rt,ZodString:ot,ZodNumber:ct,ZodBigInt:ut,ZodBoolean:lt,ZodDate:pt,ZodSymbol:ht,ZodUndefined:mt,ZodNull:ft,ZodAny:yt,ZodUnknown:gt,ZodNever:vt,ZodVoid:_t,ZodArray:bt,ZodObject:kt,ZodUnion:xt,ZodDiscriminatedUnion:Tt,ZodIntersection:Ot,ZodTuple:Zt,ZodRecord:jt,ZodMap:Nt,ZodSet:Pt,ZodFunction:At,ZodLazy:Ct,ZodLiteral:It,ZodEnum:$t,ZodNativeEnum:Ft,ZodPromise:Mt,ZodEffects:Lt,ZodTransformer:Lt,ZodOptional:Dt,ZodNullable:zt,ZodDefault:qt,ZodCatch:Ut,ZodNaN:Vt,BRAND:Ht,ZodBranded:Bt,ZodPipeline:Wt,ZodReadonly:Kt,custom:Yt,Schema:Fe,ZodSchema:Fe,late:Gt,get ZodFirstPartyTypeKind(){return Xt},coerce:In,any:cn,array:hn,bigint:nn,boolean:rn,date:an,discriminatedUnion:gn,effect:jn,enum:En,function:xn,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Yt(t=>t instanceof e,t),intersection:vn,lazy:Sn,literal:Tn,map:wn,nan:tn,nativeEnum:On,never:ln,null:dn,nullable:Pn,number:en,object:mn,oboolean:()=>rn().optional(),onumber:()=>en().optional(),optional:Nn,ostring:()=>Qt().optional(),pipeline:Cn,preprocess:An,promise:Zn,record:bn,set:kn,strictObject:fn,string:Qt,symbol:sn,transformer:jn,tuple:_n,undefined:on,union:yn,unknown:un,void:pn,NEVER:Rn,ZodIssueCode:me,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:fe});const Fn=$n.object({detail:$n.string()}),Mn=$n.object({error:$n.string()});function Ln(e){if(!e)return"Unknown error";if(e instanceof Error){const t=Fn.safeParse(e.cause);return t.success?t.data.detail:function(e){const t=function(e){try{return JSON.parse(e)}catch{return e}}(e);if(!t)return e;const n=Fn.safeParse(t);if(n.success)return n.data.detail;const r=Mn.safeParse(t);if(r.success)return r.data.error;return e}(e.message)}if("object"==typeof e){const t=Fn.safeParse(e);if(t.success)return t.data.detail;const n=Mn.safeParse(e);if(n.success)return n.data.error}try{return JSON.stringify(e)}catch{return String(e)}}function Dn(e,t){if(!e)throw new Error(t)}const zn=["normal","compact","medium","full","columns"],qn=["auto","native","polars","lazy-polars","pandas"],Un=$n.object({completion:$n.object({activate_on_typing:$n.boolean().default(!0),copilot:$n.union([$n.boolean(),$n.enum(["github","codeium","custom"])]).default(!1).transform(e=>!0===e?"github":e),codeium_api_key:$n.string().nullish()}).passthrough().default({}),save:$n.object({autosave:$n.enum(["off","after_delay"]).default("after_delay"),autosave_delay:$n.number().nonnegative().transform(e=>Math.max(e,1e3)).default(1e3),format_on_save:$n.boolean().default(!1)}).passthrough().default({}),formatting:$n.object({line_length:$n.number().nonnegative().default(79).transform(e=>Math.min(e,1e3))}).passthrough().default({}),keymap:$n.object({preset:$n.enum(["default","vim"]).default("default"),overrides:$n.record($n.string()).default({})}).passthrough().default({}),runtime:$n.object({auto_instantiate:$n.boolean().default(!0),on_cell_change:$n.enum(["lazy","autorun"]).default("autorun"),auto_reload:$n.enum(["off","lazy","autorun"]).default("off"),watcher_on_save:$n.enum(["lazy","autorun"]).default("lazy"),default_sql_output:$n.enum(qn).default("auto")}).passthrough().default({}),display:$n.object({theme:$n.enum(["light","dark","system"]).default("light"),code_editor_font_size:$n.number().nonnegative().default(14),cell_output:$n.enum(["above","below"]).default("above"),dataframes:$n.enum(["rich","plain"]).default("rich"),default_table_page_size:$n.number().default(10),default_width:$n.enum(zn).default("medium").transform(e=>"normal"===e?"compact":e),reference_highlighting:$n.boolean().default(!1)}).passthrough().default({}),package_management:$n.object({manager:$n.enum(["pip","uv","rye","poetry","pixi"]).default("pip")}).passthrough().default({manager:"pip"}),ai:$n.object({rules:$n.string().default(""),mode:$n.enum(["manual","ask"]).default("manual"),open_ai:$n.object({api_key:$n.string().optional(),base_url:$n.string().optional(),model:$n.string().optional()}).optional(),anthropic:$n.object({api_key:$n.string().optional()}).optional(),google:$n.object({api_key:$n.string().optional()}).optional(),bedrock:$n.object({region_name:$n.string().optional(),profile_name:$n.string().optional(),aws_access_key_id:$n.string().optional(),aws_secret_access_key:$n.string().optional()}).optional()}).passthrough().default({}),experimental:$n.object({markdown:$n.boolean().optional(),rtc:$n.boolean().optional()}).passthrough().default({}),server:$n.object({}).passthrough().default({}),sharing:$n.object({html:$n.boolean().optional(),wasm:$n.boolean().optional()}).passthrough().optional()}).passthrough().default({completion:{},save:{},formatting:{},keymap:{},runtime:{},display:{},experimental:{},server:{},ai:{rules:"",mode:"manual",open_ai:{}}}),Vn=$n.string(),Hn=$n.enum(qn).default("auto");$n.object({width:$n.enum(zn).default("medium").transform(e=>"normal"===e?"compact":e),app_title:Vn.nullish(),css_file:$n.string().nullish(),html_head_file:$n.string().nullish(),auto_download:$n.array($n.enum(["html","markdown","ipynb"])).default([]),sql_output:Hn}).default({width:"medium",auto_download:[]});const Bn=e=>(new TextDecoder).decode(e);function Wn(e){return e.FS}const Kn="notebook.py",Jn="/marimo",Yn=Kn,Gn=e=>{const t=Wn(e);try{t.mkdirTree(Jn)}catch{}t.chdir(Jn)},Xn=e=>{Wn(e).mount(e.FS.filesystems.IDBFS,{root:"."},Jn)},Qn=async e=>{await tr(e,!0)},er=e=>{const{pyodide:t,filename:n,code:r}=e,a=Wn(t);if(n&&n!==Kn){const e=(e=>{try{return Bn(a.readFile(e))}catch{return null}})(n);if(e)return{code:e,filename:n}}return a.writeFile(Kn,r),{code:r,filename:Kn}};function tr(e,t){return new Promise((n,r)=>{Wn(e).syncfs(t,e=>{e instanceof Error?r(e):n()})})}const nr=new class{spans=[];startSpan(e,t={}){const 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={}){const r=this.startSpan(t||e.name,n);try{const t=e();return this.endSpan(r),t}catch(a){throw this.endSpan(r,"error"),a}}wrapAsync(e,t,n={}){return async(...r)=>{const a=this.startSpan(t||e.name,n);try{const t=await e(...r);return this.endSpan(a),t}catch(s){throw this.endSpan(a,"error"),s}}}logSpans(){}};globalThis.t=nr;class rr{pyodide=null;get requirePyodide(){return Dn(this.pyodide,"Pyodide not loaded"),this.pyodide}async bootstrap(e){return await this.loadPyodideAndPackages(e)}async loadPyodideAndPackages(e){if(!ae)throw new Error("loadPyodide is not defined");const t=nr.startSpan("loadPyodide");try{const n=await ae({packages:["micropip","marimo-base","Markdown","pymdown-extensions","narwhals","packaging"],_makeSnapshot:false,lockFileURL:`https://wasm.marimo.app/pyodide-lock.json?v=${e.version}&pyodide=${e.pyodideVersion}`,indexURL:`https://cdn.jsdelivr.net/pyodide/${e.pyodideVersion}/full/`});return this.pyodide=n,t.end("ok"),n}catch(n){throw ce.error("Failed to load Pyodide",n),n}}async mountFilesystem(e){const t=nr.startSpan("mountFilesystem");return Gn(this.requirePyodide),Xn(this.requirePyodide),await Qn(this.requirePyodide),t.end("ok"),er({pyodide:this.requirePyodide,code:e.code,filename:e.filename})}async startSession(e){const{code:t,filename:n,onMessage:r,queryParameters:a,userConfig:s}=e;self.messenger={callback:r},self.query_params=a,self.user_config=s;const i=nr.startSpan("startSession.runPython"),o=n||Yn,[d,c,u]=this.requirePyodide.runPython(`\n print("[py] Starting marimo...")\n import asyncio\n import js\n from marimo._pyodide.bootstrap import create_session, instantiate\n\n assert js.messenger, "messenger is not defined"\n assert js.query_params, "query_params is not defined"\n\n session, bridge = create_session(\n filename="${o}",\n query_params=js.query_params.to_py(),\n message_callback=js.messenger.callback,\n user_config=js.user_config.to_py(),\n )\n\n def init(auto_instantiate=True):\n instantiate(session, auto_instantiate)\n asyncio.create_task(session.start())\n\n # Find the packages to install\n with open("${o}", "r") as f:\n packages = session.find_packages(f.read())\n\n bridge, init, packages`);i.end();const l=new Set(u.toJs());return this.loadNotebookDeps(t,l).then(()=>c(s.runtime.auto_instantiate)),d}async loadNotebookDeps(e,t){const n=this.requirePyodide;e.includes("mo.sql")&&(e=`import sqlglot\n${e=`import duckdb\n${e=`import pandas\n${e}`}`}`).includes("polars")&&(e=`import pyarrow\n${e}`),e=`import pyodide_http\n${e=`import jedi\n${e=`import pygments\n${e=`import docutils\n${e}`}`}`}`;const r=[...t];let a=nr.startSpan("pyodide.loadPackage");await n.loadPackagesFromImports(e,{errorCallback:ce.error,messageCallback:ce.log}),a.end(),a=nr.startSpan("micropip.install");const s=r.filter(e=>!n.loadedPackages[e]);s.length>0&&await n.runPythonAsync(`\n import micropip\n import sys\n # Filter out builtins\n missing = [p for p in ${JSON.stringify(s)} if p not in sys.modules]\n if len(missing) > 0:\n print("Loading from micropip:", missing)\n await micropip.install(missing)\n `).catch(e=>{ce.error("Failed to load packages from micropip",e)}),a.end()}}class ar extends rr{async bootstrap(e){return await super.bootstrap(e)}async mountFilesystem(e){const{code:t,filename:n}=e;try{return Gn(this.requirePyodide),er({pyodide:this.requirePyodide,code:t,filename:n})}catch(r){ce.error(r)}return{code:t,filename:n}}async startSession(e){return super.startSession({queryParameters:{},code:e.code,filename:e.filename,onMessage:e.onMessage,userConfig:Un.parse({})})}}const sr=async function(){const e=self.name,t=function(e){return e.includes("dev"),`v${re}`}(e);try{self.controller=new ar,self.pyodide=await self.controller.bootstrap({version:e,pyodideVersion:t})}catch(n){ce.error("Error bootstrapping",n),cr.send.initializedError({error:Ln(n)})}}(),ir=new class{constructor(e){this.onMessage=e,this.buffer=[]}buffer;started=!1;push=e=>{this.started?this.onMessage(e):this.buffer.push(e)};start=()=>{this.started=!0,this.buffer.forEach(e=>this.onMessage(e)),this.buffer=[]}}(e=>{cr.send.kernelMessage({message:e})}),or=new class{promise;resolve;reject;status="pending";constructor(){this.promise=new Promise((e,t)=>{this.reject=e=>{this.status="rejected",t(e)},this.resolve=t=>{this.status="resolved",e(t)}})}},dr={startSession:async e=>{await sr;try{Dn(self.controller,"Controller not loaded");const t=await self.controller.mountFilesystem({code:e.code,filename:`app-${e.appId}.py`}),n=await self.controller.startSession({...t,onMessage:ir.push});or.resolve(n),cr.send.initialized({})}catch(t){cr.send.initializedError({error:Ln(t)})}},loadPackages:async e=>{await sr,e.includes("mo.sql")&&(e=`import sqlglot\n${e=`import duckdb\n${e=`import pandas\n${e}`}`}`).includes("polars")&&(e=`import pyarrow\n${e}`),await self.pyodide.loadPackagesFromImports(e,{messageCallback:ce.log,errorCallback:ce.error})},bridge:async e=>{await sr;const{functionName:t,payload:n}=e,r=await or.promise,a=null==n?null:"string"==typeof n?n:JSON.stringify(n),s=null==a?await r[t]():await r[t](a);return"string"==typeof s?JSON.parse(s):s}},cr=function(e){return n(e)}({transport:(ur={transportId:"marimo-transport"},a(self,ur)),requestHandler:dr});var ur;cr.send("ready",{}),cr.addMessageListener("consumerReady",async()=>{await sr,ir.start()});