@ahmedrowaihi/8n 6.0.2 → 6.0.3

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 (338) hide show
  1. package/dist/{cli/adapter.cjs → adapter.cjs} +1 -1
  2. package/dist/index.mjs +4100 -0
  3. package/package.json +11 -108
  4. package/starter/.github/workflows/publish.yml +66 -0
  5. package/starter/.mcp.json +8 -0
  6. package/starter/.vscode/settings.json +7 -0
  7. package/starter/biome.json +33 -0
  8. package/starter/cli.json +13 -0
  9. package/starter/components.json +25 -0
  10. package/starter/next-env.d.ts +6 -0
  11. package/starter/openapi/petstore.json +123 -0
  12. package/starter/package-lock.json +18174 -0
  13. package/starter/package.json +107 -0
  14. package/starter/scripts/build-dist.mts +73 -0
  15. package/starter/scripts/generate-docs.mts +8 -0
  16. package/starter/serve.json +3 -0
  17. package/dist/cli/index.mjs +0 -456
  18. package/src/cli/adapter.ts +0 -41
  19. package/src/cli/commands/build.ts +0 -13
  20. package/src/cli/commands/dev.ts +0 -13
  21. package/src/cli/commands/init.ts +0 -141
  22. package/src/cli/commands/mcp.ts +0 -195
  23. package/src/cli/commands/start.ts +0 -12
  24. package/src/cli/index.ts +0 -26
  25. package/src/cli/load-config.ts +0 -26
  26. package/src/cli/web-app.ts +0 -95
  27. /package/{README.md → starter/README.md} +0 -0
  28. /package/{app → starter/app}/[lang]/(docs)/[section]/[[...slug]]/page.jsx +0 -0
  29. /package/{app → starter/app}/[lang]/(docs)/error.jsx +0 -0
  30. /package/{app → starter/app}/[lang]/(docs)/layout.jsx +0 -0
  31. /package/{app → starter/app}/[lang]/(docs)/loading.jsx +0 -0
  32. /package/{app → starter/app}/[lang]/(marketing)/layout.jsx +0 -0
  33. /package/{app → starter/app}/[lang]/(marketing)/page.jsx +0 -0
  34. /package/{app → starter/app}/[lang]/changelog/[...slug]/layout.jsx +0 -0
  35. /package/{app → starter/app}/[lang]/changelog/[...slug]/page.jsx +0 -0
  36. /package/{app → starter/app}/[lang]/changelog/layout.jsx +0 -0
  37. /package/{app → starter/app}/[lang]/changelog/page.jsx +0 -0
  38. /package/{app → starter/app}/[lang]/error.jsx +0 -0
  39. /package/{app → starter/app}/[lang]/lang-setup.jsx +0 -0
  40. /package/{app → starter/app}/[lang]/layout.jsx +0 -0
  41. /package/{app → starter/app}/[lang]/loading.jsx +0 -0
  42. /package/{app → starter/app}/[lang]/playground/page.jsx +0 -0
  43. /package/{app → starter/app}/[lang]/rss.xml/route.js +0 -0
  44. /package/{app → starter/app}/api/chat/route.js +0 -0
  45. /package/{app → starter/app}/api/dev/watch/route.js +0 -0
  46. /package/{app → starter/app}/api/pages/route.js +0 -0
  47. /package/{app → starter/app}/api/search/route.js +0 -0
  48. /package/{app → starter/app}/excalidraw/layout.jsx +0 -0
  49. /package/{app → starter/app}/excalidraw/page.jsx +0 -0
  50. /package/{app → starter/app}/layout.jsx +0 -0
  51. /package/{app → starter/app}/llms-full.txt/route.js +0 -0
  52. /package/{app → starter/app}/llms.mdx/[section]/[...slug]/route.js +0 -0
  53. /package/{app → starter/app}/llms.txt/route.js +0 -0
  54. /package/{app → starter/app}/not-found.jsx +0 -0
  55. /package/{app → starter/app}/page.jsx +0 -0
  56. /package/{app → starter/app}/robots.js +0 -0
  57. /package/{app → starter/app}/sitemap.js +0 -0
  58. /package/{content → starter/content}/api/ar/meta.json +0 -0
  59. /package/{content → starter/content}/api/en/createPet.mdx +0 -0
  60. /package/{content → starter/content}/api/en/deletePet.mdx +0 -0
  61. /package/{content → starter/content}/api/en/index.mdx +0 -0
  62. /package/{content → starter/content}/api/en/listPets.mdx +0 -0
  63. /package/{content → starter/content}/api/en/meta.json +0 -0
  64. /package/{content → starter/content}/api/en/showPetById.mdx +0 -0
  65. /package/{content → starter/content}/changelog/ar/meta.json +0 -0
  66. /package/{content → starter/content}/changelog/ar/v1.0.0.mdx +0 -0
  67. /package/{content → starter/content}/changelog/en/meta.json +0 -0
  68. /package/{content → starter/content}/changelog/en/v1.0.0.mdx +0 -0
  69. /package/{content → starter/content}/docs/ar/components/accordion.mdx +0 -0
  70. /package/{content → starter/content}/docs/ar/components/audio.mdx +0 -0
  71. /package/{content → starter/content}/docs/ar/components/callout.mdx +0 -0
  72. /package/{content → starter/content}/docs/ar/components/cards.mdx +0 -0
  73. /package/{content → starter/content}/docs/ar/components/circuit-board.mdx +0 -0
  74. /package/{content → starter/content}/docs/ar/components/code-blocks.mdx +0 -0
  75. /package/{content → starter/content}/docs/ar/components/drawio.mdx +0 -0
  76. /package/{content → starter/content}/docs/ar/components/dynamic-code-block.mdx +0 -0
  77. /package/{content → starter/content}/docs/ar/components/excalidraw.mdx +0 -0
  78. /package/{content → starter/content}/docs/ar/components/figma.mdx +0 -0
  79. /package/{content → starter/content}/docs/ar/components/files.mdx +0 -0
  80. /package/{content → starter/content}/docs/ar/components/index.mdx +0 -0
  81. /package/{content → starter/content}/docs/ar/components/inline-toc.mdx +0 -0
  82. /package/{content → starter/content}/docs/ar/components/math.mdx +0 -0
  83. /package/{content → starter/content}/docs/ar/components/mermaid.mdx +0 -0
  84. /package/{content → starter/content}/docs/ar/components/meta.json +0 -0
  85. /package/{content → starter/content}/docs/ar/components/steps.mdx +0 -0
  86. /package/{content → starter/content}/docs/ar/components/tabs.mdx +0 -0
  87. /package/{content → starter/content}/docs/ar/components/tweet.mdx +0 -0
  88. /package/{content → starter/content}/docs/ar/components/twoslash.mdx +0 -0
  89. /package/{content → starter/content}/docs/ar/components/type-table.mdx +0 -0
  90. /package/{content → starter/content}/docs/ar/components/video.mdx +0 -0
  91. /package/{content → starter/content}/docs/ar/getting-started.mdx +0 -0
  92. /package/{content → starter/content}/docs/ar/index.mdx +0 -0
  93. /package/{content → starter/content}/docs/ar/meta.json +0 -0
  94. /package/{content → starter/content}/docs/en/components/accordion.mdx +0 -0
  95. /package/{content → starter/content}/docs/en/components/audio.mdx +0 -0
  96. /package/{content → starter/content}/docs/en/components/callout.mdx +0 -0
  97. /package/{content → starter/content}/docs/en/components/cards.mdx +0 -0
  98. /package/{content → starter/content}/docs/en/components/circuit-board.mdx +0 -0
  99. /package/{content → starter/content}/docs/en/components/code-blocks.mdx +0 -0
  100. /package/{content → starter/content}/docs/en/components/drawio.mdx +0 -0
  101. /package/{content → starter/content}/docs/en/components/dynamic-code-block.mdx +0 -0
  102. /package/{content → starter/content}/docs/en/components/excalidraw.mdx +0 -0
  103. /package/{content → starter/content}/docs/en/components/figma.mdx +0 -0
  104. /package/{content → starter/content}/docs/en/components/files.mdx +0 -0
  105. /package/{content → starter/content}/docs/en/components/index.mdx +0 -0
  106. /package/{content → starter/content}/docs/en/components/inline-toc.mdx +0 -0
  107. /package/{content → starter/content}/docs/en/components/math.mdx +0 -0
  108. /package/{content → starter/content}/docs/en/components/mermaid.mdx +0 -0
  109. /package/{content → starter/content}/docs/en/components/meta.json +0 -0
  110. /package/{content → starter/content}/docs/en/components/steps.mdx +0 -0
  111. /package/{content → starter/content}/docs/en/components/tabs.mdx +0 -0
  112. /package/{content → starter/content}/docs/en/components/tweet.mdx +0 -0
  113. /package/{content → starter/content}/docs/en/components/twoslash.mdx +0 -0
  114. /package/{content → starter/content}/docs/en/components/type-table.mdx +0 -0
  115. /package/{content → starter/content}/docs/en/components/video.mdx +0 -0
  116. /package/{content → starter/content}/docs/en/getting-started.mdx +0 -0
  117. /package/{content → starter/content}/docs/en/index.mdx +0 -0
  118. /package/{content → starter/content}/docs/en/meta.json +0 -0
  119. /package/{content → starter/content}/mcp/ar/meta.json +0 -0
  120. /package/{content → starter/content}/mcp/en/components.mdx +0 -0
  121. /package/{content → starter/content}/mcp/en/config.mdx +0 -0
  122. /package/{content → starter/content}/mcp/en/frontmatter.mdx +0 -0
  123. /package/{content → starter/content}/mcp/en/meta.json +0 -0
  124. /package/{content → starter/content}/mcp/en/structure.mdx +0 -0
  125. /package/{content → starter/content}/ui/ar/meta.json +0 -0
  126. /package/{content → starter/content}/ui/en/badge.mdx +0 -0
  127. /package/{content → starter/content}/ui/en/index.mdx +0 -0
  128. /package/{content → starter/content}/ui/en/meta.json +0 -0
  129. /package/{next.config.mjs → starter/next.config.mjs} +0 -0
  130. /package/{postcss.config.mjs → starter/postcss.config.mjs} +0 -0
  131. /package/{public → starter/public}/apple-touch-icon.png +0 -0
  132. /package/{public → starter/public}/fonts/ThmanyahSans/Thmanyahsans12-Black.woff2 +0 -0
  133. /package/{public → starter/public}/fonts/ThmanyahSans/Thmanyahsans12-Bold.woff2 +0 -0
  134. /package/{public → starter/public}/fonts/ThmanyahSans/Thmanyahsans12-Light.woff2 +0 -0
  135. /package/{public → starter/public}/fonts/ThmanyahSans/Thmanyahsans12-Medium.woff2 +0 -0
  136. /package/{public → starter/public}/fonts/ThmanyahSans/Thmanyahsans12-Regular.woff2 +0 -0
  137. /package/{public → starter/public}/fonts/ThmanyahSerifDisplay/Thmanyahserifdisplay12-Black.woff2 +0 -0
  138. /package/{public → starter/public}/fonts/ThmanyahSerifDisplay/Thmanyahserifdisplay12-Bold.woff2 +0 -0
  139. /package/{public → starter/public}/fonts/ThmanyahSerifDisplay/Thmanyahserifdisplay12-Light.woff2 +0 -0
  140. /package/{public → starter/public}/fonts/ThmanyahSerifDisplay/Thmanyahserifdisplay12-Medium.woff2 +0 -0
  141. /package/{public → starter/public}/fonts/ThmanyahSerifDisplay/Thmanyahserifdisplay12-Regular.woff2 +0 -0
  142. /package/{public → starter/public}/fonts/sar.woff +0 -0
  143. /package/{public → starter/public}/manifest.json +0 -0
  144. /package/{public → starter/public}/thmanyah-icon.svg +0 -0
  145. /package/{src → starter/src}/components/ai-elements/conversation.jsx +0 -0
  146. /package/{src → starter/src}/components/ai-elements/reasoning.jsx +0 -0
  147. /package/{src → starter/src}/components/ai-elements/shimmer.jsx +0 -0
  148. /package/{src → starter/src}/components/api-page.client.jsx +0 -0
  149. /package/{src → starter/src}/components/api-page.jsx +0 -0
  150. /package/{src → starter/src}/components/blocks/audio.jsx +0 -0
  151. /package/{src → starter/src}/components/blocks/circuit-board.jsx +0 -0
  152. /package/{src → starter/src}/components/blocks/drawio-block.jsx +0 -0
  153. /package/{src → starter/src}/components/blocks/excalidraw.jsx +0 -0
  154. /package/{src → starter/src}/components/blocks/figma-block.jsx +0 -0
  155. /package/{src → starter/src}/components/blocks/mermaid.jsx +0 -0
  156. /package/{src → starter/src}/components/blocks/video.jsx +0 -0
  157. /package/{src → starter/src}/components/credit-button.jsx +0 -0
  158. /package/{src → starter/src}/components/dev-refresh.jsx +0 -0
  159. /package/{src → starter/src}/components/error-state.jsx +0 -0
  160. /package/{src → starter/src}/components/feedback/client.jsx +0 -0
  161. /package/{src → starter/src}/components/feedback/github.js +0 -0
  162. /package/{src → starter/src}/components/feedback/schema.js +0 -0
  163. /package/{src → starter/src}/components/fumadocs/layout/docs/client.jsx +0 -0
  164. /package/{src → starter/src}/components/fumadocs/layout/docs/index.jsx +0 -0
  165. /package/{src → starter/src}/components/fumadocs/layout/docs/page/client.jsx +0 -0
  166. /package/{src → starter/src}/components/fumadocs/layout/docs/page/docs-toc.jsx +0 -0
  167. /package/{src → starter/src}/components/fumadocs/layout/docs/page/index.jsx +0 -0
  168. /package/{src → starter/src}/components/fumadocs/layout/docs/sidebar.jsx +0 -0
  169. /package/{src → starter/src}/components/fumadocs/layout/editor-button.jsx +0 -0
  170. /package/{src → starter/src}/components/fumadocs/layout/home/client.jsx +0 -0
  171. /package/{src → starter/src}/components/fumadocs/layout/home/index.jsx +0 -0
  172. /package/{src → starter/src}/components/fumadocs/layout/link-item.jsx +0 -0
  173. /package/{src → starter/src}/components/fumadocs/layout/page-actions.jsx +0 -0
  174. /package/{src → starter/src}/components/fumadocs/layout/search-toggle.jsx +0 -0
  175. /package/{src → starter/src}/components/fumadocs/layout/shared.jsx +0 -0
  176. /package/{src → starter/src}/components/fumadocs/layout/sidebar/base.jsx +0 -0
  177. /package/{src → starter/src}/components/fumadocs/layout/sidebar/link-item.jsx +0 -0
  178. /package/{src → starter/src}/components/fumadocs/layout/sidebar/page-tree.jsx +0 -0
  179. /package/{src → starter/src}/components/fumadocs/layout/sidebar/tabs/dropdown.jsx +0 -0
  180. /package/{src → starter/src}/components/fumadocs/layout/sidebar/tabs/index.jsx +0 -0
  181. /package/{src → starter/src}/components/fumadocs/layout/sidebar-back-button.jsx +0 -0
  182. /package/{src → starter/src}/components/fumadocs/layout/sidebar-footer.jsx +0 -0
  183. /package/{src → starter/src}/components/fumadocs/layout/theme-toggle.jsx +0 -0
  184. /package/{src → starter/src}/components/fumadocs/mdx/base-ui.jsx +0 -0
  185. /package/{src → starter/src}/components/fumadocs/mdx/blocks.jsx +0 -0
  186. /package/{src → starter/src}/components/fumadocs/mdx/openapi.js +0 -0
  187. /package/{src → starter/src}/components/fumadocs/mdx-server.js +0 -0
  188. /package/{src → starter/src}/components/fumadocs/mdx.jsx +0 -0
  189. /package/{src → starter/src}/components/fumadocs/search-toggle.jsx +0 -0
  190. /package/{src → starter/src}/components/fumadocs/search.jsx +0 -0
  191. /package/{src → starter/src}/components/fumadocs/toc/clerk.jsx +0 -0
  192. /package/{src → starter/src}/components/fumadocs/toc/default.jsx +0 -0
  193. /package/{src → starter/src}/components/fumadocs/toc/index.jsx +0 -0
  194. /package/{src → starter/src}/components/language-switcher.jsx +0 -0
  195. /package/{src → starter/src}/components/logo-loader.jsx +0 -0
  196. /package/{src → starter/src}/components/logo.jsx +0 -0
  197. /package/{src → starter/src}/components/markdown.jsx +0 -0
  198. /package/{src → starter/src}/components/not-found.jsx +0 -0
  199. /package/{src → starter/src}/components/page-transition.jsx +0 -0
  200. /package/{src → starter/src}/components/story/badge.js +0 -0
  201. /package/{src → starter/src}/components/story/button.js +0 -0
  202. /package/{src → starter/src}/components/story/index.js +0 -0
  203. /package/{src → starter/src}/components/ui/accordion.jsx +0 -0
  204. /package/{src → starter/src}/components/ui/alert-dialog.jsx +0 -0
  205. /package/{src → starter/src}/components/ui/alert.jsx +0 -0
  206. /package/{src → starter/src}/components/ui/aspect-ratio.jsx +0 -0
  207. /package/{src → starter/src}/components/ui/avatar.jsx +0 -0
  208. /package/{src → starter/src}/components/ui/badge.client.jsx +0 -0
  209. /package/{src → starter/src}/components/ui/badge.jsx +0 -0
  210. /package/{src → starter/src}/components/ui/breadcrumb.jsx +0 -0
  211. /package/{src → starter/src}/components/ui/button-group.jsx +0 -0
  212. /package/{src → starter/src}/components/ui/button.client.jsx +0 -0
  213. /package/{src → starter/src}/components/ui/button.jsx +0 -0
  214. /package/{src → starter/src}/components/ui/calendar.jsx +0 -0
  215. /package/{src → starter/src}/components/ui/card.jsx +0 -0
  216. /package/{src → starter/src}/components/ui/carousel.jsx +0 -0
  217. /package/{src → starter/src}/components/ui/chart.jsx +0 -0
  218. /package/{src → starter/src}/components/ui/checkbox.jsx +0 -0
  219. /package/{src → starter/src}/components/ui/collapsible.jsx +0 -0
  220. /package/{src → starter/src}/components/ui/combobox.jsx +0 -0
  221. /package/{src → starter/src}/components/ui/command.jsx +0 -0
  222. /package/{src → starter/src}/components/ui/context-menu.jsx +0 -0
  223. /package/{src → starter/src}/components/ui/dialog.jsx +0 -0
  224. /package/{src → starter/src}/components/ui/direction.jsx +0 -0
  225. /package/{src → starter/src}/components/ui/drawer.jsx +0 -0
  226. /package/{src → starter/src}/components/ui/dropdown-menu.jsx +0 -0
  227. /package/{src → starter/src}/components/ui/empty.jsx +0 -0
  228. /package/{src → starter/src}/components/ui/field.jsx +0 -0
  229. /package/{src → starter/src}/components/ui/hover-card.jsx +0 -0
  230. /package/{src → starter/src}/components/ui/input-group.jsx +0 -0
  231. /package/{src → starter/src}/components/ui/input-otp.jsx +0 -0
  232. /package/{src → starter/src}/components/ui/input.jsx +0 -0
  233. /package/{src → starter/src}/components/ui/item.jsx +0 -0
  234. /package/{src → starter/src}/components/ui/kbd.jsx +0 -0
  235. /package/{src → starter/src}/components/ui/label.jsx +0 -0
  236. /package/{src → starter/src}/components/ui/menubar.jsx +0 -0
  237. /package/{src → starter/src}/components/ui/native-select.jsx +0 -0
  238. /package/{src → starter/src}/components/ui/navigation-menu.jsx +0 -0
  239. /package/{src → starter/src}/components/ui/pagination.jsx +0 -0
  240. /package/{src → starter/src}/components/ui/popover.jsx +0 -0
  241. /package/{src → starter/src}/components/ui/progress.jsx +0 -0
  242. /package/{src → starter/src}/components/ui/radio-group.jsx +0 -0
  243. /package/{src → starter/src}/components/ui/resizable.jsx +0 -0
  244. /package/{src → starter/src}/components/ui/scroll-area.jsx +0 -0
  245. /package/{src → starter/src}/components/ui/select.jsx +0 -0
  246. /package/{src → starter/src}/components/ui/separator.jsx +0 -0
  247. /package/{src → starter/src}/components/ui/sheet.jsx +0 -0
  248. /package/{src → starter/src}/components/ui/sidebar.jsx +0 -0
  249. /package/{src → starter/src}/components/ui/skeleton.jsx +0 -0
  250. /package/{src → starter/src}/components/ui/slider.jsx +0 -0
  251. /package/{src → starter/src}/components/ui/sonner.jsx +0 -0
  252. /package/{src → starter/src}/components/ui/spinner.jsx +0 -0
  253. /package/{src → starter/src}/components/ui/switch.jsx +0 -0
  254. /package/{src → starter/src}/components/ui/table.jsx +0 -0
  255. /package/{src → starter/src}/components/ui/tabs.jsx +0 -0
  256. /package/{src → starter/src}/components/ui/textarea.jsx +0 -0
  257. /package/{src → starter/src}/components/ui/toggle-group.jsx +0 -0
  258. /package/{src → starter/src}/components/ui/toggle.jsx +0 -0
  259. /package/{src → starter/src}/components/ui/tooltip.jsx +0 -0
  260. /package/{src → starter/src}/config.js +0 -0
  261. /package/{src → starter/src}/features/ai/chat/agents.js +0 -0
  262. /package/{src → starter/src}/features/ai/chat/components/api-key-form.jsx +0 -0
  263. /package/{src → starter/src}/features/ai/chat/components/brand.jsx +0 -0
  264. /package/{src → starter/src}/features/ai/chat/components/content.jsx +0 -0
  265. /package/{src → starter/src}/features/ai/chat/components/layout.jsx +0 -0
  266. /package/{src → starter/src}/features/ai/chat/components/message.jsx +0 -0
  267. /package/{src → starter/src}/features/ai/chat/components/model-select.jsx +0 -0
  268. /package/{src → starter/src}/features/ai/chat/components/panels.jsx +0 -0
  269. /package/{src → starter/src}/features/ai/chat/components/prompt.jsx +0 -0
  270. /package/{src → starter/src}/features/ai/chat/components/tool-renderer.jsx +0 -0
  271. /package/{src → starter/src}/features/ai/chat/components/trigger.jsx +0 -0
  272. /package/{src → starter/src}/features/ai/chat/constants.js +0 -0
  273. /package/{src → starter/src}/features/ai/chat/handler.js +0 -0
  274. /package/{src → starter/src}/features/ai/chat/hooks/use-pages.js +0 -0
  275. /package/{src → starter/src}/features/ai/chat/index.js +0 -0
  276. /package/{src → starter/src}/features/ai/chat/panel-store.js +0 -0
  277. /package/{src → starter/src}/features/ai/chat/provider.jsx +0 -0
  278. /package/{src → starter/src}/features/ai/chat/selection-store.js +0 -0
  279. /package/{src → starter/src}/features/ai/chat/settings-store.js +0 -0
  280. /package/{src → starter/src}/features/ai/chat/store.js +0 -0
  281. /package/{src → starter/src}/features/ai/chat/tools.js +0 -0
  282. /package/{src → starter/src}/features/ai/chat/types.js +0 -0
  283. /package/{src → starter/src}/features/ai/playground/agents.js +0 -0
  284. /package/{src → starter/src}/features/ai/playground/tools.js +0 -0
  285. /package/{src → starter/src}/features/ai/shared/create-model.js +0 -0
  286. /package/{src → starter/src}/features/ai/shared/filter-reasoning.js +0 -0
  287. /package/{src → starter/src}/features/changelog/components/changelog-list.jsx +0 -0
  288. /package/{src → starter/src}/features/changelog/components/entry-content.jsx +0 -0
  289. /package/{src → starter/src}/features/changelog/index.js +0 -0
  290. /package/{src → starter/src}/features/docs/components/page-content.jsx +0 -0
  291. /package/{src → starter/src}/features/docs/index.js +0 -0
  292. /package/{src → starter/src}/features/docs/section-page.jsx +0 -0
  293. /package/{src → starter/src}/features/feedback/components/feedback-block-mdx.jsx +0 -0
  294. /package/{src → starter/src}/features/feedback/components/feedback.jsx +0 -0
  295. /package/{src → starter/src}/features/feedback/github.js +0 -0
  296. /package/{src → starter/src}/features/feedback/index.js +0 -0
  297. /package/{src → starter/src}/features/feedback/schema.js +0 -0
  298. /package/{src → starter/src}/features/marketing/components/home.jsx +0 -0
  299. /package/{src → starter/src}/features/marketing/index.js +0 -0
  300. /package/{src → starter/src}/features/mdx-playground/components/editor.jsx +0 -0
  301. /package/{src → starter/src}/features/mdx-playground/components/playground-provider.jsx +0 -0
  302. /package/{src → starter/src}/features/mdx-playground/components/playground-sidebar.jsx +0 -0
  303. /package/{src → starter/src}/features/mdx-playground/components/playground.jsx +0 -0
  304. /package/{src → starter/src}/features/mdx-playground/components/proposal-context.jsx +0 -0
  305. /package/{src → starter/src}/features/mdx-playground/components/update-content-card.jsx +0 -0
  306. /package/{src → starter/src}/features/mdx-playground/hooks/use-mdx-compiler.js +0 -0
  307. /package/{src → starter/src}/features/mdx-playground/hooks/use-playground-chat.js +0 -0
  308. /package/{src → starter/src}/features/mdx-playground/lib/compile.js +0 -0
  309. /package/{src → starter/src}/features/mdx-playground/lib/components-reference.js +0 -0
  310. /package/{src → starter/src}/features/mdx-playground/store/settings.js +0 -0
  311. /package/{src → starter/src}/hooks/use-copy-button.js +0 -0
  312. /package/{src → starter/src}/hooks/use-locale.js +0 -0
  313. /package/{src → starter/src}/hooks/use-mobile.js +0 -0
  314. /package/{src → starter/src}/i18n.d.ts +0 -0
  315. /package/{src → starter/src}/lib/cn.js +0 -0
  316. /package/{src → starter/src}/lib/content-source.js +0 -0
  317. /package/{src → starter/src}/lib/create-docs-layout.jsx +0 -0
  318. /package/{src → starter/src}/lib/create-docs-page.jsx +0 -0
  319. /package/{src → starter/src}/lib/i18n.js +0 -0
  320. /package/{src → starter/src}/lib/layout.shared.jsx +0 -0
  321. /package/{src → starter/src}/lib/llms.js +0 -0
  322. /package/{src → starter/src}/lib/mdx-compiler.js +0 -0
  323. /package/{src → starter/src}/lib/mdx-plugins.js +0 -0
  324. /package/{src → starter/src}/lib/merge-refs.js +0 -0
  325. /package/{src → starter/src}/lib/navigation.js +0 -0
  326. /package/{src → starter/src}/lib/openapi.js +0 -0
  327. /package/{src → starter/src}/lib/pages-api.js +0 -0
  328. /package/{src → starter/src}/lib/rss.js +0 -0
  329. /package/{src → starter/src}/lib/sitemap.js +0 -0
  330. /package/{src → starter/src}/lib/source.js +0 -0
  331. /package/{src → starter/src}/lib/story.js +0 -0
  332. /package/{src → starter/src}/lib/theme-transition.js +0 -0
  333. /package/{src → starter/src}/lib/urls.js +0 -0
  334. /package/{src → starter/src}/lib/utils.js +0 -0
  335. /package/{src → starter/src}/locale.config.js +0 -0
  336. /package/{src → starter/src}/styles/app.css +0 -0
  337. /package/{src → starter/src}/styles/theme.css +0 -0
  338. /package/{tsconfig.json → starter/tsconfig.json} +0 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,4100 @@
1
+ #!/usr/bin/env node
2
+ import { Command, Option } from "commander";
3
+ import pc from "picocolors";
4
+ import { basename, dirname, extname, join, relative, resolve } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { appendFileSync, cpSync, existsSync, mkdirSync, readFileSync, readdirSync, watch, writeFileSync } from "node:fs";
7
+ import { x } from "tinyexec";
8
+ import { loadConfig } from "c12";
9
+ import { createInterface } from "node:readline/promises";
10
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
12
+ import { readFile, readdir } from "node:fs/promises";
13
+
14
+ //#region node_modules/zod/v4/core/core.js
15
+ /** A special constant with type `never` */
16
+ const NEVER = Object.freeze({ status: "aborted" });
17
+ function $constructor(name, initializer, params) {
18
+ function init(inst, def) {
19
+ if (!inst._zod) Object.defineProperty(inst, "_zod", {
20
+ value: {
21
+ def,
22
+ constr: _,
23
+ traits: /* @__PURE__ */ new Set()
24
+ },
25
+ enumerable: false
26
+ });
27
+ if (inst._zod.traits.has(name)) return;
28
+ inst._zod.traits.add(name);
29
+ initializer(inst, def);
30
+ const proto = _.prototype;
31
+ const keys = Object.keys(proto);
32
+ for (let i = 0; i < keys.length; i++) {
33
+ const k = keys[i];
34
+ if (!(k in inst)) inst[k] = proto[k].bind(inst);
35
+ }
36
+ }
37
+ const Parent = params?.Parent ?? Object;
38
+ class Definition extends Parent {}
39
+ Object.defineProperty(Definition, "name", { value: name });
40
+ function _(def) {
41
+ var _a;
42
+ const inst = params?.Parent ? new Definition() : this;
43
+ init(inst, def);
44
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
45
+ for (const fn of inst._zod.deferred) fn();
46
+ return inst;
47
+ }
48
+ Object.defineProperty(_, "init", { value: init });
49
+ Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
50
+ if (params?.Parent && inst instanceof params.Parent) return true;
51
+ return inst?._zod?.traits?.has(name);
52
+ } });
53
+ Object.defineProperty(_, "name", { value: name });
54
+ return _;
55
+ }
56
+ var $ZodAsyncError = class extends Error {
57
+ constructor() {
58
+ super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
59
+ }
60
+ };
61
+ var $ZodEncodeError = class extends Error {
62
+ constructor(name) {
63
+ super(`Encountered unidirectional transform during encode: ${name}`);
64
+ this.name = "ZodEncodeError";
65
+ }
66
+ };
67
+ const globalConfig = {};
68
+ function config(newConfig) {
69
+ if (newConfig) Object.assign(globalConfig, newConfig);
70
+ return globalConfig;
71
+ }
72
+
73
+ //#endregion
74
+ //#region node_modules/zod/v4/core/util.js
75
+ function getEnumValues(entries) {
76
+ const numericValues = Object.values(entries).filter((v) => typeof v === "number");
77
+ return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
78
+ }
79
+ function jsonStringifyReplacer(_, value) {
80
+ if (typeof value === "bigint") return value.toString();
81
+ return value;
82
+ }
83
+ function cached(getter) {
84
+ return { get value() {
85
+ {
86
+ const value = getter();
87
+ Object.defineProperty(this, "value", { value });
88
+ return value;
89
+ }
90
+ throw new Error("cached value already set");
91
+ } };
92
+ }
93
+ function nullish(input) {
94
+ return input === null || input === void 0;
95
+ }
96
+ function cleanRegex(source) {
97
+ const start = source.startsWith("^") ? 1 : 0;
98
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
99
+ return source.slice(start, end);
100
+ }
101
+ const EVALUATING = Symbol("evaluating");
102
+ function defineLazy(object, key, getter) {
103
+ let value = void 0;
104
+ Object.defineProperty(object, key, {
105
+ get() {
106
+ if (value === EVALUATING) return;
107
+ if (value === void 0) {
108
+ value = EVALUATING;
109
+ value = getter();
110
+ }
111
+ return value;
112
+ },
113
+ set(v) {
114
+ Object.defineProperty(object, key, { value: v });
115
+ },
116
+ configurable: true
117
+ });
118
+ }
119
+ function assignProp(target, prop, value) {
120
+ Object.defineProperty(target, prop, {
121
+ value,
122
+ writable: true,
123
+ enumerable: true,
124
+ configurable: true
125
+ });
126
+ }
127
+ function mergeDefs(...defs) {
128
+ const mergedDescriptors = {};
129
+ for (const def of defs) {
130
+ const descriptors = Object.getOwnPropertyDescriptors(def);
131
+ Object.assign(mergedDescriptors, descriptors);
132
+ }
133
+ return Object.defineProperties({}, mergedDescriptors);
134
+ }
135
+ function esc(str) {
136
+ return JSON.stringify(str);
137
+ }
138
+ function slugify(input) {
139
+ return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
140
+ }
141
+ const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
142
+ function isObject(data) {
143
+ return typeof data === "object" && data !== null && !Array.isArray(data);
144
+ }
145
+ const allowsEval = cached(() => {
146
+ if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
147
+ try {
148
+ new Function("");
149
+ return true;
150
+ } catch (_) {
151
+ return false;
152
+ }
153
+ });
154
+ function isPlainObject(o) {
155
+ if (isObject(o) === false) return false;
156
+ const ctor = o.constructor;
157
+ if (ctor === void 0) return true;
158
+ if (typeof ctor !== "function") return true;
159
+ const prot = ctor.prototype;
160
+ if (isObject(prot) === false) return false;
161
+ if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
162
+ return true;
163
+ }
164
+ function shallowClone(o) {
165
+ if (isPlainObject(o)) return { ...o };
166
+ if (Array.isArray(o)) return [...o];
167
+ return o;
168
+ }
169
+ const propertyKeyTypes = new Set([
170
+ "string",
171
+ "number",
172
+ "symbol"
173
+ ]);
174
+ function escapeRegex(str) {
175
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
176
+ }
177
+ function clone(inst, def, params) {
178
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
179
+ if (!def || params?.parent) cl._zod.parent = inst;
180
+ return cl;
181
+ }
182
+ function normalizeParams(_params) {
183
+ const params = _params;
184
+ if (!params) return {};
185
+ if (typeof params === "string") return { error: () => params };
186
+ if (params?.message !== void 0) {
187
+ if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
188
+ params.error = params.message;
189
+ }
190
+ delete params.message;
191
+ if (typeof params.error === "string") return {
192
+ ...params,
193
+ error: () => params.error
194
+ };
195
+ return params;
196
+ }
197
+ function optionalKeys(shape) {
198
+ return Object.keys(shape).filter((k) => {
199
+ return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
200
+ });
201
+ }
202
+ const NUMBER_FORMAT_RANGES = {
203
+ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
204
+ int32: [-2147483648, 2147483647],
205
+ uint32: [0, 4294967295],
206
+ float32: [-34028234663852886e22, 34028234663852886e22],
207
+ float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
208
+ };
209
+ function pick(schema, mask) {
210
+ const currDef = schema._zod.def;
211
+ const checks = currDef.checks;
212
+ if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
213
+ return clone(schema, mergeDefs(schema._zod.def, {
214
+ get shape() {
215
+ const newShape = {};
216
+ for (const key in mask) {
217
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
218
+ if (!mask[key]) continue;
219
+ newShape[key] = currDef.shape[key];
220
+ }
221
+ assignProp(this, "shape", newShape);
222
+ return newShape;
223
+ },
224
+ checks: []
225
+ }));
226
+ }
227
+ function omit(schema, mask) {
228
+ const currDef = schema._zod.def;
229
+ const checks = currDef.checks;
230
+ if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
231
+ return clone(schema, mergeDefs(schema._zod.def, {
232
+ get shape() {
233
+ const newShape = { ...schema._zod.def.shape };
234
+ for (const key in mask) {
235
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
236
+ if (!mask[key]) continue;
237
+ delete newShape[key];
238
+ }
239
+ assignProp(this, "shape", newShape);
240
+ return newShape;
241
+ },
242
+ checks: []
243
+ }));
244
+ }
245
+ function extend(schema, shape) {
246
+ if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
247
+ const checks = schema._zod.def.checks;
248
+ if (checks && checks.length > 0) {
249
+ const existingShape = schema._zod.def.shape;
250
+ for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
251
+ }
252
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
253
+ const _shape = {
254
+ ...schema._zod.def.shape,
255
+ ...shape
256
+ };
257
+ assignProp(this, "shape", _shape);
258
+ return _shape;
259
+ } }));
260
+ }
261
+ function safeExtend(schema, shape) {
262
+ if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
263
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
264
+ const _shape = {
265
+ ...schema._zod.def.shape,
266
+ ...shape
267
+ };
268
+ assignProp(this, "shape", _shape);
269
+ return _shape;
270
+ } }));
271
+ }
272
+ function merge(a, b) {
273
+ return clone(a, mergeDefs(a._zod.def, {
274
+ get shape() {
275
+ const _shape = {
276
+ ...a._zod.def.shape,
277
+ ...b._zod.def.shape
278
+ };
279
+ assignProp(this, "shape", _shape);
280
+ return _shape;
281
+ },
282
+ get catchall() {
283
+ return b._zod.def.catchall;
284
+ },
285
+ checks: []
286
+ }));
287
+ }
288
+ function partial(Class, schema, mask) {
289
+ const checks = schema._zod.def.checks;
290
+ if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
291
+ return clone(schema, mergeDefs(schema._zod.def, {
292
+ get shape() {
293
+ const oldShape = schema._zod.def.shape;
294
+ const shape = { ...oldShape };
295
+ if (mask) for (const key in mask) {
296
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
297
+ if (!mask[key]) continue;
298
+ shape[key] = Class ? new Class({
299
+ type: "optional",
300
+ innerType: oldShape[key]
301
+ }) : oldShape[key];
302
+ }
303
+ else for (const key in oldShape) shape[key] = Class ? new Class({
304
+ type: "optional",
305
+ innerType: oldShape[key]
306
+ }) : oldShape[key];
307
+ assignProp(this, "shape", shape);
308
+ return shape;
309
+ },
310
+ checks: []
311
+ }));
312
+ }
313
+ function required(Class, schema, mask) {
314
+ return clone(schema, mergeDefs(schema._zod.def, { get shape() {
315
+ const oldShape = schema._zod.def.shape;
316
+ const shape = { ...oldShape };
317
+ if (mask) for (const key in mask) {
318
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
319
+ if (!mask[key]) continue;
320
+ shape[key] = new Class({
321
+ type: "nonoptional",
322
+ innerType: oldShape[key]
323
+ });
324
+ }
325
+ else for (const key in oldShape) shape[key] = new Class({
326
+ type: "nonoptional",
327
+ innerType: oldShape[key]
328
+ });
329
+ assignProp(this, "shape", shape);
330
+ return shape;
331
+ } }));
332
+ }
333
+ function aborted(x, startIndex = 0) {
334
+ if (x.aborted === true) return true;
335
+ for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
336
+ return false;
337
+ }
338
+ function prefixIssues(path, issues) {
339
+ return issues.map((iss) => {
340
+ var _a;
341
+ (_a = iss).path ?? (_a.path = []);
342
+ iss.path.unshift(path);
343
+ return iss;
344
+ });
345
+ }
346
+ function unwrapMessage(message) {
347
+ return typeof message === "string" ? message : message?.message;
348
+ }
349
+ function finalizeIssue(iss, ctx, config) {
350
+ const full = {
351
+ ...iss,
352
+ path: iss.path ?? []
353
+ };
354
+ if (!iss.message) full.message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
355
+ delete full.inst;
356
+ delete full.continue;
357
+ if (!ctx?.reportInput) delete full.input;
358
+ return full;
359
+ }
360
+ function getLengthableOrigin(input) {
361
+ if (Array.isArray(input)) return "array";
362
+ if (typeof input === "string") return "string";
363
+ return "unknown";
364
+ }
365
+ function issue(...args) {
366
+ const [iss, input, inst] = args;
367
+ if (typeof iss === "string") return {
368
+ message: iss,
369
+ code: "custom",
370
+ input,
371
+ inst
372
+ };
373
+ return { ...iss };
374
+ }
375
+
376
+ //#endregion
377
+ //#region node_modules/zod/v4/core/errors.js
378
+ const initializer$1 = (inst, def) => {
379
+ inst.name = "$ZodError";
380
+ Object.defineProperty(inst, "_zod", {
381
+ value: inst._zod,
382
+ enumerable: false
383
+ });
384
+ Object.defineProperty(inst, "issues", {
385
+ value: def,
386
+ enumerable: false
387
+ });
388
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
389
+ Object.defineProperty(inst, "toString", {
390
+ value: () => inst.message,
391
+ enumerable: false
392
+ });
393
+ };
394
+ const $ZodError = $constructor("$ZodError", initializer$1);
395
+ const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
396
+ function flattenError(error, mapper = (issue) => issue.message) {
397
+ const fieldErrors = {};
398
+ const formErrors = [];
399
+ for (const sub of error.issues) if (sub.path.length > 0) {
400
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
401
+ fieldErrors[sub.path[0]].push(mapper(sub));
402
+ } else formErrors.push(mapper(sub));
403
+ return {
404
+ formErrors,
405
+ fieldErrors
406
+ };
407
+ }
408
+ function formatError(error, mapper = (issue) => issue.message) {
409
+ const fieldErrors = { _errors: [] };
410
+ const processError = (error) => {
411
+ for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }));
412
+ else if (issue.code === "invalid_key") processError({ issues: issue.issues });
413
+ else if (issue.code === "invalid_element") processError({ issues: issue.issues });
414
+ else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
415
+ else {
416
+ let curr = fieldErrors;
417
+ let i = 0;
418
+ while (i < issue.path.length) {
419
+ const el = issue.path[i];
420
+ if (!(i === issue.path.length - 1)) curr[el] = curr[el] || { _errors: [] };
421
+ else {
422
+ curr[el] = curr[el] || { _errors: [] };
423
+ curr[el]._errors.push(mapper(issue));
424
+ }
425
+ curr = curr[el];
426
+ i++;
427
+ }
428
+ }
429
+ };
430
+ processError(error);
431
+ return fieldErrors;
432
+ }
433
+
434
+ //#endregion
435
+ //#region node_modules/zod/v4/core/parse.js
436
+ const _parse = (_Err) => (schema, value, _ctx, _params) => {
437
+ const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
438
+ const result = schema._zod.run({
439
+ value,
440
+ issues: []
441
+ }, ctx);
442
+ if (result instanceof Promise) throw new $ZodAsyncError();
443
+ if (result.issues.length) {
444
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
445
+ captureStackTrace(e, _params?.callee);
446
+ throw e;
447
+ }
448
+ return result.value;
449
+ };
450
+ const parse$1 = /* @__PURE__ */ _parse($ZodRealError);
451
+ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
452
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
453
+ let result = schema._zod.run({
454
+ value,
455
+ issues: []
456
+ }, ctx);
457
+ if (result instanceof Promise) result = await result;
458
+ if (result.issues.length) {
459
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
460
+ captureStackTrace(e, params?.callee);
461
+ throw e;
462
+ }
463
+ return result.value;
464
+ };
465
+ const parseAsync$1 = /* @__PURE__ */ _parseAsync($ZodRealError);
466
+ const _safeParse = (_Err) => (schema, value, _ctx) => {
467
+ const ctx = _ctx ? {
468
+ ..._ctx,
469
+ async: false
470
+ } : { async: false };
471
+ const result = schema._zod.run({
472
+ value,
473
+ issues: []
474
+ }, ctx);
475
+ if (result instanceof Promise) throw new $ZodAsyncError();
476
+ return result.issues.length ? {
477
+ success: false,
478
+ error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
479
+ } : {
480
+ success: true,
481
+ data: result.value
482
+ };
483
+ };
484
+ const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
485
+ const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
486
+ const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
487
+ let result = schema._zod.run({
488
+ value,
489
+ issues: []
490
+ }, ctx);
491
+ if (result instanceof Promise) result = await result;
492
+ return result.issues.length ? {
493
+ success: false,
494
+ error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
495
+ } : {
496
+ success: true,
497
+ data: result.value
498
+ };
499
+ };
500
+ const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
501
+ const _encode = (_Err) => (schema, value, _ctx) => {
502
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
503
+ return _parse(_Err)(schema, value, ctx);
504
+ };
505
+ const encode$1 = /* @__PURE__ */ _encode($ZodRealError);
506
+ const _decode = (_Err) => (schema, value, _ctx) => {
507
+ return _parse(_Err)(schema, value, _ctx);
508
+ };
509
+ const decode$1 = /* @__PURE__ */ _decode($ZodRealError);
510
+ const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
511
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
512
+ return _parseAsync(_Err)(schema, value, ctx);
513
+ };
514
+ const encodeAsync$1 = /* @__PURE__ */ _encodeAsync($ZodRealError);
515
+ const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
516
+ return _parseAsync(_Err)(schema, value, _ctx);
517
+ };
518
+ const decodeAsync$1 = /* @__PURE__ */ _decodeAsync($ZodRealError);
519
+ const _safeEncode = (_Err) => (schema, value, _ctx) => {
520
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
521
+ return _safeParse(_Err)(schema, value, ctx);
522
+ };
523
+ const safeEncode$1 = /* @__PURE__ */ _safeEncode($ZodRealError);
524
+ const _safeDecode = (_Err) => (schema, value, _ctx) => {
525
+ return _safeParse(_Err)(schema, value, _ctx);
526
+ };
527
+ const safeDecode$1 = /* @__PURE__ */ _safeDecode($ZodRealError);
528
+ const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
529
+ const ctx = _ctx ? Object.assign(_ctx, { direction: "backward" }) : { direction: "backward" };
530
+ return _safeParseAsync(_Err)(schema, value, ctx);
531
+ };
532
+ const safeEncodeAsync$1 = /* @__PURE__ */ _safeEncodeAsync($ZodRealError);
533
+ const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
534
+ return _safeParseAsync(_Err)(schema, value, _ctx);
535
+ };
536
+ const safeDecodeAsync$1 = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
537
+
538
+ //#endregion
539
+ //#region node_modules/zod/v4/core/regexes.js
540
+ const cuid = /^[cC][^\s-]{8,}$/;
541
+ const cuid2 = /^[0-9a-z]+$/;
542
+ const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
543
+ const xid = /^[0-9a-vA-V]{20}$/;
544
+ const ksuid = /^[A-Za-z0-9]{27}$/;
545
+ const nanoid = /^[a-zA-Z0-9_-]{21}$/;
546
+ /** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
547
+ const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
548
+ /** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
549
+ const guid = /^([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})$/;
550
+ /** Returns a regex for validating an RFC 9562/4122 UUID.
551
+ *
552
+ * @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
553
+ const uuid = (version) => {
554
+ if (!version) return /^([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)$/;
555
+ return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
556
+ };
557
+ /** Practical email validation */
558
+ const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
559
+ const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
560
+ function emoji() {
561
+ return new RegExp(_emoji$1, "u");
562
+ }
563
+ const ipv4 = /^(?:(?: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])$/;
564
+ const ipv6 = /^(([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}|:))$/;
565
+ const cidrv4 = /^((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])$/;
566
+ const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
567
+ const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
568
+ const base64url = /^[A-Za-z0-9_-]*$/;
569
+ const e164 = /^\+[1-9]\d{6,14}$/;
570
+ const dateSource = `(?:(?:\\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])))`;
571
+ const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
572
+ function timeSource(args) {
573
+ const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
574
+ return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
575
+ }
576
+ function time$1(args) {
577
+ return new RegExp(`^${timeSource(args)}$`);
578
+ }
579
+ function datetime$1(args) {
580
+ const time = timeSource({ precision: args.precision });
581
+ const opts = ["Z"];
582
+ if (args.local) opts.push("");
583
+ if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
584
+ const timeRegex = `${time}(?:${opts.join("|")})`;
585
+ return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
586
+ }
587
+ const string$1 = (params) => {
588
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
589
+ return new RegExp(`^${regex}$`);
590
+ };
591
+ const number = /^-?\d+(?:\.\d+)?$/;
592
+ const boolean$1 = /^(?:true|false)$/i;
593
+ const lowercase = /^[^A-Z]*$/;
594
+ const uppercase = /^[^a-z]*$/;
595
+
596
+ //#endregion
597
+ //#region node_modules/zod/v4/core/checks.js
598
+ const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
599
+ var _a;
600
+ inst._zod ?? (inst._zod = {});
601
+ inst._zod.def = def;
602
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
603
+ });
604
+ const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
605
+ var _a;
606
+ $ZodCheck.init(inst, def);
607
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
608
+ const val = payload.value;
609
+ return !nullish(val) && val.length !== void 0;
610
+ });
611
+ inst._zod.onattach.push((inst) => {
612
+ const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
613
+ if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
614
+ });
615
+ inst._zod.check = (payload) => {
616
+ const input = payload.value;
617
+ if (input.length <= def.maximum) return;
618
+ const origin = getLengthableOrigin(input);
619
+ payload.issues.push({
620
+ origin,
621
+ code: "too_big",
622
+ maximum: def.maximum,
623
+ inclusive: true,
624
+ input,
625
+ inst,
626
+ continue: !def.abort
627
+ });
628
+ };
629
+ });
630
+ const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
631
+ var _a;
632
+ $ZodCheck.init(inst, def);
633
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
634
+ const val = payload.value;
635
+ return !nullish(val) && val.length !== void 0;
636
+ });
637
+ inst._zod.onattach.push((inst) => {
638
+ const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
639
+ if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
640
+ });
641
+ inst._zod.check = (payload) => {
642
+ const input = payload.value;
643
+ if (input.length >= def.minimum) return;
644
+ const origin = getLengthableOrigin(input);
645
+ payload.issues.push({
646
+ origin,
647
+ code: "too_small",
648
+ minimum: def.minimum,
649
+ inclusive: true,
650
+ input,
651
+ inst,
652
+ continue: !def.abort
653
+ });
654
+ };
655
+ });
656
+ const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
657
+ var _a;
658
+ $ZodCheck.init(inst, def);
659
+ (_a = inst._zod.def).when ?? (_a.when = (payload) => {
660
+ const val = payload.value;
661
+ return !nullish(val) && val.length !== void 0;
662
+ });
663
+ inst._zod.onattach.push((inst) => {
664
+ const bag = inst._zod.bag;
665
+ bag.minimum = def.length;
666
+ bag.maximum = def.length;
667
+ bag.length = def.length;
668
+ });
669
+ inst._zod.check = (payload) => {
670
+ const input = payload.value;
671
+ const length = input.length;
672
+ if (length === def.length) return;
673
+ const origin = getLengthableOrigin(input);
674
+ const tooBig = length > def.length;
675
+ payload.issues.push({
676
+ origin,
677
+ ...tooBig ? {
678
+ code: "too_big",
679
+ maximum: def.length
680
+ } : {
681
+ code: "too_small",
682
+ minimum: def.length
683
+ },
684
+ inclusive: true,
685
+ exact: true,
686
+ input: payload.value,
687
+ inst,
688
+ continue: !def.abort
689
+ });
690
+ };
691
+ });
692
+ const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
693
+ var _a, _b;
694
+ $ZodCheck.init(inst, def);
695
+ inst._zod.onattach.push((inst) => {
696
+ const bag = inst._zod.bag;
697
+ bag.format = def.format;
698
+ if (def.pattern) {
699
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
700
+ bag.patterns.add(def.pattern);
701
+ }
702
+ });
703
+ if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
704
+ def.pattern.lastIndex = 0;
705
+ if (def.pattern.test(payload.value)) return;
706
+ payload.issues.push({
707
+ origin: "string",
708
+ code: "invalid_format",
709
+ format: def.format,
710
+ input: payload.value,
711
+ ...def.pattern ? { pattern: def.pattern.toString() } : {},
712
+ inst,
713
+ continue: !def.abort
714
+ });
715
+ });
716
+ else (_b = inst._zod).check ?? (_b.check = () => {});
717
+ });
718
+ const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
719
+ $ZodCheckStringFormat.init(inst, def);
720
+ inst._zod.check = (payload) => {
721
+ def.pattern.lastIndex = 0;
722
+ if (def.pattern.test(payload.value)) return;
723
+ payload.issues.push({
724
+ origin: "string",
725
+ code: "invalid_format",
726
+ format: "regex",
727
+ input: payload.value,
728
+ pattern: def.pattern.toString(),
729
+ inst,
730
+ continue: !def.abort
731
+ });
732
+ };
733
+ });
734
+ const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
735
+ def.pattern ?? (def.pattern = lowercase);
736
+ $ZodCheckStringFormat.init(inst, def);
737
+ });
738
+ const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
739
+ def.pattern ?? (def.pattern = uppercase);
740
+ $ZodCheckStringFormat.init(inst, def);
741
+ });
742
+ const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
743
+ $ZodCheck.init(inst, def);
744
+ const escapedRegex = escapeRegex(def.includes);
745
+ const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
746
+ def.pattern = pattern;
747
+ inst._zod.onattach.push((inst) => {
748
+ const bag = inst._zod.bag;
749
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
750
+ bag.patterns.add(pattern);
751
+ });
752
+ inst._zod.check = (payload) => {
753
+ if (payload.value.includes(def.includes, def.position)) return;
754
+ payload.issues.push({
755
+ origin: "string",
756
+ code: "invalid_format",
757
+ format: "includes",
758
+ includes: def.includes,
759
+ input: payload.value,
760
+ inst,
761
+ continue: !def.abort
762
+ });
763
+ };
764
+ });
765
+ const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
766
+ $ZodCheck.init(inst, def);
767
+ const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
768
+ def.pattern ?? (def.pattern = pattern);
769
+ inst._zod.onattach.push((inst) => {
770
+ const bag = inst._zod.bag;
771
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
772
+ bag.patterns.add(pattern);
773
+ });
774
+ inst._zod.check = (payload) => {
775
+ if (payload.value.startsWith(def.prefix)) return;
776
+ payload.issues.push({
777
+ origin: "string",
778
+ code: "invalid_format",
779
+ format: "starts_with",
780
+ prefix: def.prefix,
781
+ input: payload.value,
782
+ inst,
783
+ continue: !def.abort
784
+ });
785
+ };
786
+ });
787
+ const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
788
+ $ZodCheck.init(inst, def);
789
+ const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
790
+ def.pattern ?? (def.pattern = pattern);
791
+ inst._zod.onattach.push((inst) => {
792
+ const bag = inst._zod.bag;
793
+ bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
794
+ bag.patterns.add(pattern);
795
+ });
796
+ inst._zod.check = (payload) => {
797
+ if (payload.value.endsWith(def.suffix)) return;
798
+ payload.issues.push({
799
+ origin: "string",
800
+ code: "invalid_format",
801
+ format: "ends_with",
802
+ suffix: def.suffix,
803
+ input: payload.value,
804
+ inst,
805
+ continue: !def.abort
806
+ });
807
+ };
808
+ });
809
+ const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
810
+ $ZodCheck.init(inst, def);
811
+ inst._zod.check = (payload) => {
812
+ payload.value = def.tx(payload.value);
813
+ };
814
+ });
815
+
816
+ //#endregion
817
+ //#region node_modules/zod/v4/core/doc.js
818
+ var Doc = class {
819
+ constructor(args = []) {
820
+ this.content = [];
821
+ this.indent = 0;
822
+ if (this) this.args = args;
823
+ }
824
+ indented(fn) {
825
+ this.indent += 1;
826
+ fn(this);
827
+ this.indent -= 1;
828
+ }
829
+ write(arg) {
830
+ if (typeof arg === "function") {
831
+ arg(this, { execution: "sync" });
832
+ arg(this, { execution: "async" });
833
+ return;
834
+ }
835
+ const lines = arg.split("\n").filter((x) => x);
836
+ const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
837
+ const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
838
+ for (const line of dedented) this.content.push(line);
839
+ }
840
+ compile() {
841
+ const F = Function;
842
+ const args = this?.args;
843
+ const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
844
+ return new F(...args, lines.join("\n"));
845
+ }
846
+ };
847
+
848
+ //#endregion
849
+ //#region node_modules/zod/v4/core/versions.js
850
+ const version = {
851
+ major: 4,
852
+ minor: 3,
853
+ patch: 6
854
+ };
855
+
856
+ //#endregion
857
+ //#region node_modules/zod/v4/core/schemas.js
858
+ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
859
+ var _a;
860
+ inst ?? (inst = {});
861
+ inst._zod.def = def;
862
+ inst._zod.bag = inst._zod.bag || {};
863
+ inst._zod.version = version;
864
+ const checks = [...inst._zod.def.checks ?? []];
865
+ if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
866
+ for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
867
+ if (checks.length === 0) {
868
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
869
+ inst._zod.deferred?.push(() => {
870
+ inst._zod.run = inst._zod.parse;
871
+ });
872
+ } else {
873
+ const runChecks = (payload, checks, ctx) => {
874
+ let isAborted = aborted(payload);
875
+ let asyncResult;
876
+ for (const ch of checks) {
877
+ if (ch._zod.def.when) {
878
+ if (!ch._zod.def.when(payload)) continue;
879
+ } else if (isAborted) continue;
880
+ const currLen = payload.issues.length;
881
+ const _ = ch._zod.check(payload);
882
+ if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
883
+ if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
884
+ await _;
885
+ if (payload.issues.length === currLen) return;
886
+ if (!isAborted) isAborted = aborted(payload, currLen);
887
+ });
888
+ else {
889
+ if (payload.issues.length === currLen) continue;
890
+ if (!isAborted) isAborted = aborted(payload, currLen);
891
+ }
892
+ }
893
+ if (asyncResult) return asyncResult.then(() => {
894
+ return payload;
895
+ });
896
+ return payload;
897
+ };
898
+ const handleCanaryResult = (canary, payload, ctx) => {
899
+ if (aborted(canary)) {
900
+ canary.aborted = true;
901
+ return canary;
902
+ }
903
+ const checkResult = runChecks(payload, checks, ctx);
904
+ if (checkResult instanceof Promise) {
905
+ if (ctx.async === false) throw new $ZodAsyncError();
906
+ return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
907
+ }
908
+ return inst._zod.parse(checkResult, ctx);
909
+ };
910
+ inst._zod.run = (payload, ctx) => {
911
+ if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
912
+ if (ctx.direction === "backward") {
913
+ const canary = inst._zod.parse({
914
+ value: payload.value,
915
+ issues: []
916
+ }, {
917
+ ...ctx,
918
+ skipChecks: true
919
+ });
920
+ if (canary instanceof Promise) return canary.then((canary) => {
921
+ return handleCanaryResult(canary, payload, ctx);
922
+ });
923
+ return handleCanaryResult(canary, payload, ctx);
924
+ }
925
+ const result = inst._zod.parse(payload, ctx);
926
+ if (result instanceof Promise) {
927
+ if (ctx.async === false) throw new $ZodAsyncError();
928
+ return result.then((result) => runChecks(result, checks, ctx));
929
+ }
930
+ return runChecks(result, checks, ctx);
931
+ };
932
+ }
933
+ defineLazy(inst, "~standard", () => ({
934
+ validate: (value) => {
935
+ try {
936
+ const r = safeParse$1(inst, value);
937
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
938
+ } catch (_) {
939
+ return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
940
+ }
941
+ },
942
+ vendor: "zod",
943
+ version: 1
944
+ }));
945
+ });
946
+ const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
947
+ $ZodType.init(inst, def);
948
+ inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
949
+ inst._zod.parse = (payload, _) => {
950
+ if (def.coerce) try {
951
+ payload.value = String(payload.value);
952
+ } catch (_) {}
953
+ if (typeof payload.value === "string") return payload;
954
+ payload.issues.push({
955
+ expected: "string",
956
+ code: "invalid_type",
957
+ input: payload.value,
958
+ inst
959
+ });
960
+ return payload;
961
+ };
962
+ });
963
+ const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
964
+ $ZodCheckStringFormat.init(inst, def);
965
+ $ZodString.init(inst, def);
966
+ });
967
+ const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
968
+ def.pattern ?? (def.pattern = guid);
969
+ $ZodStringFormat.init(inst, def);
970
+ });
971
+ const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
972
+ if (def.version) {
973
+ const v = {
974
+ v1: 1,
975
+ v2: 2,
976
+ v3: 3,
977
+ v4: 4,
978
+ v5: 5,
979
+ v6: 6,
980
+ v7: 7,
981
+ v8: 8
982
+ }[def.version];
983
+ if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
984
+ def.pattern ?? (def.pattern = uuid(v));
985
+ } else def.pattern ?? (def.pattern = uuid());
986
+ $ZodStringFormat.init(inst, def);
987
+ });
988
+ const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
989
+ def.pattern ?? (def.pattern = email);
990
+ $ZodStringFormat.init(inst, def);
991
+ });
992
+ const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
993
+ $ZodStringFormat.init(inst, def);
994
+ inst._zod.check = (payload) => {
995
+ try {
996
+ const trimmed = payload.value.trim();
997
+ const url = new URL(trimmed);
998
+ if (def.hostname) {
999
+ def.hostname.lastIndex = 0;
1000
+ if (!def.hostname.test(url.hostname)) payload.issues.push({
1001
+ code: "invalid_format",
1002
+ format: "url",
1003
+ note: "Invalid hostname",
1004
+ pattern: def.hostname.source,
1005
+ input: payload.value,
1006
+ inst,
1007
+ continue: !def.abort
1008
+ });
1009
+ }
1010
+ if (def.protocol) {
1011
+ def.protocol.lastIndex = 0;
1012
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1013
+ code: "invalid_format",
1014
+ format: "url",
1015
+ note: "Invalid protocol",
1016
+ pattern: def.protocol.source,
1017
+ input: payload.value,
1018
+ inst,
1019
+ continue: !def.abort
1020
+ });
1021
+ }
1022
+ if (def.normalize) payload.value = url.href;
1023
+ else payload.value = trimmed;
1024
+ return;
1025
+ } catch (_) {
1026
+ payload.issues.push({
1027
+ code: "invalid_format",
1028
+ format: "url",
1029
+ input: payload.value,
1030
+ inst,
1031
+ continue: !def.abort
1032
+ });
1033
+ }
1034
+ };
1035
+ });
1036
+ const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
1037
+ def.pattern ?? (def.pattern = emoji());
1038
+ $ZodStringFormat.init(inst, def);
1039
+ });
1040
+ const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
1041
+ def.pattern ?? (def.pattern = nanoid);
1042
+ $ZodStringFormat.init(inst, def);
1043
+ });
1044
+ const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
1045
+ def.pattern ?? (def.pattern = cuid);
1046
+ $ZodStringFormat.init(inst, def);
1047
+ });
1048
+ const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
1049
+ def.pattern ?? (def.pattern = cuid2);
1050
+ $ZodStringFormat.init(inst, def);
1051
+ });
1052
+ const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
1053
+ def.pattern ?? (def.pattern = ulid);
1054
+ $ZodStringFormat.init(inst, def);
1055
+ });
1056
+ const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
1057
+ def.pattern ?? (def.pattern = xid);
1058
+ $ZodStringFormat.init(inst, def);
1059
+ });
1060
+ const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
1061
+ def.pattern ?? (def.pattern = ksuid);
1062
+ $ZodStringFormat.init(inst, def);
1063
+ });
1064
+ const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
1065
+ def.pattern ?? (def.pattern = datetime$1(def));
1066
+ $ZodStringFormat.init(inst, def);
1067
+ });
1068
+ const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
1069
+ def.pattern ?? (def.pattern = date$1);
1070
+ $ZodStringFormat.init(inst, def);
1071
+ });
1072
+ const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
1073
+ def.pattern ?? (def.pattern = time$1(def));
1074
+ $ZodStringFormat.init(inst, def);
1075
+ });
1076
+ const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
1077
+ def.pattern ?? (def.pattern = duration$1);
1078
+ $ZodStringFormat.init(inst, def);
1079
+ });
1080
+ const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
1081
+ def.pattern ?? (def.pattern = ipv4);
1082
+ $ZodStringFormat.init(inst, def);
1083
+ inst._zod.bag.format = `ipv4`;
1084
+ });
1085
+ const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
1086
+ def.pattern ?? (def.pattern = ipv6);
1087
+ $ZodStringFormat.init(inst, def);
1088
+ inst._zod.bag.format = `ipv6`;
1089
+ inst._zod.check = (payload) => {
1090
+ try {
1091
+ new URL(`http://[${payload.value}]`);
1092
+ } catch {
1093
+ payload.issues.push({
1094
+ code: "invalid_format",
1095
+ format: "ipv6",
1096
+ input: payload.value,
1097
+ inst,
1098
+ continue: !def.abort
1099
+ });
1100
+ }
1101
+ };
1102
+ });
1103
+ const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
1104
+ def.pattern ?? (def.pattern = cidrv4);
1105
+ $ZodStringFormat.init(inst, def);
1106
+ });
1107
+ const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
1108
+ def.pattern ?? (def.pattern = cidrv6);
1109
+ $ZodStringFormat.init(inst, def);
1110
+ inst._zod.check = (payload) => {
1111
+ const parts = payload.value.split("/");
1112
+ try {
1113
+ if (parts.length !== 2) throw new Error();
1114
+ const [address, prefix] = parts;
1115
+ if (!prefix) throw new Error();
1116
+ const prefixNum = Number(prefix);
1117
+ if (`${prefixNum}` !== prefix) throw new Error();
1118
+ if (prefixNum < 0 || prefixNum > 128) throw new Error();
1119
+ new URL(`http://[${address}]`);
1120
+ } catch {
1121
+ payload.issues.push({
1122
+ code: "invalid_format",
1123
+ format: "cidrv6",
1124
+ input: payload.value,
1125
+ inst,
1126
+ continue: !def.abort
1127
+ });
1128
+ }
1129
+ };
1130
+ });
1131
+ function isValidBase64(data) {
1132
+ if (data === "") return true;
1133
+ if (data.length % 4 !== 0) return false;
1134
+ try {
1135
+ atob(data);
1136
+ return true;
1137
+ } catch {
1138
+ return false;
1139
+ }
1140
+ }
1141
+ const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
1142
+ def.pattern ?? (def.pattern = base64);
1143
+ $ZodStringFormat.init(inst, def);
1144
+ inst._zod.bag.contentEncoding = "base64";
1145
+ inst._zod.check = (payload) => {
1146
+ if (isValidBase64(payload.value)) return;
1147
+ payload.issues.push({
1148
+ code: "invalid_format",
1149
+ format: "base64",
1150
+ input: payload.value,
1151
+ inst,
1152
+ continue: !def.abort
1153
+ });
1154
+ };
1155
+ });
1156
+ function isValidBase64URL(data) {
1157
+ if (!base64url.test(data)) return false;
1158
+ const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
1159
+ return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
1160
+ }
1161
+ const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
1162
+ def.pattern ?? (def.pattern = base64url);
1163
+ $ZodStringFormat.init(inst, def);
1164
+ inst._zod.bag.contentEncoding = "base64url";
1165
+ inst._zod.check = (payload) => {
1166
+ if (isValidBase64URL(payload.value)) return;
1167
+ payload.issues.push({
1168
+ code: "invalid_format",
1169
+ format: "base64url",
1170
+ input: payload.value,
1171
+ inst,
1172
+ continue: !def.abort
1173
+ });
1174
+ };
1175
+ });
1176
+ const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
1177
+ def.pattern ?? (def.pattern = e164);
1178
+ $ZodStringFormat.init(inst, def);
1179
+ });
1180
+ function isValidJWT(token, algorithm = null) {
1181
+ try {
1182
+ const tokensParts = token.split(".");
1183
+ if (tokensParts.length !== 3) return false;
1184
+ const [header] = tokensParts;
1185
+ if (!header) return false;
1186
+ const parsedHeader = JSON.parse(atob(header));
1187
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
1188
+ if (!parsedHeader.alg) return false;
1189
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
1190
+ return true;
1191
+ } catch {
1192
+ return false;
1193
+ }
1194
+ }
1195
+ const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
1196
+ $ZodStringFormat.init(inst, def);
1197
+ inst._zod.check = (payload) => {
1198
+ if (isValidJWT(payload.value, def.alg)) return;
1199
+ payload.issues.push({
1200
+ code: "invalid_format",
1201
+ format: "jwt",
1202
+ input: payload.value,
1203
+ inst,
1204
+ continue: !def.abort
1205
+ });
1206
+ };
1207
+ });
1208
+ const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
1209
+ $ZodType.init(inst, def);
1210
+ inst._zod.pattern = boolean$1;
1211
+ inst._zod.parse = (payload, _ctx) => {
1212
+ if (def.coerce) try {
1213
+ payload.value = Boolean(payload.value);
1214
+ } catch (_) {}
1215
+ const input = payload.value;
1216
+ if (typeof input === "boolean") return payload;
1217
+ payload.issues.push({
1218
+ expected: "boolean",
1219
+ code: "invalid_type",
1220
+ input,
1221
+ inst
1222
+ });
1223
+ return payload;
1224
+ };
1225
+ });
1226
+ const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
1227
+ $ZodType.init(inst, def);
1228
+ inst._zod.parse = (payload) => payload;
1229
+ });
1230
+ const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
1231
+ $ZodType.init(inst, def);
1232
+ inst._zod.parse = (payload, _ctx) => {
1233
+ payload.issues.push({
1234
+ expected: "never",
1235
+ code: "invalid_type",
1236
+ input: payload.value,
1237
+ inst
1238
+ });
1239
+ return payload;
1240
+ };
1241
+ });
1242
+ function handleArrayResult(result, final, index) {
1243
+ if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
1244
+ final.value[index] = result.value;
1245
+ }
1246
+ const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
1247
+ $ZodType.init(inst, def);
1248
+ inst._zod.parse = (payload, ctx) => {
1249
+ const input = payload.value;
1250
+ if (!Array.isArray(input)) {
1251
+ payload.issues.push({
1252
+ expected: "array",
1253
+ code: "invalid_type",
1254
+ input,
1255
+ inst
1256
+ });
1257
+ return payload;
1258
+ }
1259
+ payload.value = Array(input.length);
1260
+ const proms = [];
1261
+ for (let i = 0; i < input.length; i++) {
1262
+ const item = input[i];
1263
+ const result = def.element._zod.run({
1264
+ value: item,
1265
+ issues: []
1266
+ }, ctx);
1267
+ if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
1268
+ else handleArrayResult(result, payload, i);
1269
+ }
1270
+ if (proms.length) return Promise.all(proms).then(() => payload);
1271
+ return payload;
1272
+ };
1273
+ });
1274
+ function handlePropertyResult(result, final, key, input, isOptionalOut) {
1275
+ if (result.issues.length) {
1276
+ if (isOptionalOut && !(key in input)) return;
1277
+ final.issues.push(...prefixIssues(key, result.issues));
1278
+ }
1279
+ if (result.value === void 0) {
1280
+ if (key in input) final.value[key] = void 0;
1281
+ } else final.value[key] = result.value;
1282
+ }
1283
+ function normalizeDef(def) {
1284
+ const keys = Object.keys(def.shape);
1285
+ for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1286
+ const okeys = optionalKeys(def.shape);
1287
+ return {
1288
+ ...def,
1289
+ keys,
1290
+ keySet: new Set(keys),
1291
+ numKeys: keys.length,
1292
+ optionalKeys: new Set(okeys)
1293
+ };
1294
+ }
1295
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
1296
+ const unrecognized = [];
1297
+ const keySet = def.keySet;
1298
+ const _catchall = def.catchall._zod;
1299
+ const t = _catchall.def.type;
1300
+ const isOptionalOut = _catchall.optout === "optional";
1301
+ for (const key in input) {
1302
+ if (keySet.has(key)) continue;
1303
+ if (t === "never") {
1304
+ unrecognized.push(key);
1305
+ continue;
1306
+ }
1307
+ const r = _catchall.run({
1308
+ value: input[key],
1309
+ issues: []
1310
+ }, ctx);
1311
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
1312
+ else handlePropertyResult(r, payload, key, input, isOptionalOut);
1313
+ }
1314
+ if (unrecognized.length) payload.issues.push({
1315
+ code: "unrecognized_keys",
1316
+ keys: unrecognized,
1317
+ input,
1318
+ inst
1319
+ });
1320
+ if (!proms.length) return payload;
1321
+ return Promise.all(proms).then(() => {
1322
+ return payload;
1323
+ });
1324
+ }
1325
+ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1326
+ $ZodType.init(inst, def);
1327
+ if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
1328
+ const sh = def.shape;
1329
+ Object.defineProperty(def, "shape", { get: () => {
1330
+ const newSh = { ...sh };
1331
+ Object.defineProperty(def, "shape", { value: newSh });
1332
+ return newSh;
1333
+ } });
1334
+ }
1335
+ const _normalized = cached(() => normalizeDef(def));
1336
+ defineLazy(inst._zod, "propValues", () => {
1337
+ const shape = def.shape;
1338
+ const propValues = {};
1339
+ for (const key in shape) {
1340
+ const field = shape[key]._zod;
1341
+ if (field.values) {
1342
+ propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1343
+ for (const v of field.values) propValues[key].add(v);
1344
+ }
1345
+ }
1346
+ return propValues;
1347
+ });
1348
+ const isObject$2 = isObject;
1349
+ const catchall = def.catchall;
1350
+ let value;
1351
+ inst._zod.parse = (payload, ctx) => {
1352
+ value ?? (value = _normalized.value);
1353
+ const input = payload.value;
1354
+ if (!isObject$2(input)) {
1355
+ payload.issues.push({
1356
+ expected: "object",
1357
+ code: "invalid_type",
1358
+ input,
1359
+ inst
1360
+ });
1361
+ return payload;
1362
+ }
1363
+ payload.value = {};
1364
+ const proms = [];
1365
+ const shape = value.shape;
1366
+ for (const key of value.keys) {
1367
+ const el = shape[key];
1368
+ const isOptionalOut = el._zod.optout === "optional";
1369
+ const r = el._zod.run({
1370
+ value: input[key],
1371
+ issues: []
1372
+ }, ctx);
1373
+ if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
1374
+ else handlePropertyResult(r, payload, key, input, isOptionalOut);
1375
+ }
1376
+ if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
1377
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1378
+ };
1379
+ });
1380
+ const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
1381
+ $ZodObject.init(inst, def);
1382
+ const superParse = inst._zod.parse;
1383
+ const _normalized = cached(() => normalizeDef(def));
1384
+ const generateFastpass = (shape) => {
1385
+ const doc = new Doc([
1386
+ "shape",
1387
+ "payload",
1388
+ "ctx"
1389
+ ]);
1390
+ const normalized = _normalized.value;
1391
+ const parseStr = (key) => {
1392
+ const k = esc(key);
1393
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1394
+ };
1395
+ doc.write(`const input = payload.value;`);
1396
+ const ids = Object.create(null);
1397
+ let counter = 0;
1398
+ for (const key of normalized.keys) ids[key] = `key_${counter++}`;
1399
+ doc.write(`const newResult = {};`);
1400
+ for (const key of normalized.keys) {
1401
+ const id = ids[key];
1402
+ const k = esc(key);
1403
+ const isOptionalOut = shape[key]?._zod?.optout === "optional";
1404
+ doc.write(`const ${id} = ${parseStr(key)};`);
1405
+ if (isOptionalOut) doc.write(`
1406
+ if (${id}.issues.length) {
1407
+ if (${k} in input) {
1408
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1409
+ ...iss,
1410
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1411
+ })));
1412
+ }
1413
+ }
1414
+
1415
+ if (${id}.value === undefined) {
1416
+ if (${k} in input) {
1417
+ newResult[${k}] = undefined;
1418
+ }
1419
+ } else {
1420
+ newResult[${k}] = ${id}.value;
1421
+ }
1422
+
1423
+ `);
1424
+ else doc.write(`
1425
+ if (${id}.issues.length) {
1426
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1427
+ ...iss,
1428
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1429
+ })));
1430
+ }
1431
+
1432
+ if (${id}.value === undefined) {
1433
+ if (${k} in input) {
1434
+ newResult[${k}] = undefined;
1435
+ }
1436
+ } else {
1437
+ newResult[${k}] = ${id}.value;
1438
+ }
1439
+
1440
+ `);
1441
+ }
1442
+ doc.write(`payload.value = newResult;`);
1443
+ doc.write(`return payload;`);
1444
+ const fn = doc.compile();
1445
+ return (payload, ctx) => fn(shape, payload, ctx);
1446
+ };
1447
+ let fastpass;
1448
+ const isObject$1 = isObject;
1449
+ const jit = !globalConfig.jitless;
1450
+ const allowsEval$1 = allowsEval;
1451
+ const fastEnabled = jit && allowsEval$1.value;
1452
+ const catchall = def.catchall;
1453
+ let value;
1454
+ inst._zod.parse = (payload, ctx) => {
1455
+ value ?? (value = _normalized.value);
1456
+ const input = payload.value;
1457
+ if (!isObject$1(input)) {
1458
+ payload.issues.push({
1459
+ expected: "object",
1460
+ code: "invalid_type",
1461
+ input,
1462
+ inst
1463
+ });
1464
+ return payload;
1465
+ }
1466
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
1467
+ if (!fastpass) fastpass = generateFastpass(def.shape);
1468
+ payload = fastpass(payload, ctx);
1469
+ if (!catchall) return payload;
1470
+ return handleCatchall([], input, payload, ctx, value, inst);
1471
+ }
1472
+ return superParse(payload, ctx);
1473
+ };
1474
+ });
1475
+ function handleUnionResults(results, final, inst, ctx) {
1476
+ for (const result of results) if (result.issues.length === 0) {
1477
+ final.value = result.value;
1478
+ return final;
1479
+ }
1480
+ const nonaborted = results.filter((r) => !aborted(r));
1481
+ if (nonaborted.length === 1) {
1482
+ final.value = nonaborted[0].value;
1483
+ return nonaborted[0];
1484
+ }
1485
+ final.issues.push({
1486
+ code: "invalid_union",
1487
+ input: final.value,
1488
+ inst,
1489
+ errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1490
+ });
1491
+ return final;
1492
+ }
1493
+ const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1494
+ $ZodType.init(inst, def);
1495
+ defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1496
+ defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1497
+ defineLazy(inst._zod, "values", () => {
1498
+ if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
1499
+ });
1500
+ defineLazy(inst._zod, "pattern", () => {
1501
+ if (def.options.every((o) => o._zod.pattern)) {
1502
+ const patterns = def.options.map((o) => o._zod.pattern);
1503
+ return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1504
+ }
1505
+ });
1506
+ const single = def.options.length === 1;
1507
+ const first = def.options[0]._zod.run;
1508
+ inst._zod.parse = (payload, ctx) => {
1509
+ if (single) return first(payload, ctx);
1510
+ let async = false;
1511
+ const results = [];
1512
+ for (const option of def.options) {
1513
+ const result = option._zod.run({
1514
+ value: payload.value,
1515
+ issues: []
1516
+ }, ctx);
1517
+ if (result instanceof Promise) {
1518
+ results.push(result);
1519
+ async = true;
1520
+ } else {
1521
+ if (result.issues.length === 0) return result;
1522
+ results.push(result);
1523
+ }
1524
+ }
1525
+ if (!async) return handleUnionResults(results, payload, inst, ctx);
1526
+ return Promise.all(results).then((results) => {
1527
+ return handleUnionResults(results, payload, inst, ctx);
1528
+ });
1529
+ };
1530
+ });
1531
+ const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
1532
+ $ZodType.init(inst, def);
1533
+ inst._zod.parse = (payload, ctx) => {
1534
+ const input = payload.value;
1535
+ const left = def.left._zod.run({
1536
+ value: input,
1537
+ issues: []
1538
+ }, ctx);
1539
+ const right = def.right._zod.run({
1540
+ value: input,
1541
+ issues: []
1542
+ }, ctx);
1543
+ if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
1544
+ return handleIntersectionResults(payload, left, right);
1545
+ });
1546
+ return handleIntersectionResults(payload, left, right);
1547
+ };
1548
+ });
1549
+ function mergeValues(a, b) {
1550
+ if (a === b) return {
1551
+ valid: true,
1552
+ data: a
1553
+ };
1554
+ if (a instanceof Date && b instanceof Date && +a === +b) return {
1555
+ valid: true,
1556
+ data: a
1557
+ };
1558
+ if (isPlainObject(a) && isPlainObject(b)) {
1559
+ const bKeys = Object.keys(b);
1560
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1561
+ const newObj = {
1562
+ ...a,
1563
+ ...b
1564
+ };
1565
+ for (const key of sharedKeys) {
1566
+ const sharedValue = mergeValues(a[key], b[key]);
1567
+ if (!sharedValue.valid) return {
1568
+ valid: false,
1569
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
1570
+ };
1571
+ newObj[key] = sharedValue.data;
1572
+ }
1573
+ return {
1574
+ valid: true,
1575
+ data: newObj
1576
+ };
1577
+ }
1578
+ if (Array.isArray(a) && Array.isArray(b)) {
1579
+ if (a.length !== b.length) return {
1580
+ valid: false,
1581
+ mergeErrorPath: []
1582
+ };
1583
+ const newArray = [];
1584
+ for (let index = 0; index < a.length; index++) {
1585
+ const itemA = a[index];
1586
+ const itemB = b[index];
1587
+ const sharedValue = mergeValues(itemA, itemB);
1588
+ if (!sharedValue.valid) return {
1589
+ valid: false,
1590
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
1591
+ };
1592
+ newArray.push(sharedValue.data);
1593
+ }
1594
+ return {
1595
+ valid: true,
1596
+ data: newArray
1597
+ };
1598
+ }
1599
+ return {
1600
+ valid: false,
1601
+ mergeErrorPath: []
1602
+ };
1603
+ }
1604
+ function handleIntersectionResults(result, left, right) {
1605
+ const unrecKeys = /* @__PURE__ */ new Map();
1606
+ let unrecIssue;
1607
+ for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
1608
+ unrecIssue ?? (unrecIssue = iss);
1609
+ for (const k of iss.keys) {
1610
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1611
+ unrecKeys.get(k).l = true;
1612
+ }
1613
+ } else result.issues.push(iss);
1614
+ for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
1615
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
1616
+ unrecKeys.get(k).r = true;
1617
+ }
1618
+ else result.issues.push(iss);
1619
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1620
+ if (bothKeys.length && unrecIssue) result.issues.push({
1621
+ ...unrecIssue,
1622
+ keys: bothKeys
1623
+ });
1624
+ if (aborted(result)) return result;
1625
+ const merged = mergeValues(left.value, right.value);
1626
+ if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
1627
+ result.value = merged.data;
1628
+ return result;
1629
+ }
1630
+ const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
1631
+ $ZodType.init(inst, def);
1632
+ inst._zod.parse = (payload, ctx) => {
1633
+ const input = payload.value;
1634
+ if (!isPlainObject(input)) {
1635
+ payload.issues.push({
1636
+ expected: "record",
1637
+ code: "invalid_type",
1638
+ input,
1639
+ inst
1640
+ });
1641
+ return payload;
1642
+ }
1643
+ const proms = [];
1644
+ const values = def.keyType._zod.values;
1645
+ if (values) {
1646
+ payload.value = {};
1647
+ const recordKeys = /* @__PURE__ */ new Set();
1648
+ for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1649
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
1650
+ const result = def.valueType._zod.run({
1651
+ value: input[key],
1652
+ issues: []
1653
+ }, ctx);
1654
+ if (result instanceof Promise) proms.push(result.then((result) => {
1655
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1656
+ payload.value[key] = result.value;
1657
+ }));
1658
+ else {
1659
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1660
+ payload.value[key] = result.value;
1661
+ }
1662
+ }
1663
+ let unrecognized;
1664
+ for (const key in input) if (!recordKeys.has(key)) {
1665
+ unrecognized = unrecognized ?? [];
1666
+ unrecognized.push(key);
1667
+ }
1668
+ if (unrecognized && unrecognized.length > 0) payload.issues.push({
1669
+ code: "unrecognized_keys",
1670
+ input,
1671
+ inst,
1672
+ keys: unrecognized
1673
+ });
1674
+ } else {
1675
+ payload.value = {};
1676
+ for (const key of Reflect.ownKeys(input)) {
1677
+ if (key === "__proto__") continue;
1678
+ let keyResult = def.keyType._zod.run({
1679
+ value: key,
1680
+ issues: []
1681
+ }, ctx);
1682
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
1683
+ if (typeof key === "string" && number.test(key) && keyResult.issues.length) {
1684
+ const retryResult = def.keyType._zod.run({
1685
+ value: Number(key),
1686
+ issues: []
1687
+ }, ctx);
1688
+ if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
1689
+ if (retryResult.issues.length === 0) keyResult = retryResult;
1690
+ }
1691
+ if (keyResult.issues.length) {
1692
+ if (def.mode === "loose") payload.value[key] = input[key];
1693
+ else payload.issues.push({
1694
+ code: "invalid_key",
1695
+ origin: "record",
1696
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1697
+ input: key,
1698
+ path: [key],
1699
+ inst
1700
+ });
1701
+ continue;
1702
+ }
1703
+ const result = def.valueType._zod.run({
1704
+ value: input[key],
1705
+ issues: []
1706
+ }, ctx);
1707
+ if (result instanceof Promise) proms.push(result.then((result) => {
1708
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1709
+ payload.value[keyResult.value] = result.value;
1710
+ }));
1711
+ else {
1712
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1713
+ payload.value[keyResult.value] = result.value;
1714
+ }
1715
+ }
1716
+ }
1717
+ if (proms.length) return Promise.all(proms).then(() => payload);
1718
+ return payload;
1719
+ };
1720
+ });
1721
+ const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
1722
+ $ZodType.init(inst, def);
1723
+ const values = getEnumValues(def.entries);
1724
+ const valuesSet = new Set(values);
1725
+ inst._zod.values = valuesSet;
1726
+ inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
1727
+ inst._zod.parse = (payload, _ctx) => {
1728
+ const input = payload.value;
1729
+ if (valuesSet.has(input)) return payload;
1730
+ payload.issues.push({
1731
+ code: "invalid_value",
1732
+ values,
1733
+ input,
1734
+ inst
1735
+ });
1736
+ return payload;
1737
+ };
1738
+ });
1739
+ const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
1740
+ $ZodType.init(inst, def);
1741
+ inst._zod.parse = (payload, ctx) => {
1742
+ if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
1743
+ const _out = def.transform(payload.value, payload);
1744
+ if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
1745
+ payload.value = output;
1746
+ return payload;
1747
+ });
1748
+ if (_out instanceof Promise) throw new $ZodAsyncError();
1749
+ payload.value = _out;
1750
+ return payload;
1751
+ };
1752
+ });
1753
+ function handleOptionalResult(result, input) {
1754
+ if (result.issues.length && input === void 0) return {
1755
+ issues: [],
1756
+ value: void 0
1757
+ };
1758
+ return result;
1759
+ }
1760
+ const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
1761
+ $ZodType.init(inst, def);
1762
+ inst._zod.optin = "optional";
1763
+ inst._zod.optout = "optional";
1764
+ defineLazy(inst._zod, "values", () => {
1765
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
1766
+ });
1767
+ defineLazy(inst._zod, "pattern", () => {
1768
+ const pattern = def.innerType._zod.pattern;
1769
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
1770
+ });
1771
+ inst._zod.parse = (payload, ctx) => {
1772
+ if (def.innerType._zod.optin === "optional") {
1773
+ const result = def.innerType._zod.run(payload, ctx);
1774
+ if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, payload.value));
1775
+ return handleOptionalResult(result, payload.value);
1776
+ }
1777
+ if (payload.value === void 0) return payload;
1778
+ return def.innerType._zod.run(payload, ctx);
1779
+ };
1780
+ });
1781
+ const $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
1782
+ $ZodOptional.init(inst, def);
1783
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1784
+ defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
1785
+ inst._zod.parse = (payload, ctx) => {
1786
+ return def.innerType._zod.run(payload, ctx);
1787
+ };
1788
+ });
1789
+ const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
1790
+ $ZodType.init(inst, def);
1791
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1792
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1793
+ defineLazy(inst._zod, "pattern", () => {
1794
+ const pattern = def.innerType._zod.pattern;
1795
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
1796
+ });
1797
+ defineLazy(inst._zod, "values", () => {
1798
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
1799
+ });
1800
+ inst._zod.parse = (payload, ctx) => {
1801
+ if (payload.value === null) return payload;
1802
+ return def.innerType._zod.run(payload, ctx);
1803
+ };
1804
+ });
1805
+ const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
1806
+ $ZodType.init(inst, def);
1807
+ inst._zod.optin = "optional";
1808
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1809
+ inst._zod.parse = (payload, ctx) => {
1810
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1811
+ if (payload.value === void 0) {
1812
+ payload.value = def.defaultValue;
1813
+ /**
1814
+ * $ZodDefault returns the default value immediately in forward direction.
1815
+ * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
1816
+ return payload;
1817
+ }
1818
+ const result = def.innerType._zod.run(payload, ctx);
1819
+ if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
1820
+ return handleDefaultResult(result, def);
1821
+ };
1822
+ });
1823
+ function handleDefaultResult(payload, def) {
1824
+ if (payload.value === void 0) payload.value = def.defaultValue;
1825
+ return payload;
1826
+ }
1827
+ const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
1828
+ $ZodType.init(inst, def);
1829
+ inst._zod.optin = "optional";
1830
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1831
+ inst._zod.parse = (payload, ctx) => {
1832
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1833
+ if (payload.value === void 0) payload.value = def.defaultValue;
1834
+ return def.innerType._zod.run(payload, ctx);
1835
+ };
1836
+ });
1837
+ const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
1838
+ $ZodType.init(inst, def);
1839
+ defineLazy(inst._zod, "values", () => {
1840
+ const v = def.innerType._zod.values;
1841
+ return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
1842
+ });
1843
+ inst._zod.parse = (payload, ctx) => {
1844
+ const result = def.innerType._zod.run(payload, ctx);
1845
+ if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
1846
+ return handleNonOptionalResult(result, inst);
1847
+ };
1848
+ });
1849
+ function handleNonOptionalResult(payload, inst) {
1850
+ if (!payload.issues.length && payload.value === void 0) payload.issues.push({
1851
+ code: "invalid_type",
1852
+ expected: "nonoptional",
1853
+ input: payload.value,
1854
+ inst
1855
+ });
1856
+ return payload;
1857
+ }
1858
+ const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
1859
+ $ZodType.init(inst, def);
1860
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1861
+ defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1862
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1863
+ inst._zod.parse = (payload, ctx) => {
1864
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1865
+ const result = def.innerType._zod.run(payload, ctx);
1866
+ if (result instanceof Promise) return result.then((result) => {
1867
+ payload.value = result.value;
1868
+ if (result.issues.length) {
1869
+ payload.value = def.catchValue({
1870
+ ...payload,
1871
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
1872
+ input: payload.value
1873
+ });
1874
+ payload.issues = [];
1875
+ }
1876
+ return payload;
1877
+ });
1878
+ payload.value = result.value;
1879
+ if (result.issues.length) {
1880
+ payload.value = def.catchValue({
1881
+ ...payload,
1882
+ error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
1883
+ input: payload.value
1884
+ });
1885
+ payload.issues = [];
1886
+ }
1887
+ return payload;
1888
+ };
1889
+ });
1890
+ const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
1891
+ $ZodType.init(inst, def);
1892
+ defineLazy(inst._zod, "values", () => def.in._zod.values);
1893
+ defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1894
+ defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1895
+ defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
1896
+ inst._zod.parse = (payload, ctx) => {
1897
+ if (ctx.direction === "backward") {
1898
+ const right = def.out._zod.run(payload, ctx);
1899
+ if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
1900
+ return handlePipeResult(right, def.in, ctx);
1901
+ }
1902
+ const left = def.in._zod.run(payload, ctx);
1903
+ if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
1904
+ return handlePipeResult(left, def.out, ctx);
1905
+ };
1906
+ });
1907
+ function handlePipeResult(left, next, ctx) {
1908
+ if (left.issues.length) {
1909
+ left.aborted = true;
1910
+ return left;
1911
+ }
1912
+ return next._zod.run({
1913
+ value: left.value,
1914
+ issues: left.issues
1915
+ }, ctx);
1916
+ }
1917
+ const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
1918
+ $ZodType.init(inst, def);
1919
+ defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1920
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1921
+ defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
1922
+ defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
1923
+ inst._zod.parse = (payload, ctx) => {
1924
+ if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
1925
+ const result = def.innerType._zod.run(payload, ctx);
1926
+ if (result instanceof Promise) return result.then(handleReadonlyResult);
1927
+ return handleReadonlyResult(result);
1928
+ };
1929
+ });
1930
+ function handleReadonlyResult(payload) {
1931
+ payload.value = Object.freeze(payload.value);
1932
+ return payload;
1933
+ }
1934
+ const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
1935
+ $ZodCheck.init(inst, def);
1936
+ $ZodType.init(inst, def);
1937
+ inst._zod.parse = (payload, _) => {
1938
+ return payload;
1939
+ };
1940
+ inst._zod.check = (payload) => {
1941
+ const input = payload.value;
1942
+ const r = def.fn(input);
1943
+ if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
1944
+ handleRefineResult(r, payload, input, inst);
1945
+ };
1946
+ });
1947
+ function handleRefineResult(result, payload, input, inst) {
1948
+ if (!result) {
1949
+ const _iss = {
1950
+ code: "custom",
1951
+ input,
1952
+ inst,
1953
+ path: [...inst._zod.def.path ?? []],
1954
+ continue: !inst._zod.def.abort
1955
+ };
1956
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
1957
+ payload.issues.push(issue(_iss));
1958
+ }
1959
+ }
1960
+
1961
+ //#endregion
1962
+ //#region node_modules/zod/v4/core/registries.js
1963
+ var _a;
1964
+ var $ZodRegistry = class {
1965
+ constructor() {
1966
+ this._map = /* @__PURE__ */ new WeakMap();
1967
+ this._idmap = /* @__PURE__ */ new Map();
1968
+ }
1969
+ add(schema, ..._meta) {
1970
+ const meta = _meta[0];
1971
+ this._map.set(schema, meta);
1972
+ if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
1973
+ return this;
1974
+ }
1975
+ clear() {
1976
+ this._map = /* @__PURE__ */ new WeakMap();
1977
+ this._idmap = /* @__PURE__ */ new Map();
1978
+ return this;
1979
+ }
1980
+ remove(schema) {
1981
+ const meta = this._map.get(schema);
1982
+ if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
1983
+ this._map.delete(schema);
1984
+ return this;
1985
+ }
1986
+ get(schema) {
1987
+ const p = schema._zod.parent;
1988
+ if (p) {
1989
+ const pm = { ...this.get(p) ?? {} };
1990
+ delete pm.id;
1991
+ const f = {
1992
+ ...pm,
1993
+ ...this._map.get(schema)
1994
+ };
1995
+ return Object.keys(f).length ? f : void 0;
1996
+ }
1997
+ return this._map.get(schema);
1998
+ }
1999
+ has(schema) {
2000
+ return this._map.has(schema);
2001
+ }
2002
+ };
2003
+ function registry() {
2004
+ return new $ZodRegistry();
2005
+ }
2006
+ (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2007
+ const globalRegistry = globalThis.__zod_globalRegistry;
2008
+
2009
+ //#endregion
2010
+ //#region node_modules/zod/v4/core/api.js
2011
+ /* @__NO_SIDE_EFFECTS__ */
2012
+ function _string(Class, params) {
2013
+ return new Class({
2014
+ type: "string",
2015
+ ...normalizeParams(params)
2016
+ });
2017
+ }
2018
+ /* @__NO_SIDE_EFFECTS__ */
2019
+ function _email(Class, params) {
2020
+ return new Class({
2021
+ type: "string",
2022
+ format: "email",
2023
+ check: "string_format",
2024
+ abort: false,
2025
+ ...normalizeParams(params)
2026
+ });
2027
+ }
2028
+ /* @__NO_SIDE_EFFECTS__ */
2029
+ function _guid(Class, params) {
2030
+ return new Class({
2031
+ type: "string",
2032
+ format: "guid",
2033
+ check: "string_format",
2034
+ abort: false,
2035
+ ...normalizeParams(params)
2036
+ });
2037
+ }
2038
+ /* @__NO_SIDE_EFFECTS__ */
2039
+ function _uuid(Class, params) {
2040
+ return new Class({
2041
+ type: "string",
2042
+ format: "uuid",
2043
+ check: "string_format",
2044
+ abort: false,
2045
+ ...normalizeParams(params)
2046
+ });
2047
+ }
2048
+ /* @__NO_SIDE_EFFECTS__ */
2049
+ function _uuidv4(Class, params) {
2050
+ return new Class({
2051
+ type: "string",
2052
+ format: "uuid",
2053
+ check: "string_format",
2054
+ abort: false,
2055
+ version: "v4",
2056
+ ...normalizeParams(params)
2057
+ });
2058
+ }
2059
+ /* @__NO_SIDE_EFFECTS__ */
2060
+ function _uuidv6(Class, params) {
2061
+ return new Class({
2062
+ type: "string",
2063
+ format: "uuid",
2064
+ check: "string_format",
2065
+ abort: false,
2066
+ version: "v6",
2067
+ ...normalizeParams(params)
2068
+ });
2069
+ }
2070
+ /* @__NO_SIDE_EFFECTS__ */
2071
+ function _uuidv7(Class, params) {
2072
+ return new Class({
2073
+ type: "string",
2074
+ format: "uuid",
2075
+ check: "string_format",
2076
+ abort: false,
2077
+ version: "v7",
2078
+ ...normalizeParams(params)
2079
+ });
2080
+ }
2081
+ /* @__NO_SIDE_EFFECTS__ */
2082
+ function _url(Class, params) {
2083
+ return new Class({
2084
+ type: "string",
2085
+ format: "url",
2086
+ check: "string_format",
2087
+ abort: false,
2088
+ ...normalizeParams(params)
2089
+ });
2090
+ }
2091
+ /* @__NO_SIDE_EFFECTS__ */
2092
+ function _emoji(Class, params) {
2093
+ return new Class({
2094
+ type: "string",
2095
+ format: "emoji",
2096
+ check: "string_format",
2097
+ abort: false,
2098
+ ...normalizeParams(params)
2099
+ });
2100
+ }
2101
+ /* @__NO_SIDE_EFFECTS__ */
2102
+ function _nanoid(Class, params) {
2103
+ return new Class({
2104
+ type: "string",
2105
+ format: "nanoid",
2106
+ check: "string_format",
2107
+ abort: false,
2108
+ ...normalizeParams(params)
2109
+ });
2110
+ }
2111
+ /* @__NO_SIDE_EFFECTS__ */
2112
+ function _cuid(Class, params) {
2113
+ return new Class({
2114
+ type: "string",
2115
+ format: "cuid",
2116
+ check: "string_format",
2117
+ abort: false,
2118
+ ...normalizeParams(params)
2119
+ });
2120
+ }
2121
+ /* @__NO_SIDE_EFFECTS__ */
2122
+ function _cuid2(Class, params) {
2123
+ return new Class({
2124
+ type: "string",
2125
+ format: "cuid2",
2126
+ check: "string_format",
2127
+ abort: false,
2128
+ ...normalizeParams(params)
2129
+ });
2130
+ }
2131
+ /* @__NO_SIDE_EFFECTS__ */
2132
+ function _ulid(Class, params) {
2133
+ return new Class({
2134
+ type: "string",
2135
+ format: "ulid",
2136
+ check: "string_format",
2137
+ abort: false,
2138
+ ...normalizeParams(params)
2139
+ });
2140
+ }
2141
+ /* @__NO_SIDE_EFFECTS__ */
2142
+ function _xid(Class, params) {
2143
+ return new Class({
2144
+ type: "string",
2145
+ format: "xid",
2146
+ check: "string_format",
2147
+ abort: false,
2148
+ ...normalizeParams(params)
2149
+ });
2150
+ }
2151
+ /* @__NO_SIDE_EFFECTS__ */
2152
+ function _ksuid(Class, params) {
2153
+ return new Class({
2154
+ type: "string",
2155
+ format: "ksuid",
2156
+ check: "string_format",
2157
+ abort: false,
2158
+ ...normalizeParams(params)
2159
+ });
2160
+ }
2161
+ /* @__NO_SIDE_EFFECTS__ */
2162
+ function _ipv4(Class, params) {
2163
+ return new Class({
2164
+ type: "string",
2165
+ format: "ipv4",
2166
+ check: "string_format",
2167
+ abort: false,
2168
+ ...normalizeParams(params)
2169
+ });
2170
+ }
2171
+ /* @__NO_SIDE_EFFECTS__ */
2172
+ function _ipv6(Class, params) {
2173
+ return new Class({
2174
+ type: "string",
2175
+ format: "ipv6",
2176
+ check: "string_format",
2177
+ abort: false,
2178
+ ...normalizeParams(params)
2179
+ });
2180
+ }
2181
+ /* @__NO_SIDE_EFFECTS__ */
2182
+ function _cidrv4(Class, params) {
2183
+ return new Class({
2184
+ type: "string",
2185
+ format: "cidrv4",
2186
+ check: "string_format",
2187
+ abort: false,
2188
+ ...normalizeParams(params)
2189
+ });
2190
+ }
2191
+ /* @__NO_SIDE_EFFECTS__ */
2192
+ function _cidrv6(Class, params) {
2193
+ return new Class({
2194
+ type: "string",
2195
+ format: "cidrv6",
2196
+ check: "string_format",
2197
+ abort: false,
2198
+ ...normalizeParams(params)
2199
+ });
2200
+ }
2201
+ /* @__NO_SIDE_EFFECTS__ */
2202
+ function _base64(Class, params) {
2203
+ return new Class({
2204
+ type: "string",
2205
+ format: "base64",
2206
+ check: "string_format",
2207
+ abort: false,
2208
+ ...normalizeParams(params)
2209
+ });
2210
+ }
2211
+ /* @__NO_SIDE_EFFECTS__ */
2212
+ function _base64url(Class, params) {
2213
+ return new Class({
2214
+ type: "string",
2215
+ format: "base64url",
2216
+ check: "string_format",
2217
+ abort: false,
2218
+ ...normalizeParams(params)
2219
+ });
2220
+ }
2221
+ /* @__NO_SIDE_EFFECTS__ */
2222
+ function _e164(Class, params) {
2223
+ return new Class({
2224
+ type: "string",
2225
+ format: "e164",
2226
+ check: "string_format",
2227
+ abort: false,
2228
+ ...normalizeParams(params)
2229
+ });
2230
+ }
2231
+ /* @__NO_SIDE_EFFECTS__ */
2232
+ function _jwt(Class, params) {
2233
+ return new Class({
2234
+ type: "string",
2235
+ format: "jwt",
2236
+ check: "string_format",
2237
+ abort: false,
2238
+ ...normalizeParams(params)
2239
+ });
2240
+ }
2241
+ /* @__NO_SIDE_EFFECTS__ */
2242
+ function _isoDateTime(Class, params) {
2243
+ return new Class({
2244
+ type: "string",
2245
+ format: "datetime",
2246
+ check: "string_format",
2247
+ offset: false,
2248
+ local: false,
2249
+ precision: null,
2250
+ ...normalizeParams(params)
2251
+ });
2252
+ }
2253
+ /* @__NO_SIDE_EFFECTS__ */
2254
+ function _isoDate(Class, params) {
2255
+ return new Class({
2256
+ type: "string",
2257
+ format: "date",
2258
+ check: "string_format",
2259
+ ...normalizeParams(params)
2260
+ });
2261
+ }
2262
+ /* @__NO_SIDE_EFFECTS__ */
2263
+ function _isoTime(Class, params) {
2264
+ return new Class({
2265
+ type: "string",
2266
+ format: "time",
2267
+ check: "string_format",
2268
+ precision: null,
2269
+ ...normalizeParams(params)
2270
+ });
2271
+ }
2272
+ /* @__NO_SIDE_EFFECTS__ */
2273
+ function _isoDuration(Class, params) {
2274
+ return new Class({
2275
+ type: "string",
2276
+ format: "duration",
2277
+ check: "string_format",
2278
+ ...normalizeParams(params)
2279
+ });
2280
+ }
2281
+ /* @__NO_SIDE_EFFECTS__ */
2282
+ function _boolean(Class, params) {
2283
+ return new Class({
2284
+ type: "boolean",
2285
+ ...normalizeParams(params)
2286
+ });
2287
+ }
2288
+ /* @__NO_SIDE_EFFECTS__ */
2289
+ function _unknown(Class) {
2290
+ return new Class({ type: "unknown" });
2291
+ }
2292
+ /* @__NO_SIDE_EFFECTS__ */
2293
+ function _never(Class, params) {
2294
+ return new Class({
2295
+ type: "never",
2296
+ ...normalizeParams(params)
2297
+ });
2298
+ }
2299
+ /* @__NO_SIDE_EFFECTS__ */
2300
+ function _maxLength(maximum, params) {
2301
+ return new $ZodCheckMaxLength({
2302
+ check: "max_length",
2303
+ ...normalizeParams(params),
2304
+ maximum
2305
+ });
2306
+ }
2307
+ /* @__NO_SIDE_EFFECTS__ */
2308
+ function _minLength(minimum, params) {
2309
+ return new $ZodCheckMinLength({
2310
+ check: "min_length",
2311
+ ...normalizeParams(params),
2312
+ minimum
2313
+ });
2314
+ }
2315
+ /* @__NO_SIDE_EFFECTS__ */
2316
+ function _length(length, params) {
2317
+ return new $ZodCheckLengthEquals({
2318
+ check: "length_equals",
2319
+ ...normalizeParams(params),
2320
+ length
2321
+ });
2322
+ }
2323
+ /* @__NO_SIDE_EFFECTS__ */
2324
+ function _regex(pattern, params) {
2325
+ return new $ZodCheckRegex({
2326
+ check: "string_format",
2327
+ format: "regex",
2328
+ ...normalizeParams(params),
2329
+ pattern
2330
+ });
2331
+ }
2332
+ /* @__NO_SIDE_EFFECTS__ */
2333
+ function _lowercase(params) {
2334
+ return new $ZodCheckLowerCase({
2335
+ check: "string_format",
2336
+ format: "lowercase",
2337
+ ...normalizeParams(params)
2338
+ });
2339
+ }
2340
+ /* @__NO_SIDE_EFFECTS__ */
2341
+ function _uppercase(params) {
2342
+ return new $ZodCheckUpperCase({
2343
+ check: "string_format",
2344
+ format: "uppercase",
2345
+ ...normalizeParams(params)
2346
+ });
2347
+ }
2348
+ /* @__NO_SIDE_EFFECTS__ */
2349
+ function _includes(includes, params) {
2350
+ return new $ZodCheckIncludes({
2351
+ check: "string_format",
2352
+ format: "includes",
2353
+ ...normalizeParams(params),
2354
+ includes
2355
+ });
2356
+ }
2357
+ /* @__NO_SIDE_EFFECTS__ */
2358
+ function _startsWith(prefix, params) {
2359
+ return new $ZodCheckStartsWith({
2360
+ check: "string_format",
2361
+ format: "starts_with",
2362
+ ...normalizeParams(params),
2363
+ prefix
2364
+ });
2365
+ }
2366
+ /* @__NO_SIDE_EFFECTS__ */
2367
+ function _endsWith(suffix, params) {
2368
+ return new $ZodCheckEndsWith({
2369
+ check: "string_format",
2370
+ format: "ends_with",
2371
+ ...normalizeParams(params),
2372
+ suffix
2373
+ });
2374
+ }
2375
+ /* @__NO_SIDE_EFFECTS__ */
2376
+ function _overwrite(tx) {
2377
+ return new $ZodCheckOverwrite({
2378
+ check: "overwrite",
2379
+ tx
2380
+ });
2381
+ }
2382
+ /* @__NO_SIDE_EFFECTS__ */
2383
+ function _normalize(form) {
2384
+ return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
2385
+ }
2386
+ /* @__NO_SIDE_EFFECTS__ */
2387
+ function _trim() {
2388
+ return /* @__PURE__ */ _overwrite((input) => input.trim());
2389
+ }
2390
+ /* @__NO_SIDE_EFFECTS__ */
2391
+ function _toLowerCase() {
2392
+ return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
2393
+ }
2394
+ /* @__NO_SIDE_EFFECTS__ */
2395
+ function _toUpperCase() {
2396
+ return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
2397
+ }
2398
+ /* @__NO_SIDE_EFFECTS__ */
2399
+ function _slugify() {
2400
+ return /* @__PURE__ */ _overwrite((input) => slugify(input));
2401
+ }
2402
+ /* @__NO_SIDE_EFFECTS__ */
2403
+ function _array(Class, element, params) {
2404
+ return new Class({
2405
+ type: "array",
2406
+ element,
2407
+ ...normalizeParams(params)
2408
+ });
2409
+ }
2410
+ /* @__NO_SIDE_EFFECTS__ */
2411
+ function _refine(Class, fn, _params) {
2412
+ return new Class({
2413
+ type: "custom",
2414
+ check: "custom",
2415
+ fn,
2416
+ ...normalizeParams(_params)
2417
+ });
2418
+ }
2419
+ /* @__NO_SIDE_EFFECTS__ */
2420
+ function _superRefine(fn) {
2421
+ const ch = /* @__PURE__ */ _check((payload) => {
2422
+ payload.addIssue = (issue$2) => {
2423
+ if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
2424
+ else {
2425
+ const _issue = issue$2;
2426
+ if (_issue.fatal) _issue.continue = false;
2427
+ _issue.code ?? (_issue.code = "custom");
2428
+ _issue.input ?? (_issue.input = payload.value);
2429
+ _issue.inst ?? (_issue.inst = ch);
2430
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2431
+ payload.issues.push(issue(_issue));
2432
+ }
2433
+ };
2434
+ return fn(payload.value, payload);
2435
+ });
2436
+ return ch;
2437
+ }
2438
+ /* @__NO_SIDE_EFFECTS__ */
2439
+ function _check(fn, params) {
2440
+ const ch = new $ZodCheck({
2441
+ check: "custom",
2442
+ ...normalizeParams(params)
2443
+ });
2444
+ ch._zod.check = fn;
2445
+ return ch;
2446
+ }
2447
+ /* @__NO_SIDE_EFFECTS__ */
2448
+ function describe$1(description) {
2449
+ const ch = new $ZodCheck({ check: "describe" });
2450
+ ch._zod.onattach = [(inst) => {
2451
+ const existing = globalRegistry.get(inst) ?? {};
2452
+ globalRegistry.add(inst, {
2453
+ ...existing,
2454
+ description
2455
+ });
2456
+ }];
2457
+ ch._zod.check = () => {};
2458
+ return ch;
2459
+ }
2460
+ /* @__NO_SIDE_EFFECTS__ */
2461
+ function meta$1(metadata) {
2462
+ const ch = new $ZodCheck({ check: "meta" });
2463
+ ch._zod.onattach = [(inst) => {
2464
+ const existing = globalRegistry.get(inst) ?? {};
2465
+ globalRegistry.add(inst, {
2466
+ ...existing,
2467
+ ...metadata
2468
+ });
2469
+ }];
2470
+ ch._zod.check = () => {};
2471
+ return ch;
2472
+ }
2473
+
2474
+ //#endregion
2475
+ //#region node_modules/zod/v4/core/to-json-schema.js
2476
+ function initializeContext(params) {
2477
+ let target = params?.target ?? "draft-2020-12";
2478
+ if (target === "draft-4") target = "draft-04";
2479
+ if (target === "draft-7") target = "draft-07";
2480
+ return {
2481
+ processors: params.processors ?? {},
2482
+ metadataRegistry: params?.metadata ?? globalRegistry,
2483
+ target,
2484
+ unrepresentable: params?.unrepresentable ?? "throw",
2485
+ override: params?.override ?? (() => {}),
2486
+ io: params?.io ?? "output",
2487
+ counter: 0,
2488
+ seen: /* @__PURE__ */ new Map(),
2489
+ cycles: params?.cycles ?? "ref",
2490
+ reused: params?.reused ?? "inline",
2491
+ external: params?.external ?? void 0
2492
+ };
2493
+ }
2494
+ function process$1(schema, ctx, _params = {
2495
+ path: [],
2496
+ schemaPath: []
2497
+ }) {
2498
+ var _a;
2499
+ const def = schema._zod.def;
2500
+ const seen = ctx.seen.get(schema);
2501
+ if (seen) {
2502
+ seen.count++;
2503
+ if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
2504
+ return seen.schema;
2505
+ }
2506
+ const result = {
2507
+ schema: {},
2508
+ count: 1,
2509
+ cycle: void 0,
2510
+ path: _params.path
2511
+ };
2512
+ ctx.seen.set(schema, result);
2513
+ const overrideSchema = schema._zod.toJSONSchema?.();
2514
+ if (overrideSchema) result.schema = overrideSchema;
2515
+ else {
2516
+ const params = {
2517
+ ..._params,
2518
+ schemaPath: [..._params.schemaPath, schema],
2519
+ path: _params.path
2520
+ };
2521
+ if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
2522
+ else {
2523
+ const _json = result.schema;
2524
+ const processor = ctx.processors[def.type];
2525
+ if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
2526
+ processor(schema, ctx, _json, params);
2527
+ }
2528
+ const parent = schema._zod.parent;
2529
+ if (parent) {
2530
+ if (!result.ref) result.ref = parent;
2531
+ process$1(parent, ctx, params);
2532
+ ctx.seen.get(parent).isParent = true;
2533
+ }
2534
+ }
2535
+ const meta = ctx.metadataRegistry.get(schema);
2536
+ if (meta) Object.assign(result.schema, meta);
2537
+ if (ctx.io === "input" && isTransforming(schema)) {
2538
+ delete result.schema.examples;
2539
+ delete result.schema.default;
2540
+ }
2541
+ if (ctx.io === "input" && result.schema._prefault) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
2542
+ delete result.schema._prefault;
2543
+ return ctx.seen.get(schema).schema;
2544
+ }
2545
+ function extractDefs(ctx, schema) {
2546
+ const root = ctx.seen.get(schema);
2547
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
2548
+ const idToSchema = /* @__PURE__ */ new Map();
2549
+ for (const entry of ctx.seen.entries()) {
2550
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
2551
+ if (id) {
2552
+ const existing = idToSchema.get(id);
2553
+ if (existing && existing !== entry[0]) throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
2554
+ idToSchema.set(id, entry[0]);
2555
+ }
2556
+ }
2557
+ const makeURI = (entry) => {
2558
+ const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
2559
+ if (ctx.external) {
2560
+ const externalId = ctx.external.registry.get(entry[0])?.id;
2561
+ const uriGenerator = ctx.external.uri ?? ((id) => id);
2562
+ if (externalId) return { ref: uriGenerator(externalId) };
2563
+ const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
2564
+ entry[1].defId = id;
2565
+ return {
2566
+ defId: id,
2567
+ ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
2568
+ };
2569
+ }
2570
+ if (entry[1] === root) return { ref: "#" };
2571
+ const defUriPrefix = `#/${defsSegment}/`;
2572
+ const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
2573
+ return {
2574
+ defId,
2575
+ ref: defUriPrefix + defId
2576
+ };
2577
+ };
2578
+ const extractToDef = (entry) => {
2579
+ if (entry[1].schema.$ref) return;
2580
+ const seen = entry[1];
2581
+ const { ref, defId } = makeURI(entry);
2582
+ seen.def = { ...seen.schema };
2583
+ if (defId) seen.defId = defId;
2584
+ const schema = seen.schema;
2585
+ for (const key in schema) delete schema[key];
2586
+ schema.$ref = ref;
2587
+ };
2588
+ if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
2589
+ const seen = entry[1];
2590
+ if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
2591
+
2592
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
2593
+ }
2594
+ for (const entry of ctx.seen.entries()) {
2595
+ const seen = entry[1];
2596
+ if (schema === entry[0]) {
2597
+ extractToDef(entry);
2598
+ continue;
2599
+ }
2600
+ if (ctx.external) {
2601
+ const ext = ctx.external.registry.get(entry[0])?.id;
2602
+ if (schema !== entry[0] && ext) {
2603
+ extractToDef(entry);
2604
+ continue;
2605
+ }
2606
+ }
2607
+ if (ctx.metadataRegistry.get(entry[0])?.id) {
2608
+ extractToDef(entry);
2609
+ continue;
2610
+ }
2611
+ if (seen.cycle) {
2612
+ extractToDef(entry);
2613
+ continue;
2614
+ }
2615
+ if (seen.count > 1) {
2616
+ if (ctx.reused === "ref") {
2617
+ extractToDef(entry);
2618
+ continue;
2619
+ }
2620
+ }
2621
+ }
2622
+ }
2623
+ function finalize(ctx, schema) {
2624
+ const root = ctx.seen.get(schema);
2625
+ if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
2626
+ const flattenRef = (zodSchema) => {
2627
+ const seen = ctx.seen.get(zodSchema);
2628
+ if (seen.ref === null) return;
2629
+ const schema = seen.def ?? seen.schema;
2630
+ const _cached = { ...schema };
2631
+ const ref = seen.ref;
2632
+ seen.ref = null;
2633
+ if (ref) {
2634
+ flattenRef(ref);
2635
+ const refSeen = ctx.seen.get(ref);
2636
+ const refSchema = refSeen.schema;
2637
+ if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
2638
+ schema.allOf = schema.allOf ?? [];
2639
+ schema.allOf.push(refSchema);
2640
+ } else Object.assign(schema, refSchema);
2641
+ Object.assign(schema, _cached);
2642
+ if (zodSchema._zod.parent === ref) for (const key in schema) {
2643
+ if (key === "$ref" || key === "allOf") continue;
2644
+ if (!(key in _cached)) delete schema[key];
2645
+ }
2646
+ if (refSchema.$ref && refSeen.def) for (const key in schema) {
2647
+ if (key === "$ref" || key === "allOf") continue;
2648
+ if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
2649
+ }
2650
+ }
2651
+ const parent = zodSchema._zod.parent;
2652
+ if (parent && parent !== ref) {
2653
+ flattenRef(parent);
2654
+ const parentSeen = ctx.seen.get(parent);
2655
+ if (parentSeen?.schema.$ref) {
2656
+ schema.$ref = parentSeen.schema.$ref;
2657
+ if (parentSeen.def) for (const key in schema) {
2658
+ if (key === "$ref" || key === "allOf") continue;
2659
+ if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
2660
+ }
2661
+ }
2662
+ }
2663
+ ctx.override({
2664
+ zodSchema,
2665
+ jsonSchema: schema,
2666
+ path: seen.path ?? []
2667
+ });
2668
+ };
2669
+ for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
2670
+ const result = {};
2671
+ if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
2672
+ else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
2673
+ else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
2674
+ else if (ctx.target === "openapi-3.0") {}
2675
+ if (ctx.external?.uri) {
2676
+ const id = ctx.external.registry.get(schema)?.id;
2677
+ if (!id) throw new Error("Schema is missing an `id` property");
2678
+ result.$id = ctx.external.uri(id);
2679
+ }
2680
+ Object.assign(result, root.def ?? root.schema);
2681
+ const defs = ctx.external?.defs ?? {};
2682
+ for (const entry of ctx.seen.entries()) {
2683
+ const seen = entry[1];
2684
+ if (seen.def && seen.defId) defs[seen.defId] = seen.def;
2685
+ }
2686
+ if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
2687
+ else result.definitions = defs;
2688
+ try {
2689
+ const finalized = JSON.parse(JSON.stringify(result));
2690
+ Object.defineProperty(finalized, "~standard", {
2691
+ value: {
2692
+ ...schema["~standard"],
2693
+ jsonSchema: {
2694
+ input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
2695
+ output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
2696
+ }
2697
+ },
2698
+ enumerable: false,
2699
+ writable: false
2700
+ });
2701
+ return finalized;
2702
+ } catch (_err) {
2703
+ throw new Error("Error converting schema to JSON.");
2704
+ }
2705
+ }
2706
+ function isTransforming(_schema, _ctx) {
2707
+ const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
2708
+ if (ctx.seen.has(_schema)) return false;
2709
+ ctx.seen.add(_schema);
2710
+ const def = _schema._zod.def;
2711
+ if (def.type === "transform") return true;
2712
+ if (def.type === "array") return isTransforming(def.element, ctx);
2713
+ if (def.type === "set") return isTransforming(def.valueType, ctx);
2714
+ if (def.type === "lazy") return isTransforming(def.getter(), ctx);
2715
+ if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
2716
+ if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
2717
+ if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
2718
+ if (def.type === "pipe") return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
2719
+ if (def.type === "object") {
2720
+ for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
2721
+ return false;
2722
+ }
2723
+ if (def.type === "union") {
2724
+ for (const option of def.options) if (isTransforming(option, ctx)) return true;
2725
+ return false;
2726
+ }
2727
+ if (def.type === "tuple") {
2728
+ for (const item of def.items) if (isTransforming(item, ctx)) return true;
2729
+ if (def.rest && isTransforming(def.rest, ctx)) return true;
2730
+ return false;
2731
+ }
2732
+ return false;
2733
+ }
2734
+ /**
2735
+ * Creates a toJSONSchema method for a schema instance.
2736
+ * This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
2737
+ */
2738
+ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
2739
+ const ctx = initializeContext({
2740
+ ...params,
2741
+ processors
2742
+ });
2743
+ process$1(schema, ctx);
2744
+ extractDefs(ctx, schema);
2745
+ return finalize(ctx, schema);
2746
+ };
2747
+ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
2748
+ const { libraryOptions, target } = params ?? {};
2749
+ const ctx = initializeContext({
2750
+ ...libraryOptions ?? {},
2751
+ target,
2752
+ io,
2753
+ processors
2754
+ });
2755
+ process$1(schema, ctx);
2756
+ extractDefs(ctx, schema);
2757
+ return finalize(ctx, schema);
2758
+ };
2759
+
2760
+ //#endregion
2761
+ //#region node_modules/zod/v4/core/json-schema-processors.js
2762
+ const formatMap = {
2763
+ guid: "uuid",
2764
+ url: "uri",
2765
+ datetime: "date-time",
2766
+ json_string: "json-string",
2767
+ regex: ""
2768
+ };
2769
+ const stringProcessor = (schema, ctx, _json, _params) => {
2770
+ const json = _json;
2771
+ json.type = "string";
2772
+ const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
2773
+ if (typeof minimum === "number") json.minLength = minimum;
2774
+ if (typeof maximum === "number") json.maxLength = maximum;
2775
+ if (format) {
2776
+ json.format = formatMap[format] ?? format;
2777
+ if (json.format === "") delete json.format;
2778
+ if (format === "time") delete json.format;
2779
+ }
2780
+ if (contentEncoding) json.contentEncoding = contentEncoding;
2781
+ if (patterns && patterns.size > 0) {
2782
+ const regexes = [...patterns];
2783
+ if (regexes.length === 1) json.pattern = regexes[0].source;
2784
+ else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
2785
+ ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
2786
+ pattern: regex.source
2787
+ }))];
2788
+ }
2789
+ };
2790
+ const booleanProcessor = (_schema, _ctx, json, _params) => {
2791
+ json.type = "boolean";
2792
+ };
2793
+ const neverProcessor = (_schema, _ctx, json, _params) => {
2794
+ json.not = {};
2795
+ };
2796
+ const unknownProcessor = (_schema, _ctx, _json, _params) => {};
2797
+ const enumProcessor = (schema, _ctx, json, _params) => {
2798
+ const def = schema._zod.def;
2799
+ const values = getEnumValues(def.entries);
2800
+ if (values.every((v) => typeof v === "number")) json.type = "number";
2801
+ if (values.every((v) => typeof v === "string")) json.type = "string";
2802
+ json.enum = values;
2803
+ };
2804
+ const customProcessor = (_schema, ctx, _json, _params) => {
2805
+ if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
2806
+ };
2807
+ const transformProcessor = (_schema, ctx, _json, _params) => {
2808
+ if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
2809
+ };
2810
+ const arrayProcessor = (schema, ctx, _json, params) => {
2811
+ const json = _json;
2812
+ const def = schema._zod.def;
2813
+ const { minimum, maximum } = schema._zod.bag;
2814
+ if (typeof minimum === "number") json.minItems = minimum;
2815
+ if (typeof maximum === "number") json.maxItems = maximum;
2816
+ json.type = "array";
2817
+ json.items = process$1(def.element, ctx, {
2818
+ ...params,
2819
+ path: [...params.path, "items"]
2820
+ });
2821
+ };
2822
+ const objectProcessor = (schema, ctx, _json, params) => {
2823
+ const json = _json;
2824
+ const def = schema._zod.def;
2825
+ json.type = "object";
2826
+ json.properties = {};
2827
+ const shape = def.shape;
2828
+ for (const key in shape) json.properties[key] = process$1(shape[key], ctx, {
2829
+ ...params,
2830
+ path: [
2831
+ ...params.path,
2832
+ "properties",
2833
+ key
2834
+ ]
2835
+ });
2836
+ const allKeys = new Set(Object.keys(shape));
2837
+ const requiredKeys = new Set([...allKeys].filter((key) => {
2838
+ const v = def.shape[key]._zod;
2839
+ if (ctx.io === "input") return v.optin === void 0;
2840
+ else return v.optout === void 0;
2841
+ }));
2842
+ if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
2843
+ if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
2844
+ else if (!def.catchall) {
2845
+ if (ctx.io === "output") json.additionalProperties = false;
2846
+ } else if (def.catchall) json.additionalProperties = process$1(def.catchall, ctx, {
2847
+ ...params,
2848
+ path: [...params.path, "additionalProperties"]
2849
+ });
2850
+ };
2851
+ const unionProcessor = (schema, ctx, json, params) => {
2852
+ const def = schema._zod.def;
2853
+ const isExclusive = def.inclusive === false;
2854
+ const options = def.options.map((x, i) => process$1(x, ctx, {
2855
+ ...params,
2856
+ path: [
2857
+ ...params.path,
2858
+ isExclusive ? "oneOf" : "anyOf",
2859
+ i
2860
+ ]
2861
+ }));
2862
+ if (isExclusive) json.oneOf = options;
2863
+ else json.anyOf = options;
2864
+ };
2865
+ const intersectionProcessor = (schema, ctx, json, params) => {
2866
+ const def = schema._zod.def;
2867
+ const a = process$1(def.left, ctx, {
2868
+ ...params,
2869
+ path: [
2870
+ ...params.path,
2871
+ "allOf",
2872
+ 0
2873
+ ]
2874
+ });
2875
+ const b = process$1(def.right, ctx, {
2876
+ ...params,
2877
+ path: [
2878
+ ...params.path,
2879
+ "allOf",
2880
+ 1
2881
+ ]
2882
+ });
2883
+ const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
2884
+ json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
2885
+ };
2886
+ const recordProcessor = (schema, ctx, _json, params) => {
2887
+ const json = _json;
2888
+ const def = schema._zod.def;
2889
+ json.type = "object";
2890
+ const keyType = def.keyType;
2891
+ const patterns = keyType._zod.bag?.patterns;
2892
+ if (def.mode === "loose" && patterns && patterns.size > 0) {
2893
+ const valueSchema = process$1(def.valueType, ctx, {
2894
+ ...params,
2895
+ path: [
2896
+ ...params.path,
2897
+ "patternProperties",
2898
+ "*"
2899
+ ]
2900
+ });
2901
+ json.patternProperties = {};
2902
+ for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
2903
+ } else {
2904
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$1(def.keyType, ctx, {
2905
+ ...params,
2906
+ path: [...params.path, "propertyNames"]
2907
+ });
2908
+ json.additionalProperties = process$1(def.valueType, ctx, {
2909
+ ...params,
2910
+ path: [...params.path, "additionalProperties"]
2911
+ });
2912
+ }
2913
+ const keyValues = keyType._zod.values;
2914
+ if (keyValues) {
2915
+ const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
2916
+ if (validKeyValues.length > 0) json.required = validKeyValues;
2917
+ }
2918
+ };
2919
+ const nullableProcessor = (schema, ctx, json, params) => {
2920
+ const def = schema._zod.def;
2921
+ const inner = process$1(def.innerType, ctx, params);
2922
+ const seen = ctx.seen.get(schema);
2923
+ if (ctx.target === "openapi-3.0") {
2924
+ seen.ref = def.innerType;
2925
+ json.nullable = true;
2926
+ } else json.anyOf = [inner, { type: "null" }];
2927
+ };
2928
+ const nonoptionalProcessor = (schema, ctx, _json, params) => {
2929
+ const def = schema._zod.def;
2930
+ process$1(def.innerType, ctx, params);
2931
+ const seen = ctx.seen.get(schema);
2932
+ seen.ref = def.innerType;
2933
+ };
2934
+ const defaultProcessor = (schema, ctx, json, params) => {
2935
+ const def = schema._zod.def;
2936
+ process$1(def.innerType, ctx, params);
2937
+ const seen = ctx.seen.get(schema);
2938
+ seen.ref = def.innerType;
2939
+ json.default = JSON.parse(JSON.stringify(def.defaultValue));
2940
+ };
2941
+ const prefaultProcessor = (schema, ctx, json, params) => {
2942
+ const def = schema._zod.def;
2943
+ process$1(def.innerType, ctx, params);
2944
+ const seen = ctx.seen.get(schema);
2945
+ seen.ref = def.innerType;
2946
+ if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
2947
+ };
2948
+ const catchProcessor = (schema, ctx, json, params) => {
2949
+ const def = schema._zod.def;
2950
+ process$1(def.innerType, ctx, params);
2951
+ const seen = ctx.seen.get(schema);
2952
+ seen.ref = def.innerType;
2953
+ let catchValue;
2954
+ try {
2955
+ catchValue = def.catchValue(void 0);
2956
+ } catch {
2957
+ throw new Error("Dynamic catch values are not supported in JSON Schema");
2958
+ }
2959
+ json.default = catchValue;
2960
+ };
2961
+ const pipeProcessor = (schema, ctx, _json, params) => {
2962
+ const def = schema._zod.def;
2963
+ const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
2964
+ process$1(innerType, ctx, params);
2965
+ const seen = ctx.seen.get(schema);
2966
+ seen.ref = innerType;
2967
+ };
2968
+ const readonlyProcessor = (schema, ctx, json, params) => {
2969
+ const def = schema._zod.def;
2970
+ process$1(def.innerType, ctx, params);
2971
+ const seen = ctx.seen.get(schema);
2972
+ seen.ref = def.innerType;
2973
+ json.readOnly = true;
2974
+ };
2975
+ const optionalProcessor = (schema, ctx, _json, params) => {
2976
+ const def = schema._zod.def;
2977
+ process$1(def.innerType, ctx, params);
2978
+ const seen = ctx.seen.get(schema);
2979
+ seen.ref = def.innerType;
2980
+ };
2981
+
2982
+ //#endregion
2983
+ //#region node_modules/zod/v4/classic/iso.js
2984
+ const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
2985
+ $ZodISODateTime.init(inst, def);
2986
+ ZodStringFormat.init(inst, def);
2987
+ });
2988
+ function datetime(params) {
2989
+ return _isoDateTime(ZodISODateTime, params);
2990
+ }
2991
+ const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
2992
+ $ZodISODate.init(inst, def);
2993
+ ZodStringFormat.init(inst, def);
2994
+ });
2995
+ function date(params) {
2996
+ return _isoDate(ZodISODate, params);
2997
+ }
2998
+ const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
2999
+ $ZodISOTime.init(inst, def);
3000
+ ZodStringFormat.init(inst, def);
3001
+ });
3002
+ function time(params) {
3003
+ return _isoTime(ZodISOTime, params);
3004
+ }
3005
+ const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
3006
+ $ZodISODuration.init(inst, def);
3007
+ ZodStringFormat.init(inst, def);
3008
+ });
3009
+ function duration(params) {
3010
+ return _isoDuration(ZodISODuration, params);
3011
+ }
3012
+
3013
+ //#endregion
3014
+ //#region node_modules/zod/v4/classic/errors.js
3015
+ const initializer = (inst, issues) => {
3016
+ $ZodError.init(inst, issues);
3017
+ inst.name = "ZodError";
3018
+ Object.defineProperties(inst, {
3019
+ format: { value: (mapper) => formatError(inst, mapper) },
3020
+ flatten: { value: (mapper) => flattenError(inst, mapper) },
3021
+ addIssue: { value: (issue) => {
3022
+ inst.issues.push(issue);
3023
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3024
+ } },
3025
+ addIssues: { value: (issues) => {
3026
+ inst.issues.push(...issues);
3027
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3028
+ } },
3029
+ isEmpty: { get() {
3030
+ return inst.issues.length === 0;
3031
+ } }
3032
+ });
3033
+ };
3034
+ const ZodError = $constructor("ZodError", initializer);
3035
+ const ZodRealError = $constructor("ZodError", initializer, { Parent: Error });
3036
+
3037
+ //#endregion
3038
+ //#region node_modules/zod/v4/classic/parse.js
3039
+ const parse = /* @__PURE__ */ _parse(ZodRealError);
3040
+ const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3041
+ const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
3042
+ const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
3043
+ const encode = /* @__PURE__ */ _encode(ZodRealError);
3044
+ const decode = /* @__PURE__ */ _decode(ZodRealError);
3045
+ const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
3046
+ const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
3047
+ const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
3048
+ const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
3049
+ const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3050
+ const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3051
+
3052
+ //#endregion
3053
+ //#region node_modules/zod/v4/classic/schemas.js
3054
+ const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
3055
+ $ZodType.init(inst, def);
3056
+ Object.assign(inst["~standard"], { jsonSchema: {
3057
+ input: createStandardJSONSchemaMethod(inst, "input"),
3058
+ output: createStandardJSONSchemaMethod(inst, "output")
3059
+ } });
3060
+ inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
3061
+ inst.def = def;
3062
+ inst.type = def.type;
3063
+ Object.defineProperty(inst, "_def", { value: def });
3064
+ inst.check = (...checks) => {
3065
+ return inst.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...checks.map((ch) => typeof ch === "function" ? { _zod: {
3066
+ check: ch,
3067
+ def: { check: "custom" },
3068
+ onattach: []
3069
+ } } : ch)] }), { parent: true });
3070
+ };
3071
+ inst.with = inst.check;
3072
+ inst.clone = (def, params) => clone(inst, def, params);
3073
+ inst.brand = () => inst;
3074
+ inst.register = ((reg, meta) => {
3075
+ reg.add(inst, meta);
3076
+ return inst;
3077
+ });
3078
+ inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
3079
+ inst.safeParse = (data, params) => safeParse(inst, data, params);
3080
+ inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
3081
+ inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
3082
+ inst.spa = inst.safeParseAsync;
3083
+ inst.encode = (data, params) => encode(inst, data, params);
3084
+ inst.decode = (data, params) => decode(inst, data, params);
3085
+ inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
3086
+ inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
3087
+ inst.safeEncode = (data, params) => safeEncode(inst, data, params);
3088
+ inst.safeDecode = (data, params) => safeDecode(inst, data, params);
3089
+ inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
3090
+ inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
3091
+ inst.refine = (check, params) => inst.check(refine(check, params));
3092
+ inst.superRefine = (refinement) => inst.check(superRefine(refinement));
3093
+ inst.overwrite = (fn) => inst.check(_overwrite(fn));
3094
+ inst.optional = () => optional(inst);
3095
+ inst.exactOptional = () => exactOptional(inst);
3096
+ inst.nullable = () => nullable(inst);
3097
+ inst.nullish = () => optional(nullable(inst));
3098
+ inst.nonoptional = (params) => nonoptional(inst, params);
3099
+ inst.array = () => array(inst);
3100
+ inst.or = (arg) => union([inst, arg]);
3101
+ inst.and = (arg) => intersection(inst, arg);
3102
+ inst.transform = (tx) => pipe(inst, transform(tx));
3103
+ inst.default = (def) => _default(inst, def);
3104
+ inst.prefault = (def) => prefault(inst, def);
3105
+ inst.catch = (params) => _catch(inst, params);
3106
+ inst.pipe = (target) => pipe(inst, target);
3107
+ inst.readonly = () => readonly(inst);
3108
+ inst.describe = (description) => {
3109
+ const cl = inst.clone();
3110
+ globalRegistry.add(cl, { description });
3111
+ return cl;
3112
+ };
3113
+ Object.defineProperty(inst, "description", {
3114
+ get() {
3115
+ return globalRegistry.get(inst)?.description;
3116
+ },
3117
+ configurable: true
3118
+ });
3119
+ inst.meta = (...args) => {
3120
+ if (args.length === 0) return globalRegistry.get(inst);
3121
+ const cl = inst.clone();
3122
+ globalRegistry.add(cl, args[0]);
3123
+ return cl;
3124
+ };
3125
+ inst.isOptional = () => inst.safeParse(void 0).success;
3126
+ inst.isNullable = () => inst.safeParse(null).success;
3127
+ inst.apply = (fn) => fn(inst);
3128
+ return inst;
3129
+ });
3130
+ /** @internal */
3131
+ const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
3132
+ $ZodString.init(inst, def);
3133
+ ZodType.init(inst, def);
3134
+ inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
3135
+ const bag = inst._zod.bag;
3136
+ inst.format = bag.format ?? null;
3137
+ inst.minLength = bag.minimum ?? null;
3138
+ inst.maxLength = bag.maximum ?? null;
3139
+ inst.regex = (...args) => inst.check(_regex(...args));
3140
+ inst.includes = (...args) => inst.check(_includes(...args));
3141
+ inst.startsWith = (...args) => inst.check(_startsWith(...args));
3142
+ inst.endsWith = (...args) => inst.check(_endsWith(...args));
3143
+ inst.min = (...args) => inst.check(_minLength(...args));
3144
+ inst.max = (...args) => inst.check(_maxLength(...args));
3145
+ inst.length = (...args) => inst.check(_length(...args));
3146
+ inst.nonempty = (...args) => inst.check(_minLength(1, ...args));
3147
+ inst.lowercase = (params) => inst.check(_lowercase(params));
3148
+ inst.uppercase = (params) => inst.check(_uppercase(params));
3149
+ inst.trim = () => inst.check(_trim());
3150
+ inst.normalize = (...args) => inst.check(_normalize(...args));
3151
+ inst.toLowerCase = () => inst.check(_toLowerCase());
3152
+ inst.toUpperCase = () => inst.check(_toUpperCase());
3153
+ inst.slugify = () => inst.check(_slugify());
3154
+ });
3155
+ const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
3156
+ $ZodString.init(inst, def);
3157
+ _ZodString.init(inst, def);
3158
+ inst.email = (params) => inst.check(_email(ZodEmail, params));
3159
+ inst.url = (params) => inst.check(_url(ZodURL, params));
3160
+ inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
3161
+ inst.emoji = (params) => inst.check(_emoji(ZodEmoji, params));
3162
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
3163
+ inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
3164
+ inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
3165
+ inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
3166
+ inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
3167
+ inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
3168
+ inst.guid = (params) => inst.check(_guid(ZodGUID, params));
3169
+ inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
3170
+ inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
3171
+ inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
3172
+ inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
3173
+ inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
3174
+ inst.xid = (params) => inst.check(_xid(ZodXID, params));
3175
+ inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
3176
+ inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
3177
+ inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
3178
+ inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
3179
+ inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
3180
+ inst.e164 = (params) => inst.check(_e164(ZodE164, params));
3181
+ inst.datetime = (params) => inst.check(datetime(params));
3182
+ inst.date = (params) => inst.check(date(params));
3183
+ inst.time = (params) => inst.check(time(params));
3184
+ inst.duration = (params) => inst.check(duration(params));
3185
+ });
3186
+ function string(params) {
3187
+ return _string(ZodString, params);
3188
+ }
3189
+ const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
3190
+ $ZodStringFormat.init(inst, def);
3191
+ _ZodString.init(inst, def);
3192
+ });
3193
+ const ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
3194
+ $ZodEmail.init(inst, def);
3195
+ ZodStringFormat.init(inst, def);
3196
+ });
3197
+ const ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
3198
+ $ZodGUID.init(inst, def);
3199
+ ZodStringFormat.init(inst, def);
3200
+ });
3201
+ const ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
3202
+ $ZodUUID.init(inst, def);
3203
+ ZodStringFormat.init(inst, def);
3204
+ });
3205
+ const ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
3206
+ $ZodURL.init(inst, def);
3207
+ ZodStringFormat.init(inst, def);
3208
+ });
3209
+ const ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
3210
+ $ZodEmoji.init(inst, def);
3211
+ ZodStringFormat.init(inst, def);
3212
+ });
3213
+ const ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
3214
+ $ZodNanoID.init(inst, def);
3215
+ ZodStringFormat.init(inst, def);
3216
+ });
3217
+ const ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
3218
+ $ZodCUID.init(inst, def);
3219
+ ZodStringFormat.init(inst, def);
3220
+ });
3221
+ const ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
3222
+ $ZodCUID2.init(inst, def);
3223
+ ZodStringFormat.init(inst, def);
3224
+ });
3225
+ const ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
3226
+ $ZodULID.init(inst, def);
3227
+ ZodStringFormat.init(inst, def);
3228
+ });
3229
+ const ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
3230
+ $ZodXID.init(inst, def);
3231
+ ZodStringFormat.init(inst, def);
3232
+ });
3233
+ const ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
3234
+ $ZodKSUID.init(inst, def);
3235
+ ZodStringFormat.init(inst, def);
3236
+ });
3237
+ const ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
3238
+ $ZodIPv4.init(inst, def);
3239
+ ZodStringFormat.init(inst, def);
3240
+ });
3241
+ const ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
3242
+ $ZodIPv6.init(inst, def);
3243
+ ZodStringFormat.init(inst, def);
3244
+ });
3245
+ const ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
3246
+ $ZodCIDRv4.init(inst, def);
3247
+ ZodStringFormat.init(inst, def);
3248
+ });
3249
+ const ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
3250
+ $ZodCIDRv6.init(inst, def);
3251
+ ZodStringFormat.init(inst, def);
3252
+ });
3253
+ const ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
3254
+ $ZodBase64.init(inst, def);
3255
+ ZodStringFormat.init(inst, def);
3256
+ });
3257
+ const ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
3258
+ $ZodBase64URL.init(inst, def);
3259
+ ZodStringFormat.init(inst, def);
3260
+ });
3261
+ const ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
3262
+ $ZodE164.init(inst, def);
3263
+ ZodStringFormat.init(inst, def);
3264
+ });
3265
+ const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
3266
+ $ZodJWT.init(inst, def);
3267
+ ZodStringFormat.init(inst, def);
3268
+ });
3269
+ const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
3270
+ $ZodBoolean.init(inst, def);
3271
+ ZodType.init(inst, def);
3272
+ inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
3273
+ });
3274
+ function boolean(params) {
3275
+ return _boolean(ZodBoolean, params);
3276
+ }
3277
+ const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
3278
+ $ZodUnknown.init(inst, def);
3279
+ ZodType.init(inst, def);
3280
+ inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
3281
+ });
3282
+ function unknown() {
3283
+ return _unknown(ZodUnknown);
3284
+ }
3285
+ const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
3286
+ $ZodNever.init(inst, def);
3287
+ ZodType.init(inst, def);
3288
+ inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
3289
+ });
3290
+ function never(params) {
3291
+ return _never(ZodNever, params);
3292
+ }
3293
+ const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
3294
+ $ZodArray.init(inst, def);
3295
+ ZodType.init(inst, def);
3296
+ inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
3297
+ inst.element = def.element;
3298
+ inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
3299
+ inst.nonempty = (params) => inst.check(_minLength(1, params));
3300
+ inst.max = (maxLength, params) => inst.check(_maxLength(maxLength, params));
3301
+ inst.length = (len, params) => inst.check(_length(len, params));
3302
+ inst.unwrap = () => inst.element;
3303
+ });
3304
+ function array(element, params) {
3305
+ return _array(ZodArray, element, params);
3306
+ }
3307
+ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
3308
+ $ZodObjectJIT.init(inst, def);
3309
+ ZodType.init(inst, def);
3310
+ inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
3311
+ defineLazy(inst, "shape", () => {
3312
+ return def.shape;
3313
+ });
3314
+ inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
3315
+ inst.catchall = (catchall) => inst.clone({
3316
+ ...inst._zod.def,
3317
+ catchall
3318
+ });
3319
+ inst.passthrough = () => inst.clone({
3320
+ ...inst._zod.def,
3321
+ catchall: unknown()
3322
+ });
3323
+ inst.loose = () => inst.clone({
3324
+ ...inst._zod.def,
3325
+ catchall: unknown()
3326
+ });
3327
+ inst.strict = () => inst.clone({
3328
+ ...inst._zod.def,
3329
+ catchall: never()
3330
+ });
3331
+ inst.strip = () => inst.clone({
3332
+ ...inst._zod.def,
3333
+ catchall: void 0
3334
+ });
3335
+ inst.extend = (incoming) => {
3336
+ return extend(inst, incoming);
3337
+ };
3338
+ inst.safeExtend = (incoming) => {
3339
+ return safeExtend(inst, incoming);
3340
+ };
3341
+ inst.merge = (other) => merge(inst, other);
3342
+ inst.pick = (mask) => pick(inst, mask);
3343
+ inst.omit = (mask) => omit(inst, mask);
3344
+ inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
3345
+ inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
3346
+ });
3347
+ function object(shape, params) {
3348
+ return new ZodObject({
3349
+ type: "object",
3350
+ shape: shape ?? {},
3351
+ ...normalizeParams(params)
3352
+ });
3353
+ }
3354
+ const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
3355
+ $ZodUnion.init(inst, def);
3356
+ ZodType.init(inst, def);
3357
+ inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
3358
+ inst.options = def.options;
3359
+ });
3360
+ function union(options, params) {
3361
+ return new ZodUnion({
3362
+ type: "union",
3363
+ options,
3364
+ ...normalizeParams(params)
3365
+ });
3366
+ }
3367
+ const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
3368
+ $ZodIntersection.init(inst, def);
3369
+ ZodType.init(inst, def);
3370
+ inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
3371
+ });
3372
+ function intersection(left, right) {
3373
+ return new ZodIntersection({
3374
+ type: "intersection",
3375
+ left,
3376
+ right
3377
+ });
3378
+ }
3379
+ const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
3380
+ $ZodRecord.init(inst, def);
3381
+ ZodType.init(inst, def);
3382
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
3383
+ inst.keyType = def.keyType;
3384
+ inst.valueType = def.valueType;
3385
+ });
3386
+ function record(keyType, valueType, params) {
3387
+ return new ZodRecord({
3388
+ type: "record",
3389
+ keyType,
3390
+ valueType,
3391
+ ...normalizeParams(params)
3392
+ });
3393
+ }
3394
+ const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
3395
+ $ZodEnum.init(inst, def);
3396
+ ZodType.init(inst, def);
3397
+ inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
3398
+ inst.enum = def.entries;
3399
+ inst.options = Object.values(def.entries);
3400
+ const keys = new Set(Object.keys(def.entries));
3401
+ inst.extract = (values, params) => {
3402
+ const newEntries = {};
3403
+ for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
3404
+ else throw new Error(`Key ${value} not found in enum`);
3405
+ return new ZodEnum({
3406
+ ...def,
3407
+ checks: [],
3408
+ ...normalizeParams(params),
3409
+ entries: newEntries
3410
+ });
3411
+ };
3412
+ inst.exclude = (values, params) => {
3413
+ const newEntries = { ...def.entries };
3414
+ for (const value of values) if (keys.has(value)) delete newEntries[value];
3415
+ else throw new Error(`Key ${value} not found in enum`);
3416
+ return new ZodEnum({
3417
+ ...def,
3418
+ checks: [],
3419
+ ...normalizeParams(params),
3420
+ entries: newEntries
3421
+ });
3422
+ };
3423
+ });
3424
+ function _enum(values, params) {
3425
+ return new ZodEnum({
3426
+ type: "enum",
3427
+ entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
3428
+ ...normalizeParams(params)
3429
+ });
3430
+ }
3431
+ const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
3432
+ $ZodTransform.init(inst, def);
3433
+ ZodType.init(inst, def);
3434
+ inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
3435
+ inst._zod.parse = (payload, _ctx) => {
3436
+ if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
3437
+ payload.addIssue = (issue$1) => {
3438
+ if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
3439
+ else {
3440
+ const _issue = issue$1;
3441
+ if (_issue.fatal) _issue.continue = false;
3442
+ _issue.code ?? (_issue.code = "custom");
3443
+ _issue.input ?? (_issue.input = payload.value);
3444
+ _issue.inst ?? (_issue.inst = inst);
3445
+ payload.issues.push(issue(_issue));
3446
+ }
3447
+ };
3448
+ const output = def.transform(payload.value, payload);
3449
+ if (output instanceof Promise) return output.then((output) => {
3450
+ payload.value = output;
3451
+ return payload;
3452
+ });
3453
+ payload.value = output;
3454
+ return payload;
3455
+ };
3456
+ });
3457
+ function transform(fn) {
3458
+ return new ZodTransform({
3459
+ type: "transform",
3460
+ transform: fn
3461
+ });
3462
+ }
3463
+ const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
3464
+ $ZodOptional.init(inst, def);
3465
+ ZodType.init(inst, def);
3466
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
3467
+ inst.unwrap = () => inst._zod.def.innerType;
3468
+ });
3469
+ function optional(innerType) {
3470
+ return new ZodOptional({
3471
+ type: "optional",
3472
+ innerType
3473
+ });
3474
+ }
3475
+ const ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
3476
+ $ZodExactOptional.init(inst, def);
3477
+ ZodType.init(inst, def);
3478
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
3479
+ inst.unwrap = () => inst._zod.def.innerType;
3480
+ });
3481
+ function exactOptional(innerType) {
3482
+ return new ZodExactOptional({
3483
+ type: "optional",
3484
+ innerType
3485
+ });
3486
+ }
3487
+ const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
3488
+ $ZodNullable.init(inst, def);
3489
+ ZodType.init(inst, def);
3490
+ inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
3491
+ inst.unwrap = () => inst._zod.def.innerType;
3492
+ });
3493
+ function nullable(innerType) {
3494
+ return new ZodNullable({
3495
+ type: "nullable",
3496
+ innerType
3497
+ });
3498
+ }
3499
+ const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
3500
+ $ZodDefault.init(inst, def);
3501
+ ZodType.init(inst, def);
3502
+ inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
3503
+ inst.unwrap = () => inst._zod.def.innerType;
3504
+ inst.removeDefault = inst.unwrap;
3505
+ });
3506
+ function _default(innerType, defaultValue) {
3507
+ return new ZodDefault({
3508
+ type: "default",
3509
+ innerType,
3510
+ get defaultValue() {
3511
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
3512
+ }
3513
+ });
3514
+ }
3515
+ const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
3516
+ $ZodPrefault.init(inst, def);
3517
+ ZodType.init(inst, def);
3518
+ inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
3519
+ inst.unwrap = () => inst._zod.def.innerType;
3520
+ });
3521
+ function prefault(innerType, defaultValue) {
3522
+ return new ZodPrefault({
3523
+ type: "prefault",
3524
+ innerType,
3525
+ get defaultValue() {
3526
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
3527
+ }
3528
+ });
3529
+ }
3530
+ const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
3531
+ $ZodNonOptional.init(inst, def);
3532
+ ZodType.init(inst, def);
3533
+ inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
3534
+ inst.unwrap = () => inst._zod.def.innerType;
3535
+ });
3536
+ function nonoptional(innerType, params) {
3537
+ return new ZodNonOptional({
3538
+ type: "nonoptional",
3539
+ innerType,
3540
+ ...normalizeParams(params)
3541
+ });
3542
+ }
3543
+ const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
3544
+ $ZodCatch.init(inst, def);
3545
+ ZodType.init(inst, def);
3546
+ inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
3547
+ inst.unwrap = () => inst._zod.def.innerType;
3548
+ inst.removeCatch = inst.unwrap;
3549
+ });
3550
+ function _catch(innerType, catchValue) {
3551
+ return new ZodCatch({
3552
+ type: "catch",
3553
+ innerType,
3554
+ catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
3555
+ });
3556
+ }
3557
+ const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
3558
+ $ZodPipe.init(inst, def);
3559
+ ZodType.init(inst, def);
3560
+ inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
3561
+ inst.in = def.in;
3562
+ inst.out = def.out;
3563
+ });
3564
+ function pipe(in_, out) {
3565
+ return new ZodPipe({
3566
+ type: "pipe",
3567
+ in: in_,
3568
+ out
3569
+ });
3570
+ }
3571
+ const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
3572
+ $ZodReadonly.init(inst, def);
3573
+ ZodType.init(inst, def);
3574
+ inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
3575
+ inst.unwrap = () => inst._zod.def.innerType;
3576
+ });
3577
+ function readonly(innerType) {
3578
+ return new ZodReadonly({
3579
+ type: "readonly",
3580
+ innerType
3581
+ });
3582
+ }
3583
+ const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
3584
+ $ZodCustom.init(inst, def);
3585
+ ZodType.init(inst, def);
3586
+ inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
3587
+ });
3588
+ function refine(fn, _params = {}) {
3589
+ return _refine(ZodCustom, fn, _params);
3590
+ }
3591
+ function superRefine(fn) {
3592
+ return _superRefine(fn);
3593
+ }
3594
+ const describe = describe$1;
3595
+ const meta = meta$1;
3596
+
3597
+ //#endregion
3598
+ //#region src/load-config.ts
3599
+ const configSchema = object({
3600
+ content: string().default("./content"),
3601
+ locales: array(string()).min(1).default(["en"]),
3602
+ github: object({ repo: string() }).optional(),
3603
+ siteName: string().optional(),
3604
+ version: string().optional(),
3605
+ sections: record(string(), boolean()).optional(),
3606
+ nav: object({ links: array(object({
3607
+ text: string(),
3608
+ url: string()
3609
+ })).default([]) }).default({ links: [] }),
3610
+ animations: boolean().default(true),
3611
+ basePath: string().optional()
3612
+ });
3613
+ async function resolveConfig() {
3614
+ const { config } = await loadConfig({
3615
+ name: "8n",
3616
+ defaults: configSchema.parse({})
3617
+ });
3618
+ return configSchema.parse(config);
3619
+ }
3620
+
3621
+ //#endregion
3622
+ //#region src/web-app.ts
3623
+ const FRAMES = [
3624
+ "⠋",
3625
+ "⠙",
3626
+ "⠹",
3627
+ "⠸",
3628
+ "⠼",
3629
+ "⠴",
3630
+ "⠦",
3631
+ "⠧",
3632
+ "⠇",
3633
+ "⠏"
3634
+ ];
3635
+ function spinner(text) {
3636
+ if (!process.stdout.isTTY) {
3637
+ process.stdout.write(pc.dim(` ${text}...\n`));
3638
+ return {
3639
+ succeed(msg) {
3640
+ process.stdout.write(pc.green("✓") + pc.dim(` ${msg}\n`));
3641
+ },
3642
+ fail(msg) {
3643
+ process.stdout.write(pc.red("✗") + ` ${msg}\n`);
3644
+ }
3645
+ };
3646
+ }
3647
+ let i = 0;
3648
+ const id = setInterval(() => {
3649
+ process.stdout.write(`\r${pc.cyan(FRAMES[i++ % FRAMES.length])} ${pc.dim(text)}`);
3650
+ }, 80);
3651
+ function clear() {
3652
+ clearInterval(id);
3653
+ process.stdout.clearLine?.(0);
3654
+ }
3655
+ return {
3656
+ succeed(msg) {
3657
+ clear();
3658
+ process.stdout.write(`\r${pc.green("✓")} ${pc.dim(msg)}\n`);
3659
+ },
3660
+ fail(msg) {
3661
+ clear();
3662
+ process.stdout.write(`\r${pc.red("✗")} ${msg}\n`);
3663
+ }
3664
+ };
3665
+ }
3666
+ function getStarterDir() {
3667
+ return join(dirname(fileURLToPath(import.meta.url)), "..", "starter");
3668
+ }
3669
+ async function checkSelfUpdate() {
3670
+ try {
3671
+ const res = await fetch("https://registry.npmjs.org/@ahmedrowaihi/8n/latest", {
3672
+ headers: { Accept: "application/json" },
3673
+ signal: AbortSignal.timeout(3e3)
3674
+ });
3675
+ if (!res.ok) return;
3676
+ const { version: latest } = await res.json();
3677
+ const current = "6.0.3";
3678
+ if (latest !== current) console.log(pc.yellow("⚠") + pc.dim(` new version available: `) + pc.cyan(latest) + pc.dim(` (current: ${current}) — run `) + pc.cyan("npm i -g @ahmedrowaihi/8n") + pc.dim(" to update"));
3679
+ } catch {}
3680
+ }
3681
+ async function ensureDepsInstalled() {
3682
+ const starterDir = getStarterDir();
3683
+ if (existsSync(join(starterDir, "node_modules", ".bin", "next"))) return;
3684
+ const spin = spinner("installing starter dependencies");
3685
+ try {
3686
+ await x("npm", ["install", "--legacy-peer-deps"], { nodeOptions: {
3687
+ cwd: starterDir,
3688
+ stdio: process.env.DEBUG_8N ? "inherit" : "pipe"
3689
+ } });
3690
+ spin.succeed("starter ready");
3691
+ } catch (err) {
3692
+ spin.fail(`install failed: ${err.message}`);
3693
+ throw err;
3694
+ }
3695
+ }
3696
+ function syncPublicDir(projectDir) {
3697
+ const src = join(projectDir, "public");
3698
+ if (!existsSync(src)) return;
3699
+ cpSync(src, join(getStarterDir(), "public", "_assets"), {
3700
+ recursive: true,
3701
+ force: true
3702
+ });
3703
+ }
3704
+ function watchPublicDir(projectDir) {
3705
+ const src = join(projectDir, "public");
3706
+ if (!existsSync(src)) return;
3707
+ watch(src, { recursive: true }, () => {
3708
+ cpSync(src, join(getStarterDir(), "public", "_assets"), {
3709
+ recursive: true,
3710
+ force: true
3711
+ });
3712
+ });
3713
+ }
3714
+ function getNextBin() {
3715
+ return join(getStarterDir(), "node_modules", ".bin", "next");
3716
+ }
3717
+ async function resolveProject() {
3718
+ const config = await resolveConfig();
3719
+ return {
3720
+ config,
3721
+ contentDir: resolve(process.cwd(), config.content ?? "./content")
3722
+ };
3723
+ }
3724
+ async function runNext(cmd, env) {
3725
+ await x(getNextBin(), [cmd], { nodeOptions: {
3726
+ cwd: getStarterDir(),
3727
+ stdio: "inherit",
3728
+ env
3729
+ } });
3730
+ }
3731
+ const adapterPath = join(dirname(fileURLToPath(import.meta.url)), "adapter.cjs");
3732
+ function buildEnv({ config, contentDir, staticExport = false }) {
3733
+ const ghRepo = process.env.GITHUB_REPOSITORY;
3734
+ const ghServer = process.env.GITHUB_SERVER_URL ?? "https://github.com";
3735
+ const ghPagesUrl = ghRepo ? `${ghServer}/${ghRepo}` : void 0;
3736
+ const ghPagesBasePath = ghRepo ? `/${ghRepo.split("/")[1]}` : void 0;
3737
+ return {
3738
+ ...process.env,
3739
+ CONTENT_DIR: contentDir,
3740
+ LOCALES: (config.locales ?? ["en"]).join(","),
3741
+ NEXT_PUBLIC_SITE_NAME: config.siteName ?? "Docs",
3742
+ NEXT_PUBLIC_GITHUB_REPO: config.github?.repo ?? ghPagesUrl,
3743
+ SECTIONS: JSON.stringify(config.sections ?? {}),
3744
+ NEXT_PUBLIC_NAV_LINKS: JSON.stringify(config.nav?.links ?? []),
3745
+ NEXT_PUBLIC_ANIMATIONS: config.animations === false ? "false" : "true",
3746
+ NEXT_BASE_PATH: config.basePath ?? ghPagesBasePath ?? "",
3747
+ NEXT_STATIC_EXPORT: staticExport ? "true" : "false",
3748
+ NEXT_ADAPTER_PATH: adapterPath,
3749
+ DOCS_PROJECT_DIR: process.cwd()
3750
+ };
3751
+ }
3752
+
3753
+ //#endregion
3754
+ //#region src/commands/dev.ts
3755
+ async function dev() {
3756
+ const { config, contentDir } = await resolveProject();
3757
+ console.log(pc.cyan("8n") + pc.dim(` dev → ${contentDir}`));
3758
+ checkSelfUpdate();
3759
+ await ensureDepsInstalled();
3760
+ syncPublicDir(process.cwd());
3761
+ watchPublicDir(process.cwd());
3762
+ await runNext("dev", buildEnv({
3763
+ config,
3764
+ contentDir
3765
+ }));
3766
+ }
3767
+
3768
+ //#endregion
3769
+ //#region src/commands/build.ts
3770
+ async function build() {
3771
+ const { config, contentDir } = await resolveProject();
3772
+ console.log(pc.cyan("8n") + pc.dim(` build → ${contentDir}`));
3773
+ await ensureDepsInstalled();
3774
+ syncPublicDir(process.cwd());
3775
+ await runNext("build", buildEnv({
3776
+ config,
3777
+ contentDir,
3778
+ staticExport: true
3779
+ }));
3780
+ console.log(pc.green("✓") + pc.dim(` build complete → out/`));
3781
+ }
3782
+
3783
+ //#endregion
3784
+ //#region src/commands/start.ts
3785
+ async function start() {
3786
+ const { config, contentDir } = await resolveProject();
3787
+ console.log(pc.cyan("8n") + pc.dim(` start → ${contentDir}`));
3788
+ await ensureDepsInstalled();
3789
+ syncPublicDir(process.cwd());
3790
+ await runNext("build", buildEnv({
3791
+ config,
3792
+ contentDir
3793
+ }));
3794
+ await runNext("start", buildEnv({
3795
+ config,
3796
+ contentDir
3797
+ }));
3798
+ }
3799
+
3800
+ //#endregion
3801
+ //#region src/commands/init.ts
3802
+ const SCAFFOLD = {
3803
+ ["8n.config.ts"]: `export default {
3804
+ content: "./content",
3805
+ locales: ["en"],
3806
+ siteName: "Docs",
3807
+
3808
+ // Pin to a specific starter version (git tag or commit SHA).
3809
+ // Remove this line to always track the latest release.
3810
+ // version: "v1.0.0",
3811
+
3812
+ // Sections auto-show when content exists, auto-hide when empty.
3813
+ // Set a section to false to hide it even if content is present.
3814
+ // sections: { api: false },
3815
+
3816
+ // Add links to the top navigation bar.
3817
+ // nav: { links: [{ text: "Blog", url: "https://example.com/blog" }] },
3818
+ };
3819
+ `,
3820
+ ["content/docs/en/meta.json"]: JSON.stringify({
3821
+ title: "Documentation",
3822
+ pages: ["index", "getting-started"]
3823
+ }, null, 2) + "\n",
3824
+ ["content/docs/en/index.mdx"]: `---
3825
+ title: Introduction
3826
+ description: Welcome to the docs.
3827
+ ---
3828
+
3829
+ Welcome to your documentation. Edit files in \`content/\` and run \`8n dev\` to start.
3830
+ `,
3831
+ ["content/docs/en/getting-started/meta.json"]: JSON.stringify({
3832
+ title: "Getting Started",
3833
+ pages: ["installation"]
3834
+ }, null, 2) + "\n",
3835
+ ["content/docs/en/getting-started/installation.mdx"]: `---
3836
+ title: Installation
3837
+ description: How to install and set up the project.
3838
+ ---
3839
+
3840
+ ## Installation
3841
+
3842
+ Add your installation steps here.
3843
+ `,
3844
+ ["content/home/en/index.mdx"]: `---
3845
+ title: Home
3846
+ ---
3847
+
3848
+ <div className="flex flex-col items-center justify-center text-center flex-1 gap-6 px-6 py-24">
3849
+ <h1 className="text-4xl sm:text-5xl md:text-6xl font-bold leading-tight tracking-tight max-w-2xl">
3850
+ Welcome to your docs.
3851
+ </h1>
3852
+ <div className="text-muted-foreground text-lg max-w-md leading-relaxed">
3853
+ Edit \`content/home/en/index.mdx\` to customize this page.
3854
+ </div>
3855
+ </div>
3856
+ `,
3857
+ ["content/changelog/en/meta.json"]: JSON.stringify({ title: "Changelog" }, null, 2) + "\n",
3858
+ ["content/changelog/en/v1.0.0.mdx"]: `---
3859
+ title: Version 1.0.0
3860
+ version: 1.0.0
3861
+ date: "${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}"
3862
+ summary: Initial release.
3863
+ ---
3864
+
3865
+ ## Initial Release
3866
+
3867
+ First version of the docs.
3868
+ `
3869
+ };
3870
+ const GITIGNORE_ENTRIES = ["out"];
3871
+ function isDirEmpty(dir) {
3872
+ if (!existsSync(dir)) return true;
3873
+ return readdirSync(dir).filter((f) => !f.startsWith(".")).length === 0;
3874
+ }
3875
+ function scaffold(targetDir) {
3876
+ let created = 0;
3877
+ const files = {
3878
+ ...SCAFFOLD,
3879
+ "package.json": JSON.stringify({
3880
+ name: basename(targetDir),
3881
+ private: true,
3882
+ scripts: {
3883
+ dev: "8n dev",
3884
+ build: "8n build",
3885
+ start: "8n start"
3886
+ }
3887
+ }, null, 2) + "\n"
3888
+ };
3889
+ for (const [rel, content] of Object.entries(files)) {
3890
+ const abs = resolve(targetDir, rel);
3891
+ if (existsSync(abs)) {
3892
+ console.log(pc.dim(` skip ${rel}`));
3893
+ continue;
3894
+ }
3895
+ mkdirSync(join(abs, ".."), { recursive: true });
3896
+ writeFileSync(abs, content);
3897
+ console.log(pc.green(" create") + pc.dim(` ${rel}`));
3898
+ created++;
3899
+ }
3900
+ const gitignorePath = resolve(targetDir, ".gitignore");
3901
+ const existing = existsSync(gitignorePath) ? readFileSync(gitignorePath, "utf-8") : "";
3902
+ const missing = GITIGNORE_ENTRIES.filter((e) => !existing.split("\n").includes(e));
3903
+ if (missing.length > 0) {
3904
+ appendFileSync(gitignorePath, (existing.length > 0 && !existing.endsWith("\n") ? "\n" : "") + missing.join("\n") + "\n");
3905
+ for (const e of missing) console.log(pc.green(" gitignore") + pc.dim(` ${e}`));
3906
+ created += missing.length;
3907
+ }
3908
+ if (created > 0) console.log(pc.green("\n✓") + ` ready — run ${pc.cyan("pnpm dev")} to start`);
3909
+ else console.log(pc.dim("\n already initialized"));
3910
+ }
3911
+ async function init() {
3912
+ const cwd = process.cwd();
3913
+ console.log(pc.cyan("8n") + pc.dim(" init"));
3914
+ if (isDirEmpty(cwd)) {
3915
+ scaffold(cwd);
3916
+ return;
3917
+ }
3918
+ const rl = createInterface({
3919
+ input: process.stdin,
3920
+ output: process.stdout
3921
+ });
3922
+ const name = (await rl.question(pc.dim(" directory name: "))).trim();
3923
+ rl.close();
3924
+ if (!name) {
3925
+ console.log(pc.red(" aborted"));
3926
+ return;
3927
+ }
3928
+ const targetDir = resolve(cwd, name);
3929
+ mkdirSync(targetDir, { recursive: true });
3930
+ scaffold(targetDir);
3931
+ }
3932
+
3933
+ //#endregion
3934
+ //#region src/commands/mcp.ts
3935
+ async function listMdFiles(dir) {
3936
+ let entries;
3937
+ try {
3938
+ entries = await readdir(dir, { withFileTypes: true });
3939
+ } catch {
3940
+ return [];
3941
+ }
3942
+ return entries.filter((e) => !e.isDirectory() && (e.name.endsWith(".mdx") || e.name.endsWith(".md"))).map((e) => e.name);
3943
+ }
3944
+ async function mcp() {
3945
+ const mcpDir = join(getStarterDir(), "content", "mcp", "en");
3946
+ const server = new McpServer({
3947
+ name: "8n",
3948
+ version: "6.0.3"
3949
+ });
3950
+ server.registerTool("read_me", {
3951
+ description: "Returns how to use the 8n MCP tools. Call this BEFORE documenting anything with 8n.",
3952
+ inputSchema: {}
3953
+ }, async () => ({ content: [{
3954
+ type: "text",
3955
+ text: `# 8n MCP
3956
+
3957
+ Use these tools to learn how to write documentation for an 8n project before creating any content.
3958
+
3959
+ ## Tools
3960
+
3961
+ ### list_components
3962
+ Lists all available reference topics (config, structure, frontmatter, components).
3963
+ Call this first to discover what topics are available.
3964
+
3965
+ ### get_component
3966
+ Reads a specific topic by name (without extension).
3967
+ Example: get_component({ name: "components" }) returns all available MDX components with usage examples.
3968
+
3969
+ ## Workflow
3970
+ 1. Call list_components to see available topics
3971
+ 2. Call get_component for the topics relevant to your task
3972
+ 3. Use that knowledge to write correct MDX content for the user's project
3973
+ `
3974
+ }] }));
3975
+ server.registerTool("list_components", {
3976
+ description: "Lists all available 8n reference topics (config, structure, frontmatter, MDX components).",
3977
+ inputSchema: {}
3978
+ }, async () => {
3979
+ if (!existsSync(mcpDir)) return { content: [{
3980
+ type: "text",
3981
+ text: "8n MCP knowledge not found. Reinstall @ahmedrowaihi/8n."
3982
+ }] };
3983
+ return { content: [{
3984
+ type: "text",
3985
+ text: (await listMdFiles(mcpDir)).map((f) => basename(f, extname(f))).join("\n")
3986
+ }] };
3987
+ });
3988
+ server.registerTool("get_component", {
3989
+ description: "Reads a specific 8n reference topic by name. Use list_components first to discover available names.",
3990
+ inputSchema: { name: string().describe("Topic name without extension, e.g. components, config, structure, frontmatter") }
3991
+ }, async ({ name }) => {
3992
+ if (!existsSync(mcpDir)) return { content: [{
3993
+ type: "text",
3994
+ text: "8n MCP knowledge not found. Reinstall @ahmedrowaihi/8n."
3995
+ }] };
3996
+ for (const ext of [".mdx", ".md"]) {
3997
+ const file = join(mcpDir, `${name}${ext}`);
3998
+ if (existsSync(file)) return { content: [{
3999
+ type: "text",
4000
+ text: await readFile(file, "utf-8")
4001
+ }] };
4002
+ }
4003
+ return { content: [{
4004
+ type: "text",
4005
+ text: `Unknown topic: ${name}. Call list_components to see available topics.`
4006
+ }] };
4007
+ });
4008
+ server.registerTool("analyze", {
4009
+ description: "Runs static analysis on the user's content directory and reports issues that may break the documentation site.",
4010
+ inputSchema: {}
4011
+ }, async () => {
4012
+ let contentDir = join(process.cwd(), "content");
4013
+ let locales = ["en"];
4014
+ try {
4015
+ const project = await resolveProject();
4016
+ contentDir = project.contentDir;
4017
+ locales = project.config.locales ?? ["en"];
4018
+ } catch {}
4019
+ const issues = [];
4020
+ async function walkAll(dir) {
4021
+ const results = [];
4022
+ let entries;
4023
+ try {
4024
+ entries = await readdir(dir, { withFileTypes: true });
4025
+ } catch {
4026
+ return results;
4027
+ }
4028
+ for (const e of entries) {
4029
+ const full = join(dir, e.name);
4030
+ if (e.isDirectory()) results.push(...await walkAll(full));
4031
+ else results.push(full);
4032
+ }
4033
+ return results;
4034
+ }
4035
+ const allFiles = await walkAll(contentDir);
4036
+ const mdxFiles = allFiles.filter((f) => f.endsWith(".mdx") || f.endsWith(".md"));
4037
+ const metaFiles = allFiles.filter((f) => f.endsWith("meta.json"));
4038
+ for (const file of mdxFiles) {
4039
+ const raw = await readFile(file, "utf-8").catch(() => "");
4040
+ const rel = relative(contentDir, file);
4041
+ if (!raw.match(/^---[\s\S]*?\ntitle:/m)) issues.push(`Missing title in frontmatter: ${rel}`);
4042
+ if (rel.startsWith("changelog/")) {
4043
+ if (!raw.match(/\nversion:/)) issues.push(`Changelog page missing version: ${rel}`);
4044
+ if (!raw.match(/\ndate:/)) issues.push(`Changelog page missing date: ${rel}`);
4045
+ }
4046
+ const bodyMatch = raw.match(/^---[\s\S]*?---\s*([\s\S]*)$/m);
4047
+ if (bodyMatch && bodyMatch[1].trim() === "") issues.push(`Empty page body: ${rel}`);
4048
+ }
4049
+ for (const file of metaFiles) {
4050
+ const rel = relative(contentDir, file);
4051
+ const raw = await readFile(file, "utf-8").catch(() => "");
4052
+ let meta;
4053
+ try {
4054
+ meta = JSON.parse(raw);
4055
+ } catch {
4056
+ issues.push(`Malformed JSON: ${rel}`);
4057
+ continue;
4058
+ }
4059
+ if (meta.pages) {
4060
+ const dir = join(file, "..");
4061
+ for (const page of meta.pages) {
4062
+ if (page.startsWith("...") || page === "---" || page.startsWith("[")) continue;
4063
+ if (existsSync(join(dir, page)) && !existsSync(join(dir, `${page}.mdx`)) && !existsSync(join(dir, `${page}.md`))) continue;
4064
+ if (![".mdx", ".md"].some((ext) => existsSync(join(dir, `${page}${ext}`)))) issues.push(`meta.json references missing page "${page}": ${rel}`);
4065
+ }
4066
+ }
4067
+ }
4068
+ const defaultLocale = locales[0];
4069
+ const otherLocales = locales.slice(1);
4070
+ for (const locale of otherLocales) {
4071
+ const defaultFiles = mdxFiles.filter((f) => f.includes(`/${defaultLocale}/`)).map((f) => relative(contentDir, f).replace(`${defaultLocale}/`, `${locale}/`));
4072
+ for (const expected of defaultFiles) if (!existsSync(join(contentDir, expected))) issues.push(`Missing ${locale} translation: ${expected}`);
4073
+ }
4074
+ if (issues.length === 0) return { content: [{
4075
+ type: "text",
4076
+ text: "✓ No issues found."
4077
+ }] };
4078
+ return { content: [{
4079
+ type: "text",
4080
+ text: `Found ${issues.length} issue${issues.length === 1 ? "" : "s"}:\n\n${issues.map((i) => `- ${i}`).join("\n")}`
4081
+ }] };
4082
+ });
4083
+ const transport = new StdioServerTransport();
4084
+ await server.connect(transport);
4085
+ }
4086
+
4087
+ //#endregion
4088
+ //#region src/index.ts
4089
+ const program = new Command().name("8n").description("Run your 8n docs site").version("6.0.3").addOption(new Option("--debug").hideHelp()).hook("preAction", (cmd) => {
4090
+ if (cmd.opts().debug) process.env.DEBUG_8N = "1";
4091
+ });
4092
+ program.command("init").description("Scaffold a new docs project in the current directory").action(init);
4093
+ program.command("dev").description("Start the dev server").action(dev);
4094
+ program.command("build").description("Build for production").action(build);
4095
+ program.command("start").description("Start the production server").action(start);
4096
+ program.command("mcp").description("Start the MCP server for AI-assisted docs authoring").action(mcp);
4097
+ program.parse();
4098
+
4099
+ //#endregion
4100
+ export { };