@clickmax/studio-bridge 0.0.0-stage → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (524) hide show
  1. package/README.md +22 -2
  2. package/dist/clickmax-bridge.js +291 -0
  3. package/editor/assets/__vite-browser-external-CV6URZNE.js +1 -0
  4. package/editor/assets/chunk-UYWON5AX-8myO-fst.js +1 -0
  5. package/editor/assets/dist-DFhRmUKu.js +56 -0
  6. package/editor/assets/dist-a6k0q1aq.js +51 -0
  7. package/editor/assets/domEditingLayers-KBTPQKGA-C_mwj3u9.js +1 -0
  8. package/editor/assets/hyperframes-player-CAjGal_q.js +473 -0
  9. package/editor/assets/index-CKpPsD-S.js +406 -0
  10. package/editor/assets/index-CiBmTL33.css +1 -0
  11. package/editor/assets/index-D5lVrSDr.css +1 -0
  12. package/editor/assets/index-D6uxd0yK.js +404 -0
  13. package/editor/assets/lib-DlEuZBGC.js +1 -0
  14. package/editor/assets/rolldown-runtime-B0Z9INg1.js +1 -0
  15. package/editor/assets/src-DDA8OuTJ.js +117 -0
  16. package/editor/index.html +39 -0
  17. package/moments/catalog.json +2436 -0
  18. package/package.json +41 -3
  19. package/plugin/.claude-plugin/plugin.json +6 -0
  20. package/plugin/hooks/creative-check.mjs +116 -0
  21. package/plugin/hooks/hooks.json +15 -0
  22. package/plugin/skills/achadinho/SKILL.md +71 -0
  23. package/plugin/skills/brasil-mapas/SKILL.md +139 -0
  24. package/plugin/skills/brasil-mapas/geo/br-municipios.topojson +1 -0
  25. package/plugin/skills/brasil-mapas/geo/br-regioes.topojson +1 -0
  26. package/plugin/skills/brasil-mapas/geo/br-uf.topojson +1 -0
  27. package/plugin/skills/brasil-mapas/scripts/mapa-base.mjs +527 -0
  28. package/plugin/skills/brasil-mapas/scripts/seca.mjs +258 -0
  29. package/plugin/skills/criativos/SKILL.md +182 -0
  30. package/plugin/skills/design-criativos/SKILL.md +153 -0
  31. package/plugin/skills/imagens/SKILL.md +57 -0
  32. package/plugin/skills/imagens/scripts/gerar-imagem.mjs +141 -0
  33. package/prompts/agent-system-prompt.md +27 -0
  34. package/prompts/creative-system-prompt.md +17 -0
  35. package/templates/creative/agenda-aberta-calendario/page-01.html +217 -0
  36. package/templates/creative/agenda-aberta-calendario/preview.jpg +0 -0
  37. package/templates/creative/agenda-aberta-calendario/template.json +8 -0
  38. package/templates/creative/agenda-lotando-fim-de-ano/page-01.html +201 -0
  39. package/templates/creative/agenda-lotando-fim-de-ano/preview.jpg +0 -0
  40. package/templates/creative/agenda-lotando-fim-de-ano/template.json +8 -0
  41. package/templates/creative/alerta-vencimento-mensal/page-01.html +163 -0
  42. package/templates/creative/alerta-vencimento-mensal/preview.jpg +0 -0
  43. package/templates/creative/alerta-vencimento-mensal/template.json +8 -0
  44. package/templates/creative/ano-novo-agradecimento/page-01.html +244 -0
  45. package/templates/creative/ano-novo-agradecimento/preview.jpg +0 -0
  46. package/templates/creative/ano-novo-agradecimento/template.json +8 -0
  47. package/templates/creative/antes-depois/assets/img/exemplo-antes.jpg +0 -0
  48. package/templates/creative/antes-depois/assets/img/exemplo-depois.jpg +0 -0
  49. package/templates/creative/antes-depois/page-01.html +123 -0
  50. package/templates/creative/antes-depois/preview.jpg +0 -0
  51. package/templates/creative/antes-depois/template.json +8 -0
  52. package/templates/creative/anuncio-link/assets/img/exemplo-escritorio.jpg +0 -0
  53. package/templates/creative/anuncio-link/page-01.html +86 -0
  54. package/templates/creative/anuncio-link/preview.jpg +0 -0
  55. package/templates/creative/anuncio-link/template.json +8 -0
  56. package/templates/creative/aula-ao-vivo-retrato/assets/img/exemplo-confeiteira.jpg +0 -0
  57. package/templates/creative/aula-ao-vivo-retrato/page-01.html +148 -0
  58. package/templates/creative/aula-ao-vivo-retrato/preview.jpg +0 -0
  59. package/templates/creative/aula-ao-vivo-retrato/template.json +8 -0
  60. package/templates/creative/aula-experimental-gratis/assets/img/exemplo-treino-barra.jpg +0 -0
  61. package/templates/creative/aula-experimental-gratis/page-01.html +136 -0
  62. package/templates/creative/aula-experimental-gratis/preview.jpg +0 -0
  63. package/templates/creative/aula-experimental-gratis/template.json +8 -0
  64. package/templates/creative/avaliacao-google-qr/page-01.html +158 -0
  65. package/templates/creative/avaliacao-google-qr/preview.jpg +0 -0
  66. package/templates/creative/avaliacao-google-qr/template.json +8 -0
  67. package/templates/creative/aviso-feriado-fechado/page-01.html +157 -0
  68. package/templates/creative/aviso-feriado-fechado/preview.jpg +0 -0
  69. package/templates/creative/aviso-feriado-fechado/template.json +8 -0
  70. package/templates/creative/banner-oferta-semana/assets/img/exemplo-emporio.jpg +0 -0
  71. package/templates/creative/banner-oferta-semana/page-01.html +126 -0
  72. package/templates/creative/banner-oferta-semana/preview.jpg +0 -0
  73. package/templates/creative/banner-oferta-semana/template.json +8 -0
  74. package/templates/creative/black-friday-escuro-dourado/assets/img/exemplo-retrato.jpg +0 -0
  75. package/templates/creative/black-friday-escuro-dourado/page-01.html +191 -0
  76. package/templates/creative/black-friday-escuro-dourado/preview.jpg +0 -0
  77. package/templates/creative/black-friday-escuro-dourado/template.json +8 -0
  78. package/templates/creative/black-friday-sofisticada/page-01.html +149 -0
  79. package/templates/creative/black-friday-sofisticada/preview.jpg +0 -0
  80. package/templates/creative/black-friday-sofisticada/template.json +8 -0
  81. package/templates/creative/bonus-empilhados/page-01.html +203 -0
  82. package/templates/creative/bonus-empilhados/preview.jpg +0 -0
  83. package/templates/creative/bonus-empilhados/template.json +8 -0
  84. package/templates/creative/campanha-vacinacao-pet/assets/img/exemplo-cao-vacina.jpg +0 -0
  85. package/templates/creative/campanha-vacinacao-pet/page-01.html +182 -0
  86. package/templates/creative/campanha-vacinacao-pet/preview.jpg +0 -0
  87. package/templates/creative/campanha-vacinacao-pet/template.json +8 -0
  88. package/templates/creative/capa-live-youtube/assets/img/exemplo-evento.jpg +0 -0
  89. package/templates/creative/capa-live-youtube/page-01.html +124 -0
  90. package/templates/creative/capa-live-youtube/preview.jpg +0 -0
  91. package/templates/creative/capa-live-youtube/template.json +8 -0
  92. package/templates/creative/capa-video-aula/assets/img/exemplo-escritorio.jpg +0 -0
  93. package/templates/creative/capa-video-aula/page-01.html +108 -0
  94. package/templates/creative/capa-video-aula/preview.jpg +0 -0
  95. package/templates/creative/capa-video-aula/template.json +8 -0
  96. package/templates/creative/cardapio-do-dia-lousa/page-01.html +191 -0
  97. package/templates/creative/cardapio-do-dia-lousa/preview.jpg +0 -0
  98. package/templates/creative/cardapio-do-dia-lousa/template.json +8 -0
  99. package/templates/creative/cardapio-tv-pizza/assets/img/exemplo-pizza.jpg +0 -0
  100. package/templates/creative/cardapio-tv-pizza/page-01.html +145 -0
  101. package/templates/creative/cardapio-tv-pizza/preview.jpg +0 -0
  102. package/templates/creative/cardapio-tv-pizza/template.json +8 -0
  103. package/templates/creative/carrinho-aberto-curso/page-01.html +219 -0
  104. package/templates/creative/carrinho-aberto-curso/preview.jpg +0 -0
  105. package/templates/creative/carrinho-aberto-curso/template.json +8 -0
  106. package/templates/creative/carrossel-catalogo/assets/img/exemplo-cafe-pacote.webp +0 -0
  107. package/templates/creative/carrossel-catalogo/assets/img/exemplo-emporio.jpg +0 -0
  108. package/templates/creative/carrossel-catalogo/assets/img/exemplo-produto.webp +0 -0
  109. package/templates/creative/carrossel-catalogo/assets/img/exemplo-queijo.webp +0 -0
  110. package/templates/creative/carrossel-catalogo/page-01.html +91 -0
  111. package/templates/creative/carrossel-catalogo/page-02.html +110 -0
  112. package/templates/creative/carrossel-catalogo/page-03.html +110 -0
  113. package/templates/creative/carrossel-catalogo/page-04.html +110 -0
  114. package/templates/creative/carrossel-catalogo/page-05.html +91 -0
  115. package/templates/creative/carrossel-catalogo/preview.jpg +0 -0
  116. package/templates/creative/carrossel-catalogo/template.json +8 -0
  117. package/templates/creative/carrossel-dicas/assets/img/exemplo-escritorio.jpg +0 -0
  118. package/templates/creative/carrossel-dicas/page-01.html +102 -0
  119. package/templates/creative/carrossel-dicas/page-02.html +113 -0
  120. package/templates/creative/carrossel-dicas/page-03.html +113 -0
  121. package/templates/creative/carrossel-dicas/page-04.html +113 -0
  122. package/templates/creative/carrossel-dicas/page-05.html +105 -0
  123. package/templates/creative/carrossel-dicas/preview.jpg +0 -0
  124. package/templates/creative/carrossel-dicas/template.json +8 -0
  125. package/templates/creative/carrossel-direitos/assets/img/exemplo-advogada.jpg +0 -0
  126. package/templates/creative/carrossel-direitos/page-01.html +95 -0
  127. package/templates/creative/carrossel-direitos/page-02.html +103 -0
  128. package/templates/creative/carrossel-direitos/page-03.html +103 -0
  129. package/templates/creative/carrossel-direitos/page-04.html +102 -0
  130. package/templates/creative/carrossel-direitos/page-05.html +102 -0
  131. package/templates/creative/carrossel-direitos/page-06.html +85 -0
  132. package/templates/creative/carrossel-direitos/preview.jpg +0 -0
  133. package/templates/creative/carrossel-direitos/template.json +8 -0
  134. package/templates/creative/carrossel-erros-iniciante/page-01.html +179 -0
  135. package/templates/creative/carrossel-erros-iniciante/page-02.html +187 -0
  136. package/templates/creative/carrossel-erros-iniciante/page-03.html +187 -0
  137. package/templates/creative/carrossel-erros-iniciante/page-04.html +182 -0
  138. package/templates/creative/carrossel-erros-iniciante/page-05.html +179 -0
  139. package/templates/creative/carrossel-erros-iniciante/preview.jpg +0 -0
  140. package/templates/creative/carrossel-erros-iniciante/template.json +8 -0
  141. package/templates/creative/carrossel-lancamento-planta/assets/img/exemplo-predio.jpg +0 -0
  142. package/templates/creative/carrossel-lancamento-planta/page-01.html +123 -0
  143. package/templates/creative/carrossel-lancamento-planta/page-02.html +121 -0
  144. package/templates/creative/carrossel-lancamento-planta/page-03.html +121 -0
  145. package/templates/creative/carrossel-lancamento-planta/page-04.html +122 -0
  146. package/templates/creative/carrossel-lancamento-planta/page-05.html +129 -0
  147. package/templates/creative/carrossel-lancamento-planta/page-06.html +111 -0
  148. package/templates/creative/carrossel-lancamento-planta/preview.jpg +0 -0
  149. package/templates/creative/carrossel-lancamento-planta/template.json +8 -0
  150. package/templates/creative/carrossel-lancamento-prato/assets/img/exemplo-burger-gourmet.jpg +0 -0
  151. package/templates/creative/carrossel-lancamento-prato/page-01.html +255 -0
  152. package/templates/creative/carrossel-lancamento-prato/page-02.html +256 -0
  153. package/templates/creative/carrossel-lancamento-prato/page-03.html +254 -0
  154. package/templates/creative/carrossel-lancamento-prato/page-04.html +255 -0
  155. package/templates/creative/carrossel-lancamento-prato/preview.jpg +0 -0
  156. package/templates/creative/carrossel-lancamento-prato/template.json +8 -0
  157. package/templates/creative/carrossel-perguntas-saude/page-01.html +108 -0
  158. package/templates/creative/carrossel-perguntas-saude/page-02.html +142 -0
  159. package/templates/creative/carrossel-perguntas-saude/page-03.html +142 -0
  160. package/templates/creative/carrossel-perguntas-saude/page-04.html +142 -0
  161. package/templates/creative/carrossel-perguntas-saude/page-05.html +112 -0
  162. package/templates/creative/carrossel-perguntas-saude/page-06.html +100 -0
  163. package/templates/creative/carrossel-perguntas-saude/preview.jpg +0 -0
  164. package/templates/creative/carrossel-perguntas-saude/template.json +8 -0
  165. package/templates/creative/carrossel-plano-anual/assets/img/exemplo-academia.jpg +0 -0
  166. package/templates/creative/carrossel-plano-anual/page-01.html +119 -0
  167. package/templates/creative/carrossel-plano-anual/page-02.html +140 -0
  168. package/templates/creative/carrossel-plano-anual/page-03.html +127 -0
  169. package/templates/creative/carrossel-plano-anual/page-04.html +129 -0
  170. package/templates/creative/carrossel-plano-anual/preview.jpg +0 -0
  171. package/templates/creative/carrossel-plano-anual/template.json +8 -0
  172. package/templates/creative/carrossel-servico-novo/assets/img/exemplo-sobrancelha.jpg +0 -0
  173. package/templates/creative/carrossel-servico-novo/page-01.html +110 -0
  174. package/templates/creative/carrossel-servico-novo/page-02.html +116 -0
  175. package/templates/creative/carrossel-servico-novo/page-03.html +105 -0
  176. package/templates/creative/carrossel-servico-novo/page-04.html +141 -0
  177. package/templates/creative/carrossel-servico-novo/preview.jpg +0 -0
  178. package/templates/creative/carrossel-servico-novo/template.json +8 -0
  179. package/templates/creative/cartao-fidelidade-carimbos/page-01.html +182 -0
  180. package/templates/creative/cartao-fidelidade-carimbos/page-02.html +114 -0
  181. package/templates/creative/cartao-fidelidade-carimbos/page-03.html +113 -0
  182. package/templates/creative/cartao-fidelidade-carimbos/preview.jpg +0 -0
  183. package/templates/creative/cartao-fidelidade-carimbos/template.json +8 -0
  184. package/templates/creative/chaves-entregues/assets/img/exemplo-casal-chave.jpg +0 -0
  185. package/templates/creative/chaves-entregues/page-01.html +135 -0
  186. package/templates/creative/chaves-entregues/preview.jpg +0 -0
  187. package/templates/creative/chaves-entregues/template.json +8 -0
  188. package/templates/creative/checklist-revisao-viagem/assets/img/exemplo-carro-elevador.jpg +0 -0
  189. package/templates/creative/checklist-revisao-viagem/page-01.html +201 -0
  190. package/templates/creative/checklist-revisao-viagem/page-02.html +202 -0
  191. package/templates/creative/checklist-revisao-viagem/page-03.html +202 -0
  192. package/templates/creative/checklist-revisao-viagem/page-04.html +202 -0
  193. package/templates/creative/checklist-revisao-viagem/page-05.html +200 -0
  194. package/templates/creative/checklist-revisao-viagem/page-06.html +200 -0
  195. package/templates/creative/checklist-revisao-viagem/preview.jpg +0 -0
  196. package/templates/creative/checklist-revisao-viagem/template.json +8 -0
  197. package/templates/creative/checklist-semanal-carrossel/page-01.html +142 -0
  198. package/templates/creative/checklist-semanal-carrossel/page-02.html +154 -0
  199. package/templates/creative/checklist-semanal-carrossel/page-03.html +154 -0
  200. package/templates/creative/checklist-semanal-carrossel/page-04.html +154 -0
  201. package/templates/creative/checklist-semanal-carrossel/page-05.html +154 -0
  202. package/templates/creative/checklist-semanal-carrossel/page-06.html +155 -0
  203. package/templates/creative/checklist-semanal-carrossel/preview.jpg +0 -0
  204. package/templates/creative/checklist-semanal-carrossel/template.json +8 -0
  205. package/templates/creative/citacao/page-01.html +81 -0
  206. package/templates/creative/citacao/preview.jpg +0 -0
  207. package/templates/creative/citacao/template.json +8 -0
  208. package/templates/creative/cliente-usando-produto/assets/img/exemplo-cliente-moletom.jpg +0 -0
  209. package/templates/creative/cliente-usando-produto/page-01.html +146 -0
  210. package/templates/creative/cliente-usando-produto/preview.jpg +0 -0
  211. package/templates/creative/cliente-usando-produto/template.json +8 -0
  212. package/templates/creative/combo-cafe-da-manha/assets/img/exemplo-cafe.jpg +0 -0
  213. package/templates/creative/combo-cafe-da-manha/page-01.html +220 -0
  214. package/templates/creative/combo-cafe-da-manha/preview.jpg +0 -0
  215. package/templates/creative/combo-cafe-da-manha/template.json +8 -0
  216. package/templates/creative/combo-dia-de-beleza/page-01.html +216 -0
  217. package/templates/creative/combo-dia-de-beleza/preview.jpg +0 -0
  218. package/templates/creative/combo-dia-de-beleza/template.json +8 -0
  219. package/templates/creative/combo-familia-entrega/assets/img/exemplo-mesa-burgers.jpg +0 -0
  220. package/templates/creative/combo-familia-entrega/page-01.html +146 -0
  221. package/templates/creative/combo-familia-entrega/preview.jpg +0 -0
  222. package/templates/creative/combo-familia-entrega/template.json +8 -0
  223. package/templates/creative/comparativo-tres-opcoes/page-01.html +184 -0
  224. package/templates/creative/comparativo-tres-opcoes/preview.jpg +0 -0
  225. package/templates/creative/comparativo-tres-opcoes/template.json +8 -0
  226. package/templates/creative/comprar-ou-alugar/page-01.html +100 -0
  227. package/templates/creative/comprar-ou-alugar/page-02.html +129 -0
  228. package/templates/creative/comprar-ou-alugar/page-03.html +131 -0
  229. package/templates/creative/comprar-ou-alugar/page-04.html +105 -0
  230. package/templates/creative/comprar-ou-alugar/page-05.html +94 -0
  231. package/templates/creative/comprar-ou-alugar/preview.jpg +0 -0
  232. package/templates/creative/comprar-ou-alugar/template.json +8 -0
  233. package/templates/creative/conheca-a-equipe/assets/img/exemplo-equipe.jpg +0 -0
  234. package/templates/creative/conheca-a-equipe/page-01.html +131 -0
  235. package/templates/creative/conheca-a-equipe/preview.jpg +0 -0
  236. package/templates/creative/conheca-a-equipe/template.json +8 -0
  237. package/templates/creative/consulta-gratuita-vagas/assets/img/exemplo-balanca-justica.jpg +0 -0
  238. package/templates/creative/consulta-gratuita-vagas/page-01.html +154 -0
  239. package/templates/creative/consulta-gratuita-vagas/preview.jpg +0 -0
  240. package/templates/creative/consulta-gratuita-vagas/template.json +8 -0
  241. package/templates/creative/contagem-prazo-final/page-01.html +152 -0
  242. package/templates/creative/contagem-prazo-final/preview.jpg +0 -0
  243. package/templates/creative/contagem-prazo-final/template.json +8 -0
  244. package/templates/creative/contagem-reveillon/assets/img/exemplo-piscina-noite.jpg +0 -0
  245. package/templates/creative/contagem-reveillon/page-01.html +170 -0
  246. package/templates/creative/contagem-reveillon/preview.jpg +0 -0
  247. package/templates/creative/contagem-reveillon/template.json +8 -0
  248. package/templates/creative/cupom-recortavel/page-01.html +164 -0
  249. package/templates/creative/cupom-recortavel/preview.jpg +0 -0
  250. package/templates/creative/cupom-recortavel/template.json +8 -0
  251. package/templates/creative/data-institucional/page-01.html +114 -0
  252. package/templates/creative/data-institucional/preview.jpg +0 -0
  253. package/templates/creative/data-institucional/template.json +8 -0
  254. package/templates/creative/depoimento/assets/img/exemplo-retrato.jpg +0 -0
  255. package/templates/creative/depoimento/page-01.html +112 -0
  256. package/templates/creative/depoimento/preview.jpg +0 -0
  257. package/templates/creative/depoimento/template.json +8 -0
  258. package/templates/creative/depoimento-familia-viagem/assets/img/exemplo-familia-praia.jpg +0 -0
  259. package/templates/creative/depoimento-familia-viagem/page-01.html +157 -0
  260. package/templates/creative/depoimento-familia-viagem/preview.jpg +0 -0
  261. package/templates/creative/depoimento-familia-viagem/template.json +8 -0
  262. package/templates/creative/depoimento-print-conversa/page-01.html +188 -0
  263. package/templates/creative/depoimento-print-conversa/preview.jpg +0 -0
  264. package/templates/creative/depoimento-print-conversa/template.json +8 -0
  265. package/templates/creative/desafio-30-dias/assets/img/exemplo-alunos-comemorando.jpg +0 -0
  266. package/templates/creative/desafio-30-dias/page-01.html +192 -0
  267. package/templates/creative/desafio-30-dias/preview.jpg +0 -0
  268. package/templates/creative/desafio-30-dias/template.json +8 -0
  269. package/templates/creative/dia-da-feira-hortifruti/assets/img/exemplo-frutas.webp +0 -0
  270. package/templates/creative/dia-da-feira-hortifruti/assets/img/exemplo-tomates.webp +0 -0
  271. package/templates/creative/dia-da-feira-hortifruti/page-01.html +209 -0
  272. package/templates/creative/dia-da-feira-hortifruti/preview.jpg +0 -0
  273. package/templates/creative/dia-da-feira-hortifruti/template.json +8 -0
  274. package/templates/creative/dica-rapida-story/page-01.html +128 -0
  275. package/templates/creative/dica-rapida-story/preview.jpg +0 -0
  276. package/templates/creative/dica-rapida-story/template.json +8 -0
  277. package/templates/creative/dicas-verao-pet/page-01.html +138 -0
  278. package/templates/creative/dicas-verao-pet/page-02.html +139 -0
  279. package/templates/creative/dicas-verao-pet/page-03.html +139 -0
  280. package/templates/creative/dicas-verao-pet/page-04.html +139 -0
  281. package/templates/creative/dicas-verao-pet/page-05.html +138 -0
  282. package/templates/creative/dicas-verao-pet/preview.jpg +0 -0
  283. package/templates/creative/dicas-verao-pet/template.json +8 -0
  284. package/templates/creative/drop-colecao-numerada/assets/img/exemplo-moletom.jpg +0 -0
  285. package/templates/creative/drop-colecao-numerada/page-01.html +208 -0
  286. package/templates/creative/drop-colecao-numerada/preview.jpg +0 -0
  287. package/templates/creative/drop-colecao-numerada/template.json +8 -0
  288. package/templates/creative/encarte-ofertas/assets/img/exemplo-cafe-pacote.webp +0 -0
  289. package/templates/creative/encarte-ofertas/assets/img/exemplo-frutas.webp +0 -0
  290. package/templates/creative/encarte-ofertas/assets/img/exemplo-queijo.webp +0 -0
  291. package/templates/creative/encarte-ofertas/assets/img/exemplo-tomates.webp +0 -0
  292. package/templates/creative/encarte-ofertas/page-01.html +154 -0
  293. package/templates/creative/encarte-ofertas/preview.jpg +0 -0
  294. package/templates/creative/encarte-ofertas/template.json +8 -0
  295. package/templates/creative/encomenda-bolo-tamanhos/assets/img/exemplo-bolo.webp +0 -0
  296. package/templates/creative/encomenda-bolo-tamanhos/page-01.html +158 -0
  297. package/templates/creative/encomenda-bolo-tamanhos/preview.jpg +0 -0
  298. package/templates/creative/encomenda-bolo-tamanhos/template.json +8 -0
  299. package/templates/creative/enquete-caixa-pergunta/page-01.html +122 -0
  300. package/templates/creative/enquete-caixa-pergunta/preview.jpg +0 -0
  301. package/templates/creative/enquete-caixa-pergunta/template.json +8 -0
  302. package/templates/creative/evento/assets/img/exemplo-evento.jpg +0 -0
  303. package/templates/creative/evento/page-01.html +122 -0
  304. package/templates/creative/evento/preview.jpg +0 -0
  305. package/templates/creative/evento/template.json +8 -0
  306. package/templates/creative/faixa-frete-gratis-site/page-01.html +159 -0
  307. package/templates/creative/faixa-frete-gratis-site/preview.jpg +0 -0
  308. package/templates/creative/faixa-frete-gratis-site/template.json +8 -0
  309. package/templates/creative/feira-adocao/assets/img/exemplo-filhote-caramelo.jpg +0 -0
  310. package/templates/creative/feira-adocao/page-01.html +182 -0
  311. package/templates/creative/feira-adocao/preview.jpg +0 -0
  312. package/templates/creative/feira-adocao/template.json +8 -0
  313. package/templates/creative/festa-junina-oferta/page-01.html +153 -0
  314. package/templates/creative/festa-junina-oferta/preview.jpg +0 -0
  315. package/templates/creative/festa-junina-oferta/template.json +8 -0
  316. package/templates/creative/ficha-imovel-preco/assets/img/exemplo-sala.jpg +0 -0
  317. package/templates/creative/ficha-imovel-preco/page-01.html +174 -0
  318. package/templates/creative/ficha-imovel-preco/preview.jpg +0 -0
  319. package/templates/creative/ficha-imovel-preco/template.json +8 -0
  320. package/templates/creative/garantia-refazemos/assets/img/exemplo-equipe.jpg +0 -0
  321. package/templates/creative/garantia-refazemos/page-01.html +175 -0
  322. package/templates/creative/garantia-refazemos/preview.jpg +0 -0
  323. package/templates/creative/garantia-refazemos/template.json +8 -0
  324. package/templates/creative/homenagem-dia-das-maes/assets/img/exemplo-flores.jpg +0 -0
  325. package/templates/creative/homenagem-dia-das-maes/page-01.html +103 -0
  326. package/templates/creative/homenagem-dia-das-maes/preview.jpg +0 -0
  327. package/templates/creative/homenagem-dia-das-maes/template.json +8 -0
  328. package/templates/creative/horario-especial-festas/page-01.html +134 -0
  329. package/templates/creative/horario-especial-festas/preview.jpg +0 -0
  330. package/templates/creative/horario-especial-festas/template.json +8 -0
  331. package/templates/creative/horarios-clinica-story/assets/img/exemplo-recepcao.jpg +0 -0
  332. package/templates/creative/horarios-clinica-story/page-01.html +145 -0
  333. package/templates/creative/horarios-clinica-story/preview.jpg +0 -0
  334. package/templates/creative/horarios-clinica-story/template.json +8 -0
  335. package/templates/creative/horarios-contados-agenda/assets/img/exemplo-unhas-nude.jpg +0 -0
  336. package/templates/creative/horarios-contados-agenda/page-01.html +167 -0
  337. package/templates/creative/horarios-contados-agenda/preview.jpg +0 -0
  338. package/templates/creative/horarios-contados-agenda/template.json +8 -0
  339. package/templates/creative/inauguracao-unidade/assets/img/exemplo-fachada.jpg +0 -0
  340. package/templates/creative/inauguracao-unidade/page-01.html +160 -0
  341. package/templates/creative/inauguracao-unidade/preview.jpg +0 -0
  342. package/templates/creative/inauguracao-unidade/template.json +8 -0
  343. package/templates/creative/indicacao-premiada-pix/page-01.html +169 -0
  344. package/templates/creative/indicacao-premiada-pix/preview.jpg +0 -0
  345. package/templates/creative/indicacao-premiada-pix/template.json +8 -0
  346. package/templates/creative/indique-e-ganhe-passos/page-01.html +115 -0
  347. package/templates/creative/indique-e-ganhe-passos/page-02.html +142 -0
  348. package/templates/creative/indique-e-ganhe-passos/page-03.html +161 -0
  349. package/templates/creative/indique-e-ganhe-passos/preview.jpg +0 -0
  350. package/templates/creative/indique-e-ganhe-passos/template.json +8 -0
  351. package/templates/creative/kit-presente-data/assets/img/exemplo-caixa-presente.jpg +0 -0
  352. package/templates/creative/kit-presente-data/page-01.html +208 -0
  353. package/templates/creative/kit-presente-data/preview.jpg +0 -0
  354. package/templates/creative/kit-presente-data/template.json +8 -0
  355. package/templates/creative/lancamento/assets/img/exemplo-cafe.jpg +0 -0
  356. package/templates/creative/lancamento/page-01.html +95 -0
  357. package/templates/creative/lancamento/preview.jpg +0 -0
  358. package/templates/creative/lancamento/template.json +8 -0
  359. package/templates/creative/lista-de-espera-banner/assets/img/exemplo-brigadeiros.jpg +0 -0
  360. package/templates/creative/lista-de-espera-banner/page-01.html +156 -0
  361. package/templates/creative/lista-de-espera-banner/preview.jpg +0 -0
  362. package/templates/creative/lista-de-espera-banner/template.json +8 -0
  363. package/templates/creative/look-do-dia-precos/assets/img/exemplo-look-streetwear.jpg +0 -0
  364. package/templates/creative/look-do-dia-precos/page-01.html +170 -0
  365. package/templates/creative/look-do-dia-precos/preview.jpg +0 -0
  366. package/templates/creative/look-do-dia-precos/template.json +8 -0
  367. package/templates/creative/mensagem-de-natal/page-01.html +161 -0
  368. package/templates/creative/mensagem-de-natal/preview.jpg +0 -0
  369. package/templates/creative/mensagem-de-natal/template.json +8 -0
  370. package/templates/creative/mito-ou-verdade/page-01.html +160 -0
  371. package/templates/creative/mito-ou-verdade/preview.jpg +0 -0
  372. package/templates/creative/mito-ou-verdade/template.json +8 -0
  373. package/templates/creative/mudanca-endereco-banner/assets/img/exemplo-recepcao-espelhos.jpg +0 -0
  374. package/templates/creative/mudanca-endereco-banner/page-01.html +140 -0
  375. package/templates/creative/mudanca-endereco-banner/preview.jpg +0 -0
  376. package/templates/creative/mudanca-endereco-banner/template.json +8 -0
  377. package/templates/creative/natal-pet-foto/page-01.html +168 -0
  378. package/templates/creative/natal-pet-foto/preview.jpg +0 -0
  379. package/templates/creative/natal-pet-foto/template.json +8 -0
  380. package/templates/creative/novidades-emporio-carrossel/assets/img/exemplo-cafe-pacote.webp +0 -0
  381. package/templates/creative/novidades-emporio-carrossel/assets/img/exemplo-queijo.webp +0 -0
  382. package/templates/creative/novidades-emporio-carrossel/page-01.html +155 -0
  383. package/templates/creative/novidades-emporio-carrossel/page-02.html +163 -0
  384. package/templates/creative/novidades-emporio-carrossel/page-03.html +163 -0
  385. package/templates/creative/novidades-emporio-carrossel/page-04.html +108 -0
  386. package/templates/creative/novidades-emporio-carrossel/preview.jpg +0 -0
  387. package/templates/creative/novidades-emporio-carrossel/template.json +8 -0
  388. package/templates/creative/oferta-parcelada-discreta/page-01.html +176 -0
  389. package/templates/creative/oferta-parcelada-discreta/preview.jpg +0 -0
  390. package/templates/creative/oferta-parcelada-discreta/template.json +8 -0
  391. package/templates/creative/open-house-convite/assets/img/exemplo-casa.jpg +0 -0
  392. package/templates/creative/open-house-convite/page-01.html +173 -0
  393. package/templates/creative/open-house-convite/preview.jpg +0 -0
  394. package/templates/creative/open-house-convite/template.json +8 -0
  395. package/templates/creative/orcamento-em-minutos/assets/img/exemplo-mecanico.jpg +0 -0
  396. package/templates/creative/orcamento-em-minutos/page-01.html +170 -0
  397. package/templates/creative/orcamento-em-minutos/preview.jpg +0 -0
  398. package/templates/creative/orcamento-em-minutos/template.json +8 -0
  399. package/templates/creative/orcamento-por-foto/assets/img/exemplo-sala.jpg +0 -0
  400. package/templates/creative/orcamento-por-foto/page-01.html +175 -0
  401. package/templates/creative/orcamento-por-foto/preview.jpg +0 -0
  402. package/templates/creative/orcamento-por-foto/template.json +8 -0
  403. package/templates/creative/pacote-feriado-pousada/assets/img/exemplo-pousada.jpg +0 -0
  404. package/templates/creative/pacote-feriado-pousada/page-01.html +194 -0
  405. package/templates/creative/pacote-feriado-pousada/preview.jpg +0 -0
  406. package/templates/creative/pacote-feriado-pousada/template.json +8 -0
  407. package/templates/creative/pacote-ultimos-quartos/assets/img/exemplo-festa.jpg +0 -0
  408. package/templates/creative/pacote-ultimos-quartos/page-01.html +208 -0
  409. package/templates/creative/pacote-ultimos-quartos/preview.jpg +0 -0
  410. package/templates/creative/pacote-ultimos-quartos/template.json +8 -0
  411. package/templates/creative/parcela-em-destaque/assets/img/exemplo-tenis.webp +0 -0
  412. package/templates/creative/parcela-em-destaque/page-01.html +144 -0
  413. package/templates/creative/parcela-em-destaque/preview.jpg +0 -0
  414. package/templates/creative/parcela-em-destaque/template.json +8 -0
  415. package/templates/creative/parceria-duas-marcas/assets/img/exemplo-aperto-mao.jpg +0 -0
  416. package/templates/creative/parceria-duas-marcas/page-01.html +169 -0
  417. package/templates/creative/parceria-duas-marcas/preview.jpg +0 -0
  418. package/templates/creative/parceria-duas-marcas/template.json +8 -0
  419. package/templates/creative/pequenos-reparos-banner/assets/img/exemplo-torneira-reparo.jpg +0 -0
  420. package/templates/creative/pequenos-reparos-banner/page-01.html +115 -0
  421. package/templates/creative/pequenos-reparos-banner/preview.jpg +0 -0
  422. package/templates/creative/pequenos-reparos-banner/template.json +8 -0
  423. package/templates/creative/pergunta/page-01.html +126 -0
  424. package/templates/creative/pergunta/preview.jpg +0 -0
  425. package/templates/creative/pergunta/template.json +8 -0
  426. package/templates/creative/pergunta-do-seguidor/page-01.html +132 -0
  427. package/templates/creative/pergunta-do-seguidor/preview.jpg +0 -0
  428. package/templates/creative/pergunta-do-seguidor/template.json +8 -0
  429. package/templates/creative/pneus-black-friday-banner/assets/img/exemplo-pneus.jpg +0 -0
  430. package/templates/creative/pneus-black-friday-banner/page-01.html +141 -0
  431. package/templates/creative/pneus-black-friday-banner/preview.jpg +0 -0
  432. package/templates/creative/pneus-black-friday-banner/template.json +8 -0
  433. package/templates/creative/prazo-imposto-renda/page-01.html +196 -0
  434. package/templates/creative/prazo-imposto-renda/preview.jpg +0 -0
  435. package/templates/creative/prazo-imposto-renda/template.json +8 -0
  436. package/templates/creative/produto-destaque/assets/img/exemplo-produto.webp +0 -0
  437. package/templates/creative/produto-destaque/page-01.html +129 -0
  438. package/templates/creative/produto-destaque/preview.jpg +0 -0
  439. package/templates/creative/produto-destaque/template.json +8 -0
  440. package/templates/creative/projeto-verao-semanas/assets/img/exemplo-kettlebell.jpg +0 -0
  441. package/templates/creative/projeto-verao-semanas/page-01.html +168 -0
  442. package/templates/creative/projeto-verao-semanas/preview.jpg +0 -0
  443. package/templates/creative/projeto-verao-semanas/template.json +8 -0
  444. package/templates/creative/promo-relampago-delivery/assets/img/exemplo-hamburguer.jpg +0 -0
  445. package/templates/creative/promo-relampago-delivery/page-01.html +198 -0
  446. package/templates/creative/promo-relampago-delivery/preview.jpg +0 -0
  447. package/templates/creative/promo-relampago-delivery/template.json +8 -0
  448. package/templates/creative/promocao/assets/img/exemplo-tenis.webp +0 -0
  449. package/templates/creative/promocao/page-01.html +167 -0
  450. package/templates/creative/promocao/preview.jpg +0 -0
  451. package/templates/creative/promocao/template.json +8 -0
  452. package/templates/creative/queima-de-estoque/page-01.html +182 -0
  453. package/templates/creative/queima-de-estoque/preview.jpg +0 -0
  454. package/templates/creative/queima-de-estoque/template.json +8 -0
  455. package/templates/creative/resultado-aluno-numeros/page-01.html +173 -0
  456. package/templates/creative/resultado-aluno-numeros/preview.jpg +0 -0
  457. package/templates/creative/resultado-aluno-numeros/template.json +8 -0
  458. package/templates/creative/resultado-com-aviso/assets/img/exemplo-sorriso.jpg +0 -0
  459. package/templates/creative/resultado-com-aviso/page-01.html +145 -0
  460. package/templates/creative/resultado-com-aviso/preview.jpg +0 -0
  461. package/templates/creative/resultado-com-aviso/template.json +8 -0
  462. package/templates/creative/roteiro-um-dia-carrossel/assets/img/exemplo-praia-espelho.jpg +0 -0
  463. package/templates/creative/roteiro-um-dia-carrossel/assets/img/exemplo-vila-trancoso.jpg +0 -0
  464. package/templates/creative/roteiro-um-dia-carrossel/page-01.html +119 -0
  465. package/templates/creative/roteiro-um-dia-carrossel/page-02.html +123 -0
  466. package/templates/creative/roteiro-um-dia-carrossel/page-03.html +125 -0
  467. package/templates/creative/roteiro-um-dia-carrossel/page-04.html +125 -0
  468. package/templates/creative/roteiro-um-dia-carrossel/page-05.html +140 -0
  469. package/templates/creative/roteiro-um-dia-carrossel/preview.jpg +0 -0
  470. package/templates/creative/roteiro-um-dia-carrossel/template.json +8 -0
  471. package/templates/creative/selo-garantia-7-dias/page-01.html +158 -0
  472. package/templates/creative/selo-garantia-7-dias/preview.jpg +0 -0
  473. package/templates/creative/selo-garantia-7-dias/template.json +8 -0
  474. package/templates/creative/sorteio-aniversario/page-01.html +224 -0
  475. package/templates/creative/sorteio-aniversario/preview.jpg +0 -0
  476. package/templates/creative/sorteio-aniversario/template.json +8 -0
  477. package/templates/creative/story-contagem/assets/img/exemplo-pizza.jpg +0 -0
  478. package/templates/creative/story-contagem/page-01.html +135 -0
  479. package/templates/creative/story-contagem/preview.jpg +0 -0
  480. package/templates/creative/story-contagem/template.json +8 -0
  481. package/templates/creative/story-oferta/assets/img/exemplo-fundo-story.jpg +0 -0
  482. package/templates/creative/story-oferta/assets/img/exemplo-produto.webp +0 -0
  483. package/templates/creative/story-oferta/page-01.html +119 -0
  484. package/templates/creative/story-oferta/preview.jpg +0 -0
  485. package/templates/creative/story-oferta/template.json +8 -0
  486. package/templates/creative/tabela-banho-tosa/assets/img/exemplo-shihtzu.webp +0 -0
  487. package/templates/creative/tabela-banho-tosa/page-01.html +171 -0
  488. package/templates/creative/tabela-banho-tosa/preview.jpg +0 -0
  489. package/templates/creative/tabela-banho-tosa/template.json +8 -0
  490. package/templates/creative/tabela-planos-academia/page-01.html +187 -0
  491. package/templates/creative/tabela-planos-academia/preview.jpg +0 -0
  492. package/templates/creative/tabela-planos-academia/template.json +8 -0
  493. package/templates/creative/tabela-precos-servicos/page-01.html +192 -0
  494. package/templates/creative/tabela-precos-servicos/preview.jpg +0 -0
  495. package/templates/creative/tabela-precos-servicos/template.json +8 -0
  496. package/templates/creative/temporada-reservas-banner/assets/img/exemplo-praia.jpg +0 -0
  497. package/templates/creative/temporada-reservas-banner/page-01.html +148 -0
  498. package/templates/creative/temporada-reservas-banner/preview.jpg +0 -0
  499. package/templates/creative/temporada-reservas-banner/template.json +8 -0
  500. package/templates/creative/troca-facil-passos/page-01.html +109 -0
  501. package/templates/creative/troca-facil-passos/page-02.html +107 -0
  502. package/templates/creative/troca-facil-passos/page-03.html +107 -0
  503. package/templates/creative/troca-facil-passos/page-04.html +106 -0
  504. package/templates/creative/troca-facil-passos/preview.jpg +0 -0
  505. package/templates/creative/troca-facil-passos/template.json +8 -0
  506. package/templates/creative/troca-oleo-preco/assets/img/exemplo-galao-oleo.webp +0 -0
  507. package/templates/creative/troca-oleo-preco/page-01.html +178 -0
  508. package/templates/creative/troca-oleo-preco/preview.jpg +0 -0
  509. package/templates/creative/troca-oleo-preco/template.json +8 -0
  510. package/templates/creative/ultimas-vagas-mentoria/assets/img/exemplo-retrato.jpg +0 -0
  511. package/templates/creative/ultimas-vagas-mentoria/page-01.html +140 -0
  512. package/templates/creative/ultimas-vagas-mentoria/preview.jpg +0 -0
  513. package/templates/creative/ultimas-vagas-mentoria/template.json +8 -0
  514. package/templates/creative/vaga-emprego-funcoes/page-01.html +178 -0
  515. package/templates/creative/vaga-emprego-funcoes/preview.jpg +0 -0
  516. package/templates/creative/vaga-emprego-funcoes/template.json +8 -0
  517. package/templates/creative/voltou-ao-estoque/assets/img/exemplo-produto.webp +0 -0
  518. package/templates/creative/voltou-ao-estoque/page-01.html +155 -0
  519. package/templates/creative/voltou-ao-estoque/preview.jpg +0 -0
  520. package/templates/creative/voltou-ao-estoque/template.json +8 -0
  521. package/templates/creative/voucher-presente/assets/img/exemplo-voucher-flor.jpg +0 -0
  522. package/templates/creative/voucher-presente/page-01.html +181 -0
  523. package/templates/creative/voucher-presente/preview.jpg +0 -0
  524. package/templates/creative/voucher-presente/template.json +8 -0
@@ -0,0 +1,56 @@
1
+ function e(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function t(e,t=`|`){return e.map(e=>ue(e)).join(t)}function n(e,t){return typeof t==`bigint`?t.toString():t}var r=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function i(e){return new r(e)}function a(e){return e==null}function o(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function s(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var c=Symbol(`evaluating`);function l(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==c)return r===void 0&&(r=c,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function u(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function d(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function f(e){return d(e._zod.def)??e._zod.def.shape}function p(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return u(this,t,e),e},enumerable:!0,configurable:!0})}function m(e,t,n){t in e?u(e,t,n):e[t]=n}function h(e,t,n,r){let i=f(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?p(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):m(e,a,r?r(n.value,a):n.value))}}function g(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?p(e,n,()=>t[n]):m(e,n,r.value))}}function _(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ee(e){return JSON.stringify(e)}function te(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ne=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ie=i(()=>{if(T.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ae(e){if(re(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return re(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function oe(e){return ae(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var se=new Set([`string`,`number`,`symbol`]);function ce(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function le(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function v(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function ue(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function de(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var fe={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},pe={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function me(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return h(i,e,he(e,t)),le(e,_(n,{shape:i,checks:[]}))}function he(e,t){let n=f(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function ge(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(he(e,t)),a={};return h(a,e,Reflect.ownKeys(f(e)).filter(e=>!i.has(e))),le(e,_(n,{shape:a,checks:[]}))}function _e(e,t){if(!ae(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=f(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return le(e,_(e._zod.def,{shape:ve(e,t)}))}function ve(e,t){let n={};return h(n,e,Reflect.ownKeys(f(e))),g(n,t),n}function ye(e,t){if(!ae(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return le(e,_(e._zod.def,{shape:ve(e,t)}))}function be(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return h(n,e,Reflect.ownKeys(f(e))),h(n,t,Reflect.ownKeys(f(t))),le(e,_(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function xe(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(he(t,n)):void 0,o={};return h(o,t,Reflect.ownKeys(f(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),le(t,_(t._zod.def,{shape:o,checks:[]}))}function y(e,t,n){let r=n?new Set(he(t,n)):void 0,i={};return h(i,t,Reflect.ownKeys(f(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),le(t,_(t._zod.def,{shape:i}))}function b(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Se(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Ce(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function we(e){return typeof e==`string`?e:e?.message}function Te(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Ee(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function x(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:we(e.inst?._zod.def?.error?.(e))??we(a?.(e))??we(t?.error?.(e))??we(n.customError?.(e))??we(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var De=/[\uD800-\uDBFF]/;function Oe(e){let t=e.length;if(!De.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function ke(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ae(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function je(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Me(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Fe(e,n,r.value)}}function Ne(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function S(e,t,n){return Ne(e,t,n,!1)}function Pe(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Ne(this,n,r(this))},set(e){Ne(this,n,e)}})}return t}function Fe(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ne(this,t,n.bind(this))},set(e){Ne(this,t,e)}})}function Ie(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Le,Re=!1,ze={configurable:!0,get(){Re=!0}};function C(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Le!==e._zod){Le=void 0;return}Le=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ze);let e=Re;Re=!1;try{let r=n(this);return Re?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Re||=e,r}catch(n){throw delete this[t],Re||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Be(e,t,n,r){let i=Ie(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Ve=`~constantCatch`;function He(e){let t=()=>e;return t[Ve]=!0,t}var Ue,We=Object.freeze({status:`aborted`}),Ge={value:void 0,enumerable:!1},Ke=`captureStackTrace`in Error?Error:null;function qe(e){let t=Ke;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ke=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function w(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Ge.value=new a(r);try{Object.defineProperty(n,"_zod",Ge)}finally{Ge.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Me(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?qe(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Je=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ye=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ue=globalThis).__zod_globalConfig??(Ue.__zod_globalConfig={});var T=globalThis.__zod_globalConfig;function Xe(e){return e&&Object.assign(T,e),T}function Ze(){let e=this._zod;return e.message??=JSON.stringify(e.def,n,2),e.message}function Qe(e){this._zod.message=e}var $e={get:Ze,set:Qe,enumerable:!0,configurable:!0},et={value:void 0,enumerable:!1},tt=new WeakSet([Object.prototype,Error.prototype]),E=(e,t)=>{e.name=`$ZodError`,et.value=t,Object.defineProperty(e,"issues",et),et.value=void 0,Object.defineProperty(e,"message",$e);let n=Object.getPrototypeOf(e);tt.has(n)||(tt.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},nt=w(`$ZodError`,E);w(`$ZodError`,E,void 0,{Parent:Error});function rt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function it(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?rt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function at(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function ot(e,t){return{callee:t?.callee??e,Err:t?.Err}}var st=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Je;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>x(e,o,Xe())));throw ne(n,a?.callee??t),n}return s.value};return t},ct=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>x(e,o,Xe())));throw ne(n,a?.callee??t),n}return s.value};return t},lt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Je;return a.issues.length?ut(e,a.issues,i):{success:!0,data:a.value}};function ut(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>x(e,n,Xe()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var dt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?ut(e,a.issues,i):{success:!0,data:a.value}},ft=Symbol.for(`zod.compile.invalid`),pt=Symbol.for(`zod.compile.fallback`),mt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==ft)return!0;if(r.definite===!0&&n===void 0)return!1}return ht(e,t,n)});function ht(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[pt]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Je;return a.issues.length===0}var gt=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},_t=e=>{let t=st(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,ot(n,a))};return n},vt=e=>{let t=st(e),n=(e,r,i,a)=>t(e,r,i,ot(n,a));return n},yt=e=>{let t=ct(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,ot(n,a))};return n},bt=e=>{let t=ct(e),n=async(e,r,i,a)=>await t(e,r,i,ot(n,a));return n},xt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return lt(e)(t,n,i)},St=e=>(t,n,r)=>lt(e)(t,n,r),Ct=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return dt(e)(t,n,i)},wt=e=>async(t,n,r)=>dt(e)(t,n,r),Tt=/^[cC][0-9a-z]{6,}$/,Et=/^[0-9a-z]+$/,Dt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ot=/^[0-9a-vA-V]{20}$/,kt=/^[A-Za-z0-9]{27}$/,At=/^[a-zA-Z0-9_-]{21}$/;function jt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Mt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Nt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Pt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ft=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,It=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Lt(){return new RegExp(It,`u`)}var Rt=/^(?:(?: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])$/,zt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Bt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Vt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ht=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ut=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Wt=/^https?$/,Gt=/^\+[1-9]\d{6,14}$/,Kt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function qt(e){return RegExp(`^${e}$`)}var Jt=qt(Kt);function Yt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Xt(e){return RegExp(`^${Yt(e)}$`)}function Zt(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Yt({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Yt({precision:e.precision})}`:n;return RegExp(`^${Kt}T(?:${r})$`)}var Qt=/^[\s\S]{0,}$/,$t=/^-?\d+$/,en=/^-?\d+(?:\.\d+)?$/,tn=/^(?:true|false)$/i,nn=/^null$/i,rn=/^[^A-Z]*$/,an=/^[^a-z]*$/,D=w(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),on=e=>{let t=e.value;return!a(t)&&t.length!==void 0},sn={number:`number`,bigint:`bigint`,object:`date`},cn=w(`$ZodCheckLessThan`,(e,t)=>{D.init(e,t);let n=sn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:sn[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ln=w(`$ZodCheckGreaterThan`,(e,t)=>{D.init(e,t);let n=sn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:sn[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),un=w(`$ZodCheckMultipleOf`,(e,t)=>{D.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):s(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),dn=w(`$ZodCheckNumberFormat`,(e,t)=>{D.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=fe[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),fn=w(`$ZodCheckMaxLength`,(e,t)=>{var n;D.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Oe(r):i)<=t.maximum)return;let a=ke(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pn=w(`$ZodCheckMinLength`,(e,t)=>{var n;D.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Oe(r):i)>=t.minimum)return;let a=ke(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mn=w(`$ZodCheckLengthEquals`,(e,t)=>{var n;D.init(e,t),(n=e._zod.def).when??(n.when=on),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Oe(r):i;if(a===t.length)return;let o=ke(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),hn=w(`$ZodCheckStringFormat`,(e,t)=>{var n,r;D.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),gn=w(`$ZodCheckRegex`,(e,t)=>{hn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),_n=w(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=rn,hn.init(e,t)}),vn=w(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=an,hn.init(e,t)}),yn=w(`$ZodCheckIncludes`,(e,t)=>{D.init(e,t);let n=ce(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),bn=w(`$ZodCheckStartsWith`,(e,t)=>{D.init(e,t);let n=RegExp(`^${ce(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),xn=w(`$ZodCheckEndsWith`,(e,t)=>{D.init(e,t);let n=RegExp(`.*${ce(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Sn=w(`$ZodCheckOverwrite`,(e,t)=>{D.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Cn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
3
+ `)}\n};`)(...Object.values(this.closed))}},wn={major:4,minor:6,patch:7},O=w(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=wn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=b(t),a;for(let o of n){if(o._zod.def.when){if(Se(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Je;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ee(t.issues,n,e),i||=b(t,n))});else{if(t.issues.length===n)continue;Ee(t.issues,n,e),i||=b(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(b(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Je;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Je;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return S(this,`~standard`,Dn(this))},set"~standard"(e){Ne(this,`~standard`,e)}}),Tn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>x(e,t,Xe()))}:{value:e.value};async function En(e,t){let n={async:!0};return Tn(await e._zod.run({value:t,issues:[]},n),n)}function Dn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Tn(r,n)}catch{}return En(e,t)},vendor:`zod`,version:1}}var On=w(`$ZodString`,(e,t)=>{O.init(e,t),e._zod.pattern=t.pattern??Qt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),k=w(`$ZodStringFormat`,(e,t)=>{hn.init(e,t),On.init(e,t)}),kn=w(`$ZodGUID`,(e,t)=>{t.pattern??=Nt,k.init(e,t)}),An=w(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Pt(e)}else t.pattern??=Pt();k.init(e,t)}),jn=w(`$ZodEmail`,(e,t)=>{t.pattern??=Ft,k.init(e,t)});function Mn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Nn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Mn(e)||2:Pn(e,t)}function Pn(e,t){if(!t.normalize&&t.protocol?.source===Wt.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Fn=/[\t\n\r]/g;function In(e){return e.replace(Fn,``)}function Ln(e,t){return t.lastIndex=0,t.test(e.hostname)}function Rn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var zn=w(`$ZodURL`,(e,t)=>{k.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Nn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=In(r);return}t.hostname&&!Ln(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Rn(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:In(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Bn=w(`$ZodEmoji`,(e,t)=>{t.pattern??=Lt(),k.init(e,t)}),Vn=w(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?At:jt(t.length),k.init(e,t)}),Hn=w(`$ZodCUID`,(e,t)=>{t.pattern??=Tt,k.init(e,t)}),Un=w(`$ZodCUID2`,(e,t)=>{t.pattern??=Et,k.init(e,t)}),Wn=w(`$ZodULID`,(e,t)=>{t.pattern??=Dt,k.init(e,t)}),Gn=w(`$ZodXID`,(e,t)=>{t.pattern??=Ot,k.init(e,t)}),Kn=w(`$ZodKSUID`,(e,t)=>{t.pattern??=kt,k.init(e,t)}),qn=w(`$ZodISODateTime`,(e,t)=>{t.pattern??=Zt(t),k.init(e,t)}),Jn=w(`$ZodISODate`,(e,t)=>{t.pattern??=Jt,k.init(e,t)}),Yn=w(`$ZodISOTime`,(e,t)=>{t.pattern??=Xt(t),k.init(e,t)}),Xn=w(`$ZodISODuration`,(e,t)=>{t.pattern??=Mt,k.init(e,t)}),Zn=w(`$ZodIPv4`,(e,t)=>{t.pattern??=Rt,k.init(e,t)}),Qn=/^[0-9a-fA-F:.]+$/;function $n(e){return Qn.test(e)?Mn(`http://[${e}]`):!1}var er=w(`$ZodIPv6`,(e,t)=>{t.pattern??=zt,k.init(e,t),e._zod.check=n=>{$n(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),tr=w(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Bt,k.init(e,t)});function nr(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:$n(n)}var rr=w(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Vt,k.init(e,t),e._zod.check=n=>{nr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function ir(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ar=/^[0-9a-zA-Z+/]*={0,2}$/,or=w(`$ZodBase64`,(e,t)=>{t.pattern??=ar,k.init(e,t),e._zod.check=n=>{ir(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),sr=/^[A-Za-z0-9_-]*$/;function cr(e){if(!sr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return ir(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var lr=w(`$ZodBase64URL`,(e,t)=>{t.pattern??=sr,k.init(e,t),e._zod.check=n=>{cr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),ur=w(`$ZodE164`,(e,t)=>{t.pattern??=Gt,k.init(e,t)});function dr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var fr=w(`$ZodJWT`,(e,t)=>{k.init(e,t),e._zod.check=n=>{dr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),pr=w(`$ZodNumber`,(e,t)=>{O.init(e,t),e._zod.pattern=en,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),mr=w(`$ZodNumberFormat`,(e,t)=>{dn.init(e,t),pr.init(e,t)}),hr=w(`$ZodBoolean`,(e,t)=>{O.init(e,t),e._zod.pattern=tn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),gr=w(`$ZodNull`,(e,t)=>{O.init(e,t),e._zod.pattern=nn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),_r=w(`$ZodAny`,(e,t)=>{O.init(e,t),e._zod.parse=e=>e}),vr=w(`$ZodUnknown`,(e,t)=>{O.init(e,t),e._zod.parse=e=>e}),yr=w(`$ZodNever`,(e,t)=>{O.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function br(e,t){let n=Te(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Te(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Ee(n.issues,t,e),n}}return i(n,a)}}var xr=e=>Array.isArray(e)?e.length:-1;function Sr(e,t,n){e.issues.length&&t.issues.push(...Ce(n,e.issues)),t.value[n]=e.value}var Cr=w(`$ZodArray`,(e,t)=>{O.init(e,t);let n=T.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Sr(t,r,e)));else if(Sr(c,r,e),s&&c.issues.length!==0&&b(c))break}return o.length?Promise.all(o).then(()=>r):r},br(e,xr)});function wr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Ce(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Tr=[];function Er(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Tr,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=de(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Dr(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(b(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>wr(e,n,i,t,d,f))):wr(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Or=w(`$ZodObject`,(e,t)=>{O.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let a=i(()=>Er(t));C(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||u(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let o=re,s=t.catchall,c,l=T.memoizer;l?.attach(e),e._zod.parse=(t,n)=>{c??=a.value;let r=t.value;if(!o(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=l?l.alloc(e,t,{},n):{};let i=[],u=c.shape,d=n?.abortEarly,f=t.issues.length;for(let e of c.allKeys){if(d&&t.issues.length!==f){if(b(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let a=u[e],o=a._zod.optin,s=a._zod.optout,c=a._zod.run({value:r[e],issues:[]},n);c instanceof Promise?i.push(c.then(n=>wr(n,t,e,r,o,s))):wr(c,t,e,r,o,s)}return s?Dr(i,r,t,n,a.value,e,d===!0):i.length?Promise.all(i).then(()=>t):t}}),kr=w(`$ZodObjectJIT`,(e,t)=>{Or.init(e,t);let n=e._zod.parse,r=i(()=>Er(t)),a=T.memoizer,o=t=>{let n=r.value,i=n.symbolKeys,o=new Cn([`payload`,`ctx`],{shape:t,inst:e,memo:a,syms:i}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
4
+ let ${e}_ab = false;
5
+ for (let i = 0; i < ${e}.issues.length; i++) {
6
+ const iss = ${e}.issues[i];
7
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
8
+ payload.issues.push(iss);
9
+ if (iss.continue !== true) ${e}_ab = true;
10
+ }
11
+ if (${e}_ab && ctx && ctx.abortEarly) {
12
+ payload.value = newResult;
13
+ return payload;
14
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(a?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${i.indexOf(e)}]`:ee(e),a=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
15
+ const ${n}_present = ${a};
16
+ if (!${n}.issues.length || ${n}_present) {
17
+ if (${n}.issues.length) {${c(n,r)}
18
+ }
19
+
20
+ if (${e}) {
21
+ newResult[${r}] = ${n}.value;
22
+ }
23
+ }
24
+
25
+ `)}else f?(o.write(`
26
+ if (${n}.issues.length) {${c(n,r)}
27
+ }
28
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
29
+ if (${n}.value !== undefined || ${a}) {
30
+ newResult[${r}] = ${n}.value;
31
+ }
32
+ `)):o.write(`
33
+ const ${n}_present = ${a};
34
+ if (${n}.issues.length) {${c(n,r)}
35
+ }
36
+ if (!${n}_present && !${n}.issues.length) {
37
+ payload.issues.push({
38
+ code: "invalid_type",
39
+ expected: "nonoptional",
40
+ input: undefined,
41
+ path: [${r}]
42
+ });
43
+ if (ctx && ctx.abortEarly) {
44
+ payload.value = newResult;
45
+ return payload;
46
+ }
47
+ }
48
+
49
+ if (${n}_present) {
50
+ newResult[${r}] = ${n}.value;
51
+ }
52
+
53
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},s,c=re,l=!T.jitless,u=l&&ie.value,d=t.catchall,f;e._zod.parse=(i,a)=>{f??=r.value;let p=i.value;return c(p)?l&&u&&a?.async===!1&&a.jitless!==!0?(s||=o(t.shape),i=s(i,a),d?Dr([],p,i,a,f,e,a?.abortEarly===!0):i):n(i,a):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Ar(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!b(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>x(e,r,Xe())))}),t)}var jr=w(`$ZodUnion`,(e,t)=>{O.init(e,t),C(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),C(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),C(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),C(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>o(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Ar(t,r,e,i)):Ar(o,r,e,i)}});function Mr(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Nr=w(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,jr.init(e,t);let n=e._zod.parse;C(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||u(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=d(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=i(()=>Mr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!re(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Pr=w(`$ZodIntersection`,(e,t)=>{O.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Ir(e,t,n)):Ir(e,i,a)}});function Fr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ae(e)&&ae(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Fr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Fr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ir(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Fr(t.value,n.value);if(!c.valid){if(b(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Lr=w(`$ZodRecord`,(e,t)=>{O.init(e,t);let n=T.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ae(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>x(e,i,Xe())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Ce(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Ce(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e))if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e);l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&en.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>x(e,i,Xe())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Ce(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Ce(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Rr=w(`$ZodEnum`,(t,n)=>{O.init(t,n);let r=e(n.entries),i=new Set(r);t._zod.values=i,C(t,`pattern`,t=>{let n=e(t.def.entries).filter(e=>se.has(typeof e));return RegExp(n.length?`^(${n.map(e=>ce(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),t._zod.parse=(e,n)=>{let a=e.value;return i.has(a)||e.issues.push({code:`invalid_value`,values:r,input:a,inst:t}),e}}),zr=w(`$ZodLiteral`,(e,t)=>{O.init(e,t);let n=new Set(t.values);e._zod.values=n,C(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?ce(e):e?ce(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Br=w(`$ZodTransform`,(e,t)=>{O.init(e,t),e._zod.optin=`optional`,T.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ye(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Je;return n.value=i,n}});function Vr(e,t){return e.value=t.issues.length?void 0:t.value,e}var Hr=w(`$ZodOptional`,(e,t)=>{O.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,C(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),C(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${o(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Vr(e,t)):Vr(e,r)}return t.innerType._zod.run(e,n)}}),Ur=w(`$ZodExactOptional`,(e,t)=>{Hr.init(e,t),C(e,`values`,e=>e.def.innerType._zod.values),C(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Wr=w(`$ZodNullable`,(e,t)=>{O.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin),C(e,`optout`,e=>e.def.innerType._zod.optout),C(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${o(t.source)}|null)$`):void 0}),C(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Gr=w(`$ZodDefault`,(e,t)=>{O.init(e,t),e._zod.optin=`defaulted`,C(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Kr(e,t)):Kr(r,t)}});function Kr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var qr=w(`$ZodPrefault`,(e,t)=>{O.init(e,t),e._zod.optin=`defaulted`,C(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Jr=w(`$ZodNonOptional`,(e,t)=>{O.init(e,t),C(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Yr(t,e)):Yr(i,e)}});function Yr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Xr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>x(e,r,Xe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Zr=w(`$ZodCatch`,(e,t)=>{O.init(e,t),C(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),C(e,`optout`,e=>e.def.innerType._zod.optout),C(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Xr(e,r,t,n)):Xr(e,r,t,n)}}),Qr=w(`$ZodPipe`,(e,t)=>{O.init(e,t),C(e,`values`,e=>e.def.in._zod.values),C(e,`optin`,e=>e.def.in._zod.optin),C(e,`optout`,e=>e.def.out._zod.optout),C(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>$r(e,t.in,n)):$r(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>$r(e,t.out,n)):$r(r,t.out,n)}});function $r(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ei=w(`$ZodPreprocess`,(e,t)=>{Qr.init(e,t)}),ti=w(`$ZodReadonly`,(e,t)=>{O.init(e,t),C(e,`propValues`,e=>e.def.innerType._zod.propValues),C(e,`values`,e=>e.def.innerType._zod.values),C(e,`optin`,e=>e.def.innerType?._zod?.optin),C(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ni):ni(r)}});function ni(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ri=w(`$ZodLazy`,(e,t)=>{O.init(e,t),l(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),C(e,`pattern`,e=>e.innerType?._zod?.pattern),C(e,`propValues`,e=>e.innerType?._zod?.propValues),C(e,`optin`,e=>e.innerType?._zod?.optin??void 0),C(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),ii=w(`$ZodCustom`,(e,t)=>{D.init(e,t),O.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ai(t,n,r,e));ai(i,n,r,e)}});function ai(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(je(e))}}var oi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},si=`~memo`,ci=[];function li(e){return typeof e==`object`&&!!e}function ui(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var di=new WeakMap,fi=0,pi=1,mi=2;function hi(e,t,n){let r=di.get(e);if(r!==void 0)return r?mi:fi;if(t.has(e))return mi;t.add(e);let i=fi,a=e=>{if(i!==mi&&e?._zod){let r=hi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=fi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?pi:o.value?._zod?hi(o.value,t,n):fi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=d(c);s(e?o(e,!0):pi),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?hi(r,t,!1):pi);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),gi(e,i)}function gi(e,t){return t!==pi&&di.set(e,t===mi),t}function _i(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var vi,yi=[],bi={alloc(e,t,n){let r=vi;if(!r)return n;vi=void 0;let i={value:n,issues:null};return r.set(t.value,i),yi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Si(n,e.value))throw new oi;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=hi(e,new Set,!1);if(i===fi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===mi||r?n=!0:r=!0}let l=s.value;if(!li(l))return t(s,c);let u=c[si];u||(u={buckets:new WeakMap,backEdges:void 0},c[si]=u);let d;i===c?d=a:(d=_i(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...ui(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;vi=d;let p=yi.length,m=t(s,c);vi=void 0;let h=yi.length>p?yi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?ui(e.issues):ci),e)):(h&&(h.issues=m.issues.length?ui(m.issues):ci),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function xi(){return bi}function Si(e,t){let n=e[si]?.backEdges;return n!==void 0&&li(t)&&n.has(t)}var Ci=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function n(t){return e[t]??null}let r={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},i={nan:`NaN`};function a(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):i[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${a(e.expected)}, received ${a(Ae(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${ue(e.values[0])}`:`Invalid option: expected one of ${t(e.values,`|`)}`;case`too_big`:{let t=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=n(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${t}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${t}${e.maximum.toString()}`}case`too_small`:{let t=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=n(e.origin);return r?`Too small: expected ${e.origin} to have ${t}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${t}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${r[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${t(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function wi(){return{localeError:Ci()}}var Ti,Ei=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Di(){return new Ei}(Ti=globalThis).__zod_globalRegistry??(Ti.__zod_globalRegistry=Di());var Oi=globalThis.__zod_globalRegistry;function ki(e){return e.checks&&=[...e.checks],e}function Ai(e,t){return new e(ki({type:`string`,...v(t)}))}function ji(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...v(t)})}function Mi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...v(t)})}function Ni(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...v(t)})}function Pi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...v(t)})}function Fi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...v(t)})}function Ii(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...v(t)})}function Li(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...v(t)})}function Ri(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...v(t)})}function zi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...v(t)})}function Bi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...v(t)})}function Vi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...v(t)})}function Hi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...v(t)})}function Ui(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...v(t)})}function Wi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...v(t)})}function Gi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...v(t)})}function Ki(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...v(t)})}function qi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...v(t)})}function Ji(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...v(t)})}function Yi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...v(t)})}function Xi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...v(t)})}function Zi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...v(t)})}function Qi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...v(t)})}function $i(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...v(t)})}function ea(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...v(t)})}function ta(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...v(t)})}function na(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...v(t)})}function ra(e,t){return new e(ki({type:`number`,checks:[],...v(t)}))}function ia(e,t){return new e(ki({type:`number`,coerce:!0,checks:[],...v(t)}))}function aa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...v(t)})}function oa(e,t){return new e({type:`boolean`,...v(t)})}function sa(e,t){return new e({type:`null`,...v(t)})}function ca(e){return new e({type:`any`})}function la(e){return new e({type:`unknown`})}function ua(e,t){return new e({type:`never`,...v(t)})}function da(e,t){return new cn({check:`less_than`,...v(t),value:e,inclusive:!1})}function fa(e,t){return new cn({check:`less_than`,...v(t),value:e,inclusive:!0})}function pa(e,t){return new ln({check:`greater_than`,...v(t),value:e,inclusive:!1})}function ma(e,t){return new ln({check:`greater_than`,...v(t),value:e,inclusive:!0})}function ha(e,t){return new un({check:`multiple_of`,...v(t),value:e})}function ga(e,t){return new fn({check:`max_length`,...v(t),maximum:e})}function _a(e,t){return new pn({check:`min_length`,...v(t),minimum:e})}function va(e,t){return new mn({check:`length_equals`,...v(t),length:e})}function ya(e,t){return new gn({check:`string_format`,format:`regex`,...v(t),pattern:e})}function ba(e){return new _n({check:`string_format`,format:`lowercase`,...v(e)})}function xa(e){return new vn({check:`string_format`,format:`uppercase`,...v(e)})}function Sa(e,t){return new yn({check:`string_format`,format:`includes`,...v(t),includes:e})}function Ca(e,t){return new bn({check:`string_format`,format:`starts_with`,...v(t),prefix:e})}function wa(e,t){return new xn({check:`string_format`,format:`ends_with`,...v(t),suffix:e})}function Ta(e){return new Sn({check:`overwrite`,tx:e})}function Ea(e){return Ta(t=>t.normalize(e))}function Da(){return Ta(e=>e.trim())}function Oa(){return Ta(e=>e.toLowerCase())}function ka(){return Ta(e=>e.toUpperCase())}function Aa(){return Ta(e=>te(e))}function ja(e,t,n){return new e({type:`array`,element:t,...v(n)})}function Ma(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...v(n)})}function Na(e,t){let n=Pa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(je(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(je(r))}},e(t.value,t)),t);return n}function Pa(e,t){let n=new D({check:`custom`,...v(t)});return n._zod.check=e,n}function Fa(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&u(e,t,n[t]);return e}function Ia(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Oi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function A(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function j(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,j(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Fa(o.schema,c),t.io===`input`&&Ka(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function La(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ra(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${La(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+La(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
54
+
55
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function za(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;za(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ba=new Set([`type`,`properties`,`required`,`additionalProperties`]),Va=[`oneOf`,`anyOf`];function Ha(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Ua(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ba.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ha(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}u(n,r,e.length===1?e[0]:Ua(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ha(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Wa(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ba)if(t in e)return;let n=t.filter(e=>Va.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Ua(t);else{let e=n[0],i=Va.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Ua([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Fa(e,r))}function Ga(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Fa(i,s),Fa(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())za(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Wa(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Fa(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,u(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Ja(t,`input`,e.processors),output:Ja(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Ka(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Ka(r.element,n);if(r.type===`set`)return Ka(r.valueType,n);if(r.type===`lazy`)return Ka(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return Ka(r.innerType,n);if(r.type===`intersection`)return Ka(r.left,n)||Ka(r.right,n);if(r.type===`record`||r.type===`map`)return Ka(r.keyType,n)||Ka(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Ka(r.in,n)||Ka(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Ka(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Ka(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Ka(e,n))return!0;return!!(r.rest&&Ka(r.rest,n))}return!1}var qa=(e,t={})=>n=>{let r=Ia({...n,processors:t});return j(e,r),Ra(r,e),Ga(r,e)},Ja=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ia({...i??{},target:a,io:t,processors:n});return j(e,o),Ra(o,e),Ga(o,e)},Ya=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Xa=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Za=(e,t)=>{Ya(e,`minimum`,t),Xa(e,`maximum`,t)},Qa=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},$a=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},eo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},to=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},no=(e,t)=>Ya(e,`minimum`,t.minimum),ro=(e,t)=>Xa(e,`maximum`,t.maximum),io=e=>(t,n)=>{to(t,n.format);let[r,i]=e[n.format];Ya(t,`minimum`,r),Xa(t,`maximum`,i)},ao={greater_than:(e,t)=>Ya(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Xa(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Qa(e,t.value),number_format:io(fe),bigint_format:io(pe),min_length:no,max_length:ro,length_equals:(e,t)=>Za(e,t.length),min_size:no,max_size:ro,size_equals:(e,t)=>Za(e,t.size),string_format:(e,t)=>{to(e,t.format),t.pattern&&$a(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>eo(e,t.mime)};function oo(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)ao[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Ya(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Ya(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Xa(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Xa(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Qa(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&eo(t,i.mime);for(let e of i.patterns??[])$a(t,e);return t}var so={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},co=new Map([[ar,Ht],[sr,Ut]]),lo=e=>co.get(e)??e,uo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=oo(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=so[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(lo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},fo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=oo(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):A(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},po=(e,t,n,r)=>{n.type=`boolean`},mo=(e,t,n,r)=>{A(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},ho=(e,t,n,r)=>{A(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},go=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},_o=(e,t,n,r)=>{A(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},vo=(e,t,n,r)=>{A(e,t,n,r,`Void cannot be represented in JSON Schema`)},yo=(e,t,n,r)=>{n.not={}},bo=(e,t,n,r)=>{},xo=(e,t,n,r)=>{},So=(e,t,n,r)=>{A(e,t,n,r,`Date cannot be represented in JSON Schema`)},Co=(t,n,r,i)=>{let a=t._zod.def,o=e(a.entries);if(o.length===0){r.not={};return}o.every(e=>typeof e==`number`)&&(r.type=`number`),o.every(e=>typeof e==`string`)&&(r.type=`string`),r.enum=o},wo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(A(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(A(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},To=(e,t,n,r)=>{A(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Eo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Do=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=oo(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},Oo=(e,t,n,r)=>{n.type=`boolean`},ko=(e,t,n,r)=>{A(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Ao=(e,t,n,r)=>{A(e,t,n,r,`Function types cannot be represented in JSON Schema`)},jo=(e,t,n,r)=>{A(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Mo=(e,t,n,r)=>{A(e,t,n,r,`Map cannot be represented in JSON Schema`)},No=(e,t,n,r)=>{A(e,t,n,r,`Set cannot be represented in JSON Schema`)},Po=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=oo(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=j(a.element,t,{...r,path:[...r.path,`items`]})};function Fo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Fo(t.out):t.type===`catch`?Fo(t.innerType):e._zod.optin}var Io=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&A(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)u(i.properties,e,j(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Fo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=j(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Lo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>j(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ro=(e,t,n,r)=>{let i=e._zod.def,a=j(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=j(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},zo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>j(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?j(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Fo(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=oo(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Bo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Bo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Bo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?en:$t).source),p):p}var Vo=new WeakMap;function Ho(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Vo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Bo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Uo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=oo(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=j(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)u(i.patternProperties,lo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=j(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Vo.get(t);n||(n=[],Vo.set(t,n),t.deferred.push(()=>Ho(t))),n.push(e)}i.additionalProperties=j(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Fo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Wo=(e,t,n,r)=>{let i=e._zod.def,a=j(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Go=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ko=Symbol();function qo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(A(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ko):JSON.parse(o)}var Jo=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=qo(i.defaultValue,e,t,n,r);o!==Ko&&(n.default=o)},Yo=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=qo(i.defaultValue,e,t,n,r);o!==Ko&&(n._prefault=o)},Xo=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{A(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Zo=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;j(o,t,r);let s=t.seen.get(e);s.ref=o},Qo=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},$o=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},es=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ts=(e,t,n,r)=>{let i=e._zod.innerType;j(i,t,r);let a=t.seen.get(e);a.ref=i},ns={string:uo,number:fo,boolean:po,bigint:mo,symbol:ho,null:go,undefined:_o,void:vo,never:yo,any:bo,unknown:xo,date:So,enum:Co,literal:wo,nan:To,template_literal:Eo,file:Do,success:Oo,custom:ko,function:Ao,transform:jo,map:Mo,set:No,array:Po,object:Io,union:Lo,intersection:Ro,tuple:zo,record:Uo,nullable:Wo,nonoptional:Go,default:Jo,prefault:Yo,catch:Xo,pipe:Zo,readonly:Qo,promise:$o,optional:es,lazy:ts};function rs(e,t){if(`_idmap`in e){let n=e,r=Ia({...t,processors:ns}),i={};for(let e of n._idmap.entries()){let[t,n]=e;j(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;Ra(r,n),u(a,t,Ga(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ia({...t,processors:ns});return j(e,n),Ra(n,e),Ga(n,e)}var is=new WeakSet([Object.prototype,Error.prototype]);function as(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var os=w(`ZodError`,(e,t)=>{nt.init(e,t),e.name=`ZodError`;let r=Object.getPrototypeOf(e);is.has(r)||(is.add(r),as(r,`format`,e=>t=>at(e,t)),as(r,`flatten`,e=>t=>it(e,t)),as(r,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,n,2)}),as(r,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,n,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),ss=st(os),cs=ct(os),ls=lt(os),us=dt(os),ds=_t(os),fs=vt(os),ps=yt(os),ms=bt(os),hs=xt(os),gs=St(os),_s=Ct(os),vs=wt(os);function ys(){T.localeError||Xe(wi())}function bs(){T.memoizer||Xe({memoizer:xi()})}var M=w(`ZodType`,(e,t)=>(ys(),O.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(_(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return le(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Rc(e,t))},superRefine(e,t){return this.check(zc(e,t))},overwrite(e){return this.check(Ta(e))},optional(){return G(this)},exactOptional(){return yc(this)},nullable(){return xc(this)},nullish(){return G(xc(this))},nonoptional(e){return Dc(this,e)},array(){return R(this)},or(e){return V([this,e])},and(e){return dc(this,e)},transform(e){return jc(this,gc(e))},default(e){return Cc(this,e)},prefault(e){return Tc(this,e)},catch(e){return kc(this,e)},pipe(e){return jc(this,e)},readonly(){return Pc(this)},describe(e){let t=this.clone();return Oi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Oi.get(this);let t=this.clone();return Oi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return S(this,`~standard`,{...Dn(this),jsonSchema:{input:Ja(this,`input`),output:Ja(this,`output`)}})},set"~standard"(e){Ne(this,`~standard`,e)},parse:function e(t,n){return ss(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await cs(this,t,n,{callee:e})},safeParse(e,t){return ls(this,e,t)},async safeParseAsync(e,t){return us(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ne(this,`spa`,e)},validate(e,t){return mt(this,e,t)},validateAsync(e,t){return gt(this,e,t)},encode:function e(t,n){return ds(this,t,n,{callee:e})},decode:function e(t,n){return fs(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ps(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await ms(this,t,n,{callee:e})},safeEncode(e,t){return hs(this,e,t)},safeDecode(e,t){return gs(this,e,t)},async safeEncodeAsync(e,t){return _s(this,e,t)},async safeDecodeAsync(e,t){return vs(this,e,t)},toJSONSchema(e){return qa(this,{})(e)},get description(){return Oi.get(this)?.description},get _def(){return this._zod.def}}),xs=w(`_ZodString`,(e,t)=>{On.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r)},Pe({format:e=>oo(e).format??null,minLength:e=>oo(e).minimum??null,maxLength:e=>oo(e).maximum??null},{regex(...e){return this.check(ya(...e))},includes(...e){return this.check(Sa(...e))},startsWith(...e){return this.check(Ca(...e))},endsWith(...e){return this.check(wa(...e))},min(...e){return this.check(_a(...e))},max(...e){return this.check(ga(...e))},length(...e){return this.check(va(...e))},nonempty(...e){return this.check(_a(1,...e))},lowercase(e){return this.check(ba(e))},uppercase(e){return this.check(xa(e))},trim(){return this.check(Da())},normalize(...e){return this.check(Ea(...e))},toLowerCase(){return this.check(Oa())},toUpperCase(){return this.check(ka())},slugify(){return this.check(Aa())}})),Ss=w(`ZodString`,(e,t)=>{On.init(e,t),xs.init(e,t)},{email(e){return this.check(ji(Ds,e))},url(e){return this.check(Li(js,e))},jwt(e){return this.check(Qi(qs,e))},emoji(e){return this.check(Ri(Ns,e))},guid(e){return this.check(Mi(ks,e))},uuid(e){return this.check(Ni(As,e))},uuidv4(e){return this.check(Pi(As,e))},uuidv6(e){return this.check(Fi(As,e))},uuidv7(e){return this.check(Ii(As,e))},nanoid(e){return this.check(zi(Ps,e))},cuid(e){return this.check(Bi(Fs,e))},cuid2(e){return this.check(Vi(Is,e))},ulid(e){return this.check(Hi(Ls,e))},base64(e){return this.check(Yi(Ws,e))},base64url(e){return this.check(Xi(Gs,e))},xid(e){return this.check(Ui(Rs,e))},ksuid(e){return this.check(Wi(zs,e))},ipv4(e){return this.check(Gi(Bs,e))},ipv6(e){return this.check(Ki(Vs,e))},cidrv4(e){return this.check(qi(Hs,e))},cidrv6(e){return this.check(Ji(Us,e))},e164(e){return this.check(Zi(Ks,e))},datetime(e){return this.check($i(Cs,e))},date(e){return this.check(ea(ws,e))},time(e){return this.check(ta(Ts,e))},duration(e){return this.check(na(Es,e))}});function N(e){return Ai(Ss,e)}var P=w(`ZodStringFormat`,(e,t)=>{k.init(e,t),xs.init(e,t)}),Cs=w(`ZodISODateTime`,(e,t)=>{qn.init(e,t),P.init(e,t)}),ws=w(`ZodISODate`,(e,t)=>{Jn.init(e,t),P.init(e,t)}),Ts=w(`ZodISOTime`,(e,t)=>{Yn.init(e,t),P.init(e,t)}),Es=w(`ZodISODuration`,(e,t)=>{Xn.init(e,t),P.init(e,t)}),Ds=w(`ZodEmail`,(e,t)=>{jn.init(e,t),P.init(e,t)});function Os(e){return ji(Ds,e)}var ks=w(`ZodGUID`,(e,t)=>{kn.init(e,t),P.init(e,t)}),As=w(`ZodUUID`,(e,t)=>{An.init(e,t),P.init(e,t)}),js=w(`ZodURL`,(e,t)=>{zn.init(e,t),P.init(e,t)});function Ms(e){return Li(js,e)}var Ns=w(`ZodEmoji`,(e,t)=>{Bn.init(e,t),P.init(e,t)}),Ps=w(`ZodNanoID`,(e,t)=>{Vn.init(e,t),P.init(e,t)}),Fs=w(`ZodCUID`,(e,t)=>{Hn.init(e,t),P.init(e,t)}),Is=w(`ZodCUID2`,(e,t)=>{Un.init(e,t),P.init(e,t)}),Ls=w(`ZodULID`,(e,t)=>{Wn.init(e,t),P.init(e,t)}),Rs=w(`ZodXID`,(e,t)=>{Gn.init(e,t),P.init(e,t)}),zs=w(`ZodKSUID`,(e,t)=>{Kn.init(e,t),P.init(e,t)}),Bs=w(`ZodIPv4`,(e,t)=>{Zn.init(e,t),P.init(e,t)}),Vs=w(`ZodIPv6`,(e,t)=>{er.init(e,t),P.init(e,t)}),Hs=w(`ZodCIDRv4`,(e,t)=>{tr.init(e,t),P.init(e,t)}),Us=w(`ZodCIDRv6`,(e,t)=>{rr.init(e,t),P.init(e,t)}),Ws=w(`ZodBase64`,(e,t)=>{or.init(e,t),P.init(e,t)}),Gs=w(`ZodBase64URL`,(e,t)=>{lr.init(e,t),P.init(e,t)}),Ks=w(`ZodE164`,(e,t)=>{ur.init(e,t),P.init(e,t)}),qs=w(`ZodJWT`,(e,t)=>{fr.init(e,t),P.init(e,t)}),Js=w(`ZodNumber`,(e,t)=>{pr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.isFinite=!0},Pe({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=oo(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=oo(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=oo(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>oo(e).format??null},{gt(e,t){return this.check(pa(e,t))},gte(e,t){return this.check(ma(e,t))},min(e,t){return this.check(ma(e,t))},lt(e,t){return this.check(da(e,t))},lte(e,t){return this.check(fa(e,t))},max(e,t){return this.check(fa(e,t))},int(e){return this.check(Xs(e))},safe(e){return this.check(Xs(e))},positive(e){return this.check(pa(0,e))},nonnegative(e){return this.check(ma(0,e))},negative(e){return this.check(da(0,e))},nonpositive(e){return this.check(fa(0,e))},multipleOf(e,t){return this.check(ha(e,t))},step(e,t){return this.check(ha(e,t))},finite(){return this}}));function F(e){return ra(Js,e)}var Ys=w(`ZodNumberFormat`,(e,t)=>{mr.init(e,t),Js.init(e,t)});function Xs(e){return aa(Ys,e)}var Zs=w(`ZodBoolean`,(e,t)=>{hr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r)});function I(e){return oa(Zs,e)}var Qs=w(`ZodNull`,(e,t)=>{gr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r)});function $s(e){return sa(Qs,e)}var ec=w(`ZodAny`,(e,t)=>{_r.init(e,t),M.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function tc(){return ca(ec)}var nc=w(`ZodUnknown`,(e,t)=>{vr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function L(){return la(nc)}var rc=w(`ZodNever`,(e,t)=>{yr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r)});function ic(e){return ua(rc,e)}var ac=w(`ZodArray`,(e,t)=>{bs(),Cr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.element=t.element},{min(e,t){return this.check(_a(e,t))},nonempty(e){return this.check(_a(1,e))},max(e,t){return this.check(ga(e,t))},length(e,t){return this.check(va(e,t))},unwrap(){return this.element}});function R(e,t){return ja(ac,e,t)}var oc=w(`ZodObject`,(e,t)=>{bs(),kr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Io(e,t,n,r),Be(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return U(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(_(this._zod.def,{catchall:e}))},passthrough(){return this.clone(_(this._zod.def,{catchall:L()}))},loose(){return this.clone(_(this._zod.def,{catchall:L()}))},strict(){return this.clone(_(this._zod.def,{catchall:ic()}))},strip(){return this.clone(_(this._zod.def,{catchall:void 0}))},extend(e){return _e(this,e)},safeExtend(e){return ye(this,e)},merge(e){return be(this,e)},pick(e){return me(this,e)},omit(e){return ge(this,e)},partial(...e){return xe(_c,this,e[0])},exactPartial(...e){return xe(vc,this,e[0],`exactPartial`)},required(...e){return y(Ec,this,e[0])}});function z(e,t){return new oc({type:`object`,shape:e??{},...v(t)})}function B(e,t){return new oc({type:`object`,shape:e,catchall:L(),...v(t)})}var sc=w(`ZodUnion`,(e,t)=>{jr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),e.options=t.options});function V(e,t){return new sc({type:`union`,options:e,...v(t)})}var cc=w(`ZodDiscriminatedUnion`,(e,t)=>{sc.init(e,t),Nr.init(e,t)});function lc(e,t,n){return new cc({type:`union`,options:t,discriminator:e,...v(n)})}var uc=w(`ZodIntersection`,(e,t)=>{Pr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r)});function dc(e,t){return new uc({type:`intersection`,left:e,right:t})}var fc=w(`ZodRecord`,(e,t)=>{bs(),Lr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function H(e,t,n){return!t||!t._zod?new fc({type:`record`,keyType:N(),valueType:e,...v(t)}):new fc({type:`record`,keyType:e,valueType:t,...v(n)})}var pc=w(`ZodEnum`,(e,t)=>{Rr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new pc({...t,checks:[],...v(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new pc({...t,checks:[],...v(r),entries:i})}});function U(e,t){return new pc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...v(t)})}var mc=w(`ZodLiteral`,(e,t)=>{zr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function W(e,t){return new mc({type:`literal`,values:Array.isArray(e)?e:[e],...v(t)})}var hc=w(`ZodTransform`,(e,t)=>{bs(),Br.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ye(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(je(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(je(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function gc(e){return new hc({type:`transform`,transform:e})}var _c=w(`ZodOptional`,(e,t)=>{Hr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function G(e){return new _c({type:`optional`,innerType:e})}var vc=w(`ZodExactOptional`,(e,t)=>{Ur.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yc(e){return new vc({type:`optional`,innerType:e})}var bc=w(`ZodNullable`,(e,t)=>{Wr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e){return new bc({type:`nullable`,innerType:e})}var Sc=w(`ZodDefault`,(e,t)=>{Gr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Cc(e,t){return new Sc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():oe(t)}})}var wc=w(`ZodPrefault`,(e,t)=>{qr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tc(e,t){return new wc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():oe(t)}})}var Ec=w(`ZodNonOptional`,(e,t)=>{Jr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dc(e,t){return new Ec({type:`nonoptional`,innerType:e,...v(t)})}var Oc=w(`ZodCatch`,(e,t)=>{Zr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function kc(e,t){return new Oc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:He(t)})}var Ac=w(`ZodPipe`,(e,t)=>{Qr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.in=t.in,e.out=t.out});function jc(e,t){return new Ac({type:`pipe`,in:e,out:t})}var Mc=w(`ZodPreprocess`,(e,t)=>{Ac.init(e,t),ei.init(e,t)}),Nc=w(`ZodReadonly`,(e,t)=>{ti.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Pc(e){return new Nc({type:`readonly`,innerType:e})}var Fc=w(`ZodLazy`,(e,t)=>{ri.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ts(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Ic(e){return new Fc({type:`lazy`,getter:e})}var Lc=w(`ZodCustom`,(e,t)=>{ii.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r)});function Rc(e,t={}){return Ma(Lc,e,t)}function zc(e,t){return Na(e,t)}function Bc(e,t){return new Mc({type:`pipe`,in:gc(e),out:t})}var Vc={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},Hc;Hc||={};function Uc(e){return $i(Cs,e)}function Wc(e){return ea(ws,e)}function Gc(e){return ia(Js,e)}var Kc=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],qc=`io.modelcontextprotocol/related-task`,Jc=`io.modelcontextprotocol/protocolVersion`,Yc=`io.modelcontextprotocol/clientInfo`,Xc=`io.modelcontextprotocol/serverInfo`,Zc=`io.modelcontextprotocol/clientCapabilities`,Qc=`io.modelcontextprotocol/subscriptionId`,$c=`io.modelcontextprotocol/logLevel`,el=Ic(()=>V([N(),F(),I(),$s(),H(N(),el),R(el)])),K=H(N(),el),tl=R(el),nl=V([N(),F().int()]),rl=N(),il=z({ttl:F().optional()}),al=z({taskId:N()}),ol=B({progressToken:nl.optional(),[qc]:al.optional()}),sl=z({_meta:ol.optional()}),cl=sl.extend({task:il.optional()}),q=z({method:N(),params:sl.loose().optional()}),ll=z({_meta:ol.optional()}),ul=z({method:N(),params:ll.loose().optional()}),dl=B({get[Xc](){return Tl.optional().catch(void 0)}}),J=B({_meta:dl.optional()}),fl=V([N(),F().int()]),pl=z({jsonrpc:W(`2.0`),id:fl,...q.shape}).strict(),ml=z({jsonrpc:W(`2.0`),...ul.shape}).strict(),hl=z({jsonrpc:W(`2.0`),id:fl,result:J}).strict(),gl=z({jsonrpc:W(`2.0`),id:fl.optional(),error:z({code:F().int(),message:N(),data:L().optional()})}).strict(),_l=V([pl,ml,hl,gl]),vl=V([hl,gl]),yl=J.strict(),bl=ll.extend({requestId:fl.optional(),reason:N().optional()}),xl=ul.extend({method:W(`notifications/cancelled`),params:bl}),Sl=z({src:N(),mimeType:N().optional(),sizes:R(N()).optional(),theme:U([`light`,`dark`]).optional()}),Cl=z({icons:R(Sl).optional()}),wl=z({name:N(),title:N().optional()}),Tl=wl.extend({...wl.shape,...Cl.shape,version:N(),websiteUrl:N().optional(),description:N().optional()}),El=Bc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,dc(z({form:dc(z({applyDefaults:I().optional()}),K).optional(),url:K.optional()}),K.optional())),Dl=B({list:K.optional(),cancel:K.optional(),requests:B({sampling:B({createMessage:K.optional()}).optional(),elicitation:B({create:K.optional()}).optional()}).optional()}),Ol=B({list:K.optional(),cancel:K.optional(),requests:B({tools:B({call:K.optional()}).optional()}).optional()}),kl=z({experimental:H(N(),K).optional(),sampling:z({context:K.optional(),tools:K.optional()}).optional(),elicitation:El.optional(),roots:z({listChanged:I().optional()}).optional(),tasks:Dl.optional(),extensions:H(N(),K).optional()}),Al=sl.extend({protocolVersion:N(),capabilities:kl,clientInfo:Tl}),jl=q.extend({method:W(`initialize`),params:Al}),Ml=z({experimental:H(N(),K).optional(),logging:K.optional(),completions:K.optional(),prompts:z({listChanged:I().optional()}).optional(),resources:z({subscribe:I().optional(),listChanged:I().optional()}).optional(),tools:z({listChanged:I().optional()}).optional(),tasks:Ol.optional(),extensions:H(N(),K).optional()}),Nl=J.extend({protocolVersion:N(),capabilities:Ml,serverInfo:Tl,instructions:N().optional()}),Pl=ul.extend({method:W(`notifications/initialized`),params:ll.optional()}),Fl=q.extend({method:W(`server/discover`),params:sl.optional()}),Il=J.extend({supportedVersions:R(N()),capabilities:Ml,instructions:N().optional()}),Ll=q.extend({method:W(`ping`),params:sl.optional()}),Rl=z({progress:F(),total:G(F()),message:G(N())}),zl=z({...ll.shape,...Rl.shape,progressToken:nl}),Bl=ul.extend({method:W(`notifications/progress`),params:zl}),Vl=sl.extend({cursor:rl.optional()}),Hl=q.extend({params:Vl.optional()}),Ul=J.extend({nextCursor:rl.optional()}),Wl=z({uri:N(),mimeType:G(N()),_meta:H(N(),L()).optional()}),Gl=Wl.extend({text:N()}),Kl=N().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),ql=Wl.extend({blob:Kl}),Jl=U([`user`,`assistant`]),Yl=z({audience:R(Jl).optional(),priority:F().min(0).max(1).optional(),lastModified:Uc({offset:!0}).optional()}),Xl=z({...wl.shape,...Cl.shape,uri:N(),description:G(N()),mimeType:G(N()),size:G(F()),annotations:Yl.optional(),_meta:G(B({}))}),Zl=z({...wl.shape,...Cl.shape,uriTemplate:N(),description:G(N()),mimeType:G(N()),annotations:Yl.optional(),_meta:G(B({}))}),Ql=Hl.extend({method:W(`resources/list`)}),$l=Ul.extend({resources:R(Xl)}),eu=Hl.extend({method:W(`resources/templates/list`)}),tu=Ul.extend({resourceTemplates:R(Zl)}),nu=sl.extend({uri:N()}),ru=nu,iu=q.extend({method:W(`resources/read`),params:ru}),au=J.extend({contents:R(V([Gl,ql]))}),ou=ul.extend({method:W(`notifications/resources/list_changed`),params:ll.optional()}),su=nu,cu=q.extend({method:W(`resources/subscribe`),params:su}),lu=nu,uu=q.extend({method:W(`resources/unsubscribe`),params:lu}),du=z({toolsListChanged:I().optional(),promptsListChanged:I().optional(),resourcesListChanged:I().optional(),resourceSubscriptions:R(N()).optional()}),fu=sl.extend({notifications:du}),pu=q.extend({method:W(`subscriptions/listen`),params:fu}),mu=ll.extend({notifications:du}),hu=ul.extend({method:W(`notifications/subscriptions/acknowledged`),params:mu}),gu=dl.extend({[Qc]:fl}),_u=J.extend({_meta:gu}),vu=ll.extend({uri:N()}),yu=ul.extend({method:W(`notifications/resources/updated`),params:vu}),bu=z({name:N(),description:G(N()),required:G(I())}),xu=z({...wl.shape,...Cl.shape,description:G(N()),arguments:G(R(bu)),_meta:G(B({}))}),Su=Hl.extend({method:W(`prompts/list`)}),Cu=Ul.extend({prompts:R(xu)}),wu=sl.extend({name:N(),arguments:H(N(),N()).optional()}),Tu=q.extend({method:W(`prompts/get`),params:wu}),Eu=z({type:W(`text`),text:N(),annotations:Yl.optional(),_meta:H(N(),L()).optional()}),Du=z({type:W(`image`),data:Kl,mimeType:N(),annotations:Yl.optional(),_meta:H(N(),L()).optional()}),Ou=z({type:W(`audio`),data:Kl,mimeType:N(),annotations:Yl.optional(),_meta:H(N(),L()).optional()}),ku=z({type:W(`tool_use`),name:N(),id:N(),input:H(N(),L()),_meta:H(N(),L()).optional()}),Au=z({type:W(`resource`),resource:V([Gl,ql]),annotations:Yl.optional(),_meta:H(N(),L()).optional()}),ju=Xl.extend({type:W(`resource_link`)}),Mu=V([Eu,Du,Ou,ju,Au]),Nu=z({role:Jl,content:Mu}),Pu=J.extend({description:N().optional(),messages:R(Nu)}),Fu=ul.extend({method:W(`notifications/prompts/list_changed`),params:ll.optional()}),Iu=z({title:N().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),Lu=z({taskSupport:U([`required`,`optional`,`forbidden`]).optional()}),Ru=z({...wl.shape,...Cl.shape,description:N().optional(),inputSchema:z({type:W(`object`),properties:H(N(),el).optional(),required:R(N()).optional()}).catchall(L()),outputSchema:B({$schema:N().optional()}).optional(),annotations:Iu.optional(),execution:Lu.optional(),_meta:H(N(),L()).optional()}),zu=Hl.extend({method:W(`tools/list`)}),Bu=Ul.extend({tools:R(Ru)}),Vu=J.extend({content:R(Mu).default([]),structuredContent:L().optional(),isError:I().optional()}),Hu=Vu.or(J.extend({toolResult:L()})),Uu=cl.extend({name:N(),arguments:H(N(),L()).optional()}),Wu=q.extend({method:W(`tools/call`),params:Uu}),Gu=ul.extend({method:W(`notifications/tools/list_changed`),params:ll.optional()}),Ku=z({autoRefresh:I().default(!0),debounceMs:F().int().nonnegative().default(300)}),qu=U([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Ju=sl.extend({level:qu}),Yu=q.extend({method:W(`logging/setLevel`),params:Ju}),Xu=ll.extend({level:qu,logger:N().optional(),data:L()}),Zu=ul.extend({method:W(`notifications/message`),params:Xu}),Qu=z({name:N().optional()}),$u=z({hints:R(Qu).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),ed=z({mode:U([`auto`,`required`,`none`]).optional()}),td=z({type:W(`tool_result`),toolUseId:N().describe(`The unique identifier for the corresponding tool call.`),content:R(Mu),structuredContent:L().optional(),isError:I().optional(),_meta:H(N(),L()).optional()}),nd=lc(`type`,[Eu,Du,Ou]),rd=lc(`type`,[Eu,Du,Ou,ku,td]),id=z({role:Jl,content:V([rd,R(rd)]),_meta:H(N(),L()).optional()}),ad=cl.extend({messages:R(id),modelPreferences:$u.optional(),systemPrompt:N().optional(),includeContext:U([`none`,`thisServer`,`allServers`]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:R(N()).optional(),metadata:K.optional(),tools:R(Ru).optional(),toolChoice:ed.optional()}),od=q.extend({method:W(`sampling/createMessage`),params:ad}),sd=J.extend({model:N(),stopReason:G(U([`endTurn`,`stopSequence`,`maxTokens`]).or(N())),role:Jl,content:nd}),cd=J.extend({model:N(),stopReason:G(U([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(N())),role:Jl,content:V([rd,R(rd)])}),ld=z({type:W(`boolean`),title:N().optional(),description:N().optional(),default:I().optional()}),ud=z({type:W(`string`),title:N().optional(),description:N().optional(),minLength:F().optional(),maxLength:F().optional(),format:U([`email`,`uri`,`date`,`date-time`]).optional(),default:N().optional()}),dd=z({type:U([`number`,`integer`]),title:N().optional(),description:N().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),fd=z({type:W(`string`),title:N().optional(),description:N().optional(),enum:R(N()),default:N().optional()}),pd=z({type:W(`string`),title:N().optional(),description:N().optional(),oneOf:R(z({const:N(),title:N()})),default:N().optional()}),md=z({type:W(`string`),title:N().optional(),description:N().optional(),enum:R(N()),enumNames:R(N()).optional(),default:N().optional()}),hd=V([fd,pd]),gd=z({type:W(`array`),title:N().optional(),description:N().optional(),minItems:F().optional(),maxItems:F().optional(),items:z({type:W(`string`),enum:R(N())}),default:R(N()).optional()}),_d=z({type:W(`array`),title:N().optional(),description:N().optional(),minItems:F().optional(),maxItems:F().optional(),items:z({anyOf:R(z({const:N(),title:N()}))}),default:R(N()).optional()}),vd=V([gd,_d]),yd=V([md,hd,vd]),bd=V([yd,ld,ud,dd]),xd=cl.extend({mode:W(`form`).optional(),message:N(),requestedSchema:z({type:W(`object`),properties:H(N(),bd),required:R(N()).optional()}).catchall(L())}),Sd=cl.extend({mode:W(`url`),message:N(),elicitationId:N(),url:N().url()}),Cd=V([xd,Sd]),wd=q.extend({method:W(`elicitation/create`),params:Cd}),Td=ll.extend({elicitationId:N()}),Ed=ul.extend({method:W(`notifications/elicitation/complete`),params:Td}),Dd=J.extend({action:U([`accept`,`decline`,`cancel`]),content:Bc(e=>e===null?void 0:e,H(N(),V([N(),F(),I(),R(N())])).optional())}),Od=z({type:W(`ref/resource`),uri:N()}),kd=z({type:W(`ref/prompt`),name:N()}),Ad=sl.extend({ref:V([kd,Od]),argument:z({name:N(),value:N()}),context:z({arguments:H(N(),N()).optional()}).optional()}),jd=q.extend({method:W(`completion/complete`),params:Ad}),Md=J.extend({completion:B({values:R(N()).max(100),total:G(F().int()),hasMore:G(I())})}),Nd=z({uri:N().startsWith(`file://`),name:N().optional(),_meta:H(N(),L()).optional()}),Pd=q.extend({method:W(`roots/list`),params:sl.optional()}),Fd=J.extend({roots:R(Nd)}),Id=ul.extend({method:W(`notifications/roots/list_changed`),params:ll.optional()}),Ld=B({ttl:F().optional(),pollInterval:F().optional()}),Rd=U([`working`,`input_required`,`completed`,`failed`,`cancelled`]),zd=z({taskId:N(),status:Rd,ttl:V([F(),$s()]),createdAt:N(),lastUpdatedAt:N(),pollInterval:G(F()),statusMessage:G(N())}),Bd=J.extend({task:zd}),Vd=ll.merge(zd),Hd=ul.extend({method:W(`notifications/tasks/status`),params:Vd}),Ud=q.extend({method:W(`tasks/get`),params:sl.extend({taskId:N()})}),Wd=J.merge(zd),Gd=q.extend({method:W(`tasks/result`),params:sl.extend({taskId:N()})}),Kd=J.loose(),qd=Hl.extend({method:W(`tasks/list`)}),Jd=Ul.extend({tasks:R(zd)}),Yd=q.extend({method:W(`tasks/cancel`),params:sl.extend({taskId:N()})}),Xd=J.merge(zd),Zd=V([Ll,jl,Fl,jd,Yu,Tu,Su,Ql,eu,iu,cu,uu,pu,Wu,zu]),Qd=V([xl,Bl,Pl,Id]),$d=V([yl,sd,cd,Dd,Fd]),ef=V([Ll,od,wd,Pd]),tf=V([xl,Bl,Zu,yu,ou,Gu,Fu,hu,Ed]),nf=V([yl,Nl,Il,Md,Pu,Cu,$l,tu,au,Vu,Bu,_u]),rf=Ms().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Vc.custom,message:`URL must be parseable`,fatal:!0}),We}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),af=B({resource:N().url(),authorization_servers:R(rf).optional(),jwks_uri:N().url().optional(),scopes_supported:R(N()).optional(),bearer_methods_supported:R(N()).optional(),resource_signing_alg_values_supported:R(N()).optional(),resource_name:N().optional(),resource_documentation:N().optional(),resource_policy_uri:N().url().optional(),resource_tos_uri:N().url().optional(),tls_client_certificate_bound_access_tokens:I().optional(),authorization_details_types_supported:R(N()).optional(),dpop_signing_alg_values_supported:R(N()).optional(),dpop_bound_access_tokens_required:I().optional()}),of=B({issuer:N(),authorization_endpoint:rf,token_endpoint:rf,registration_endpoint:rf.optional(),scopes_supported:R(N()).optional(),response_types_supported:R(N()),response_modes_supported:R(N()).optional(),grant_types_supported:R(N()).optional(),token_endpoint_auth_methods_supported:R(N()).optional(),token_endpoint_auth_signing_alg_values_supported:R(N()).optional(),service_documentation:rf.optional(),revocation_endpoint:rf.optional(),revocation_endpoint_auth_methods_supported:R(N()).optional(),revocation_endpoint_auth_signing_alg_values_supported:R(N()).optional(),introspection_endpoint:N().optional(),introspection_endpoint_auth_methods_supported:R(N()).optional(),introspection_endpoint_auth_signing_alg_values_supported:R(N()).optional(),code_challenge_methods_supported:R(N()).optional(),client_id_metadata_document_supported:I().optional(),authorization_response_iss_parameter_supported:I().optional().catch(void 0)}),sf=B({issuer:N(),authorization_endpoint:rf,token_endpoint:rf,userinfo_endpoint:rf.optional(),jwks_uri:rf,registration_endpoint:rf.optional(),scopes_supported:R(N()).optional(),response_types_supported:R(N()),response_modes_supported:R(N()).optional(),grant_types_supported:R(N()).optional(),acr_values_supported:R(N()).optional(),subject_types_supported:R(N()),id_token_signing_alg_values_supported:R(N()),id_token_encryption_alg_values_supported:R(N()).optional(),id_token_encryption_enc_values_supported:R(N()).optional(),userinfo_signing_alg_values_supported:R(N()).optional(),userinfo_encryption_alg_values_supported:R(N()).optional(),userinfo_encryption_enc_values_supported:R(N()).optional(),request_object_signing_alg_values_supported:R(N()).optional(),request_object_encryption_alg_values_supported:R(N()).optional(),request_object_encryption_enc_values_supported:R(N()).optional(),token_endpoint_auth_methods_supported:R(N()).optional(),token_endpoint_auth_signing_alg_values_supported:R(N()).optional(),display_values_supported:R(N()).optional(),claim_types_supported:R(N()).optional(),claims_supported:R(N()).optional(),service_documentation:N().optional(),claims_locales_supported:R(N()).optional(),ui_locales_supported:R(N()).optional(),claims_parameter_supported:I().optional(),request_parameter_supported:I().optional(),request_uri_parameter_supported:I().optional(),require_request_uri_registration:I().optional(),op_policy_uri:rf.optional(),op_tos_uri:rf.optional(),client_id_metadata_document_supported:I().optional(),authorization_response_iss_parameter_supported:I().optional().catch(void 0)}),cf=z({...sf.shape,...of.pick({code_challenge_methods_supported:!0}).shape}),lf=z({access_token:N(),id_token:N().optional(),token_type:N(),expires_in:Gc().optional(),scope:N().optional(),refresh_token:N().optional()}).strip(),uf=z({issued_token_type:W(`urn:ietf:params:oauth:token-type:id-jag`),access_token:N(),token_type:N().optional(),expires_in:F().optional(),scope:N().optional()}).strip(),df=z({error:N(),error_description:N().optional(),error_uri:N().optional()}),ff=rf.optional().or(W(``).transform(()=>void 0)),pf=z({redirect_uris:R(rf),token_endpoint_auth_method:N().optional(),grant_types:R(N()).optional(),response_types:R(N()).optional(),application_type:N().optional(),client_name:N().optional(),client_uri:rf.optional(),logo_uri:ff,scope:N().optional(),contacts:R(N()).optional(),tos_uri:ff,policy_uri:N().optional(),jwks_uri:rf.optional(),jwks:tc().optional(),software_id:N().optional(),software_version:N().optional(),software_statement:N().optional()}).strip(),mf=z({client_id:N(),client_secret:N().optional(),client_id_issued_at:F().optional(),client_secret_expires_at:F().optional()}).strip(),hf=pf.merge(mf),gf=z({error:N(),error_description:N().optional()}).strip(),_f=z({token:N(),token_type_hint:N().optional()}).strip();function vf(e,t,n){return typeof e==`object`&&!!e&&Reflect.get(e,`channel`)===t&&Reflect.get(e,`type`)===`mcp`&&Reflect.get(e,`direction`)===n&&Reflect.has(e,`payload`)}function yf(e,t,n,r,i){e.postMessage({channel:n,type:`mcp`,direction:r,payload:i},t)}var bf=class{_started=!1;_closed=!1;_allowedOrigins;_channelId;_messageHandler;_clientOrigin;onclientorigin;onclose;onerror;onmessage;constructor(e){if(!e.allowedOrigins?.length)throw Error(`At least one allowed origin must be specified`);this._allowedOrigins=new Set(e.allowedOrigins),this._channelId=e.channelId??`mcp-iframe`}get clientOrigin(){return this._clientOrigin}async start(){if(this._closed)throw Error(`IframeChildTransport cannot be restarted after it closes`);if(this._started)throw Error(`Transport already started`);this._messageHandler=e=>{if(e.source!==window.parent||!this._allowedOrigins.has(`*`)&&!this._allowedOrigins.has(e.origin)||!vf(e.data,this._channelId,`client-to-server`))return;this._clientOrigin!==e.origin&&(this._clientOrigin=e.origin,this.onclientorigin?.(e.origin));let{payload:t}=e.data;if(t===`mcp-check-ready`){this._broadcastServerReady();return}try{let e=_l.parse(t);this.onmessage?.(e)}catch(e){this.onerror?.(Error(`Invalid message: ${e instanceof Error?e.message:String(e)}`))}},window.addEventListener(`message`,this._messageHandler),this._started=!0,this._broadcastServerReady()}async send(e,t){if(this._closed)throw Error(`Transport is closed`);if(!this._started)throw Error(`Transport not started`);if(!this._clientOrigin){console.debug(`[IframeChildTransport] No client connected, message not sent`);return}if(window.parent===window){console.debug(`[IframeChildTransport] Not running in an iframe, message not sent`);return}yf(window.parent,this._clientOrigin,this._channelId,`server-to-client`,e)}async close(){this._closed||(this._closed=!0,this._started=!1,this._messageHandler&&=(window.removeEventListener(`message`,this._messageHandler),void 0),this._clientOrigin&&window.parent!==window&&yf(window.parent,this._clientOrigin,this._channelId,`server-to-client`,`mcp-server-stopped`),this.onclose?.())}_broadcastServerReady(){window.parent!==window&&yf(window.parent,`*`,this._channelId,`server-to-client`,`mcp-server-ready`)}},xf=class{_started=!1;_closed=!1;_allowedOrigins;_channelId;_messageHandler;onclose;onerror;onmessage;constructor(e){if(!e.allowedOrigins?.length)throw Error(`At least one allowed origin must be specified`);this._allowedOrigins=new Set(e.allowedOrigins),this._channelId=e.channelId??`mcp-default`}async start(){if(this._closed)throw Error(`TabServerTransport cannot be restarted after it closes`);if(this._started)throw Error(`Transport already started`);this._messageHandler=e=>{if(e.source!==window||!this._allowedOrigins.has(`*`)&&!this._allowedOrigins.has(e.origin)||!vf(e.data,this._channelId,`client-to-server`))return;let{payload:t}=e.data;if(t===`mcp-check-ready`){yf(window,`*`,this._channelId,`server-to-client`,`mcp-server-ready`);return}try{let e=_l.parse(t);this.onmessage?.(e)}catch(e){this.onerror?.(Error(`Invalid message: ${e instanceof Error?e.message:String(e)}`))}},window.addEventListener(`message`,this._messageHandler),this._started=!0,yf(window,`*`,this._channelId,`server-to-client`,`mcp-server-ready`)}async send(e,t){if(this._closed)throw Error(`Transport is closed`);if(!this._started)throw Error(`Transport not started`);yf(window,`*`,this._channelId,`server-to-client`,e)}async close(){this._closed||(this._closed=!0,this._messageHandler&&=(window.removeEventListener(`message`,this._messageHandler),void 0),this._started&&yf(window,`*`,this._channelId,`server-to-client`,`mcp-server-stopped`),this._started=!1,this.onclose?.())}},Sf={type:`object`,properties:{}},Cf=`Failed to parse input arguments`,wf=`Tool was executed but the invocation failed. For example, the script function threw an error`,Tf=[`draft-2020-12`,`draft-07`],Ef=/^[A-Za-z0-9_.-]{1,128}$/u;function Df(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Of(e){if(typeof e==`symbol`)throw TypeError(`Symbol values cannot be converted to a DOMString`);return String(e)}function kf(e){let t=Reflect.get(e,`name`),n=Reflect.get(e,`description`),r=Reflect.get(e,`title`);if(t===void 0)throw TypeError(`Tool "name" is required`);if(n===void 0)throw TypeError(`Tool "description" is required`);let i=Reflect.get(e,`annotations`),a=Df(i)?i:{},o=Reflect.get(e,`inputSchema`),s=Reflect.get(e,`outputSchema`),c=Reflect.get(e,`execute`);return{name:Of(t),...r===void 0?{}:{title:Of(r).toWellFormed()},description:Of(n),...o===void 0?{}:{inputSchema:o},...s===void 0?{}:{outputSchema:s},execute:c,...i===void 0?{}:{annotations:{...a.title===void 0?{}:{title:Of(a.title).toWellFormed()},readOnlyHint:!!a.readOnlyHint,...a.destructiveHint===void 0?{}:{destructiveHint:!!a.destructiveHint},...a.idempotentHint===void 0?{}:{idempotentHint:!!a.idempotentHint},...a.openWorldHint===void 0?{}:{openWorldHint:!!a.openWorldHint},untrustedContentHint:!!a.untrustedContentHint}}}}function Af(e){if(!Df(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function jf(e,t=new WeakSet){if(e===null||typeof e==`string`||typeof e==`boolean`)return!0;if(typeof e==`number`)return Number.isFinite(e);if(typeof e!=`object`||t.has(e))return!1;t.add(e);try{return(Array.isArray(e)?e:Af(e)?Object.values(e):null)?.every(e=>jf(e,t))??!1}catch{return!1}finally{t.delete(e)}}function Mf(e){return jf(e)?e:void 0}function Nf(e){return Df(e)&&Array.isArray(e.content)}function Pf(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function Ff(e){if(Nf(e))return e;let t=Mf(e);return{content:[{type:`text`,text:Pf(e)}],...t===void 0?{}:{structuredContent:t},isError:!1}}function If(e){return new DOMException(e,`UnknownError`)}function Lf(e){return If(e instanceof Error?`${wf}: ${e.message}`:wf)}function Rf(e){return new DOMException(e,`InvalidStateError`)}function zf(e){if(e.name===``)throw Rf(`Tool "name" must be a non-empty string`);if(typeof e.name!=`string`||!Ef.test(e.name))throw Rf(`Tool "name" must be 1–128 characters and contain only ASCII alphanumeric, underscore, hyphen, or period`);if(typeof e.description!=`string`||e.description.length===0)throw Rf(`Tool "description" must be a non-empty string`);if(typeof e.execute!=`function`)throw TypeError(`Tool "execute" must be a function`)}function Bf(e){return{readOnlyHint:e.readOnlyHint??!1,untrustedContentHint:e.untrustedContentHint??!1}}function Vf(e){try{let t=JSON.parse(e);if(Array.isArray(t)||Df(t))return t}catch{}throw If(Cf)}function Hf(e){if(typeof e==`object`&&e||typeof e==`function`)try{let t=JSON.stringify(e);if(t)return t}catch{}return String(e)||`Operation succeeded`}function Uf(e,t,n=()=>t?.reason){return t?t.aborted?Promise.reject(n()):new Promise((r,i)=>{let a=()=>{o(),i(n())},o=()=>t.removeEventListener(`abort`,a);t.addEventListener(`abort`,a,{once:!0}),e.then(e=>{o(),r(e)},e=>{o(),i(e)})}):e}function Wf(e){let t=e.origin===`null`?e:new URL(e.origin),n=t.protocol;if([`https:`,`wss:`,`file:`,`chrome-extension:`,`moz-extension:`].includes(n))return!0;let r=t.hostname.toLowerCase(),i=r.split(`.`),a=i.length===4&&i.every(e=>/^\d{1,3}$/u.test(e)&&Number(e)<=255)&&Number(i[0])===127;return r===`::1`||r===`[::1]`||r===`localhost`||r===`localhost.`||r.endsWith(`.localhost`)||r.endsWith(`.localhost.`)||a}function Gf(e){for(let t of e??[]){let e;try{e=new URL(t)}catch{throw new DOMException(`Invalid or untrustworthy origin: ${String(t)}`,`SecurityError`)}if(!Wf(e))throw new DOMException(`Invalid or untrustworthy origin: ${t}`,`SecurityError`)}}function Kf(e){if(qf(),!e)return;let t=e.defaultView?.DOMException??DOMException,n=!1;try{let t=e.defaultView;n=!!(t&&t.document===e)}catch{}if(!n)throw new t(`The associated document is not fully active`,`InvalidStateError`);let r=Reflect.get(e,`permissionsPolicy`)??Reflect.get(e,`featurePolicy`);if(r&&typeof r==`object`){let e=Reflect.get(r,`features`),n=Reflect.get(r,`allowsFeature`);if(typeof e==`function`&&typeof n==`function`){let i=Reflect.apply(e,r,[]);if(Array.isArray(i)&&i.includes(`tools`)){if(Reflect.apply(n,r,[`tools`])===!0)return;throw new t(`WebMCP is disabled by Permissions Policy`,`NotAllowedError`)}}}let i=e.defaultView;if(!(!i||i.parent===i)){try{i.parent.document;return}catch{}throw new t(`WebMCP in cross-origin frames requires native Permissions Policy support`,`NotAllowedError`)}}function qf(){if(globalThis.originAgentCluster===!1&&globalThis.location?.protocol!==`file:`)throw new DOMException(``,`SecurityError`)}function Jf(e){try{if(new URL(String(e)).origin!==`null`)return}catch{}throw new DOMException(`Unsupported tool origin: ${String(e)}`,`NotSupportedError`)}function Yf(e){if(!Df(e))return null;let t=e[`~standard`];return Df(t)?t:null}function Xf(e){let t=Yf(e);return!!(t&&t.version===1&&typeof t.validate==`function`)}function Zf(e){let t=Yf(e);return!t||t.version!==1||!Df(t.jsonSchema)?!1:typeof t.jsonSchema.input==`function`}function Qf(e,t){let n={...e};return Object.defineProperty(n,"~standard",{value:t[`~standard`]}),n}function $f(e){for(let t of Tf)try{let n=tp(e[`~standard`].jsonSchema.input({target:t})),r=JSON.parse(n);if(!Df(r))throw TypeError(`inputSchema must serialize to an object`);return r}catch{}throw Error(`Failed to convert Standard JSON Schema inputSchema to a JSON Schema object`)}function ep(e){if(e===void 0)return{inputSchema:Sf};if(Zf(e)){let t=$f(e),n=tp(t);return{inputSchema:Xf(e)?Qf(t,e):t,registeredInputSchema:n}}if(Xf(e))throw Error(`Standard Schema inputSchema must provide ~standard.jsonSchema.input() for tool metadata`);if(e===null||typeof e!=`object`&&typeof e!=`function`)throw TypeError(`inputSchema must be an object`);let t=tp(e),n=JSON.parse(t),r=Df(n)?n:void 0;return!r||Object.keys(r).length===0?{inputSchema:Sf,registeredInputSchema:t}:{inputSchema:r.type===void 0?{type:`object`,...r}:r,registeredInputSchema:t}}function tp(e){if(e===null||typeof e!=`object`&&typeof e!=`function`)throw TypeError(`inputSchema must be an object`);let t=JSON.stringify(e);if(t===void 0)throw TypeError(`inputSchema must be JSON-serializable`);return t}var np=new WeakSet,rp=new WeakMap,ip=new WeakMap;function ap(e){return e.isTrusted&&(np.has(e)||e.eventPhase!==Event.NONE&&e.target instanceof HTMLFormElement&&ip.has(e.target))}function op(e,t){if(!ap(e))throw new DOMException(`respondWith() is only available during an agent-invoked submit event`,`InvalidStateError`);if(!e.defaultPrevented)throw new DOMException(`respondWith() requires preventDefault() during an agent-invoked submit event`,`InvalidStateError`);if(e.eventPhase===Event.NONE)throw new DOMException(`respondWith() is only available while the submit event is being dispatched`,`InvalidStateError`);np.add(e);let n=Promise.resolve(t);rp.set(e,n),e.target instanceof HTMLFormElement&&ip.get(e.target)?.respond(e)}var sp=new Set([`email`,`password`,`search`,`tel`,`text`,`url`]),cp=new Set([...sp,`date`,`datetime-local`,`month`,`number`,`time`,`week`]);function lp(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function up(e){return Reflect.get(HTMLFormElement.prototype,`elements`,e)}function dp(e,t){return Reflect.apply(Element.prototype.getAttribute,e,[t])}function fp(e,t){return Reflect.apply(Element.prototype.hasAttribute,e,[t])}function pp(e){return Reflect.get(Node.prototype,`isConnected`,e)}function mp(e){return Reflect.get(Element.prototype,`shadowRoot`,e)}function hp(e){return Reflect.apply(HTMLFormElement.prototype.checkValidity,e,[])}function gp(e,t){Reflect.apply(HTMLFormElement.prototype.requestSubmit,e,t?[t]:[])}function _p(e){return[...up(e)].filter(e=>lp(e)&&!e.matches(`:disabled`)&&!(`readOnly`in e&&e.readOnly&&(e instanceof HTMLTextAreaElement||cp.has(e.type))))}function vp(e){let t=new Map;for(let n of _p(e)){let e=n.name.trim(),r=t.get(e);r?r.push(n):t.set(e,[n])}return t}function yp(e){return[...e.labels??[]].map(e=>{let t=e.cloneNode(!0);return t instanceof HTMLElement?(t.querySelectorAll(`button, input, meter, output, progress, select, textarea`).forEach(e=>e.remove()),t.textContent?.trim()??``):``}).filter(Boolean).join(`; `)}function bp(e,t){for(let n=t[0]?.parentElement;n&&n!==e;n=n.parentElement)if(n instanceof HTMLFieldSetElement&&t.every(e=>n.contains(e)))return n}function xp(e,t){if(t.length===1){let e=t[0];return e&&(e.getAttribute(`toolparamdescription`)||yp(e)||e.getAttribute(`aria-description`))||void 0}return bp(e,t)?.getAttribute(`toolparamdescription`)||void 0}function Sp(e,t,n,r){let i=xp(t,n),a=i&&r?`${i} (${r})`:i||r;return a?{...e,description:a}:e}function Cp(e,t){let n=e.getAttribute(t);if(n===null||n.trim()===``)return;let r=Number(n);return Number.isFinite(r)?r:void 0}function wp(e,t){let n=e/t;return Math.abs(n-Math.round(n))<2**-52*16}function Tp(e){let t=e.getAttribute(`pattern`);if(t!==null)try{return new RegExp(t,`v`),t}catch{return}}function Ep(e,t=!0){let n={type:`number`},r=Cp(e,`min`),i=Cp(e,`max`);r!==void 0&&(n.minimum=r),i!==void 0&&(n.maximum=i);let a=e.getAttribute(`step`);if(a!==`any`){let t=a===null||a===``?1:Number(a),i=Number.isFinite(t)&&t>0?t:1,o=Number(e.getAttribute(`value`));wp(r??(Number.isFinite(o)?o:0),i)&&(n.multipleOf=i)}let o=t?Tp(e):void 0;return o!==void 0&&(n.pattern=o),n}function Dp(e,t){let n=e.getAttribute(`step`),r=n===null||n===``?60:Number(n),i=Number.isFinite(r)&&r>0?r:60;return i<1?`${t}(:[0-5][0-9](\\.[0-9]{1,3})?)?$`:i<60?`${t}(:[0-5][0-9])?$`:`${t}$`}function Op(e){return{anyOf:e.map(e=>({type:`string`,const:e.value,title:e.textContent??``})),enum:e.map(e=>e.value)}}function kp(e){return{anyOf:e.map(e=>{let t=yp(e);return{type:`string`,const:e.value,...t?{title:t}:{}}}),enum:e.map(e=>e.value)}}function Ap(e,t){let n=t[0];if(n){if(t.length>1)return t.every(e=>e instanceof HTMLInputElement)?t.every(e=>e.type===`checkbox`)?Sp({type:`array`,items:{type:`string`,...kp(t)},uniqueItems:!0},e,t):t.every(e=>e.type===`radio`)?Sp({type:`string`,...kp(t)},e,t):void 0:void 0;if(n instanceof HTMLTextAreaElement)return Sp({type:`string`},e,t);if(n instanceof HTMLSelectElement){let r=Op([...n.options]);return Sp(n.multiple?{type:`array`,items:{type:`string`,...r},uniqueItems:!0}:{type:`string`,...r},e,t)}if(sp.has(n.type)){let r={type:`string`},i=Tp(n);return i!==void 0&&(r.pattern=i),Sp(r,e,t)}if(n.type===`hidden`)return n.getAttribute(`toolparamdescription`)?Sp({type:`string`},e,t):void 0;if(n.type===`number`)return Sp(Ep(n),e,t);if(n.type===`range`){let r=Ep(n,!1);return r.minimum??=0,r.maximum??=100,Sp(r,e,t)}if(n.type===`checkbox`)return Sp({type:`boolean`},e,t);if(n.type===`radio`)return Sp({type:`string`,...kp([n])},e,t);if(n.type===`date`)return Sp({type:`string`,format:`date`},e,t,`Dates MUST be provided in 'YYYY-MM-DD' format.`);if(n.type===`month`)return Sp({type:`string`,format:`^[0-9]{4}-(0[1-9]|1[0-2])$`},e,t);if(n.type===`week`)return Sp({type:`string`,format:`^[0-9]{4}-W(0[1-9]|[1-4][0-9]|5[0-3])$`},e,t);if(n.type===`time`)return Sp({type:`string`,format:Dp(n,`^([01][0-9]|2[0-3]):[0-5][0-9]`)},e,t);if(n.type===`datetime-local`)return Sp({type:`string`,format:Dp(n,`^[0-9]{4}-(0[1-9]|1[0-2])-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]`)},e,t);if(n.type===`color`)return Sp({type:`string`,format:`^#[0-9a-zA-Z]{6}$`},e,t)}}function jp(e){let t={},n=[];for(let[r,i]of vp(e)){if(!r)continue;let a=Ap(e,i);a&&(Object.defineProperty(t,r,{configurable:!0,enumerable:!0,value:a,writable:!0}),i.some(e=>e.required)&&n.push(r))}return{type:`object`,properties:t,required:n}}function Mp(e){return{name:dp(e,`toolname`)??``,title:dp(e,`tooltitle`)??``,description:dp(e,`tooldescription`)??``,inputSchema:jp(e),autosubmit:fp(e,`toolautosubmit`)}}function Np(e){if(typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e))return String(e)}function Pp(e){if(typeof e==`boolean`)return e;if(typeof e==`number`&&Number.isInteger(e))return e!==0;if(typeof e==`string`){if(e===`1`||e.toLowerCase()===`true`)return!0;if(e===`0`||e.toLowerCase()===`false`)return!1}}function Fp(e,t){if(!Array.isArray(e))return!1;let n=new Set(t);for(let t of e){let e=Np(t);if(e===void 0||!n.delete(e))return!1}return!0}function Ip(e,t){if(t===``)return e.type!==`number`&&e.type!==`range`;let n=e.ownerDocument.createElement(`input`);return n.type=e.type,n.value=t,n.value!==``}function Lp(e,t,n){let r=t[0];if(!r||!Ap(e,t))return!1;if(t.length>1){if(!t.every(e=>e instanceof HTMLInputElement))return!1;if(t.every(e=>e.type===`checkbox`))return Fp(n,new Set(t.map(e=>e.value)));if(t.every(e=>e.type===`radio`)){let e=Np(n);return e!==void 0&&t.some(t=>t.value===e)}return!1}if(r instanceof HTMLSelectElement){let e=new Set([...r.options].map(e=>e.value));if(r.multiple)return Fp(n,e);let t=Np(n);return t!==void 0&&e.has(t)}if(r instanceof HTMLTextAreaElement)return Np(n)!==void 0;if(r.type===`checkbox`)return Pp(n)!==void 0;if(r.type===`radio`){let e=Np(n);return e!==void 0&&r.value===e}let i=Np(n);return i!==void 0&&Ip(r,i)}function Rp(e){e.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0}))}function zp(e,t){let n=e instanceof HTMLInputElement?HTMLInputElement.prototype:HTMLTextAreaElement.prototype;Object.getOwnPropertyDescriptor(n,`value`)?.set?.call(e,t)}function Bp(e,t){Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`checked`)?.set?.call(e,t)}function Vp(e,t){let n=e[0];if(!n)return;if(e.length>1&&e.every(e=>e instanceof HTMLInputElement)){if(e.every(e=>e.type===`checkbox`)&&Array.isArray(t)){let n=new Set(t.map(Np));for(let t of e){let e=n.has(t.value);t.checked!==e&&(Bp(t,e),Rp(t))}return}let n=Np(t),r=e.find(e=>e.value===n);r&&!r.checked&&(Bp(r,!0),Rp(r));return}if(n instanceof HTMLSelectElement){if(n.multiple&&Array.isArray(t)){let e=new Set(t.map(Np)),r=!1;for(let t of n.options){let n=e.has(t.value);t.selected!==n&&(t.selected=n,r=!0)}r&&Rp(n);return}let e=Np(t);e!==void 0&&n.value!==e&&(n.value=e,Rp(n));return}if(n instanceof HTMLInputElement&&n.type===`checkbox`){let e=Pp(t);e!==void 0&&n.checked!==e&&(Bp(n,e),Rp(n));return}if(n instanceof HTMLInputElement&&n.type===`radio`){Np(t)===n.value&&!n.checked&&(Bp(n,!0),Rp(n));return}let r=Np(t);r!==void 0&&n.value!==r&&(zp(n,r),Rp(n))}function Hp(e,t){if(Array.isArray(t))throw TypeError(`Declarative tool input must be an object`);let n=vp(e);for(let[r,i]of Object.entries(t)){let t=n.get(r);if(!t||!Lp(e,t,i))throw TypeError(`Invalid value for declarative form parameter "${r}"`)}for(let[e,r]of Object.entries(t))Vp(n.get(e)??[],r)}function Up(e){return[...up(e)].find(e=>!e.matches(`:disabled`)&&(e instanceof HTMLButtonElement&&e.type===`submit`||e instanceof HTMLInputElement&&[`image`,`submit`].includes(e.type)))}function Wp(e){let t=[...up(e)].filter(e=>lp(e)&&e.willValidate&&!e.validity.valid).map(e=>`${e.name.trim()||`{unknown}`}: ${e.validationMessage}`).join(`. `);return new DOMException(`Form validation failed: ${t}`,`UnknownError`)}function Gp(e){let t=new Event(`toolactivated`);return Object.defineProperty(t,"toolName",{enumerable:!0,value:e}),t}function Kp(e,t,n,r){let{form:i}=e;return e.cancelPending?.(new DOMException(`Tool execution cancelled`,`UnknownError`)),new Promise((a,o)=>{let s=!1,c=()=>{Reflect.apply(EventTarget.prototype.removeEventListener,i,[`invalid`,f,!0]),ip.delete(i),e.cancelPending===u&&delete e.cancelPending},l=e=>{s||(s=!0,c(),e())},u=e=>l(()=>o(e)),d=e=>{e.then(e=>l(()=>a(e)),e=>l(()=>o(e)))},f=e=>{e.isTrusted&&queueMicrotask(()=>{hp(i)||u(Wp(i))})};if(ip.set(i,{complete(e){queueMicrotask(()=>{let t=rp.get(e);t?d(t):e.defaultPrevented?u(new DOMException(`preventDefault() requires respondWith()`,`UnknownError`)):l(()=>a(void 0))})},direct(){l(()=>a(void 0))},respond(e){queueMicrotask(()=>{let t=rp.get(e);t&&d(t)})}}),e.cancelPending=u,Reflect.apply(EventTarget.prototype.addEventListener,i,[`invalid`,f,!0]),!n){r?.focus(),window.dispatchEvent(Gp(t));return}try{gp(i,r),window.dispatchEvent(Gp(t))}catch(e){u(e)}})}function qp(e,t){let n=!0,r=new Map,i=new Map,a=new Map,o=e=>{if(!(e instanceof SubmitEvent)||!e.isTrusted||!(e.target instanceof HTMLFormElement))return;let t=ip.get(e.target);t&&(np.add(e),t.complete(e))},s=e=>{if(!e.isTrusted||!(e.target instanceof HTMLFormElement))return;let t=e.target;queueMicrotask(()=>{e.defaultPrevented||r.get(t)?.cancelPending?.(new DOMException(`Tool execution cancelled by form reset`,`UnknownError`))})};function c(e){a.get(e)?.disconnect(),a.delete(e),e.removeEventListener(`reset`,s,!0),e.removeEventListener(`submit`,o,!0)}function l(e){if(a.has(e))return;let t=new MutationObserver(u);a.set(e,t),t.observe(e,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),e.addEventListener(`reset`,s,!0),e.addEventListener(`submit`,o,!0)}function u(){l(e);for(let e of a.keys())e instanceof ShadowRoot&&!Reflect.get(Node.prototype,`isConnected`,e.host)&&c(e);let n=new Set,o=new Map,s=new Map;for(let e of a.keys())for(let t of e.querySelectorAll(`*`)){let e=mp(t);if(e&&l(e),!(t instanceof HTMLFormElement)||!fp(t,`toolname`)||!fp(t,`tooldescription`)||!pp(t))continue;let r=t;n.add(r);let a=Mp(r),c=JSON.stringify(a),u=i.get(r);if(u===c)continue;let d=u!==void 0;i.delete(r);let f=s.get(a.name);if(f&&!d){i.set(r,c);continue}if(f){let e=o.get(f);e&&(i.set(f,e.fingerprint),o.delete(f))}s.set(a.name,r),o.set(r,{definition:a,fingerprint:c})}for(let e of i.keys())n.has(e)||i.delete(e);for(let[e,t]of r)o.get(e)?.fingerprint!==t.fingerprint&&(t.cancelPending?.(new DOMException(`Tool execution cancelled because its form changed`,`UnknownError`)),t.controller.abort(),r.delete(e));for(let[e,{definition:n,fingerprint:i}]of o){if(r.has(e))continue;let a=new AbortController,o={controller:a,fingerprint:i,form:e};r.set(e,o),t.registerTool({name:n.name,title:n.title,description:n.description,inputSchema:n.inputSchema,execute(t){let r=Up(e);if(!n.autosubmit&&!r)throw new DOMException(`A declarative form without toolautosubmit requires a submit button`,`UnknownError`);return Hp(e,t),Kp(o,n.name,n.autosubmit,r)}},{signal:a.signal}).catch(e=>{a.abort(),e?.name!==`AbortError`&&console.error(`[webmcp] declarative form tool "${n.name}" was not registered:`,e)})}}let d=()=>{},f=e.defaultView?.Element.prototype,p=f?Object.getOwnPropertyDescriptor(f,`attachShadow`):void 0;if(f&&p?.configurable){let t=f.attachShadow,r=function(r){let i=t.call(this,r);return n&&i.mode===`open`&&Reflect.get(Node.prototype,`ownerDocument`,this)===e&&Reflect.get(Node.prototype,`isConnected`,this)&&l(i),i};Object.defineProperty(f,"attachShadow",{...p,value:r}),d=()=>{f.attachShadow===r&&Object.defineProperty(f,"attachShadow",p)}}let m=()=>{},h=e.defaultView?.HTMLFormElement.prototype,g=h?Object.getOwnPropertyDescriptor(h,`submit`):void 0;if(h&&g?.configurable){let e=h.submit,t=function(){e.call(this),n&&ip.get(this)?.direct()};Object.defineProperty(h,"submit",{...g,value:t}),m=()=>{h.submit===t&&Object.defineProperty(h,"submit",g)}}return u(),()=>{n=!1,m(),d();for(let e of a.keys())c(e);i.clear();for(let e of r.values())e.cancelPending?.(new DOMException(`Tool execution cancelled`,`UnknownError`)),e.controller.abort();r.clear()}}var Jp=`__isWebMCPPolyfill`,Yp=Symbol(`registeredInputSchema`),Xp=Symbol(`registrationSignal`),Zp=Symbol(`registrationAbort`),Qp=[],$p=null,em=null;function tm(){return typeof globalThis.origin==`string`?globalThis.origin:globalThis.location?.origin??``}function nm(e,t,n){let r=Object.getOwnPropertyDescriptor(e,t);try{Object.defineProperty(e,t,n)}catch(e){throw mm(),e}Qp.push({target:e,key:t,previous:r})}var rm=class extends EventTarget{#e=new Map;#t=null;#n=null;#r=e=>{this.#n?.call(this,e)};#i;#a;constructor(e){super(),this.#a=e,this.#i=e?.defaultView?.DOMException??DOMException,Object.defineProperty(this,Jp,{value:!0,enumerable:!1,writable:!1,configurable:!1})}get ontoolchange(){return this.#n}set ontoolchange(e){let t=typeof e==`function`?e:null;if(t===null){this.#n=null,super.removeEventListener(`toolchange`,this.#r);return}this.#n===null&&super.addEventListener(`toolchange`,this.#r),this.#n=t}async registerTool(e,t={}){Kf(this.#a);let n=t?.signal,r=om(e,this.#e);if(n?.throwIfAborted(),Gf(t?.exposedTo),n?.throwIfAborted(),t?.exposedTo?.length)throw new this.#i(`Cross-document tool exposure requires native WebMCP`,`NotSupportedError`);if(this.#e.set(r.name,r),n){let e=()=>{this.#o(r.name,r)&&this.#c()};r[Xp]=n,r[Zp]=e,n.addEventListener(`abort`,e,{once:!0})}if(await this.#c(),n?.aborted)throw n.reason}async getTools(e={}){if(Kf(this.#a),Gf(e?.fromOrigins),e?.fromOrigins?.length)throw new this.#i(`Cross-document tool discovery requires native WebMCP`,`NotSupportedError`);let t=[...this.#e.values()].map(e=>{let t=e[Yp],n=t===void 0?void 0:JSON.parse(t);return{name:e.name,title:e.title??``,description:e.description,...Df(n)?{inputSchema:n}:{},origin:tm(),window:globalThis.window,...e.annotations?{annotations:Bf(e.annotations)}:{}}}).sort((e,t)=>e.name<t.name?-1:+(e.name>t.name));return await new Promise(e=>setTimeout(e,0)),t}async executeTool(e,t,n={}){if(Kf(this.#a),typeof e!=`object`||!e)throw TypeError(`RegisteredTool must be an object`);for(let t of[`name`,`description`,`window`,`origin`])if(!(t in e))throw TypeError(`RegisteredTool.${t} is required`);if(Jf(e.origin),e.window!==globalThis.window||e.origin!==tm())throw If(`Tool not found: ${e.name}`);return this.#s(e.name,t,n)}static getTestingShim(e){return e.#t??=new am(e),e.#t}static getToolInfos(e){return[...e.#e.values()].map(e=>({name:e.name,description:e.description,...e[Yp]===void 0?{}:{inputSchema:e[Yp]}}))}static executeToolForTesting(e,t,n,r){return Kf(e.#a),e.#s(t,n,r)}static dispose(e){for(let t of e.#e.keys())e.#o(t);e.ontoolchange=null,e.#t?.dispose()}#o(e,t){let n=this.#e.get(e);if(!n||t&&n!==t)return!1;let r=n[Xp],i=n[Zp];return r&&i&&r.removeEventListener(`abort`,i),this.#e.delete(e)}async#s(e,t,n){n?.signal?.throwIfAborted();let r=this.#e.get(e);if(!r)throw If(`Tool not found: ${e}`);let i=Vf(t);if(n?.signal?.throwIfAborted(),r[Xp]?.aborted)throw If(`Tool unregistered`);let a;try{let e=r[Xp];a=await Uf(Uf(Promise.resolve(r.execute(i)),e,()=>If(`Tool unregistered`)),n?.signal)}catch(e){throw n?.signal?.aborted&&e===n.signal.reason||r[Xp]?.aborted?e:Lf(e)}return Hf(a)}async#c(){await new Promise(e=>setTimeout(e,0)),this.dispatchEvent(new Event(`toolchange`)),this.#t?.dispatchToolChange()}},im=function(){throw TypeError(`Illegal constructor`)};Object.defineProperty(im,"name",{value:`ModelContext`}),Object.defineProperty(im,"prototype",{value:rm.prototype,writable:!1}),Object.setPrototypeOf(im,EventTarget),Object.defineProperty(rm.prototype,"constructor",{configurable:!0,writable:!0,value:im}),Object.defineProperty(rm.prototype,Symbol.toStringTag,{configurable:!0,value:`ModelContext`});for(let e of[`registerTool`,`getTools`,`executeTool`,`ontoolchange`]){let t=Object.getOwnPropertyDescriptor(rm.prototype,e);t&&Object.defineProperty(rm.prototype,e,{...t,enumerable:!0})}var am=class extends EventTarget{_ontoolchange=null;ontoolchangeListener=e=>{this._ontoolchange?.call(this,e)};#e;constructor(e){super(),this.#e=e}listTools(){return rm.getToolInfos(this.#e)}executeTool(e,t,n){return rm.executeToolForTesting(this.#e,e,t,n)}get ontoolchange(){return this._ontoolchange}set ontoolchange(e){let t=typeof e==`function`?e:null;if(t===null){this._ontoolchange=null,super.removeEventListener(`toolchange`,this.ontoolchangeListener);return}this._ontoolchange===null&&super.addEventListener(`toolchange`,this.ontoolchangeListener),this._ontoolchange=t}dispatchToolChange(){this.dispatchEvent(new Event(`toolchange`))}dispose(){this.ontoolchange=null}};function om(e,t){if(!e||typeof e!=`object`)throw TypeError(`registerTool(tool) requires a tool object`);let n=kf(e);if(zf(n),t.has(n.name))throw Rf(`Tool already registered: ${n.name}`);let r=n.inputSchema===void 0?void 0:tp(n.inputSchema);return{name:n.name,...n.title===void 0?{}:{title:n.title},description:n.description,...n.inputSchema===void 0?{}:{inputSchema:n.inputSchema},...n.annotations===void 0?{}:{annotations:n.annotations},execute:e=>Reflect.apply(n.execute,void 0,[e]),...r===void 0?{}:{[Yp]:r}}}var sm=!1,cm=new WeakMap,{modelContext:lm}={modelContext(){if(!(this instanceof Document))throw TypeError(`Illegal invocation`);return cm.get(this)}};Object.defineProperty(lm,"name",{value:`get modelContext`});function um(e,t){cm.set(e,t),!Object.hasOwn(Document.prototype,`modelContext`)&&nm(Document.prototype,`modelContext`,{configurable:!0,enumerable:!0,get:lm})}function dm(e,t){nm(e,`modelContext`,{configurable:!0,enumerable:!0,get(){return sm||(sm=!0,console.warn(`[WebMCPPolyfill] navigator.modelContext is deprecated. The May 27, 2026 WebMCP draft moved the modelContext getter from Navigator to Document — use document.modelContext instead. See https://github.com/webmachinelearning/webmcp/pull/184.`)),t}})}function fm(){let e=SubmitEvent.prototype;`agentInvoked`in e||nm(e,`agentInvoked`,{configurable:!0,enumerable:!0,get(){return ap(this)}}),`respondWith`in e||nm(e,`respondWith`,{configurable:!0,enumerable:!0,writable:!0,value(e){op(this,e)}})}function pm(e){if(globalThis.isSecureContext===!1)return;let t=typeof navigator>`u`?null:navigator,n=typeof document>`u`?null:document;if(!t||!n||typeof window>`u`||n.modelContext)return;let r=t.modelContext;if(Qp.length>0&&mm(),r){um(n,r);return}let i=Object.getOwnPropertyDescriptor(window,`ModelContext`);if(i&&!i.configurable){if(!Object.is(Reflect.get(window,`ModelContext`),im))throw TypeError(`Cannot install ModelContext over a non-configurable global`)}else nm(window,`ModelContext`,{configurable:!0,enumerable:!1,writable:!0,value:im});let a=new rm(n);$p=a,um(n,a),sm=!1,dm(t,a),fm(),e?.installTestingShim&&!t.modelContextTesting&&nm(t,`modelContextTesting`,{configurable:!0,enumerable:!0,writable:!1,value:rm.getTestingShim(a)}),em=qp(n,a)}function mm(){em?.(),em=null,$p&&rm.dispose($p),$p=null;for(let{target:e,key:t,previous:n}of[...Qp].reverse())n?Object.defineProperty(e,t,n):Reflect.deleteProperty(e,t);Qp.length=0,sm=!1}var hm=Object.defineProperty,gm=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_m=(e,t)=>{let n={};for(var r in e)hm(n,r,{get:e[r],enumerable:!0});return t&&hm(n,Symbol.toStringTag,{value:`Module`}),n},vm=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),ym=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),bm=new Set([`https://json-schema.org/draft-07/schema`,`http://json-schema.org/draft-07/schema`]),xm=new Set([`https://json-schema.org/draft-06/schema`,`http://json-schema.org/draft-06/schema`]);function Sm(e){return typeof e==`string`&&ym.has(e.replace(/#$/,``))}function Cm(e,t){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let n=e.$schema.replace(/#$/,``);if(vm.has(n))return`2020-12`;if(ym.has(n))return`2019-09`;if(bm.has(n)||xm.has(n))return`draft-7`;throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var wm=Symbol.for(`mcp.sdk.errorBrands`);function Tm(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,wm,{value:n,enumerable:!1,configurable:!0})}function Em(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,wm)){let n=t[wm];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return Em(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Em(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Tm(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});var Y=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),X=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return Em(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Em(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`SdkError`,Tm(this,new.target)}};(class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n){super(e,t,n),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});function Dm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Om(e,t,n){return e===`elicitation`&&t===`form`&&n.form===void 0&&n.url===void 0}function km(e){switch(e.method){case`elicitation/create`:return e.params?.mode===`url`?{elicitation:{url:{}}}:{elicitation:{form:{}}};case`sampling/createMessage`:{let t=e.params;return t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0)?{sampling:{tools:{}}}:{sampling:{}}}case`roots/list`:return{roots:{}};default:return}}function Am(e,t){let n={};for(let[r,i]of Object.entries(e)){if(i===void 0)continue;let e=t===void 0?void 0:t[r];if(e===void 0){n[r]=i;continue}if(Dm(i)&&Dm(e)){let t={};for(let[n,a]of Object.entries(i))a!==void 0&&e[n]===void 0&&!Om(r,n,e)&&(t[n]=a);Object.keys(t).length>0&&(n[r]=t)}}return Object.keys(n).length>0?n:void 0}var jm=`2026-07-28`;function Mm(e){return e>=jm}function Nm(e){return e.filter(e=>!Mm(e))}function Pm(e){return e.filter(e=>Mm(e))}function Fm(e){let t=e.structuredContent;return t===void 0||!(typeof t!=`object`||!t||Array.isArray(t))||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var Im=[`task`,`inputRequests`,`requestState`];function Lm(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Im.some(t=>t in e)?e:{...e,content:[]}}function Rm(){let e=Ic(()=>V([N(),F(),I(),$s(),H(N(),e),R(e)])),t=H(N(),e),n=V([N(),F().int()]),r=N(),i=z({ttl:F().optional()}),a=z({taskId:N()}),o=B({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=z({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=z({method:N(),params:s.loose().optional()}),u=z({_meta:o.optional()}),d=z({method:N(),params:u.loose().optional()}),f=B({_meta:o.optional()}),p=V([N(),F().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:N().optional()}),g=d.extend({method:W(`notifications/cancelled`),params:h}),_=z({src:N(),mimeType:N().optional(),sizes:R(N()).optional(),theme:U([`light`,`dark`]).optional()}),ee=z({icons:R(_).optional()}),te=z({name:N(),title:N().optional()}),ne=te.extend({...te.shape,...ee.shape,version:N(),websiteUrl:N().optional(),description:N().optional()}),re=Bc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,dc(z({form:dc(z({applyDefaults:I().optional()}),t).optional(),url:t.optional()}),t.optional())),ie=B({list:t.optional(),cancel:t.optional(),requests:B({sampling:B({createMessage:t.optional()}).optional(),elicitation:B({create:t.optional()}).optional()}).optional()}),ae=B({list:t.optional(),cancel:t.optional(),requests:B({tools:B({call:t.optional()}).optional()}).optional()}),oe=z({experimental:H(N(),t).optional(),sampling:z({context:t.optional(),tools:t.optional()}).optional(),elicitation:re.optional(),roots:z({listChanged:I().optional()}).optional(),tasks:ie.optional(),extensions:H(N(),t).optional()}),se=s.extend({protocolVersion:N(),capabilities:oe,clientInfo:ne}),ce=l.extend({method:W(`initialize`),params:se}),le=z({experimental:H(N(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:z({listChanged:I().optional()}).optional(),resources:z({subscribe:I().optional(),listChanged:I().optional()}).optional(),tools:z({listChanged:I().optional()}).optional(),tasks:ae.optional(),extensions:H(N(),t).optional()}),v=f.extend({protocolVersion:N(),capabilities:le,serverInfo:ne,instructions:N().optional()}),ue=d.extend({method:W(`notifications/initialized`),params:u.optional()}),de=l.extend({method:W(`ping`),params:s.optional()}),fe=z({progress:F(),total:G(F()),message:G(N())}),pe=z({...u.shape,...fe.shape,progressToken:n}),me=d.extend({method:W(`notifications/progress`),params:pe}),he=s.extend({cursor:r.optional()}),ge=l.extend({params:he.optional()}),_e=f.extend({nextCursor:r.optional()}),ve=z({uri:N(),mimeType:G(N()),_meta:H(N(),L()).optional()}),ye=ve.extend({text:N()}),be=N().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),xe=ve.extend({blob:be}),y=U([`user`,`assistant`]),b=z({audience:R(y).optional(),priority:F().min(0).max(1).optional(),lastModified:Uc({offset:!0}).optional()}),Se=z({...te.shape,...ee.shape,uri:N(),description:G(N()),mimeType:G(N()),size:G(F()),annotations:b.optional(),_meta:G(B({}))}),Ce=z({...te.shape,...ee.shape,uriTemplate:N(),description:G(N()),mimeType:G(N()),annotations:b.optional(),_meta:G(B({}))}),we=ge.extend({method:W(`resources/list`)}),Te=_e.extend({resources:R(Se)}),Ee=ge.extend({method:W(`resources/templates/list`)}),x=_e.extend({resourceTemplates:R(Ce)}),De=s.extend({uri:N()}),Oe=De,ke=l.extend({method:W(`resources/read`),params:Oe}),Ae=f.extend({contents:R(V([ye,xe]))}),je=d.extend({method:W(`notifications/resources/list_changed`),params:u.optional()}),Me=De,Ne=l.extend({method:W(`resources/subscribe`),params:Me}),S=De,Pe=l.extend({method:W(`resources/unsubscribe`),params:S}),Fe=u.extend({uri:N()}),Ie=d.extend({method:W(`notifications/resources/updated`),params:Fe}),Le=z({name:N(),description:G(N()),required:G(I())}),Re=z({...te.shape,...ee.shape,description:G(N()),arguments:G(R(Le)),_meta:G(B({}))}),ze=ge.extend({method:W(`prompts/list`)}),C=_e.extend({prompts:R(Re)}),Be=s.extend({name:N(),arguments:H(N(),N()).optional()}),Ve=l.extend({method:W(`prompts/get`),params:Be}),He=z({type:W(`text`),text:N(),annotations:b.optional(),_meta:H(N(),L()).optional()}),Ue=z({type:W(`image`),data:be,mimeType:N(),annotations:b.optional(),_meta:H(N(),L()).optional()}),We=z({type:W(`audio`),data:be,mimeType:N(),annotations:b.optional(),_meta:H(N(),L()).optional()}),Ge=z({type:W(`tool_use`),name:N(),id:N(),input:H(N(),L()),_meta:H(N(),L()).optional()}),Ke=z({type:W(`resource`),resource:V([ye,xe]),annotations:b.optional(),_meta:H(N(),L()).optional()}),qe=Se.extend({type:W(`resource_link`)}),w=V([He,Ue,We,qe,Ke]),Je=z({role:y,content:w}),Ye=f.extend({description:N().optional(),messages:R(Je)}),T=d.extend({method:W(`notifications/prompts/list_changed`),params:u.optional()}),Xe=z({title:N().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),Ze=z({taskSupport:U([`required`,`optional`,`forbidden`]).optional()}),Qe=z({...te.shape,...ee.shape,description:N().optional(),inputSchema:z({type:W(`object`),properties:H(N(),e).optional(),required:R(N()).optional()}).catchall(L()),outputSchema:z({type:W(`object`),properties:H(N(),e).optional(),required:R(N()).optional()}).catchall(L()).optional(),annotations:Xe.optional(),execution:Ze.optional(),_meta:H(N(),L()).optional()}),$e=ge.extend({method:W(`tools/list`)}),et=_e.extend({tools:R(Qe)}),tt=f.extend({content:R(w),structuredContent:H(N(),L()).optional(),isError:I().optional()}),E=c.extend({name:N(),arguments:H(N(),L()).optional()}),nt=l.extend({method:W(`tools/call`),params:E}),rt=d.extend({method:W(`notifications/tools/list_changed`),params:u.optional()}),it=U([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),at=s.extend({level:it}),ot=l.extend({method:W(`logging/setLevel`),params:at}),st=u.extend({level:it,logger:N().optional(),data:L()}),ct=d.extend({method:W(`notifications/message`),params:st}),lt=z({name:N().optional()}),ut=z({hints:R(lt).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),dt=z({mode:U([`auto`,`required`,`none`]).optional()}),ft=z({type:W(`tool_result`),toolUseId:N().describe(`The unique identifier for the corresponding tool call.`),content:R(w),structuredContent:z({}).loose().optional(),isError:I().optional(),_meta:H(N(),L()).optional()}),pt=lc(`type`,[He,Ue,We]),mt=lc(`type`,[He,Ue,We,Ge,ft]),ht=z({role:y,content:V([mt,R(mt)]),_meta:H(N(),L()).optional()}),gt=c.extend({messages:R(ht),modelPreferences:ut.optional(),systemPrompt:N().optional(),includeContext:U([`none`,`thisServer`,`allServers`]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:R(N()).optional(),metadata:t.optional(),tools:R(Qe).optional(),toolChoice:dt.optional()}),_t=l.extend({method:W(`sampling/createMessage`),params:gt}),vt=f.extend({model:N(),stopReason:G(U([`endTurn`,`stopSequence`,`maxTokens`]).or(N())),role:y,content:pt}),yt=f.extend({model:N(),stopReason:G(U([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(N())),role:y,content:V([mt,R(mt)])}),bt=z({type:W(`boolean`),title:N().optional(),description:N().optional(),default:I().optional()}),xt=z({type:W(`string`),title:N().optional(),description:N().optional(),minLength:F().optional(),maxLength:F().optional(),format:U([`email`,`uri`,`date`,`date-time`]).optional(),default:N().optional()}),St=z({type:U([`number`,`integer`]),title:N().optional(),description:N().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),Ct=z({type:W(`string`),title:N().optional(),description:N().optional(),enum:R(N()),default:N().optional()}),wt=z({type:W(`string`),title:N().optional(),description:N().optional(),oneOf:R(z({const:N(),title:N()})),default:N().optional()}),Tt=z({type:W(`string`),title:N().optional(),description:N().optional(),enum:R(N()),enumNames:R(N()).optional(),default:N().optional()}),Et=V([Ct,wt]),Dt=z({type:W(`array`),title:N().optional(),description:N().optional(),minItems:F().optional(),maxItems:F().optional(),items:z({type:W(`string`),enum:R(N())}),default:R(N()).optional()}),Ot=z({type:W(`array`),title:N().optional(),description:N().optional(),minItems:F().optional(),maxItems:F().optional(),items:z({anyOf:R(z({const:N(),title:N()}))}),default:R(N()).optional()}),kt=V([Dt,Ot]),At=V([Tt,Et,kt]),jt=V([At,bt,xt,St]),Mt=c.extend({mode:W(`form`).optional(),message:N(),requestedSchema:z({type:W(`object`),properties:H(N(),jt),required:R(N()).optional()}).catchall(L())}),Nt=c.extend({mode:W(`url`),message:N(),elicitationId:N(),url:N().url()}),Pt=V([Mt,Nt]),Ft=l.extend({method:W(`elicitation/create`),params:Pt}),It=u.extend({elicitationId:N()}),Lt=d.extend({method:W(`notifications/elicitation/complete`),params:It}),Rt=f.extend({action:U([`accept`,`decline`,`cancel`]),content:Bc(e=>e===null?void 0:e,H(N(),V([N(),F(),I(),R(N())])).optional())}),zt=z({type:W(`ref/resource`),uri:N()}),Bt=z({type:W(`ref/prompt`),name:N()}),Vt=s.extend({ref:V([Bt,zt]),argument:z({name:N(),value:N()}),context:z({arguments:H(N(),N()).optional()}).optional()}),Ht=l.extend({method:W(`completion/complete`),params:Vt}),Ut=f.extend({completion:B({values:R(N()).max(100),total:G(F().int()),hasMore:G(I())})}),Wt=z({uri:N().startsWith(`file://`),name:N().optional(),_meta:H(N(),L()).optional()}),Gt=l.extend({method:W(`roots/list`),params:s.optional()}),Kt=f.extend({roots:R(Wt)}),qt=d.extend({method:W(`notifications/roots/list_changed`),params:u.optional()}),Jt=B({ttl:F().optional(),pollInterval:F().optional()}),Yt=U([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Xt=z({taskId:N(),status:Yt,ttl:V([F(),$s()]),createdAt:N(),lastUpdatedAt:N(),pollInterval:G(F()),statusMessage:G(N())}),Zt=f.extend({task:Xt}),Qt=u.merge(Xt),$t=d.extend({method:W(`notifications/tasks/status`),params:Qt}),en=l.extend({method:W(`tasks/get`),params:s.extend({taskId:N()})}),tn=f.merge(Xt),nn=l.extend({method:W(`tasks/result`),params:s.extend({taskId:N()})}),rn=f.loose(),an=ge.extend({method:W(`tasks/list`)}),D=_e.extend({tasks:R(Xt)}),on=l.extend({method:W(`tasks/cancel`),params:s.extend({taskId:N()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:g,IconSchema:_,IconsSchema:ee,BaseMetadataSchema:te,ImplementationSchema:ne,ClientTasksCapabilitySchema:ie,ServerTasksCapabilitySchema:ae,ClientCapabilitiesSchema:oe,InitializeRequestParamsSchema:se,InitializeRequestSchema:ce,ServerCapabilitiesSchema:le,InitializeResultSchema:v,InitializedNotificationSchema:ue,PingRequestSchema:de,ProgressSchema:fe,ProgressNotificationParamsSchema:pe,ProgressNotificationSchema:me,PaginatedRequestParamsSchema:he,PaginatedRequestSchema:ge,PaginatedResultSchema:_e,ResourceContentsSchema:ve,TextResourceContentsSchema:ye,BlobResourceContentsSchema:xe,RoleSchema:y,AnnotationsSchema:b,ResourceSchema:Se,ResourceTemplateSchema:Ce,ListResourcesRequestSchema:we,ListResourcesResultSchema:Te,ListResourceTemplatesRequestSchema:Ee,ListResourceTemplatesResultSchema:x,ResourceRequestParamsSchema:De,ReadResourceRequestParamsSchema:Oe,ReadResourceRequestSchema:ke,ReadResourceResultSchema:Ae,ResourceListChangedNotificationSchema:je,SubscribeRequestParamsSchema:Me,SubscribeRequestSchema:Ne,UnsubscribeRequestParamsSchema:S,UnsubscribeRequestSchema:Pe,ResourceUpdatedNotificationParamsSchema:Fe,ResourceUpdatedNotificationSchema:Ie,PromptArgumentSchema:Le,PromptSchema:Re,ListPromptsRequestSchema:ze,ListPromptsResultSchema:C,GetPromptRequestParamsSchema:Be,GetPromptRequestSchema:Ve,TextContentSchema:He,ImageContentSchema:Ue,AudioContentSchema:We,ToolUseContentSchema:Ge,EmbeddedResourceSchema:Ke,ResourceLinkSchema:qe,ContentBlockSchema:w,PromptMessageSchema:Je,GetPromptResultSchema:Ye,PromptListChangedNotificationSchema:T,ToolAnnotationsSchema:Xe,ToolExecutionSchema:Ze,ToolSchema:Qe,ListToolsRequestSchema:$e,ListToolsResultSchema:et,CallToolResultSchema:tt,CallToolRequestParamsSchema:E,CallToolRequestSchema:nt,ToolListChangedNotificationSchema:rt,LoggingLevelSchema:it,SetLevelRequestParamsSchema:at,SetLevelRequestSchema:ot,LoggingMessageNotificationParamsSchema:st,LoggingMessageNotificationSchema:ct,ModelHintSchema:lt,ModelPreferencesSchema:ut,ToolChoiceSchema:dt,ToolResultContentSchema:ft,SamplingContentSchema:pt,SamplingMessageContentBlockSchema:mt,SamplingMessageSchema:ht,CreateMessageRequestParamsSchema:gt,CreateMessageRequestSchema:_t,CreateMessageResultSchema:vt,CreateMessageResultWithToolsSchema:yt,BooleanSchemaSchema:bt,StringSchemaSchema:xt,NumberSchemaSchema:St,UntitledSingleSelectEnumSchemaSchema:Ct,TitledSingleSelectEnumSchemaSchema:wt,LegacyTitledEnumSchemaSchema:Tt,SingleSelectEnumSchemaSchema:Et,UntitledMultiSelectEnumSchemaSchema:Dt,TitledMultiSelectEnumSchemaSchema:Ot,MultiSelectEnumSchemaSchema:kt,EnumSchemaSchema:At,PrimitiveSchemaDefinitionSchema:jt,ElicitRequestFormParamsSchema:Mt,ElicitRequestURLParamsSchema:Nt,ElicitRequestParamsSchema:Pt,ElicitRequestSchema:Ft,ElicitationCompleteNotificationParamsSchema:It,ElicitationCompleteNotificationSchema:Lt,ElicitResultSchema:Rt,ResourceTemplateReferenceSchema:zt,PromptReferenceSchema:Bt,CompleteRequestParamsSchema:Vt,CompleteRequestSchema:Ht,CompleteResultSchema:Ut,RootSchema:Wt,ListRootsRequestSchema:Gt,ListRootsResultSchema:Kt,RootsListChangedNotificationSchema:qt,TaskCreationParamsSchema:Jt,TaskStatusSchema:Yt,TaskSchema:Xt,CreateTaskResultSchema:Zt,TaskStatusNotificationParamsSchema:Qt,TaskStatusNotificationSchema:$t,GetTaskRequestSchema:en,GetTaskResultSchema:tn,GetTaskPayloadRequestSchema:nn,GetTaskPayloadResultSchema:rn,ListTasksRequestSchema:an,ListTasksResultSchema:D,CancelTaskRequestSchema:on,CancelTaskResultSchema:f.merge(Xt),ClientRequestSchema:V([de,ce,Ht,ot,Ve,ze,we,Ee,ke,Ne,Pe,nt,$e,en,nn,an,on]),ClientNotificationSchema:V([g,me,ue,qt,$t]),ClientResultSchema:V([m,vt,yt,Rt,Kt,tn,D,Zt]),ServerRequestSchema:V([de,_t,Ft,Gt,en,nn,an,on]),ServerNotificationSchema:V([g,me,ct,Ie,je,rt,T,$t,Lt]),ServerResultSchema:V([m,v,Ut,Ye,C,Te,x,Ae,tt,et,tn,D,Zt]),CallToolResultWireSchema:L().superRefine((e,t)=>{if(!(typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0)){for(let n of Im)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(Lm).pipe(tt)}}var zm;function Bm(){return zm??=Rm()}function Vm(e){return e.type!==`object`}var Hm=new Set([`const`,`enum`,`default`,`examples`]),Um=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function Wm(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Gm(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(Wm(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=Sm(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&Wm(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=Hm.has(o)?s:Um.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Km={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},qm={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Jm={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ym;function Xm(){if(Ym)return Ym;let e=Bm();return Ym={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ym}function Zm(e){return Object.prototype.hasOwnProperty.call(Km,e)}function Qm(e){return Object.prototype.hasOwnProperty.call(qm,e)}function $m(e){return Object.prototype.hasOwnProperty.call(Jm,e)}function eh(e){return $m(e)?Xm().resultSchemas[e]:void 0}function th(e){return Zm(e)?Xm().requestSchemas[e]:void 0}function nh(e){return Qm(e)?Xm().notificationSchemas[e]:void 0}Object.keys(Km),Object.keys(qm);function rh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ih(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var ah={ok:!1,reason:`not-in-era`};function oh(e){return rh(e)&&rh(e.outputSchema)&&Vm(e.outputSchema)}function sh(e){return e}var ch={era:`2025-11-25`,hasRequestMethod:Zm,hasNotificationMethod:Qm,validateRequest:(e,t)=>ih(th(e),t),validateResult:(e,t)=>ih(eh(e),t),validateNotification:(e,t)=>ih(nh(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>ah,validateInputResponse:()=>ah,samplingResultVariant:((e,t)=>{let n=Bm();return ih(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Fm(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&Vm(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(rh(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:sh(e)}}return{kind:`complete`,result:sh(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>oh(e))?t:{...t,tools:n.map(e=>oh(e)?{...e,outputSchema:Gm(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function lh(){let e=Ic(()=>V([N(),F(),I(),$s(),H(N(),e),R(e)])),t=H(N(),e),n=V([N(),F().int()]),r=N(),i=V([N(),F().int()]),a=U([`user`,`assistant`]),o=U([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=N().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=z({ttl:F().optional()}),l=z({taskId:N()}),u=B({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=z({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=z({_meta:u.optional()}),m=z({method:N(),params:p.loose().optional()}),h=z({src:N(),mimeType:N().optional(),sizes:R(N()).optional(),theme:U([`light`,`dark`]).optional()}),g=z({icons:R(h).optional()}),_=z({name:N(),title:N().optional()}),ee=_.extend({..._.shape,...g.shape,version:N(),websiteUrl:N().optional(),description:N().optional()}),te=Bc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,dc(z({form:dc(z({applyDefaults:I().optional()}),t).optional(),url:t.optional()}),t.optional())),ne=B({list:t.optional(),cancel:t.optional(),requests:B({sampling:B({createMessage:t.optional()}).optional(),elicitation:B({create:t.optional()}).optional()}).optional()}),re=B({list:t.optional(),cancel:t.optional(),requests:B({tools:B({call:t.optional()}).optional()}).optional()}),ie=z({experimental:H(N(),t).optional(),sampling:z({context:t.optional(),tools:t.optional()}).optional(),elicitation:te.optional(),roots:z({listChanged:I().optional()}).optional(),tasks:ne.optional(),extensions:H(N(),t).optional()}),ae=z({experimental:H(N(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:z({listChanged:I().optional()}).optional(),resources:z({subscribe:I().optional(),listChanged:I().optional()}).optional(),tools:z({listChanged:I().optional()}).optional(),tasks:re.optional(),extensions:H(N(),t).optional()}),oe=z({progress:F(),total:G(F()),message:G(N())}),se=z({...p.shape,...oe.shape,progressToken:n}),ce=m.extend({method:W(`notifications/progress`),params:se}),le=p.extend({level:o,logger:N().optional(),data:L()}),v=m.extend({method:W(`notifications/message`),params:le}),ue=z({uri:N(),mimeType:G(N()),_meta:H(N(),L()).optional()}),de=ue.extend({text:N()}),fe=ue.extend({blob:s}),pe=z({audience:R(a).optional(),priority:F().min(0).max(1).optional(),lastModified:Uc({offset:!0}).optional()}),me=z({..._.shape,...g.shape,uri:N(),description:G(N()),mimeType:G(N()),size:G(F()),annotations:pe.optional(),_meta:G(B({}))}),he=z({..._.shape,...g.shape,uriTemplate:N(),description:G(N()),mimeType:G(N()),annotations:pe.optional(),_meta:G(B({}))}),ge=m.extend({method:W(`notifications/resources/list_changed`),params:p.optional()}),_e=p.extend({uri:N()}),ve=m.extend({method:W(`notifications/resources/updated`),params:_e}),ye=z({name:N(),description:G(N()),required:G(I())}),be=z({..._.shape,...g.shape,description:G(N()),arguments:G(R(ye)),_meta:G(B({}))}),xe=m.extend({method:W(`notifications/prompts/list_changed`),params:p.optional()}),y=z({type:W(`text`),text:N(),annotations:pe.optional(),_meta:H(N(),L()).optional()}),b=z({type:W(`image`),data:s,mimeType:N(),annotations:pe.optional(),_meta:H(N(),L()).optional()}),Se=z({type:W(`audio`),data:s,mimeType:N(),annotations:pe.optional(),_meta:H(N(),L()).optional()}),Ce=z({type:W(`tool_use`),name:N(),id:N(),input:H(N(),L()),_meta:H(N(),L()).optional()}),we=z({type:W(`resource`),resource:V([de,fe]),annotations:pe.optional(),_meta:H(N(),L()).optional()}),Te=me.extend({type:W(`resource_link`)}),Ee=V([y,b,Se,Te,we]),x=z({role:a,content:Ee}),De=z({title:N().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),Oe=m.extend({method:W(`notifications/tools/list_changed`),params:p.optional()}),ke=z({name:N().optional()}),Ae=z({hints:R(ke).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),je=z({mode:U([`auto`,`required`,`none`]).optional()}),Me=z({type:W(`boolean`),title:N().optional(),description:N().optional(),default:I().optional()}),Ne=z({type:W(`string`),title:N().optional(),description:N().optional(),minLength:F().optional(),maxLength:F().optional(),format:U([`email`,`uri`,`date`,`date-time`]).optional(),default:N().optional()}),S=z({type:U([`number`,`integer`]),title:N().optional(),description:N().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),Pe=z({type:W(`string`),title:N().optional(),description:N().optional(),enum:R(N()),default:N().optional()}),Fe=z({type:W(`string`),title:N().optional(),description:N().optional(),oneOf:R(z({const:N(),title:N()})),default:N().optional()}),Ie=z({type:W(`string`),title:N().optional(),description:N().optional(),enum:R(N()),enumNames:R(N()).optional(),default:N().optional()}),Le=V([Pe,Fe]),Re=z({type:W(`array`),title:N().optional(),description:N().optional(),minItems:F().optional(),maxItems:F().optional(),items:z({type:W(`string`),enum:R(N())}),default:R(N()).optional()}),ze=z({type:W(`array`),title:N().optional(),description:N().optional(),minItems:F().optional(),maxItems:F().optional(),items:z({anyOf:R(z({const:N(),title:N()}))}),default:R(N()).optional()}),C=V([Re,ze]),Be=V([Ie,Le,C]),Ve=V([Be,Me,Ne,S]),He=f.extend({mode:W(`form`).optional(),message:N(),requestedSchema:z({type:W(`object`),properties:H(N(),Ve),required:R(N()).optional()}).catchall(L())}),Ue=z({type:W(`ref/resource`),uri:N()}),We=z({type:W(`ref/prompt`),name:N()}),Ge=z({uri:N().startsWith(`file://`),name:N().optional(),_meta:H(N(),L()).optional()}),Ke=ie.shape,qe=z({experimental:Ke.experimental,sampling:Ke.sampling,elicitation:Ke.elicitation,roots:Ke.roots,extensions:Ke.extensions}),w=ae.shape,Je=z({experimental:w.experimental,logging:w.logging,completions:w.completions,prompts:w.prompts,resources:w.resources,tools:w.tools,extensions:w.extensions}),Ye=B({progressToken:n.optional(),[Jc]:N(),[Yc]:ee.optional(),[Zc]:qe,[$c]:o.optional()}),T=z({..._.shape,...g.shape,description:N().optional(),inputSchema:B({$schema:N().optional(),type:W(`object`)}),outputSchema:B({$schema:N().optional()}).optional(),annotations:De.optional(),_meta:H(N(),L()).optional()}),Xe=z({type:W(`tool_result`),toolUseId:N(),content:R(Ee),structuredContent:L().optional(),isError:I().optional(),_meta:H(N(),L()).optional()}),Ze=V([y,b,Se,Ce,Xe]),Qe=z({role:a,content:V([Ze,R(Ze)]),_meta:H(N(),L()).optional()}),$e=N(),et=B({[Xc]:ee.optional().catch(void 0)}),tt=et.optional();function E(e){return B({_meta:tt,resultType:$e.default(`complete`),...e})}let nt=E({}),rt=E({nextCursor:r.optional()}),it=E({content:R(Ee),structuredContent:L().optional(),isError:I().optional()}),at=E({ttlMs:F().int().min(0),cacheScope:U([`public`,`private`]),tools:R(T),nextCursor:r.optional()}),ot=E({ttlMs:F().int().min(0),cacheScope:U([`public`,`private`]),prompts:R(be),nextCursor:r.optional()}),st=E({description:N().optional(),messages:R(x)}),ct=E({ttlMs:F().int().min(0),cacheScope:U([`public`,`private`]),resources:R(me),nextCursor:r.optional()}),lt=E({ttlMs:F().int().min(0),cacheScope:U([`public`,`private`]),resourceTemplates:R(he),nextCursor:r.optional()}),ut=E({ttlMs:F().int().min(0),cacheScope:U([`public`,`private`]),contents:R(V([de,fe]))}),dt=E({completion:z({values:R(N()).max(100),total:F().int().optional(),hasMore:I().optional()}).loose()}),ft=E({ttlMs:F().int().min(0),cacheScope:U([`public`,`private`])}),pt=E({ttlMs:F().int().min(0).catch(0),cacheScope:U([`public`,`private`]).catch(`private`),supportedVersions:R(N()),capabilities:Je,instructions:N().optional()}),mt=z({messages:R(Qe),modelPreferences:Ae.optional(),systemPrompt:N().optional(),includeContext:U([`none`,`thisServer`,`allServers`]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:R(N()).optional(),metadata:t.optional(),tools:R(T).optional(),toolChoice:je.optional()}),ht=z({method:W(`sampling/createMessage`),params:mt}),gt=z({method:W(`roots/list`),params:z({_meta:H(N(),L()).optional()}).optional()}),_t=z({...Qe.shape,model:N(),stopReason:N().optional()}),vt=z({roots:R(Ge)}),yt=z({action:U([`accept`,`decline`,`cancel`]),content:H(N(),V([N(),F(),I(),R(N())])).optional()}),bt=z({mode:W(`url`),message:N(),url:N().url()}),xt=V([He,bt]),St=z({method:W(`elicitation/create`),params:xt}),Ct=V([ht,gt,St]),wt=V([_t,vt,yt]),Tt=H(N(),Ct),Et=H(N(),wt),Dt=E({inputRequests:Tt.optional(),requestState:N().optional()}),Ot={inputResponses:Et.optional(),requestState:N().optional()},kt=z({_meta:Ye,...Ot}),At=B({progressToken:n.optional()});function jt(e,t){return z({method:W(e),params:z({_meta:Ye,...t})})}function Mt(e,t){return z({method:W(e),params:z({_meta:At.optional(),...t}).optional()})}let Nt={name:N(),arguments:H(N(),L()).optional(),...Ot},Pt={cursor:r.optional()},Ft=jt(`tools/call`,Nt),It=jt(`tools/list`,Pt),Lt=jt(`prompts/list`,Pt),Rt=jt(`prompts/get`,{name:N(),arguments:H(N(),N()).optional(),...Ot}),zt=jt(`resources/list`,Pt),Bt=jt(`resources/templates/list`,Pt),Vt=jt(`resources/read`,{uri:N(),...Ot}),Ht={ref:V([We,Ue]),argument:z({name:N(),value:N()}),context:z({arguments:H(N(),N()).optional()}).optional()},Ut=jt(`completion/complete`,Ht),Wt=jt(`server/discover`,{}),Gt=z({toolsListChanged:I().optional(),promptsListChanged:I().optional(),resourcesListChanged:I().optional(),resourceSubscriptions:R(N()).optional()}),Kt={notifications:Gt},qt=jt(`subscriptions/listen`,Kt),Jt=et.extend({"io.modelcontextprotocol/subscriptionId":i}),Yt=B({_meta:Jt,resultType:$e.default(`complete`)}),Xt={"tools/call":Mt(`tools/call`,Nt),"tools/list":Mt(`tools/list`,Pt),"prompts/get":Mt(`prompts/get`,{name:N(),arguments:H(N(),N()).optional()}),"prompts/list":Mt(`prompts/list`,Pt),"resources/list":Mt(`resources/list`,Pt),"resources/templates/list":Mt(`resources/templates/list`,Pt),"resources/read":Mt(`resources/read`,{uri:N()}),"completion/complete":Mt(`completion/complete`,Ht),"server/discover":Mt(`server/discover`,{}),"subscriptions/listen":Mt(`subscriptions/listen`,Kt)};function Zt(e){return B({_meta:tt,...e})}let Qt={"tools/call":Zt({content:R(Ee),structuredContent:L().optional(),isError:I().optional()}),"tools/list":Zt({ttlMs:F().int().min(0),cacheScope:U([`public`,`private`]),tools:R(T),nextCursor:r.optional()}),"prompts/get":Zt({description:N().optional(),messages:R(x)}),"prompts/list":Zt({ttlMs:F().int().min(0),cacheScope:U([`public`,`private`]),prompts:R(be),nextCursor:r.optional()}),"resources/list":Zt({ttlMs:F().int().min(0),cacheScope:U([`public`,`private`]),resources:R(me),nextCursor:r.optional()}),"resources/templates/list":Zt({ttlMs:F().int().min(0),cacheScope:U([`public`,`private`]),resourceTemplates:R(he),nextCursor:r.optional()}),"resources/read":Zt({ttlMs:F().int().min(0),cacheScope:U([`public`,`private`]),contents:R(V([de,fe]))}),"completion/complete":Zt({completion:z({values:R(N()).max(100),total:F().int().optional(),hasMore:I().optional()}).loose()}),"server/discover":Zt({ttlMs:F().int().min(0).catch(0),cacheScope:U([`public`,`private`]).catch(`private`),supportedVersions:R(N()),capabilities:Je,instructions:N().optional()}),"subscriptions/listen":Zt({})},$t=B({"io.modelcontextprotocol/subscriptionId":i.optional()}),en=z({method:W(`notifications/subscriptions/acknowledged`),params:z({_meta:$t.optional(),notifications:Gt})}),tn=z({_meta:$t.optional(),requestId:i,reason:N().optional()}),nn=z({method:W(`notifications/cancelled`),params:tn}),rn={"notifications/cancelled":nn,"notifications/progress":ce,"notifications/message":v,"notifications/resources/updated":ve,"notifications/resources/list_changed":ge,"notifications/tools/list_changed":Oe,"notifications/prompts/list_changed":xe,"notifications/subscriptions/acknowledged":en},an=e=>z({jsonrpc:W(`2.0`),id:V([N(),F().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:g,BaseMetadataSchema:_,ImplementationSchema:ee,ClientTasksCapabilitySchema:ne,ServerTasksCapabilitySchema:re,ClientCapabilitiesSchema:ie,ServerCapabilitiesSchema:ae,ProgressSchema:oe,ProgressNotificationParamsSchema:se,ProgressNotificationSchema:ce,LoggingMessageNotificationParamsSchema:le,LoggingMessageNotificationSchema:v,ResourceContentsSchema:ue,TextResourceContentsSchema:de,BlobResourceContentsSchema:fe,AnnotationsSchema:pe,ResourceSchema:me,ResourceTemplateSchema:he,ResourceListChangedNotificationSchema:ge,ResourceUpdatedNotificationParamsSchema:_e,ResourceUpdatedNotificationSchema:ve,PromptArgumentSchema:ye,PromptSchema:be,PromptListChangedNotificationSchema:xe,TextContentSchema:y,ImageContentSchema:b,AudioContentSchema:Se,ToolUseContentSchema:Ce,EmbeddedResourceSchema:we,ResourceLinkSchema:Te,ContentBlockSchema:Ee,PromptMessageSchema:x,ToolAnnotationsSchema:De,ToolListChangedNotificationSchema:Oe,ModelHintSchema:ke,ModelPreferencesSchema:Ae,ToolChoiceSchema:je,BooleanSchemaSchema:Me,StringSchemaSchema:Ne,NumberSchemaSchema:S,UntitledSingleSelectEnumSchemaSchema:Pe,TitledSingleSelectEnumSchemaSchema:Fe,LegacyTitledEnumSchemaSchema:Ie,SingleSelectEnumSchemaSchema:Le,UntitledMultiSelectEnumSchemaSchema:Re,TitledMultiSelectEnumSchemaSchema:ze,MultiSelectEnumSchemaSchema:C,EnumSchemaSchema:Be,PrimitiveSchemaDefinitionSchema:Ve,ElicitRequestFormParamsSchema:He,ResourceTemplateReferenceSchema:Ue,PromptReferenceSchema:We,RootSchema:Ge,ClientCapabilities2026Schema:qe,ServerCapabilities2026Schema:Je,RequestMetaEnvelopeSchema:Ye,ToolSchema:T,ToolResultContentSchema:Xe,SamplingMessageContentBlockSchema:Ze,SamplingMessageSchema:Qe,ResultTypeSchema:$e,ResultMetaSchema:et,ResultSchema:nt,PaginatedResultSchema:rt,CallToolResultSchema:it,ListToolsResultSchema:at,ListPromptsResultSchema:ot,GetPromptResultSchema:st,ListResourcesResultSchema:ct,ListResourceTemplatesResultSchema:lt,ReadResourceResultSchema:ut,CompleteResultSchema:dt,CacheableResultSchema:ft,DiscoverResultSchema:pt,CreateMessageRequestParamsSchema:mt,CreateMessageRequestSchema:ht,ListRootsRequestSchema:gt,CreateMessageResultSchema:_t,ListRootsResultSchema:vt,ElicitResultSchema:yt,ElicitRequestURLParamsSchema:bt,ElicitRequestParamsSchema:xt,ElicitRequestSchema:St,InputRequestSchema:Ct,InputResponseSchema:wt,InputRequestsSchema:Tt,InputResponsesSchema:Et,InputRequiredResultSchema:Dt,InputResponseRequestParamsSchema:kt,CallToolRequestSchema:Ft,ListToolsRequestSchema:It,ListPromptsRequestSchema:Lt,GetPromptRequestSchema:Rt,ListResourcesRequestSchema:zt,ListResourceTemplatesRequestSchema:Bt,ReadResourceRequestSchema:Vt,CompleteRequestSchema:Ut,DiscoverRequestSchema:Wt,SubscriptionFilterSchema:Gt,SubscriptionsListenRequestSchema:qt,SubscriptionsListenResultMetaSchema:Jt,SubscriptionsListenResultSchema:Yt,dispatchRequestSchemas:Xt,dispatchResultSchemas:Qt,NotificationMetaSchema:$t,SubscriptionsAcknowledgedNotificationSchema:en,CancelledNotificationParamsSchema:tn,CancelledNotificationSchema:nn,notificationSchemas2026:rn,JSONRPCResultResponseSchema:an(nt),CallToolResultResponseSchema:an(V([it,Dt])),ListToolsResultResponseSchema:an(at),ListPromptsResultResponseSchema:an(ot),GetPromptResultResponseSchema:an(V([st,Dt])),ListResourcesResultResponseSchema:an(ct),ListResourceTemplatesResultResponseSchema:an(lt),ReadResourceResultResponseSchema:an(V([ut,Dt])),CompleteResultResponseSchema:an(dt),DiscoverResultResponseSchema:an(pt)}}var uh;function dh(){return uh??=lh()}var fh=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function ph(e){return fh.includes(e)}var mh=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function hh(e,t){if(t===void 0)return e;let n=e[mh];if(n===void 0)return{...e,[mh]:t};let r={},i=n.ttlMs??t.ttlMs;i!==void 0&&(r.ttlMs=i);let a=n.cacheScope??t.cacheScope;return a!==void 0&&(r.cacheScope=a),{...e,[mh]:r}}function gh(e){return e[mh]}function _h(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function vh(e){return e===`public`||e===`private`}function yh(e,t){if(e.ttlMs!==void 0&&!_h(e.ttlMs))throw RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!vh(e.cacheScope))throw RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var Z=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),Q=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return Em(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Em(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Tm(this,new.target)}static fromError(t,n,r){if(t===Z.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new xh(e.elicitations,n)}if(t===Z.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Sh({supported:e.supported,requested:e.requested},n)}if(t===Z.InvalidParams||t===Z.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===Z.ResourceNotFound||Object.keys(e).length===1))return new bh(e.uri,n)}if(t===Z.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Ch({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},bh=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(Z.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},xh=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(Z.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Sh=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Z.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Ch=class extends Q{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(Z.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},wh=0,Th=`private`,Eh=[`tools/call`,`prompts/get`,`resources/read`];function Dh(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||Eh.includes(e))return t;throw new Q(Z.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Oh(e,t){let n=gh(t);if(t.resultType!==`complete`||!ph(e))return n===void 0?t:Nh(t);let r=t,i=_h(r.ttlMs)?r.ttlMs:jh(n),a=vh(r.cacheScope)?r.cacheScope:Mh(n),o={...r,ttlMs:i,cacheScope:a};return delete o[mh],o}function kh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ah(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Xc]:t}}:!kh(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Xc]:t}}}function jh(e){return e!==void 0&&_h(e.ttlMs)?e.ttlMs:wh}function Mh(e){return e!==void 0&&vh(e.cacheScope)?e.cacheScope:Th}function Nh(e){let t={...e};return delete t[mh],t}var Ph=[`elicitation/create`,`sampling/createMessage`,`roots/list`],Fh;function Ih(){if(Fh)return Fh;let e=dh();return Fh={request:{"elicitation/create":z({method:W(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":z({method:W(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":z({method:W(`roots/list`),params:B({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Fh}function Lh(e){return Ph.includes(e)}function Rh(e){return Lh(e)?Ih().request[e]:void 0}function zh(e){return Lh(e)?Ih().response[e]:void 0}var Bh={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},Vh={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function Hh(e){return Object.prototype.hasOwnProperty.call(Bh,e)}function Uh(e){return Object.prototype.hasOwnProperty.call(Vh,e)}function Wh(e){return Object.prototype.hasOwnProperty.call(Bh,e)}function Gh(e){return Hh(e)?dh().dispatchRequestSchemas[e]:void 0}function Kh(e){return Wh(e)?dh().dispatchResultSchemas[e]:void 0}function qh(e){return Uh(e)?dh().notificationSchemas2026[e]:void 0}Object.keys(Bh),Object.keys(Vh);function Jh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Yh(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Xh={ok:!1,reason:`not-in-era`},Zh=[Jc,Zc];function Qh(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Jh(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Jh(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Jh(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var $h={era:`2026-07-28`,hasRequestMethod:Hh,hasNotificationMethod:Uh,hasInputRequestMethod:e=>Rh(e)!==void 0,validateRequest:(e,t)=>Yh(Gh(e),t),validateResult:(e,t)=>Yh(Kh(e),t),validateNotification:(e,t)=>Yh(qh(e),t),validateInputRequest:(e,t)=>Yh(Rh(e),t),validateInputResponse:(e,t)=>Yh(zh(e),t),samplingResultVariant:()=>Xh,outboundEnvelope(e){return{[Jc]:e.protocolVersion,[Yc]:e.clientInfo,[Zc]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Zh)n in e||t.push({key:n,problem:`missing`});let n=dh().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>Fm(e),inputRequestSchema:Rh,decodeResult(e,t){if(!Jh(t))return{kind:`invalid`,error:new X(Y.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new X(Y.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new X(Y.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Jh(n)?n:{},i=t.requestState;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new X(Y.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i}}}if(n!==`complete`)return{kind:`invalid`,error:new X(Y.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=tg(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new X(Y.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return Ah(Oh(e,Dh(e,Qh(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=dh().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},eg;function tg(){if(eg)return eg;let e=dh();return eg={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},eg}var ng=`2026-07-28`;function rg(e){return e!==void 0&&Mm(e)?$h:ch}function ig(e){return e.revision===void 0?e.era===`modern`?$h.era:ch.era:rg(e.revision).era}function ag(e){return sg.some(t=>t.hasRequestMethod(e))}function og(e){return sg.some(t=>t.hasNotificationMethod(e))}var sg=[ch,$h],cg=_m({AnnotationsSchema:()=>Yl,AudioContentSchema:()=>Ou,BaseMetadataSchema:()=>wl,BaseRequestParamsSchema:()=>sl,BlobResourceContentsSchema:()=>ql,BooleanSchemaSchema:()=>ld,CallToolRequestParamsSchema:()=>Uu,CallToolRequestSchema:()=>Wu,CallToolResultSchema:()=>Vu,CancelTaskRequestSchema:()=>Yd,CancelTaskResultSchema:()=>Xd,CancelledNotificationParamsSchema:()=>bl,CancelledNotificationSchema:()=>xl,ClientCapabilitiesSchema:()=>kl,ClientNotificationSchema:()=>Qd,ClientRequestSchema:()=>Zd,ClientResultSchema:()=>$d,ClientTasksCapabilitySchema:()=>Dl,CompatibilityCallToolResultSchema:()=>Hu,CompleteRequestParamsSchema:()=>Ad,CompleteRequestSchema:()=>jd,CompleteResultSchema:()=>Md,ContentBlockSchema:()=>Mu,CreateMessageRequestParamsSchema:()=>ad,CreateMessageRequestSchema:()=>od,CreateMessageResultSchema:()=>sd,CreateMessageResultWithToolsSchema:()=>cd,CreateTaskResultSchema:()=>Bd,CursorSchema:()=>rl,DiscoverRequestSchema:()=>Fl,DiscoverResultSchema:()=>Il,ElicitRequestFormParamsSchema:()=>xd,ElicitRequestParamsSchema:()=>Cd,ElicitRequestSchema:()=>wd,ElicitRequestURLParamsSchema:()=>Sd,ElicitResultSchema:()=>Dd,ElicitationCompleteNotificationParamsSchema:()=>Td,ElicitationCompleteNotificationSchema:()=>Ed,EmbeddedResourceSchema:()=>Au,EmptyResultSchema:()=>yl,EnumSchemaSchema:()=>yd,GetPromptRequestParamsSchema:()=>wu,GetPromptRequestSchema:()=>Tu,GetPromptResultSchema:()=>Pu,GetTaskPayloadRequestSchema:()=>Gd,GetTaskPayloadResultSchema:()=>Kd,GetTaskRequestSchema:()=>Ud,GetTaskResultSchema:()=>Wd,IconSchema:()=>Sl,IconsSchema:()=>Cl,ImageContentSchema:()=>Du,ImplementationSchema:()=>Tl,InitializeRequestParamsSchema:()=>Al,InitializeRequestSchema:()=>jl,InitializeResultSchema:()=>Nl,InitializedNotificationSchema:()=>Pl,JSONArraySchema:()=>tl,JSONObjectSchema:()=>K,JSONRPCErrorResponseSchema:()=>gl,JSONRPCMessageSchema:()=>_l,JSONRPCNotificationSchema:()=>ml,JSONRPCRequestSchema:()=>pl,JSONRPCResponseSchema:()=>vl,JSONRPCResultResponseSchema:()=>hl,JSONValueSchema:()=>el,LegacyTitledEnumSchemaSchema:()=>md,ListChangedOptionsBaseSchema:()=>Ku,ListPromptsRequestSchema:()=>Su,ListPromptsResultSchema:()=>Cu,ListResourceTemplatesRequestSchema:()=>eu,ListResourceTemplatesResultSchema:()=>tu,ListResourcesRequestSchema:()=>Ql,ListResourcesResultSchema:()=>$l,ListRootsRequestSchema:()=>Pd,ListRootsResultSchema:()=>Fd,ListTasksRequestSchema:()=>qd,ListTasksResultSchema:()=>Jd,ListToolsRequestSchema:()=>zu,ListToolsResultSchema:()=>Bu,LoggingLevelSchema:()=>qu,LoggingMessageNotificationParamsSchema:()=>Xu,LoggingMessageNotificationSchema:()=>Zu,ModelHintSchema:()=>Qu,ModelPreferencesSchema:()=>$u,MultiSelectEnumSchemaSchema:()=>vd,NotificationSchema:()=>ul,NotificationsParamsSchema:()=>ll,NumberSchemaSchema:()=>dd,PaginatedRequestParamsSchema:()=>Vl,PaginatedRequestSchema:()=>Hl,PaginatedResultSchema:()=>Ul,PingRequestSchema:()=>Ll,PrimitiveSchemaDefinitionSchema:()=>bd,ProgressNotificationParamsSchema:()=>zl,ProgressNotificationSchema:()=>Bl,ProgressSchema:()=>Rl,ProgressTokenSchema:()=>nl,PromptArgumentSchema:()=>bu,PromptListChangedNotificationSchema:()=>Fu,PromptMessageSchema:()=>Nu,PromptReferenceSchema:()=>kd,PromptSchema:()=>xu,ReadResourceRequestParamsSchema:()=>ru,ReadResourceRequestSchema:()=>iu,ReadResourceResultSchema:()=>au,RelatedTaskMetadataSchema:()=>al,RequestIdSchema:()=>fl,RequestMetaSchema:()=>ol,RequestSchema:()=>q,ResourceContentsSchema:()=>Wl,ResourceLinkSchema:()=>ju,ResourceListChangedNotificationSchema:()=>ou,ResourceRequestParamsSchema:()=>nu,ResourceSchema:()=>Xl,ResourceTemplateReferenceSchema:()=>Od,ResourceTemplateSchema:()=>Zl,ResourceUpdatedNotificationParamsSchema:()=>vu,ResourceUpdatedNotificationSchema:()=>yu,ResultMetaObjectSchema:()=>dl,ResultSchema:()=>J,RoleSchema:()=>Jl,RootSchema:()=>Nd,RootsListChangedNotificationSchema:()=>Id,SamplingContentSchema:()=>nd,SamplingMessageContentBlockSchema:()=>rd,SamplingMessageSchema:()=>id,ServerCapabilitiesSchema:()=>Ml,ServerNotificationSchema:()=>tf,ServerRequestSchema:()=>ef,ServerResultSchema:()=>nf,ServerTasksCapabilitySchema:()=>Ol,SetLevelRequestParamsSchema:()=>Ju,SetLevelRequestSchema:()=>Yu,SingleSelectEnumSchemaSchema:()=>hd,StringSchemaSchema:()=>ud,SubscribeRequestParamsSchema:()=>su,SubscribeRequestSchema:()=>cu,SubscriptionFilterSchema:()=>du,SubscriptionsAcknowledgedNotificationParamsSchema:()=>mu,SubscriptionsAcknowledgedNotificationSchema:()=>hu,SubscriptionsListenRequestParamsSchema:()=>fu,SubscriptionsListenRequestSchema:()=>pu,SubscriptionsListenResultMetaSchema:()=>gu,SubscriptionsListenResultSchema:()=>_u,TaskAugmentedRequestParamsSchema:()=>cl,TaskCreationParamsSchema:()=>Ld,TaskMetadataSchema:()=>il,TaskSchema:()=>zd,TaskStatusNotificationParamsSchema:()=>Vd,TaskStatusNotificationSchema:()=>Hd,TaskStatusSchema:()=>Rd,TextContentSchema:()=>Eu,TextResourceContentsSchema:()=>Gl,TitledMultiSelectEnumSchemaSchema:()=>_d,TitledSingleSelectEnumSchemaSchema:()=>pd,ToolAnnotationsSchema:()=>Iu,ToolChoiceSchema:()=>ed,ToolExecutionSchema:()=>Lu,ToolListChangedNotificationSchema:()=>Gu,ToolResultContentSchema:()=>td,ToolSchema:()=>Ru,ToolUseContentSchema:()=>ku,UnsubscribeRequestParamsSchema:()=>lu,UnsubscribeRequestSchema:()=>uu,UntitledMultiSelectEnumSchemaSchema:()=>gd,UntitledSingleSelectEnumSchemaSchema:()=>fd}),lg=e=>pl.safeParse(e).success,ug=e=>ml.safeParse(e).success,dg=e=>hl.safeParse(e).success,fg=e=>gl.safeParse(e).success,pg=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`;function mg(e){if(e.params.ref.type!==`ref/prompt`)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function hg(e){if(e.params.ref.type!==`ref/resource`)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var gg=`x-mcp-header`,_g=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,vg=new Set([`string`,`integer`,`boolean`,`number`]);function yg(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(gg in o){if(!a||i.length===0)return`${Sg(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let e=o[gg];if(typeof e!=`string`||e.length===0)return`${Sg(i)}: x-mcp-header MUST be a non-empty string`;if(!_g.test(e))return`${Sg(i)}: x-mcp-header '${e}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let r=typeof o.type==`string`?o.type:void 0;if(r===void 0||!vg.has(r))return`${Sg(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${r??`<none>`}`;let s=e.toLowerCase(),c=n.get(s);if(c!==void 0)return`x-mcp-header '${e}' is not case-insensitively unique (also declared as '${c}')`;n.set(s,e),t.push({path:i,headerName:e,type:r})}let s=o.properties;if(typeof s==`object`&&s)for(let[e,t]of Object.entries(s)){let n=r(t,[...i,e],a);if(n!==void 0)return n}for(let e of bg){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&xg.has(e)?Object.values(t):[t];for(let t of n){let n=r(t,[...i,`<${e}>`],!1);if(n!==void 0)return n}}},i=r(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}var bg=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],xg=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function Sg(e){return e.length===0?`<root>`:e.join(`.`)}Z.InvalidRequest,Z.UnsupportedProtocolVersion,Z.InvalidParams,Z.MethodNotFound,Z.InvalidParams,Z.MissingRequiredClientCapability,Z.ParseError,Z.InvalidRequest,Z.MethodNotFound,Z.UnsupportedProtocolVersion,Z.MissingRequiredClientCapability;function Cg(e,t){return ls(e,t)}function wg(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function Tg(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var Eg=!1,Dg=`draft-2020-12`;function Og(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:Dg});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);Eg||(Eg=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=rs(e,{target:Dg,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&kg(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function kg(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||kg(e)))}return!1}function Ag(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function jg(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>Ag(e)).join(`, `)}:{success:!0,data:n.value}}function Mg(e){let t=rs(e,{target:Dg,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var Ng=/\\\.\\d\{(\d+)\}/;function Pg(e){let t=Ng.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>Uc({local:e,offset:t,precision:n}))))}function Fg(e,t){let n;switch(e){case`email`:n=[Os()];break;case`uri`:n=[Ms()];break;case`date`:n=[Wc()];break;case`date-time`:n=Pg(t)}return new Set(n.map(e=>Mg(e)).filter(e=>e!==void 0))}function Ig(e,t,n){return n!==`zod`||Fg(e,t).has(t)}function Lg(e){let t=Og(e,`input`),n=t.properties||{},r=t.required||[];return Object.entries(n).map(([e,t])=>({name:e,description:t?.description,required:r.includes(e)}))}function Rg(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zg(e){try{return Og(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Q(Z.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Bg=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Vg(e){return Bg.has(e)||e.startsWith(`x-`)}var Hg=new Set([`$schema`,...Object.keys(xd.shape.requestedSchema.shape)]),Ug={string:wg([ud,fd,pd,md]),number:wg([dd]),integer:wg([dd]),boolean:wg([ld]),array:wg([gd,_d])},Wg=new Set(ud.shape.format.unwrap().options);function Gg(e,t,n,r){if(!Rg(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Ug,e.type)?Ug[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Vg(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Wg.has(e.format)?(typeof s!=`string`||!Ig(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Kg(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Rg(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Gg(n,`properties.${e}`,t,r)])):Hg.has(i)?n[i]=a:Vg(i)||r.push(i);if(r.length>0)throw new Q(Z.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function qg(e,t){if(!Rg(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!Cg(bd,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Jg(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Jg(e,t[r],`${n}[${r}]`)):!Rg(e)||!Rg(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Jg(r,t[e],i):Vg(e)?[]:[i]})}function Yg(e){if(!Tg(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Kg(zg(e.requestedSchema),t),r=Cg(xd.shape.requestedSchema,n);if(!r.success)throw new Q(Z.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${qg(n,r.error.message)}`);let i=Jg(n,r.data);if(i.length>0)throw new Q(Z.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Q(Z.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Xg(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(Xg,{elicit(e){try{return{method:`elicitation/create`,params:Yg(e)}}catch(e){throw e instanceof Q?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});function Zg(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Qg(e,t){return new Promise((n,r)=>{if(t?.aborted){r(t.reason instanceof X?t.reason:new X(Y.RequestTimeout,String(t.reason)));return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(t?.reason instanceof X?t.reason:new X(Y.RequestTimeout,String(t?.reason)))};t?.addEventListener(`abort`,a,{once:!0})})}function $g(e){let t=new AbortController,n=()=>t.abort(e?.reason);return e?.addEventListener(`abort`,n,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener(`abort`,n)}}var e_=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),t_={IdJagTokenExchangeResponseSchema:uf,OAuthClientInformationFullSchema:hf,OAuthClientInformationSchema:mf,OAuthClientMetadataSchema:pf,OAuthClientRegistrationErrorSchema:gf,OAuthErrorResponseSchema:df,OAuthMetadataSchema:of,OAuthProtectedResourceMetadataSchema:af,OAuthTokenRevocationRequestSchema:_f,OAuthTokensSchema:lf,OpenIdProviderDiscoveryMetadataSchema:cf,OpenIdProviderMetadataSchema:sf},n_={},r_={};function i_(e,t){let n=e.slice(0,-6);n_[n]=t,r_[n]=e=>t.safeParse(e).success}for(let e of e_)i_(e,cg[e]);for(let[e,t]of Object.entries(t_))i_(e,t);Object.freeze(n_),Object.freeze(r_);function a_(e){switch(e){case`initialize`:case`notifications/initialized`:return rg(void 0);case`server/discover`:return rg(ng);default:return}}var o_=[Jc,Yc,Zc,$c],s_=[`inputResponses`,`requestState`];function c_(e,t){let n=e.params;if(!m_(n))return{message:e,lifted:{}};let r=n._meta,i=m_(r)?o_.filter(e=>e in r):[],a=t===`request`?s_.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&m_(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function l_(e,t){let n=e.validateResult(t,void 0);if(!(!n.ok&&n.reason===`not-in-era`))return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function u_(e){return()=>e}var d_=u_(void 0);function f_(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:u_(t)}}}var p_=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Kc,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new X(Y.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new X(Y.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),dg(e)||fg(e)?this._onresponse(e):lg(e)?this._onrequest(e,t):ug(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new X(Y.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=c_(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=ig(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(og(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=c_(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=ig(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(Z.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(ag(n.method)&&!i.hasRequestMethod(n.method)){o(Z.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(Z.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(Z.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:__(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?d_:u_(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),Tg(t))return u(e,t,n);let i=l_(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(Z.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:Z.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),dg(e)?n(e):n(Q.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),Tg(t))return this._requestWithSchemaViaCodec(r,e,t,n);let i=l_(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return rg(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=a_(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(ag(t)&&!e.hasRequestMethod(t))throw new X(Y.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof X?e:new X(Y.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),ee=!1,te=e=>{ee||(this._progressHandlers.delete(h),m===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof X?e:new X(Y.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(ee=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(v_(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;jg(n,o).then(e=>{e.success?d(e.data):f(new X(Y.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>te(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let ne=r?.timeout??6e4;this._setupTimeout(h,ne,r?.maxTotalTimeout,()=>te(new X(Y.RequestTimeout,`Request timed out`,{timeout:ne})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new X(Y.NotConnected,`Not connected`);if(og(t.method)&&!e.hasNotificationMethod(t.method))throw new X(Y.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!ag(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Q(Z.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await jg(t.params,{...r.params});if(!a.success)throw new Q(Z.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!og(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Q(Z.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await jg(t.params,{...r.params});if(!i.success)throw new Q(Z.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function m_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function h_(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];n[r]=m_(a)&&m_(i)?{...a,...i}:i}return n}function g_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function __(e){let t={},n=[];if(!g_(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!g_(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function v_(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}gm((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))();var y_=/^[A-Za-z0-9._-]{1,128}$/;function b_(e){let t=[];if(e.length===0)return{isValid:!1,warnings:[`Tool name cannot be empty`]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(` `)&&t.push(`Tool name contains spaces, which may cause parsing issues`),e.includes(`,`)&&t.push(`Tool name contains commas, which may cause parsing issues`),(e.startsWith(`-`)||e.endsWith(`-`))&&t.push(`Tool name starts or ends with a dash, which may cause parsing issues in some contexts`),(e.startsWith(`.`)||e.endsWith(`.`))&&t.push(`Tool name starts or ends with a dot, which may cause parsing issues in some contexts`),!y_.test(e)){let n=[...e].filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,n)=>n.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${n.map(e=>`"${e}"`).join(`, `)}`,`Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)`),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function x_(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let e of t)console.warn(` - ${e}`);console.warn(`Tool registration will proceed, but this may cause compatibility issues.`),console.warn(`Consider updating the tool name to conform to the MCP tool naming standard.`),console.warn(`See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.`)}}function S_(e){let t=b_(e);return x_(e,t.warnings),t.isValid}var C_=1e6,w_=1e6,T_=1e4,E_=1e6,D_=class e{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,t,n){if(e.length>t)throw Error(`${n} exceeds maximum length of ${t} characters (got ${e.length})`)}template;parts;get variableNames(){return this.parts.flatMap(e=>typeof e==`string`?[]:e.names)}constructor(t){e.validateLength(t,C_,`Template`),this.template=t,this.parts=this.parse(t)}toString(){return this.template}parse(t){let n=[],r=``,i=0,a=0;for(;i<t.length;)if(t[i]===`{`){r&&=(n.push(r),``);let o=t.indexOf(`}`,i);if(o===-1)throw Error(`Unclosed template expression`);if(a++,a>T_)throw Error(`Template contains too many expressions (max ${T_})`);let s=t.slice(i+1,o),c=this.getOperator(s),l=s.includes(`*`),u=this.getNames(s),d=u[0];for(let t of u)e.validateLength(t,w_,`Variable name`);n.push({name:d,operator:c,names:u,exploded:l}),i=o+1}else r+=t[i],i++;return r&&n.push(r),n}getOperator(e){return[`+`,`#`,`.`,`/`,`?`,`&`].find(t=>e.startsWith(t))||``}getNames(e){let t=this.getOperator(e);return e.slice(t.length).split(`,`).map(e=>e.replace(`*`,``).trim()).filter(e=>e.length>0)}encodeValue(t,n){return e.validateLength(t,w_,`Variable value`),n===`+`||n===`#`?encodeURI(t):encodeURIComponent(t)}expandPart(e,t){if(e.operator===`?`||e.operator===`&`){let n=e.names.map(n=>{let r=t[n];return r===void 0?``:`${n}=${Array.isArray(r)?r.map(t=>this.encodeValue(t,e.operator)).join(`,`):this.encodeValue(r.toString(),e.operator)}`}).filter(e=>e.length>0);return n.length===0?``:(e.operator===`?`?`?`:`&`)+n.join(`&`)}if(e.names.length>1){let n=e.names.map(e=>t[e]).filter(e=>e!==void 0);return n.length===0?``:n.map(e=>Array.isArray(e)?e[0]:e).join(`,`)}let n=t[e.name];if(n===void 0)return``;let r=(Array.isArray(n)?n:[n]).map(t=>this.encodeValue(t,e.operator));switch(e.operator){case``:return r.join(`,`);case`+`:return r.join(`,`);case`#`:return`#`+r.join(`,`);case`.`:return`.`+r.join(`.`);case`/`:return`/`+r.join(`/`);default:return r.join(`,`)}}expand(e){let t=``,n=!1;for(let r of this.parts){if(typeof r==`string`){t+=r;continue}let i=this.expandPart(r,e);i&&(t+=(r.operator===`?`||r.operator===`&`)&&n?i.replace(`?`,`&`):i,(r.operator===`?`||r.operator===`&`)&&(n=!0))}return t}escapeRegExp(e){return e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(t){let n=[];for(let n of t.names)e.validateLength(n,w_,`Variable name`);if(t.operator===`?`||t.operator===`&`){for(let e=0;e<t.names.length;e++){let r=t.names[e],i=e===0?`\\`+t.operator:`&`;n.push({pattern:i+this.escapeRegExp(r)+`=([^&]+)`,name:r})}return n}let r,i=t.name;switch(t.operator){case``:r=t.exploded?`([^/,]+(?:,[^/,]+)*)`:`([^/,]+)`;break;case`+`:case`#`:r=`(.+)`;break;case`.`:r=String.raw`\.([^/,]+)`;break;case`/`:r=`/`+(t.exploded?`([^/,]+(?:,[^/,]+)*)`:`([^/,]+)`);break;default:r=`([^/]+)`}return n.push({pattern:r,name:i}),n}match(t){e.validateLength(t,C_,`URI`);let n=`^`,r=[];for(let e of this.parts)if(typeof e==`string`)n+=this.escapeRegExp(e);else{let t=this.partToRegExp(e);for(let{pattern:i,name:a}of t)n+=i,r.push({name:a,exploded:e.exploded})}n+=`$`,e.validateLength(n,E_,`Generated regex pattern`);let i=new RegExp(n),a=t.match(i);if(!a)return null;let o={};for(let[e,t]of r.entries()){let{name:n,exploded:r}=t,i=a[e+1],s=n.replace(`*`,``);o[s]=r&&i.includes(`,`)?i.split(`,`):i}return o}};function O_(e){return typeof e==`object`&&!!e&&`_zod`in e}function k_(e){return typeof e==`object`&&!!e&&!(`_zod`in e)&&`_def`in e&&typeof e._def?.typeName==`string`}function A_(e){if(typeof e!=`object`||!e||Tg(e))return!1;let t=Object.getPrototypeOf(e);return t!==Object.prototype&&t!==null?!1:Object.values(e).every(e=>O_(e))}function j_(e){if(e!==void 0){if(A_(e))return z(e);if(typeof e==`object`&&e&&!Tg(e)&&Object.values(e).some(e=>k_(e)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!Tg(e))throw TypeError(`inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).`);return e}}function M_(e,t){let n=t.getValidator(e);return{"~standard":{version:1,vendor:`mcp`,jsonSchema:{input:()=>e,output:()=>e},validate:e=>{let t=n(e);return t.valid?{value:t.data}:{issues:[{message:t.errorMessage}]}}}}}function N_(e,t){let n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(!N_(e[r],t[r]))return!1;return!0}if(n===`object`){if(!e||!t)return e===t;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!N_(e[r],t[r]))return!1;return!0}return e===t}function P_(e){return encodeURI(F_(e))}function F_(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}var I_={prefixItems:!0,items:!0,allOf:!0,anyOf:!0,oneOf:!0},L_={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependentSchemas:!0},R_={id:!0,$id:!0,$ref:!0,$schema:!0,$anchor:!0,$vocabulary:!0,$comment:!0,default:!0,enum:!0,const:!0,required:!0,type:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},z_=typeof self<`u`&&self.location&&self.location.origin!==`null`?new URL(self.location.origin+self.location.pathname+location.search):new URL(`https://github.com/cfworker`);function B_(e,t=Object.create(null),n=z_,r=``){if(e&&typeof e==`object`&&!Array.isArray(e)){let i=e.$id||e.id;if(i){let a=new URL(i,n.href);a.hash.length>1?t[a.href]=e:(a.hash=``,r===``?n=a:B_(e,t,n))}}else if(e!==!0&&e!==!1)return t;let i=n.href+(r?`#`+r:``);if(t[i]!==void 0)throw Error(`Duplicate schema URI "${i}".`);if(t[i]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:i}),e.$ref&&e.__absolute_ref__===void 0){let t=new URL(e.$ref,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:t.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let t=new URL(e.$recursiveRef,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:t.href})}if(e.$anchor){let r=new URL(`#`+e.$anchor,n.href);t[r.href]=e}for(let i in e){if(R_[i])continue;let a=`${r}/${P_(i)}`,o=e[i];if(Array.isArray(o)){if(I_[i]){let e=o.length;for(let r=0;r<e;r++)B_(o[r],t,n,`${a}/${r}`)}}else if(L_[i])for(let e in o)B_(o[e],t,n,`${a}/${P_(e)}`);else B_(o,t,n,a)}return t}var V_=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,H_=[0,31,28,31,30,31,30,31,31,30,31,30,31],U_=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,W_=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,G_=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,K_=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,q_=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,J_=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Y_=/^(?:\/(?:[^~/]|~0|~1)*)*$/,X_=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Z_=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Q_=e=>{if(e[0]===`"`)return!1;let[t,n,...r]=e.split(`@`);return!t||!n||r.length!==0||t.length>64||n.length>253||t[0]===`.`||t.endsWith(`.`)||t.includes(`..`)||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(`.`).every(e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e))},$_=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ev=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,tv=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function nv(e){return e.test.bind(e)}var rv={date:av,time:ov.bind(void 0,!1),"date-time":cv,duration:tv,uri:dv,"uri-reference":nv(G_),"uri-template":nv(K_),url:nv(q_),email:Q_,hostname:nv(W_),ipv4:nv($_),ipv6:nv(ev),regex:pv,uuid:nv(J_),"json-pointer":nv(Y_),"json-pointer-uri-fragment":nv(X_),"relative-json-pointer":nv(Z_)};function iv(e){return e%4==0&&(e%100!=0||e%400==0)}function av(e){let t=e.match(V_);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&iv(n)?29:H_[r])}function ov(e,t){let n=t.match(U_);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}var sv=/t|\s/i;function cv(e){let t=e.split(sv);return t.length==2&&av(t[0])&&ov(!0,t[1])}var lv=/\/|:/,uv=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function dv(e){return lv.test(e)&&uv.test(e)}var fv=/[^\\]\\Z/;function pv(e){if(fv.test(e))return!1;try{return new RegExp(e,`u`),!0}catch{return!1}}function mv(e){let t=0,n=e.length,r=0,i;for(;r<n;)t++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<n&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return t}function $(e,t,n=`2019-09`,r=B_(t),i=!0,a=null,o=`#`,s=`#`,c=Object.create(null)){if(t===!0)return{valid:!0,errors:[]};if(t===!1)return{valid:!1,errors:[{instanceLocation:o,keyword:`false`,keywordLocation:o,error:`False boolean schema.`}]};let l=typeof e,u;switch(l){case`boolean`:case`number`:case`string`:u=l;break;case`object`:u=e===null?`null`:Array.isArray(e)?`array`:`object`;break;default:throw Error(`Instances of "${l}" type are not supported.`)}let{$ref:d,$recursiveRef:f,$recursiveAnchor:p,type:m,const:h,enum:g,required:_,not:ee,anyOf:te,allOf:ne,oneOf:re,if:ie,then:ae,else:oe,format:se,properties:ce,patternProperties:le,additionalProperties:v,unevaluatedProperties:ue,minProperties:de,maxProperties:fe,propertyNames:pe,dependentRequired:me,dependentSchemas:he,dependencies:ge,prefixItems:_e,items:ve,additionalItems:ye,unevaluatedItems:be,contains:xe,minContains:y,maxContains:b,minItems:Se,maxItems:Ce,uniqueItems:we,minimum:Te,maximum:Ee,exclusiveMinimum:x,exclusiveMaximum:De,multipleOf:Oe,minLength:ke,maxLength:Ae,pattern:je,__absolute_ref__:Me,__absolute_recursive_ref__:Ne}=t,S=[];if(p===!0&&a===null&&(a=t),f===`#`){let l=a===null?r[Ne]:a,u=`${s}/$recursiveRef`,d=$(e,a===null?t:a,n,r,i,l,o,u,c);d.valid||S.push({instanceLocation:o,keyword:`$recursiveRef`,keywordLocation:u,error:`A subschema had errors.`},...d.errors)}if(d!==void 0){let t=r[Me||d];if(t===void 0){let e=`Unresolved $ref "${d}".`;throw Me&&Me!==d&&(e+=` Absolute URI "${Me}".`),e+=`\nKnown schemas:\n- ${Object.keys(r).join(`
56
+ - `)}`,Error(e)}let l=`${s}/$ref`,u=$(e,t,n,r,i,a,o,l,c);if(u.valid||S.push({instanceLocation:o,keyword:`$ref`,keywordLocation:l,error:`A subschema had errors.`},...u.errors),n===`4`||n===`7`)return{valid:S.length===0,errors:S}}if(Array.isArray(m)){let t=m.length,n=!1;for(let r=0;r<t;r++)if(u===m[r]||m[r]===`integer`&&u===`number`&&e%1==0&&e===e){n=!0;break}n||S.push({instanceLocation:o,keyword:`type`,keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m.join(`", "`)}".`})}else m===`integer`?(u!==`number`||e%1||e!==e)&&S.push({instanceLocation:o,keyword:`type`,keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`}):m!==void 0&&u!==m&&S.push({instanceLocation:o,keyword:`type`,keywordLocation:`${s}/type`,error:`Instance type "${u}" is invalid. Expected "${m}".`});if(h!==void 0&&(u===`object`||u===`array`?N_(e,h)||S.push({instanceLocation:o,keyword:`const`,keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`}):e!==h&&S.push({instanceLocation:o,keyword:`const`,keywordLocation:`${s}/const`,error:`Instance does not match ${JSON.stringify(h)}.`})),g!==void 0&&(u===`object`||u===`array`?g.some(t=>N_(e,t))||S.push({instanceLocation:o,keyword:`enum`,keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(t=>e===t)||S.push({instanceLocation:o,keyword:`enum`,keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`})),ee!==void 0){let t=`${s}/not`;$(e,ee,n,r,i,a,o,t).valid&&S.push({instanceLocation:o,keyword:`not`,keywordLocation:t,error:`Instance matched "not" schema.`})}let Pe=[];if(te!==void 0){let t=`${s}/anyOf`,l=S.length,u=!1;for(let s=0;s<te.length;s++){let l=te[s],d=Object.create(c),f=$(e,l,n,r,i,p===!0?a:null,o,`${t}/${s}`,d);S.push(...f.errors),u||=f.valid,f.valid&&Pe.push(d)}u?S.length=l:S.splice(l,0,{instanceLocation:o,keyword:`anyOf`,keywordLocation:t,error:`Instance does not match any subschemas.`})}if(ne!==void 0){let t=`${s}/allOf`,l=S.length,u=!0;for(let s=0;s<ne.length;s++){let l=ne[s],d=Object.create(c),f=$(e,l,n,r,i,p===!0?a:null,o,`${t}/${s}`,d);S.push(...f.errors),u&&=f.valid,f.valid&&Pe.push(d)}u?S.length=l:S.splice(l,0,{instanceLocation:o,keyword:`allOf`,keywordLocation:t,error:`Instance does not match every subschema.`})}if(re!==void 0){let t=`${s}/oneOf`,l=S.length,u=re.filter((s,l)=>{let u=Object.create(c),d=$(e,s,n,r,i,p===!0?a:null,o,`${t}/${l}`,u);return S.push(...d.errors),d.valid&&Pe.push(u),d.valid}).length;u===1?S.length=l:S.splice(l,0,{instanceLocation:o,keyword:`oneOf`,keywordLocation:t,error:`Instance does not match exactly one subschema (${u} matches).`})}if((u===`object`||u===`array`)&&Object.assign(c,...Pe),ie!==void 0){let t=`${s}/if`;if($(e,ie,n,r,i,a,o,t,c).valid){if(ae!==void 0){let l=$(e,ae,n,r,i,a,o,`${s}/then`,c);l.valid||S.push({instanceLocation:o,keyword:`if`,keywordLocation:t,error:`Instance does not match "then" schema.`},...l.errors)}}else if(oe!==void 0){let l=$(e,oe,n,r,i,a,o,`${s}/else`,c);l.valid||S.push({instanceLocation:o,keyword:`if`,keywordLocation:t,error:`Instance does not match "else" schema.`},...l.errors)}}if(u===`object`){if(_!==void 0)for(let t of _)t in e||S.push({instanceLocation:o,keyword:`required`,keywordLocation:`${s}/required`,error:`Instance does not have required property "${t}".`});let t=Object.keys(e);if(de!==void 0&&t.length<de&&S.push({instanceLocation:o,keyword:`minProperties`,keywordLocation:`${s}/minProperties`,error:`Instance does not have at least ${de} properties.`}),fe!==void 0&&t.length>fe&&S.push({instanceLocation:o,keyword:`maxProperties`,keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${fe} properties.`}),pe!==void 0){let t=`${s}/propertyNames`;for(let s in e){let e=`${o}/${P_(s)}`,c=$(s,pe,n,r,i,a,e,t);c.valid||S.push({instanceLocation:o,keyword:`propertyNames`,keywordLocation:t,error:`Property name "${s}" does not match schema.`},...c.errors)}}if(me!==void 0){let t=`${s}/dependantRequired`;for(let n in me)if(n in e){let r=me[n];for(let i of r)i in e||S.push({instanceLocation:o,keyword:`dependentRequired`,keywordLocation:t,error:`Instance has "${n}" but does not have "${i}".`})}}if(he!==void 0)for(let t in he){let l=`${s}/dependentSchemas`;if(t in e){let s=$(e,he[t],n,r,i,a,o,`${l}/${P_(t)}`,c);s.valid||S.push({instanceLocation:o,keyword:`dependentSchemas`,keywordLocation:l,error:`Instance has "${t}" but does not match dependant schema.`},...s.errors)}}if(ge!==void 0){let t=`${s}/dependencies`;for(let s in ge)if(s in e){let c=ge[s];if(Array.isArray(c))for(let n of c)n in e||S.push({instanceLocation:o,keyword:`dependencies`,keywordLocation:t,error:`Instance has "${s}" but does not have "${n}".`});else{let l=$(e,c,n,r,i,a,o,`${t}/${P_(s)}`);l.valid||S.push({instanceLocation:o,keyword:`dependencies`,keywordLocation:t,error:`Instance has "${s}" but does not match dependant schema.`},...l.errors)}}}let l=Object.create(null),u=!1;if(ce!==void 0){let t=`${s}/properties`;for(let s in ce){if(!(s in e))continue;let d=`${o}/${P_(s)}`,f=$(e[s],ce[s],n,r,i,a,d,`${t}/${P_(s)}`);if(f.valid)c[s]=l[s]=!0;else if(u=i,S.push({instanceLocation:o,keyword:`properties`,keywordLocation:t,error:`Property "${s}" does not match schema.`},...f.errors),u)break}}if(!u&&le!==void 0){let t=`${s}/patternProperties`;for(let s in le){let d=new RegExp(s,`u`),f=le[s];for(let p in e){if(!d.test(p))continue;let m=`${o}/${P_(p)}`,h=$(e[p],f,n,r,i,a,m,`${t}/${P_(s)}`);h.valid?c[p]=l[p]=!0:(u=i,S.push({instanceLocation:o,keyword:`patternProperties`,keywordLocation:t,error:`Property "${p}" matches pattern "${s}" but does not match associated schema.`},...h.errors))}}}if(!u&&v!==void 0){let t=`${s}/additionalProperties`;for(let s in e){if(l[s])continue;let d=`${o}/${P_(s)}`,f=$(e[s],v,n,r,i,a,d,t);f.valid?c[s]=!0:(u=i,S.push({instanceLocation:o,keyword:`additionalProperties`,keywordLocation:t,error:`Property "${s}" does not match additional properties schema.`},...f.errors))}}else if(!u&&ue!==void 0){let t=`${s}/unevaluatedProperties`;for(let s in e)if(!c[s]){let l=`${o}/${P_(s)}`,u=$(e[s],ue,n,r,i,a,l,t);u.valid?c[s]=!0:S.push({instanceLocation:o,keyword:`unevaluatedProperties`,keywordLocation:t,error:`Property "${s}" does not match unevaluated properties schema.`},...u.errors)}}}else if(u===`array`){Ce!==void 0&&e.length>Ce&&S.push({instanceLocation:o,keyword:`maxItems`,keywordLocation:`${s}/maxItems`,error:`Array has too many items (${e.length} > ${Ce}).`}),Se!==void 0&&e.length<Se&&S.push({instanceLocation:o,keyword:`minItems`,keywordLocation:`${s}/minItems`,error:`Array has too few items (${e.length} < ${Se}).`});let t=e.length,l=0,u=!1;if(_e!==void 0){let d=`${s}/prefixItems`,f=Math.min(_e.length,t);for(;l<f;l++){let t=$(e[l],_e[l],n,r,i,a,`${o}/${l}`,`${d}/${l}`);if(c[l]=!0,!t.valid&&(u=i,S.push({instanceLocation:o,keyword:`prefixItems`,keywordLocation:d,error:`Items did not match schema.`},...t.errors),u))break}}if(ve!==void 0){let d=`${s}/items`;if(Array.isArray(ve)){let s=Math.min(ve.length,t);for(;l<s;l++){let t=$(e[l],ve[l],n,r,i,a,`${o}/${l}`,`${d}/${l}`);if(c[l]=!0,!t.valid&&(u=i,S.push({instanceLocation:o,keyword:`items`,keywordLocation:d,error:`Items did not match schema.`},...t.errors),u))break}}else for(;l<t;l++){let t=$(e[l],ve,n,r,i,a,`${o}/${l}`,d);if(c[l]=!0,!t.valid&&(u=i,S.push({instanceLocation:o,keyword:`items`,keywordLocation:d,error:`Items did not match schema.`},...t.errors),u))break}if(!u&&ye!==void 0){let d=`${s}/additionalItems`;for(;l<t;l++){let t=$(e[l],ye,n,r,i,a,`${o}/${l}`,d);c[l]=!0,t.valid||(u=i,S.push({instanceLocation:o,keyword:`additionalItems`,keywordLocation:d,error:`Items did not match additional items schema.`},...t.errors))}}}if(xe!==void 0)if(t===0&&y===void 0)S.push({instanceLocation:o,keyword:`contains`,keywordLocation:`${s}/contains`,error:`Array is empty. It must contain at least one item matching the schema.`});else if(y!==void 0&&t<y)S.push({instanceLocation:o,keyword:`minContains`,keywordLocation:`${s}/minContains`,error:`Array has less items (${t}) than minContains (${y}).`});else{let l=`${s}/contains`,u=S.length,d=0;for(let s=0;s<t;s++){let t=$(e[s],xe,n,r,i,a,`${o}/${s}`,l);t.valid?(c[s]=!0,d++):S.push(...t.errors)}d>=(y||0)&&(S.length=u),y===void 0&&b===void 0&&d===0?S.splice(u,0,{instanceLocation:o,keyword:`contains`,keywordLocation:l,error:`Array does not contain item matching schema.`}):y!==void 0&&d<y?S.push({instanceLocation:o,keyword:`minContains`,keywordLocation:`${s}/minContains`,error:`Array must contain at least ${y} items matching schema. Only ${d} items were found.`}):b!==void 0&&d>b&&S.push({instanceLocation:o,keyword:`maxContains`,keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${b} items matching schema. ${d} items were found.`})}if(!u&&be!==void 0){let u=`${s}/unevaluatedItems`;for(;l<t;l++){if(c[l])continue;let t=$(e[l],be,n,r,i,a,`${o}/${l}`,u);c[l]=!0,t.valid||S.push({instanceLocation:o,keyword:`unevaluatedItems`,keywordLocation:u,error:`Items did not match unevaluated items schema.`},...t.errors)}}if(we)for(let n=0;n<t;n++){let r=e[n],i=typeof r==`object`&&!!r;for(let a=0;a<t;a++){if(n===a)continue;let t=e[a];(r===t||i&&typeof t==`object`&&t&&N_(r,t))&&(S.push({instanceLocation:o,keyword:`uniqueItems`,keywordLocation:`${s}/uniqueItems`,error:`Duplicate items at indexes ${n} and ${a}.`}),n=2**53-1,a=2**53-1)}}}else if(u===`number`){if(n===`4`?(Te!==void 0&&(x===!0&&e<=Te||e<Te)&&S.push({instanceLocation:o,keyword:`minimum`,keywordLocation:`${s}/minimum`,error:`${e} is less than ${x?`or equal to `:``} ${Te}.`}),Ee!==void 0&&(De===!0&&e>=Ee||e>Ee)&&S.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${De?`or equal to `:``} ${Ee}.`})):(Te!==void 0&&e<Te&&S.push({instanceLocation:o,keyword:`minimum`,keywordLocation:`${s}/minimum`,error:`${e} is less than ${Te}.`}),Ee!==void 0&&e>Ee&&S.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${Ee}.`}),x!==void 0&&e<=x&&S.push({instanceLocation:o,keyword:`exclusiveMinimum`,keywordLocation:`${s}/exclusiveMinimum`,error:`${e} is less than ${x}.`}),De!==void 0&&e>=De&&S.push({instanceLocation:o,keyword:`exclusiveMaximum`,keywordLocation:`${s}/exclusiveMaximum`,error:`${e} is greater than or equal to ${De}.`})),Oe!==void 0){let t=e%Oe;Math.abs(0-t)>=1.1920929e-7&&Math.abs(Oe-t)>=1.1920929e-7&&S.push({instanceLocation:o,keyword:`multipleOf`,keywordLocation:`${s}/multipleOf`,error:`${e} is not a multiple of ${Oe}.`})}}else if(u===`string`){let t=ke===void 0&&Ae===void 0?0:mv(e);ke!==void 0&&t<ke&&S.push({instanceLocation:o,keyword:`minLength`,keywordLocation:`${s}/minLength`,error:`String is too short (${t} < ${ke}).`}),Ae!==void 0&&t>Ae&&S.push({instanceLocation:o,keyword:`maxLength`,keywordLocation:`${s}/maxLength`,error:`String is too long (${t} > ${Ae}).`}),je!==void 0&&!new RegExp(je,`u`).test(e)&&S.push({instanceLocation:o,keyword:`pattern`,keywordLocation:`${s}/pattern`,error:`String does not match pattern.`}),se!==void 0&&rv[se]&&!rv[se](e)&&S.push({instanceLocation:o,keyword:`format`,keywordLocation:`${s}/format`,error:`String does not match format "${se}".`})}return{valid:S.length===0,errors:S}}var hv=class{schema;draft;shortCircuit;lookup;constructor(e,t=`2019-09`,n=!0){this.schema=e,this.draft=t,this.shortCircuit=n,this.lookup=B_(e)}validate(e){return $(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){t&&(e={...e,$id:t}),B_(e,this.lookup)}},gv=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=Cm(e,`pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.`);return t===`draft-7`?`7`:t}getValidator(e){let t=new hv(e,this.draft??this._draftFor(e),this.shortcircuit);return e=>{let n=t.validate(e);return n.valid?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:n.errors.map(e=>`${e.instanceLocation}: ${e.error}`).join(`; `)}}}},_v=Symbol.for(`mcp.completable`);function vv(e){return!!e&&typeof e==`object`&&_v in e}function yv(e){return e[_v]?.complete}var bv=8,xv=6e5;function Sv(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??bv,roundTimeoutMs:e?.roundTimeoutMs??xv,legacyShim:e?.legacyShim??!0}}function Cv(e,t,n){if(typeof n!=`object`||!n||typeof n.method!=`string`)throw new Q(Z.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let r=n,i=km(r);if(i===void 0)throw new Q(Z.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${r.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:r,required:i}}function wv(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=[...t].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function Tv(e,t){if(e===`tools/call`)return{content:[{type:`text`,text:t}],isError:!0};throw new Q(Z.InternalError,t)}var Ev=class{constructor(e){this._host=e}async fulfill(e,t,n,r,i){let{maxRounds:a,roundTimeoutMs:o}=this._host,s=r.mcpReq.signal,c=i,l=0;for(;;){if(l+=1,l>a)return Tv(e,Zg(e,a));let i=c.inputRequests,u=i!=null&&Object.keys(i).length>0,d=typeof c.requestState==`string`?c.requestState:void 0;if(!u&&d===void 0)throw new Q(Z.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let f;if(u){let t=this._host.resolvedClientCapabilities(r),n=[];for(let[r,a]of Object.entries(i)){let{embedded:i,required:o}=Cv(e,r,a);if(i.method!==`roots/list`&&i.params===void 0)throw new Q(Z.InternalError,`Handler for ${e} returned an input request '${r}' of kind '${i.method}' without params`);if(Am(o,t)!==void 0)return Tv(e,`Cannot request input '${r}' (${i.method}): the client on this 2025-era connection did not declare the required capability${t===void 0?` (no client capabilities are available on this connection — per-request legacy serving cannot receive server-to-client requests)`:``}`);n.push([r,i])}let a=$g(s);try{let e={relatedRequestId:r.mcpReq.id,timeout:o,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:a.signal},t=await Promise.all(n.map(async([t,n])=>{try{return[t,await this._dispatchLeg(n,e)]}catch(e){throw a.abort(e),e}}));f=Object.fromEntries(t)}catch(t){if(s.aborted)throw t;return Tv(e,`Fulfilling input required by '${e}' failed: ${t instanceof Error?t.message:String(t)}`)}finally{a.dispose()}}else await Qg(250,s);let p={...r,mcpReq:{...r.mcpReq,inputResponses:f,droppedInputResponseKeys:void 0,requestState:u_(d)}};if(d!==void 0){let t=await this._host.verifyRequestState(d,p,e);t!==void 0&&(p=f_(p,t))}let m=await t(n,p);if(!pg(m))return m;c=m}}async _dispatchLeg(e,t){switch(e.method){case`elicitation/create`:{let n=e.params;return n.mode===`url`&&n.elicitationId===void 0&&(n={...n,elicitationId:wv()}),await this._host.sendElicitation(n,t)}case`sampling/createMessage`:return await this._host.sendSampling(e.params,t);case`roots/list`:return await this._host.listRoots(e.params,t)}}},Dv=new Set([`tools/call`,`prompts/get`,`resources/read`]),Ov=class extends p_{_clientCapabilities;_clientVersion;_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new Ev({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,n)=>this._verifyRequestState(e,t,n),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new gv,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=Sv(t?.inputRequired),t?.cacheHints!==void 0){for(let[e,n]of Object.entries(t.cacheHints))n!==void 0&&yh(n,`cacheHints['${e}']`);this._cacheHints=t.cacheHints}this.setRequestHandler(`initialize`,e=>this._oninitialize(e)),this.setNotificationHandler(`notifications/initialized`,()=>this.oninitialized?.()),Pm(this._supportedProtocolVersions).length>0&&this.setRequestHandler(`server/discover`,()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler(`logging/setLevel`,async(e,t)=>{let n=t.sessionId||t.http?.req?.headers.get(`mcp-session-id`)||void 0,{level:r}=e.params,i=Cg(qu,r);return i.success&&this._loggingLevels.set(n,i.data),{}})}buildContext(e,t){let n=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(t,n,r)=>{if(!this._capabilities.logging)return Promise.resolve();let i;if(this._servedModernEra()){if(i=e.mcpReq.envelope?.[$c],i===void 0)return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return i!==void 0&&this.LOG_LEVEL_SEVERITY.get(t)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():e.mcpReq.notify({method:`notifications/message`,params:{level:t,data:n,logger:r}})},elicitInput:(e,t)=>this.elicitInput(e,t),requestSampling:(e,t)=>this.createMessage(e,t)},http:n?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(qu.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1};registerCapabilities(e){if(this.transport)throw new X(Y.AlreadyConnected,`Cannot register capabilities after connecting to transport`);let t=!!this._capabilities.logging;this._capabilities=h_(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if(e!==`tools/call`){let n=this._cacheHints?.[e],r=Dv.has(e);return n===void 0&&!r?async(n,r)=>{let i=await t(n,r);if(pg(i))throw new Q(Z.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}:async(i,a)=>{let o=r?await this._invokeInputRequiredCapableHandler(e,t,i,a):await t(i,a);if(pg(o)){if(!r)throw new Q(Z.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return o}return n===void 0?o:hh(o,n)}}return async(e,n)=>{let r=rg(this._negotiatedProtocolVersion),i=r.validateRequest(`tools/call`,e);if(!i.ok)throw new Q(i.reason===`not-in-era`?Z.InternalError:Z.InvalidParams,i.reason===`not-in-era`?`No wire schema for tools/call in the resolved era`:`Invalid tools/call request: ${i.message}`);let a=await this._invokeInputRequiredCapableHandler(`tools/call`,t,e,n);if(pg(a))return a;let o=Lm(a),s=r.validateResult(`tools/call`,o);if(!s.ok)throw new Q(s.reason===`not-in-era`?Z.InternalError:Z.InvalidParams,s.reason===`not-in-era`?`No wire schema for tools/call in the resolved era`:`Invalid tools/call result: ${s.message}`);return s.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&Mm(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,n,r){let i=this._servedModernEra(),a=r.mcpReq.requestState();if(a!==void 0&&typeof a!=`string`)throw new Q(Z.InvalidParams,`Invalid or expired requestState`,{reason:`invalid_request_state`});let o=r;if(typeof a==`string`){let t=await this._verifyRequestState(a,r,e);t!==void 0&&(o=f_(r,t))}let s;try{s=await t(n,o)}catch(e){throw e instanceof Q&&e.code===Z.UrlElicitationRequired&&i?new Q(Z.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { …: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`):e}if(!pg(s))return s;if(!i){if(!this._inputRequiredServing.legacyShim)throw new Q(Z.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??`2025-11-25`}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,n,o,s)}let c=s.inputRequests,l=c!=null&&Object.keys(c).length>0,u=typeof s.requestState==`string`;if(!l&&!u)throw new Q(Z.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(l){let t=this._inputRequestCapabilityView(r);for(let[n,r]of Object.entries(c)){let{embedded:i,required:a}=Cv(e,n,r),o=Am(a,t);if(o!==void 0)throw new Ch({requiredCapabilities:o},`Cannot request input '${n}' (${i.method}): the request's client capabilities do not declare the required capability`)}}return s}async _verifyRequestState(e,t,n){if(this._requestStateVerify!==void 0)try{return await this._requestStateVerify(e,t)}catch(e){throw this.onerror?.(Error(`requestState verification rejected ${n}: ${e instanceof Error?e.message:String(e)}`)),new Q(Z.InvalidParams,`Invalid or expired requestState`,{reason:`invalid_request_state`})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Zc]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new X(Y.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead — the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:`2026-07-28`})}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw new X(Y.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw new X(Y.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw new X(Y.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw new X(Y.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw new X(Y.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw new X(Y.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw new X(Y.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw new X(Y.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){switch(e){case`completion/complete`:if(!this._capabilities.completions)throw new X(Y.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw new X(Y.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw new X(Y.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw new X(Y.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw new X(Y.CapabilityNotSupported,`Server does not support tools (required for ${e})`)}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let n=Nm(this._supportedProtocolVersions),r=n.includes(t)?t:n[0]??`2025-11-25`;return this._negotiatedProtocolVersion=r,this.transport?.setProtocolVersion?.(r),{protocolVersion:r,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Pm(this._supportedProtocolVersions),capabilities:kv(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra(`ping`),this.request({method:`ping`})}async createMessage(e,t){if(this._assertPushApiInServedEra(`sampling/createMessage`),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new X(Y.CapabilityNotSupported,`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages.at(-1),n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages.at(-2):void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw new Q(Z.InvalidParams,`The last message must contain only tool_result content if any is present`);if(!o)throw new Q(Z.InvalidParams,`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new Q(Z.InvalidParams,`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}let n=!!(e.tools||e.toolChoice),r=await this.request({method:`sampling/createMessage`,params:e},t),i=this._wireCodec().samplingResultVariant(n,r);if(!i.ok)throw new X(Y.InvalidResult,`Invalid sampling/createMessage result: ${i.reason===`invalid`?i.message:i.reason}`);return i.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra(`elicitation/create`),e.mode??`form`){case`url`:if(!this._clientCapabilities?.elicitation?.url)throw new X(Y.CapabilityNotSupported,`Client does not support url elicitation.`);break;case`form`:if(!this._clientCapabilities?.elicitation?.form)throw new X(Y.CapabilityNotSupported,`Client does not support form elicitation.`)}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,n){let r=e.mode??`form`,i=n?.validateAcceptedContent??!0;switch(r){case`url`:{let n=e;return this.request({method:`elicitation/create`,params:n},t)}case`form`:{let n=e.mode===`form`?e:{...e,mode:`form`},r=await this.request({method:`elicitation/create`,params:n},t);if(i&&r.action===`accept`&&r.content&&n.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(r.content);if(!e.valid)throw new Q(Z.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof Q?e:new Q(Z.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return r}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new X(Y.CapabilityNotSupported,`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra(`roots/list`),this.request({method:`roots/list`,params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}};function kv(e){return{...e}}var Av=class{server;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(!(t===void 0||!t.enabled)){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(t.inputSchema===void 0)return Nv;try{let n=Og(t.inputSchema,`input`);return this._toolInputSchemaJson[e]=n,n}catch{return}}}constructor(e,t){this.server=new Ov(e,t),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||=(this.server.assertCanSetRequestHandler(`tools/list`),this.server.assertCanSetRequestHandler(`tools/call`),this.server.registerCapabilities({tools:{listChanged:this.server.getCapabilities().tools?.listChanged??!0}}),this.server.setRequestHandler(`tools/list`,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let n={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?Og(t.inputSchema,`input`):Nv,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(n.outputSchema=Og(t.outputSchema,`output`)),n})})),this.server.setRequestHandler(`tools/call`,async(e,t)=>{let n=this._registeredTools[e.params.name];if(!n)throw new Q(Z.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new Q(Z.InvalidParams,`Tool ${e.params.name} disabled`);try{let r=await this.validateToolInput(n,e.params.arguments,e.params.name),i=await this.executeToolHandler(n,r,t);return await this.validateToolOutput(n,i,e.params.name),pg(i)?i:this.server.projectCallToolResult(i,n.outputSchemaJson)}catch(e){if(e instanceof Q&&e.code===Z.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),!0)}createToolError(e){return{content:[{type:`text`,text:e}],isError:!0}}async validateToolInput(e,t,n){if(!e.inputSchema)return;let r=await jg(e.inputSchema,t??{});if(!r.success)throw new Q(Z.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${r.error}`);return r.data}async validateToolOutput(e,t,n){if(!e.outputSchema||pg(t)||t.isError)return;if(t.structuredContent===void 0)throw new Q(Z.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let r=await jg(e.outputSchema,t.structuredContent);if(!r.success)throw new Q(Z.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${r.error}`)}async executeToolHandler(e,t,n){return e.executor(t,n)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||=(this.server.assertCanSetRequestHandler(`completion/complete`),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(`completion/complete`,async e=>{switch(e.params.ref.type){case`ref/prompt`:return mg(e),this.handlePromptCompletion(e,e.params.ref);case`ref/resource`:return hg(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Q(Z.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),!0)}async handlePromptCompletion(e,t){let n=this._registeredPrompts[t.name];if(!n)throw new Q(Z.InvalidParams,`Prompt ${t.name} not found`);if(!n.enabled)throw new Q(Z.InvalidParams,`Prompt ${t.name} disabled`);if(!n.argsSchema)return Lv;let r=Bv(Rv(n.argsSchema)?.[e.params.argument.name]);if(!vv(r))return Lv;let i=yv(r);return i?Iv(await i(e.params.argument.value,e.params.context)):Lv}async handleResourceCompletion(e,t){let n=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!n){if(this._registeredResources[t.uri])return Lv;throw new Q(Z.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let r=n.resourceTemplate.completeCallback(e.params.argument.name);return r?Iv(await r(e.params.argument.value,e.params.context)):Lv}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||=(this.server.assertCanSetRequestHandler(`resources/list`),this.server.assertCanSetRequestHandler(`resources/templates/list`),this.server.assertCanSetRequestHandler(`resources/read`),this.server.registerCapabilities({resources:{listChanged:this.server.getCapabilities().resources?.listChanged??!0}}),this.server.setRequestHandler(`resources/list`,async(e,t)=>{let n=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),r=[];for(let e of Object.values(this._registeredResourceTemplates)){if(!e.resourceTemplate.listCallback)continue;let n=await e.resourceTemplate.listCallback(t);for(let t of n.resources)r.push({...e.metadata,...t})}return{resources:[...n,...r]}}),this.server.setRequestHandler(`resources/templates/list`,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(`resources/read`,async(e,t)=>{let n;try{n=new URL(e.params.uri)}catch{throw new Q(Z.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:`invalid_uri`})}let r=this._registeredResources[n.toString()];if(r){if(!r.enabled)throw new Q(Z.InvalidParams,`Resource ${n} disabled`);return hh(await r.readCallback(n,t),r.cacheHint)}for(let e of Object.values(this._registeredResourceTemplates)){let r=e.resourceTemplate.uriTemplate.match(n.toString());if(r)return hh(await e.readCallback(n,r,t),e.cacheHint)}throw new bh(e.params.uri)}),!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||=(this.server.assertCanSetRequestHandler(`prompts/list`),this.server.assertCanSetRequestHandler(`prompts/get`),this.server.registerCapabilities({prompts:{listChanged:this.server.getCapabilities().prompts?.listChanged??!0}}),this.server.setRequestHandler(`prompts/list`,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?Lg(t.argsSchema):void 0,icons:t.icons,_meta:t._meta}))})),this.server.setRequestHandler(`prompts/get`,async(e,t)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new Q(Z.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new Q(Z.InvalidParams,`Prompt ${e.params.name} disabled`);return n.handler(e.params.arguments,t)}),!0)}registerResource(e,t,n,r){let i=n.cacheHint,a=n;if(i!==void 0){yh(i,`resource ${e}`);let t={...n};delete t.cacheHint,a=t}if(typeof t==`string`){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let o=this._createRegisteredResource(e,n.title,t,a,r);return i!==void 0&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let o=this._createRegisteredResourceTemplate(e,n.title,t,a,r);return i!==void 0&&(o.cacheHint=i),this.setResourceRequestHandlers(),this.sendResourceListChanged(),o}}_createRegisteredResource(e,t,n,r,i){let a={name:e,title:t,metadata:r,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({uri:null}),update:e=>{e.uri!==void 0&&e.uri!==n&&(delete this._registeredResources[n],e.uri&&(this._registeredResources[e.uri]=a)),e.name!==void 0&&(a.name=e.name),e.title!==void 0&&(a.title=e.title),e.metadata!==void 0&&(a.metadata=e.metadata),e.callback!==void 0&&(a.readCallback=e.callback),e.enabled!==void 0&&(a.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=a,a}_createRegisteredResourceTemplate(e,t,n,r,i){let a={resourceTemplate:n,title:t,metadata:r,readCallback:i,enabled:!0,disable:()=>a.update({enabled:!1}),enable:()=>a.update({enabled:!0}),remove:()=>a.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=a)),t.title!==void 0&&(a.title=t.title),t.template!==void 0&&(a.resourceTemplate=t.template),t.metadata!==void 0&&(a.metadata=t.metadata),t.callback!==void 0&&(a.readCallback=t.callback),t.enabled!==void 0&&(a.enabled=t.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=a;let o=n.uriTemplate.variableNames;return Array.isArray(o)&&o.some(e=>!!n.completeCallback(e))&&this.setCompletionRequestHandler(),a}_createRegisteredPrompt(e,t,n,r,i,a,o){let s=r,c=i,l={title:t,description:n,argsSchema:r,icons:a,_meta:o,handler:Fv(e,r,i),enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=l)),t.title!==void 0&&(l.title=t.title),t.description!==void 0&&(l.description=t.description),t.icons!==void 0&&(l.icons=t.icons),t._meta!==void 0&&(l._meta=t._meta);let n=!1;t.argsSchema!==void 0&&(l.argsSchema=t.argsSchema,s=t.argsSchema,n=!0),t.callback!==void 0&&(c=t.callback,n=!0),n&&(l.handler=Fv(e,s,c)),t.enabled!==void 0&&(l.enabled=t.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=l,r){let e=Rv(r);e&&Object.values(e).some(e=>vv(Bv(e)))&&this.setCompletionRequestHandler()}return l}_createRegisteredTool(e,t,n,r,i,a,o,s,c,l){if(S_(e),r!==void 0)try{let t=Og(r,`input`);this._toolInputSchemaJson[e]=t;let n=yg(t);n.valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${n.reason}`)}catch{}let u=l,d={title:t,description:n,inputSchema:r,outputSchema:i,outputSchemaJson:Pv(i),annotations:a,icons:o,execution:s,_meta:c,handler:l,executor:Mv(r,l),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:t=>{t.name!==void 0&&t.name!==e&&(typeof t.name==`string`&&S_(t.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],t.name&&(delete this._toolInputSchemaJson[t.name],this._registeredTools[t.name]=d,e=t.name)),t.title!==void 0&&(d.title=t.title),t.description!==void 0&&(d.description=t.description);let n=!1;t.paramsSchema!==void 0&&(d.inputSchema=t.paramsSchema,delete this._toolInputSchemaJson[e],n=!0),t.callback!==void 0&&(d.handler=t.callback,u=t.callback,n=!0),n&&(d.executor=Mv(d.inputSchema,u)),t.outputSchema!==void 0&&(d.outputSchema=t.outputSchema,d.outputSchemaJson=Pv(t.outputSchema)),t.annotations!==void 0&&(d.annotations=t.annotations),t.icons!==void 0&&(d.icons=t.icons),t._meta!==void 0&&(d._meta=t._meta),t.enabled!==void 0&&(d.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}registerTool(e,t,n){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:r,description:i,inputSchema:a,outputSchema:o,annotations:s,icons:c,_meta:l}=t;return this._createRegisteredTool(e,r,i,j_(a),j_(o),s,c,void 0,l,n)}registerPrompt(e,t,n){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:r,description:i,argsSchema:a,icons:o,_meta:s}=t,c=this._createRegisteredPrompt(e,r,i,j_(a),n,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),c}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}},jv=class{_uriTemplate;constructor(e,t){this._callbacks=t,this._uriTemplate=typeof e==`string`?new D_(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}};function Mv(e,t){if(e){let e=t;return async(t,n)=>e(t,n)}let n=t;return async(e,t)=>n(t)}var Nv={type:`object`,properties:{}};function Pv(e){if(e!==void 0)try{return Og(e,`output`)}catch{return}}function Fv(e,t,n){if(t){let r=n;return async(n,i)=>{let a=await jg(t,n);if(!a.success)throw new Q(Z.InvalidParams,`Invalid arguments for prompt ${e}: ${a.error}`);return r(a.data,i)}}{let e=n;return async(t,n)=>e(n)}}function Iv(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var Lv={completion:{values:[],hasMore:!1}};function Rv(e){let t=e;if(t.shape&&typeof t.shape==`object`)return t.shape}function zv(e){return e?.type===`optional`}function Bv(e){return zv(e)?e.def?.innerType??e:e}var Vv;function Hv(e,t){return M_(e,t??(Vv??=new gv))}var Uv=ep(void 0).inputSchema,Wv=`__isBrowserMcpServer`;function Gv(e){return typeof e==`object`&&!!e&&Wv in e&&e[Wv]===!0}function Kv(e){if(e===null)return{content:[{type:`text`,text:`Tool execution interrupted by navigation`}],isError:!0};let t;try{t=JSON.parse(e)}catch{return Ff(e)}return pg(t)?t:Ff(t)}function qv(e){let t=Object.getOwnPropertyDescriptor(e.inputSchema,`~standard`);return t&&!t.enumerable?e.inputSchema:Hv(e.inputSchema)}function Jv(e){if(!e)return;let{untrustedContentHint:t,...n}=e;return n}function Yv(e,t,n){let r=e.annotations?Bf(e.annotations):void 0;return{name:e.name,...e.title===void 0?{}:{title:e.title},description:e.description,...t===void 0?{}:{inputSchema:t},...r?{annotations:r}:{},execute:n}}var Xv=class extends EventTarget{[Wv]=!0;mcpServer;native;ownerDocument;tools=new Map;peerOrigin;stopObservingPeerOrigin;registrations=new Set;nativeToolAbortControllers=new Map;nativeBackfilledTools=new Map;pendingTools=new Map;removingNativeTools=new Set;nativeSyncQueue=Promise.resolve();nativeToolChangeQueue=Promise.resolve();nativeToolChangeListener;closed=!1;closePromise;ontoolchangeHandler=null;ontoolchangeListener=e=>{this.ontoolchangeHandler?.call(this,e)};constructor(e,t={}){super();let{native:n,...r}=t;this.mcpServer=new Av(e,{...r,capabilities:h_(r.capabilities??{},{tools:{listChanged:!0},resources:{listChanged:!0},prompts:{listChanged:!0}})}),this.native=n,this.ownerDocument=globalThis.document??null,n&&typeof n.addEventListener==`function`&&typeof n.removeEventListener==`function`&&(this.nativeToolChangeListener=()=>{this.closed||(this.nativeToolChangeQueue=this.nativeToolChangeQueue.then(async()=>{try{await this.syncNativeTools()}catch(e){console.warn(`[BrowserMcpServer] Native WebMCP tool reconciliation failed:`,e)}await this.notifyProducerToolsChanged()}))},n.addEventListener(`toolchange`,this.nativeToolChangeListener))}get ontoolchange(){return this.ontoolchangeHandler}set ontoolchange(e){let t=typeof e==`function`?e:null;if(t===null){this.ontoolchangeHandler=null,super.removeEventListener(`toolchange`,this.ontoolchangeListener);return}this.ontoolchangeHandler===null&&super.addEventListener(`toolchange`,this.ontoolchangeListener),this.ontoolchangeHandler=t}async notifyProducerToolsChanged(){this.closed||(await new Promise(e=>setTimeout(e,0)),this.closed||this.dispatchEvent(new Event(`toolchange`)))}getNativeStandardToolsApi(){let e=this.native;return e&&typeof e.executeTool==`function`?e:void 0}async registerNativeToolMirror(e,t,n,r,i){if(!this.native)return;let a=this.native.registerTool,o=n.signal?AbortSignal.any([n.signal,i.signal]):i.signal,s=t.registeredInputSchema===void 0?void 0:JSON.parse(t.registeredInputSchema);this.nativeToolAbortControllers.set(e.name,i);try{await a.call(this.native,Yv(e,s,e=>r(e)),{...n,signal:o})}catch(t){throw i.abort(),this.nativeToolAbortControllers.get(e.name)===i&&this.nativeToolAbortControllers.delete(e.name),t}this.nativeToolAbortControllers.get(e.name)===i&&this.removingNativeTools.delete(e.name)}abortNativeToolMirror(e,t=this.nativeToolAbortControllers.get(e)){!t||this.nativeToolAbortControllers.get(e)!==t||(this.removingNativeTools.add(e),t.abort(),this.nativeToolAbortControllers.delete(e))}validateToolDescriptor(e){if(zf(e),this.tools.has(e.name)||this.pendingTools.has(e.name))throw Rf(`Tool already registered: ${e.name}`);return ep(e.inputSchema)}registerToolInMcp(e,t,n,r){let i=e.outputSchema===void 0?void 0:structuredClone(e.outputSchema),a=i===void 0?void 0:Hv(i),o=Jv(e.annotations),s=t.inputSchema.type===void 0||t.inputSchema.type===`object`,c=s?this.mcpServer.registerTool(e.name,{...e.title===void 0?{}:{title:e.title},description:e.description,inputSchema:qv(t),...a?{outputSchema:a}:{},...o?{annotations:o}:{}},async(t,r)=>{let i=await n(t,r.mcpReq.signal);if(pg(i))throw Error(`WebMCP tool "${e.name}" returned input_required. Multi-round tool flows require BrowserMcpServer.mcpServer.registerTool().`);return Ff(i)}):void 0;return r?.length&&c?.disable(),s||console.warn(`[BrowserMcpServer] Tool "${e.name}" remains available through WebMCP but cannot be exposed over MCP because MCP input schemas require an object root.`),{item:{name:e.name,...e.title===void 0?{}:{title:e.title},description:e.description,inputSchema:t.inputSchema,...i===void 0?{}:{outputSchema:i},...e.annotations?{annotations:e.annotations}:{}},...t.registeredInputSchema===void 0?{}:{registeredInputSchema:t.registeredInputSchema},execute:n,mcpHandle:c,...r?.length?{exposedTo:r}:{}}}registerTool=async(e,t={})=>{let{signal:n,exposedTo:r}=t??{},i={...n?{signal:n}:{},...r?{exposedTo:[...r]}:{}};if(Kf(this.ownerDocument),this.closed)throw Rf(`BrowserMcpServer is closed`);if(!Df(e))throw TypeError(`registerTool(tool) requires a tool object`);let a=kf(e),o=this.validateToolDescriptor(a);i.signal?.throwIfAborted(),Gf(i.exposedTo),i.signal?.throwIfAborted();let s=async(e,t)=>(t?.throwIfAborted(),Uf(Promise.resolve().then(()=>Reflect.apply(a.execute,void 0,[e])),t)),c=new AbortController,l,u=()=>{this.pendingTools.get(a.name)===c&&this.pendingTools.delete(a.name),l&&this.tools.get(a.name)===l?this.removeTool(a.name):this.abortNativeToolMirror(a.name,c)};i.signal?.addEventListener(`abort`,u,{once:!0}),this.pendingTools.set(a.name,c);try{if(await this.registerNativeToolMirror(a,o,i,s,c),this.closed)throw Rf(`BrowserMcpServer is closed`);i.signal?.throwIfAborted(),l=this.registerToolInMcp(a,o,s,i.exposedTo?.map(e=>{let t=new URL(e).origin;return t===`null`?e:t})),this.tools.set(a.name,l),this.applyToolExposure(),i.signal?.aborted&&(u(),i.signal.throwIfAborted())}catch(e){throw this.abortNativeToolMirror(a.name,c),i.signal?.removeEventListener(`abort`,u),i.signal?.throwIfAborted(),e}finally{this.pendingTools.get(a.name)===c&&this.pendingTools.delete(a.name)}if(i.signal&&(l.abortSignal=i.signal,l.abortListener=u),this.tools.get(a.name)===l&&(this.native?await this.nativeToolChangeQueue:await this.notifyProducerToolsChanged()),this.closed)throw Rf(`BrowserMcpServer is closed`);i.signal?.throwIfAborted()};removeTool(e,t){let n=this.tools.get(e);n&&(n.abortSignal&&n.abortListener&&n.abortSignal.removeEventListener(`abort`,n.abortListener),this.tools.delete(e),this.nativeBackfilledTools.delete(e),n.mcpHandle?.remove(),(t?.notify??!0)&&!this.native&&this.notifyProducerToolsChanged()),t?.skipNative||this.abortNativeToolMirror(e)}syncNativeTools(){let e=this.nativeSyncQueue.then(async()=>{if(this.closed)return;let e=this.getNativeStandardToolsApi();e&&await this.backfillNativeStandardTools(e)});return this.nativeSyncQueue=e.then(()=>void 0,()=>void 0),e}async backfillNativeStandardTools(e){let t=await e.getTools();if(this.closed)return;let n=new Map,r=new Set(t.map(({name:e})=>e));for(let e of this.removingNativeTools)r.has(e)||this.removingNativeTools.delete(e);for(let e of t){if(n.has(e.name)||this.pendingTools.has(e.name)||this.removingNativeTools.has(e.name))continue;let t=Uv;if(e.inputSchema!==void 0)try{let n=typeof e.inputSchema==`string`?e.inputSchema:JSON.stringify(e.inputSchema),r=JSON.parse(n);t=Df(r)?r:void 0}catch{t=void 0}if(!t){console.warn(`[BrowserMcpServer] Native tool "${e.name}" was not exposed over MCP because its input schema is malformed.`);continue}let r={name:e.name,...e.title===void 0?{}:{title:e.title},description:e.description,inputSchema:t,...e.annotations?{annotations:e.annotations}:{}};n.set(e.name,{source:e,item:r,fingerprint:JSON.stringify(r)})}for(let[e,t]of this.nativeBackfilledTools){let r=n.get(e);if(!r||r.fingerprint!==t.fingerprint){this.removeTool(e,{skipNative:!0,notify:!1});continue}this.nativeBackfilledTools.set(e,r)}for(let[t,r]of n){if(this.tools.has(t))continue;let n=async(n,r)=>{let i=this.nativeBackfilledTools.get(t)?.source;if(!i)throw Error(`Native tool not found: ${t}`);let a=JSON.stringify(n);return Kv(r?await e.executeTool.call(this.native,i,a,{signal:r}):await e.executeTool.call(this.native,i,a))},i={name:t,...r.item.title===void 0?{}:{title:r.item.title},description:r.item.description,inputSchema:r.item.inputSchema,...r.item.annotations?{annotations:r.item.annotations}:{},execute:e=>n(e)};try{let e=this.validateToolDescriptor(i);this.tools.set(i.name,this.registerToolInMcp(i,e,n,void 0)),this.nativeBackfilledTools.set(t,r)}catch(e){console.warn(`[BrowserMcpServer] Native tool "${t}" was not exposed over MCP because its schema could not be compiled:`,e)}}}registerResource(e){if(this.closed)throw Rf(`BrowserMcpServer is closed`);let t={...e},n={...t.description===void 0?{}:{description:t.description},...t.mimeType===void 0?{}:{mimeType:t.mimeType}},r=t.uri.includes(`{`)?new jv(t.uri,{list:void 0}):void 0,i=r?this.mcpServer.registerResource(t.name,r,n,async(e,n)=>t.read(e,n)):this.mcpServer.registerResource(t.name,t.uri,n,async e=>t.read(e));return this.registrations.add(i),{unregister:()=>{this.registrations.delete(i)&&i.remove()}}}registerPrompt(e){if(this.closed)throw Rf(`BrowserMcpServer is closed`);let t={...e,...e.argsSchema===void 0?{}:{argsSchema:structuredClone(e.argsSchema)}},n=t.argsSchema===void 0?void 0:Hv(t.argsSchema),r=this.mcpServer.registerPrompt(t.name,{...t.description===void 0?{}:{description:t.description},...n?{argsSchema:n}:{}},async e=>t.get(e??{}));return this.registrations.add(r),{unregister:()=>{this.registrations.delete(r)&&r.remove()}}}listTools(){return structuredClone([...this.tools.values()].map(({item:e})=>e))}async getTools(e){if(Kf(this.ownerDocument),this.closed)throw Rf(`BrowserMcpServer is closed`);if(this.native)return this.native.getTools(e);if(Gf(e?.fromOrigins),e?.fromOrigins?.length)throw new DOMException(`Cross-document tool discovery requires native WebMCP`,`NotSupportedError`);let t=globalThis.location?.origin??``,n=globalThis.window,r=[...this.tools.values()].map(({item:e,registeredInputSchema:r})=>{let i=r===void 0?void 0:JSON.parse(r);return{name:e.name,title:e.title??``,description:e.description,...Df(i)?{inputSchema:i}:{},origin:t,window:n,...e.annotations?{annotations:Bf(e.annotations)}:{}}}).sort((e,t)=>e.name<t.name?-1:+(e.name>t.name));return await new Promise(e=>setTimeout(e,0)),r}async executeTool(e,t,n){if(Kf(this.ownerDocument),this.closed)throw Rf(`BrowserMcpServer is closed`);let r=this.getNativeStandardToolsApi();if(r)return r.executeTool.call(this.native,e,t,n);if(typeof e!=`object`||!e)throw TypeError(`RegisteredTool must be an object`);for(let t of[`name`,`description`,`window`,`origin`])if(!(t in e))throw TypeError(`RegisteredTool.${t} is required`);Jf(e.origin);let i=globalThis.location?.origin??``,a=globalThis.window;if(e.origin!==i||e.window!==a)throw If(`Native tool not found: ${e.name}`);n?.signal?.throwIfAborted();let o=this.tools.get(e.name);if(!o)throw If(`Tool not found: ${e.name}`);let s=Vf(t);try{return Hf(await Uf(o.execute(s,n?.signal),o.abortSignal,()=>If(`Tool unregistered`)))}catch(e){throw n?.signal?.aborted&&e===n.signal.reason||o.abortSignal?.aborted?e:Lf(e)}}applyToolExposure(){for(let{exposedTo:e,mcpHandle:t}of this.tools.values()){if(!e?.length||!t)continue;let n=this.peerOrigin!==void 0&&this.peerOrigin!==`null`&&e.includes(this.peerOrigin);n!==t.enabled&&(n?t.enable():t.disable())}}observePeerOrigin(e){if(this.stopObservingPeerOrigin?.(),this.stopObservingPeerOrigin=void 0,this.peerOrigin=void 0,this.applyToolExposure(),!(`clientOrigin`in e))return;let t=e;this.peerOrigin=t.clientOrigin,this.applyToolExposure();let n=t.onclientorigin,r=!0,i=e=>{n?.(e),r&&(this.peerOrigin=e,this.applyToolExposure())};t.onclientorigin=i,this.stopObservingPeerOrigin=()=>{r=!1,t.onclientorigin===i&&(t.onclientorigin=n)}}async connect(e){if(this.closed)throw Rf(`BrowserMcpServer is closed`);if(this.mcpServer.server.transport)throw Rf(`BrowserMcpServer is already connected`);this.observePeerOrigin(e);let t=this.stopObservingPeerOrigin;try{await this.mcpServer.connect(e)}catch(n){throw this.stopObservingPeerOrigin===t&&(t?.(),this.stopObservingPeerOrigin=void 0,this.peerOrigin=void 0,this.applyToolExposure()),this.mcpServer.server.transport===e&&await this.mcpServer.close(),n}}close(){return this.closePromise?this.closePromise:(this.closed=!0,this.stopObservingPeerOrigin?.(),this.stopObservingPeerOrigin=void 0,this.closePromise=(async()=>{this.native&&this.nativeToolChangeListener&&(this.native.removeEventListener(`toolchange`,this.nativeToolChangeListener),this.nativeToolChangeListener=void 0);for(let e of this.nativeToolAbortControllers.keys())this.abortNativeToolMirror(e);for(let e of this.tools.keys())this.removeTool(e,{notify:!1});for(let e of this.registrations)e.remove();this.registrations.clear(),this.nativeBackfilledTools.clear(),this.removingNativeTools.clear(),await this.mcpServer.close()})(),this.closePromise)}},Zv=null;function Qv(){return typeof window<`u`&&window.navigator!==void 0}function $v(){return document.modelContext??navigator.modelContext}function ey(e){let t=Object.getOwnPropertyDescriptor(e,`modelContext`);return t?t.configurable===!0:Object.isExtensible(e)}function ty(e){Object.defineProperty(document,"modelContext",{configurable:!0,enumerable:!0,writable:!1,value:e}),document.modelContext!==e&&console.error(`[WebModelContext] Failed to replace document.modelContext.`,`Descriptor:`,Object.getOwnPropertyDescriptor(document,`modelContext`))}function ny(e){Object.defineProperty(navigator,"modelContext",{configurable:!0,enumerable:!0,writable:!1,value:e}),navigator.modelContext!==e&&console.error(`[WebModelContext] Failed to replace navigator.modelContext.`,`Descriptor:`,Object.getOwnPropertyDescriptor(navigator,`modelContext`))}function ry(e,t,n){n?Object.defineProperty(e,t,n):Reflect.deleteProperty(e,t)}function iy(e,t,n){try{ty(e),ny(e)}catch(e){throw ry(document,`modelContext`,t),ry(navigator,`modelContext`,n),e}}function ay(e){if(window.parent!==window&&e?.iframeServer!==!1)return new bf(typeof e?.iframeServer==`object`?e.iframeServer:{allowedOrigins:[`*`]});if(e?.tabServer===!1)throw Error(`tabServer transport is disabled and iframe transport was not selected`);return new xf(typeof e?.tabServer==`object`?e.tabServer:{allowedOrigins:[`*`]})}function oy(e){if(!Qv()||globalThis.isSecureContext===!1||Zv)return;let t=$v();if(t&&Gv(t))return;pm({installTestingShim:e?.installTestingShim??!0});let n=$v();if(!n)throw Error(`modelContext is not available`);if(!ey(document)||!ey(navigator))return;let r=ay(e?.transport),i=new Xv({name:`${window.location.hostname||`localhost`}-webmcp`,version:`1.0.0`},{native:n}),a=Object.getOwnPropertyDescriptor(document,`modelContext`),o=Object.getOwnPropertyDescriptor(navigator,`modelContext`);try{iy(i,a,o),Zv={server:i,transport:r,previousDocumentModelContextDescriptor:a,previousNavigatorModelContextDescriptor:o}}catch(e){throw i.close(),r.close(),e}(async()=>{try{await i.syncNativeTools()}catch(e){console.warn(`[WebModelContext] Native WebMCP tool synchronization failed:`,e)}if(Zv?.server===i)try{await i.connect(r)}catch(e){console.error(`[WebModelContext] Failed to connect MCP transport:`,e),Zv?.server===i&&sy()}})()}function sy(){if(!Zv)return;let{server:e,transport:t,previousDocumentModelContextDescriptor:n,previousNavigatorModelContextDescriptor:r}=Zv;Zv=null,e.close(),t.close(),ry(document,`modelContext`,n),ry(navigator,`modelContext`,r)}if(typeof window<`u`&&typeof document<`u`){let e=window.__webModelContextOptions;if(e?.autoInitialize!==!1)try{oy(e)}catch(e){console.error(`[WebModelContext] Auto-initialization failed:`,e)}}export{sy as cleanupWebModelContext,oy as initializeWebModelContext};