@oomol-lab/open-flow 0.1.0-beta.73 → 0.1.0-beta.75

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 (444) hide show
  1. package/LICENSE +36 -0
  2. package/NOTICE +7 -0
  3. package/README.md +41 -0
  4. package/dist/browser/{ContentIcon-CUQHjQIw.js → ContentIcon-FCpKiwjp.js} +2 -1
  5. package/dist/browser/{FlowCanvas-Dtf8_cQp.js → FlowCanvas-dzRBnlUT.js} +1 -1
  6. package/dist/browser/{createResourceDialog-BWJkjiOO.js → createResourceDialog-BeYDdUl-.js} +2 -2
  7. package/dist/browser/{dialog-CUy_fwx9.js → dialog-ZtpsFbl4.js} +337 -31
  8. package/dist/browser/{exportSvg-BOoy7-Db.js → exportSvg-DqXw1yf-.js} +2 -2
  9. package/dist/browser/{flowChanges-CgSnSqqP.js → flowChanges-b_5UobFj.js} +586 -87
  10. package/dist/browser/{flowWorkspace-Bf7H-r0t.js → flowWorkspace-ItojZbO4.js} +21162 -20242
  11. package/dist/browser/preview.css +254 -179
  12. package/dist/browser/preview.js +22201 -20625
  13. package/dist/browser/{typeScriptSession-B0hC-C8y.js → typeScriptSession-CSRwWmZm.js} +1 -1
  14. package/dist/browser/ui.css +72 -2
  15. package/dist/browser/workbench.css +254 -179
  16. package/dist/browser/workbench.js +22 -78
  17. package/dist/browser/{workbenchSelect-C3e4J93X.js → workbenchSelect-M441Lz0d.js} +1 -1
  18. package/dist/command/index.js +42 -42
  19. package/dist/common/authoring.d.ts +5 -5
  20. package/dist/common/authoringExamples.d.ts +3 -2
  21. package/dist/common/authoringFields.d.ts +1 -1
  22. package/dist/common/authoringSchema.d.ts +95 -8
  23. package/dist/common/connector-proxy.d.ts +1 -1
  24. package/dist/common/control-api-conformance.d.ts +1 -1
  25. package/dist/common/control-api-conformance.js +119 -31
  26. package/dist/common/control-api.d.ts +4 -3
  27. package/dist/common/control-api.js +117 -29
  28. package/dist/common/control-requests.d.ts +5 -4
  29. package/dist/common/control-requests.js +437 -103
  30. package/dist/common/cron-trigger.d.ts +1 -1
  31. package/dist/common/decision.d.ts +1 -1
  32. package/dist/common/draftOperations.d.ts +1 -1
  33. package/dist/common/engine-contract.d.ts +4 -2
  34. package/dist/common/event-source-definition.d.ts +1 -1
  35. package/dist/common/flow-agent.d.ts +1 -1
  36. package/dist/{browser → common}/flow-authoring-node.d.ts +3 -3
  37. package/dist/{browser → common}/flow-authoring.js +131 -30
  38. package/dist/{browser → common}/flow-change-schema.d.ts +177 -6
  39. package/dist/{browser → common}/flow-change.d.ts +35 -15
  40. package/dist/{browser → common}/flow-change.js +133 -32
  41. package/dist/common/flow-connectionUsage.d.ts +1 -1
  42. package/dist/common/flow-encoding.d.ts +1 -1
  43. package/dist/common/flow-encoding.js +89 -23
  44. package/dist/common/flow-errorHandling.d.ts +1 -1
  45. package/dist/common/flow-graph.d.ts +3 -2
  46. package/dist/common/flow-modules.d.ts +1 -1
  47. package/dist/common/flow-promptTemplate.d.ts +1 -1
  48. package/dist/common/flow-retry.d.ts +2 -2
  49. package/dist/common/flow-semantics.d.ts +1 -1
  50. package/dist/common/flow-semantics.js +966 -614
  51. package/dist/common/flow-workflowFile.d.ts +1 -1
  52. package/dist/common/flowInspection.d.ts +3 -3
  53. package/dist/common/http-request.d.ts +156 -0
  54. package/dist/common/http-request.js +5254 -0
  55. package/dist/common/integration-trigger.d.ts +1 -1
  56. package/dist/common/licenses.md +118 -1
  57. package/dist/common/liveDetails.d.ts +1 -1
  58. package/dist/common/mcp.d.ts +5 -4
  59. package/dist/common/mcp.js +117 -29
  60. package/dist/common/openapi.d.ts +1 -1
  61. package/dist/common/poll-trigger.d.ts +1 -1
  62. package/dist/common/run-events.js +11 -9
  63. package/dist/common/run-results.d.ts +8 -1
  64. package/dist/common/runtime-contract.d.ts +8 -2
  65. package/dist/common/runtime-contract.js +25 -5
  66. package/dist/common/scheduler-checkpoint.d.ts +1 -1
  67. package/dist/common/scheduler-dependencies.d.ts +1 -1
  68. package/dist/common/scheduler-node-execution.d.ts +1 -1
  69. package/dist/common/scheduler.d.ts +3 -3
  70. package/dist/common/scheduler.js +101 -33
  71. package/dist/common/trigger-catalog.d.ts +1 -1
  72. package/dist/common/trigger-config-options.d.ts +1 -1
  73. package/dist/common/trigger-config.d.ts +1 -1
  74. package/dist/common/trigger-contract.d.ts +2 -2
  75. package/dist/common/trigger-localization.d.ts +1 -1
  76. package/dist/common/webhook-response.d.ts +1 -3
  77. package/dist/common/webhook-trigger.d.ts +1 -1
  78. package/dist/common/webhook-trigger.js +12 -11
  79. package/dist/common/workflow.d.ts +17 -1
  80. package/dist/common/workflow.js +68 -22
  81. package/dist/index.d.ts +6 -3
  82. package/package.json +11 -6
  83. package/skills/open-flow/references/flow-authoring.md +1 -0
  84. package/skills/open-flow/references/flow-n8n-conversion.md +19 -15
  85. package/src/base/common/json.ts +90 -0
  86. package/src/canvas/common/commands.ts +15 -0
  87. package/src/connector/common/actionSchema.ts +168 -0
  88. package/src/connector/common/proxy.ts +44 -0
  89. package/src/control/common/api.ts +1506 -0
  90. package/src/control/common/authoring.ts +923 -0
  91. package/src/control/common/authoringCondition.ts +110 -0
  92. package/src/control/common/authoringDiagnosticFields.ts +136 -0
  93. package/src/control/common/authoringExamples.ts +200 -0
  94. package/src/control/common/authoringFields.ts +53 -0
  95. package/src/control/common/authoringLlm.ts +70 -0
  96. package/src/control/common/authoringOpenApi.ts +129 -0
  97. package/src/control/common/authoringSchema.ts +410 -0
  98. package/src/control/common/authoringTools.ts +123 -0
  99. package/src/control/common/authoringTriggers.ts +26 -0
  100. package/src/control/common/checkDecoders.ts +65 -0
  101. package/src/control/common/conformance.ts +1989 -0
  102. package/src/control/common/connectorDecoders.ts +370 -0
  103. package/src/control/common/connectorQueries.ts +61 -0
  104. package/src/control/common/decoding.ts +60 -0
  105. package/src/control/common/draftOperations.ts +61 -0
  106. package/src/control/common/errors.ts +114 -0
  107. package/src/control/common/eventSourceSchemas.ts +13 -0
  108. package/src/control/common/eventSources.ts +186 -0
  109. package/src/control/common/flowDecoders.ts +153 -0
  110. package/src/control/common/flowInspection.ts +181 -0
  111. package/src/control/common/flowNotifications.ts +37 -0
  112. package/src/control/common/liveDetails.ts +124 -0
  113. package/src/control/common/mcp.ts +241 -0
  114. package/src/control/common/mcpConformance.ts +142 -0
  115. package/src/control/common/providerAccess.ts +28 -0
  116. package/src/control/common/providerIconSprite.ts +42 -0
  117. package/src/control/common/publicationDecoders.ts +98 -0
  118. package/src/control/common/random.ts +16 -0
  119. package/src/control/common/requests.ts +112 -0
  120. package/src/control/common/resultQuery.ts +8 -0
  121. package/src/control/common/results.ts +176 -0
  122. package/src/control/common/revisionDecoders.ts +52 -0
  123. package/src/control/common/runDecoders.ts +240 -0
  124. package/src/control/common/triggerCatalog.ts +89 -0
  125. package/src/control/common/triggerDecoders.ts +175 -0
  126. package/src/decision/common/decision.ts +168 -0
  127. package/src/event-source/common/catalog.generated.json +65 -0
  128. package/src/event-source/common/definition.ts +66 -0
  129. package/src/event-source/common/index.ts +99 -0
  130. package/src/execution/common/checkpoint.ts +311 -0
  131. package/src/execution/common/dependencies.ts +440 -0
  132. package/src/execution/common/engineContract.ts +84 -0
  133. package/src/execution/common/events.ts +331 -0
  134. package/src/execution/common/node-execution.ts +469 -0
  135. package/src/execution/common/runLifecycle.ts +250 -0
  136. package/src/execution/common/runtime.ts +563 -0
  137. package/src/execution/common/scheduler.ts +697 -0
  138. package/src/execution/common/wait.ts +36 -0
  139. package/src/flow/common/agent.ts +305 -0
  140. package/src/flow/common/authoring.ts +30 -0
  141. package/src/flow/common/change.ts +1037 -0
  142. package/src/flow/common/changeSchema.ts +792 -0
  143. package/src/flow/common/codePermissions.ts +2 -0
  144. package/src/flow/common/condition.ts +265 -0
  145. package/src/flow/common/connectionUsage.ts +131 -0
  146. package/src/flow/common/edgeChanges.ts +35 -0
  147. package/src/flow/common/encoding.ts +437 -0
  148. package/src/flow/common/errorHandling.ts +34 -0
  149. package/src/flow/common/graph.ts +898 -0
  150. package/src/flow/common/inputValue.ts +16 -0
  151. package/src/flow/common/json.ts +8 -0
  152. package/src/flow/common/moduleChanges.ts +31 -0
  153. package/src/flow/common/modules.ts +292 -0
  154. package/src/flow/common/nodeChanges.ts +762 -0
  155. package/src/flow/common/portChanges.ts +36 -0
  156. package/src/flow/common/promptTemplate.ts +15 -0
  157. package/src/flow/common/retry.ts +20 -0
  158. package/src/flow/common/schema.ts +162 -0
  159. package/src/flow/common/schemaCompare.ts +176 -0
  160. package/src/flow/common/schemaComparer.ts +178 -0
  161. package/src/flow/common/schemaKeywords.ts +53 -0
  162. package/src/flow/common/semantics.ts +531 -0
  163. package/src/flow/common/sourceField.ts +35 -0
  164. package/src/flow/common/triggerScheduleSchema.ts +8 -0
  165. package/src/flow/common/wait.ts +30 -0
  166. package/src/flow/common/webhookMethod.ts +7 -0
  167. package/src/flow/common/webhookResponse.ts +71 -0
  168. package/src/flow/common/workflowFile.ts +97 -0
  169. package/src/http/common/authBindings.ts +12 -0
  170. package/src/http/common/headers.ts +5 -0
  171. package/src/http/common/httpRequest.ts +251 -0
  172. package/src/json-schema-subset/checker/array.ts +142 -0
  173. package/src/json-schema-subset/checker/cache.ts +57 -0
  174. package/src/json-schema-subset/checker/checker.ts +230 -0
  175. package/src/json-schema-subset/checker/enumAndConst.ts +113 -0
  176. package/src/json-schema-subset/checker/equals.ts +93 -0
  177. package/src/json-schema-subset/checker/numeric/checker.ts +50 -0
  178. package/src/json-schema-subset/checker/numeric/float.ts +121 -0
  179. package/src/json-schema-subset/checker/numeric/index.ts +1 -0
  180. package/src/json-schema-subset/checker/numeric/integer.ts +119 -0
  181. package/src/json-schema-subset/checker/numeric/integerNormalizer.ts +72 -0
  182. package/src/json-schema-subset/checker/object.ts +354 -0
  183. package/src/json-schema-subset/checker/range.ts +91 -0
  184. package/src/json-schema-subset/checker/string.ts +60 -0
  185. package/src/json-schema-subset/checker/tools/index.ts +3 -0
  186. package/src/json-schema-subset/checker/tools/mark.ts +82 -0
  187. package/src/json-schema-subset/checker/tools/quantum.ts +106 -0
  188. package/src/json-schema-subset/checker/tools/range.ts +210 -0
  189. package/src/json-schema-subset/checker/validator.ts +23 -0
  190. package/src/json-schema-subset/compiler/array.ts +163 -0
  191. package/src/json-schema-subset/compiler/combination.ts +109 -0
  192. package/src/json-schema-subset/compiler/common.ts +99 -0
  193. package/src/json-schema-subset/compiler/compiler.ts +188 -0
  194. package/src/json-schema-subset/compiler/enumAndConst.ts +75 -0
  195. package/src/json-schema-subset/compiler/index.ts +11 -0
  196. package/src/json-schema-subset/compiler/object.ts +411 -0
  197. package/src/json-schema-subset/compiler/primitive.ts +144 -0
  198. package/src/json-schema-subset/compiler/utils.ts +24 -0
  199. package/src/json-schema-subset/compiler/wrapper.ts +192 -0
  200. package/src/json-schema-subset/error.ts +55 -0
  201. package/src/json-schema-subset/expression/calculator.ts +442 -0
  202. package/src/json-schema-subset/expression/combination.ts +49 -0
  203. package/src/json-schema-subset/expression/expression.ts +191 -0
  204. package/src/json-schema-subset/expression/index.ts +25 -0
  205. package/src/json-schema-subset/expression/result.ts +88 -0
  206. package/src/json-schema-subset/expression/types.ts +36 -0
  207. package/src/json-schema-subset/extends/extendsContext.ts +89 -0
  208. package/src/json-schema-subset/extends/index.ts +2 -0
  209. package/src/json-schema-subset/extends/types.ts +12 -0
  210. package/src/json-schema-subset/global.ts +60 -0
  211. package/src/json-schema-subset/index.ts +8 -0
  212. package/src/json-schema-subset/preprocessing.ts +74 -0
  213. package/src/json-schema-subset/types.ts +8 -0
  214. package/src/json-schema-subset/utils.ts +95 -0
  215. package/src/localization/common/languages.ts +118 -0
  216. package/src/localization/common/timeZone.ts +25 -0
  217. package/src/openapi/common/openapi.ts +459 -0
  218. package/src/trigger/common/config.ts +56 -0
  219. package/src/trigger/common/configOptions.ts +15 -0
  220. package/src/trigger/common/configSchema.ts +8 -0
  221. package/src/trigger/common/contract.ts +132 -0
  222. package/src/trigger/common/cron.ts +151 -0
  223. package/src/trigger/common/integration.ts +498 -0
  224. package/src/trigger/common/poll.ts +187 -0
  225. package/src/trigger/common/webhook.ts +413 -0
  226. package/src/trigger/providers/airtable/locales/fr.json +18 -0
  227. package/src/trigger/providers/airtable/locales/ja.json +18 -0
  228. package/src/trigger/providers/airtable/locales/ko.json +18 -0
  229. package/src/trigger/providers/airtable/locales/ru.json +18 -0
  230. package/src/trigger/providers/airtable/locales/zh-CN.json +18 -0
  231. package/src/trigger/providers/airtable/locales/zh-TW.json +18 -0
  232. package/src/trigger/providers/asana/locales/fr.json +15 -0
  233. package/src/trigger/providers/asana/locales/ja.json +15 -0
  234. package/src/trigger/providers/asana/locales/ko.json +15 -0
  235. package/src/trigger/providers/asana/locales/ru.json +15 -0
  236. package/src/trigger/providers/asana/locales/zh-CN.json +15 -0
  237. package/src/trigger/providers/asana/locales/zh-TW.json +15 -0
  238. package/src/trigger/providers/calendly/locales/fr.json +16 -0
  239. package/src/trigger/providers/calendly/locales/ja.json +16 -0
  240. package/src/trigger/providers/calendly/locales/ko.json +16 -0
  241. package/src/trigger/providers/calendly/locales/ru.json +16 -0
  242. package/src/trigger/providers/calendly/locales/zh-CN.json +16 -0
  243. package/src/trigger/providers/calendly/locales/zh-TW.json +16 -0
  244. package/src/trigger/providers/catalog.generated.json +4996 -0
  245. package/src/trigger/providers/clickup/locales/fr.json +16 -0
  246. package/src/trigger/providers/clickup/locales/ja.json +16 -0
  247. package/src/trigger/providers/clickup/locales/ko.json +16 -0
  248. package/src/trigger/providers/clickup/locales/ru.json +16 -0
  249. package/src/trigger/providers/clickup/locales/zh-CN.json +16 -0
  250. package/src/trigger/providers/clickup/locales/zh-TW.json +16 -0
  251. package/src/trigger/providers/definitions.ts +19 -0
  252. package/src/trigger/providers/feishu/locales/fr.json +20 -0
  253. package/src/trigger/providers/feishu/locales/ja.json +20 -0
  254. package/src/trigger/providers/feishu/locales/ko.json +20 -0
  255. package/src/trigger/providers/feishu/locales/ru.json +20 -0
  256. package/src/trigger/providers/feishu/locales/zh-CN.json +20 -0
  257. package/src/trigger/providers/feishu/locales/zh-TW.json +20 -0
  258. package/src/trigger/providers/fieldDescriptions.ts +392 -0
  259. package/src/trigger/providers/fieldLabels.ts +256 -0
  260. package/src/trigger/providers/fireflies/locales/fr.json +17 -0
  261. package/src/trigger/providers/fireflies/locales/ja.json +17 -0
  262. package/src/trigger/providers/fireflies/locales/ko.json +17 -0
  263. package/src/trigger/providers/fireflies/locales/ru.json +17 -0
  264. package/src/trigger/providers/fireflies/locales/zh-CN.json +17 -0
  265. package/src/trigger/providers/fireflies/locales/zh-TW.json +17 -0
  266. package/src/trigger/providers/github/locales/fr.json +30 -0
  267. package/src/trigger/providers/github/locales/ja.json +30 -0
  268. package/src/trigger/providers/github/locales/ko.json +30 -0
  269. package/src/trigger/providers/github/locales/ru.json +30 -0
  270. package/src/trigger/providers/github/locales/zh-CN.json +30 -0
  271. package/src/trigger/providers/github/locales/zh-TW.json +30 -0
  272. package/src/trigger/providers/gitlab/locales/fr.json +18 -0
  273. package/src/trigger/providers/gitlab/locales/ja.json +18 -0
  274. package/src/trigger/providers/gitlab/locales/ko.json +18 -0
  275. package/src/trigger/providers/gitlab/locales/ru.json +18 -0
  276. package/src/trigger/providers/gitlab/locales/zh-CN.json +18 -0
  277. package/src/trigger/providers/gitlab/locales/zh-TW.json +18 -0
  278. package/src/trigger/providers/gmail/locales/fr.json +18 -0
  279. package/src/trigger/providers/gmail/locales/ja.json +18 -0
  280. package/src/trigger/providers/gmail/locales/ko.json +18 -0
  281. package/src/trigger/providers/gmail/locales/ru.json +18 -0
  282. package/src/trigger/providers/gmail/locales/zh-CN.json +18 -0
  283. package/src/trigger/providers/gmail/locales/zh-TW.json +18 -0
  284. package/src/trigger/providers/google-calendar/locales/fr.json +15 -0
  285. package/src/trigger/providers/google-calendar/locales/ja.json +15 -0
  286. package/src/trigger/providers/google-calendar/locales/ko.json +15 -0
  287. package/src/trigger/providers/google-calendar/locales/ru.json +15 -0
  288. package/src/trigger/providers/google-calendar/locales/zh-CN.json +15 -0
  289. package/src/trigger/providers/google-calendar/locales/zh-TW.json +15 -0
  290. package/src/trigger/providers/google-drive/locales/fr.json +48 -0
  291. package/src/trigger/providers/google-drive/locales/ja.json +48 -0
  292. package/src/trigger/providers/google-drive/locales/ko.json +48 -0
  293. package/src/trigger/providers/google-drive/locales/ru.json +48 -0
  294. package/src/trigger/providers/google-drive/locales/zh-CN.json +48 -0
  295. package/src/trigger/providers/google-drive/locales/zh-TW.json +48 -0
  296. package/src/trigger/providers/google-sheets/locales/fr.json +19 -0
  297. package/src/trigger/providers/google-sheets/locales/ja.json +19 -0
  298. package/src/trigger/providers/google-sheets/locales/ko.json +19 -0
  299. package/src/trigger/providers/google-sheets/locales/ru.json +19 -0
  300. package/src/trigger/providers/google-sheets/locales/zh-CN.json +19 -0
  301. package/src/trigger/providers/google-sheets/locales/zh-TW.json +19 -0
  302. package/src/trigger/providers/intercom/locales/fr.json +17 -0
  303. package/src/trigger/providers/intercom/locales/ja.json +17 -0
  304. package/src/trigger/providers/intercom/locales/ko.json +17 -0
  305. package/src/trigger/providers/intercom/locales/ru.json +17 -0
  306. package/src/trigger/providers/intercom/locales/zh-CN.json +17 -0
  307. package/src/trigger/providers/intercom/locales/zh-TW.json +17 -0
  308. package/src/trigger/providers/jira/locales/fr.json +17 -0
  309. package/src/trigger/providers/jira/locales/ja.json +17 -0
  310. package/src/trigger/providers/jira/locales/ko.json +17 -0
  311. package/src/trigger/providers/jira/locales/ru.json +17 -0
  312. package/src/trigger/providers/jira/locales/zh-CN.json +17 -0
  313. package/src/trigger/providers/jira/locales/zh-TW.json +17 -0
  314. package/src/trigger/providers/linear/locales/fr.json +13 -0
  315. package/src/trigger/providers/linear/locales/ja.json +13 -0
  316. package/src/trigger/providers/linear/locales/ko.json +13 -0
  317. package/src/trigger/providers/linear/locales/ru.json +13 -0
  318. package/src/trigger/providers/linear/locales/zh-CN.json +13 -0
  319. package/src/trigger/providers/linear/locales/zh-TW.json +13 -0
  320. package/src/trigger/providers/locales/fr.ts +71 -0
  321. package/src/trigger/providers/locales/ja.ts +71 -0
  322. package/src/trigger/providers/locales/ko.ts +71 -0
  323. package/src/trigger/providers/locales/ru.ts +71 -0
  324. package/src/trigger/providers/locales/zh-CN.ts +71 -0
  325. package/src/trigger/providers/locales/zh-TW.ts +71 -0
  326. package/src/trigger/providers/localization.ts +59 -0
  327. package/src/trigger/providers/notion/locales/fr.json +16 -0
  328. package/src/trigger/providers/notion/locales/ja.json +16 -0
  329. package/src/trigger/providers/notion/locales/ko.json +16 -0
  330. package/src/trigger/providers/notion/locales/ru.json +16 -0
  331. package/src/trigger/providers/notion/locales/zh-CN.json +16 -0
  332. package/src/trigger/providers/notion/locales/zh-TW.json +16 -0
  333. package/src/trigger/providers/one-drive/locales/fr.json +16 -0
  334. package/src/trigger/providers/one-drive/locales/ja.json +16 -0
  335. package/src/trigger/providers/one-drive/locales/ko.json +16 -0
  336. package/src/trigger/providers/one-drive/locales/ru.json +16 -0
  337. package/src/trigger/providers/one-drive/locales/zh-CN.json +16 -0
  338. package/src/trigger/providers/one-drive/locales/zh-TW.json +16 -0
  339. package/src/trigger/providers/outlook/locales/fr.json +18 -0
  340. package/src/trigger/providers/outlook/locales/ja.json +18 -0
  341. package/src/trigger/providers/outlook/locales/ko.json +18 -0
  342. package/src/trigger/providers/outlook/locales/ru.json +18 -0
  343. package/src/trigger/providers/outlook/locales/zh-CN.json +18 -0
  344. package/src/trigger/providers/outlook/locales/zh-TW.json +18 -0
  345. package/src/trigger/providers/pandadoc/locales/fr.json +12 -0
  346. package/src/trigger/providers/pandadoc/locales/ja.json +12 -0
  347. package/src/trigger/providers/pandadoc/locales/ko.json +12 -0
  348. package/src/trigger/providers/pandadoc/locales/ru.json +12 -0
  349. package/src/trigger/providers/pandadoc/locales/zh-CN.json +12 -0
  350. package/src/trigger/providers/pandadoc/locales/zh-TW.json +12 -0
  351. package/src/trigger/providers/pipedrive/locales/fr.json +15 -0
  352. package/src/trigger/providers/pipedrive/locales/ja.json +15 -0
  353. package/src/trigger/providers/pipedrive/locales/ko.json +15 -0
  354. package/src/trigger/providers/pipedrive/locales/ru.json +15 -0
  355. package/src/trigger/providers/pipedrive/locales/zh-CN.json +15 -0
  356. package/src/trigger/providers/pipedrive/locales/zh-TW.json +15 -0
  357. package/src/trigger/providers/remote.ts +163 -0
  358. package/src/trigger/providers/resend/locales/fr.json +16 -0
  359. package/src/trigger/providers/resend/locales/ja.json +16 -0
  360. package/src/trigger/providers/resend/locales/ko.json +16 -0
  361. package/src/trigger/providers/resend/locales/ru.json +16 -0
  362. package/src/trigger/providers/resend/locales/zh-CN.json +16 -0
  363. package/src/trigger/providers/resend/locales/zh-TW.json +16 -0
  364. package/src/trigger/providers/sentry/locales/fr.json +19 -0
  365. package/src/trigger/providers/sentry/locales/ja.json +19 -0
  366. package/src/trigger/providers/sentry/locales/ko.json +19 -0
  367. package/src/trigger/providers/sentry/locales/ru.json +19 -0
  368. package/src/trigger/providers/sentry/locales/zh-CN.json +19 -0
  369. package/src/trigger/providers/sentry/locales/zh-TW.json +19 -0
  370. package/src/trigger/providers/shopify/locales/fr.json +18 -0
  371. package/src/trigger/providers/shopify/locales/ja.json +18 -0
  372. package/src/trigger/providers/shopify/locales/ko.json +18 -0
  373. package/src/trigger/providers/shopify/locales/ru.json +18 -0
  374. package/src/trigger/providers/shopify/locales/zh-CN.json +18 -0
  375. package/src/trigger/providers/shopify/locales/zh-TW.json +18 -0
  376. package/src/trigger/providers/slack/locales/fr.json +18 -0
  377. package/src/trigger/providers/slack/locales/ja.json +18 -0
  378. package/src/trigger/providers/slack/locales/ko.json +18 -0
  379. package/src/trigger/providers/slack/locales/ru.json +18 -0
  380. package/src/trigger/providers/slack/locales/zh-CN.json +18 -0
  381. package/src/trigger/providers/slack/locales/zh-TW.json +18 -0
  382. package/src/trigger/providers/slackbot/locales/fr.json +23 -0
  383. package/src/trigger/providers/slackbot/locales/ja.json +23 -0
  384. package/src/trigger/providers/slackbot/locales/ko.json +23 -0
  385. package/src/trigger/providers/slackbot/locales/ru.json +23 -0
  386. package/src/trigger/providers/slackbot/locales/zh-CN.json +23 -0
  387. package/src/trigger/providers/slackbot/locales/zh-TW.json +23 -0
  388. package/src/trigger/providers/source-events.ts +25 -0
  389. package/src/trigger/providers/stripe/locales/fr.json +17 -0
  390. package/src/trigger/providers/stripe/locales/ja.json +17 -0
  391. package/src/trigger/providers/stripe/locales/ko.json +17 -0
  392. package/src/trigger/providers/stripe/locales/ru.json +17 -0
  393. package/src/trigger/providers/stripe/locales/zh-CN.json +17 -0
  394. package/src/trigger/providers/stripe/locales/zh-TW.json +17 -0
  395. package/src/trigger/providers/tally/locales/fr.json +12 -0
  396. package/src/trigger/providers/tally/locales/ja.json +12 -0
  397. package/src/trigger/providers/tally/locales/ko.json +12 -0
  398. package/src/trigger/providers/tally/locales/ru.json +12 -0
  399. package/src/trigger/providers/tally/locales/zh-CN.json +12 -0
  400. package/src/trigger/providers/tally/locales/zh-TW.json +12 -0
  401. package/src/trigger/providers/telegram/locales/fr.json +17 -0
  402. package/src/trigger/providers/telegram/locales/ja.json +17 -0
  403. package/src/trigger/providers/telegram/locales/ko.json +17 -0
  404. package/src/trigger/providers/telegram/locales/ru.json +17 -0
  405. package/src/trigger/providers/telegram/locales/zh-CN.json +17 -0
  406. package/src/trigger/providers/telegram/locales/zh-TW.json +17 -0
  407. package/src/trigger/providers/typeform/locales/fr.json +12 -0
  408. package/src/trigger/providers/typeform/locales/ja.json +12 -0
  409. package/src/trigger/providers/typeform/locales/ko.json +12 -0
  410. package/src/trigger/providers/typeform/locales/ru.json +12 -0
  411. package/src/trigger/providers/typeform/locales/zh-CN.json +12 -0
  412. package/src/trigger/providers/typeform/locales/zh-TW.json +12 -0
  413. package/src/trigger/providers/vercel/locales/fr.json +18 -0
  414. package/src/trigger/providers/vercel/locales/ja.json +18 -0
  415. package/src/trigger/providers/vercel/locales/ko.json +18 -0
  416. package/src/trigger/providers/vercel/locales/ru.json +18 -0
  417. package/src/trigger/providers/vercel/locales/zh-CN.json +18 -0
  418. package/src/trigger/providers/vercel/locales/zh-TW.json +18 -0
  419. package/src/trigger/providers/woocommerce/locales/fr.json +19 -0
  420. package/src/trigger/providers/woocommerce/locales/ja.json +19 -0
  421. package/src/trigger/providers/woocommerce/locales/ko.json +19 -0
  422. package/src/trigger/providers/woocommerce/locales/ru.json +19 -0
  423. package/src/trigger/providers/woocommerce/locales/zh-CN.json +19 -0
  424. package/src/trigger/providers/woocommerce/locales/zh-TW.json +19 -0
  425. package/src/trigger/providers/zendesk/locales/fr.json +15 -0
  426. package/src/trigger/providers/zendesk/locales/ja.json +15 -0
  427. package/src/trigger/providers/zendesk/locales/ko.json +15 -0
  428. package/src/trigger/providers/zendesk/locales/ru.json +15 -0
  429. package/src/trigger/providers/zendesk/locales/zh-CN.json +15 -0
  430. package/src/trigger/providers/zendesk/locales/zh-TW.json +15 -0
  431. package/src/trigger/providers/zoom/locales/fr.json +17 -0
  432. package/src/trigger/providers/zoom/locales/ja.json +17 -0
  433. package/src/trigger/providers/zoom/locales/ko.json +17 -0
  434. package/src/trigger/providers/zoom/locales/ru.json +17 -0
  435. package/src/trigger/providers/zoom/locales/zh-CN.json +17 -0
  436. package/src/trigger/providers/zoom/locales/zh-TW.json +17 -0
  437. package/src/types/index.ts +112 -0
  438. package/src/workflow/common/workflow.ts +273 -0
  439. package/dist/browser/lib-DrKav3HG.js +0 -11403
  440. /package/dist/{browser → common}/flow-authoring-edge.d.ts +0 -0
  441. /package/dist/{browser → common}/flow-authoring-module.d.ts +0 -0
  442. /package/dist/{browser → common}/flow-authoring.d.ts +0 -0
  443. /package/dist/{browser → common}/flow-input-value.d.ts +0 -0
  444. /package/dist/{browser → common}/webhook-method.d.ts +0 -0
@@ -1,13 +1,13 @@
1
1
  // @bun
2
- var Gb=Object.defineProperty;var Hb=(e)=>e;function Qb(e,n){this[e]=Hb.bind(null,n)}var no=(e,n)=>{for(var t in n)Gb(e,t,{get:n[t],enumerable:!0,configurable:!0,set:Qb.bind(n,t)})};var Iu="0.1.0-beta.73";var rs=["en","zh-CN","zh-TW","ja","ko","ru","fr"],Cu="en";var ts=new Map(rs.map((e)=>[e.toLowerCase(),e])),Xb=new Set(["hk","mo","tw"]);function Ou(e){return typeof e=="string"&&ts.get(e.toLowerCase())==e}function to(e,n="en"){for(let t of e){let r=t==null?void 0:ew(t);if(r!=null)return r}return n}function ew(e){let n=e.trim().toLowerCase();if(n.length==0)return;let t=ts.get(n);if(t!=null)return t;let r=n.split("-");if(r[0]=="zh"){if(r.includes("hant"))return"zh-TW";if(r.includes("hans"))return"zh-CN";return r.some((o)=>Xb.has(o))?"zh-TW":"zh-CN"}return ts.get(r[0])}function Eu(e){return{en:"Imported workflow","zh-CN":"\u5BFC\u5165\u7684\u5DE5\u4F5C\u6D41","zh-TW":"\u532F\u5165\u7684\u5DE5\u4F5C\u6D41",ja:"\u30A4\u30F3\u30DD\u30FC\u30C8\u3057\u305F\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC",ko:"\uAC00\uC838\uC628 \uC6CC\uD06C\uD50C\uB85C",fr:"Workflow import\xE9",ru:"\u0418\u043C\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u043F\u0440\u043E\u0446\u0435\u0441\u0441"}[e]}import{spawn as IC}from"child_process";import{readFile as CC}from"fs/promises";import{setTimeout as OC}from"timers/promises";var ro="open-flow-engine/v7";var nw={waitAutoContinue:!0,webhookResponses:!0,platformExports:new Set(["engineContract","identity"]),platformModule:"open-flow:platform",platformSource:`export const engineContract = ${JSON.stringify("open-flow-engine/v7")}
2
+ var iw=Object.defineProperty;var sw=(e)=>e;function aw(e,n){this[e]=sw.bind(null,n)}var no=(e,n)=>{for(var t in n)iw(e,t,{get:n[t],enumerable:!0,configurable:!0,set:aw.bind(n,t)})};var _u="0.1.0-beta.75";var is=["en","zh-CN","zh-TW","ja","ko","ru","fr"],Ru="en";var os=new Map(is.map((e)=>[e.toLowerCase(),e])),lw=new Set(["hk","mo","tw"]);function Au(e){return typeof e=="string"&&os.get(e.toLowerCase())==e}function to(e,n="en"){for(let t of e){let r=t==null?void 0:uw(t);if(r!=null)return r}return n}function uw(e){let n=e.trim().toLowerCase();if(n.length==0)return;let t=os.get(n);if(t!=null)return t;let r=n.split("-");if(r[0]=="zh"){if(r.includes("hant"))return"zh-TW";if(r.includes("hans"))return"zh-CN";return r.some((o)=>lw.has(o))?"zh-TW":"zh-CN"}return os.get(r[0])}function Pu(e){return{en:"Imported workflow","zh-CN":"\u5BFC\u5165\u7684\u5DE5\u4F5C\u6D41","zh-TW":"\u532F\u5165\u7684\u5DE5\u4F5C\u6D41",ja:"\u30A4\u30F3\u30DD\u30FC\u30C8\u3057\u305F\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC",ko:"\uAC00\uC838\uC628 \uC6CC\uD06C\uD50C\uB85C",fr:"Workflow import\xE9",ru:"\u0418\u043C\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u043F\u0440\u043E\u0446\u0435\u0441\u0441"}[e]}import{spawn as VC}from"child_process";import{readFile as MC}from"fs/promises";import{setTimeout as FC}from"timers/promises";var ro="open-flow-engine/v8";var dw={workflowTools:!0,httpRequests:!0,waitAutoContinue:!0,webhookResponses:!0,platformExports:new Set(["engineContract","identity"]),platformModule:"open-flow:platform",platformSource:`export const engineContract = ${JSON.stringify("open-flow-engine/v8")}
3
3
  export function identity(value) { return value }
4
- `},AC={...nw,builtinModules:new Set(["assert","assert/strict","buffer","console","constants","crypto","events","fs","fs/promises","os","path","path/posix","process","punycode","querystring","stream","stream/promises","stream/web","string_decoder","timers","timers/promises","url","util","zlib"].flatMap((e)=>[e,`node:${e}`])),platformSource:`export const engineContract = ${JSON.stringify("open-flow-engine/v7/nodejs-compat-v1")}
4
+ `},KC={...dw,builtinModules:new Set(["assert","assert/strict","buffer","console","constants","crypto","events","fs","fs/promises","os","path","path/posix","process","punycode","querystring","stream","stream/promises","stream/web","string_decoder","timers","timers/promises","url","util","zlib"].flatMap((e)=>[e,`node:${e}`])),platformSource:`export const engineContract = ${JSON.stringify("open-flow-engine/v8/nodejs-compat-v1")}
5
5
  export function identity(value) { return value }
6
- `};var _u=Object.prototype.hasOwnProperty;function Ie(e,n){var t,r;if(e===n)return!0;if(e&&n&&(t=e.constructor)===n.constructor){if(t===Date)return e.getTime()===n.getTime();if(t===RegExp)return e.toString()===n.toString();if(t===Array){if((r=e.length)===n.length)while(r--&&Ie(e[r],n[r]));return r===-1}if(!t||typeof e==="object"){r=0;for(t in e){if(_u.call(e,t)&&++r&&!_u.call(n,t))return!1;if(!(t in n)||!Ie(e[t],n[t]))return!1}return Object.keys(n).length===r}}return e!==e&&n!==n}function Zt(e){let n=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>n.indexOf(+r)===-1).map(([r,o])=>o)}function is(e,n="|"){return e.map((t)=>ls(t)).join(n)}function Jt(e,n){if(typeof n==="bigint")return n.toString();return n}class Ru{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Ut(e){return new Ru(e)}function ss(e){return e===null||e===void 0}function _n(e){let n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}function Au(e,n){let t=e/n,r=Math.round(t),o=4*Number.EPSILON*Math.max(Math.abs(t),1);if(Math.abs(t-r)<o)return 0;return t-r}var ju=Symbol("evaluating");function Pu(e,n,t){let r=void 0;Object.defineProperty(e,n,{get(){if(r===ju)return;if(r===void 0)r=ju,r=t();return r},set(o){Object.defineProperty(e,n,{value:o})},configurable:!0})}function je(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Bt(e){let n=Object.getOwnPropertyDescriptor(e,"shape");return n?.get?n.get.raw:n?.value}function yn(e){return Bt(e._zod.def)??e._zod.def.shape}function $u(e,n,t){Object.defineProperty(e,n,{get(){let r=t();return je(this,n,r),r},enumerable:!0,configurable:!0})}function Tu(e,n,t){if(n in e)je(e,n,t);else e[n]=t}function Fn(e,n,t,r){let o=yn(n);for(let i of t){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)$u(e,i,()=>{let a=n._zod.def.shape[i];return r?r(a,i):a});else Tu(e,i,r?r(s.value,i):s.value)}}function tw(e,n){for(let t of Reflect.ownKeys(n)){let r=Object.getOwnPropertyDescriptor(n,t);if(!r.enumerable)continue;if(r.get)$u(e,t,()=>n[t]);else Tu(e,t,r.value)}}function Je(...e){let n={};for(let t of e){let r=Object.getOwnPropertyDescriptors(t);Object.assign(n,r)}return Object.defineProperties({},n)}function Nu(e){return JSON.stringify(e)}function zu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var as="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function at(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Du=Ut(()=>{if(_e.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function wn(e){if(at(e)===!1)return!1;let n=e.constructor;if(n===void 0)return!0;if(typeof n!=="function")return!0;let t=n.prototype;if(at(t)===!1)return!1;if(Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)return!1;return!0}function cs(e){if(wn(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var oo=new Set(["string","number","symbol"]),Lu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function tn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function un(e,n,t){let r=new e._zod.constr(n??e._zod.def);if(!n||t?.parent)r._zod.parent=e;return r}function C(e){let n=e;if(!n)return{};if(typeof n==="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");n.error=n.message}if(delete n.message,typeof n.error==="string")return{...n,error:()=>n.error};return n}function ls(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Vu(e){return Object.keys(e).filter((n)=>e[n]._zod.optin!==void 0&&e[n]._zod.optout==="optional")}var io=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),so={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function rw(e,n){let t=e._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Fn(i,e,ao(e,n)),un(e,Je(t,{shape:i,checks:[]}))}function ao(e,n){let t=yn(e),r=[];for(let o of Reflect.ownKeys(n)){if(!Object.getOwnPropertyDescriptor(t,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(n[o])r.push(o)}return r}function ow(e,n){let t=e._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ao(e,n)),s={};return Fn(s,e,Reflect.ownKeys(yn(e)).filter((a)=>!i.has(a))),un(e,Je(t,{shape:s,checks:[]}))}function iw(e,n){if(!wn(n))throw Error("Invalid input to extend: expected a plain object");let t=e._zod.def.checks;if(t&&t.length>0){let o=yn(e);for(let i of Reflect.ownKeys(n))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return un(e,Je(e._zod.def,{shape:Mu(e,n)}))}function Mu(e,n){let t={};return Fn(t,e,Reflect.ownKeys(yn(e))),tw(t,n),t}function sw(e,n){if(!wn(n))throw Error("Invalid input to safeExtend: expected a plain object");return un(e,Je(e._zod.def,{shape:Mu(e,n)}))}function aw(e,n){if(!n?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let t={};Fn(t,e,Reflect.ownKeys(yn(e))),Fn(t,n,Reflect.ownKeys(yn(n)));let r=Je(e._zod.def,{shape:t,get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return un(e,r)}function qu(e,n,t,r="partial"){let i=n._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=t?new Set(ao(n,t)):void 0,c={};return Fn(c,n,Reflect.ownKeys(yn(n)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),un(n,Je(n._zod.def,{shape:c,checks:[]}))}function cw(e,n,t){let r=t?new Set(ao(n,t)):void 0,o={};return Fn(o,n,Reflect.ownKeys(yn(n)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),un(n,Je(n._zod.def,{shape:o}))}function Ve(e,n=0){if(e.aborted===!0)return!0;for(let t=n;t<e.issues.length;t++)if(e.issues[t]?.continue!==!0)return!0;return!1}function Fu(e,n=0){if(e.aborted===!0)return!0;for(let t=n;t<e.issues.length;t++)if(e.issues[t]?.continue===!1)return!0;return!1}function Ue(e,n){return n.map((t)=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Ft(e){return typeof e==="string"?e:e?.message}function us(e,n,t){var r;for(let o=n;o<e.length;o++)(r=e[o]).schema??(r.schema=t)}function Be(e,n,t){var r;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Ft(e.inst?._zod.def?.error?.(e))??Ft(i?.(e))??Ft(n?.error?.(e))??Ft(t.customError?.(e))??Ft(t.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,n?.reportInput)a.input=e.input;return a}function co(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var lw=/[\uD800-\uDBFF]/;function lo(e){let n=e.length;if(!lw.test(e))return n;let t=n;for(let r=0;r<n-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)t--,r++;return t}function uo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Zu(e){let n=typeof e;switch(n){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return n}function Zn(...e){let[n,t,r]=e;if(typeof n==="string")return{message:n,code:"custom",input:t,inst:r};return{...n}}function Ju(e,n){for(let t in n){let r=Object.getOwnPropertyDescriptor(n,t);if(r.get)Object.defineProperty(e,t,{...r,enumerable:!1});else uw(e,t,r.value)}}function bn(e,n,t,r=!0){return Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:r,value:t}),t}function Kt(e,n,t){return bn(e,n,t,!1)}function po(e,n){for(let t in e){let r=e[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get(){return bn(this,t,r(this))},set(o){bn(this,t,o)}})}return n}function uw(e,n,t){Object.defineProperty(e,n,{configurable:!0,get(){return this==null?t:bn(this,n,t.bind(this))},set(r){bn(this,n,r)}})}function dw(e,n){let t=Object.getPrototypeOf(e);return n in t?void 0:t}var os,En=!1,pw={configurable:!0,get(){En=!0;return}};function B(e,n,t){let r=Object.getPrototypeOf(e._zod);if(n in r&&os!==e._zod){os=void 0;return}os=e._zod,Object.defineProperty(r,n,{configurable:!0,get(){Object.defineProperty(this,n,pw);let o=En;En=!1;try{let i=t(this);if(En)delete this[n];else Object.defineProperty(this,n,{configurable:!0,writable:!0,value:i});return En=En||o,i}catch(i){throw delete this[n],En=En||o,i}},set(o){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:o})}})}function fw(e,n,t,r){let o=dw(e,n);if(!o)return;Object.defineProperty(o,n,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,n,i),i.value=t(this),Object.defineProperty(this,n,i),i.value},set(i){Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var mw="~constantCatch";function Uu(e){let n=()=>e;return n[mw]=!0,n}var Bu;var ds={value:void 0,enumerable:!1},Ku="captureStackTrace"in Error?Error:null;function gw(e){let n=Ku;if(n){let t=n.stackTraceLimit;if(typeof t==="number"){try{n.stackTraceLimit=0}catch{return Ku=null,new e}try{return new e}finally{n.stackTraceLimit=t}}}return new e}function m(e,n,t,r){let o={};function i(g){this.def=g,this.constr=d,this.traits=new Set}i.prototype=o;let s=t,a=s&&new WeakSet;function c(g,h){if(!g._zod){ds.value=new i(h);try{Object.defineProperty(g,"_zod",ds)}finally{ds.value=void 0}}else if(g._zod.traits.has(e))return;if(g._zod.traits.add(e),n(g,h),a){let S=Object.getPrototypeOf(g),j=g._zod.constr.prototype,N=S;while(N&&N!==j)N=Object.getPrototypeOf(N);let D=N??S;if(!a.has(D))a.add(D),Ju(D,s)}let y=d.prototype;for(let S in y){if(!Object.prototype.hasOwnProperty.call(y,S))continue;if(!(S in g))g[S]=y[S].bind(g)}}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(g){let h=r?.Parent?gw(u):this;c(h,g);let y=h._zod.deferred;if(y){for(let j of y)j();h._zod.deferred=void 0}let S=globalThis.__zod_globalConfig?.postProcessor;if(S)S(h);return h}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(g)=>{if(r?.Parent&&g instanceof r.Parent)return!0;return g?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class dn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ct extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Bu=globalThis).__zod_globalConfig??(Bu.__zod_globalConfig={});var _e=globalThis.__zod_globalConfig;function Re(e){if(e)Object.assign(_e,e);return _e}function hw(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Jt,2)),e.message}function yw(e){this._zod.message=e}var bw={get:hw,set:yw,enumerable:!0,configurable:!0},fs={value:void 0,enumerable:!1},Wu=new WeakSet([Object.prototype,Error.prototype]),Gu=(e,n)=>{e.name="$ZodError",fs.value=n,Object.defineProperty(e,"issues",fs),fs.value=void 0,Object.defineProperty(e,"message",bw);let t=Object.getPrototypeOf(e);if(!Wu.has(t))Wu.add(t),Object.defineProperty(t,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},Hu=m("$ZodError",Gu),ms=m("$ZodError",Gu,void 0,{Parent:Error});function ww(e,n,t){if(!Object.prototype.hasOwnProperty.call(e,n))if(n==="__proto__")Object.defineProperty(e,n,{value:t(),writable:!0,enumerable:!0,configurable:!0});else e[n]=t();return e[n]}function Qu(e,n=(t)=>t.message){let t={},r=[];for(let o of e.issues)if(o.path.length>0)ww(t,o.path[0],()=>[]).push(n(o));else r.push(n(o));return{formErrors:r,fieldErrors:t}}function Yu(e,n=(t)=>t.message){let t={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)t._errors.push(n(s));else{let c=t,l=0;while(l<a.length){let u=a[l],d=l===a.length-1;if(u==="_errors"){if(d)c._errors.push(n(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,u))Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let g=c[u];if(d)g._errors.push(n(s));c=g,l++}}}};return r(e),t}function fo(e,n){return{callee:n?.callee??e,Err:n?.Err}}var Wt=(e)=>{let n=(t,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new dn;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Be(l,s,Re())));throw as(c,i?.callee??n),c}return a.value};return n},gs=Wt(ms),Gt=(e)=>{let n=async(t,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Be(l,s,Re())));throw as(c,i?.callee??n),c}return a.value};return n},hs=Gt(ms),mo=(e)=>(n,t,r)=>{let o=r?{...r,async:!1}:{async:!1},i=n._zod.run({value:t,issues:[]},o);if(i instanceof Promise)throw new dn;return i.issues.length?Xu(e,i.issues,o):{success:!0,data:i.value}};function Xu(e,n,t){let r;return{success:!1,get error(){if(!r)r=new e(n.map((o)=>Be(o,t,Re()))),n=void 0,t=void 0;return r},set error(o){r=o,n=void 0,t=void 0}}}var go=(e)=>async(n,t,r)=>{let o=r?{...r,async:!0}:{async:!0},i=n._zod.run({value:t,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?Xu(e,i.issues,o):{success:!0,data:i.value}};var xw=Symbol.for("zod.compile.invalid"),kw=Symbol.for("zod.compile.fallback"),ys=(e,n,t)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(n)!==xw)return!0;if(r.definite===!0&&t===void 0)return!1}return Sw(e,n,t)};function Sw(e,n,t){let r=t?{...t,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[kw]=!0,i=o({value:n,issues:[]},r);else i=e._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new dn;return i.issues.length===0}var bs=async(e,n,t)=>{let r=t?{...t,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:n,issues:[]},r);if(o instanceof Promise)o=await o;return o.issues.length===0},ed=(e)=>{let n=Wt(e),t=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return n(r,o,a,fo(t,s))};return t};var nd=(e)=>{let n=Wt(e),t=(r,o,i,s)=>n(r,o,i,fo(t,s));return t};var td=(e)=>{let n=Gt(e),t=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await n(r,o,a,fo(t,s))};return t};var rd=(e)=>{let n=Gt(e),t=async(r,o,i,s)=>await n(r,o,i,fo(t,s));return t};var od=(e)=>(n,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return mo(e)(n,t,o)};var id=(e)=>(n,t,r)=>mo(e)(n,t,r);var sd=(e)=>async(n,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return go(e)(n,t,o)};var ad=(e)=>async(n,t,r)=>go(e)(n,t,r);var jn={};no(jn,{anyString:()=>Us,base64:()=>zs,base64url:()=>Ds,bigint:()=>Ks,boolean:()=>Ws,browserEmail:()=>Aw,cidrv4:()=>Ts,cidrv6:()=>Ns,creditCard:()=>ho,cuid:()=>vs,cuid2:()=>xs,currencyCode:()=>qs,date:()=>Fs,datetime:()=>Js,domain:()=>Vs,duration:()=>Es,e164:()=>Ms,email:()=>js,emoji:()=>Rs,extendedDuration:()=>Iw,guid:()=>_s,hex:()=>Xs,hostname:()=>Ls,html5Email:()=>_w,httpProtocol:()=>Ht,iban:()=>yo,idnEmail:()=>Rw,integer:()=>Qt,ipv4:()=>As,ipv6:()=>Ps,ksuid:()=>Is,lowercase:()=>Qs,mac:()=>$s,md5_base64:()=>Nw,md5_base64url:()=>zw,md5_hex:()=>Tw,nanoid:()=>Cs,nanoidOfLength:()=>Os,null:()=>Gs,number:()=>Un,rfc5322Email:()=>jw,sha1_base64:()=>Lw,sha1_base64url:()=>Vw,sha1_hex:()=>Dw,sha256_base64:()=>qw,sha256_base64url:()=>Fw,sha256_hex:()=>Mw,sha384_base64:()=>Jw,sha384_base64url:()=>Uw,sha384_hex:()=>Zw,sha512_base64:()=>Kw,sha512_base64url:()=>Ww,sha512_hex:()=>Bw,string:()=>Bs,time:()=>Zs,ulid:()=>ks,undefined:()=>Hs,unicodeEmail:()=>cd,uppercase:()=>Ys,uuid:()=>Jn,uuid4:()=>Cw,uuid6:()=>Ow,uuid7:()=>Ew,xid:()=>Ss});var vs=/^[cC][0-9a-z]{6,}$/,xs=/^[0-9a-z]+$/,ks=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ss=/^[0-9a-vA-V]{20}$/,Is=/^[A-Za-z0-9]{27}$/,Cs=/^[a-zA-Z0-9_-]{21}$/;function Os(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Es=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Iw=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,_s=/^([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})$/,Jn=(e)=>{if(!e)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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Cw=Jn(4),Ow=Jn(6),Ew=Jn(7),js=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_w=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,jw=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,cd=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Rw=cd,Aw=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Pw="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Rs(){return new RegExp(Pw,"u")}var As=/^(?:(?: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])$/,Ps=/^(([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}|:))$/,$s=(e)=>{let n=tn(e??":");return new RegExp(`^(?:[0-9A-F]{2}${n}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${n}){5}[0-9a-f]{2}$`)},Ts=/^((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])$/,Ns=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,zs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ds=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ls=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Vs=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Ht=/^https?$/,Ms=/^\+[1-9]\d{6,14}$/,ho=/^\d(?:[ -]?\d){11,18}$/,qs=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,yo=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,ld="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function $w(e){return new RegExp(`^${e}$`)}var Fs=$w(ld);function ws(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Zs(e){return new RegExp(`^${ws(e)}$`)}function Js(e){let n=["Z"];if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let t=`${ws({precision:e.precision,seconds:!0})}(?:${n.join("|")})`,r=e.local?`${t}|${ws({precision:e.precision})}`:t;return new RegExp(`^${ld}T(?:${r})$`)}var Us=/^[\s\S]{0,}$/,Bs=(e)=>{let n=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},Ks=/^-?\d+n?$/,Qt=/^-?\d+$/,Un=/^-?\d+(?:\.\d+)?$/,Ws=/^(?:true|false)$/i,Gs=/^null$/i;var Hs=/^undefined$/i;var Qs=/^[^A-Z]*$/,Ys=/^[^a-z]*$/,Xs=/^[0-9a-fA-F]*$/;function Yt(e,n){return new RegExp(`^[A-Za-z0-9+/]{${e}}${n}$`)}function Xt(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Tw=/^[0-9a-fA-F]{32}$/,Nw=Yt(22,"=="),zw=Xt(22),Dw=/^[0-9a-fA-F]{40}$/,Lw=Yt(27,"="),Vw=Xt(27),Mw=/^[0-9a-fA-F]{64}$/,qw=Yt(43,"="),Fw=Xt(43),Zw=/^[0-9a-fA-F]{96}$/,Jw=Yt(64,""),Uw=Xt(64),Bw=/^[0-9a-fA-F]{128}$/,Kw=Yt(86,"=="),Ww=Xt(86);var le=m("$ZodCheck",(e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])}),ea=(e)=>{let n=e.value;return!ss(n)&&n.size!==void 0},na=(e)=>{let n=e.value;return!ss(n)&&n.length!==void 0},bo={number:"number",bigint:"bigint",object:"date"},ta=m("$ZodCheckLessThan",(e,n)=>{le.init(e,n);let t=bo[typeof n.value];e._zod.check=(r)=>{if(n.inclusive?r.value<=n.value:r.value<n.value)return;r.issues.push({origin:bo[typeof r.value]??t,code:"too_big",maximum:typeof n.value==="object"?n.value.getTime():n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),ra=m("$ZodCheckGreaterThan",(e,n)=>{le.init(e,n);let t=bo[typeof n.value];e._zod.check=(r)=>{if(n.inclusive?r.value>=n.value:r.value>n.value)return;r.issues.push({origin:bo[typeof r.value]??t,code:"too_small",minimum:typeof n.value==="object"?n.value.getTime():n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),ud=m("$ZodCheckMultipleOf",(e,n)=>{le.init(e,n),e._zod.check=(t)=>{if(typeof t.value!==typeof n.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof t.value==="bigint"?n.value!==BigInt(0)&&t.value%n.value===BigInt(0):Au(t.value,n.value)===0)return;t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:n.value,input:t.value,inst:e,continue:!n.abort})}}),dd=m("$ZodCheckNumberFormat",(e,n)=>{le.init(e,n),n.format=n.format||"float64";let t=n.format?.includes("int"),r=t?"int":"number",[o,i]=io[n.format];e._zod.check=(s)=>{let a=s.value;if(t){if(!Number.isInteger(a)){s.issues.push({expected:r,format:n.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort});return}}if(a<o)s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!n.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!n.abort})}}),pd=m("$ZodCheckBigIntFormat",(e,n)=>{le.init(e,n);let[t,r]=so[n.format];e._zod.check=(o)=>{let i=o.value;if(i<t)o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:t,inclusive:!0,inst:e,continue:!n.abort});if(i>r)o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!n.abort})}}),fd=m("$ZodCheckMaxSize",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=ea),e._zod.check=(r)=>{let o=r.value;if(o.size<=n.maximum)return;r.issues.push({origin:co(o),code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),md=m("$ZodCheckMinSize",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=ea),e._zod.check=(r)=>{let o=r.value;if(o.size>=n.minimum)return;r.issues.push({origin:co(o),code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),gd=m("$ZodCheckSizeEquals",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=ea),e._zod.check=(r)=>{let o=r.value,i=o.size;if(i===n.size)return;let s=i>n.size;r.issues.push({origin:co(o),...s?{code:"too_big",maximum:n.size}:{code:"too_small",minimum:n.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!n.abort})}}),hd=m("$ZodCheckMaxLength",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=na),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>n.maximum?lo(o):i)<=n.maximum)return;let a=uo(o);r.issues.push({origin:a,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),yd=m("$ZodCheckMinLength",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=na),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>=n.minimum&&i<n.minimum*2?lo(o):i)>=n.minimum)return;let a=uo(o);r.issues.push({origin:a,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),bd=m("$ZodCheckLengthEquals",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=na),e._zod.check=(r)=>{let o=r.value,i=o.length,s=typeof o==="string"&&i>=n.length&&i<=n.length*2?lo(o):i;if(s===n.length)return;let a=uo(o),c=s>n.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!n.abort})}}),er=m("$ZodCheckStringFormat",(e,n)=>{var t,r;if(le.init(e,n),n.pattern)(t=e._zod).check??(t.check=(o)=>{if(n.pattern.lastIndex=0,n.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:n.format,input:o.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})});else(r=e._zod).check??(r.check=()=>{})}),wd=m("$ZodCheckRegex",(e,n)=>{er.init(e,n),e._zod.check=(t)=>{if(n.pattern.lastIndex=0,n.pattern.test(t.value))return;t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}}),vd=m("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=Qs),er.init(e,n)}),xd=m("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=Ys),er.init(e,n)}),kd=m("$ZodCheckIncludes",(e,n)=>{le.init(e,n);let t=tn(n.includes),r=new RegExp(typeof n.position==="number"?`^.{${n.position},}${t}`:t);n.pattern=r,e._zod.check=(o)=>{if(o.value.includes(n.includes,n.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:o.value,inst:e,continue:!n.abort})}}),Sd=m("$ZodCheckStartsWith",(e,n)=>{le.init(e,n);let t=new RegExp(`^${tn(n.prefix)}.*`);n.pattern??(n.pattern=t),e._zod.check=(r)=>{if(r.value.startsWith(n.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:r.value,inst:e,continue:!n.abort})}}),Id=m("$ZodCheckEndsWith",(e,n)=>{le.init(e,n);let t=new RegExp(`.*${tn(n.suffix)}$`);n.pattern??(n.pattern=t),e._zod.check=(r)=>{if(r.value.endsWith(n.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:r.value,inst:e,continue:!n.abort})}});function wo(e,n,t){if(e.issues.length)n.issues.push(...Ue(t,e.issues))}var Cd=m("$ZodCheckProperty",(e,n)=>{le.init(e,n),e._zod.check=(t)=>{let r=n.schema._zod.run({value:t.value[n.property],issues:[]},{});if(r instanceof Promise)return r.then((o)=>wo(o,t,n.property));wo(r,t,n.property);return}}),Od=m("$ZodCheckProperties",(e,n)=>{le.init(e,n),Kt(e,Symbol.iterator,function*(){yield e});let t;e._zod.check=(r)=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}t??(t=Reflect.ownKeys(n.shape).map((s)=>[s,n.shape[s]]));let o=r.value,i;for(let[s,a]of t){let c=a._zod.run({value:o[s],issues:[]},{});if(c instanceof Promise)i??(i=[]),i.push(c.then((l)=>wo(l,r,s)));else wo(c,r,s)}if(i)return Promise.all(i).then(()=>{return});return}}),Ed=m("$ZodCheckMimeType",(e,n)=>{le.init(e,n);let t=new Set(n.mime);e._zod.check=(r)=>{if(t.has(r.value.type))return;r.issues.push({code:"invalid_value",values:n.mime,input:r.value.type,inst:e,continue:!n.abort})}}),_d=m("$ZodCheckOverwrite",(e,n)=>{le.init(e,n),e._zod.check=(t)=>{t.value=n.tx(t.value)}});class oa{constructor(e=[],n={}){this.content=[],this.indent=0,this.args=e,this.closed=n}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split(`
6
+ `};var Tu=Object.prototype.hasOwnProperty;function xe(e,n){var t,r;if(e===n)return!0;if(e&&n&&(t=e.constructor)===n.constructor){if(t===Date)return e.getTime()===n.getTime();if(t===RegExp)return e.toString()===n.toString();if(t===Array){if((r=e.length)===n.length)while(r--&&xe(e[r],n[r]));return r===-1}if(!t||typeof e==="object"){r=0;for(t in e){if(Tu.call(e,t)&&++r&&!Tu.call(n,t))return!1;if(!(t in n)||!xe(e[t],n[t]))return!1}return Object.keys(n).length===r}}return e!==e&&n!==n}function Zt(e){let n=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>n.indexOf(+r)===-1).map(([r,o])=>o)}function as(e,n="|"){return e.map((t)=>ds(t)).join(n)}function Jt(e,n){if(typeof n==="bigint")return n.toString();return n}class Nu{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Ut(e){return new Nu(e)}function cs(e){return e===null||e===void 0}function jn(e){let n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}function zu(e,n){let t=e/n,r=Math.round(t),o=4*Number.EPSILON*Math.max(Math.abs(t),1);if(Math.abs(t-r)<o)return 0;return t-r}var $u=Symbol("evaluating");function Du(e,n,t){let r=void 0;Object.defineProperty(e,n,{get(){if(r===$u)return;if(r===void 0)r=$u,r=t();return r},set(o){Object.defineProperty(e,n,{value:o})},configurable:!0})}function _e(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function Bt(e){let n=Object.getOwnPropertyDescriptor(e,"shape");return n?.get?n.get.raw:n?.value}function yn(e){return Bt(e._zod.def)??e._zod.def.shape}function qu(e,n,t){Object.defineProperty(e,n,{get(){let r=t();return _e(this,n,r),r},enumerable:!0,configurable:!0})}function Lu(e,n,t){if(n in e)_e(e,n,t);else e[n]=t}function Zn(e,n,t,r){let o=yn(n);for(let i of t){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)qu(e,i,()=>{let a=n._zod.def.shape[i];return r?r(a,i):a});else Lu(e,i,r?r(s.value,i):s.value)}}function pw(e,n){for(let t of Reflect.ownKeys(n)){let r=Object.getOwnPropertyDescriptor(n,t);if(!r.enumerable)continue;if(r.get)qu(e,t,()=>n[t]);else Lu(e,t,r.value)}}function Je(...e){let n={};for(let t of e){let r=Object.getOwnPropertyDescriptors(t);Object.assign(n,r)}return Object.defineProperties({},n)}function Vu(e){return JSON.stringify(e)}function Mu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ls="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ct(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Fu=Ut(()=>{if(je.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function wn(e){if(ct(e)===!1)return!1;let n=e.constructor;if(n===void 0)return!0;if(typeof n!=="function")return!0;let t=n.prototype;if(ct(t)===!1)return!1;if(Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)return!1;return!0}function us(e){if(wn(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var oo=new Set(["string","number","symbol"]),Zu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function nn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function un(e,n,t){let r=new e._zod.constr(n??e._zod.def);if(!n||t?.parent)r._zod.parent=e;return r}function C(e){let n=e;if(!n)return{};if(typeof n==="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");n.error=n.message}if(delete n.message,typeof n.error==="string")return{...n,error:()=>n.error};return n}function ds(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Ju(e){return Object.keys(e).filter((n)=>e[n]._zod.optin!==void 0&&e[n]._zod.optout==="optional")}var io=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),so={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function fw(e,n){let t=e._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Zn(i,e,ao(e,n)),un(e,Je(t,{shape:i,checks:[]}))}function ao(e,n){let t=yn(e),r=[];for(let o of Reflect.ownKeys(n)){if(!Object.getOwnPropertyDescriptor(t,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(n[o])r.push(o)}return r}function mw(e,n){let t=e._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(ao(e,n)),s={};return Zn(s,e,Reflect.ownKeys(yn(e)).filter((a)=>!i.has(a))),un(e,Je(t,{shape:s,checks:[]}))}function gw(e,n){if(!wn(n))throw Error("Invalid input to extend: expected a plain object");let t=e._zod.def.checks;if(t&&t.length>0){let o=yn(e);for(let i of Reflect.ownKeys(n))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return un(e,Je(e._zod.def,{shape:Uu(e,n)}))}function Uu(e,n){let t={};return Zn(t,e,Reflect.ownKeys(yn(e))),pw(t,n),t}function hw(e,n){if(!wn(n))throw Error("Invalid input to safeExtend: expected a plain object");return un(e,Je(e._zod.def,{shape:Uu(e,n)}))}function yw(e,n){if(!n?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let t={};Zn(t,e,Reflect.ownKeys(yn(e))),Zn(t,n,Reflect.ownKeys(yn(n)));let r=Je(e._zod.def,{shape:t,get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return un(e,r)}function Bu(e,n,t,r="partial"){let i=n._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=t?new Set(ao(n,t)):void 0,c={};return Zn(c,n,Reflect.ownKeys(yn(n)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),un(n,Je(n._zod.def,{shape:c,checks:[]}))}function bw(e,n,t){let r=t?new Set(ao(n,t)):void 0,o={};return Zn(o,n,Reflect.ownKeys(yn(n)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),un(n,Je(n._zod.def,{shape:o}))}function Le(e,n=0){if(e.aborted===!0)return!0;for(let t=n;t<e.issues.length;t++)if(e.issues[t]?.continue!==!0)return!0;return!1}function Ku(e,n=0){if(e.aborted===!0)return!0;for(let t=n;t<e.issues.length;t++)if(e.issues[t]?.continue===!1)return!0;return!1}function Ue(e,n){return n.map((t)=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function Ft(e){return typeof e==="string"?e:e?.message}function ps(e,n,t){var r;for(let o=n;o<e.length;o++)(r=e[o]).schema??(r.schema=t)}function Be(e,n,t){var r;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Ft(e.inst?._zod.def?.error?.(e))??Ft(i?.(e))??Ft(n?.error?.(e))??Ft(t.customError?.(e))??Ft(t.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,n?.reportInput)a.input=e.input;return a}function co(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var ww=/[\uD800-\uDBFF]/;function lo(e){let n=e.length;if(!ww.test(e))return n;let t=n;for(let r=0;r<n-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)t--,r++;return t}function uo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Wu(e){let n=typeof e;switch(n){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&"constructor"in t&&t.constructor)return t.constructor.name}}return n}function Jn(...e){let[n,t,r]=e;if(typeof n==="string")return{message:n,code:"custom",input:t,inst:r};return{...n}}function Gu(e,n){for(let t in n){let r=Object.getOwnPropertyDescriptor(n,t);if(r.get)Object.defineProperty(e,t,{...r,enumerable:!1});else vw(e,t,r.value)}}function bn(e,n,t,r=!0){return Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:r,value:t}),t}function Kt(e,n,t){return bn(e,n,t,!1)}function po(e,n){for(let t in e){let r=e[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get(){return bn(this,t,r(this))},set(o){bn(this,t,o)}})}return n}function vw(e,n,t){Object.defineProperty(e,n,{configurable:!0,get(){return this==null?t:bn(this,n,t.bind(this))},set(r){bn(this,n,r)}})}function kw(e,n){let t=Object.getPrototypeOf(e);return n in t?void 0:t}var ss,On=!1,xw={configurable:!0,get(){On=!0;return}};function B(e,n,t){let r=Object.getPrototypeOf(e._zod);if(n in r&&ss!==e._zod){ss=void 0;return}ss=e._zod,Object.defineProperty(r,n,{configurable:!0,get(){Object.defineProperty(this,n,xw);let o=On;On=!1;try{let i=t(this);if(On)delete this[n];else Object.defineProperty(this,n,{configurable:!0,writable:!0,value:i});return On=On||o,i}catch(i){throw delete this[n],On=On||o,i}},set(o){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:o})}})}function Sw(e,n,t,r){let o=kw(e,n);if(!o)return;Object.defineProperty(o,n,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,n,i),i.value=t(this),Object.defineProperty(this,n,i),i.value},set(i){Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var Iw="~constantCatch";function Hu(e){let n=()=>e;return n[Iw]=!0,n}var Qu;var fs={value:void 0,enumerable:!1},Yu="captureStackTrace"in Error?Error:null;function Cw(e){let n=Yu;if(n){let t=n.stackTraceLimit;if(typeof t==="number"){try{n.stackTraceLimit=0}catch{return Yu=null,new e}try{return new e}finally{n.stackTraceLimit=t}}}return new e}function m(e,n,t,r){let o={};function i(g){this.def=g,this.constr=d,this.traits=new Set}i.prototype=o;let s=t,a=s&&new WeakSet;function c(g,h){if(!g._zod){fs.value=new i(h);try{Object.defineProperty(g,"_zod",fs)}finally{fs.value=void 0}}else if(g._zod.traits.has(e))return;if(g._zod.traits.add(e),n(g,h),a){let S=Object.getPrototypeOf(g),R=g._zod.constr.prototype,N=S;while(N&&N!==R)N=Object.getPrototypeOf(N);let D=N??S;if(!a.has(D))a.add(D),Gu(D,s)}let y=d.prototype;for(let S in y){if(!Object.prototype.hasOwnProperty.call(y,S))continue;if(!(S in g))g[S]=y[S].bind(g)}}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(g){let h=r?.Parent?Cw(u):this;c(h,g);let y=h._zod.deferred;if(y){for(let R of y)R();h._zod.deferred=void 0}let S=globalThis.__zod_globalConfig?.postProcessor;if(S)S(h);return h}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(g)=>{if(r?.Parent&&g instanceof r.Parent)return!0;return g?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class dn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class lt extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Qu=globalThis).__zod_globalConfig??(Qu.__zod_globalConfig={});var je=globalThis.__zod_globalConfig;function Re(e){if(e)Object.assign(je,e);return je}function Ew(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Jt,2)),e.message}function Ow(e){this._zod.message=e}var jw={get:Ew,set:Ow,enumerable:!0,configurable:!0},gs={value:void 0,enumerable:!1},Xu=new WeakSet([Object.prototype,Error.prototype]),ed=(e,n)=>{e.name="$ZodError",gs.value=n,Object.defineProperty(e,"issues",gs),gs.value=void 0,Object.defineProperty(e,"message",jw);let t=Object.getPrototypeOf(e);if(!Xu.has(t))Xu.add(t),Object.defineProperty(t,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},nd=m("$ZodError",ed),hs=m("$ZodError",ed,void 0,{Parent:Error});function _w(e,n,t){if(!Object.prototype.hasOwnProperty.call(e,n))if(n==="__proto__")Object.defineProperty(e,n,{value:t(),writable:!0,enumerable:!0,configurable:!0});else e[n]=t();return e[n]}function td(e,n=(t)=>t.message){let t={},r=[];for(let o of e.issues)if(o.path.length>0)_w(t,o.path[0],()=>[]).push(n(o));else r.push(n(o));return{formErrors:r,fieldErrors:t}}function rd(e,n=(t)=>t.message){let t={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)t._errors.push(n(s));else{let c=t,l=0;while(l<a.length){let u=a[l],d=l===a.length-1;if(u==="_errors"){if(d)c._errors.push(n(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,u))Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let g=c[u];if(d)g._errors.push(n(s));c=g,l++}}}};return r(e),t}function fo(e,n){return{callee:n?.callee??e,Err:n?.Err}}var Wt=(e)=>{let n=(t,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new dn;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Be(l,s,Re())));throw ls(c,i?.callee??n),c}return a.value};return n},ys=Wt(hs),Gt=(e)=>{let n=async(t,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Be(l,s,Re())));throw ls(c,i?.callee??n),c}return a.value};return n},bs=Gt(hs),mo=(e)=>(n,t,r)=>{let o=r?{...r,async:!1}:{async:!1},i=n._zod.run({value:t,issues:[]},o);if(i instanceof Promise)throw new dn;return i.issues.length?od(e,i.issues,o):{success:!0,data:i.value}};function od(e,n,t){let r;return{success:!1,get error(){if(!r)r=new e(n.map((o)=>Be(o,t,Re()))),n=void 0,t=void 0;return r},set error(o){r=o,n=void 0,t=void 0}}}var go=(e)=>async(n,t,r)=>{let o=r?{...r,async:!0}:{async:!0},i=n._zod.run({value:t,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?od(e,i.issues,o):{success:!0,data:i.value}};var Aw=Symbol.for("zod.compile.invalid"),Pw=Symbol.for("zod.compile.fallback"),ws=(e,n,t)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(n)!==Aw)return!0;if(r.definite===!0&&t===void 0)return!1}return Tw(e,n,t)};function Tw(e,n,t){let r=t?{...t,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[Pw]=!0,i=o({value:n,issues:[]},r);else i=e._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new dn;return i.issues.length===0}var vs=async(e,n,t)=>{let r=t?{...t,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:n,issues:[]},r);if(o instanceof Promise)o=await o;return o.issues.length===0},id=(e)=>{let n=Wt(e),t=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return n(r,o,a,fo(t,s))};return t};var sd=(e)=>{let n=Wt(e),t=(r,o,i,s)=>n(r,o,i,fo(t,s));return t};var ad=(e)=>{let n=Gt(e),t=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await n(r,o,a,fo(t,s))};return t};var cd=(e)=>{let n=Gt(e),t=async(r,o,i,s)=>await n(r,o,i,fo(t,s));return t};var ld=(e)=>(n,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return mo(e)(n,t,o)};var ud=(e)=>(n,t,r)=>mo(e)(n,t,r);var dd=(e)=>async(n,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return go(e)(n,t,o)};var pd=(e)=>async(n,t,r)=>go(e)(n,t,r);var _n={};no(_n,{anyString:()=>Ks,base64:()=>qs,base64url:()=>Ls,bigint:()=>Gs,boolean:()=>Hs,browserEmail:()=>Mw,cidrv4:()=>zs,cidrv6:()=>Ds,creditCard:()=>ho,cuid:()=>xs,cuid2:()=>Ss,currencyCode:()=>Zs,date:()=>Js,datetime:()=>Bs,domain:()=>Ms,duration:()=>_s,e164:()=>Fs,email:()=>As,emoji:()=>Ps,extendedDuration:()=>$w,guid:()=>Rs,hex:()=>na,hostname:()=>Vs,html5Email:()=>qw,httpProtocol:()=>Ht,iban:()=>yo,idnEmail:()=>Vw,integer:()=>Qt,ipv4:()=>Ts,ipv6:()=>$s,ksuid:()=>Es,lowercase:()=>Xs,mac:()=>Ns,md5_base64:()=>Uw,md5_base64url:()=>Bw,md5_hex:()=>Jw,nanoid:()=>Os,nanoidOfLength:()=>js,null:()=>Qs,number:()=>Bn,rfc5322Email:()=>Lw,sha1_base64:()=>Ww,sha1_base64url:()=>Gw,sha1_hex:()=>Kw,sha256_base64:()=>Qw,sha256_base64url:()=>Yw,sha256_hex:()=>Hw,sha384_base64:()=>ev,sha384_base64url:()=>nv,sha384_hex:()=>Xw,sha512_base64:()=>rv,sha512_base64url:()=>ov,sha512_hex:()=>tv,string:()=>Ws,time:()=>Us,ulid:()=>Is,undefined:()=>Ys,unicodeEmail:()=>fd,uppercase:()=>ea,uuid:()=>Un,uuid4:()=>Nw,uuid6:()=>zw,uuid7:()=>Dw,xid:()=>Cs});var xs=/^[cC][0-9a-z]{6,}$/,Ss=/^[0-9a-z]+$/,Is=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Cs=/^[0-9a-vA-V]{20}$/,Es=/^[A-Za-z0-9]{27}$/,Os=/^[a-zA-Z0-9_-]{21}$/;function js(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var _s=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$w=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rs=/^([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})$/,Un=(e)=>{if(!e)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)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Nw=Un(4),zw=Un(6),Dw=Un(7),As=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qw=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Lw=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,fd=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Vw=fd,Mw=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Fw="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ps(){return new RegExp(Fw,"u")}var Ts=/^(?:(?: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])$/,$s=/^(([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}|:))$/,Ns=(e)=>{let n=nn(e??":");return new RegExp(`^(?:[0-9A-F]{2}${n}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${n}){5}[0-9a-f]{2}$`)},zs=/^((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])$/,Ds=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ls=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Vs=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Ms=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Ht=/^https?$/,Fs=/^\+[1-9]\d{6,14}$/,ho=/^\d(?:[ -]?\d){11,18}$/,Zs=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,yo=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,md="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Zw(e){return new RegExp(`^${e}$`)}var Js=Zw(md);function ks(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Us(e){return new RegExp(`^${ks(e)}$`)}function Bs(e){let n=["Z"];if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let t=`${ks({precision:e.precision,seconds:!0})}(?:${n.join("|")})`,r=e.local?`${t}|${ks({precision:e.precision})}`:t;return new RegExp(`^${md}T(?:${r})$`)}var Ks=/^[\s\S]{0,}$/,Ws=(e)=>{let n=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},Gs=/^-?\d+n?$/,Qt=/^-?\d+$/,Bn=/^-?\d+(?:\.\d+)?$/,Hs=/^(?:true|false)$/i,Qs=/^null$/i;var Ys=/^undefined$/i;var Xs=/^[^A-Z]*$/,ea=/^[^a-z]*$/,na=/^[0-9a-fA-F]*$/;function Yt(e,n){return new RegExp(`^[A-Za-z0-9+/]{${e}}${n}$`)}function Xt(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Jw=/^[0-9a-fA-F]{32}$/,Uw=Yt(22,"=="),Bw=Xt(22),Kw=/^[0-9a-fA-F]{40}$/,Ww=Yt(27,"="),Gw=Xt(27),Hw=/^[0-9a-fA-F]{64}$/,Qw=Yt(43,"="),Yw=Xt(43),Xw=/^[0-9a-fA-F]{96}$/,ev=Yt(64,""),nv=Xt(64),tv=/^[0-9a-fA-F]{128}$/,rv=Yt(86,"=="),ov=Xt(86);var le=m("$ZodCheck",(e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])}),ta=(e)=>{let n=e.value;return!cs(n)&&n.size!==void 0},ra=(e)=>{let n=e.value;return!cs(n)&&n.length!==void 0},bo={number:"number",bigint:"bigint",object:"date"},oa=m("$ZodCheckLessThan",(e,n)=>{le.init(e,n);let t=bo[typeof n.value];e._zod.check=(r)=>{if(n.inclusive?r.value<=n.value:r.value<n.value)return;r.issues.push({origin:bo[typeof r.value]??t,code:"too_big",maximum:typeof n.value==="object"?n.value.getTime():n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),ia=m("$ZodCheckGreaterThan",(e,n)=>{le.init(e,n);let t=bo[typeof n.value];e._zod.check=(r)=>{if(n.inclusive?r.value>=n.value:r.value>n.value)return;r.issues.push({origin:bo[typeof r.value]??t,code:"too_small",minimum:typeof n.value==="object"?n.value.getTime():n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),gd=m("$ZodCheckMultipleOf",(e,n)=>{le.init(e,n),e._zod.check=(t)=>{if(typeof t.value!==typeof n.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof t.value==="bigint"?n.value!==BigInt(0)&&t.value%n.value===BigInt(0):zu(t.value,n.value)===0)return;t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:n.value,input:t.value,inst:e,continue:!n.abort})}}),hd=m("$ZodCheckNumberFormat",(e,n)=>{le.init(e,n),n.format=n.format||"float64";let t=n.format?.includes("int"),r=t?"int":"number",[o,i]=io[n.format];e._zod.check=(s)=>{let a=s.value;if(t){if(!Number.isInteger(a)){s.issues.push({expected:r,format:n.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort});return}}if(a<o)s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!n.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!n.abort})}}),yd=m("$ZodCheckBigIntFormat",(e,n)=>{le.init(e,n);let[t,r]=so[n.format];e._zod.check=(o)=>{let i=o.value;if(i<t)o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:t,inclusive:!0,inst:e,continue:!n.abort});if(i>r)o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!n.abort})}}),bd=m("$ZodCheckMaxSize",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=ta),e._zod.check=(r)=>{let o=r.value;if(o.size<=n.maximum)return;r.issues.push({origin:co(o),code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),wd=m("$ZodCheckMinSize",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=ta),e._zod.check=(r)=>{let o=r.value;if(o.size>=n.minimum)return;r.issues.push({origin:co(o),code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),vd=m("$ZodCheckSizeEquals",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=ta),e._zod.check=(r)=>{let o=r.value,i=o.size;if(i===n.size)return;let s=i>n.size;r.issues.push({origin:co(o),...s?{code:"too_big",maximum:n.size}:{code:"too_small",minimum:n.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!n.abort})}}),kd=m("$ZodCheckMaxLength",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=ra),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>n.maximum?lo(o):i)<=n.maximum)return;let a=uo(o);r.issues.push({origin:a,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),xd=m("$ZodCheckMinLength",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=ra),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>=n.minimum&&i<n.minimum*2?lo(o):i)>=n.minimum)return;let a=uo(o);r.issues.push({origin:a,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Sd=m("$ZodCheckLengthEquals",(e,n)=>{var t;le.init(e,n),(t=e._zod.def).when??(t.when=ra),e._zod.check=(r)=>{let o=r.value,i=o.length,s=typeof o==="string"&&i>=n.length&&i<=n.length*2?lo(o):i;if(s===n.length)return;let a=uo(o),c=s>n.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!n.abort})}}),er=m("$ZodCheckStringFormat",(e,n)=>{var t,r;if(le.init(e,n),n.pattern)(t=e._zod).check??(t.check=(o)=>{if(n.pattern.lastIndex=0,n.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:n.format,input:o.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})});else(r=e._zod).check??(r.check=()=>{})}),Id=m("$ZodCheckRegex",(e,n)=>{er.init(e,n),e._zod.check=(t)=>{if(n.pattern.lastIndex=0,n.pattern.test(t.value))return;t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}}),Cd=m("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=Xs),er.init(e,n)}),Ed=m("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=ea),er.init(e,n)}),Od=m("$ZodCheckIncludes",(e,n)=>{le.init(e,n);let t=nn(n.includes),r=new RegExp(typeof n.position==="number"?`^.{${n.position},}${t}`:t);n.pattern=r,e._zod.check=(o)=>{if(o.value.includes(n.includes,n.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:o.value,inst:e,continue:!n.abort})}}),jd=m("$ZodCheckStartsWith",(e,n)=>{le.init(e,n);let t=new RegExp(`^${nn(n.prefix)}.*`);n.pattern??(n.pattern=t),e._zod.check=(r)=>{if(r.value.startsWith(n.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:r.value,inst:e,continue:!n.abort})}}),_d=m("$ZodCheckEndsWith",(e,n)=>{le.init(e,n);let t=new RegExp(`.*${nn(n.suffix)}$`);n.pattern??(n.pattern=t),e._zod.check=(r)=>{if(r.value.endsWith(n.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:r.value,inst:e,continue:!n.abort})}});function wo(e,n,t){if(e.issues.length)n.issues.push(...Ue(t,e.issues))}var Rd=m("$ZodCheckProperty",(e,n)=>{le.init(e,n),e._zod.check=(t)=>{let r=n.schema._zod.run({value:t.value[n.property],issues:[]},{});if(r instanceof Promise)return r.then((o)=>wo(o,t,n.property));wo(r,t,n.property);return}}),Ad=m("$ZodCheckProperties",(e,n)=>{le.init(e,n),Kt(e,Symbol.iterator,function*(){yield e});let t;e._zod.check=(r)=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}t??(t=Reflect.ownKeys(n.shape).map((s)=>[s,n.shape[s]]));let o=r.value,i;for(let[s,a]of t){let c=a._zod.run({value:o[s],issues:[]},{});if(c instanceof Promise)i??(i=[]),i.push(c.then((l)=>wo(l,r,s)));else wo(c,r,s)}if(i)return Promise.all(i).then(()=>{return});return}}),Pd=m("$ZodCheckMimeType",(e,n)=>{le.init(e,n);let t=new Set(n.mime);e._zod.check=(r)=>{if(t.has(r.value.type))return;r.issues.push({code:"invalid_value",values:n.mime,input:r.value.type,inst:e,continue:!n.abort})}}),Td=m("$ZodCheckOverwrite",(e,n)=>{le.init(e,n),e._zod.check=(t)=>{t.value=n.tx(t.value)}});class sa{constructor(e=[],n={}){this.content=[],this.indent=0,this.args=e,this.closed=n}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split(`
7
7
  `).filter((i)=>i),r=Math.min(...t.map((i)=>i.length-i.trimStart().length)),o=t.map((i)=>i.slice(r)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,n=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
8
8
  ${n.join(`
9
9
  `)}
10
- };`)(...Object.values(this.closed))}}var Rd={major:4,minor:6,patch:5};var M=m("$ZodType",(e,n)=>{var t;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=Rd;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{if(a.memo)return a;let u=Ve(a),d;for(let g of c){if(g._zod.def.when){if(Fu(a))continue;if(!g._zod.def.when(a))continue}else if(u)continue;let h=a.issues.length,y=g._zod.check(a);if(y instanceof Promise&&l?.async===!1)throw new dn;if(d||y instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await y,a.issues.length===h)return;if(us(a.issues,h,e),!u)u=Ve(a,h)});else{if(a.issues.length===h)continue;if(us(a.issues,h,e),!u)u=Ve(a,h)}}if(d)return d.then(()=>a);return a},s=(a,c,l)=>{if(Ve(a))return a.aborted=!0,a;let u=i(c,o,l);if(u instanceof Promise){if(l.async===!1)throw new dn;return u.then((d)=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((d)=>s(d,a,c));return s(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new dn;return l.then((u)=>i(u,o,c))}return i(l,o,c)}}},{get "~standard"(){return Kt(this,"~standard",aa(this))},set "~standard"(e){bn(this,"~standard",e)}}),Kd=(e,n)=>e.issues.length?{issues:e.issues.map((t)=>Be(t,n,Re()))}:{value:e.value};async function Gw(e,n){let t={async:!0};return Kd(await e._zod.run({value:n,issues:[]},t),t)}function aa(e){return{validate:(n)=>{let t={async:!1};try{let r=e._zod.run({value:n,issues:[]},t);if(!(r instanceof Promise))return Kd(r,t)}catch(r){}return Gw(e,n)},vendor:"zod",version:1}}var lt=m("$ZodString",(e,n)=>{M.init(e,n),e._zod.pattern=n.pattern??Us,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=String(t.value)}catch(o){}if(typeof t.value==="string")return t;return t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:e}),t}}),se=m("$ZodStringFormat",(e,n)=>{er.init(e,n),lt.init(e,n)}),Wd=m("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=_s),se.init(e,n)}),Gd=m("$ZodUUID",(e,n)=>{if(n.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(r===void 0)throw Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=Jn(r))}else n.pattern??(n.pattern=Jn());se.init(e,n)}),Hd=m("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=js),se.init(e,n)}),Qd=1,So=2;function Yd(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Hw(e,n){if(!("normalize"in n)&&!("hostname"in n)&&!("protocol"in n))return Yd(e)||So;return Qw(e,n)}function Qw(e,n){if(!n.normalize&&n.protocol?.source===Ht.source&&!/^https?:\/\//i.test(e))return Qd;try{if(typeof URL<"u"){let t=URL;if(typeof t.parse==="function")return t.parse(e)??So}return new URL(e)}catch{return So}}var Yw=/[\t\n\r]/g;function Ad(e){return e.replace(Yw,"")}function Xw(e,n){return n.lastIndex=0,n.test(e.hostname)}function ev(e,n){return n.lastIndex=0,n.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Xd=m("$ZodURL",(e,n)=>{se.init(e,n),e._zod.check=(t)=>{try{let r=t.value.trim(),o=Hw(r,n);if(o===Qd){t.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:t.value,inst:e,continue:!n.abort});return}if(o===So){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort});return}if(o===!0){t.value=Ad(r);return}if(n.hostname&&!Xw(o,n.hostname))t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:t.value,inst:e,continue:!n.abort});if(n.protocol&&!ev(o,n.protocol))t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:t.value,inst:e,continue:!n.abort});t.value=n.normalize?o.href:Ad(r);return}catch(r){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort})}}}),ep=m("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=Rs()),se.init(e,n)}),np=m("$ZodNanoID",(e,n)=>{if(n.length!==void 0&&(!Number.isInteger(n.length)||n.length<1))throw Error(`Invalid nanoid length: ${n.length}`);n.pattern??(n.pattern=n.length===void 0?Cs:Os(n.length)),se.init(e,n)}),tp=m("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=vs),se.init(e,n)}),rp=m("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=xs),se.init(e,n)}),op=m("$ZodULID",(e,n)=>{n.pattern??(n.pattern=ks),se.init(e,n)}),ip=m("$ZodXID",(e,n)=>{n.pattern??(n.pattern=Ss),se.init(e,n)}),sp=m("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=Is),se.init(e,n)}),ap=m("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=Js(n)),se.init(e,n)}),cp=m("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=Fs),se.init(e,n)}),lp=m("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=Zs(n)),se.init(e,n)}),up=m("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=Es),se.init(e,n)}),dp=m("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=As),se.init(e,n)}),nv=/^[0-9a-fA-F:.]+$/;function pp(e){if(!nv.test(e))return!1;return Yd(`http://[${e}]`)}var fp=m("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=Ps),se.init(e,n),e._zod.check=(t)=>{if(!pp(t.value))t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e,continue:!n.abort})}}),mp=m("$ZodMAC",(e,n)=>{n.pattern??(n.pattern=$s(n.delimiter)),se.init(e,n)}),gp=m("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=Ts),se.init(e,n)});function tv(e){let n=e.split("/");if(n.length!==2)return!1;let[t,r]=n;if(!r)return!1;let o=Number(r);if(`${o}`!==r)return!1;if(o<0||o>128)return!1;return pp(t)}var hp=m("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=Ns),se.init(e,n),e._zod.check=(t)=>{if(!tv(t.value))t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e,continue:!n.abort})}});function yp(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var ca=/^[0-9a-zA-Z+/]*={0,2}$/,bp=m("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=ca),se.init(e,n),e._zod.check=(t)=>{if(yp(t.value))return;t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!n.abort})}}),Co=/^[A-Za-z0-9_-]*$/;function rv(e){if(!Co.test(e))return!1;let n=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),t=n.padEnd(Math.ceil(n.length/4)*4,"=");return yp(t)}var wp=m("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=Co),se.init(e,n),e._zod.check=(t)=>{if(rv(t.value))return;t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e,continue:!n.abort})}}),vp=m("$ZodE164",(e,n)=>{n.pattern??(n.pattern=Ms),se.init(e,n)}),ov=/[- ]/g;function iv(e){let n=e.length,t=1,r=0;while(n){let o=e.charCodeAt(--n)-48;t^=1,r+=t?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function sv(e){if(!ho.test(e))return!1;return iv(e.replace(ov,""))}var xp=m("$ZodCreditCard",(e,n)=>{n.pattern??(n.pattern=ho),se.init(e,n),e._zod.check=(t)=>{if(sv(t.value))return;t.issues.push({code:"invalid_format",format:"credit_card",input:t.value,inst:e,continue:!n.abort})}});function av(e){let n=0,t=e.length;for(let r=4;r<t;r++){let o=e.charCodeAt(r);n=(o>=65?n*100+(o-55):n*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);n=(o>=65?n*100+(o-55):n*10+(o-48))%97}return n===1}function cv(e){if(!yo.test(e))return!1;return av(e)}var kp=m("$ZodIBAN",(e,n)=>{n.pattern??(n.pattern=yo),se.init(e,n),e._zod.check=(t)=>{if(cv(t.value))return;t.issues.push({code:"invalid_format",format:"iban",input:t.value,inst:e,continue:!n.abort})}});function lv(e,n=null){try{let t=e.split(".");if(t.length!==3)return!1;let[r]=t;if(!r)return!1;let o=JSON.parse(atob(r));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(n&&(!("alg"in o)||o.alg!==n))return!1;return!0}catch{return!1}}var Sp=m("$ZodJWT",(e,n)=>{se.init(e,n),e._zod.check=(t)=>{if(lv(t.value,n.alg))return;t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!n.abort})}}),Ip=m("$ZodCustomStringFormat",(e,n)=>{se.init(e,n),e._zod.check=(t)=>{if(n.fn(t.value))return;t.issues.push({code:"invalid_format",format:n.format,input:t.value,inst:e,continue:!n.abort})}}),la=m("$ZodNumber",(e,n)=>{M.init(e,n),e._zod.pattern=Un,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=Number(t.value)}catch(s){}let o=t.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return t;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return t.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),t}}),Cp=m("$ZodNumberFormat",(e,n)=>{dd.init(e,n),la.init(e,n)}),Oo=m("$ZodBoolean",(e,n)=>{M.init(e,n),e._zod.pattern=Ws,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=Boolean(t.value)}catch(i){}let o=t.value;if(typeof o==="boolean")return t;return t.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),t}}),ua=m("$ZodBigInt",(e,n)=>{M.init(e,n),e._zod.pattern=Ks,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=BigInt(t.value)}catch(o){}if(typeof t.value==="bigint")return t;return t.issues.push({expected:"bigint",code:"invalid_type",input:t.value,inst:e}),t}}),Op=m("$ZodBigIntFormat",(e,n)=>{pd.init(e,n),ua.init(e,n)}),Ep=m("$ZodSymbol",(e,n)=>{M.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o==="symbol")return t;return t.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),t}}),_p=m("$ZodUndefined",(e,n)=>{M.init(e,n),e._zod.pattern=Hs,e._zod.values=new Set([void 0]),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o>"u")return t;return t.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),t}}),jp=m("$ZodNull",(e,n)=>{M.init(e,n),e._zod.pattern=Gs,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let o=t.value;if(o===null)return t;return t.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),t}}),Rp=m("$ZodAny",(e,n)=>{M.init(e,n),e._zod.parse=(t)=>t}),Ap=m("$ZodUnknown",(e,n)=>{M.init(e,n),e._zod.parse=(t)=>t}),Pp=m("$ZodNever",(e,n)=>{M.init(e,n),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),$p=m("$ZodVoid",(e,n)=>{M.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o>"u")return t;return t.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),t}}),Tp=m("$ZodDate",(e,n)=>{M.init(e,n),e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=new Date(t.value)}catch(a){}let o=t.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return t;return t.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),t}});function Pd(e,n,t){if(e.issues.length)n.issues.push(...Ue(t,e.issues));n.value[t]=e.value}var Np=m("$ZodArray",(e,n)=>{M.init(e,n);let t=_e.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=t?t.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let l=i[c],u=n.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>Pd(d,r,c)));else if(Pd(u,r,c),a&&u.issues.length!==0&&Ve(u))break}if(s.length)return Promise.all(s).then(()=>r);return r}});function Io(e,n,t,r,o,i){let s=t in r,a=i==="optional";if(!s&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!s)return;n.issues.push(...Ue(t,e.issues))}if(!s&&o===void 0){if(!e.issues.length)n.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[t]});return}if(e.value===void 0){if(s||o==="defaulted"&&!a)n.value[t]=void 0}else n.value[t]=e.value}var uv=[];function zp(e){let n=Object.keys(e.shape),t=Object.getOwnPropertySymbols(e.shape),r=t.length?t:uv,o=r.length?[...n,...r]:n;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Vu(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(i)}}function Dp(e,n,t,r,o,i,s){let a=[],c=o.keySet,l=o.catchall._zod,u=l.def.type,{optin:d,optout:g}=l,h=0;for(let y in n){if(s&&t.issues.length!==h){if(Ve(t,h))break;h=t.issues.length}if(c.has(y))continue;if(y==="__proto__"){if(u==="never")a.push(y);continue}if(u==="never"){a.push(y);continue}let S=l.run({value:n[y],issues:[]},r);if(S instanceof Promise)e.push(S.then((j)=>Io(j,t,y,n,d,g)));else Io(S,t,y,n,d,g)}if(a.length)t.issues.push({code:"unrecognized_keys",keys:a,input:n,inst:i,continue:!0});if(!e.length)return t;return Promise.all(e).then(()=>t)}var dv=m("$ZodObject",(e,n)=>{M.init(e,n);let t=Object.getOwnPropertyDescriptor(n,"shape"),r=t?.get?t.get.raw:n.shape??{};if(r){let l=()=>{let u={...r};return Object.defineProperty(n,"shape",{value:u}),l.raw=u,u};l.raw=r,Object.defineProperty(n,"shape",{get:l})}let o=Ut(()=>zp(n));B(e,"propValues",(l)=>{let u=l.def.shape,d={};for(let g in u){let h=u[g]._zod;if(h.values){if(!Object.prototype.hasOwnProperty.call(d,g))je(d,g,new Set);for(let y of h.values)d[g].add(y);if(h.optin!==void 0)d[g].add(void 0)}}return d});let i=at,s=n.catchall,a,c=_e.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=o.value);let d=l.value;if(!i(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let g=[],h=a.shape,y=u?.abortEarly,S=l.issues.length;for(let j of a.allKeys){if(y&&l.issues.length!==S){if(Ve(l,S))break;S=l.issues.length}if(j==="__proto__")continue;let N=h[j],D=N._zod.optin,V=N._zod.optout,Ee=N._zod.run({value:d[j],issues:[]},u);if(Ee instanceof Promise)g.push(Ee.then((fe)=>Io(fe,l,j,d,D,V)));else Io(Ee,l,j,d,D,V)}if(!s)return g.length?Promise.all(g).then(()=>l):l;return Dp(g,d,l,u,o.value,e,y===!0)}}),Lp=m("$ZodObjectJIT",(e,n)=>{dv.init(e,n);let t=e._zod.parse,r=Ut(()=>zp(n)),o=_e.memoizer,i=(h)=>{let y=r.value,S=y.symbolKeys,j=new oa(["payload","ctx"],{shape:h,inst:e,memo:o,syms:S}),N=(fe)=>`shape[${fe}]._zod.run({ value: input[${fe}], issues: [] }, ctx)`,D=(fe,ie)=>`
10
+ };`)(...Object.values(this.closed))}}var Nd={major:4,minor:6,patch:5};var V=m("$ZodType",(e,n)=>{var t;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=Nd;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{if(a.memo)return a;let u=Le(a),d;for(let g of c){if(g._zod.def.when){if(Ku(a))continue;if(!g._zod.def.when(a))continue}else if(u)continue;let h=a.issues.length,y=g._zod.check(a);if(y instanceof Promise&&l?.async===!1)throw new dn;if(d||y instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await y,a.issues.length===h)return;if(ps(a.issues,h,e),!u)u=Le(a,h)});else{if(a.issues.length===h)continue;if(ps(a.issues,h,e),!u)u=Le(a,h)}}if(d)return d.then(()=>a);return a},s=(a,c,l)=>{if(Le(a))return a.aborted=!0,a;let u=i(c,o,l);if(u instanceof Promise){if(l.async===!1)throw new dn;return u.then((d)=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((d)=>s(d,a,c));return s(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new dn;return l.then((u)=>i(u,o,c))}return i(l,o,c)}}},{get "~standard"(){return Kt(this,"~standard",la(this))},set "~standard"(e){bn(this,"~standard",e)}}),Yd=(e,n)=>e.issues.length?{issues:e.issues.map((t)=>Be(t,n,Re()))}:{value:e.value};async function iv(e,n){let t={async:!0};return Yd(await e._zod.run({value:n,issues:[]},t),t)}function la(e){return{validate:(n)=>{let t={async:!1};try{let r=e._zod.run({value:n,issues:[]},t);if(!(r instanceof Promise))return Yd(r,t)}catch(r){}return iv(e,n)},vendor:"zod",version:1}}var ut=m("$ZodString",(e,n)=>{V.init(e,n),e._zod.pattern=n.pattern??Ks,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=String(t.value)}catch(o){}if(typeof t.value==="string")return t;return t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:e}),t}}),se=m("$ZodStringFormat",(e,n)=>{er.init(e,n),ut.init(e,n)}),Xd=m("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=Rs),se.init(e,n)}),ep=m("$ZodUUID",(e,n)=>{if(n.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(r===void 0)throw Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=Un(r))}else n.pattern??(n.pattern=Un());se.init(e,n)}),np=m("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=As),se.init(e,n)}),tp=1,So=2;function rp(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function sv(e,n){if(!("normalize"in n)&&!("hostname"in n)&&!("protocol"in n))return rp(e)||So;return av(e,n)}function av(e,n){if(!n.normalize&&n.protocol?.source===Ht.source&&!/^https?:\/\//i.test(e))return tp;try{if(typeof URL<"u"){let t=URL;if(typeof t.parse==="function")return t.parse(e)??So}return new URL(e)}catch{return So}}var cv=/[\t\n\r]/g;function zd(e){return e.replace(cv,"")}function lv(e,n){return n.lastIndex=0,n.test(e.hostname)}function uv(e,n){return n.lastIndex=0,n.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var op=m("$ZodURL",(e,n)=>{se.init(e,n),e._zod.check=(t)=>{try{let r=t.value.trim(),o=sv(r,n);if(o===tp){t.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:t.value,inst:e,continue:!n.abort});return}if(o===So){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort});return}if(o===!0){t.value=zd(r);return}if(n.hostname&&!lv(o,n.hostname))t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:t.value,inst:e,continue:!n.abort});if(n.protocol&&!uv(o,n.protocol))t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:t.value,inst:e,continue:!n.abort});t.value=n.normalize?o.href:zd(r);return}catch(r){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort})}}}),ip=m("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=Ps()),se.init(e,n)}),sp=m("$ZodNanoID",(e,n)=>{if(n.length!==void 0&&(!Number.isInteger(n.length)||n.length<1))throw Error(`Invalid nanoid length: ${n.length}`);n.pattern??(n.pattern=n.length===void 0?Os:js(n.length)),se.init(e,n)}),ap=m("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=xs),se.init(e,n)}),cp=m("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=Ss),se.init(e,n)}),lp=m("$ZodULID",(e,n)=>{n.pattern??(n.pattern=Is),se.init(e,n)}),up=m("$ZodXID",(e,n)=>{n.pattern??(n.pattern=Cs),se.init(e,n)}),dp=m("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=Es),se.init(e,n)}),pp=m("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=Bs(n)),se.init(e,n)}),fp=m("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=Js),se.init(e,n)}),mp=m("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=Us(n)),se.init(e,n)}),gp=m("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=_s),se.init(e,n)}),hp=m("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=Ts),se.init(e,n)}),dv=/^[0-9a-fA-F:.]+$/;function yp(e){if(!dv.test(e))return!1;return rp(`http://[${e}]`)}var bp=m("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=$s),se.init(e,n),e._zod.check=(t)=>{if(!yp(t.value))t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e,continue:!n.abort})}}),wp=m("$ZodMAC",(e,n)=>{n.pattern??(n.pattern=Ns(n.delimiter)),se.init(e,n)}),vp=m("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=zs),se.init(e,n)});function pv(e){let n=e.split("/");if(n.length!==2)return!1;let[t,r]=n;if(!r)return!1;let o=Number(r);if(`${o}`!==r)return!1;if(o<0||o>128)return!1;return yp(t)}var kp=m("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=Ds),se.init(e,n),e._zod.check=(t)=>{if(!pv(t.value))t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e,continue:!n.abort})}});function xp(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var ua=/^[0-9a-zA-Z+/]*={0,2}$/,Sp=m("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=ua),se.init(e,n),e._zod.check=(t)=>{if(xp(t.value))return;t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!n.abort})}}),Co=/^[A-Za-z0-9_-]*$/;function fv(e){if(!Co.test(e))return!1;let n=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),t=n.padEnd(Math.ceil(n.length/4)*4,"=");return xp(t)}var Ip=m("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=Co),se.init(e,n),e._zod.check=(t)=>{if(fv(t.value))return;t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e,continue:!n.abort})}}),Cp=m("$ZodE164",(e,n)=>{n.pattern??(n.pattern=Fs),se.init(e,n)}),mv=/[- ]/g;function gv(e){let n=e.length,t=1,r=0;while(n){let o=e.charCodeAt(--n)-48;t^=1,r+=t?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function hv(e){if(!ho.test(e))return!1;return gv(e.replace(mv,""))}var Ep=m("$ZodCreditCard",(e,n)=>{n.pattern??(n.pattern=ho),se.init(e,n),e._zod.check=(t)=>{if(hv(t.value))return;t.issues.push({code:"invalid_format",format:"credit_card",input:t.value,inst:e,continue:!n.abort})}});function yv(e){let n=0,t=e.length;for(let r=4;r<t;r++){let o=e.charCodeAt(r);n=(o>=65?n*100+(o-55):n*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);n=(o>=65?n*100+(o-55):n*10+(o-48))%97}return n===1}function bv(e){if(!yo.test(e))return!1;return yv(e)}var Op=m("$ZodIBAN",(e,n)=>{n.pattern??(n.pattern=yo),se.init(e,n),e._zod.check=(t)=>{if(bv(t.value))return;t.issues.push({code:"invalid_format",format:"iban",input:t.value,inst:e,continue:!n.abort})}});function wv(e,n=null){try{let t=e.split(".");if(t.length!==3)return!1;let[r]=t;if(!r)return!1;let o=JSON.parse(atob(r));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(n&&(!("alg"in o)||o.alg!==n))return!1;return!0}catch{return!1}}var jp=m("$ZodJWT",(e,n)=>{se.init(e,n),e._zod.check=(t)=>{if(wv(t.value,n.alg))return;t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!n.abort})}}),_p=m("$ZodCustomStringFormat",(e,n)=>{se.init(e,n),e._zod.check=(t)=>{if(n.fn(t.value))return;t.issues.push({code:"invalid_format",format:n.format,input:t.value,inst:e,continue:!n.abort})}}),da=m("$ZodNumber",(e,n)=>{V.init(e,n),e._zod.pattern=Bn,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=Number(t.value)}catch(s){}let o=t.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return t;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return t.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),t}}),Rp=m("$ZodNumberFormat",(e,n)=>{hd.init(e,n),da.init(e,n)}),Eo=m("$ZodBoolean",(e,n)=>{V.init(e,n),e._zod.pattern=Hs,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=Boolean(t.value)}catch(i){}let o=t.value;if(typeof o==="boolean")return t;return t.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),t}}),pa=m("$ZodBigInt",(e,n)=>{V.init(e,n),e._zod.pattern=Gs,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=BigInt(t.value)}catch(o){}if(typeof t.value==="bigint")return t;return t.issues.push({expected:"bigint",code:"invalid_type",input:t.value,inst:e}),t}}),Ap=m("$ZodBigIntFormat",(e,n)=>{yd.init(e,n),pa.init(e,n)}),Pp=m("$ZodSymbol",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o==="symbol")return t;return t.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),t}}),Tp=m("$ZodUndefined",(e,n)=>{V.init(e,n),e._zod.pattern=Ys,e._zod.values=new Set([void 0]),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o>"u")return t;return t.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),t}}),$p=m("$ZodNull",(e,n)=>{V.init(e,n),e._zod.pattern=Qs,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let o=t.value;if(o===null)return t;return t.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),t}}),Np=m("$ZodAny",(e,n)=>{V.init(e,n),e._zod.parse=(t)=>t}),zp=m("$ZodUnknown",(e,n)=>{V.init(e,n),e._zod.parse=(t)=>t}),Dp=m("$ZodNever",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),qp=m("$ZodVoid",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o>"u")return t;return t.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),t}}),Lp=m("$ZodDate",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=new Date(t.value)}catch(a){}let o=t.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return t;return t.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),t}});function Dd(e,n,t){if(e.issues.length)n.issues.push(...Ue(t,e.issues));n.value[t]=e.value}var Vp=m("$ZodArray",(e,n)=>{V.init(e,n);let t=je.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=t?t.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let l=i[c],u=n.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>Dd(d,r,c)));else if(Dd(u,r,c),a&&u.issues.length!==0&&Le(u))break}if(s.length)return Promise.all(s).then(()=>r);return r}});function Io(e,n,t,r,o,i){let s=t in r,a=i==="optional";if(!s&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!s)return;n.issues.push(...Ue(t,e.issues))}if(!s&&o===void 0){if(!e.issues.length)n.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[t]});return}if(e.value===void 0){if(s||o==="defaulted"&&!a)n.value[t]=void 0}else n.value[t]=e.value}var vv=[];function Mp(e){let n=Object.keys(e.shape),t=Object.getOwnPropertySymbols(e.shape),r=t.length?t:vv,o=r.length?[...n,...r]:n;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Ju(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(i)}}function Fp(e,n,t,r,o,i,s){let a=[],c=o.keySet,l=o.catchall._zod,u=l.def.type,{optin:d,optout:g}=l,h=0;for(let y in n){if(s&&t.issues.length!==h){if(Le(t,h))break;h=t.issues.length}if(c.has(y))continue;if(y==="__proto__"){if(u==="never")a.push(y);continue}if(u==="never"){a.push(y);continue}let S=l.run({value:n[y],issues:[]},r);if(S instanceof Promise)e.push(S.then((R)=>Io(R,t,y,n,d,g)));else Io(S,t,y,n,d,g)}if(a.length)t.issues.push({code:"unrecognized_keys",keys:a,input:n,inst:i,continue:!0});if(!e.length)return t;return Promise.all(e).then(()=>t)}var kv=m("$ZodObject",(e,n)=>{V.init(e,n);let t=Object.getOwnPropertyDescriptor(n,"shape"),r=t?.get?t.get.raw:n.shape??{};if(r){let l=()=>{let u={...r};return Object.defineProperty(n,"shape",{value:u}),l.raw=u,u};l.raw=r,Object.defineProperty(n,"shape",{get:l})}let o=Ut(()=>Mp(n));B(e,"propValues",(l)=>{let u=l.def.shape,d={};for(let g in u){let h=u[g]._zod;if(h.values){if(!Object.prototype.hasOwnProperty.call(d,g))_e(d,g,new Set);for(let y of h.values)d[g].add(y);if(h.optin!==void 0)d[g].add(void 0)}}return d});let i=ct,s=n.catchall,a,c=je.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=o.value);let d=l.value;if(!i(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let g=[],h=a.shape,y=u?.abortEarly,S=l.issues.length;for(let R of a.allKeys){if(y&&l.issues.length!==S){if(Le(l,S))break;S=l.issues.length}if(R==="__proto__")continue;let N=h[R],D=N._zod.optin,L=N._zod.optout,Oe=N._zod.run({value:d[R],issues:[]},u);if(Oe instanceof Promise)g.push(Oe.then((fe)=>Io(fe,l,R,d,D,L)));else Io(Oe,l,R,d,D,L)}if(!s)return g.length?Promise.all(g).then(()=>l):l;return Fp(g,d,l,u,o.value,e,y===!0)}}),Zp=m("$ZodObjectJIT",(e,n)=>{kv.init(e,n);let t=e._zod.parse,r=Ut(()=>Mp(n)),o=je.memoizer,i=(h)=>{let y=r.value,S=y.symbolKeys,R=new sa(["payload","ctx"],{shape:h,inst:e,memo:o,syms:S}),N=(fe)=>`shape[${fe}]._zod.run({ value: input[${fe}], issues: [] }, ctx)`,D=(fe,ie)=>`
11
11
  let ${fe}_ab = false;
12
12
  for (let i = 0; i < ${fe}.issues.length; i++) {
13
13
  const iss = ${fe}.issues[i];
@@ -18,27 +18,27 @@ ${n.join(`
18
18
  if (${fe}_ab && ctx && ctx.abortEarly) {
19
19
  payload.value = newResult;
20
20
  return payload;
21
- }`;j.write("const input = payload.value;");let V=Object.create(null),Ee=0;for(let fe of y.allKeys)V[fe]=`key_${Ee++}`;j.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let fe of y.allKeys){if(fe==="__proto__")continue;let ie=V[fe],Le=typeof fe==="symbol"?`syms[${S.indexOf(fe)}]`:Nu(fe),rt=`${Le} in input`,ot=h[fe],it=ot?._zod?.optin,st=it!==void 0,Vt=ot?._zod?.optout==="optional";if(j.write(`const ${ie} = ${N(Le)};`),st&&Vt){let Yr=it==="optional"?`${ie}_present`:`${ie}.value !== undefined || ${ie}_present`;j.write(`
22
- const ${ie}_present = ${rt};
21
+ }`;R.write("const input = payload.value;");let L=Object.create(null),Oe=0;for(let fe of y.allKeys)L[fe]=`key_${Oe++}`;R.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let fe of y.allKeys){if(fe==="__proto__")continue;let ie=L[fe],qe=typeof fe==="symbol"?`syms[${S.indexOf(fe)}]`:Vu(fe),ot=`${qe} in input`,it=h[fe],st=it?._zod?.optin,at=st!==void 0,Lt=it?._zod?.optout==="optional";if(R.write(`const ${ie} = ${N(qe)};`),at&&Lt){let Yr=st==="optional"?`${ie}_present`:`${ie}.value !== undefined || ${ie}_present`;R.write(`
22
+ const ${ie}_present = ${ot};
23
23
  if (!${ie}.issues.length || ${ie}_present) {
24
- if (${ie}.issues.length) {${D(ie,Le)}
24
+ if (${ie}.issues.length) {${D(ie,qe)}
25
25
  }
26
26
 
27
27
  if (${Yr}) {
28
- newResult[${Le}] = ${ie}.value;
28
+ newResult[${qe}] = ${ie}.value;
29
29
  }
30
30
  }
31
31
 
32
- `)}else if(!st)j.write(`
33
- const ${ie}_present = ${rt};
34
- if (${ie}.issues.length) {${D(ie,Le)}
32
+ `)}else if(!at)R.write(`
33
+ const ${ie}_present = ${ot};
34
+ if (${ie}.issues.length) {${D(ie,qe)}
35
35
  }
36
36
  if (!${ie}_present && !${ie}.issues.length) {
37
37
  payload.issues.push({
38
38
  code: "invalid_type",
39
39
  expected: "nonoptional",
40
40
  input: undefined,
41
- path: [${Le}]
41
+ path: [${qe}]
42
42
  });
43
43
  if (ctx && ctx.abortEarly) {
44
44
  payload.value = newResult;
@@ -47,43 +47,43 @@ ${n.join(`
47
47
  }
48
48
 
49
49
  if (${ie}_present) {
50
- newResult[${Le}] = ${ie}.value;
50
+ newResult[${qe}] = ${ie}.value;
51
51
  }
52
52
 
53
- `);else if(j.write(`
54
- if (${ie}.issues.length) {${D(ie,Le)}
53
+ `);else if(R.write(`
54
+ if (${ie}.issues.length) {${D(ie,qe)}
55
55
  }
56
- `),it==="defaulted")j.write(`newResult[${Le}] = ${ie}.value;`);else j.write(`
57
- if (${ie}.value !== undefined || ${rt}) {
58
- newResult[${Le}] = ${ie}.value;
56
+ `),st==="defaulted")R.write(`newResult[${qe}] = ${ie}.value;`);else R.write(`
57
+ if (${ie}.value !== undefined || ${ot}) {
58
+ newResult[${qe}] = ${ie}.value;
59
59
  }
60
- `)}return j.write("payload.value = newResult;"),j.write("return payload;"),j.compile()},s,a=at,c=!_e.jitless,u=c&&Du.value,d=n.catchall,g;e._zod.parse=(h,y)=>{g??(g=r.value);let S=h.value;if(!a(S))return h.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),h;if(c&&u&&y?.async===!1&&y.jitless!==!0){if(!s)s=i(n.shape);if(h=s(h,y),!d)return h;return Dp([],S,h,y,g,e,y?.abortEarly===!0)}return t(h,y)}});function $d(e,n,t,r){for(let i of e)if(i.issues.length===0)return n.value=i.value,n;let o=e.filter((i)=>!Ve(i));if(o.length===1)return n.value=o[0].value,o[0];return n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((i)=>i.issues.map((s)=>Be(s,r,Re())))}),n}var Eo=m("$ZodUnion",(e,n)=>{M.init(e,n),B(e,"optin",(r)=>r.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),B(e,"optout",(r)=>r.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),B(e,"values",(r)=>{if(r.def.options.every((o)=>o._zod.values))return new Set(r.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),B(e,"pattern",(r)=>{if(r.def.options.every((o)=>o._zod.pattern)){let o=r.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>_n(i.source)).join("|")})$`)}return});let t=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(t)return t(r,o);let i=!1,s=[];for(let a of n.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return $d(s,r,e,o);return Promise.all(s).then((a)=>$d(a,r,e,o))}});function Td(e,n,t,r){let o=[];for(let i=0;i<e.length;i++)if(e[i].issues.length===0)o.push(i);if(o.length===1)return n.value=e[o[0]].value,n;if(o.length===0)n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((i)=>i.issues.map((s)=>Be(s,r,Re())))});else n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:[],inclusive:!1,matches:o});return n}var Vp=m("$ZodXor",(e,n)=>{Eo.init(e,n),n.inclusive=!1;let t=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(t)return t(r,o);let i=!1,s=[];for(let a of n.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else s.push(c)}if(!i)return Td(s,r,e,o);return Promise.all(s).then((a)=>Td(a,r,e,o))}});function pv(e){let n=new Map;for(let t of e.options){let r=t._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(t)}"`);for(let o of r)if(n.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);n.set(o,null)}else n.set(o,t)}return n}var Mp=m("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,Eo.init(e,n);let t=e._zod.parse;B(e,"propValues",(o)=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))s++;for(let[l,u]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,l))je(i,l,new Set);for(let d of u)i[l].add(d)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),n.options.forEach((o,i)=>{let s=Bt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,n.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let r=Ut(()=>pv(n));e._zod.parse=(o,i)=>{let s=o.value;if(!at(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[n.discriminator],c=r.value.get(a);if(c&&(a!==void 0||i.direction!=="backward"))return c._zod.run(o,i);if(n.unionFallback||i.direction==="backward")return t(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,options:Array.from(r.value.keys()).filter((l)=>r.value.get(l)!==null),input:s,path:[n.discriminator],inst:e}),o}}),qp=m("$ZodIntersection",(e,n)=>{M.init(e,n),e._zod.parse=(t,r)=>{let o=t.value,i=n.left._zod.run({value:o,issues:[]},r),s=n.right._zod.run({value:o,issues:[]},r);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,l])=>Nd(t,c,l));return Nd(t,i,s)}});function ia(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e===+n)return{valid:!0,data:e};if(wn(e)&&wn(n)){let t=Object.keys(n),r=Object.keys(e).filter((i)=>t.indexOf(i)!==-1),o={...e,...n};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=ia(e[i],n[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};let t=[];for(let r=0;r<e.length;r++){let o=e[r],i=n[r],s=ia(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};t.push(s.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Nd(e,n,t){let r=new Map,o,i=new Map,s=(l,u)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let g=String(l.path[0]);if(!i.has(g))i.set(g,l);d=[g]}else return!1;for(let g of d){if(!r.has(g))r.set(g,{});r.get(g)[u]=!0}return!0};for(let l of n.issues)if(!s(l,"l"))e.issues.push(l);for(let l of t.issues)if(!s(l,"r"))e.issues.push(l);let a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter((u)=>o.keys.includes(u)):[];if(l.length)e.issues.push({...o,keys:l});for(let u of a)if(!l.includes(u)&&i.has(u))e.issues.push(i.get(u))}let c=ia(n.value,t.value);if(!c.valid){if(Ve(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var da=m("$ZodTuple",(e,n)=>{M.init(e,n);let t=n.items,r=_e.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=zd(t,"optin"),l=zd(t,"optout");if(!n.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>t.length)o.issues.push({code:"too_big",maximum:t.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=Array(t.length),d=n.rest?i?.abortEarly:void 0,g=!1;for(let h=0;h<t.length;h++){let y=t[h]._zod.run({value:s[h],issues:[]},i);if(y instanceof Promise)a.push(y.then((S)=>{u[h]=S}));else if(u[h]=y,d&&!g&&y.issues.length)g=Ve(y)}if(n.rest&&!g){let h=t.length-1,y=s.slice(t.length),S=o.issues.length;for(let j of y){if(d&&o.issues.length!==S){if(Ve(o,S))break;S=o.issues.length}h++;let N=n.rest._zod.run({value:j,issues:[]},i);if(N instanceof Promise)a.push(N.then((D)=>Dd(D,o,h)));else Dd(N,o,h)}}if(a.length)return Promise.all(a).then(()=>Ld(u,o,t,s,l));return Ld(u,o,t,s,l)}});function zd(e,n){for(let t=e.length-1;t>=0;t--)if(!(n==="optin"?e[t]._zod.optin!==void 0:e[t]._zod.optout==="optional"))return t+1;return 0}function Dd(e,n,t){if(e.issues.length)n.issues.push(...Ue(t,e.issues));n.value[t]=e.value}function Ld(e,n,t,r,o){for(let i=0;i<t.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&t[i]._zod.optin==="optional"){n.value.length=i;break}if(s.issues.length){if(!a&&i>=o){n.value.length=i;break}n.issues.push(...Ue(i,s.issues))}n.value[i]=s.value}for(let i=n.value.length-1;i>=r.length;i--)if(t[i]._zod.optout==="optional"&&n.value[i]===void 0)n.value.length=i;else break;return n}var Fp=m("$ZodRecord",(e,n)=>{M.init(e,n);let t=_e.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!wn(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=n.keyType._zod.values;if(a&&!n.partial){r.value=t?t.alloc(e,r,{},o):{};let c=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){if(c.add(typeof u==="number"?u.toString():u),u==="__proto__")continue;let d=n.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((y)=>Be(y,o,Re())),input:u,path:[u],inst:e});continue}let g=d.value;if(g==="__proto__")continue;let h=n.valueType._zod.run({value:i[u],issues:[]},o);if(h instanceof Promise)s.push(h.then((y)=>{if(y.issues.length)r.issues.push(...Ue(u,y.issues));r.value[g]=y.value}));else{if(h.issues.length)r.issues.push(...Ue(u,h.issues));r.value[g]=h.value}}let l;for(let u in i)if(!c.has(u))if(n.mode==="loose"){if(u==="__proto__")continue;r.value[u]=i[u]}else l=l??[],l.push(u);if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{r.value=t?t.alloc(e,r,{},o):{};let c;for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let u=n.keyType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&Un.test(l)&&u.issues.length){let y=n.keyType._zod.run({value:Number(l),issues:[]},o);if(y instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(y.issues.length===0)u=y}if(u.issues.length){if(n.mode==="loose")r.value[l]=i[l];else if(a)c=c??[],c.push(l);else r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((y)=>Be(y,o,Re())),input:l,path:[l],inst:e});continue}let g=u.value;if(g==="__proto__")continue;let h=n.valueType._zod.run({value:i[l],issues:[]},o);if(h instanceof Promise)s.push(h.then((y)=>{if(y.issues.length)r.issues.push(...Ue(l,y.issues));r.value[g]=y.value}));else{if(h.issues.length)r.issues.push(...Ue(l,h.issues));r.value[g]=h.value}}if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}if(s.length)return Promise.all(s).then(()=>r);return r}}),Zp=m("$ZodMap",(e,n)=>{M.init(e,n);let t=_e.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let s=[];r.value=t?t.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,c=r.issues.length;for(let[l,u]of i){if(a&&r.issues.length!==c){if(Ve(r,c))break;c=r.issues.length}let d=n.keyType._zod.run({value:l,issues:[]},o),g=n.valueType._zod.run({value:u,issues:[]},o);if(d instanceof Promise||g instanceof Promise)s.push(Promise.all([d,g]).then(([h,y])=>{Vd(h,y,r,l,i,e,o)}));else Vd(d,g,r,l,i,e,o)}if(s.length)return Promise.all(s).then(()=>r);return r}});function Vd(e,n,t,r,o,i,s){if(e.issues.length)if(oo.has(typeof r))t.issues.push(...Ue(r,e.issues));else t.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map((a)=>Be(a,s,Re()))});if(n.issues.length)if(oo.has(typeof r))t.issues.push(...Ue(r,n.issues));else t.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:n.issues.map((a)=>Be(a,s,Re()))});t.value.set(e.value,n.value)}var Jp=m("$ZodSet",(e,n)=>{M.init(e,n);let t=_e.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let s=[];r.value=t?t.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,c=r.issues.length;for(let l of i){if(a&&r.issues.length!==c){if(Ve(r,c))break;c=r.issues.length}let u=n.valueType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>Md(d,r)));else Md(u,r)}if(s.length)return Promise.all(s).then(()=>r);return r}});function Md(e,n){if(e.issues.length)n.issues.push(...e.issues);n.value.add(e.value)}var Up=m("$ZodEnum",(e,n)=>{M.init(e,n);let t=Zt(n.entries),r=new Set(t);e._zod.values=r,B(e,"pattern",(o)=>{let i=Zt(o.def.entries).filter((s)=>oo.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>tn(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:t,input:s,inst:e}),o}}),Bp=m("$ZodLiteral",(e,n)=>{M.init(e,n);let t=new Set(n.values);e._zod.values=t,B(e,"pattern",(r)=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?tn(i):i?tn(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;if(t.has(i))return r;return r.issues.push({code:"invalid_value",values:n.values,input:i,inst:e}),r}}),Kp=m("$ZodFile",(e,n)=>{M.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(o instanceof File)return t;return t.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),t}}),Wp=m("$ZodTransform",(e,n)=>{M.init(e,n),e._zod.optin="optional",_e.memoizer?.guard(e),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new ct(e.constructor.name);let o=n.transform(t.value,t);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(t.value=s,t));if(o instanceof Promise)throw new dn;return t.value=o,t}});function qd(e,n){return e.value=n.issues.length?void 0:n.value,e}var pa=m("$ZodOptional",(e,n)=>{M.init(e,n),B(e,"optin",(t)=>t.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",B(e,"values",(t)=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),B(e,"pattern",(t)=>{let r=t.def.innerType._zod.pattern;return r?new RegExp(`^(${_n(r.source)})?$`):void 0}),e._zod.parse=(t,r)=>{if(t.value===void 0){if(n.innerType._zod.optin!=="defaulted")return t;let o=n.innerType._zod.run({value:t.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>qd(t,i));return qd(t,o)}return n.innerType._zod.run(t,r)}}),Gp=m("$ZodExactOptional",(e,n)=>{pa.init(e,n),B(e,"values",(t)=>t.def.innerType._zod.values),B(e,"pattern",(t)=>t.def.innerType._zod.pattern),e._zod.parse=(t,r)=>n.innerType._zod.run(t,r)}),Hp=m("$ZodNullable",(e,n)=>{M.init(e,n),B(e,"optin",(t)=>t.def.innerType._zod.optin),B(e,"optout",(t)=>t.def.innerType._zod.optout),B(e,"pattern",(t)=>{let r=t.def.innerType._zod.pattern;return r?new RegExp(`^(${_n(r.source)}|null)$`):void 0}),B(e,"values",(t)=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),e._zod.parse=(t,r)=>{if(t.value===null)return t;return n.innerType._zod.run(t,r)}}),Qp=m("$ZodDefault",(e,n)=>{M.init(e,n),e._zod.optin="defaulted",B(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);if(t.value===void 0)return t.value=n.defaultValue,t;let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>Fd(i,n));return Fd(o,n)}});function Fd(e,n){if(e.value===void 0)e.value=n.defaultValue;return e}var Yp=m("$ZodPrefault",(e,n)=>{M.init(e,n),e._zod.optin="defaulted",B(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);if(t.value===void 0)t.value=n.defaultValue;return n.innerType._zod.run(t,r)}}),Xp=m("$ZodNonOptional",(e,n)=>{M.init(e,n),B(e,"values",(t)=>{let r=t.def.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(t,r)=>{let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>Zd(i,e));return Zd(o,e)}});function Zd(e,n){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n});return e}var ef=m("$ZodSuccess",(e,n)=>{M.init(e,n),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new ct("ZodSuccess");let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>(t.value=i.issues.length===0,t));return t.value=o.issues.length===0,t}});function Jd(e,n,t,r){if(!n.issues.length){if(e.value=n.value,n.memo)e.memo=!0;return e}return e.value=t.catchValue({...n,value:e.value,error:{issues:n.issues.map((o)=>Be(o,r,Re()))},input:e.value}),e}var nf=m("$ZodCatch",(e,n)=>{M.init(e,n),B(e,"optin",(t)=>t.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),B(e,"optout",(t)=>t.def.innerType._zod.optout),B(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);let o=n.innerType._zod.run({value:t.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>Jd(t,i,n,r));return Jd(t,o,n,r)}}),tf=m("$ZodNaN",(e,n)=>{M.init(e,n),e._zod.parse=(t,r)=>{if(typeof t.value!=="number"||!Number.isNaN(t.value))return t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t;return t}}),fa=m("$ZodPipe",(e,n)=>{M.init(e,n),B(e,"values",(t)=>t.def.in._zod.values),B(e,"optin",(t)=>t.def.in._zod.optin),B(e,"optout",(t)=>t.def.out._zod.optout),B(e,"propValues",(t)=>t.def.in._zod.propValues),e._zod.parse=(t,r)=>{if(r.direction==="backward"){let i=n.out._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>vo(s,n.in,r));return vo(i,n.in,r)}let o=n.in._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>vo(i,n.out,r));return vo(o,n.out,r)}});function vo(e,n,t){if(e.issues.some((r)=>r.code!=="unrecognized_keys"))return e.aborted=!0,e;return n._zod.run({value:e.value,issues:e.issues},t)}var _o=m("$ZodCodec",(e,n)=>{M.init(e,n),B(e,"values",(t)=>t.def.in._zod.values),B(e,"optin",(t)=>t.def.in._zod.optin),B(e,"optout",(t)=>t.def.out._zod.optout),B(e,"propValues",(t)=>t.def.in._zod.propValues),e._zod.parse=(t,r)=>{if((r.direction||"forward")==="forward"){let i=n.in._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>xo(s,n,r));return xo(i,n,r)}else{let i=n.out._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>xo(s,n,r));return xo(i,n,r)}}});function xo(e,n,t){if(e.issues.length)return e.aborted=!0,e;if((t.direction||"forward")==="forward"){let o=n.transform(e.value,e);if(o instanceof Promise)return o.then((i)=>ko(e,i,n.out,t));return ko(e,o,n.out,t)}else{let o=n.reverseTransform(e.value,e);if(o instanceof Promise)return o.then((i)=>ko(e,i,n.in,t));return ko(e,o,n.in,t)}}function ko(e,n,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:n,issues:e.issues},r)}var rf=m("$ZodPreprocess",(e,n)=>{fa.init(e,n)}),of=m("$ZodReadonly",(e,n)=>{M.init(e,n),B(e,"propValues",(t)=>t.def.innerType._zod.propValues),B(e,"values",(t)=>t.def.innerType._zod.values),B(e,"optin",(t)=>t.def.innerType?._zod?.optin),B(e,"optout",(t)=>t.def.innerType?._zod?.optout),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then(Ud);return Ud(o)}});function Ud(e){if(!e.memo)e.value=Object.freeze(e.value);return e}function fv(e){let n=e._zod.def,t=n.pattern,r=!!n.format?.includes("int"),o,i;for(let a of n.checks??[]){let c=a._zod.def;if(c.pattern)t=c.pattern;r||(r=!!c.format?.includes("int"));let l=c.minimum??c.length,u=c.maximum??c.length;if(l!==void 0&&(o===void 0||l>o))o=l;if(u!==void 0&&(i===void 0||u<i))i=u}if(t)return t.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Bs({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===Un?Qt:s)?.source}function sa(e){let n=e._zod.def,t=e._zod.pattern?.source,r=n.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=sa(r);if(t&&o&&i&&i!==o)return t.replace(_n(o),()=>_n(i));return t}if(n.options){let o=n.options.map(sa);if(o.every(Boolean))return`^(${o.map((i)=>_n(i)).join("|")})$`}return fv(e)}var sf=m("$ZodTemplateLiteral",(e,n)=>{M.init(e,n);let t=[];for(let r of n.parts)if(typeof r==="object"&&r!==null){let o=sa(r);if(!o)throw Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);t.push(_n(o))}else if(r===null||Lu.has(typeof r))t.push(tn(`${r}`));else throw Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${t.join("")}$`),e._zod.parse=(r,o)=>{if(typeof r.value!=="string")return r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(r.value))return r.issues.push({input:r.value,inst:e,code:"invalid_format",format:n.format??"template_literal",pattern:e._zod.pattern.source}),r;return r}}),af=m("$ZodFunction",(e,n)=>(M.init(e,n),Object.defineProperty(e,"_def",{value:n}),e._zod.def=n,e.implement=(t)=>{if(typeof t!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?gs(e._def.input,r):r,i=Reflect.apply(t,this,o);if(e._def.output)return gs(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(t)=>{if(typeof t!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await hs(e._def.input,r):r,i=await Reflect.apply(t,this,o);if(e._def.output)return await hs(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(t,r)=>{if(typeof t.value!=="function")return t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}),t;if(e._def.output&&e._def.output._zod.def.type==="promise")t.value=e.implementAsync(t.value);else t.value=e.implement(t.value);return t},e.input=(...t)=>{let r=e.constructor;if(Array.isArray(t[0]))return new r({type:"function",input:new da({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output});return new r({type:"function",input:t[0],output:e._def.output})},e.output=(t)=>new e.constructor({type:"function",input:e._def.input,output:t}),e)),cf=m("$ZodPromise",(e,n)=>{M.init(e,n),e._zod.parse=(t,r)=>Promise.resolve(t.value).then((o)=>n.innerType._zod.run({value:o,issues:[]},r))}),lf=m("$ZodLazy",(e,n)=>{M.init(e,n),Pu(e._zod,"innerType",()=>{let t=n;if(!t._cachedInner)t._cachedInner=n.getter();return t._cachedInner}),B(e,"pattern",(t)=>t.innerType?._zod?.pattern),B(e,"propValues",(t)=>t.innerType?._zod?.propValues),B(e,"optin",(t)=>t.innerType?._zod?.optin??void 0),B(e,"optout",(t)=>t.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),uf=m("$ZodCustom",(e,n)=>{le.init(e,n),M.init(e,n),e._zod.parse=(t,r)=>t,e._zod.check=(t)=>{let r=t.value,o=n.fn(r);if(o instanceof Promise)return o.then((i)=>Bd(i,t,r,e));Bd(o,t,r,e);return}});function Bd(e,n,t,r){if(!e){let o={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)o.params=r._zod.def.params;n.issues.push(Zn(o))}}class pf extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var ga="~memo",df=[];function ff(e){return e!==null&&typeof e==="object"}function ma(e){return e.map((n)=>n.path?{...n,path:n.path.slice()}:{...n})}var mf=new WeakMap,nr=0,Ao=1,tr=2;function Po(e,n,t){let r=mf.get(e);if(r!==void 0)return r?tr:nr;if(n.has(e))return tr;n.add(e);let o=nr,i=(u)=>{if(o!==tr&&u?._zod){let d=Po(u,n,t);if(d>o)o=d}},s=(u,d)=>{let g=nr;for(let h of Reflect.ownKeys(u)){let y=Object.getOwnPropertyDescriptor(u,h);if(d&&!y.enumerable)continue;let S=y.get?Ao:y.value?._zod?Po(y.value,n,t):nr;if(S>g)g=S}return g},a=(u)=>{if(u>o)o=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=Bt(c);a(u?s(u,!0):Ao),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let u of c.items)i(u);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let u of c.options)i(u);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let u=c._cachedInner??(t?e._zod.innerType:void 0);a(u?Po(u,n,!1):Ao);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in c){let d=Object.getOwnPropertyDescriptor(c,u);if(!d||d.get)continue;let g=d.value;if(!g||typeof g!=="object")continue;if(g._zod)i(g);else if(Array.isArray(g))for(let h of g)i(h)}}return n.delete(e),gv(e,o)}function gv(e,n){if(n!==Ao)mf.set(e,n===tr);return n}function hv(e,n){let t=e.buckets.get(n);if(!t)t=new WeakMap,e.buckets.set(n,t);return t}var jo,Ro=[],yv={alloc(e,n,t){let r=jo;if(!r)return t;jo=void 0;let o={value:t,issues:null};return r.set(n.value,o),Ro.push(o),t},guard(e){var n;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&bv(i,o.value))throw new pf;return t(o,i)};if(e._zod.parse=r,e._zod.run===t)e._zod.run=r})},attach(e){var n;let t,r=!1,o,i;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(t===void 0){let N=Po(e,new Set,!1);if(N===nr){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(N===tr||r)t=!0;else r=!0}let u=c.value;if(!ff(u))return s(c,l);let d=l[ga];if(!d)d={buckets:new WeakMap,backEdges:void 0},l[ga]=d;let g;if(o===l)g=i;else g=hv(d,e),o=l,i=g;let h=g.get(u);if(h){if(c.value=h.value,h.issues){if(h.issues.length)c.issues.push(...ma(h.issues))}else c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(h.value);return c}jo=g;let y=Ro.length,S=s(c,l);jo=void 0;let j=Ro.length>y?Ro.pop():void 0;if(S instanceof Promise)return S.then((N)=>{if(j)j.issues=N.issues.length?ma(N.issues):df;return N});if(j)j.issues=S.issues.length?ma(S.issues):df;return S};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function gf(){return yv}function bv(e,n){let t=e[ga]?.backEdges;return t!==void 0&&ff(n)&&t.has(n)}var wv=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function n(i){return e[i]??null}let t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return r[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=Zu(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${ls(i.values[0])}`;return`Invalid option: expected one of ${is(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=n(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=n(i.origin);if(a)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${t[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${is(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((a)=>`'${a}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function ha(){return{localeError:wv()}}var hf;class yf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){let t=n[0];if(this._map.set(e,t),t&&typeof t==="object"&&"id"in t)this._idmap.set(t.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let n=this._map.get(e);if(n&&typeof n==="object"&&"id"in n)this._idmap.delete(n.id);return this._map.delete(e),this}get(e){let n=e._zod.parent;if(n){let t={...this.get(n)??{}};delete t.id;let r={...t,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function vv(){return new yf}(hf=globalThis).__zod_globalRegistry??(hf.__zod_globalRegistry=vv());var Me=globalThis.__zod_globalRegistry;function bf(e){if(e.checks)e.checks=[...e.checks];return e}function wf(e,n){return new e(bf({type:"string",...C(n)}))}function ya(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...C(n)})}function ba(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...C(n)})}function wa(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...C(n)})}function va(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...C(n)})}function xa(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...C(n)})}function ka(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...C(n)})}function $o(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...C(n)})}function Sa(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...C(n)})}function Ia(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...C(n)})}function Ca(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...C(n)})}function Oa(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...C(n)})}function Ea(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...C(n)})}function _a(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...C(n)})}function ja(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...C(n)})}function Ra(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...C(n)})}function Aa(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...C(n)})}function vf(e,n){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...C(n)})}function Pa(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...C(n)})}function $a(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...C(n)})}function Ta(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...C(n)})}function Na(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...C(n)})}function za(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...C(n)})}function xf(e,n){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...C(n)})}function kf(e,n){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...C(n)})}function Da(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...C(n)})}function To(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...C(n)})}function No(e,n){return new e({type:"string",format:"date",check:"string_format",...C(n)})}function zo(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...C(n)})}function Do(e,n){return new e({type:"string",format:"duration",check:"string_format",...C(n)})}function Sf(e,n){return new e(bf({type:"number",checks:[],...C(n)}))}function If(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...C(n)})}function Cf(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...C(n)})}function Of(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...C(n)})}function Ef(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...C(n)})}function _f(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...C(n)})}function jf(e,n){return new e({type:"boolean",...C(n)})}function Rf(e,n){return new e({type:"bigint",...C(n)})}function Af(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...C(n)})}function Pf(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...C(n)})}function $f(e,n){return new e({type:"symbol",...C(n)})}function Tf(e,n){return new e({type:"undefined",...C(n)})}function Nf(e,n){return new e({type:"null",...C(n)})}function zf(e){return new e({type:"any"})}function Df(e){return new e({type:"unknown"})}function Lf(e,n){return new e({type:"never",...C(n)})}function Vf(e,n){return new e({type:"void",...C(n)})}function Mf(e,n){return new e({type:"date",...C(n)})}function qf(e,n){return new e({type:"nan",...C(n)})}function Rn(e,n){return new ta({check:"less_than",...C(n),value:e,inclusive:!1})}function rn(e,n){return new ta({check:"less_than",...C(n),value:e,inclusive:!0})}function An(e,n){return new ra({check:"greater_than",...C(n),value:e,inclusive:!1})}function on(e,n){return new ra({check:"greater_than",...C(n),value:e,inclusive:!0})}function Ff(e){return An(0,e)}function Zf(e){return Rn(0,e)}function Jf(e){return rn(0,e)}function Uf(e){return on(0,e)}function ut(e,n){return new ud({check:"multiple_of",...C(n),value:e})}function dt(e,n){return new fd({check:"max_size",...C(n),maximum:e})}function Pn(e,n){return new md({check:"min_size",...C(n),minimum:e})}function rr(e,n){return new gd({check:"size_equals",...C(n),size:e})}function or(e,n){return new hd({check:"max_length",...C(n),maximum:e})}function Bn(e,n){return new yd({check:"min_length",...C(n),minimum:e})}function ir(e,n){return new bd({check:"length_equals",...C(n),length:e})}function Lo(e,n){return new wd({check:"string_format",format:"regex",...C(n),pattern:e})}function Vo(e){return new vd({check:"string_format",format:"lowercase",...C(e)})}function Mo(e){return new xd({check:"string_format",format:"uppercase",...C(e)})}function qo(e,n){return new kd({check:"string_format",format:"includes",...C(n),includes:e})}function Fo(e,n){return new Sd({check:"string_format",format:"starts_with",...C(n),prefix:e})}function Zo(e,n){return new Id({check:"string_format",format:"ends_with",...C(n),suffix:e})}function Bf(e,n,t){return new Cd({check:"property",property:e,schema:n,...C(t)})}function Jo(e,n){return new Od({check:"properties",shape:e,...C(n)})}function Uo(e,n){return new Ed({check:"mime_type",mime:e,...C(n)})}function vn(e){return new _d({check:"overwrite",tx:e})}function Bo(e){return vn((n)=>n.normalize(e))}function Ko(){return vn((e)=>e.trim())}function Wo(){return vn((e)=>e.toLowerCase())}function Go(){return vn((e)=>e.toUpperCase())}function Ho(){return vn((e)=>zu(e))}function Kf(e,n,t){return new e({type:"array",element:n,...C(t)})}function Wf(e,n){return new e({type:"file",...C(n)})}function Gf(e,n,t){let r=C(t);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:n,...r})}function Hf(e,n,t){return new e({type:"custom",check:"custom",fn:n,...C(t)})}function Qf(e,n){let t=kv((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Zn(o,r.value,t._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(Zn(i))}},e(r.value,r)),n);return t}function kv(e,n){let t=new le({check:"custom",...C(n)});return t._zod.check=e,t}function Yf(e){let n=new le({check:"describe"});return n._zod.onattach=[(t)=>{let r=Me.get(t)??{};Me.add(t,{...r,description:e})}],n._zod.check=()=>{},n}function Xf(e){let n=new le({check:"meta"});return n._zod.onattach=[(t)=>{let r=Me.get(t)??{};Me.add(t,{...r,...e})}],n._zod.check=()=>{},n}function em(e,n){let t=C(n),r=t.truthy??["true","1","yes","on","y","enabled"],o=t.falsy??["false","0","no","off","n","disabled"];if(t.case!=="sensitive")r=r.map((h)=>typeof h==="string"?h.toLowerCase():h),o=o.map((h)=>typeof h==="string"?h.toLowerCase():h);let i=new Set(r),s=new Set(o),a=e.Codec??_o,c=e.Boolean??Oo,u=new(e.String??lt)({type:"string",error:t.error}),d=new c({type:"boolean",error:t.error}),g=new a({type:"pipe",in:u,out:d,transform:(h,y)=>{let S=h;if(t.case!=="sensitive")S=S.toLowerCase();if(i.has(S))return!0;else if(s.has(S))return!1;else return y.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:y.value,inst:g,continue:!1}),{}},reverseTransform:(h,y)=>{if(h===!0)return r[0]||"true";else return o[0]||"false"},error:t.error});return g._zod.bag.truthy=r,g._zod.bag.falsy=o,g._zod.bag.case=t.case??"insensitive",g}function pt(e,n,t,r={}){let o=C(r),i={check:"string_format",type:"string",format:n,fn:typeof t==="function"?t:(a)=>t.test(a),...o};if(t instanceof RegExp)i.pattern=t;return new e(i)}function sr(e,...n){for(let t of n)for(let r of Reflect.ownKeys(t))if(Object.prototype.propertyIsEnumerable.call(t,r))je(e,r,t[r]);return e}function cr(e){let n=e?.target??"draft-2020-12";if(n==="draft-4")n="draft-04";if(n==="draft-7")n="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Me,target:n,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ce(e,n,t,r,o){let i=typeof n.unrepresentable==="function"?n.unrepresentable({zodSchema:e,path:r.path,message:o}):n.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(t,i),!0}function ue(e,n,t={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=n.seen.get(e);if(i){if(i.count++,t.schemaPath.includes(e))i.cycle=t.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:t.path};n.seen.set(e,s),n.sharedDefsExtractedFor=void 0,n.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...t,schemaPath:[...t.schemaPath,e],path:t.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,s.schema,u);else{let g=s.schema,h=n.processors[o.type];if(!h)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,n,g,u)}let d=e._zod.parent;if(d){if(!s.ref)s.ref=d;ue(d,n,u),n.seen.get(d).isParent=!0}}let c=n.metadataRegistry.get(e);if(c)sr(s.schema,c);if(n.io==="input"&&$e(e))delete s.schema.examples,delete s.schema.default;if(n.io==="input"&&"_prefault"in s.schema)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,n.seen.get(e).schema}function nm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function lr(e,n){let t=e.seen.get(n);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,g=e.external.uri??((y)=>y);if(d)return{ref:g(d)};let h=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=h,{defId:h,ref:`${g("__shared")}#/${a}/${nm(h)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===t&&!s[1].schema.id)return{ref:c};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+nm(u)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=o(s);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
60
+ `)}return R.write("payload.value = newResult;"),R.write("return payload;"),R.compile()},s,a=ct,c=!je.jitless,u=c&&Fu.value,d=n.catchall,g;e._zod.parse=(h,y)=>{g??(g=r.value);let S=h.value;if(!a(S))return h.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),h;if(c&&u&&y?.async===!1&&y.jitless!==!0){if(!s)s=i(n.shape);if(h=s(h,y),!d)return h;return Fp([],S,h,y,g,e,y?.abortEarly===!0)}return t(h,y)}});function qd(e,n,t,r){for(let i of e)if(i.issues.length===0)return n.value=i.value,n;let o=e.filter((i)=>!Le(i));if(o.length===1)return n.value=o[0].value,o[0];return n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((i)=>i.issues.map((s)=>Be(s,r,Re())))}),n}var Oo=m("$ZodUnion",(e,n)=>{V.init(e,n),B(e,"optin",(r)=>r.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),B(e,"optout",(r)=>r.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),B(e,"values",(r)=>{if(r.def.options.every((o)=>o._zod.values))return new Set(r.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),B(e,"pattern",(r)=>{if(r.def.options.every((o)=>o._zod.pattern)){let o=r.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>jn(i.source)).join("|")})$`)}return});let t=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(t)return t(r,o);let i=!1,s=[];for(let a of n.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return qd(s,r,e,o);return Promise.all(s).then((a)=>qd(a,r,e,o))}});function Ld(e,n,t,r){let o=[];for(let i=0;i<e.length;i++)if(e[i].issues.length===0)o.push(i);if(o.length===1)return n.value=e[o[0]].value,n;if(o.length===0)n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((i)=>i.issues.map((s)=>Be(s,r,Re())))});else n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:[],inclusive:!1,matches:o});return n}var Jp=m("$ZodXor",(e,n)=>{Oo.init(e,n),n.inclusive=!1;let t=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(t)return t(r,o);let i=!1,s=[];for(let a of n.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else s.push(c)}if(!i)return Ld(s,r,e,o);return Promise.all(s).then((a)=>Ld(a,r,e,o))}});function xv(e){let n=new Map;for(let t of e.options){let r=t._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(t)}"`);for(let o of r)if(n.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);n.set(o,null)}else n.set(o,t)}return n}var Up=m("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,Oo.init(e,n);let t=e._zod.parse;B(e,"propValues",(o)=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))s++;for(let[l,u]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,l))_e(i,l,new Set);for(let d of u)i[l].add(d)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),n.options.forEach((o,i)=>{let s=Bt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,n.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let r=Ut(()=>xv(n));e._zod.parse=(o,i)=>{let s=o.value;if(!ct(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[n.discriminator],c=r.value.get(a);if(c&&(a!==void 0||i.direction!=="backward"))return c._zod.run(o,i);if(n.unionFallback||i.direction==="backward")return t(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,options:Array.from(r.value.keys()).filter((l)=>r.value.get(l)!==null),input:s,path:[n.discriminator],inst:e}),o}}),Bp=m("$ZodIntersection",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{let o=t.value,i=n.left._zod.run({value:o,issues:[]},r),s=n.right._zod.run({value:o,issues:[]},r);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,l])=>Vd(t,c,l));return Vd(t,i,s)}});function aa(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e===+n)return{valid:!0,data:e};if(wn(e)&&wn(n)){let t=Object.keys(n),r=Object.keys(e).filter((i)=>t.indexOf(i)!==-1),o={...e,...n};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=aa(e[i],n[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};let t=[];for(let r=0;r<e.length;r++){let o=e[r],i=n[r],s=aa(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};t.push(s.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Vd(e,n,t){let r=new Map,o,i=new Map,s=(l,u)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let g=String(l.path[0]);if(!i.has(g))i.set(g,l);d=[g]}else return!1;for(let g of d){if(!r.has(g))r.set(g,{});r.get(g)[u]=!0}return!0};for(let l of n.issues)if(!s(l,"l"))e.issues.push(l);for(let l of t.issues)if(!s(l,"r"))e.issues.push(l);let a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter((u)=>o.keys.includes(u)):[];if(l.length)e.issues.push({...o,keys:l});for(let u of a)if(!l.includes(u)&&i.has(u))e.issues.push(i.get(u))}let c=aa(n.value,t.value);if(!c.valid){if(Le(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var fa=m("$ZodTuple",(e,n)=>{V.init(e,n);let t=n.items,r=je.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=Md(t,"optin"),l=Md(t,"optout");if(!n.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>t.length)o.issues.push({code:"too_big",maximum:t.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=Array(t.length),d=n.rest?i?.abortEarly:void 0,g=!1;for(let h=0;h<t.length;h++){let y=t[h]._zod.run({value:s[h],issues:[]},i);if(y instanceof Promise)a.push(y.then((S)=>{u[h]=S}));else if(u[h]=y,d&&!g&&y.issues.length)g=Le(y)}if(n.rest&&!g){let h=t.length-1,y=s.slice(t.length),S=o.issues.length;for(let R of y){if(d&&o.issues.length!==S){if(Le(o,S))break;S=o.issues.length}h++;let N=n.rest._zod.run({value:R,issues:[]},i);if(N instanceof Promise)a.push(N.then((D)=>Fd(D,o,h)));else Fd(N,o,h)}}if(a.length)return Promise.all(a).then(()=>Zd(u,o,t,s,l));return Zd(u,o,t,s,l)}});function Md(e,n){for(let t=e.length-1;t>=0;t--)if(!(n==="optin"?e[t]._zod.optin!==void 0:e[t]._zod.optout==="optional"))return t+1;return 0}function Fd(e,n,t){if(e.issues.length)n.issues.push(...Ue(t,e.issues));n.value[t]=e.value}function Zd(e,n,t,r,o){for(let i=0;i<t.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&t[i]._zod.optin==="optional"){n.value.length=i;break}if(s.issues.length){if(!a&&i>=o){n.value.length=i;break}n.issues.push(...Ue(i,s.issues))}n.value[i]=s.value}for(let i=n.value.length-1;i>=r.length;i--)if(t[i]._zod.optout==="optional"&&n.value[i]===void 0)n.value.length=i;else break;return n}var Kp=m("$ZodRecord",(e,n)=>{V.init(e,n);let t=je.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!wn(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=n.keyType._zod.values;if(a&&!n.partial){r.value=t?t.alloc(e,r,{},o):{};let c=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){if(c.add(typeof u==="number"?u.toString():u),u==="__proto__")continue;let d=n.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((y)=>Be(y,o,Re())),input:u,path:[u],inst:e});continue}let g=d.value;if(g==="__proto__")continue;let h=n.valueType._zod.run({value:i[u],issues:[]},o);if(h instanceof Promise)s.push(h.then((y)=>{if(y.issues.length)r.issues.push(...Ue(u,y.issues));r.value[g]=y.value}));else{if(h.issues.length)r.issues.push(...Ue(u,h.issues));r.value[g]=h.value}}let l;for(let u in i)if(!c.has(u))if(n.mode==="loose"){if(u==="__proto__")continue;r.value[u]=i[u]}else l=l??[],l.push(u);if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{r.value=t?t.alloc(e,r,{},o):{};let c;for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let u=n.keyType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&Bn.test(l)&&u.issues.length){let y=n.keyType._zod.run({value:Number(l),issues:[]},o);if(y instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(y.issues.length===0)u=y}if(u.issues.length){if(n.mode==="loose")r.value[l]=i[l];else if(a)c=c??[],c.push(l);else r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((y)=>Be(y,o,Re())),input:l,path:[l],inst:e});continue}let g=u.value;if(g==="__proto__")continue;let h=n.valueType._zod.run({value:i[l],issues:[]},o);if(h instanceof Promise)s.push(h.then((y)=>{if(y.issues.length)r.issues.push(...Ue(l,y.issues));r.value[g]=y.value}));else{if(h.issues.length)r.issues.push(...Ue(l,h.issues));r.value[g]=h.value}}if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}if(s.length)return Promise.all(s).then(()=>r);return r}}),Wp=m("$ZodMap",(e,n)=>{V.init(e,n);let t=je.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let s=[];r.value=t?t.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,c=r.issues.length;for(let[l,u]of i){if(a&&r.issues.length!==c){if(Le(r,c))break;c=r.issues.length}let d=n.keyType._zod.run({value:l,issues:[]},o),g=n.valueType._zod.run({value:u,issues:[]},o);if(d instanceof Promise||g instanceof Promise)s.push(Promise.all([d,g]).then(([h,y])=>{Jd(h,y,r,l,i,e,o)}));else Jd(d,g,r,l,i,e,o)}if(s.length)return Promise.all(s).then(()=>r);return r}});function Jd(e,n,t,r,o,i,s){if(e.issues.length)if(oo.has(typeof r))t.issues.push(...Ue(r,e.issues));else t.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map((a)=>Be(a,s,Re()))});if(n.issues.length)if(oo.has(typeof r))t.issues.push(...Ue(r,n.issues));else t.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:n.issues.map((a)=>Be(a,s,Re()))});t.value.set(e.value,n.value)}var Gp=m("$ZodSet",(e,n)=>{V.init(e,n);let t=je.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let s=[];r.value=t?t.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,c=r.issues.length;for(let l of i){if(a&&r.issues.length!==c){if(Le(r,c))break;c=r.issues.length}let u=n.valueType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>Ud(d,r)));else Ud(u,r)}if(s.length)return Promise.all(s).then(()=>r);return r}});function Ud(e,n){if(e.issues.length)n.issues.push(...e.issues);n.value.add(e.value)}var Hp=m("$ZodEnum",(e,n)=>{V.init(e,n);let t=Zt(n.entries),r=new Set(t);e._zod.values=r,B(e,"pattern",(o)=>{let i=Zt(o.def.entries).filter((s)=>oo.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>nn(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:t,input:s,inst:e}),o}}),Qp=m("$ZodLiteral",(e,n)=>{V.init(e,n);let t=new Set(n.values);e._zod.values=t,B(e,"pattern",(r)=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?nn(i):i?nn(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;if(t.has(i))return r;return r.issues.push({code:"invalid_value",values:n.values,input:i,inst:e}),r}}),Yp=m("$ZodFile",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(o instanceof File)return t;return t.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),t}}),Xp=m("$ZodTransform",(e,n)=>{V.init(e,n),e._zod.optin="optional",je.memoizer?.guard(e),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new lt(e.constructor.name);let o=n.transform(t.value,t);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(t.value=s,t));if(o instanceof Promise)throw new dn;return t.value=o,t}});function Bd(e,n){return e.value=n.issues.length?void 0:n.value,e}var ma=m("$ZodOptional",(e,n)=>{V.init(e,n),B(e,"optin",(t)=>t.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",B(e,"values",(t)=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),B(e,"pattern",(t)=>{let r=t.def.innerType._zod.pattern;return r?new RegExp(`^(${jn(r.source)})?$`):void 0}),e._zod.parse=(t,r)=>{if(t.value===void 0){if(n.innerType._zod.optin!=="defaulted")return t;let o=n.innerType._zod.run({value:t.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>Bd(t,i));return Bd(t,o)}return n.innerType._zod.run(t,r)}}),ef=m("$ZodExactOptional",(e,n)=>{ma.init(e,n),B(e,"values",(t)=>t.def.innerType._zod.values),B(e,"pattern",(t)=>t.def.innerType._zod.pattern),e._zod.parse=(t,r)=>n.innerType._zod.run(t,r)}),nf=m("$ZodNullable",(e,n)=>{V.init(e,n),B(e,"optin",(t)=>t.def.innerType._zod.optin),B(e,"optout",(t)=>t.def.innerType._zod.optout),B(e,"pattern",(t)=>{let r=t.def.innerType._zod.pattern;return r?new RegExp(`^(${jn(r.source)}|null)$`):void 0}),B(e,"values",(t)=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),e._zod.parse=(t,r)=>{if(t.value===null)return t;return n.innerType._zod.run(t,r)}}),tf=m("$ZodDefault",(e,n)=>{V.init(e,n),e._zod.optin="defaulted",B(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);if(t.value===void 0)return t.value=n.defaultValue,t;let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>Kd(i,n));return Kd(o,n)}});function Kd(e,n){if(e.value===void 0)e.value=n.defaultValue;return e}var rf=m("$ZodPrefault",(e,n)=>{V.init(e,n),e._zod.optin="defaulted",B(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);if(t.value===void 0)t.value=n.defaultValue;return n.innerType._zod.run(t,r)}}),of=m("$ZodNonOptional",(e,n)=>{V.init(e,n),B(e,"values",(t)=>{let r=t.def.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(t,r)=>{let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>Wd(i,e));return Wd(o,e)}});function Wd(e,n){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n});return e}var sf=m("$ZodSuccess",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new lt("ZodSuccess");let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>(t.value=i.issues.length===0,t));return t.value=o.issues.length===0,t}});function Gd(e,n,t,r){if(!n.issues.length){if(e.value=n.value,n.memo)e.memo=!0;return e}return e.value=t.catchValue({...n,value:e.value,error:{issues:n.issues.map((o)=>Be(o,r,Re()))},input:e.value}),e}var af=m("$ZodCatch",(e,n)=>{V.init(e,n),B(e,"optin",(t)=>t.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),B(e,"optout",(t)=>t.def.innerType._zod.optout),B(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);let o=n.innerType._zod.run({value:t.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>Gd(t,i,n,r));return Gd(t,o,n,r)}}),cf=m("$ZodNaN",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>{if(typeof t.value!=="number"||!Number.isNaN(t.value))return t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t;return t}}),ga=m("$ZodPipe",(e,n)=>{V.init(e,n),B(e,"values",(t)=>t.def.in._zod.values),B(e,"optin",(t)=>t.def.in._zod.optin),B(e,"optout",(t)=>t.def.out._zod.optout),B(e,"propValues",(t)=>t.def.in._zod.propValues),e._zod.parse=(t,r)=>{if(r.direction==="backward"){let i=n.out._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>vo(s,n.in,r));return vo(i,n.in,r)}let o=n.in._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>vo(i,n.out,r));return vo(o,n.out,r)}});function vo(e,n,t){if(e.issues.some((r)=>r.code!=="unrecognized_keys"))return e.aborted=!0,e;return n._zod.run({value:e.value,issues:e.issues},t)}var jo=m("$ZodCodec",(e,n)=>{V.init(e,n),B(e,"values",(t)=>t.def.in._zod.values),B(e,"optin",(t)=>t.def.in._zod.optin),B(e,"optout",(t)=>t.def.out._zod.optout),B(e,"propValues",(t)=>t.def.in._zod.propValues),e._zod.parse=(t,r)=>{if((r.direction||"forward")==="forward"){let i=n.in._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>ko(s,n,r));return ko(i,n,r)}else{let i=n.out._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>ko(s,n,r));return ko(i,n,r)}}});function ko(e,n,t){if(e.issues.length)return e.aborted=!0,e;if((t.direction||"forward")==="forward"){let o=n.transform(e.value,e);if(o instanceof Promise)return o.then((i)=>xo(e,i,n.out,t));return xo(e,o,n.out,t)}else{let o=n.reverseTransform(e.value,e);if(o instanceof Promise)return o.then((i)=>xo(e,i,n.in,t));return xo(e,o,n.in,t)}}function xo(e,n,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:n,issues:e.issues},r)}var lf=m("$ZodPreprocess",(e,n)=>{ga.init(e,n)}),uf=m("$ZodReadonly",(e,n)=>{V.init(e,n),B(e,"propValues",(t)=>t.def.innerType._zod.propValues),B(e,"values",(t)=>t.def.innerType._zod.values),B(e,"optin",(t)=>t.def.innerType?._zod?.optin),B(e,"optout",(t)=>t.def.innerType?._zod?.optout),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then(Hd);return Hd(o)}});function Hd(e){if(!e.memo)e.value=Object.freeze(e.value);return e}function Sv(e){let n=e._zod.def,t=n.pattern,r=!!n.format?.includes("int"),o,i;for(let a of n.checks??[]){let c=a._zod.def;if(c.pattern)t=c.pattern;r||(r=!!c.format?.includes("int"));let l=c.minimum??c.length,u=c.maximum??c.length;if(l!==void 0&&(o===void 0||l>o))o=l;if(u!==void 0&&(i===void 0||u<i))i=u}if(t)return t.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Ws({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===Bn?Qt:s)?.source}function ca(e){let n=e._zod.def,t=e._zod.pattern?.source,r=n.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=ca(r);if(t&&o&&i&&i!==o)return t.replace(jn(o),()=>jn(i));return t}if(n.options){let o=n.options.map(ca);if(o.every(Boolean))return`^(${o.map((i)=>jn(i)).join("|")})$`}return Sv(e)}var df=m("$ZodTemplateLiteral",(e,n)=>{V.init(e,n);let t=[];for(let r of n.parts)if(typeof r==="object"&&r!==null){let o=ca(r);if(!o)throw Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);t.push(jn(o))}else if(r===null||Zu.has(typeof r))t.push(nn(`${r}`));else throw Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${t.join("")}$`),e._zod.parse=(r,o)=>{if(typeof r.value!=="string")return r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(r.value))return r.issues.push({input:r.value,inst:e,code:"invalid_format",format:n.format??"template_literal",pattern:e._zod.pattern.source}),r;return r}}),pf=m("$ZodFunction",(e,n)=>(V.init(e,n),Object.defineProperty(e,"_def",{value:n}),e._zod.def=n,e.implement=(t)=>{if(typeof t!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?ys(e._def.input,r):r,i=Reflect.apply(t,this,o);if(e._def.output)return ys(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(t)=>{if(typeof t!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await bs(e._def.input,r):r,i=await Reflect.apply(t,this,o);if(e._def.output)return await bs(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(t,r)=>{if(typeof t.value!=="function")return t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}),t;if(e._def.output&&e._def.output._zod.def.type==="promise")t.value=e.implementAsync(t.value);else t.value=e.implement(t.value);return t},e.input=(...t)=>{let r=e.constructor;if(Array.isArray(t[0]))return new r({type:"function",input:new fa({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output});return new r({type:"function",input:t[0],output:e._def.output})},e.output=(t)=>new e.constructor({type:"function",input:e._def.input,output:t}),e)),ff=m("$ZodPromise",(e,n)=>{V.init(e,n),e._zod.parse=(t,r)=>Promise.resolve(t.value).then((o)=>n.innerType._zod.run({value:o,issues:[]},r))}),mf=m("$ZodLazy",(e,n)=>{V.init(e,n),Du(e._zod,"innerType",()=>{let t=n;if(!t._cachedInner)t._cachedInner=n.getter();return t._cachedInner}),B(e,"pattern",(t)=>t.innerType?._zod?.pattern),B(e,"propValues",(t)=>t.innerType?._zod?.propValues),B(e,"optin",(t)=>t.innerType?._zod?.optin??void 0),B(e,"optout",(t)=>t.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),gf=m("$ZodCustom",(e,n)=>{le.init(e,n),V.init(e,n),e._zod.parse=(t,r)=>t,e._zod.check=(t)=>{let r=t.value,o=n.fn(r);if(o instanceof Promise)return o.then((i)=>Qd(i,t,r,e));Qd(o,t,r,e);return}});function Qd(e,n,t,r){if(!e){let o={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)o.params=r._zod.def.params;n.issues.push(Jn(o))}}class yf extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var ya="~memo",hf=[];function bf(e){return e!==null&&typeof e==="object"}function ha(e){return e.map((n)=>n.path?{...n,path:n.path.slice()}:{...n})}var wf=new WeakMap,nr=0,Ao=1,tr=2;function Po(e,n,t){let r=wf.get(e);if(r!==void 0)return r?tr:nr;if(n.has(e))return tr;n.add(e);let o=nr,i=(u)=>{if(o!==tr&&u?._zod){let d=Po(u,n,t);if(d>o)o=d}},s=(u,d)=>{let g=nr;for(let h of Reflect.ownKeys(u)){let y=Object.getOwnPropertyDescriptor(u,h);if(d&&!y.enumerable)continue;let S=y.get?Ao:y.value?._zod?Po(y.value,n,t):nr;if(S>g)g=S}return g},a=(u)=>{if(u>o)o=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=Bt(c);a(u?s(u,!0):Ao),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let u of c.items)i(u);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let u of c.options)i(u);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let u=c._cachedInner??(t?e._zod.innerType:void 0);a(u?Po(u,n,!1):Ao);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in c){let d=Object.getOwnPropertyDescriptor(c,u);if(!d||d.get)continue;let g=d.value;if(!g||typeof g!=="object")continue;if(g._zod)i(g);else if(Array.isArray(g))for(let h of g)i(h)}}return n.delete(e),Cv(e,o)}function Cv(e,n){if(n!==Ao)wf.set(e,n===tr);return n}function Ev(e,n){let t=e.buckets.get(n);if(!t)t=new WeakMap,e.buckets.set(n,t);return t}var _o,Ro=[],Ov={alloc(e,n,t){let r=_o;if(!r)return t;_o=void 0;let o={value:t,issues:null};return r.set(n.value,o),Ro.push(o),t},guard(e){var n;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&jv(i,o.value))throw new yf;return t(o,i)};if(e._zod.parse=r,e._zod.run===t)e._zod.run=r})},attach(e){var n;let t,r=!1,o,i;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(t===void 0){let N=Po(e,new Set,!1);if(N===nr){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(N===tr||r)t=!0;else r=!0}let u=c.value;if(!bf(u))return s(c,l);let d=l[ya];if(!d)d={buckets:new WeakMap,backEdges:void 0},l[ya]=d;let g;if(o===l)g=i;else g=Ev(d,e),o=l,i=g;let h=g.get(u);if(h){if(c.value=h.value,h.issues){if(h.issues.length)c.issues.push(...ha(h.issues))}else c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(h.value);return c}_o=g;let y=Ro.length,S=s(c,l);_o=void 0;let R=Ro.length>y?Ro.pop():void 0;if(S instanceof Promise)return S.then((N)=>{if(R)R.issues=N.issues.length?ha(N.issues):hf;return N});if(R)R.issues=S.issues.length?ha(S.issues):hf;return S};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function vf(){return Ov}function jv(e,n){let t=e[ya]?.backEdges;return t!==void 0&&bf(n)&&t.has(n)}var _v=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function n(i){return e[i]??null}let t={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return r[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=Wu(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${ds(i.values[0])}`;return`Invalid option: expected one of ${as(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=n(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=n(i.origin);if(a)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${t[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${as(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((a)=>`'${a}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function ba(){return{localeError:_v()}}var kf;class xf{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){let t=n[0];if(this._map.set(e,t),t&&typeof t==="object"&&"id"in t)this._idmap.set(t.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let n=this._map.get(e);if(n&&typeof n==="object"&&"id"in n)this._idmap.delete(n.id);return this._map.delete(e),this}get(e){let n=e._zod.parent;if(n){let t={...this.get(n)??{}};delete t.id;let r={...t,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Rv(){return new xf}(kf=globalThis).__zod_globalRegistry??(kf.__zod_globalRegistry=Rv());var Ve=globalThis.__zod_globalRegistry;function Sf(e){if(e.checks)e.checks=[...e.checks];return e}function If(e,n){return new e(Sf({type:"string",...C(n)}))}function wa(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...C(n)})}function va(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...C(n)})}function ka(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...C(n)})}function xa(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...C(n)})}function Sa(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...C(n)})}function Ia(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...C(n)})}function To(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...C(n)})}function Ca(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...C(n)})}function Ea(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...C(n)})}function Oa(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...C(n)})}function ja(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...C(n)})}function _a(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...C(n)})}function Ra(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...C(n)})}function Aa(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...C(n)})}function Pa(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...C(n)})}function Ta(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...C(n)})}function Cf(e,n){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...C(n)})}function $a(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...C(n)})}function Na(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...C(n)})}function za(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...C(n)})}function Da(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...C(n)})}function qa(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...C(n)})}function Ef(e,n){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...C(n)})}function Of(e,n){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...C(n)})}function La(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...C(n)})}function $o(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...C(n)})}function No(e,n){return new e({type:"string",format:"date",check:"string_format",...C(n)})}function zo(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...C(n)})}function Do(e,n){return new e({type:"string",format:"duration",check:"string_format",...C(n)})}function jf(e,n){return new e(Sf({type:"number",checks:[],...C(n)}))}function _f(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...C(n)})}function Rf(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...C(n)})}function Af(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...C(n)})}function Pf(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...C(n)})}function Tf(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...C(n)})}function $f(e,n){return new e({type:"boolean",...C(n)})}function Nf(e,n){return new e({type:"bigint",...C(n)})}function zf(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...C(n)})}function Df(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...C(n)})}function qf(e,n){return new e({type:"symbol",...C(n)})}function Lf(e,n){return new e({type:"undefined",...C(n)})}function Vf(e,n){return new e({type:"null",...C(n)})}function Mf(e){return new e({type:"any"})}function Ff(e){return new e({type:"unknown"})}function Zf(e,n){return new e({type:"never",...C(n)})}function Jf(e,n){return new e({type:"void",...C(n)})}function Uf(e,n){return new e({type:"date",...C(n)})}function Bf(e,n){return new e({type:"nan",...C(n)})}function Rn(e,n){return new oa({check:"less_than",...C(n),value:e,inclusive:!1})}function tn(e,n){return new oa({check:"less_than",...C(n),value:e,inclusive:!0})}function An(e,n){return new ia({check:"greater_than",...C(n),value:e,inclusive:!1})}function rn(e,n){return new ia({check:"greater_than",...C(n),value:e,inclusive:!0})}function Kf(e){return An(0,e)}function Wf(e){return Rn(0,e)}function Gf(e){return tn(0,e)}function Hf(e){return rn(0,e)}function dt(e,n){return new gd({check:"multiple_of",...C(n),value:e})}function pt(e,n){return new bd({check:"max_size",...C(n),maximum:e})}function Pn(e,n){return new wd({check:"min_size",...C(n),minimum:e})}function rr(e,n){return new vd({check:"size_equals",...C(n),size:e})}function or(e,n){return new kd({check:"max_length",...C(n),maximum:e})}function Kn(e,n){return new xd({check:"min_length",...C(n),minimum:e})}function ir(e,n){return new Sd({check:"length_equals",...C(n),length:e})}function qo(e,n){return new Id({check:"string_format",format:"regex",...C(n),pattern:e})}function Lo(e){return new Cd({check:"string_format",format:"lowercase",...C(e)})}function Vo(e){return new Ed({check:"string_format",format:"uppercase",...C(e)})}function Mo(e,n){return new Od({check:"string_format",format:"includes",...C(n),includes:e})}function Fo(e,n){return new jd({check:"string_format",format:"starts_with",...C(n),prefix:e})}function Zo(e,n){return new _d({check:"string_format",format:"ends_with",...C(n),suffix:e})}function Qf(e,n,t){return new Rd({check:"property",property:e,schema:n,...C(t)})}function Jo(e,n){return new Ad({check:"properties",shape:e,...C(n)})}function Uo(e,n){return new Pd({check:"mime_type",mime:e,...C(n)})}function vn(e){return new Td({check:"overwrite",tx:e})}function Bo(e){return vn((n)=>n.normalize(e))}function Ko(){return vn((e)=>e.trim())}function Wo(){return vn((e)=>e.toLowerCase())}function Go(){return vn((e)=>e.toUpperCase())}function Ho(){return vn((e)=>Mu(e))}function Yf(e,n,t){return new e({type:"array",element:n,...C(t)})}function Xf(e,n){return new e({type:"file",...C(n)})}function em(e,n,t){let r=C(t);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:n,...r})}function nm(e,n,t){return new e({type:"custom",check:"custom",fn:n,...C(t)})}function tm(e,n){let t=Pv((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Jn(o,r.value,t._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(Jn(i))}},e(r.value,r)),n);return t}function Pv(e,n){let t=new le({check:"custom",...C(n)});return t._zod.check=e,t}function rm(e){let n=new le({check:"describe"});return n._zod.onattach=[(t)=>{let r=Ve.get(t)??{};Ve.add(t,{...r,description:e})}],n._zod.check=()=>{},n}function om(e){let n=new le({check:"meta"});return n._zod.onattach=[(t)=>{let r=Ve.get(t)??{};Ve.add(t,{...r,...e})}],n._zod.check=()=>{},n}function im(e,n){let t=C(n),r=t.truthy??["true","1","yes","on","y","enabled"],o=t.falsy??["false","0","no","off","n","disabled"];if(t.case!=="sensitive")r=r.map((h)=>typeof h==="string"?h.toLowerCase():h),o=o.map((h)=>typeof h==="string"?h.toLowerCase():h);let i=new Set(r),s=new Set(o),a=e.Codec??jo,c=e.Boolean??Eo,u=new(e.String??ut)({type:"string",error:t.error}),d=new c({type:"boolean",error:t.error}),g=new a({type:"pipe",in:u,out:d,transform:(h,y)=>{let S=h;if(t.case!=="sensitive")S=S.toLowerCase();if(i.has(S))return!0;else if(s.has(S))return!1;else return y.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:y.value,inst:g,continue:!1}),{}},reverseTransform:(h,y)=>{if(h===!0)return r[0]||"true";else return o[0]||"false"},error:t.error});return g._zod.bag.truthy=r,g._zod.bag.falsy=o,g._zod.bag.case=t.case??"insensitive",g}function ft(e,n,t,r={}){let o=C(r),i={check:"string_format",type:"string",format:n,fn:typeof t==="function"?t:(a)=>t.test(a),...o};if(t instanceof RegExp)i.pattern=t;return new e(i)}function sr(e,...n){for(let t of n)for(let r of Reflect.ownKeys(t))if(Object.prototype.propertyIsEnumerable.call(t,r))_e(e,r,t[r]);return e}function cr(e){let n=e?.target??"draft-2020-12";if(n==="draft-4")n="draft-04";if(n==="draft-7")n="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Ve,target:n,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function Ce(e,n,t,r,o){let i=typeof n.unrepresentable==="function"?n.unrepresentable({zodSchema:e,path:r.path,message:o}):n.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(t,i),!0}function ue(e,n,t={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=n.seen.get(e);if(i){if(i.count++,t.schemaPath.includes(e))i.cycle=t.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:t.path};n.seen.set(e,s),n.sharedDefsExtractedFor=void 0,n.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...t,schemaPath:[...t.schemaPath,e],path:t.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,s.schema,u);else{let g=s.schema,h=n.processors[o.type];if(!h)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,n,g,u)}let d=e._zod.parent;if(d){if(!s.ref)s.ref=d;ue(d,n,u),n.seen.get(d).isParent=!0}}let c=n.metadataRegistry.get(e);if(c)sr(s.schema,c);if(n.io==="input"&&Te(e))delete s.schema.examples,delete s.schema.default;if(n.io==="input"&&"_prefault"in s.schema)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,n.seen.get(e).schema}function sm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function lr(e,n){let t=e.seen.get(n);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,g=e.external.uri??((y)=>y);if(d)return{ref:g(d)};let h=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=h,{defId:h,ref:`${g("__shared")}#/${a}/${sm(h)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===t&&!s[1].schema.id)return{ref:c};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+sm(u)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=o(s);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
61
61
 
62
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(n===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(n!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function om(e){let n=e.anyOf;if(!Array.isArray(n)||n.length===0||e.type!==void 0)return;let t=[];for(let r of n){if(!r||typeof r!=="object")return;om(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!t.includes(s))t.push(s)}}delete e.anyOf,e.type=t.length===1?t[0]:t}var im=new Set(["type","properties","required","additionalProperties"]),tm=["oneOf","anyOf"];function rm(e){let n=e.additionalProperties;if(n===void 0||n===!1||typeof n!=="object"||n===null)return null;return Object.keys(n).length?n:null}function La(e){let n=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!im.has(s))return null;n.push(i)}let t={},r=new Set;for(let i of n){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(t,s))continue;let a=[];for(let l of n){let u=l.properties?.[s]??rm(l);if(u===null||u===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(u)))a.push(u)}let c=a.length===1?a[0]:La(a)??{allOf:a};je(t,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:t};if(r.size)o.required=[...r];if(n.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of n){let a=rm(s);if(a&&!i.some((c)=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function Sv(e){let n=e.allOf;if(!Array.isArray(n)||n.length<2)return;for(let o of im)if(o in e)return;let t=n.filter((o)=>tm.some((i)=>Array.isArray(o[i]))),r=null;if(!t.length)r=La(n);else{let o=t[0],i=tm.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=n.filter((c)=>c!==o),a=o[i].map((c)=>La([...s,c]));if(a.some((c)=>!c))return;r={[i]:a}}if(!r)return;delete e.allOf,sr(e,r)}function ur(e,n){let t=e.seen.get(n);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){r(d);let h=e.seen.get(d),y=h.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(y);else sr(l,y);if(sr(l,u),a._zod.parent===d)for(let j in l){if(j==="$ref"||j==="allOf")continue;if(!(j in u))delete l[j]}if(y.$ref&&h.def)for(let j in l){if(j==="$ref"||j==="allOf")continue;if(j in h.def&&JSON.stringify(l[j])===JSON.stringify(h.def[j]))delete l[j]}}let g=a._zod.parent;if(g&&g!==d){r(g);let h=e.seen.get(g);if(h?.schema.$ref){if(l.$ref=h.schema.$ref,h.def)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(y in h.def&&JSON.stringify(l[y])===JSON.stringify(h.def[y]))delete l[y]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())om(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);if(d)d.push(l);else a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])Sv(l)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(n)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}sr(o,t.defId?t.schema:t.def??t.schema);let i=e.metadataRegistry.get(n)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;je(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...n["~standard"],jsonSchema:{input:ar(n,"input",e.processors),output:ar(n,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function $e(e,n){let t=n??{seen:new Set};if(t.seen.has(e))return!1;t.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return $e(r.element,t);if(r.type==="set")return $e(r.valueType,t);if(r.type==="lazy")return $e(r.getter(),t);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return $e(r.innerType,t);if(r.type==="intersection")return $e(r.left,t)||$e(r.right,t);if(r.type==="record"||r.type==="map")return $e(r.keyType,t)||$e(r.valueType,t);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return $e(r.in,t)||$e(r.out,t)}if(r.type==="object"){for(let o in r.shape)if($e(r.shape[o],t))return!0;return!1}if(r.type==="union"){for(let o of r.options)if($e(o,t))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if($e(o,t))return!0;if(r.rest&&$e(r.rest,t))return!0;return!1}return!1}var sm=(e,n={})=>(t)=>{let r=cr({...t,processors:n});return ue(e,r),lr(r,e),ur(r,e)},ar=(e,n,t={})=>(r)=>{let{libraryOptions:o,target:i}=r??{},s=cr({...o??{},target:i,io:n,processors:t});return ue(e,s),lr(s,e),ur(s,e)};var ft=(e,n,t)=>{if(e[n]===void 0||t>e[n])e[n]=t},mt=(e,n,t)=>{if(e[n]===void 0||t<e[n])e[n]=t},am=(e,n)=>{ft(e,"minimum",n),mt(e,"maximum",n)},pm=(e,n)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(n))e.multipleOf.push(n)},fm=(e,n)=>{e.patterns??(e.patterns=new Set),e.patterns.add(n)},mm=(e,n)=>{e.mime=e.mime?e.mime.filter((t)=>n.includes(t)):[...n]},gm=(e,n)=>{if(e.format=n,n.includes("int"))e.isInt=!0},cm=(e,n)=>ft(e,"minimum",n.minimum),lm=(e,n)=>mt(e,"maximum",n.maximum),um=(e)=>(n,t)=>{gm(n,t.format);let[r,o]=e[t.format];ft(n,"minimum",r),mt(n,"maximum",o)},Iv={greater_than:(e,n)=>ft(e,n.inclusive?"minimum":"exclusiveMinimum",n.value),less_than:(e,n)=>mt(e,n.inclusive?"maximum":"exclusiveMaximum",n.value),multiple_of:(e,n)=>pm(e,n.value),number_format:um(io),bigint_format:um(so),min_length:cm,max_length:lm,length_equals:(e,n)=>am(e,n.length),min_size:cm,max_size:lm,size_equals:(e,n)=>am(e,n.size),string_format:(e,n)=>{if(gm(e,n.format),n.pattern)fm(e,n.pattern);if(n.format==="base64"||n.format==="base64url")e.contentEncoding=n.format;if(n.local||n.precision===-1)e.laxFormat=!0},mime_type:(e,n)=>mm(e,n.mime)};function ke(e){let n={},t=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...t.checks??[]]:t.checks??[];for(let i of r)Iv[i._zod.def.check]?.(n,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)ft(n,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)ft(n,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)mt(n,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)mt(n,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)pm(n,o.multipleOf);if(o.format!==void 0){if(n.format??(n.format=o.format),o.format.includes("int"))n.isInt=!0}if(o.mime)mm(n,o.mime);for(let i of o.patterns??[])fm(n,i);return n}var Cv={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ov=new Map([[ca,zs],[Co,Ds]]),hm=(e)=>Ov.get(e)??e,qa=(e,n,t,r)=>{let o=t;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=ke(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=Cv[a]??a,o.format==="")delete o.format;if(a==="time"||u)delete o.format}if(l)o.contentEncoding=l;if(c&&c.size>0){let d=[...c].map(hm);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((g)=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))]}},Fa=(e,n,t,r)=>{let o=t,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=ke(e);o.type=u?"integer":"number";let d=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),g=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),h=n.target==="draft-04"||n.target==="openapi-3.0";if(d)if(h)o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;else if(typeof i==="number")o.minimum=i;if(g)if(h)o.maximum=c,o.exclusiveMaximum=!0;else o.exclusiveMaximum=c;else if(typeof s==="number")o.maximum=s;if(a){let y=new Set;for(let N of a)if(Number.isFinite(N)&&N!==0)y.add(Math.abs(N));else Ce(e,n,o,r,`A multipleOf divisor of ${N} cannot be represented in JSON Schema`);let[S,...j]=y;if(S!==void 0)o.multipleOf=S;if(j.length)o.allOf=[...o.allOf??[],...j.map((N)=>({multipleOf:N}))]}},Za=(e,n,t,r)=>{t.type="boolean"},Ja=(e,n,t,r)=>{Ce(e,n,t,r,"BigInt cannot be represented in JSON Schema")},Ua=(e,n,t,r)=>{Ce(e,n,t,r,"Symbols cannot be represented in JSON Schema")},Ba=(e,n,t,r)=>{if(n.target==="openapi-3.0")t.type="string",t.nullable=!0,t.enum=[null];else t.type="null"},Ka=(e,n,t,r)=>{Ce(e,n,t,r,"Undefined cannot be represented in JSON Schema")},Wa=(e,n,t,r)=>{Ce(e,n,t,r,"Void cannot be represented in JSON Schema")},Ga=(e,n,t,r)=>{t.not={}},Ha=(e,n,t,r)=>{},Qa=(e,n,t,r)=>{},Ya=(e,n,t,r)=>{Ce(e,n,t,r,"Date cannot be represented in JSON Schema")},Xa=(e,n,t,r)=>{let o=e._zod.def,i=Zt(o.entries);if(i.length===0){t.not={};return}if(i.every((s)=>typeof s==="number"))t.type="number";if(i.every((s)=>typeof s==="string"))t.type="string";t.enum=i},ec=(e,n,t,r)=>{let o=e._zod.def;if(o.values.length===0){t.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(Ce(e,n,t,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(Ce(e,n,t,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(t.type=s===null?"null":typeof s,n.target==="draft-04"||n.target==="openapi-3.0")t.enum=[s];else t.const=s}else{if(i.every((s)=>typeof s==="number"))t.type="number";if(i.every((s)=>typeof s==="string"))t.type="string";if(i.every((s)=>typeof s==="boolean"))t.type="boolean";if(i.every((s)=>s===null))t.type="null";t.enum=i}},nc=(e,n,t,r)=>{Ce(e,n,t,r,"NaN cannot be represented in JSON Schema")},tc=(e,n,t,r)=>{let o=t,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},rc=(e,n,t,r)=>{let o=t;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=ke(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!a)return;if(a.length===0)o.not={};else if(a.length===1)o.contentMediaType=a[0];else o.anyOf=a.map((c)=>({contentMediaType:c}))},oc=(e,n,t,r)=>{t.type="boolean"},ic=(e,n,t,r)=>{Ce(e,n,t,r,"Custom types cannot be represented in JSON Schema")},sc=(e,n,t,r)=>{Ce(e,n,t,r,"Function types cannot be represented in JSON Schema")},ac=(e,n,t,r)=>{Ce(e,n,t,r,"Transforms cannot be represented in JSON Schema")},cc=(e,n,t,r)=>{Ce(e,n,t,r,"Map cannot be represented in JSON Schema")},lc=(e,n,t,r)=>{Ce(e,n,t,r,"Set cannot be represented in JSON Schema")},uc=(e,n,t,r)=>{let o=t,i=e._zod.def,{minimum:s,maximum:a}=ke(e);if(typeof s==="number")o.minItems=s;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=ue(i.element,n,{...r,path:[...r.path,"items"]})};function dr(e){let n=e._zod.def;if(n.type==="pipe"&&n.in._zod.traits.has("$ZodTransform"))return dr(n.out);if(n.type==="catch")return dr(n.innerType);return e._zod.optin}var dc=(e,n,t,r)=>{let o=t,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Ce(e,n,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)je(o.properties,l,ue(s[l],n,{...r,path:[...r.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let u=i.shape[l];if(n.io==="input"?dr(u)===void 0:u._zod.optout===void 0)c.push(l)}if(c.length>0)o.required=c;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(n.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=ue(i.catchall,n,{...r,path:[...r.path,"additionalProperties"]})},Qo=(e,n,t,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>ue(a,n,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));if(i)t.oneOf=s;else t.anyOf=s},pc=(e,n,t,r)=>{let o=e._zod.def,i=ue(o.left,n,{...r,path:[...r.path,"allOf",0]}),s=ue(o.right,n,{...r,path:[...r.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];t.allOf=c,n.intersections.push(c)},fc=(e,n,t,r)=>{let o=t,i=e._zod.def;o.type="array";let s=n.target==="draft-2020-12"?"prefixItems":"items",a=n.target==="draft-2020-12"?"items":n.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((S,j)=>ue(S,n,{...r,path:[...r.path,s,j]})),l=i.rest?ue(i.rest,n,{...r,path:[...r.path,a,...n.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;while(u>0){let S=i.items[u-1];if(!(n.io==="input"?dr(S)!==void 0:S._zod.optout==="optional"))break;u--}let d=i.items.length,g=!i.rest;if(n.target==="draft-2020-12"){if(o.prefixItems=c,g)o.items=!1;else if(l)o.items=l;if(u>0)o.minItems=u;if(g)o.maxItems=d}else if(n.target==="openapi-3.0"){if(o.items={anyOf:c},l)o.items.anyOf.push(l);if(u>0)o.minItems=u;if(g)o.maxItems=d}else{if(o.items=c,g)o.additionalItems=!1;else if(l)o.additionalItems=l;if(u>0)o.minItems=u;if(g)o.maxItems=d}let{minimum:h,maximum:y}=ke(e);if(typeof h==="number")o.minItems=h;if(typeof y==="number")o.maxItems=y};function Va(e,n,t){if(n.$ref){if(t.has(n))return n;t.add(n);let y=e.get(n)?.def;if(!y)return n;let S=Va(e,y,t);return S===y?n:S}for(let y of["anyOf","oneOf"]){let S=n[y];if(!Array.isArray(S))continue;let j=S.map((N)=>Va(e,N,t));if(j.some((N,D)=>N!==S[D]))n={...n,[y]:j}}let r=Array.isArray(n.type)?n.type:[n.type],o=!r.includes("string")&&r.some((y)=>y==="number"||y==="integer"),i=n.enum??(n.const!==void 0?[n.const]:void 0);if(!o&&!i?.some((y)=>typeof y==="number"))return n;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:g,...h}=n;if(h.enum)h.enum=h.enum.map((y)=>typeof y==="number"?String(y):y);else if(typeof h.const==="number")h.const=String(h.const);if(!o)return h;if(h.type="string",!i)h.pattern=(r.includes("number")?Un:Qt).source;return h}var Ma=new WeakMap;function Ev(e){let n=new Map;for(let r of e.seen.values())if(r.def&&!n.has(r.schema))n.set(r.schema,r);let t=new Map;for(let r of Ma.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||t.has(i))continue;let s=Va(n,i,new Set);if(s!==i)t.set(i,s)}if(!t.size)return;for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&t.get(o.propertyNames);if(i)o.propertyNames=i}}var mc=(e,n,t,r)=>{let o=t,i=e._zod.def;o.type="object";let s=i.keyType,a=ke(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let u=ue(i.valueType,n,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)je(o.patternProperties,hm(d).source,u)}else{if(n.target==="draft-07"||n.target==="draft-2020-12"){o.propertyNames=ue(i.keyType,n,{...r,path:[...r.path,"propertyNames"]});let u=Ma.get(n);if(!u)u=[],Ma.set(n,u),n.deferred.push(()=>Ev(n));u.push(e)}o.additionalProperties=ue(i.valueType,n,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,l=n.io==="input"&&dr(i.valueType)!==void 0;if(c&&!i.partial&&!l){let u=[...c].filter((d)=>typeof d==="string"||typeof d==="number");if(u.length>0)o.required=u.map(String)}},gc=(e,n,t,r)=>{let o=e._zod.def,i=ue(o.innerType,n,r),s=n.seen.get(e);if(n.target==="openapi-3.0")s.ref=o.innerType,t.nullable=!0;else t.anyOf=[i,{type:"null"}]},hc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},yc=Symbol();function ym(e,n,t,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return i=!0,null});if(!i)return JSON.parse(s);return Ce(n,t,r,o,"BigInt defaults cannot be represented in JSON Schema"),yc}var bc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType;let s=ym(o.defaultValue,e,n,t,r);if(s!==yc)t.default=s},wc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);if(i.ref=o.innerType,n.io!=="input")return;let s=ym(o.defaultValue,e,n,t,r);if(s!==yc)t._prefault=s},vc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{Ce(e,n,t,r,"Dynamic catch values are not supported in JSON Schema");return}t.default=s},xc=(e,n,t,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=n.io==="input"?i?o.out:o.in:o.out;ue(s,n,r);let a=n.seen.get(e);a.ref=s},kc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType,t.readOnly=!0},Sc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},Yo=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},Ic=(e,n,t,r)=>{let o=e._zod.innerType;ue(o,n,r);let i=n.seen.get(e);i.ref=o},dm={string:qa,number:Fa,boolean:Za,bigint:Ja,symbol:Ua,null:Ba,undefined:Ka,void:Wa,never:Ga,any:Ha,unknown:Qa,date:Ya,enum:Xa,literal:ec,nan:nc,template_literal:tc,file:rc,success:oc,custom:ic,function:sc,transform:ac,map:cc,set:lc,array:uc,object:dc,union:Qo,intersection:pc,tuple:fc,record:mc,nullable:gc,nonoptional:hc,default:bc,prefault:wc,catch:vc,pipe:xc,readonly:kc,promise:Sc,optional:Yo,lazy:Ic};function gt(e,n){if("_idmap"in e){let r=e,o=cr({...n,processors:dm}),i={};for(let c of r._idmap.entries()){let[l,u]=c;ue(u,o)}let s={},a={registry:r,uri:n?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[l,u]=c;lr(o,u),je(s,l,ur(o,u))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let t=cr({...n,processors:dm});return ue(e,t),lr(t,e),ur(t,e)}var Yc={};no(Yc,{ZodAny:()=>Vm,ZodArray:()=>Jm,ZodBase64:()=>qc,ZodBase64URL:()=>Fc,ZodBigInt:()=>Kc,ZodBigIntFormat:()=>Wc,ZodBoolean:()=>Bc,ZodCIDRv4:()=>Vc,ZodCIDRv6:()=>Mc,ZodCUID:()=>Pc,ZodCUID2:()=>$c,ZodCatch:()=>ug,ZodCodec:()=>ci,ZodCreditCard:()=>$m,ZodCustom:()=>li,ZodCustomStringFormat:()=>vt,ZodDate:()=>Zm,ZodDefault:()=>og,ZodDiscriminatedUnion:()=>Bm,ZodE164:()=>Zc,ZodEmail:()=>_c,ZodEmoji:()=>Rc,ZodEnum:()=>mr,ZodExactOptional:()=>Hc,ZodFile:()=>eg,ZodFunction:()=>vg,ZodGUID:()=>jc,ZodIBAN:()=>Tm,ZodIPv4:()=>Dc,ZodIPv6:()=>Lc,ZodISODate:()=>yt,ZodISODateTime:()=>ht,ZodISODuration:()=>wt,ZodISOTime:()=>bt,ZodInstanceOf:()=>Sg,ZodIntersection:()=>Km,ZodJWT:()=>Jc,ZodKSUID:()=>zc,ZodLazy:()=>yg,ZodLiteral:()=>Xm,ZodMAC:()=>Pm,ZodMap:()=>Qm,ZodNaN:()=>pg,ZodNanoID:()=>Ac,ZodNever:()=>qm,ZodNonOptional:()=>Qc,ZodNull:()=>Dm,ZodNullable:()=>rg,ZodNumber:()=>Uc,ZodNumberFormat:()=>xt,ZodObject:()=>oi,ZodOptional:()=>si,ZodPipe:()=>ai,ZodPrefault:()=>sg,ZodPreprocess:()=>fg,ZodPromise:()=>wg,ZodReadonly:()=>mg,ZodRecord:()=>fr,ZodSet:()=>Ym,ZodString:()=>Ec,ZodStringFormat:()=>ae,ZodSuccess:()=>lg,ZodSymbol:()=>Nm,ZodTemplateLiteral:()=>hg,ZodTransform:()=>ng,ZodTuple:()=>Gm,ZodType:()=>Z,ZodULID:()=>Tc,ZodURL:()=>ri,ZodUUID:()=>xn,ZodUndefined:()=>zm,ZodUnion:()=>ii,ZodUnknown:()=>Mm,ZodVoid:()=>Fm,ZodXID:()=>Nc,ZodXor:()=>Um,_ZodString:()=>Oc,_default:()=>ig,_function:()=>Lx,any:()=>wx,array:()=>P,base64:()=>Xv,base64url:()=>ex,bigint:()=>mx,boolean:()=>me,catch:()=>dg,check:()=>Vx,cidrv4:()=>Qv,cidrv6:()=>Yv,codec:()=>Tx,creditCard:()=>tx,cuid:()=>Zv,cuid2:()=>Jv,currencyCode:()=>cx,custom:()=>Mx,date:()=>xx,describe:()=>qx,discriminatedUnion:()=>an,e164:()=>nx,email:()=>$v,emoji:()=>qv,enum:()=>ee,exactOptional:()=>tg,file:()=>Rx,float32:()=>ux,float64:()=>dx,function:()=>Lx,guid:()=>Tv,hash:()=>lx,hex:()=>ax,hostname:()=>sx,httpUrl:()=>Mv,iban:()=>rx,instanceof:()=>Zx,int:()=>we,int32:()=>px,int64:()=>gx,intersection:()=>Wm,invertCodec:()=>Nx,ipv4:()=>Wv,ipv6:()=>Hv,json:()=>Te,jwt:()=>ox,keyof:()=>kx,ksuid:()=>Kv,lazy:()=>bg,literal:()=>w,looseObject:()=>Sx,looseRecord:()=>Ox,mac:()=>Gv,map:()=>Ex,meta:()=>Fx,nan:()=>$x,nanoid:()=>Fv,nativeEnum:()=>jx,never:()=>sn,nonoptional:()=>cg,null:()=>Lm,nullable:()=>ti,nullish:()=>Ax,number:()=>X,object:()=>O,optional:()=>ni,partialRecord:()=>Cx,pipe:()=>Cc,prefault:()=>ag,preprocess:()=>Ig,promise:()=>Dx,readonly:()=>gg,record:()=>re,refine:()=>xg,set:()=>_x,strictObject:()=>x,string:()=>R,stringFormat:()=>ix,stringbool:()=>Jx,success:()=>Px,superRefine:()=>kg,symbol:()=>yx,templateLiteral:()=>zx,transform:()=>Gc,tuple:()=>Hm,uint32:()=>fx,uint64:()=>hx,ulid:()=>Uv,undefined:()=>bx,union:()=>te,unknown:()=>pn,url:()=>Vv,uuid:()=>Nv,uuidv4:()=>zv,uuidv6:()=>Dv,uuidv7:()=>Lv,void:()=>vx,xid:()=>Bv,xor:()=>Ix});var Xo={};no(Xo,{endsWith:()=>Zo,gt:()=>An,gte:()=>on,includes:()=>qo,length:()=>ir,lowercase:()=>Vo,lt:()=>Rn,lte:()=>rn,maxLength:()=>or,maxSize:()=>dt,mime:()=>Uo,minLength:()=>Bn,minSize:()=>Pn,multipleOf:()=>ut,negative:()=>Zf,nonnegative:()=>Uf,nonpositive:()=>Jf,normalize:()=>Bo,overwrite:()=>vn,positive:()=>Ff,properties:()=>Jo,property:()=>Bf,regex:()=>Lo,size:()=>rr,slugify:()=>Ho,startsWith:()=>Fo,toLowerCase:()=>Wo,toUpperCase:()=>Go,trim:()=>Ko,uppercase:()=>Mo});var bm=new WeakSet([Object.prototype,Error.prototype]);function ei(e,n,t){Object.defineProperty(e,n,{configurable:!0,enumerable:!1,get(){let r=t(this);return Object.defineProperty(this,n,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,n,{value:r,configurable:!0,writable:!0})}})}var wm=(e,n)=>{Hu.init(e,n),e.name="ZodError";let t=Object.getPrototypeOf(e);if(bm.has(t))return;bm.add(t),ei(t,"format",(r)=>(o)=>Yu(r,o)),ei(t,"flatten",(r)=>(o)=>Qu(r,o)),ei(t,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Jt,2)}),ei(t,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Jt,2)}),Object.defineProperty(t,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},Rv=m("ZodError",wm),Ke=m("ZodError",wm,void 0,{Parent:Error});var vm=Wt(Ke),xm=Gt(Ke),km=mo(Ke),Sm=go(Ke),Im=ed(Ke),Cm=nd(Ke),Om=td(Ke),Em=rd(Ke),_m=od(Ke),jm=id(Ke),Rm=sd(Ke),Am=ad(Ke);function Pv(){if(!_e.localeError)Re(ha())}function Kn(){if(!_e.memoizer)Re({memoizer:gf()})}var Z=m("ZodType",(e,n)=>(Pv(),M.init(e,n),e.def=n,e.type=n.type,e),{check(...e){let n=this.def;return this.clone(Je(n,{checks:[...n.checks??[],...e.map((t)=>typeof t==="function"?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,n){return un(this,e,n)},brand(){return this},register(e,n){return e.add(this,n),this},refine(e,n){return this.check(xg(e,n))},superRefine(e,n){return this.check(kg(e,n))},overwrite(e){return this.check(vn(e))},optional(){return ni(this)},exactOptional(){return tg(this)},nullable(){return ti(this)},nullish(){return ni(ti(this))},nonoptional(e){return cg(this,e)},array(){return P(this)},or(e){return te([this,e])},and(e){return Wm(this,e)},transform(e){return Cc(this,Gc(e))},default(e){return ig(this,e)},prefault(e){return ag(this,e)},catch(e){return dg(this,e)},pipe(e){return Cc(this,e)},readonly(){return gg(this)},describe(e){let n=this.clone();return Me.add(n,{description:e}),n},meta(...e){if(e.length===0)return Me.get(this);let n=this.clone();return Me.add(n,e[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...n){return n.length===0?e(this):e(this,...n)},get "~standard"(){return Kt(this,"~standard",{...aa(this),jsonSchema:{input:ar(this,"input"),output:ar(this,"output")}})},set "~standard"(e){bn(this,"~standard",e)},parse:function e(n,t){return vm(this,n,t,{callee:e})},parseAsync:async function e(n,t){return await xm(this,n,t,{callee:e})},safeParse(e,n){return km(this,e,n)},async safeParseAsync(e,n){return Sm(this,e,n)},get spa(){return this?.safeParseAsync},set spa(e){bn(this,"spa",e)},validate(e,n){return ys(this,e,n)},validateAsync(e,n){return bs(this,e,n)},encode:function e(n,t){return Im(this,n,t,{callee:e})},decode:function e(n,t){return Cm(this,n,t,{callee:e})},encodeAsync:async function e(n,t){return await Om(this,n,t,{callee:e})},decodeAsync:async function e(n,t){return await Em(this,n,t,{callee:e})},safeEncode(e,n){return _m(this,e,n)},safeDecode(e,n){return jm(this,e,n)},async safeEncodeAsync(e,n){return Rm(this,e,n)},async safeDecodeAsync(e,n){return Am(this,e,n)},toJSONSchema(e){return sm(this,{})(e)},get description(){return Me.get(this)?.description},get _def(){return this._zod.def}}),Oc=m("_ZodString",(e,n)=>{lt.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>qa(e,t,r,o)},po({format:(e)=>ke(e).format??null,minLength:(e)=>ke(e).minimum??null,maxLength:(e)=>ke(e).maximum??null},{regex(...e){return this.check(Lo(...e))},includes(...e){return this.check(qo(...e))},startsWith(...e){return this.check(Fo(...e))},endsWith(...e){return this.check(Zo(...e))},min(...e){return this.check(Bn(...e))},max(...e){return this.check(or(...e))},length(...e){return this.check(ir(...e))},nonempty(...e){return this.check(Bn(1,...e))},lowercase(e){return this.check(Vo(e))},uppercase(e){return this.check(Mo(e))},trim(){return this.check(Ko())},normalize(...e){return this.check(Bo(...e))},toLowerCase(){return this.check(Wo())},toUpperCase(){return this.check(Go())},slugify(){return this.check(Ho())}})),Ec=m("ZodString",(e,n)=>{lt.init(e,n),Oc.init(e,n)},{email(e){return this.check(ya(_c,e))},url(e){return this.check($o(ri,e))},jwt(e){return this.check(Da(Jc,e))},emoji(e){return this.check(Sa(Rc,e))},guid(e){return this.check(ba(jc,e))},uuid(e){return this.check(wa(xn,e))},uuidv4(e){return this.check(va(xn,e))},uuidv6(e){return this.check(xa(xn,e))},uuidv7(e){return this.check(ka(xn,e))},nanoid(e){return this.check(Ia(Ac,e))},cuid(e){return this.check(Ca(Pc,e))},cuid2(e){return this.check(Oa($c,e))},ulid(e){return this.check(Ea(Tc,e))},base64(e){return this.check(Ta(qc,e))},base64url(e){return this.check(Na(Fc,e))},xid(e){return this.check(_a(Nc,e))},ksuid(e){return this.check(ja(zc,e))},ipv4(e){return this.check(Ra(Dc,e))},ipv6(e){return this.check(Aa(Lc,e))},cidrv4(e){return this.check(Pa(Vc,e))},cidrv6(e){return this.check($a(Mc,e))},e164(e){return this.check(za(Zc,e))},datetime(e){return this.check(To(ht,e))},date(e){return this.check(No(yt,e))},time(e){return this.check(zo(bt,e))},duration(e){return this.check(Do(wt,e))}});function R(e){return wf(Ec,e)}var ae=m("ZodStringFormat",(e,n)=>{se.init(e,n),Oc.init(e,n)}),ht=m("ZodISODateTime",(e,n)=>{ap.init(e,n),ae.init(e,n)}),yt=m("ZodISODate",(e,n)=>{cp.init(e,n),ae.init(e,n)}),bt=m("ZodISOTime",(e,n)=>{lp.init(e,n),ae.init(e,n)}),wt=m("ZodISODuration",(e,n)=>{up.init(e,n),ae.init(e,n)}),_c=m("ZodEmail",(e,n)=>{Hd.init(e,n),ae.init(e,n)});function $v(e){return ya(_c,e)}var jc=m("ZodGUID",(e,n)=>{Wd.init(e,n),ae.init(e,n)});function Tv(e){return ba(jc,e)}var xn=m("ZodUUID",(e,n)=>{Gd.init(e,n),ae.init(e,n)});function Nv(e){return wa(xn,e)}function zv(e){return va(xn,e)}function Dv(e){return xa(xn,e)}function Lv(e){return ka(xn,e)}var ri=m("ZodURL",(e,n)=>{Xd.init(e,n),ae.init(e,n)});function Vv(e){return $o(ri,e)}function Mv(e){return $o(ri,{protocol:Ht,hostname:Vs,...C(e)})}var Rc=m("ZodEmoji",(e,n)=>{ep.init(e,n),ae.init(e,n)});function qv(e){return Sa(Rc,e)}var Ac=m("ZodNanoID",(e,n)=>{np.init(e,n),ae.init(e,n)});function Fv(e){return Ia(Ac,e)}var Pc=m("ZodCUID",(e,n)=>{tp.init(e,n),ae.init(e,n)});function Zv(e){return Ca(Pc,e)}var $c=m("ZodCUID2",(e,n)=>{rp.init(e,n),ae.init(e,n)});function Jv(e){return Oa($c,e)}var Tc=m("ZodULID",(e,n)=>{op.init(e,n),ae.init(e,n)});function Uv(e){return Ea(Tc,e)}var Nc=m("ZodXID",(e,n)=>{ip.init(e,n),ae.init(e,n)});function Bv(e){return _a(Nc,e)}var zc=m("ZodKSUID",(e,n)=>{sp.init(e,n),ae.init(e,n)});function Kv(e){return ja(zc,e)}var Dc=m("ZodIPv4",(e,n)=>{dp.init(e,n),ae.init(e,n)});function Wv(e){return Ra(Dc,e)}var Pm=m("ZodMAC",(e,n)=>{mp.init(e,n),ae.init(e,n)});function Gv(e){return vf(Pm,e)}var Lc=m("ZodIPv6",(e,n)=>{fp.init(e,n),ae.init(e,n)});function Hv(e){return Aa(Lc,e)}var Vc=m("ZodCIDRv4",(e,n)=>{gp.init(e,n),ae.init(e,n)});function Qv(e){return Pa(Vc,e)}var Mc=m("ZodCIDRv6",(e,n)=>{hp.init(e,n),ae.init(e,n)});function Yv(e){return $a(Mc,e)}var qc=m("ZodBase64",(e,n)=>{bp.init(e,n),ae.init(e,n)});function Xv(e){return Ta(qc,e)}var Fc=m("ZodBase64URL",(e,n)=>{wp.init(e,n),ae.init(e,n)});function ex(e){return Na(Fc,e)}var Zc=m("ZodE164",(e,n)=>{vp.init(e,n),ae.init(e,n)});function nx(e){return za(Zc,e)}var $m=m("ZodCreditCard",(e,n)=>{xp.init(e,n),ae.init(e,n)});function tx(e){return xf($m,e)}var Tm=m("ZodIBAN",(e,n)=>{kp.init(e,n),ae.init(e,n)});function rx(e){return kf(Tm,e)}var Jc=m("ZodJWT",(e,n)=>{Sp.init(e,n),ae.init(e,n)});function ox(e){return Da(Jc,e)}var vt=m("ZodCustomStringFormat",(e,n)=>{Ip.init(e,n),ae.init(e,n)});function ix(e,n,t={}){return pt(vt,e,n,t)}function sx(e){return pt(vt,"hostname",Ls,e)}function ax(e){return pt(vt,"hex",Xs,e)}function cx(e){return pt(vt,"currency_code",qs,e)}function lx(e,n){let t=n?.enc??"hex",r=`${e}_${t}`,o=jn[r];if(!o)throw Error(`Unrecognized hash format: ${r}`);return pt(vt,r,o,n)}var Uc=m("ZodNumber",(e,n)=>{la.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Fa(e,t,r,o),e.isFinite=!0},po({minValue:(e)=>{let{minimum:n,exclusiveMinimum:t}=ke(e);return Math.max(n??Number.NEGATIVE_INFINITY,t??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:n,exclusiveMaximum:t}=ke(e);return Math.min(n??Number.POSITIVE_INFINITY,t??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:n,multipleOf:t}=ke(e);return!!n||!!t?.some(Number.isSafeInteger)},format:(e)=>ke(e).format??null},{gt(e,n){return this.check(An(e,n))},gte(e,n){return this.check(on(e,n))},min(e,n){return this.check(on(e,n))},lt(e,n){return this.check(Rn(e,n))},lte(e,n){return this.check(rn(e,n))},max(e,n){return this.check(rn(e,n))},int(e){return this.check(we(e))},safe(e){return this.check(we(e))},positive(e){return this.check(An(0,e))},nonnegative(e){return this.check(on(0,e))},negative(e){return this.check(Rn(0,e))},nonpositive(e){return this.check(rn(0,e))},multipleOf(e,n){return this.check(ut(e,n))},step(e,n){return this.check(ut(e,n))},finite(){return this}}));function X(e){return Sf(Uc,e)}var xt=m("ZodNumberFormat",(e,n)=>{Cp.init(e,n),Uc.init(e,n)});function we(e){return If(xt,e)}function ux(e){return Cf(xt,e)}function dx(e){return Of(xt,e)}function px(e){return Ef(xt,e)}function fx(e){return _f(xt,e)}var Bc=m("ZodBoolean",(e,n)=>{Oo.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Za(e,t,r,o)});function me(e){return jf(Bc,e)}var Kc=m("ZodBigInt",(e,n)=>{ua.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ja(e,t,r,o)},po({minValue:(e)=>ke(e).minimum??null,maxValue:(e)=>ke(e).maximum??null,format:(e)=>ke(e).format??null},{gte(e,n){return this.check(on(e,n))},min(e,n){return this.check(on(e,n))},gt(e,n){return this.check(An(e,n))},lt(e,n){return this.check(Rn(e,n))},lte(e,n){return this.check(rn(e,n))},max(e,n){return this.check(rn(e,n))},positive(e){return this.check(An(BigInt(0),e))},negative(e){return this.check(Rn(BigInt(0),e))},nonpositive(e){return this.check(rn(BigInt(0),e))},nonnegative(e){return this.check(on(BigInt(0),e))},multipleOf(e,n){return this.check(ut(e,n))}}));function mx(e){return Rf(Kc,e)}var Wc=m("ZodBigIntFormat",(e,n)=>{Op.init(e,n),Kc.init(e,n)});function gx(e){return Af(Wc,e)}function hx(e){return Pf(Wc,e)}var Nm=m("ZodSymbol",(e,n)=>{Ep.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ua(e,t,r,o)});function yx(e){return $f(Nm,e)}var zm=m("ZodUndefined",(e,n)=>{_p.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ka(e,t,r,o)});function bx(e){return Tf(zm,e)}var Dm=m("ZodNull",(e,n)=>{jp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ba(e,t,r,o)});function Lm(e){return Nf(Dm,e)}var Vm=m("ZodAny",(e,n)=>{Rp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ha(e,t,r,o)});function wx(){return zf(Vm)}var Mm=m("ZodUnknown",(e,n)=>{Ap.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Qa(e,t,r,o)});function pn(){return Df(Mm)}var qm=m("ZodNever",(e,n)=>{Pp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ga(e,t,r,o)});function sn(e){return Lf(qm,e)}var Fm=m("ZodVoid",(e,n)=>{$p.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Wa(e,t,r,o)});function vx(e){return Vf(Fm,e)}var Zm=m("ZodDate",(e,n)=>{Tp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ya(e,t,r,o),e.min=(t,r)=>e.check(on(t,r)),e.max=(t,r)=>e.check(rn(t,r))},po({minDate:(e)=>{let{minimum:n}=ke(e);return n?new Date(n):null},maxDate:(e)=>{let{maximum:n}=ke(e);return n?new Date(n):null}},{}));function xx(e){return Mf(Zm,e)}var Jm=m("ZodArray",(e,n)=>{Kn(),Np.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>uc(e,t,r,o),e.element=n.element},{min(e,n){return this.check(Bn(e,n))},nonempty(e){return this.check(Bn(1,e))},max(e,n){return this.check(or(e,n))},length(e,n){return this.check(ir(e,n))},unwrap(){return this.element}});function P(e,n){return Kf(Jm,e,n)}function kx(e){let n=e._zod.def.shape;return ee(Object.keys(n))}var oi=m("ZodObject",(e,n)=>{Kn(),Lp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>dc(e,t,r,o),fw(e,"shape",(t)=>t._zod.def.shape,!1)},{keyof(){return ee(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Je(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Je(this._zod.def,{catchall:pn()}))},loose(){return this.clone(Je(this._zod.def,{catchall:pn()}))},strict(){return this.clone(Je(this._zod.def,{catchall:sn()}))},strip(){return this.clone(Je(this._zod.def,{catchall:void 0}))},extend(e){return iw(this,e)},safeExtend(e){return sw(this,e)},merge(e){return aw(this,e)},pick(e){return rw(this,e)},omit(e){return ow(this,e)},partial(...e){return qu(si,this,e[0])},exactPartial(...e){return qu(Hc,this,e[0],"exactPartial")},required(...e){return cw(Qc,this,e[0])}});function O(e,n){let t={type:"object",shape:e??{},...C(n)};return new oi(t)}function x(e,n){return new oi({type:"object",shape:e,catchall:sn(),...C(n)})}function Sx(e,n){return new oi({type:"object",shape:e,catchall:pn(),...C(n)})}var ii=m("ZodUnion",(e,n)=>{Eo.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Qo(e,t,r,o),e.options=n.options});function te(e,n){return new ii({type:"union",options:e,...C(n)})}var Um=m("ZodXor",(e,n)=>{ii.init(e,n),Vp.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Qo(e,t,r,o),e.options=n.options});function Ix(e,n){return new Um({type:"union",options:e,inclusive:!1,...C(n)})}var Bm=m("ZodDiscriminatedUnion",(e,n)=>{ii.init(e,n),Mp.init(e,n)});function an(e,n,t){return new Bm({type:"union",options:n,discriminator:e,...C(t)})}var Km=m("ZodIntersection",(e,n)=>{qp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>pc(e,t,r,o)});function Wm(e,n){return new Km({type:"intersection",left:e,right:n})}var Gm=m("ZodTuple",(e,n)=>{Kn(),da.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>fc(e,t,r,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((n)=>new si({type:"optional",innerType:n}))})}});function Hm(e,n,t){let r=n instanceof M,o=r?t:n;return new Gm({type:"tuple",items:e,rest:r?n:null,...C(o)})}var fr=m("ZodRecord",(e,n)=>{Kn(),Fp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>mc(e,t,r,o),e.keyType=n.keyType,e.valueType=n.valueType});function re(e,n,t){if(!n||!n._zod)return new fr({type:"record",keyType:R(),valueType:e,...C(n)});return new fr({type:"record",keyType:e,valueType:n,...C(t)})}function Cx(e,n,t){return new fr({type:"record",keyType:e,valueType:n,...C(t),partial:!0})}function Ox(e,n,t){return new fr({type:"record",keyType:e,valueType:n,mode:"loose",...C(t)})}var Qm=m("ZodMap",(e,n)=>{Kn(),Zp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>cc(e,t,r,o),e.keyType=n.keyType,e.valueType=n.valueType,e.min=(...t)=>e.check(Pn(...t)),e.nonempty=(t)=>e.check(Pn(1,t)),e.max=(...t)=>e.check(dt(...t)),e.size=(...t)=>e.check(rr(...t))});function Ex(e,n,t){return new Qm({type:"map",keyType:e,valueType:n,...C(t)})}var Ym=m("ZodSet",(e,n)=>{Kn(),Jp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>lc(e,t,r,o),e.min=(...t)=>e.check(Pn(...t)),e.nonempty=(t)=>e.check(Pn(1,t)),e.max=(...t)=>e.check(dt(...t)),e.size=(...t)=>e.check(rr(...t))});function _x(e,n){return new Ym({type:"set",valueType:e,...C(n)})}var mr=m("ZodEnum",(e,n)=>{Up.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(r,o,i)=>Xa(e,r,o,i),e.enum=n.entries,e.options=[...e._zod.values];let t=new Set(Object.keys(n.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(t.has(s))i[s]=n.entries[s];else throw Error(`Key ${s} not found in enum`);return new mr({...n,checks:[],...C(o),entries:i})},e.exclude=(r,o)=>{let i={...n.entries};for(let s of r)if(t.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new mr({...n,checks:[],...C(o),entries:i})}});function ee(e,n){let t=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new mr({type:"enum",entries:t,...C(n)})}function jx(e,n){return new mr({type:"enum",entries:e,...C(n)})}var Xm=m("ZodLiteral",(e,n)=>{Bp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ec(e,t,r,o),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function w(e,n){return new Xm({type:"literal",values:Array.isArray(e)?e:[e],...C(n)})}var eg=m("ZodFile",(e,n)=>{Kp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>rc(e,t,r,o),e.min=(t,r)=>e.check(Pn(t,r)),e.max=(t,r)=>e.check(dt(t,r)),e.mime=(t,r)=>e.check(Uo(Array.isArray(t)?t:[t],r))});function Rx(e){return Wf(eg,e)}var ng=m("ZodTransform",(e,n)=>{Kn(),Wp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ac(e,t,r,o),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new ct(e.constructor.name);t.addIssue=(i)=>{if(typeof i==="string")t.issues.push(Zn(i,t.value,n));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=t.value;s.inst??(s.inst=e),t.issues.push(Zn(s))}};let o=n.transform(t.value,t);if(o instanceof Promise)return o.then((i)=>(t.value=i,t));return t.value=o,t}});function Gc(e){return new ng({type:"transform",transform:e})}var si=m("ZodOptional",(e,n)=>{pa.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Yo(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function ni(e){return new si({type:"optional",innerType:e})}var Hc=m("ZodExactOptional",(e,n)=>{Gp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Yo(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function tg(e){return new Hc({type:"optional",innerType:e})}var rg=m("ZodNullable",(e,n)=>{Hp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>gc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function ti(e){return new rg({type:"nullable",innerType:e})}function Ax(e){return ni(ti(e))}var og=m("ZodDefault",(e,n)=>{Qp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>bc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ig(e,n){return new og({type:"default",innerType:e,get defaultValue(){return typeof n==="function"?n():cs(n)}})}var sg=m("ZodPrefault",(e,n)=>{Yp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>wc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function ag(e,n){return new sg({type:"prefault",innerType:e,get defaultValue(){return typeof n==="function"?n():cs(n)}})}var Qc=m("ZodNonOptional",(e,n)=>{Xp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>hc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function cg(e,n){return new Qc({type:"nonoptional",innerType:e,...C(n)})}var lg=m("ZodSuccess",(e,n)=>{ef.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>oc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Px(e){return new lg({type:"success",innerType:e})}var ug=m("ZodCatch",(e,n)=>{nf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>vc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function dg(e,n){return new ug({type:"catch",innerType:e,catchValue:typeof n==="function"?n:Uu(n)})}var pg=m("ZodNaN",(e,n)=>{tf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>nc(e,t,r,o)});function $x(e){return qf(pg,e)}var ai=m("ZodPipe",(e,n)=>{fa.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>xc(e,t,r,o),e.in=n.in,e.out=n.out});function Cc(e,n){return new ai({type:"pipe",in:e,out:n})}var ci=m("ZodCodec",(e,n)=>{ai.init(e,n),_o.init(e,n)});function Tx(e,n,t){return new ci({type:"pipe",in:e,out:n,transform:t.decode,reverseTransform:t.encode})}function Nx(e){let n=e._zod.def;return new ci({type:"pipe",in:n.out,out:n.in,transform:n.reverseTransform,reverseTransform:n.transform})}var fg=m("ZodPreprocess",(e,n)=>{ai.init(e,n),rf.init(e,n)}),mg=m("ZodReadonly",(e,n)=>{of.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>kc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function gg(e){return new mg({type:"readonly",innerType:e})}var hg=m("ZodTemplateLiteral",(e,n)=>{sf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>tc(e,t,r,o)});function zx(e,n){return new hg({type:"template_literal",parts:e,...C(n)})}var yg=m("ZodLazy",(e,n)=>{lf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ic(e,t,r,o),e.unwrap=()=>e._zod.def.getter()});function bg(e){return new yg({type:"lazy",getter:e})}var wg=m("ZodPromise",(e,n)=>{cf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Sc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Dx(e){return new wg({type:"promise",innerType:e})}var vg=m("ZodFunction",(e,n)=>{af.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>sc(e,t,r,o)});function Lx(e){return new vg({type:"function",input:Array.isArray(e?.input)?Hm(e?.input):e?.input??P(pn()),output:e?.output??pn()})}var li=m("ZodCustom",(e,n)=>{uf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ic(e,t,r,o)});function Vx(e){let n=new le({check:"custom"});return n._zod.check=e,n}function Mx(e,n){return Gf(li,e??(()=>!0),n)}function xg(e,n={}){return Hf(li,e,n)}function kg(e,n){return Qf(e,n)}var qx=Yf,Fx=Xf,Sg=m("ZodInstanceOf",(e,n)=>{li.init(e,n)},{properties(e,n){return this.check(Jo(e,n))}});function Zx(e,n={}){let t=new Sg({type:"custom",check:"custom",fn:(r)=>r instanceof e,abort:!0,...C(n)});return t._zod.bag.Class=e,t._zod.check=(r)=>{if(!(r.value instanceof e))r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:t,path:[...t._zod.def.path??[]]})},t}var Jx=(...e)=>em({Codec:ci,Boolean:Bc,String:Ec},...e);function Te(e){let n=bg(()=>te([R(e),X(),me(),Lm(),P(n),re(R(),n)]));return n}function Ig(e,n){return new fg({type:"pipe",in:Gc(e),out:n})}var gr={};no(gr,{ZodISODate:()=>yt,ZodISODateTime:()=>ht,ZodISODuration:()=>wt,ZodISOTime:()=>bt,date:()=>Bx,datetime:()=>Ux,duration:()=>Wx,time:()=>Kx});function Ux(e){return To(ht,e)}function Bx(e){return No(yt,e)}function Kx(e){return zo(bt,e)}function Wx(e){return Do(wt,e)}var T={...Yc,...Xo,iso:gr},Gx=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Hx(e,n){let t=e.$schema;if(t==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(t==="http://json-schema.org/draft-07/schema#")return"draft-7";if(t==="http://json-schema.org/draft-04/schema#")return"draft-4";return n??"draft-2020-12"}function Cg(e,n){return e.map((t,r)=>r<n?t:t.optional())}function Qx(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Yx(e,n){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let t=e.slice(1).split("/").filter(Boolean);if(t.length===0)return n.rootSchema;let r=n.version==="draft-2020-12"?"$defs":"definitions";if(t[0]===r){let o=t[1]===void 0?void 0:Qx(t[1]);if(!o||!n.defs[o])throw Error(`Reference not found: ${e}`);return n.defs[o]}throw Error(`Reference not found: ${e}`)}function Xx(e,n){return T.transform((r)=>r).check((r)=>{let o=r.value;if(typeof o!=="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(n.minProperties!==void 0&&i.length<n.minProperties)r.issues.push({origin:"object",code:"too_small",minimum:n.minProperties,inclusive:!0,message:`Too small: expected object to have >=${n.minProperties} properties`,input:o,inst:e,continue:!0});if(n.maxProperties!==void 0&&i.length>n.maxProperties)r.issues.push({origin:"object",code:"too_big",maximum:n.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${n.maxProperties} properties`,input:o,inst:e,continue:!0});if(n.keySchema)for(let s of i){let a=n.keySchema.safeParse(s);if(a.success)continue;r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function Xc(e,n){if(e===null)return"z";let t=typeof e;if(t!=="object"){if(t==="number"&&Number.isNaN(e))return null;let r=String(e);return`${t[0]}${r.length}:${r}`}if(n.has(e))return null;n.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=Xc(s,n);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let s=Xc(e[i],n);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{n.delete(e)}}var ek=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),nk=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function hr(e){if(typeof e!=="object"||e===null)return!1;if(Array.isArray(e))return e.some(hr);if(typeof e.$ref==="string")return!0;return Object.entries(e).some(([n,t])=>{if(ek.has(n))return hr(t);if(!nk.has(n)||typeof t!=="object"||t===null)return!1;return Object.values(t).some(hr)})}function Og(e){return e===1?"element":"elements"}function tk(e,n){return T.transform((r)=>r).check((r)=>{let o=r.value;if(!Array.isArray(o))return;if(n.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=Xc(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(n.containsSchema){let i=n.minContains??1,s=n.maxContains!==void 0?n.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(n.containsSchema.safeParse(c).success&&++a>=s)break;if(a<i)r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Og(i)}; found ${a}`,input:o,continue:!0});if(n.maxContains!==void 0&&a>n.maxContains)r.issues.push({code:"custom",message:`Array must contain at most ${n.maxContains} matching ${Og(n.maxContains)}`,input:o,continue:!0})}}).pipe(e)}function Eg(e,n){if(e===!1)return;if(e===void 0||e===!0)return T.any();return Ne(e,n)}var rk=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function _g(e,n){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return T.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(n.refs.has(o))return n.refs.get(o);if(n.processing.has(o))return T.lazy(()=>{if(!n.refs.has(o))throw Error(`Circular reference not resolved: ${o}`);return n.refs.get(o)});n.processing.add(o);let i=Yx(o,n),s=Ne(i,n);return n.refs.set(o,s),n.processing.delete(o),s}if(e.enum!==void 0){let o=e.enum;if(n.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return T.null();if(o.length===0)return T.never();if(o.length===1)return T.literal(o[0]);if(o.every((s)=>typeof s==="string"))return T.enum(o);let i=o.map((s)=>T.literal(s));if(i.length<2)return i[0];return T.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return T.literal(e.const);let t=e.type;if(Array.isArray(t)){let o=t.map((i)=>{let s={...e,type:i};return _g(s,n)});if(o.length===0)return T.never();if(o.length===1)return o[0];return T.union(o)}if(!t)return T.any();let r;switch(t){case"string":{let o=T.string();if(e.format){let i=e.format;if(i==="email")o=o.check(T.email());else if(i==="uri"||i==="uri-reference")o=o.check(T.url());else if(i==="uuid"||i==="guid")o=o.check(T.uuid());else if(i==="date-time")o=o.check(T.iso.datetime({offset:!0}));else if(i==="date")o=o.check(T.iso.date());else if(i==="time")o=o.check(T.regex(rk));else if(i==="duration")o=o.check(T.iso.duration());else if(i==="hostname")o=o.check(T.hostname());else if(i==="ipv4")o=o.check(T.ipv4());else if(i==="ipv6")o=o.check(T.ipv6());else if(i==="mac")o=o.check(T.mac());else if(i==="cidr")o=o.check(T.cidrv4());else if(i==="cidr-v6")o=o.check(T.cidrv6());else if(i==="base64")o=o.check(T.base64());else if(i==="base64url")o=o.check(T.base64url());else if(i==="e164")o=o.check(T.e164());else if(i==="credit_card")o=o.check(T.creditCard());else if(i==="iban")o=o.check(T.iban());else if(i==="jwt")o=o.check(T.jwt());else if(i==="emoji")o=o.check(T.emoji());else if(i==="nanoid")o=o.check(T.nanoid());else if(i==="cuid")o=o.check(T.cuid());else if(i==="cuid2")o=o.check(T.cuid2());else if(i==="ulid")o=o.check(T.ulid());else if(i==="xid")o=o.check(T.xid());else if(i==="ksuid")o=o.check(T.ksuid())}if(typeof e.minLength==="number")o=o.min(e.minLength);if(typeof e.maxLength==="number")o=o.max(e.maxLength);if(e.pattern)o=o.regex(new RegExp(e.pattern));r=o;break}case"number":case"integer":{let o=t==="integer"?T.number().int():T.number();if(typeof e.minimum==="number"&&e.exclusiveMinimum!==!0)o=o.min(e.minimum);if(typeof e.maximum==="number"&&e.exclusiveMaximum!==!0)o=o.max(e.maximum);if(typeof e.exclusiveMinimum==="number")o=o.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")o=o.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")o=o.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")o=o.lt(e.maximum);if(typeof e.multipleOf==="number")o=o.multipleOf(e.multipleOf);r=o;break}case"boolean":{r=T.boolean();break}case"null":{r=T.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties==="object"?Ne(e.additionalProperties,n):void 0;for(let[d,g]of Object.entries(i)){let h=Ne(g,n);je(o,d,s.has(d)?h:h.optional())}if(e.patternProperties){let d=e.patternProperties,g=Object.keys(d),h=[];for(let S of g){let j=Ne(d[S],n),N=T.string().regex(new RegExp(S));h.push(T.looseRecord(N,j))}let y=[];if(Object.keys(o).length>0)y.push(T.object(o).passthrough());if(y.push(...h),y.length===0)r=T.object({}).passthrough();else if(y.length===1)r=y[0];else{let S=T.intersection(y[0],y[1]);for(let j=2;j<y.length;j++)S=T.intersection(S,y[j]);r=S}if(e.additionalProperties===!1){let S=Object.keys(o),j=g.map((D)=>new RegExp(D)),N=r;r=r.check((D)=>{if(!wn(D.value))return;let V=[];for(let Ee of Object.keys(D.value)){if(S.includes(Ee))continue;if(j.some((fe)=>fe.test(Ee)))continue;V.push(Ee)}if(V.length)D.issues.push({code:"unrecognized_keys",keys:V,input:D.value,inst:N})})}}else{let d=T.object(o);if(e.additionalProperties===!1)r=d.strict();else if(a)r=d.catchall(a);else r=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties==="number"?e.minProperties:void 0,u=typeof e.maxProperties==="number"?e.maxProperties:void 0;if(c||l!==void 0||u!==void 0){let d;if(c){let g=typeof e.propertyNames==="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Ne(g,n)}r=Xx(r,{keySchema:d,minProperties:l,maxProperties:u})}break}case"array":{let{prefixItems:o,items:i}=e;if(o&&Array.isArray(o)){let s=typeof e.minItems==="number"?e.minItems:0,a=o.map((d)=>Ne(d,n)),c=Cg(a,s),l=!Array.isArray(i)?Eg(i,n):void 0,u=T.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(T.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(T.maxLength(e.maxItems))}else if(Array.isArray(i)){let s=typeof e.minItems==="number"?e.minItems:0,a=i.map((d)=>Ne(d,n)),c=Cg(a,s),l=Eg(e.additionalItems,n),u=T.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(T.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(T.maxLength(e.maxItems))}else if(i!==void 0){let s=Ne(i,n),a=T.array(s);if(typeof e.minItems==="number")a=a.min(e.minItems);if(typeof e.maxItems==="number")a=a.max(e.maxItems);r=a}else r=T.array(T.any());if(e.uniqueItems===!0||e.contains!==void 0)r=tk(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Ne(e.contains,n):void 0,minContains:typeof e.minContains==="number"?e.minContains:void 0,maxContains:typeof e.maxContains==="number"?e.maxContains:void 0});break}default:throw Error(`Unsupported type: ${t}`)}return r}function Ne(e,n){if(typeof e==="boolean")return e?T.any():T.never();let t=_g(e,n),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map((l)=>Ne(l,n)),c=T.union(a);t=r?T.intersection(t,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map((l)=>Ne(l,n)),c=T.xor(a);t=r?T.intersection(t,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)t=r?t:T.any();else{let a=r?t:Ne(e.allOf[0],n),c=r?0:1;for(let l=c;l<e.allOf.length;l++)a=T.intersection(a,Ne(e.allOf[l],n));t=a}if(e.nullable===!0&&n.version==="openapi-3.0")t=T.nullable(t);if(e.readOnly===!0)t=T.readonly(t);if(e.default!==void 0)t=t.default(e.default);let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)if(a in e)o[a]=e[a];let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)if(a in e)o[a]=e[a];if(e.type==="object"&&e.$ref===void 0){if(e.propertyNames!==void 0&&!hr(e.propertyNames))o.propertyNames=e.propertyNames;for(let a of["minProperties","maxProperties"])if(e[a]!==void 0)o[a]=e[a]}if(e.type==="array"&&e.$ref===void 0){if(e.contains!==void 0&&!hr(e.contains))o.contains=e.contains;for(let a of["uniqueItems","minContains","maxContains"])if(e[a]!==void 0)o[a]=e[a]}for(let a of Object.keys(e))if(!Gx.has(a))je(o,a,e[a]);if(Object.keys(o).length>0)n.registry.add(t,o);if(e.description)t=t.describe(e.description);return t}function jg(e,n){if(typeof e==="boolean")return e?T.any():T.never();let t;try{t=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=Hx(t,n?.defaultTarget),o=t.$defs||t.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:t,registry:n?.registry??Me};return Ne(t,i)}var Rg=0;function $n(){let e=Rg;return Rg+=1,e}function St(e){if(typeof e==="object"&&e!==null&&!Object.isFrozen(e)){for(let n of Object.getOwnPropertyNames(e)){let t=Reflect.get(e,n);St(t)}Object.freeze(e)}return e}function el(e,n){let t={};for(let r of n)if(r in e)t[r]=e[r];return t}function ui(e){if(typeof e!=="object"||e===null)return e;else if(Array.isArray(e)){let n=[];for(let[t,r]of e.entries())n[t]=ui(r);return n}else{let n={};for(let t in e)n[t]=ui(e[t]);return n}}function kt(e,n){if(e===n)return!0;if(e===null)return!1;if(typeof e!=="object")return!1;if(typeof e!==typeof n)return!1;if(Array.isArray(e)){if(!Array.isArray(n))return!1;if(e.length!==n.length)return!1;for(let[t,r]of e.entries())if(!kt(r,n[t]))return!1}else{if(Array.isArray(n))return!1;for(let t in e){if(!(t in n))return!1;if(!kt(e[t],n[t]))return!1}for(let t in n)if(!(t in e))return!1}return!0}var b=Object.freeze({Equals:0,Containing:1,ContainedBy:2,Rejection:3,Intersection:4}),K=Tn(b.Equals),q=Tn(b.Containing),J=Tn(b.ContainedBy),W=Tn(b.Rejection),Q=Tn(b.Intersection),kn=St([[b.Equals,K],[b.Containing,q],[b.ContainedBy,J],[b.Rejection,W],[b.Intersection,Q]]),de=0,We=(()=>{let e=de;for(let[n,t]of kn)e|=t;return e})();function yr(e){return!!(e&K)}function br(e){return!!(e&q)}function wr(e){return!!(e&J)}function vr(e){return!!(e&W)}function xr(e){return!!(e&Q)}function Tn(e){return 1<<e}function nl(e){let n=de,t=0,r={push:(o)=>{if(t===0)n=o;else n=ok(n,o,e);return t+=1,n}};return Object.defineProperties(r,{result:{get:()=>n},count:{get:()=>t}}),r}function ok(e,n,t){let r=de;for(let[o,i]of kn)if(i&e){for(let[s,a]of kn)if(a&n){if(r|=t(o,s),r===We)return r}}return r}var ge=Object.freeze({Save:0,OneOf:1,AllOf:2,AnyOf:3,Not:4,Swap:5});function Ag(e,n){switch(e){case ge.Save:return n[0];case ge.OneOf:return ik(n);case ge.AllOf:case ge.AnyOf:return kr(e,n);case ge.Not:case ge.Swap:return tl(e,n[0])}}function Nn(e){return tl(ge.Swap,e)}function ik(e){if(e.length===1)return e[0];let n=kr(ge.AnyOf,e),t=[];for(let i=0;i<e.length;++i)for(let s=i+1;s<e.length;++s){let a=e[i],c=e[s],l=kr(ge.AllOf,[a,c]);t.push(l)}let r=kr(ge.AnyOf,t),o=tl(ge.Not,r);return kr(ge.AllOf,[n,o])}function kr(e,n){if(n.length<0)throw Error("invalid expressions: empty array");let t;switch(e){case ge.AllOf:{t=nl(sk);break}case ge.AnyOf:{t=nl(ak);break}default:throw Error(`invalid operator ${e}`)}for(let r of n)t.push(r);return t.result}function tl(e,n){let t,r=de;switch(e){case ge.Not:{t=ck;break}case ge.Swap:{t=lk;break}default:throw Error(`invalid operator ${e}`)}for(let[o,i]of kn)if(i&n)r|=t(o);return r}function sk(e,n){let t=de;switch(e){case b.Equals:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=K;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=de;break}case b.Intersection:{t=J;break}}break}case b.Containing:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=K|q;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=W;break}case b.Intersection:{t=Q|J;break}}break}case b.ContainedBy:{switch(n){case b.Equals:{t=J;break}case b.Containing:{t=J;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=de;break}case b.Intersection:{t=J;break}}break}case b.Rejection:{switch(n){case b.Equals:{t=de;break}case b.Containing:{t=W;break}case b.ContainedBy:{t=de;break}case b.Rejection:{t=W;break}case b.Intersection:{t=W;break}}break}case b.Intersection:{switch(n){case b.Equals:{t=J;break}case b.Containing:{t=Q|J;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=W;break}case b.Intersection:{t=J|W|Q;break}}break}}return t}function ak(e,n){let t=de;switch(e){case b.Equals:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=q;break}case b.ContainedBy:{t=K;break}case b.Rejection:{t=q;break}case b.Intersection:{t=q;break}}break}case b.Containing:{switch(n){case b.Equals:{t=q;break}case b.Containing:{t=q;break}case b.ContainedBy:{t=q;break}case b.Rejection:{t=q;break}case b.Intersection:{t=q;break}}break}case b.ContainedBy:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=q;break}case b.ContainedBy:{t=K|J;break}case b.Rejection:{t=Q;break}case b.Intersection:{t=q|Q;break}}break}case b.Rejection:{switch(n){case b.Equals:{t=q;break}case b.Containing:{t=q;break}case b.ContainedBy:{t=Q;break}case b.Rejection:{t=W;break}case b.Intersection:{t=Q;break}}break}case b.Intersection:{switch(n){case b.Equals:{t=q;break}case b.Containing:{t=q;break}case b.ContainedBy:{t=q|Q;break}case b.Rejection:{t=Q;break}case b.Intersection:{t=q|Q;break}}break}}return t}function ck(e){let n=de;switch(e){case b.Equals:{n=W;break}case b.Containing:{n=W;break}case b.ContainedBy:{n=Q;break}case b.Rejection:{n=K|q;break}case b.Intersection:{n=J|Q;break}}return n}function lk(e){let n=de;switch(e){case b.Equals:{n=K;break}case b.Containing:{n=J;break}case b.ContainedBy:{n=q;break}case b.Rejection:{n=W;break}case b.Intersection:{n=Q;break}}return n}var qe=Object.freeze({Leaf:0,Not:1,AllOf:2,AnyOf:3,OneOf:4});var rl=(e)=>(n,t)=>{let r={parent:null,swapped:!1,expressions:null,calculation:{operator:ge.Save,results:[de],willSwap:!1,count:0}},o=[{parent:{node:r,index:0},swapped:!1,expressions:[n,t],calculation:null}],i=[];while(o.length>0||i.length>0){while(o.length>0){let u=o.pop();s(u)}while(i.length>0){let u=i.pop();c(u)}}function s(u){let d=K,[g,h]=u.expressions;if(!e.equals(g,h)){let y=e.describe(g);if(y.kind!==qe.Leaf){let[N,D]=a(y,!1);u.expressions=null,u.calculation=N;for(let[V,Ee]of D.entries())o.push({parent:{node:u,index:V},swapped:u.swapped,expressions:[Ee,h],calculation:null});return}let S=e.describe(h);if(S.kind!==qe.Leaf){let[N,D]=a(S,!0);u.expressions=null,u.calculation=N;for(let[V,Ee]of D.entries())o.push({parent:{node:u,index:V},swapped:!u.swapped,expressions:[Ee,g],calculation:null});return}if(d=e.calculate(g,h),e.observeCalculation?.(g,h,d,u.swapped),d===de)throw Error("cannot response expression as none")}u.expressions=null,u.calculation={operator:ge.Save,results:[d],willSwap:!1,count:0},i.push(u)}function a(u,d){let g=ge.Save,h;switch(u.kind){case qe.Not:{g=ge.Not,h=[u.expression];break}case qe.AllOf:{g=ge.AllOf,h=[...u.expressions];break}case qe.AnyOf:{g=ge.AnyOf,h=[...u.expressions];break}case qe.OneOf:{g=ge.OneOf,h=[...u.expressions];break}default:throw Error(`invalid kind ${u.kind}`)}return[{operator:g,willSwap:d,count:0,results:Array(h.length).fill(-1)},h]}function c(u){let{calculation:d,parent:g}=u,h=Ag(d.operator,d.results);if(h===de)h=J;if(d.willSwap)h=Nn(h);if(g){let y=g.node.calculation,S=y.results;if(S[g.index]=h,y.count+=1,y.count>=S.length)i.push(g.node)}}let l=r.calculation.results[0];if(l===0)throw Error("cannot find result of root");return l};class di extends Error{constructor(e=[]){super(uk(e));this.name="SchemaError",this.items=e}}var It=Object.freeze({Compiled:0,External:1});function Ct(e){switch(e.kind){case It.Compiled:{let{message:n,path:t}=e;return`${n} (at ${t.length>0?t.join("."):"$root"})`}case It.External:return String(e.error)}}function uk(e){switch(e.length){case 0:return"without any items";case 1:return Ct(e[0]);default:return`${Ct(e[0])} ... omit the rest ${e.length-1} items`}}var dk=new Set(["type","enum","const","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","items","additionalItems","maxItems","minItems","uniqueItems","contains","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames","if","then","else","allOf","anyOf","oneOf","not","format","contentMediaType","contentEncoding","definitions"]);function fn(e){return dk.has(e)}function Pg(e){for(let n in e)if(fn(n))return!1;return!0}function ze(e,...n){return{...e,path:[...e.path,...n]}}function Fe(e){if(typeof e==="boolean")throw Error("JSONSchema7Definition cannot be boolean");return e}function zn({path:e,errors:n},t,...r){n.push($g(e,r,t))}function Y({path:e,warns:n},t,...r){n.push($g(e,r,t))}function $g(e,n,t){return{kind:It.Compiled,message:t,path:[...e,...n]}}function pi(e){for(let n in e){let t=e[n];if(t===void 0)delete e[n];else if(t&&typeof t==="object"){if(Array.isArray(t)){if(t.length===0)delete e[n]}else if(pk(t))delete e[n]}}return e}function pk(e){for(let n in e)return!1;return!0}var Sr=Symbol("compiledId"),ol=Symbol("compiledKind"),il=Symbol("compiledPath"),Tg=Symbol("validatorLoader"),I=Object.freeze({Extends:0,Never:1,Any:2,Null:3,String:4,Numeric:5,Boolean:6,Object:7,Array:8,Not:9,Combination:10,EnumOrConst:11}),Dn=St(fi(I.Any,$n(),{},()=>()=>!0)),Ir=St(fi(I.Never,$n(),{type:"string",maxLength:0,minLength:1},()=>()=>!1));function Cr(e){if(e===null||typeof e!=="object")return!1;return Sr in e}function Ze(e){if(e===null||typeof e!=="object")return!1;return Sr in e&&ol in e}function H(e){if(Ze(e))return e[ol];else return I.Extends}function Wn(e){if(Ze(e)||Cr(e))return e[Sr];else return e.id}function sl(e){return Ze(e)?e[il]:void 0}function al(e){if(e===null||typeof e!=="object")return e;return Object.defineProperty(e,Sr,{value:$n(),configurable:!1,writable:!1,enumerable:!1}),e}function he(e,n,t,r=[]){return fi(e,$n(),n,t&&(()=>t.compile(n)),r)}function Or(e){return fi(I.Never,$n(),{...e},e[Tg],e[il])}function fi(e,n,t,r,o=[]){let i=null;return Object.defineProperties(t,{[ol]:{value:e,configurable:!1,writable:!1,enumerable:!1},[Sr]:{value:n,configurable:!1,writable:!1,enumerable:!1},[il]:{value:o,configurable:!1,writable:!1,enumerable:!1},[Tg]:{value:r,configurable:!1,writable:!1,enumerable:!1},isValid:{configurable:!1,enumerable:!1,get:()=>{if(r){if(!i)i=r();return i}else return}}}),t}function Dg(e,n){let t=fk(e,n),r=Ng(e,"maxItems",n),o=Ng(e,"minItems",n),i=mk(e,n),s=n.uniqueItems,a;if(Array.isArray(t))a=gk(e,n);else if(n.additionalItems)Y(e,"it is needless when items is not array","additionalItems");if(!t||!i||a===null)return null;let c=!1,l=!1;if(Array.isArray(t)){if(r!==void 0&&r<=t.length)t=t.splice(r),a=zg(a,e.delegate);let g=t.findIndex((h)=>H(h)===I.Never);if(g!==-1){if(t=t.splice(g),a=zg(a,e.delegate),r===void 0)r=t.length,l=!0}if(o!==void 0&&t.length<o)Y(e,`length(${t.length}) of items if less than minItems(${o})`),c=!0;if(t.length===0&&a&&H(a)===I.Never)c=!0}else if(H(t)===I.Never)c=!0;if(r!==void 0&&o!==void 0&&r<o){if(!l)Y(e,`maxItems(${r}) is less than minItems(${o})`);c=!0}let u=c?I.Never:I.Array,d=pi({type:"array",items:t,contains:i,uniqueItems:s,maxItems:r,minItems:o,additionalItems:a});return he(u,d,e.delegate,e.path)}function fk(e,{items:n}){if(!n)return he(I.Any,{},e.delegate,e.path);if(Array.isArray(n)){let t=[],r=!1;for(let[o,i]of n.entries()){let s=ze(e,"items",o),a=De(s,Fe(i));if(!a){r=!0;continue}t.push(a)}if(r)return null;return t}else{let t=ze(e,"items"),r=Fe(n);return De(t,r)}}function Ng(e,n,t){let r=t[n];if(r===void 0)return;if(Number.isNaN(r)){Y(e,"find NaN",n);return}if(r<0){Y(e,`find invalid number ${r}`,n);return}return r}function mk(e,{contains:n}){if(!n)return he(I.Any,{},e.delegate,e.path);let t=ze(e,"contains"),r=Fe(n);return De(t,r)}function gk(e,{additionalItems:n}){switch(typeof n){case"boolean":if(n)return he(I.Any,{},e.delegate,e.path);else return!1;case"object":{let t=ze(e,"additionalItems");return De(t,n)}default:return he(I.Any,{},e.delegate,e.path)}}function zg(e,n){if(e===void 0)return he(I.Never,{type:"string",maxLength:0,minLength:1},n);else if(Ze(e))return H(e)===I.Never?e:Or(e);else return e}var Lg=Object.freeze(["allOf","anyOf","oneOf"]);function cl(e,n,t,r){if(t.length===0)return zn(e,"disable empty list",n),null;let o=[];for(let[c,l]of t.entries()){let u=ze(e,n,c),d=Fe(l),g=De(u,d);if(g)o.push(g)}if(o.length<t.length)return null;let i=0,s=0;for(let c of o)switch(H(c)){case I.Any:{i+=1;break}case I.Never:{s+=1;break}}let a=I.Combination;switch(n){case"allOf":{if(s>0)a=I.Never;else if(i===o.length)a=I.Any;else if(!hk(o))a=I.Never;break}case"anyOf":{if(i>0)a=I.Any;else if(s===o.length)a=I.Never;break}case"oneOf":{if(i>1)a=I.Never;else if(s===o.length)a=I.Never;else if(i===1&&s===o.length-1)a=I.Any;break}}return he(a,{[n]:o},r,e.path)}function hk(e){let n=null;for(let t of e){let r=H(t);switch(r){case I.Any:case I.Never:break;default:{if(n===null)n=r;else if(n!==r)return!1;break}}}return!0}var Ae=Object.freeze({Valid:0,Invalid:1,Unknown:2});function mn(e,n){let t=e.isValid;if(t)if(t(n)===!0)return Ae.Valid;else return Ae.Invalid;else return Ae.Unknown}function Vg(e,n,t,r){let o,i=!1;if(n){if(n.length===0)return zn(e,"disable empty list","enum"),null;o=[];for(let[c,l]of n.entries())switch(mn(r,l)){case Ae.Valid:{o.push(al(l));break}case Ae.Invalid:{Y(e,"cannot pass JSON schema of currently schema object","enum",c);break}}if(o.length===0)Y(e,"all of elements from list is rejected by currently schema object","enum")}if(t!==void 0&&mn(r,t)===Ae.Invalid)i=!0;if(o){if(o.length===0)i=!0;else if(t!==void 0){let c=!1;for(let l of o)if(kt(l,t)){c=!0;break}if(!c)i=!0}}let s=i?I.Never:I.EnumOrConst,a={};if(r.type)a.type=r.type;if(o)a.enum=o;if(t!==void 0)a.const=al(ui(t));return he(s,a,e.delegate,e.path)}var yk=new Set(["type","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames"]);function qg(e,n){let t=Object.keys(n).filter((y)=>!yk.has(y)&&fn(y));if(t.length>0)Y(e,`type="object" will exclude other keys: ${t.toSorted().join(", ")}`);let r=Mg(e,"maxProperties",n),o=Mg(e,"minProperties",n),i=bk(e,n),s=wk(e,n),a=vk(e,n),c=kk(e,n);if(!i||!s||!a||!c)return null;let l=xk(e,s,a,n);if(!l)return null;let u=Sk(i,s,a,l),d=Ik(e,u,c,n),g=Ck(e,i,l,d,r,o)?I.Never:I.Object,h=pi({type:"object",required:d,properties:l,minProperties:o,maxProperties:r,additionalProperties:i,patternProperties:_k(s),dependencies:jk(c,n),propertyNames:a});return he(g,h,e.delegate,e.path)}function Mg(e,n,t){let r=t[n];if(r===void 0)return;if(Number.isNaN(r)){Y(e,"find NaN",n);return}if(r<0){Y(e,`find invalid number ${r}`,n);return}return r}function bk(e,{additionalProperties:n}){if(n===!1)return he(I.Never,{type:"string",maxLength:0,minLength:1},e.delegate,e.path);if(typeof n!=="object")return he(I.Any,{},e.delegate,e.path);let t=ze(e,"additionalProperties"),r=Fe(n);return De(t,r)}function wk(e,{patternProperties:n}){let t=!1,r={};for(let o in n){let i=Ek(o);if(i instanceof Error){Y(e,`property name invalid. ${o}`,"patternProperties",o);continue}let s=Fe(n[o]),a=ze(e,"patternProperties",o),c=De(a,s);if(!c){t=!0;continue}r[o]=[c,i]}if(t)return null;return r}function vk(e,{propertyNames:n}){if(!n)return he(I.Any,{},e.delegate,e.path);n=Fe(n);let t=ze(e,"propertyNames"),r=De(t,n);if(!r)return null;let o=H(r);if(o!==I.String&&o!==I.Any)return Or(r);return r}function xk(e,n,t,{properties:r}){let o=!1;if(!r)return{};let i={};for(let s in r){if(mn(t,s)===Ae.Invalid){Y(e,`key ${JSON.stringify(s)} cannot pass JSON schema from propertyNames`,"properties");continue}let a=Zg(n,s);if(a&&H(a)===I.Never){Y(e,`key ${JSON.stringify(s)} matches a pattern that has a impossible(never) schema`,"properties");continue}let c=Fe(r[s]),l=ze(e,"properties",s),u=De(l,c);if(!u){o=!0;continue}i[s]=u}if(o)return null;return i}function kk(e,{dependencies:n}){if(!n)return[{},{}];let t={},r={};for(let o in n){let i=Fe(n[o]);if(Array.isArray(i)){let{keys:s,duplicated:a}=Fg(i);if(a)Y(e,`found duplicated property names: ${a.join(", ")}`,"dependencies",o);t[o]=s}else{let s=ze(e,"dependencies",o),a=De(s,i);if(a){let c=H(a);if(c===I.Object||c===I.Any)r[o]=a;else if(c===I.Extends)r[o]=Ir;else r[o]=Or(a)}}}return[t,r]}function Sk(e,n,t,r){return(o)=>{if(mn(t,o)===Ae.Invalid)return!0;let i=Zg(n,o);if(i&&H(i)===I.Never)return!0;let s=r[o]??e;if(H(s)===I.Never)return!0;return!1}}function Ik(e,n,t,{required:r}){if(!r)return[];let o=Fg(r);if(o.duplicated)Y(e,`found duplicated required keys: ${o.duplicated.join(", ")}`,"required");let i=[],s=[];for(let a of o.keys)if(Ok(t,a).some((l)=>n(l)))s.push(a);else i.push(a);if(s.length>0)Y(e,`key ${s.map((a)=>JSON.stringify(a)).join(", ")} will ban by another condition`,"required");return i}function Ck(e,n,t,r,o,i){if(o!==void 0&&i!==void 0&&o<i)return Y(e,`maxProperties(${o}) is less than minProperties(${i})`),!0;if(o!==void 0&&r.length>o)return Y(e,`length(${r.length}) of required is greater than maxProperties(${o})`),!0;if(i!==void 0&&r.length<i)return Y(e,`length(${r.length}) of required is less than minProperties(${i})`),!0;if(H(n)!==I.Never)return!1;for(let s in t){let a=t[s];if(H(a)!==I.Never)return!1}return!0}function Ok([e,n],t){let r=[t],o=new Set(r);while(r.length>0){let s=r.pop(),a=n[s],c=e[s];if(a){if(H(a)===I.Object)i(a.required)}if(c)i(c)}function i(s){if(s){for(let a of s)if(!o.has(a))o.add(a),r.push(a)}}return[...o]}function Fg(e){let n=new Set,t=new Set;for(let r of e)if(n.has(r))t.add(r);else n.add(r);if(t.size===0)return{keys:[...e],duplicated:null};else return{keys:[...n],duplicated:[...t]}}function Zg(e,n){for(let t in e){let[r,o]=e[t];if(o.test(n))return r}return null}function Ek(e){try{return new RegExp(e,"i")}catch(n){if(n instanceof SyntaxError)return n;else throw n}}function _k(e){let n={};for(let t in e)n[t]=e[t][0];return n}function jk([e,n],{dependencies:t}){let r={};for(let o in t){let i=e[o],s=n[o];r[o]=i||s}return r}var ll=new Set(["type","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum"]),Jg=new Set(["type","format","maxLength","minLength","pattern"]);function Bg(e,n){let{type:t}=n;switch(t){case"number":case"integer":return Rk(e,n);case"string":return Pk(e,n);case"boolean":case"null":{let r=Object.keys(n).filter((s)=>fn(s)&&s!=="type");if(r.length>0)Y(e,`key "type" will exclude other keys: ${r.toSorted().join(", ")}`);let o=t==="null"?I.Null:I.Boolean;return he(o,{type:t},e.delegate,e.path)}default:return zn(e,`invalid type ${JSON.stringify(t)}`),null}}function Rk(e,n){let t=Object.keys(n).filter((u)=>!ll.has(u)&&fn(u));if(t.length>0)Y(e,`type=${JSON.stringify(n.type)} will exclude other keys: ${t.toSorted().join(", ")}`);let r=el(n,ll);for(let u of ll){let d=r[u];if(u!=="type"&&d!==void 0&&Number.isNaN(d))Y(e,"found NaN",u),delete r[u]}let{maximum:o,exclusiveMaximum:i,minimum:s,exclusiveMinimum:a}=r;if(o!==void 0&&i!==void 0){if(o===i)delete r.maximum;else if(o<i)delete r.exclusiveMaximum;else if(o>i)delete r.maximum}if(s!==void 0&&a!==void 0){if(s===a)delete r.minimum;else if(s<a)delete r.exclusiveMinimum;else if(s>a)delete r.minimum}let{multipleOf:c}=r;if(c===0)delete r.multipleOf,r.type="number",Y(e,"cannot be 0","multipleOf");let l=I.Numeric;if(!Ak(r))l=I.Never;return he(l,r,e.delegate,e.path)}function Ak(e){let{maximum:n,exclusiveMaximum:t,minimum:r,exclusiveMinimum:o}=e;if(n!==void 0&&r!==void 0)return n>=r;else if(t!==void 0&&r!==void 0)return t>r;else if(n!==void 0&&o!==void 0)return n>o;else if(t!==void 0&&o!==void 0)return t>o;else return!0}function Pk(e,n){let t=Object.keys(n).filter((a)=>!Jg.has(a)&&fn(a));if(t.length>0)Y(e,`type="string" will exclude other keys: ${t.toSorted().join(", ")}`);let r=el(n,Jg);Ug(e,r,"maxLength"),Ug(e,r,"minLength");let{maxLength:o,minLength:i}=r,s=I.String;if(o!==void 0){if(o<0)s=I.Never;else if(o!==void 0&&i!==void 0&&o<i)s=I.Never}return he(s,r,e.delegate,e.path)}function Ug(e,n,t){let r=n[t];if(r!==void 0){if(Number.isNaN(r))Y(e,"found NaN",t),delete n[t]}}var Kg=Object.freeze([]);function mi(e,n,t,r){if(Ze(e))return{schema:e,warns:Kg};if(n.isExtendsSchema(e))return{schema:e,warns:Kg};if(r){let s=r.isSchema(e);if(typeof s==="object"){let a=[];for(let c of s)a.push({kind:It.External,error:c});if(a.length>0)return a}else if(s===!1)throw Error("it is not a JSON Schema 7")}let o={delegate:r,payload:t,extends:n,path:[],errors:[],warns:[]},i=De(o,e);if(i)Wg(o.errors.length===0,"found errors (it should be empty)");else return Wg(o.errors.length>0,"cannot found any errors"),o.errors;return{schema:i,warns:o.warns}}function Wg(e,n){if(!e)throw Error(n)}function De(e,n){if(e.extends.isExtendsSchema(n))return n;if(Ze(n))return n;let t=e.extends.tryCompiledExtendsSchema(n,e.payload);if(t)return t;let r=n,o=!1,{enum:i,const:s}=n;if(i||s!==void 0){let{enum:c,const:l,...u}=n;r=u,o=!0}let a=$k(e,r);if(a&&o)a=Vg(e,i,s,a);if(!a)return null;return a}function $k(e,n){for(let t of Lg){let r=n[t];if(r){let o=Object.keys(n).filter((s)=>fn(s)&&s!==t);if(o.length>0)Y(e,`composition key ${JSON.stringify(t)} will exclude other keys: ${o.toSorted().join(", ")}`);let i=cl(e,t,r);if(!i)return null;return i}}{let t=Fe(n.not);if(t){let r=Object.keys(n).filter((a)=>fn(a)&&a!=="not");if(r.length>0)Y(e,`key "not" will exclude other keys: ${r.toSorted().join(", ")}`);let o=ze(e,"not"),i=De(o,t);if(!i)return null;let s=I.Not;switch(H(i)){case I.Never:{s=I.Any;break}case I.Any:{s=I.Never;break}}return he(s,{not:i},e.delegate,e.path)}}if(n.type){let{type:t}=n;if(Array.isArray(t)){let{type:r,...o}=n;return cl(e,"anyOf",t.map((i)=>({...o,type:i})))}switch(t){case"object":return qg(e,n);case"array":return Dg(e,n);default:return Bg(e,n)}}if(Pg(n))return he(I.Any,{},e.delegate,e.path);return zn(e,"unrecognized"),null}class ul{constructor(e){let n=Object.freeze(e.toSorted());if(n.length>32)throw Error(`cannot define ${n.length} keys which is greater than 32`);this.keys=n,this.clazz=class extends Gg{constructor(t){super(n,t)}};for(let[t,r]of this.keys.entries()){let o=1<<t;Object.defineProperty(this.clazz.prototype,r,{enumerable:!0,get:function(){return!!(this.int32&o)},set:function(s){if(s)this.int32|=o;else this.int32&=~o}})}}toBundle(e){let n=0;if(typeof e==="number")n=e;else if(e){for(let[t,r]of this.keys.entries())if(e[r])n|=1<<t}return new this.clazz(n)}}class Gg{constructor(e,n){this.keys=e,this.int32=n}toInt32(){return this.int32}toString(){let e={};for(let n of this.keys)e[n]=this[n];return JSON.stringify(e)}}function gi(e){return new Hg(e)}class Hg{constructor(e){this.description=new ul(e)}get keys(){return this.description.keys}variable(e){let n;if(e)n=this.description.toBundle(e).toInt32();return new Qg(this.description,n)}}class Qg{constructor(e,n){this.values=new Set;if(this.description=e,n!==void 0)this.values.add(n)}[Symbol.iterator](){let e=this.values[Symbol.iterator]();return{next:()=>{let n=e.next();if(n.done)return n;else return{done:!1,value:this.description.toBundle(n.value)}}}}assign(e){let{values:n}=e;for(let t of n)this.values.add(t);return this}push(e,n){let t=new Set;for(let r of this.values)for(let[o,i]of kn)if(e&i){let s=this.description.toBundle(r);n(o,s),t.add(s.toInt32())}this.values=t}update(e){let n=new Set;for(let t of this.values){let r=this.description.toBundle(t);e(r),n.add(r.toInt32())}this.values=n}}function Ln(e,n){let[t]=e,[r]=n;if(t.num<r.num)return Tk(e,n);else if(t.num>r.num)return Nk(e,n);else return zk(e,n)}function Tk(e,n){let[t,r]=e,[o,i]=n;if(r.num<=o.num){let s=r.exclusive,a=o.exclusive;if(r.num<o.num||s||a)return{left:{fromLeft:!0,range:e},right:{fromLeft:!1,range:n}}}if(r.num<=i.num){let s=!0,a=!1;if(r.num===i.num){let c=r.exclusive,l=i.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!1,range:[Qe(r),i]};return{left:{fromLeft:!0,range:[t,Qe(o)]},center:[o,r],right:c}}}return{left:{fromLeft:!0,range:[t,Qe(o)]},center:[o,i],right:{fromLeft:!0,range:[Qe(i),r]}}}function Nk(e,n){let[t,r]=e,[o,i]=n;if(t.num>=i.num){let s=i.exclusive,a=t.exclusive;if(t.num>i.num||s||a)return{left:{fromLeft:!1,range:n},right:{fromLeft:!0,range:e}}}if(i.num<=r.num){let s=!0,a=!1;if(r.num===i.num){let c=i.exclusive,l=r.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!0,range:[Qe(i),r]};return{left:{fromLeft:!1,range:[o,Qe(t)]},center:[t,i],right:c}}}return{left:{fromLeft:!1,range:[o,Qe(t)]},center:[t,r],right:{fromLeft:!1,range:[Qe(r),i]}}}function zk(e,n){let[t,r]=e,[o,i]=n,s=t.exclusive,a=o.exclusive,c,l=t;if(!s&&a)l=o,c={fromLeft:!0,range:[t,Qe(o)]};else if(s&&!a)c={fromLeft:!1,range:[o,Qe(t)]};if(r.num<=i.num){let u=!0,d=!1;if(r.num===i.num){let g=r.exclusive,h=i.exclusive;u=g!==h,d=!g&&h}if(!d){let g;if(u)g={fromLeft:!1,range:[Qe(r),i]};return{left:c,center:[l,r],right:g}}}return{left:c,center:[l,i],right:{fromLeft:!0,range:[Qe(i),r]}}}function Qe(e){return{num:e.num,exclusive:!e.exclusive}}var Ot=(e)=>(n=e,t=Number.POSITIVE_INFINITY,r=e,o=Number.POSITIVE_INFINITY)=>{let{left:i,center:s,right:a}=Ln([{num:n,exclusive:!1},{num:t,exclusive:!1}],[{num:r,exclusive:!1},{num:o,exclusive:!1}]),c,l,u;if(i)c={min:i.range[0].num,max:i.range[1].num,isFrom1:i.fromLeft};if(a)l={min:a.range[0].num,max:a.range[1].num,isFrom1:a.fromLeft};if(s)u={min:s[0].num,max:s[1].num};return{left:c,right:l,intersection:u}};function Et({left:e,right:n,intersection:t}){if(!t)return b.Rejection;let r=!1,o=!1;if(e)if(e.isFrom1)r=!0;else o=!0;if(n)if(n.isFrom1)r=!0;else o=!0;if(r&&o)return b.Intersection;if(r)return b.Containing;if(o)return b.ContainedBy;return b.Equals}var Dk=Ot(0),Lk=gi(["hasCommon","hasExtra1","hasExtra2","hasRejection","hasCommonBroken"]);function Xg({calculate:e},n,t){let r=Dk(n.minItems,n.maxItems,t.minItems,t.maxItems),o=Et(r);if(o===b.Rejection)return W;let[i,s]=Yg(n),[a,c]=Yg(t),l=Math.max(i.length,a.length)+1,u=Math.min(l,r.intersection.max),d=Lk.variable({}),g=Math.min(n.minItems??0,t.minItems??0);for(let y=0;y<u;y++){let S=i[y]??s,j=a[y]??c,N=e(S,j);d.push(N,(D,V)=>{switch(D){case b.Equals:{if(!V.hasRejection)V.hasCommon=!0;break}case b.Containing:{if(!V.hasRejection)V.hasCommon=!0;V.hasExtra1=!0;break}case b.ContainedBy:{if(!V.hasRejection)V.hasCommon=!0;V.hasExtra2=!0;break}case b.Intersection:{if(!V.hasRejection)V.hasCommon=!0;V.hasExtra1=!0,V.hasExtra2=!0;break}case b.Rejection:{if(y<g)V.hasCommonBroken=!0;V.hasRejection=!0,V.hasExtra1=!0,V.hasExtra2=!0;break}}})}d.update((y)=>{switch(o){case b.Containing:{y.hasExtra1=!0;break}case b.ContainedBy:{y.hasExtra2=!0;break}case b.Intersection:{y.hasExtra1=!0,y.hasExtra2=!0;break}}if(n.uniqueItems&&!t.uniqueItems&&(t.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra2=!0;else if(!n.uniqueItems&&t.uniqueItems&&(n.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra1=!0;if(n.maxItems===0||t.maxItems===0){if(y.hasCommon=!0,n.maxItems!==0)y.hasExtra1=!0;if(t.maxItems!==0)y.hasExtra2=!0}});let h=de;for(let{hasExtra1:y,hasExtra2:S,hasCommon:j,hasCommonBroken:N}of d){let D=j;if(N)D=!1;if(!D)h|=W;else if(y&&S)h|=Q;else if(y)h|=q;else if(S)h|=J;else h|=K}return h}function Yg({items:e,additionalItems:n}){if(Array.isArray(e))return[e,n??Dn];else return[[],e??Dn]}function eh(e){let n=new Map;return(t,r)=>{let o=Cr(t),i=Cr(r);if(o!==i)return!1;if(!o)return t===r;return th(n,t,r,e)}}function nh(e){let n=new Map;return(t,r)=>th(n,t,r,e)}function th(e,n,t,r){let o=Wn(n),i=Wn(t),s=`${o}/${i}`,a=e.get(s);if(a===void 0)e.set(s,a=r(n,t));return a}function oh(e,n,t){let r=dl(n),o=dl(t),i=!1,s=!1,a=!1;for(let c of r){if(rh(e,o,c))a=!0;else i=!0;if(i&&a)break}for(let c of o){if(rh(e,r,c))a=!0;else s=!0;if(s&&a)break}if(!a)return W;if(i&&s)return Q;if(i)return q;if(s)return J;return K}function pl(e,n){let t=!1,r=!1;for(let o of dl(e)){switch(mn(n,o)){case Ae.Valid:{t=!0;break}case Ae.Invalid:{r=!0;break}case Ae.Unknown:return We}if(t&&r)break}if(t&&r)return Q;if(t)return K|J;if(r)return W;if(H(n)===I.Never)return K;return J}function dl({const:e,enum:n}){if(e!==void 0)return[e];if(n)return n;throw Error("invalid branch")}function rh({isEquals:e},n,t){for(let r of n)if(e(r,t))return!0;return!1}function ih(e){function n(s,a){let c=e.isExtendsSchema(s),l=e.isExtendsSchema(a);if(c||l)return e.equals(s,a);else return r(s,a)}let t=new Map;function r(s,a){let c=Wn(s),l=Wn(a);if(c===l)return!0;let u=`${c}/${l}`,d=t.get(u);if(d===void 0)d=o(s,a),t.set(u,d);return d}function o(s,a){if(Array.isArray(s)){if(!Array.isArray(a))return!1;if(s.length!==a.length)return!1;for(let[c,l]of s.entries())if(!i(l,a[c]))return!1}else{if(Array.isArray(a))return!1;for(let c in s){if(!(c in a))return!1;let l=Reflect.get(s,c),u=Reflect.get(a,c);if(!i(l,u))return!1}for(let c in a)if(!(c in s))return!1}return!0}function i(s,a){if(s===a)return!0;if(s===null||a===null)return!1;if(typeof s!=="object")return!1;if(typeof s!==typeof a)return!1;if(Ze(s)&&Ze(a))return r(s,a);return o(s,a)}return n}function Er(e){let n=_r(e),t=e.multipleOf??1,r=cn(n,t);if(!r)return null;return{multipleOf:t,range:r}}function sh([e,n]){if(e.num!==n.num)return!1;if(e.exclusive)return!1;if(n.exclusive)return!1;return!0}function cn(e,n){if(!e)return;let[t,r]=e,o=Vk(t.num,n),i=Mk(r.num,n);if(o===t.num&&t.exclusive)o+=n;if(i===r.num&&r.exclusive)i-=n;if(o>i)return;if(o===i){if(o===Number.POSITIVE_INFINITY)return;if(o===Number.NEGATIVE_INFINITY)return}return[{num:o,exclusive:!1},{num:i,exclusive:!1}]}function Vk(e,n){return Math.ceil(e/n)*n}function Mk(e,n){return Math.floor(e/n)*n}function ch(e,n){let t=_r(e),r=_r(n),{left:o,right:i,center:s}=Ln(t,r);if(!s)return W;let a=!1,c=!1;if(o)if(o.fromLeft)a=!0;else c=!0;if(i)if(i.fromLeft)a=!0;else c=!0;if(a&&c)return Q;if(a)return q;if(c)return J;return K}function fl(e,n){let t=_r(e),r=Er(n);if(!r)return q;let o=Ln(t,r.range),i=cn(o.center,r.multipleOf),s=ah(o.left,r.multipleOf),a=ah(o.right,r.multipleOf);if(!o.center)return W;let c=!1,l=!1;if(o.left?.fromLeft)c=!0;if(o.right?.fromLeft)c=!0;if(!i||!sh(o.center))c=!0;if(s)l=!0;if(a)l=!0;if(c&&l)return Q;if(c)return q;if(l)return J;return K}function _r(e){let n,t;if(e.exclusiveMinimum!==void 0)n={num:e.exclusiveMinimum,exclusive:!0};else if(e.minimum!==void 0)n={num:e.minimum,exclusive:!1};else n={num:Number.NEGATIVE_INFINITY,exclusive:!0};if(e.exclusiveMaximum!==void 0)t={num:e.exclusiveMaximum,exclusive:!0};else if(e.maximum!==void 0)t={num:e.maximum,exclusive:!1};else t={num:Number.POSITIVE_INFINITY,exclusive:!0};return[n,t]}function ah(e,n){if(!e)return;if(e.fromLeft)return;return cn(e.range,n)}function dh(e,n){let t=Er(e),r=Er(n);if(!t&&!r)return K;if(!t)return J;if(!r)return q;let{range:o,multipleOf:i}=t,{range:s,multipleOf:a}=r,c=Ln(o,s),l,u=0;if(c.center)u=qk(i,a),l=cn(c.center,u);if(!l)return W;let d=!1,g=!1,{left:h,right:y}=c;if(h&&cn(h.range,h.fromLeft?i:a))if(h.fromLeft)d=!0;else g=!0;if(y&&cn(y.range,y.fromLeft?i:a))if(y.fromLeft)d=!0;else g=!0;if(d=d||lh(t,l,u),g=g||lh(r,l,u),d&&g)return Q;if(d)return q;if(g)return J;return K}function lh({range:e,multipleOf:n},t,r){let o=Ln(e,t);if(cn(o.left?.range,n))return!0;if(cn(o.right?.range,n))return!0;let i=cn(o.center,n);if(!i)return!1;let s=uh(t);if(uh(i)>s)return!0;if(s===1)return!1;if(n<r)return!0;return!1}function qk(e,n){return e*n/ph(e,n)}function ph(e,n){if(e===0)return n;return ph(n%e,e)}function uh(e){if(!e)return 0;let[n,t]=e;return t.num-n.num+1}function ml(e,n){if(fh(e)||fh(n))return We;let t=mh(e),r=mh(n);if(t&&r)return ch(e,n);else if(t)return fl(e,n);else if(r)return Nn(fl(n,e));else return dh(e,n)}function fh(e){let{multipleOf:n}=e;if(n===void 0)return!1;if(!Number.isInteger(n))return!0;if(n<0)return!0;return!1}function mh(e){let{multipleOf:n}=e;if(n!==void 0&&Number.isInteger(n))return!1;if(e.type==="integer")return!1;return!0}var Fk=Ot(0),Zk=gi(["hasCommonInRequired","hasCommonOutRequired","hasExtra1","hasExtra2","hasRejection"]);function yh(e,n,t){if(Jk(n,t))return W;let r=Uk(n,t);if(!r)return W;let o=gh(n),i=gh(t),s=(S)=>{let j=o(S),N=i(S);if(hh(j,N))return e.calculate(j,N);else return de},{commonRequired:a,extraRequired1:c,extraRequired2:l}=r,u=Zk.variable({});for(let S of[...a].toSorted())u.push(s(S),Kk);for(let S of[...c].toSorted())u.push(s(S),Wk);for(let S of[...l].toSorted())u.push(s(S),Gk);let{hasOptional1:d,hasOptional2:g}=r;if(d||g){let S=Hk(d,g);for(let D of[...Bk(n,t)].toSorted()){let V=s(D);if(V!==de)u.push(V,S)}let j=n.additionalProperties??Dn,N=t.additionalProperties??Dn;if(hh(j,N)){let D=e.calculate(j,N);u.push(D,S)}}u.update((S)=>{if(!S.hasRejection){if(c.size>0)S.hasExtra2=!0;if(l.size>0)S.hasExtra1=!0}});let{requiredKeysCount:h}=r,y=de;for(let{hasExtra1:S,hasExtra2:j,hasCommonInRequired:N,hasCommonOutRequired:D,hasRejection:V}of u)if(!N&&h>0)y|=W;else if(!D&&h===0)y|=W;else if(V)y|=W;else if(S&&j)y|=Q;else if(S)y|=q;else if(j)y|=J;else y|=K;return y}function Jk(e,n){let t=Fk(e.minProperties,e.maxProperties,n.minProperties,n.maxProperties);return Et(t)===b.Rejection}function Uk(e,n){let t=new Set(e.required),r=new Set(n.required),o=new Set,i=new Set,s=t.size,a=r.size;for(let d of t){if(r.has(d))o.add(d);i.add(d)}for(let d of r){if(t.has(d))o.add(d);i.add(d)}let c=i.size;for(let d of o)t.delete(d),r.delete(d);let l=e.maxProperties??Number.MAX_SAFE_INTEGER,u=n.maxProperties??Number.MAX_SAFE_INTEGER;if(c>l||c>u)return null;return{requiredKeysCount:c,extraRequired1:t,extraRequired2:r,commonRequired:o,hasOptional1:l>s,hasOptional2:u>a}}function Bk(e,n){let t=new Set(e.required),r=e.properties,o=n.properties,i=e.required,s=n.required;if(r)for(let a in r)t.add(a);if(o)for(let a in o)t.add(a);if(i)for(let a of i)t.delete(a);if(s)for(let a of s)t.delete(a);return t}var Kk=(e,n)=>{switch(e){case b.Equals:{n.hasCommonInRequired=!0;break}case b.Containing:{n.hasExtra1=!0,n.hasCommonInRequired=!0;break}case b.ContainedBy:{n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case b.Intersection:{n.hasExtra1=!0,n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case b.Rejection:{n.hasRejection=!0;break}}},Wk=(e,n)=>{switch(e){case b.Equals:case b.ContainedBy:{n.hasCommonInRequired=!0;break}case b.Intersection:case b.Containing:{n.hasExtra1=!0,n.hasCommonInRequired=!0;break}case b.Rejection:{n.hasRejection=!0;break}}},Gk=(e,n)=>{switch(e){case b.Equals:case b.Containing:{n.hasCommonInRequired=!0;break}case b.Intersection:case b.ContainedBy:{n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case b.Rejection:{n.hasRejection=!0;break}}},Hk=(e,n)=>(t,r)=>{if(r.hasRejection)return;let o=!1,i=!1,s=!1;switch(t){case b.Equals:{s=!0;break}case b.Containing:{o=!0,s=!0;break}case b.ContainedBy:{i=!0,s=!0;break}case b.Intersection:{o=!0,i=!0,s=!0;break}case b.Rejection:{o=!0,i=!0;break}}if(e&&o)r.hasExtra1=!0;if(n&&i)r.hasExtra2=!0;if(e&&n&&s)r.hasCommonOutRequired=!0};function gh(e){let{properties:n,propertyNames:t,additionalProperties:r}=e,o=[];if(e.patternProperties)for(let i in e.patternProperties){let s=e.patternProperties[i],a=new RegExp(i,"i");o.push({pattern:a,schema:s})}return(i)=>{if(t&&mn(t,i)===Ae.Invalid)return Ir;for(let{pattern:a,schema:c}of o)if(a.test(i))return c;let s=(n&&n[i])??r;if(!s)return Dn;return s}}function hh(e,n){let t=H(e),r=H(n);return t!==I.Never||r!==I.Never}var Qk=Ot(0);function bh(e,n){if(n.format&&!e.format)return q;if(e.format&&n.format&&e.format!==n.format)return We;let t=Qk(e.minLength,e.maxLength,n.minLength,n.maxLength),r=Et(t),o=!!e.pattern,i=!!n.pattern;switch(r){case b.Rejection:return W;case b.Containing:return o?We:q;case b.ContainedBy:return i?We:J;case b.Equals:{if(o&&i)return e.pattern===n.pattern?K:We;if(o)return K|J;if(i)return K|q;return K}case b.Intersection:{if(o&&i)return We;if(o)return Q|W|J;if(i)return Q|W|q;return Q}}}function vh(e,n,t){let r={},o=[],i=nh(Xk(e,r)),s=Yk(),a=ih(e);r.isEquals=eh(kt),r.calculate=rl({describe:s,equals:a,calculate:i,observeCalculation:(l,u,d,g)=>{let h=g?Nn(d):d;if(!eS(h))return;let y=g?wh(u,l):wh(l,u);if(y)o.push(y)}}),Object.freeze(r);let c=r.calculate(n,t);return{errorPath:o[0],expression:c}}var Yk=()=>(e)=>{let n;switch(H(e)){case I.Not:{n={kind:qe.Not,expression:e.not};break}case I.Combination:{if("allOf"in e)n={kind:qe.AllOf,expressions:gl(e.allOf,I.Any)};else if("anyOf"in e)n={kind:qe.AnyOf,expressions:gl(e.anyOf,I.Never)};else if("oneOf"in e)n={kind:qe.OneOf,expressions:gl(e.oneOf,I.Never)};else throw Error(`invalid combination JSON Schema: ${JSON.stringify(e)}`);break}default:{n={kind:qe.Leaf};break}}return n},Xk=(e,n)=>(t,r)=>{let o=H(t),i=H(r);if(o===I.Extends||i===I.Extends)return e.calculate(t,r);switch(o){case I.Any:return i===I.Any?K:q;case I.Never:return i===I.Never?K:J}switch(i){case I.Any:return J;case I.Never:return q}if(o===I.EnumOrConst&&i===I.EnumOrConst)return oh(n,t,r);if(o===I.EnumOrConst)return pl(t,r);if(i===I.EnumOrConst)return Nn(pl(r,t));if(o!==i)return W;switch(o){case I.Null:return K;case I.Numeric:return ml(t,r);case I.String:return bh(t,r);case I.Boolean:return K;case I.Object:return yh(n,t,r);case I.Array:return Xg(n,t,r);default:throw Error(`invalid kind ${o}`)}};function gl(e,n){return e.filter((t)=>H(t)!==n)}function eS(e){return!yr(e)&&!wr(e)&&(br(e)||xr(e)||vr(e))}function wh(e,n){let t=sl(n);if(!t)return;let r=H(e),o=H(n);if(r!==o)return[...t,"type"];let i=e,s=n;switch(o){case I.String:{if((i.minLength??0)<(s.minLength??0))return[...t,"minLength"];if((i.maxLength??Number.POSITIVE_INFINITY)>(s.maxLength??Number.POSITIVE_INFINITY))return[...t,"maxLength"];if(i.pattern!==s.pattern&&s.pattern)return[...t,"pattern"];if(i.format!==s.format&&s.format)return[...t,"format"];break}case I.Numeric:{if((i.minimum??i.exclusiveMinimum??Number.NEGATIVE_INFINITY)<(s.minimum??s.exclusiveMinimum??Number.NEGATIVE_INFINITY))return[...t,s.exclusiveMinimum==null?"minimum":"exclusiveMinimum"];if((i.maximum??i.exclusiveMaximum??Number.POSITIVE_INFINITY)>(s.maximum??s.exclusiveMaximum??Number.POSITIVE_INFINITY))return[...t,s.exclusiveMaximum==null?"maximum":"exclusiveMaximum"];if(i.multipleOf!==s.multipleOf&&s.multipleOf!=null)return[...t,"multipleOf"];break}case I.Array:{if((i.minItems??0)<(s.minItems??0))return[...t,"minItems"];if((i.maxItems??Number.POSITIVE_INFINITY)>(s.maxItems??Number.POSITIVE_INFINITY))return[...t,"maxItems"];if(!i.uniqueItems&&s.uniqueItems)return[...t,"uniqueItems"];break}case I.Object:{let a=new Set(i.required??[]);if((s.required??[]).some((c)=>!a.has(c)))return[...t,"required"];if((i.minProperties??0)<(s.minProperties??0))return[...t,"minProperties"];if((i.maxProperties??Number.POSITIVE_INFINITY)>(s.maxProperties??Number.POSITIVE_INFINITY))return[...t,"maxProperties"];break}case I.EnumOrConst:return[...t,s.const===void 0?"enum":"const"]}return t}class jr{constructor(e=[]){this.extendsSchemaClasses=Object.freeze([...e])}tryCompiledExtendsSchema(e,n){for(let t of this.extendsSchemaClasses)if(t.isMatch(e))return new t($n(),e,n);return null}isExtendsSchema(e){for(let n of this.extendsSchemaClasses)if(e instanceof n)return!0;return!1}calculate(e,n){let t=this.findMatchedClass(e,n),r=!(e instanceof t),o=de,i;if(r)i=n.compare(e);else i=e.compare(n);for(let s of i){if(r)s=jr.swap(s);o|=Tn(s)}return o}equals(e,n){let t=this.findMatchedClass(e,n);if(!(e instanceof t))return n.equals(e);else return e.equals(n)}findMatchedClass(e,n){for(let t of this.extendsSchemaClasses){if(e instanceof t)return t;if(n instanceof t)return t}throw Error("Invalid schema")}static swap(e){switch(e){case b.Containing:return b.ContainedBy;case b.ContainedBy:return b.Containing;default:return e}}}function xh(e,n,t=!1){let r=n(e);if(Array.isArray(r)){let s=[];throw hl(s,r,"$"),new di(s)}let{schema:o,warns:i}=r;if(t&&i.length>0){console.warn(`found ${i.length} warns after compile schema`);for(let s of i)console.warn(Ct(s))}return o}function kh(e,n,t,r=!1){let o=t(e),i=t(n);if(Array.isArray(o)||Array.isArray(i)){let u=[];if(Array.isArray(o))hl(u,o,"$1");if(Array.isArray(i))hl(u,i,"$2");throw new di(u)}let{schema:s,warns:a}=o,{schema:c,warns:l}=i;if(r){if(a.length>0)console.warn(`found ${a.length} warns after compile superSchema`);for(let u of a)console.warn(Ct(u));if(l.length>0)console.warn(`found ${l.length} warns after compile subSchema`);for(let u of l)console.warn(Ct(u))}return[s,c]}function hl(e,n,t){for(let r of n){let o={...r,path:[t,...r.path]};e.push(o)}}var Rr=Object.freeze({True:0,False:1,Unknown:2});function yl({extendsSchemaClasses:e,delegate:n}={}){let t=new jr(e);return Object.freeze({compile:(o,i,s)=>xh(o,(c)=>mi(c,t,i,n),s),isSubset:(o,i,s=!1)=>{let a=(y)=>mi(y,t,void 0,n),[c,l]=kh(o,i,a,s),{errorPath:u,expression:d}=vh(t,c,l),g=yr(d)||wr(d),h=br(d)||xr(d)||vr(d);if(g&&!h)return{result:Rr.True};if(!g&&h)return{errorPath:u,result:Rr.False};return{result:Rr.Unknown}}})}var hi=(e)=>typeof e==="string";var nS=Array.isArray;var tS=(e)=>e!==null&&typeof e==="object";var rS=(e)=>tS(e)&&!nS(e),Gn=(e)=>rS(e)?e:void 0;function oS(e){return Gn(e)?.type==="string"}function iS(e){let n=Gn(e),t=Gn(n?.error);if(n==null||t==null||n.packageId!=null&&!hi(n.packageId)||t.message!=null&&!hi(t.message))throw TypeError("Invalid schema comparison context.")}function sS(e){if(e==null)return{error:{}};return iS(e),e}class Vn{static setError(e,n,t){if(e instanceof Vn)e.context.error.message=t;else if(n instanceof Vn)n.context.error.message=t}constructor(e,n,t){this.id=e,this.value=n,this.context=sS(t)}compare(e){if(Ze(e)&&H(e)===I.Any)return[b.ContainedBy];return this.compareImpl(e)}}class Ar extends Vn{static isMatch(e){let n=Gn(e)?.enum;return Array.isArray(n)&&n.every((t)=>hi(t))}constructor(e,n,t){if(!Ar.isMatch(n))throw TypeError("Invalid single-select schema.");super(e,n,t)}compareImpl(e){if(oS(e))return[b.ContainedBy];if(e instanceof Ar){let n=new Set(this.value.enum),t=b.Equals;for(let r of e.value.enum){if(!n.has(r))t=b.ContainedBy;n.delete(r)}if(n.size===0)return[t];if(n.size===this.value.enum.length)return[b.Rejection];return[b.Intersection]}return[b.Rejection]}equals(e){if(e instanceof Ar){let n=new Set(this.value.enum);for(let t of e.value.enum){if(!n.has(t))return!1;n.delete(t)}return n.size===0}return!1}}class Pr extends Vn{static isMatch(e){return Gn(e)?.contentMediaType==="oomol/bin"}constructor(e,n,t){if(!Pr.isMatch(n))throw TypeError("Invalid binary schema.");super(e,n,t)}compareImpl(e){if(e instanceof Pr)return[b.Equals];else return Vn.setError(this,e,"edgeError.binDiffType"),[b.Rejection]}equals(e){return e instanceof Pr}}class $r extends Vn{static isMatch(e){return Gn(e)?.contentMediaType==="oomol/artifact"}constructor(e,n,t){if(!$r.isMatch(n))throw TypeError("Invalid Artifact schema.");super(e,n,t)}compareImpl(e){if(e instanceof $r)return[b.Equals];return Vn.setError(this,e,"edgeError.artifactDiffType"),[b.Rejection]}equals(e){return e instanceof $r}}function Sh(){return yl({extendsSchemaClasses:[Ar,Pr,$r]})}var Sj=Sh();var aS=new Set(["const","enum","exclusiveMaximum","exclusiveMinimum","maximum","maxItems","maxLength","maxProperties","minimum","minItems","minLength","minProperties","multipleOf","pattern","required","type"]);function yi(e){return aS.has(e)}var bi=O({handle:R().min(1),jsonSchema:Te(),nullable:me(),description:R().optional()}),Tj=x({inputs:P(bi).nullable(),outputs:P(bi).nullable()});var Ih=O({version:w(1),flowId:R().min(1),name:R(),revisionId:R().min(1),publicationId:R().min(1),inputs:P(bi),outputs:P(bi).nullable()});var Ch=O({version:w(1),direction:ee(["incoming","outgoing"]),total:we().nonnegative(),nextOffset:we().nonnegative().optional(),references:P(O({flowId:R(),name:R().nullable(),available:me(),draft:me(),live:O({publicationId:R(),enabled:me()}).nullable()}))});var bl=["GET","POST","PUT","PATCH","DELETE"];function wi(e){return e!=="GET"}var wl={choice:255,score:10};function Oh(e){if(e.type==="noul"||e.criteria.length<=wl[e.type])return e;if(e.type==="choice")return{...e,criteria:e.criteria.slice(0,wl.choice)};return{...e,criteria:e.criteria.slice(0,wl.score)}}function lS(e){let n=e.map(Oh);return n.every((t,r)=>t===e[r])?e:n}function Eh(e){if(e.executor.kind!=="decision")return e;let n=e.executor.questions,t=lS(n);if(t===n)return e;let r=e.outputs.map((o)=>{if(!("handle"in o))return o;let i=n.findIndex((s)=>s.name===o.handle);if(i<0||n[i]===t[i]||!Ie(o.jsonSchema,_h(n[i])))return o;return{...o,jsonSchema:uS(t[i])}});return{...e,executor:{...e.executor,questions:t},outputs:r}}var vl={type:"number",minimum:0,maximum:1};function uS(e){return _h(Oh(e))}function _h(e){let n={type:{const:e.type}};if(e.type==="noul")n.noul=vl;else{let t=e.type==="choice"?e.criteria.map((r)=>r.name):e.criteria.map((r,o)=>String(o));if(n.confidence=vl,n.probabilities={type:"object",properties:Object.fromEntries(t.map((r)=>[r,vl])),required:t,additionalProperties:!1},e.type==="choice")n.choice={type:"string",...t.length?{enum:t}:{}};else n.score={type:"number",minimum:0,maximum:Math.max(0,t.length-1)},n.legend={type:"object",properties:Object.fromEntries(t.map((r)=>[r,{type:"string"}])),required:t,additionalProperties:!1}}return{type:"object",properties:n,required:Object.keys(n)}}function xl(e){for(let n of Object.values(e.graph.nodes)){if(n.kind!="task"||!("executor"in n.task)||n.task.executor.kind!="openapi")continue;for(let[t,r]of Object.entries(n.inputs))if(t.startsWith("auth.")&&r.kind=="value")throw TypeError("OpenAPI authentication accepts deployment variables and upstream outputs only.")}}function Hn(e,n=0){if(n>64)throw TypeError("Value exceeds the maximum JSON depth.");if(e!=null&&typeof e=="object")for(let t of Object.values(e))Hn(t,n+1)}var kl=["code","connector","openapi","llm","decision"],vi={maxRetries:5,minIntervalMs:1000,maxIntervalMs:60000,intervalStepMs:1000};var gn=x({maxRetries:X().int().min(0).max(vi.maxRetries),intervalMs:X().int().min(vi.minIntervalMs).max(vi.maxIntervalMs).multipleOf(vi.intervalStepMs)});var Mn=P(te([O({type:w("cron"),expression:R(),timezone:R()}),O({type:w("every"),unit:ee(["day","hour","minute","month","week"]),value:X()})]));function jh(e){try{return Intl.DateTimeFormat("en",{timeZone:e}),!0}catch{return!1}}var _t=an("kind",[x({kind:w("after"),durationMs:X().nullable()}),x({kind:w("at"),at:R(),timezone:R().optional()})]),Sl=an("kind",[_t.options[0].extend({durationMs:X().int().positive().max(Number.MAX_SAFE_INTEGER)}),_t.options[1].extend({at:gr.datetime({offset:!0}),timezone:R().refine(jh,"Select a valid IANA timezone.").optional()})]);var Nr={defaultMs:30000,minMs:1000,maxMs:60000};var Rh={jsonSchema:{type:"object",additionalProperties:{type:["string","number","boolean"]}},nullable:!0};var dS=[{handle:"body",jsonSchema:{},nullable:!0,value:""},{handle:"statusCode",jsonSchema:{type:"number"},nullable:!1,value:200},{handle:"headers",jsonSchema:Rh.jsonSchema,nullable:!1,value:{}}];var Oi=10,k=R(),xi=k.describe('Account selection: omit while unconfigured; use an account ID to select it; use "" to explicitly defer configuration. Deferred Actions fail if called; deferred Agent tools are excluded from the callable tool set. Not supported by Triggers.'),Xn=Te(),zr=P(k),At=O({description:k.optional(),jsonSchema:Xn,nullable:me(),handle:k}),pS=P(At.strict()),Ye=At.extend({value:Xn.optional()}),Ah=O({collapsed:me().optional(),group:k}),fS=O({kind:w("node"),nodeId:k,output:k,system:w(!0).optional(),field:k.optional()}),Th=te([fS,O({kind:w("binding"),bindingId:k})]),Dr=te([O({kind:w("unset")}),O({kind:w("value"),value:Xn})]),Il=te([Dr,O({kind:w("sources"),sources:P(Th)})]),Nh=re(k,Il),Rt={inputs:P(te([Ye,Ah])),outputs:P(te([At,Ah]))},mS=x({kind:w("connector"),action:k,connectionId:k.optional(),connections:P(x({connectionId:k,alias:k.optional()}))}),Si=te([mS,x({kind:w("connector"),mode:w("shared")}),x({kind:w("connector"),mode:w("independent"),actions:P(x({action:k,connectionId:xi.optional()}))}),x({kind:w("connector"),actionHints:P(k).optional(),connectionHints:P(x({action:k,connectionId:k,alias:k.optional()})).optional()})]),Cl=O({...Rt,name:k,moduleId:k,capabilities:P(Si).optional()}),zh=te([O({kind:w("value"),value:Xn}),O({kind:w("input"),input:k})]),gS=te([zh,O({kind:w("model")})]),hS=an("type",[x({name:k,instructions:k,type:w("noul"),criteria:x({true:k.optional(),false:k.optional()}).optional()}),x({name:k,instructions:k,type:w("choice"),criteria:P(x({name:k,description:k}))}),x({name:k,instructions:k,type:w("score"),criteria:zr})]),jt=O({...Rt,name:k,executor:te([O({kind:w("connector"),action:k,connectionId:xi.optional(),outputMode:w("value").optional()}),O({kind:w("openapi"),sourceUrl:k,method:k,path:k,serverUrl:k,document:Xn,auth:P(O({id:k,type:ee(["bearer","basic","apiKey"]),name:k.optional(),in:ee(["header","query"]).optional()}))}),x({kind:w("decision"),questions:P(hS)}),O({kind:w("llm"),mode:ee(["chat","json"])}),O({kind:w("agent"),code:me().optional(),model:k,prompt:k,maxRounds:X(),tools:P(O({id:k,name:k,description:k,action:k,connectionId:xi.optional(),approval:me(),inputs:P(Ye.extend({source:gS}))})),notification:O({action:k,connectionId:xi.optional(),inputDefinitions:P(Ye),messageHandle:k,inputs:re(k,zh)}).optional()}),x({kind:w("workflow"),flowId:k,revisionId:k})])}),Ol=jt.transform(Eh),Ph=te([O({kind:w("value"),value:Xn.optional(),jsonSchema:Xn.optional()}),O({kind:w("source"),source:Th})]),Ii={matchMode:ee(["first","all"]),cases:P(O({description:k.optional(),output:k,groups:P(O({expressions:P(O({left:Ph,operator:ee(["!=","<","<=","==",">",">=","contains","endsWith","hasKey","hasValue","isEmpty","isFalse","isNotEmpty","isNotNull","isNull","isTrue","notContains","notHasKey","notHasValue","startsWith"]),right:Ph.optional()}))}))}))},Lr={inputDefinitions:P(Ye),prompt:k},yS=O({allowedMethods:sn().optional(),allowedOrigins:zr.optional(),noResponseBody:sn().optional(),responseBody:an("kind",[x({kind:w("workflow-outputs"),output:k.optional(),timeoutMs:X().int().min(Nr.minMs).max(Nr.maxMs).optional()}),x({kind:w("webhook-response"),nodeId:k.optional(),timeoutMs:X().int().min(Nr.minMs).max(Nr.maxMs).optional()})]).optional(),responseData:k.optional(),responseHeaders:re(k,k).optional(),responseHeadersSource:x({kind:w("workflow-outputs"),output:k.optional()}).optional(),responseHeaderOutputs:re(k,k).optional(),responseStatusCode:X().int().min(200).max(599).optional(),responseStatusCodeOutput:k.optional()}),Ci={bodyFields:P(Ye),method:ee(bl),options:yS.optional()},$h={configInputs:Rt.inputs,definitionVersion:w(2),description:k,displayName:k,key:k,name:k,outputs:P(At).refine((e)=>new Set(e.map((n)=>n.handle)).size===e.length,"Duplicate Trigger output handle."),provider:k},bS=O({body:O({allowArray:me(),allowEmpty:me(),formats:P(ee(["form","json","multipart","text"]))}),methods:P(ee(["DELETE","GET","HEAD","PATCH","POST","PUT"])),successStatus:X()}),El=P(k.min(1)).refine((e)=>new Set(e).size===e.length,"Duplicate source Flow ID."),Qn={name:k,description:k.optional(),icon:k.optional()},Yn={maxExecutions:X().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),inputs:Nh,name:k.optional(),description:k.optional(),icon:k.optional(),timeoutMs:X().optional(),retry:gn.optional(),onError:ee(["stop","error"]).optional()},ki=te([x({...Yn,kind:w("webhook-response"),retry:sn().optional(),onError:sn().optional()}),x({...Yn,kind:w("outputs"),outputDefs:P(At.strict()),outputMappings:Nh}).omit({inputs:!0}),O({...Yn,inputs:re(k,sn()),kind:w("condition"),...Ii}),O({...Yn,inputs:pn().transform(()=>({})).default({}),kind:w("value"),values:P(Ye)}),O({...Yn,kind:w("task"),task:te([Cl,Ol]),additionalInputs:P(Ye).optional()}),x({...Yn,kind:w("approval"),...Lr}).omit({timeoutMs:!0}),x({...Yn,kind:w("wait"),...Lr,autoContinue:_t.optional()}).omit({timeoutMs:!0}),O({...Qn,kind:w("manual")}),x({...Qn,kind:w("start"),inputDefs:pS}),x({...Qn,kind:w("error"),sourceFlowIds:El.optional()}),O({...Qn,kind:w("webhook"),...Ci}),O({...Qn,kind:w("cron"),cronTimes:Mn}),O({...Qn,kind:w("poll"),connectionId:k.min(1).optional(),config:re(k,Dr),definition:O({...$h,type:w("poll")}),pollTimes:Mn}),O({...Qn,kind:w("integration"),connectionId:k.min(1).optional(),config:re(k,Dr),definition:O({...$h,type:w("integration"),endpoint:bS})})]),Ge={input:Ye,port:At,ports:Rt,condition:x(Ii),wait:x(Lr),waitAutoContinue:Sl,webhook:x(Ci),schedule:Mn,capabilities:P(Si),connector:jt.shape.executor.options[0].omit({kind:!0}).strict(),openapi:jt.shape.executor.options[1].omit({kind:!0}).strict(),decision:jt.shape.executor.options[2].omit({kind:!0}).strict(),llm:jt.shape.executor.options[3].omit({kind:!0}).strict(),agent:jt.shape.executor.options[4].omit({kind:!0,notification:!0}).strict()},_l=O({source:k,target:k,sourceHandle:k.optional()}),Oe={nodeId:k,target:sn().optional()},wS=O({nodes:re(k,ki),edges:P(_l).default([])}),Dh=O({kind:w("variable"),target:k}),Lh=O({name:k,imports:zr,source:k}),vS=Ig(xS,O({bindings:re(k,Dh),graph:wS})),Vh=O({modelVersion:te([w(2),w(4),w(5),w(6),w(7),w(8),w(9),w(Oi)]),document:vS,modules:re(k,Lh)}),aR=Vh.extend({kind:w("open-flow-flow-revision"),version:w(1)});function xS(e){let n=ln(e);if(n.tasks!==void 0&&(n.tasks===null||typeof n.tasks!=="object"||Array.isArray(n.tasks)||Object.keys(n.tasks).length>0))throw TypeError("Independent Task definitions are no longer supported.");if(Object.values(ln(ln(n.graph).nodes)).some((r)=>Object.hasOwn(ln(r),"taskId")))throw TypeError("Task references are no longer supported.");let t=n.subflows;if(t!==void 0&&(t===null||typeof t!=="object"||Array.isArray(t)||Object.keys(t).length>0))throw TypeError("Subflows are no longer supported.");if(Object.values(ln(ln(n.graph).nodes)).some((r)=>ln(r).kind==="subflow"))throw TypeError("Subflow nodes are no longer supported.");if(["inputDefs","outputDefs","outputMappings"].some((r)=>Object.hasOwn(n,r)))throw TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");if(Object.values(ln(ln(n.graph).nodes)).some((r)=>ln(r).kind=="start"&&Object.hasOwn(ln(r),"parameters")))throw TypeError("Legacy Start.parameters is unsupported; configure node.inputDefs.");return e}function ln(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Pt(e){Hn(e);let n=Vh.parse(e);return SS(n),xl(n.document),n}var kS={"graph.trigger.sources.set":{nodeId:k,before:El.optional(),value:El.optional()},"binding.create":{bindingId:k,binding:Dh},"binding.delete":{bindingId:k},"binding.target.set":{bindingId:k,before:k,value:k},"graph.edge.connect":{edge:_l,target:sn().optional()},"graph.edge.disconnect":{edge:_l,target:sn().optional()},"graph.node.create":{...Oe,node:ki},"graph.node.replace":{...Oe,before:ki,node:ki},"graph.node.delete":Oe,"graph.node.field.set":te([O({...Oe,kind:w("graph.node.field.set"),field:w("retry"),before:gn.optional(),value:gn.optional()}),O({...Oe,kind:w("graph.node.field.set"),field:w("connectionId"),before:k.min(1).optional(),value:k.min(1).optional()}),O({...Oe,kind:w("graph.node.field.set"),field:ee(["description","icon","name","onError"]),before:k.optional(),value:k.optional()}),O({...Oe,kind:w("graph.node.field.set"),field:w("maxExecutions"),before:X().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),value:X().int().positive().max(Number.MAX_SAFE_INTEGER).optional()}),O({...Oe,kind:w("graph.node.field.set"),field:w("timeoutMs"),before:X().optional(),value:X().optional()})]),"graph.node.input.set":{...Oe,handle:k,before:Il.optional(),value:Il.optional()},"graph.node.additional-inputs.set":{...Oe,before:P(Ye).optional(),value:P(Ye).optional()},"graph.node.condition.set":{...Oe,before:O(Ii),value:O(Ii)},"graph.node.values.set":{...Oe,before:P(Ye),value:P(Ye)},"graph.node.resolution.set":{...Oe,before:x({...Lr,autoContinue:_t.optional()}),value:x({...Lr,autoContinue:_t.optional()})},"graph.node.webhook.set":{...Oe,before:O(Ci),value:O(Ci)},"graph.node.task.ports.set":{...Oe,before:O(Rt),value:O(Rt)},"graph.node.task.name.set":{...Oe,before:k,value:k},"graph.node.task.capabilities.set":{...Oe,before:P(Si).optional(),value:P(Si).optional()},"graph.trigger.config.set":{nodeId:k,name:k,before:Dr.optional(),value:Dr.optional()},"graph.trigger.schedule.set":{nodeId:k,before:Mn,value:Mn},"module.create":{moduleId:k,module:Lh},"module.delete":{moduleId:k},"module.rename":{moduleId:k,before:k,name:k},"module.source.replace":{moduleId:k,beforeImports:zr,beforeSource:k,imports:zr,source:k},"graph.node.task.set":{...Oe,before:te([Cl,Ol]),value:te([Cl,Ol])}},Mh=new Map(Object.entries(kS).map(([e,n])=>[e,n instanceof Z?n:O({kind:w(e),...n})])),cR=P(te([...Mh.values()])).min(1);function Vr(e,n,t){try{return t(e)}catch(r){if(!(r instanceof Rv))throw r;throw TypeError(`operations[${n}]: ${r.issues.map((o)=>`${o.path.join(".")}: ${o.message}`).join("; ")}`,{cause:r})}}function qh(e,n){let{kind:t}=Vr(e,n,O({kind:k}).parse),r=Mh.get(t);if(r==null)throw TypeError(`operations[${n}]: Unknown operation ${JSON.stringify(t)}.`);return Vr(e,n,r.parse)}function SS(e){if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="webhook"&&(n.options?.responseBody!=null||n.options?.responseStatusCodeOutput!=null||n.options?.responseHeadersSource!=null||n.options?.responseHeaderOutputs!=null)))throw TypeError("Dynamic Webhook responses require Flow model version 10.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((n)=>("retry"in n)&&n.retry!=null))throw TypeError("Node retries require Flow model version 9.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((n)=>{if(n.onError!=null)return!0;if([...Object.values("inputs"in n?n.inputs:{}),...Object.values(n.kind=="outputs"?n.outputMappings:{})].some((r)=>r.kind=="sources"&&r.sources.some((o)=>o.kind=="node"&&o.system)))return!0;return n.kind=="condition"&&n.cases.some((r)=>r.groups.some((o)=>o.expressions.some((i)=>[i.left,i.right].some((s)=>s?.kind=="source"&&s.source.kind=="node"&&s.source.system))))}))throw TypeError("Node error handling requires Flow model version 9.");if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((n)=>n.kind==="webhook-response"))throw TypeError("Webhook response nodes require Flow model version 10.");if(e.modelVersion<8&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="outputs"))throw TypeError("Workflow outputs require Flow model version 8.");if(e.modelVersion<7&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="start"))throw TypeError("Start Triggers require Flow model version 7.");if(e.modelVersion<6&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("executor"in n.task)))throw TypeError("Node-owned managed Tasks require Flow model version 6.");if(e.modelVersion<5&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="error"))throw TypeError("Error workflows require Flow model version 5.")}var Fh=x({mode:ee(["chat","json"]),resultSchema:Te(),model:Te().optional().describe("Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence."),template:Te().optional().describe('Default message templates: [{role: "system" | "user" | "assistant", content: "Text with {{namedInput}}"}].'),messages:Te().optional().describe("Default conversation history, prepended without template interpolation; an array of {role, content} or null.")});var OS=te([x({schemes:P(R().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.")}),x({type:ee(["bearer","basic"])}),x({type:w("apiKey"),name:R().min(1),in:ee(["header","query"])})]),Zh=x({sourceUrl:R().min(1),path:R().min(1),method:R().min(1),serverUrl:R().optional(),authentication:OS.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")});var z=R().min(1),Xe=Te(),$l=re(z,Xe),Ei=["start","outputs","webhook-response","workflow","webhook","cron","error","poll","integration","code","connector","agent","llm","decision","openapi","condition","value","wait","approval"],Tl=ee(Ei),hn=z.describe('An existing node reference returned by read/search, or $alias for a preceding node.add in this edit batch. For node.add.as "step", reference "$step", never bare "step". Aliases are local to one batch.'),jl=x({kind:w("output"),node:hn,port:z.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),field:R().optional()}),Rl=x({kind:w("system"),node:hn,port:w("error"),field:R().optional()}),Al=x({kind:w("variable"),name:z}),Jh=te([jl,Rl,Al,x({kind:w("value"),value:Xe}),x({kind:w("unset")}),x({kind:w("default")}),x({kind:w("sources"),sources:P(te([jl,Rl,Al])).min(1)})]),Uh=te([x({kind:w("value"),value:Xe.optional(),schema:Xe.optional()}),jl,Rl,Al]),ES=Ge.agent.shape.tools.element.omit({id:!0,inputs:!0}).extend({inputs:re(z,Ge.agent.shape.tools.element.shape.inputs.element.shape.source).optional().describe("Action input sources by name. The tool resolves types from the Action. New inputs default to model-provided; existing sources are preserved when omitted.")}).strict(),_S=x({...Ge.connector.shape,messageHandle:z,inputs:re(z,te([x({kind:w("value"),value:Xe}),x({kind:w("input"),input:z})]))}),_i=x({schema:Xe.optional(),nullable:me().optional(),description:R().optional()}),$t=re(z,_i.extend({default:Xe.optional()})).describe("Optional business input constraints by name. A binding to a new Code, Agent, LLM, Wait or Approval input automatically declares an input accepting any JSON. Existing constraints are preserved. Omitted schema accepts any JSON; omitted nullable is true. Use default for inherited values; input.set supplies data."),Gh=re(z,_i).describe("Workflow input definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Supply call values as trigger.outputs."),jS=Gh.describe("Workflow output definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Set values on the Outputs node with input.set or node.add.inputs."),Hh=re(z,_i.extend({schema:Xe,nullable:me()})),Bh=re(z,_i).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true."),Pl=x({left:Uh,operator:Ge.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,right:Uh.optional()}),Kh=x({all:P(Pl)}),RS=te([Pl,Kh,x({any:P(te([Pl,Kh]))})]),Sn={"webhook-response":x({}),workflow:x({flowId:z}),start:x({inputDefs:Gh.default({})}),outputs:x({outputDefs:jS.default({})}),error:x({sourceFlowIds:P(z).optional()}),webhook:Ge.webhook.omit({bodyFields:!0}).extend({body:$t}).strict(),cron:x({schedule:Ge.schedule}),poll:x({key:z,connectionId:z.optional(),schedule:Ge.schedule}),integration:x({key:z,connectionId:z.optional()}),code:x({inputs:$t,outputs:Bh,capabilities:Ge.capabilities.optional()}),connector:Ge.connector.omit({outputMode:!0}).strict(),openapi:Zh,agent:Ge.agent.omit({prompt:!0,tools:!0}).extend({inputs:$t,resultSchema:Xe.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),tools:P(ES),notification:_S.optional()}).strict(),llm:Fh.extend({inputs:$t}),decision:Ge.decision,condition:x({match:ee(["first","all"]),branches:P(x({name:z,description:R().optional(),when:RS}))}),value:x({values:$l,outputs:Bh}),wait:x({inputs:$t,autoContinue:Ge.waitAutoContinue.optional().describe("Wait only. Omit to disable; clear config.autoContinue to remove. after counts from each wait registration; at requires an explicit offset and continues immediately if already past. Optional timezone preserves the editor zone; at remains the absolute instant. Server requires the deadline to precede the 7-day expiry.")}),approval:x({inputs:$t})},AS={onError:ee(["stop","error"]).optional(),name:z.optional(),description:R().optional(),icon:R().optional(),maxExecutions:we().positive().optional(),timeoutMs:X().nonnegative().optional(),retry:gn.partial().optional().describe('Node retry policy for Code, Connector, OpenAPI, LLM and AI Decision. Omitted update fields preserve the policy; use clear: [["retry"]] to disable it. maxRetries counts additional attempts; intervalMs is 1000\u201360000 in whole seconds.')},PS=x({...AS,config:$l.optional().describe('Recursively merge configuration; omitted fields remain unchanged and arrays replace as a whole. This includes schema objects: {} does not clear an existing schema. Use clear paths to remove fields, e.g. ["config","inputs","amount","schema","type"].')}),$S=an("op",[x({op:w("node.add"),as:z.regex(/^[A-Za-z][\w-]*$/).describe("Unique batch-local alias without the $ prefix. Later edits must reference this new node as $alias; the bare alias is not its node ID."),type:Tl,name:z,onError:ee(["stop","error"]).optional(),retry:gn.optional(),config:$l.optional(),inputs:re(z,Jh).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),code:R().optional(),prompt:R().optional()}),x({op:w("node.update"),node:hn,set:PS.optional(),clear:P(P(z).min(1)).optional()}),x({op:w("node.refresh"),node:hn}),x({op:w("node.remove"),node:hn}),x({op:w("input.set"),node:hn,input:z,source:Jh}),x({op:ee(["edge.connect","edge.disconnect"]),source:hn,target:hn,branch:z.optional()}),x({op:w("text.edit"),node:hn,field:ee(["code","prompt"]),oldText:z,newText:R()}),x({op:w("text.set"),node:hn,field:ee(["code","prompt"]),text:R()})]),Mr=x({baseRevision:z,requestId:z.max(256),edits:P($S).min(1).max(1000)}),ji=x({revision:z.optional().describe("Fixed revision from a previous read; omit to read the current draft."),nodes:P(z).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),text:x({node:z,field:ee(["code","prompt"]),start:we().positive().default(1),lines:we().min(1).max(200).default(80)}).optional().describe("Read code or prompt by line (1-based). Mutually exclusive with nodes. Follow nextStart at the same revision until truncated is false.")}).refine((e)=>e.nodes==null||e.text==null,"Choose nodes or text.").meta({not:{required:["nodes","text"]},description:"Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."}),Nl=x({revisionId:z}),Ri=x({revision:z.optional(),query:z.max(1000),type:Tl.optional(),offset:we().nonnegative().default(0),limit:we().min(1).max(100).default(20)}),Qh=x({type:Tl.optional(),action:z.optional()}).refine((e)=>e.type==null||e.action==null,"Choose type or action."),Wh={read:{schema:ji,guidance:"Read Start and Outputs node details for their interface definitions and data sources. Choose one mode: outline (omit nodes and text), node details (nodes), or text excerpt (text). nodes and text are mutually exclusive. Text defaults to 80 lines, at most 200 lines and 24000 characters. For the complete text, repeat at nextStart with the same revision until truncated is false.",examples:[{},{revision:"REVISION",nodes:["NODE"]},{revision:"REVISION",text:{node:"NODE",field:"prompt",start:1,lines:80}}]},search:{schema:Ri,guidance:"Search names, configurations and text. Keep the returned revision when following nextOffset or reading a match.",examples:[{query:"Customer summary",type:"agent"}]},edit:{schema:Mr,guidance:'Edit Start config.inputDefs and Outputs config.outputDefs through node.add or node.update; clear paths are relative to the node, e.g. ["config","inputDefs","amount"]. Set Outputs values with input.set. Use the observed revision as baseRevision and a stable requestId. Edits are ordered and atomic. node.add.as declares a batch-local alias without $. Every later reference to that new node must use $alias, including node, edge source/target and output source node fields; a bare alias is not the node ID. Use returned node references in later batches. Updates recursively merge objects (including schemas); {} preserves existing fields. Arrays replace as a whole. Remove fields with clear paths. Text replacement requires exactly one match. Read the target text first. A saved draft can have validation diagnostics.',examples:[{baseRevision:"REVISION",requestId:"CREATE_REQUEST",edits:[{op:"node.add",as:"start",type:"start",name:"Start"},{op:"node.add",as:"step",type:"code",name:"Process",code:"export default ({value}) => ({result:value})"},{op:"edge.connect",source:"$start",target:"$step"},{op:"node.update",node:"$step",set:{description:"Created and connected in one atomic edit."}}]},{baseRevision:"REVISION",requestId:"REQUEST",edits:[{op:"text.edit",node:"NODE",field:"prompt",oldText:"Original rule.",newText:"Updated rule."}]}]},check:{schema:Nl,guidance:"Check a fixed revision. In the CLI, pass this identity with --revision REVISION.",examples:[{revisionId:"REVISION"}]}};function zl(e){if(!Object.hasOwn(Wh,e))return;let n=Wh[e];return{request:gt(n.schema,{io:"input"}),guidance:n.guidance,examples:n.examples}}function Dl(e){return e==null?{types:Ei,request:gt(Mr),guidance:"Read a node type schema before creating or configuring it. Use $alias to reference a preceding node.add in the same batch. Read returns stable node references. Long code and prompt fields use text reads and edits. Changes use the observed baseRevision and a stable requestId."}:{type:e,onError:kl.some((n)=>n==e)?{enum:["stop","error"]}:!1,retry:kl.some((n)=>n==e)?gt(gn):!1,inputSources:["poll","integration"].includes(e)?["value","unset","default"]:["start","outputs","error","cron","webhook","value","condition"].includes(e)?[]:["value","unset","default","output","system","variable","sources"],extensibleInputs:["code","agent","llm","wait","approval"].includes(e),guidance:e=="webhook-response"?'Prepare an HTTP response using fixed inputs body (any JSON, default empty text), statusCode (number, default 200) and headers (scalar-valued object, default {}). Select this node in Webhook options.responseBody as {kind: "webhook-response", nodeId: "node reference", timeoutMs: 30000}. Its first completion responds immediately while the Run continues. It has no business outputs. Multiple response nodes are allowed; each Webhook selects one reachable node.':e=="outputs"?"Declare output fields through config.outputDefs. Set their values through node.add.inputs or input.set. Outputs is a singleton execution sink; it waits for its predecessors and produces workflow business outputs independently of node logs. No downstream edges or data references to Outputs are allowed.":e=="webhook"?'Use options.responseBody: {kind: "webhook-response", nodeId: "node ID or $alias", timeoutMs: 30000} to respond on the selected node\u2019s first completion while the Run continues. Body, statusCode and headers come exclusively from that node; clear workflow-output-only status/header references when switching. Alternatively configure options.responseBody as {kind: "workflow-outputs", output?: "top-level output name", timeoutMs?: 30000} to respond after the Run succeeds. Omit output for the complete object. Connect Webhook to Outputs. Timeout is 1000\u201360000 ms; HTTP timeout does not cancel the Run. Strings return text; other values return JSON. Only in this mode, options.responseStatusCodeOutput can select a numeric top-level workflow output as the HTTP status, overriding the preserved fixed responseStatusCode (default 200). Its runtime value must be an integer from 200 to 599, excluding 204, 205, 304; missing or invalid values return 500. Use responseHeaders for fixed text headers. In workflow-output mode, responseHeaderOutputs maps header names to top-level output names; values can be string, number or boolean and are converted to text. Alternatively responseHeadersSource: {kind: "workflow-outputs", output?: "object field"} replaces the entire header object (omit output for all outputs), preserving but ignoring per-header settings. Missing, null, complex or invalid header values return 500 without fallback. Header restrictions and Content-Type policy still apply. Omit responseBody for immediate responseData. Clear options.responseBody, options.responseStatusCodeOutput, options.responseHeadersSource and options.responseHeaderOutputs explicitly to switch back.':e=="start"?"Declare workflow inputs through config.inputDefs; read them in Start node details. REST calls and manual runs supply them as trigger.outputs. Downstream nodes bind these parameters as Start outputs. Start has no input sources or defaults; non-nullable parameters are required, and omitted nullable parameters become null.":e=="condition"?"Edit branch operands through config.branches. A branch can test one expression, all expressions, or any alternatives. Unmatched execution uses branch otherwise.":["poll","integration"].includes(e)?"Configure static parameters with node.add.inputs or input.set. Definitions come from the selected Trigger key; execution output and variable sources are unavailable.":e=="llm"?"Configure model settings, message templates and history as defaults. Input bindings with the same names override these defaults; named business inputs can be bound directly. Template strings interpolate {{name}}.":e=="openapi"?"Select an operation; the tool resolves its ports and authentication. Read authenticationChoices from node details. authentication is replaced as a complete choice. Bind advertised credentials through inputs.":e=="workflow"?"Select another workflow with config.flowId. A workflow cannot call itself, including in a disconnected node. Owned unpublished or unavailable targets may be saved as incomplete drafts. Use node.refresh to load the current published interface.":"Supply business configuration and input data. Fixed definitions are assembled by the tool. Existing constraints and defaults are preserved on partial updates.",example:{op:"node.add",as:"step",type:e,name:"Step",...{start:{config:{inputDefs:{}}},outputs:{config:{outputDefs:{}}},workflow:{config:{flowId:"<Flow ID>"}},connector:{config:{action:"<Action ID>",connectionId:"<Connection ID>"}},poll:{config:{key:"<Trigger key>",schedule:[{type:"every",unit:"minute",value:5}]}},integration:{config:{key:"<Trigger key>"}},openapi:{config:{sourceUrl:"https://example.com/openapi.json",path:"/items",method:"get"}},code:{code:"export default ({value}) => ({result:value})",inputs:{value:{kind:"value",value:"Hello"}}},condition:{config:{match:"first",branches:[{name:"yes",when:{left:{kind:"value",value:120},operator:">",right:{kind:"value",value:100}}}]}},value:{config:{values:{threshold:100,region:"EU"}}},webhook:{config:{method:"POST",body:{orderId:{schema:{type:"string"},nullable:!1}}}},wait:{prompt:"Continue processing this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},approval:{prompt:"Approve this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},llm:{config:{model:{model:"deepseek-v4-flash"},template:[{role:"user",content:"Summarize {{order}}."}]},inputs:{order:{kind:"value",value:{orderId:"A-1",total:42}}}},agent:{config:{model:"deepseek-v4-flash"},inputs:{orders:{kind:"value",value:[{orderId:"A-1",total:42}]}},prompt:"Summarize {{orders}}."}}[e]},configuration:gt(Sn[e].partial()),texts:e=="code"?["code"]:["agent","wait","approval"].includes(e)?["prompt"]:[]}}var Yh=O({code:z,message:R(),nodes:P(z),field:R().optional(),line:X().optional(),column:X().optional()}),Xh=O({flowId:z,revisionId:z,valid:me(),diagnostics:P(Yh),version:w(1)}),ey=O({flowId:z,saved:w(!0),revision:z,nodes:re(z,z),changes:P(O({index:we(),op:z,node:z.optional()})),validation:O({status:ee(["valid","invalid","unavailable"]),diagnostics:P(Yh).optional()}),version:w(1)}),ny=O({flowId:z,revision:z,data:O({nodes:P(re(R(),Xe)).optional(),edges:P(Xe).optional(),text:re(R(),Xe).optional()}),version:w(1)}),ty=O({flowId:z,revision:z,data:O({matches:P(O({node:z.optional(),field:z,line:we().optional(),excerpt:R()})),total:we(),nextOffset:we().optional()}),version:w(1)});var L={authenticationRequired:"authentication.required",authorizationDenied:"authorization.denied",bindingUnresolved:"binding.unresolved",connectorActionNotFound:"connector.action-not-found",connectorAccessConflict:"connector.access-conflict",connectorAccessInvalid:"connector.access-invalid",connectorAccessRequired:"connector.access-required",connectorAccessUnsupported:"connector.access-unsupported",connectorUnconfigured:"connector.unconfigured",connectorUnavailable:"connector.unavailable",connectorConsoleUnconfigured:"connector.console-unconfigured",engineUnavailable:"engine.unavailable",engineUnsupported:"engine.unsupported",eventSourceInvalid:"event-source.invalid",eventSourceIdentityUnavailable:"event-source.identity-unavailable",eventSourceNotFound:"event-source.not-found",eventSourceConflict:"event-source.conflict",flowInvalid:"flow.invalid",flowRepairRequired:"flow.repair-required",flowUpgradeRequired:"flow.upgrade-required",flowNotFound:"flow.not-found",flowBusy:"flow.busy",flowConflict:"flow.conflict",flowPresentationConflict:"flow.presentation-conflict",flowRevisionConflict:"flow.revision-conflict",liveConflict:"live.conflict",liveNotFound:"live.not-found",pageInvalidCursor:"page.invalid-cursor",publicationConflict:"publication.conflict",publicationNotFound:"publication.not-found",publicationUnsupported:"publication.unsupported",publishOperationNotFound:"publication.operation-not-found",routeNotFound:"route.not-found",runConflict:"run.conflict",runEventsExpired:"run.events-expired",runInvalid:"run.invalid",runNotFound:"run.not-found",runNotTerminal:"run.not-terminal",runOverloaded:"run.overloaded",runWaitNotFound:"run.wait-not-found",triggerKeyInvalid:"trigger-key.invalid",triggerKeyNotFound:"trigger-key.not-found",triggerNotFound:"trigger.not-found",variableInvalid:"variable.invalid",variableLimitReached:"variable.limit-reached",variableNotFound:"variable.not-found"},NS={[L.eventSourceInvalid]:{status:400},[L.eventSourceIdentityUnavailable]:{status:409},[L.eventSourceNotFound]:{status:404},[L.eventSourceConflict]:{status:409},[L.authenticationRequired]:{status:401},[L.authorizationDenied]:{status:403},[L.bindingUnresolved]:{status:409},[L.connectorActionNotFound]:{status:404},[L.connectorAccessConflict]:{status:412},[L.connectorAccessInvalid]:{status:409},[L.connectorAccessRequired]:{status:409},[L.connectorAccessUnsupported]:{status:409},[L.connectorUnconfigured]:{status:503},[L.connectorUnavailable]:{status:503},[L.connectorConsoleUnconfigured]:{status:503},[L.engineUnavailable]:{status:503},[L.engineUnsupported]:{status:409},[L.flowInvalid]:{status:400},[L.flowRepairRequired]:{status:409},[L.flowUpgradeRequired]:{status:409},[L.flowNotFound]:{status:404},[L.flowBusy]:{status:409},[L.flowConflict]:{status:409},[L.flowPresentationConflict]:{status:412},[L.flowRevisionConflict]:{status:412},[L.liveConflict]:{status:412},[L.liveNotFound]:{status:404},[L.pageInvalidCursor]:{status:400},[L.publicationConflict]:{status:409},[L.publicationNotFound]:{status:404},[L.publicationUnsupported]:{status:409},[L.publishOperationNotFound]:{status:404},[L.routeNotFound]:{status:404},[L.runConflict]:{status:409},[L.runEventsExpired]:{status:410},[L.runInvalid]:{status:400},[L.runNotFound]:{status:404},[L.runNotTerminal]:{status:409},[L.runOverloaded]:{status:429},[L.runWaitNotFound]:{status:404},[L.triggerKeyInvalid]:{status:409},[L.triggerKeyNotFound]:{status:404},[L.triggerNotFound]:{status:404},[L.variableInvalid]:{status:400},[L.variableLimitReached]:{status:409},[L.variableNotFound]:{status:404}};class Pe extends Error{constructor(e,n,t,r){super(t);this.code=n,this.details=r,this.name="ApiError",this.status=e}}class ry extends Pe{constructor(e){super(502,"response.invalid",`The Control API returned an invalid response.${e==null?"":` ${e}`}`);this.detail=e}}function p(e){throw new ry(e)}function v(e){if(e==null||typeof e!="object"||Array.isArray(e))return p("Expected an object.");return e}function f(e){return typeof e=="string"&&e.length>0?e:p("Expected a non-empty string.")}function G(e,n){let t=n.filter((r)=>!Object.hasOwn(e,r));if(t.length>0)p(`Missing fields: ${t.join(", ")}.`)}function en(e,n){let t=Object.keys(e);if(t.length!=n.length||t.some((r)=>!n.includes(r))){let r=n.filter((i)=>!Object.hasOwn(e,i)),o=t.filter((i)=>!n.includes(i));p([r.length>0?`Missing fields: ${r.join(", ")}.`:"",o.length>0?`Unexpected fields: ${o.join(", ")}.`:""].filter(Boolean).join(" "))}}function ce(e){return Number.isSafeInteger(e)?e:p("Expected a safe integer.")}function be(e){if(e===null||typeof e=="boolean"||typeof e=="string")return e;if(typeof e=="number"&&Number.isFinite(e))return e;if(Array.isArray(e))return e.map(be);let n=v(e);return Object.fromEntries(Object.entries(n).map(([t,r])=>[t,be(r)]))}function Ai(e){if(e==null)return;return f(e)}function Tt(e){let n=v(e),t=n.liveEnd==null?void 0:v(n.liveEnd);if(t!=null&&typeof t.enabled!="boolean")return p();let{operation:r,sourcePublicationId:o}=n;if(n.version!=1)return p();if(r!="publish"&&r!="rollback")return p();if(o!=null&&typeof o!="string")return p();return{...t==null?{}:{liveEnd:{enabled:t.enabled,endedAt:f(t.endedAt)}},actorId:f(n.actorId),closureDigest:f(n.closureDigest),createdAt:f(n.createdAt),engineContract:f(n.engineContract),flowId:f(n.flowId),modelVersion:ce(n.modelVersion),operation:r,publicationId:f(n.publicationId),sharedAccessDigest:f(n.sharedAccessDigest),revisionDigest:f(n.revisionDigest),revisionId:f(n.revisionId),...o==null?{}:{sourcePublicationId:o},version:1}}function Ll(e){let n=v(e),t=n.status,r={createdAt:f(n.createdAt),flowId:f(n.flowId),operationId:f(n.operationId),revisionId:f(n.revisionId),updatedAt:f(n.updatedAt),version:1};if(n.version!=1)return p();switch(t){case"pending":return G(n,["createdAt","flowId","operationId","revisionId","status","updatedAt","version"]),{...r,status:t};case"succeeded":return G(n,["createdAt","flowId","operationId","publicationId","revisionId","status","updatedAt","version"]),{...r,publicationId:f(n.publicationId),status:t};case"failed":{G(n,["createdAt","flowId","issue","operationId","revisionId","status","updatedAt","version"]);let o=v(n.issue),i=o.nodeId;return G(o,["code","message",...i==null?[]:["nodeId"]]),{...r,issue:{code:f(o.code),message:f(o.message),...i==null?{}:{nodeId:f(i)}},status:t}}default:return p()}}function Vl(e){let n=v(e),{status:t,publication:r}=n;if(n.version!=1||typeof n.hasUnpublishedChanges!="boolean")return p();if(t!="not-published"&&t!="runnable"&&t!="suspended")return p();if(t=="not-published"&&r!==null)return p();if(t!="not-published"&&r===null)return p();return{flowId:f(n.flowId),hasUnpublishedChanges:n.hasUnpublishedChanges,publication:r===null?null:Tt(r),revision:ce(n.revision),status:t,version:1}}function oy(e){let n=v(e),{nextCursor:t,total:r}=n;if(n.version!=1||!Array.isArray(n.publications))return p();if(t!=null&&typeof t!="string")return p();if(r!=null&&!Number.isSafeInteger(r))return p();return{...t==null?{}:{nextCursor:t},publications:n.publications.map(Tt),...r==null?{}:{total:r},version:1}}var iy=P(te([x({handle:R().min(1),description:R().optional(),jsonSchema:Te(),nullable:me(),value:Te().optional()}),x({group:R(),collapsed:me().optional()})]));function Ml(e){let n=v(e),t=n.type;if(t!="integration"&&t!="poll")return p();return{description:typeof n.description=="string"?n.description:p(),displayName:f(n.displayName),key:f(n.key),name:f(n.name),provider:f(n.provider),type:t}}function qr(e){let n=v(e),t=Ml(n),r={configInputs:iy.parse(n.configInputs),definitionVersion:n.definitionVersion===2?2:p(),description:t.description,displayName:t.displayName,key:t.key,name:t.name,outputs:(Array.isArray(n.outputs)?n.outputs:p()).map((l)=>{let u=v(l);return Object.assign({handle:f(u.handle),jsonSchema:be(u.jsonSchema),nullable:typeof u.nullable==="boolean"?u.nullable:p()},u.description==null?{}:{description:f(u.description)})}),provider:t.provider};if(t.type=="poll")return{...r,type:"poll"};let o=v(n.endpoint),i=v(o.body);if(!Array.isArray(o.methods)||!Array.isArray(i.formats)||typeof i.allowArray!="boolean"||typeof i.allowEmpty!="boolean")return p();let s=o.methods.map(f),a=i.formats.map(f),c=ce(o.successStatus);if(s.some((l)=>!["DELETE","GET","HEAD","PATCH","POST","PUT"].includes(l))||a.some((l)=>!["form","json","multipart","text"].includes(l))||c<200||c>299)return p();return{...r,endpoint:{body:{allowArray:i.allowArray,allowEmpty:i.allowEmpty,formats:a},methods:s,successStatus:c},type:"integration"}}var zS=new Set(["error","cron","integration","poll","webhook"]),DS=new Set(["failed","healthy","initializing","needs_reauth","suspended"]),LS=new Set(["delivery.failed","health.failed","health.needs_reauth","health.recovered","health.suspended","operator.paused","operator.resumed"]);function Fr(e){let n=v(e),t=n.health,r=n.listener==null?void 0:v(n.listener);if(r!=null&&r.health!="healthy"&&r.health!="failed"&&r.health!="needs_reauth")return p();let o=n.kind,i=ce(n.runtimeVersion);if(n.version!=1||typeof t!="string"||!DS.has(t))return p();if(typeof o!="string"||!zS.has(o))return p();if(i<=0)return p();return{...n.currentPublicationId==null?{}:{currentPublicationId:f(n.currentPublicationId)},...n.currentRevisionId==null?{}:{currentRevisionId:f(n.currentRevisionId)},...n.endpointUrl==null?{}:{endpointUrl:f(n.endpointUrl)},...r==null?{}:{listener:{health:r.health,...r.lastErrorCode==null?{}:{lastErrorCode:f(r.lastErrorCode)}}},flowId:f(n.flowId),health:t,kind:o,...n.lastErrorCode==null?{}:{lastErrorCode:f(n.lastErrorCode)},runtimeVersion:i,triggerNodeId:f(n.triggerNodeId),updatedAt:f(n.updatedAt),version:1}}function sy(e){let n=v(e);if(n.version!=1)return p();return{binding:Fr(n.binding),version:1}}function VS(e){let n=v(e),t=n.kind;if(typeof t!="string"||!LS.has(t))return p();let r=Ai(n.errorCode),o=Ai(n.errorMessage);if(o!=null&&o.length>512)return p();return{activityId:f(n.activityId),createdAt:f(n.createdAt),...r==null?{}:{errorCode:r},...o==null?{}:{errorMessage:o},kind:t}}function ay(e){let n=v(e),t=Ai(n.nextCursor);if(n.version!=1||!Array.isArray(n.activities))return p();return{activities:n.activities.map(VS),...t==null?{}:{nextCursor:t},version:1}}function cy(e){let n=v(e),t=ce(n.filtered);if(n.version!=1||!Array.isArray(n.events)||typeof n.hasMore!="boolean"||t<0)return p();return{events:n.events.map((r)=>{let o=v(r);return Object.fromEntries(Object.entries(o).map(([i,s])=>[i,be(s)]))}),filtered:t,hasMore:n.hasMore,version:1}}var et={nodeId:R().min(1),name:R(),description:R().optional()},Zr=pn().transform(Fr),ly={provider:R().min(1),inputs:re(R(),an("kind",[O({kind:w("value"),value:Te()}),O({kind:w("unset")})]))},qS=an("type",[O({...et,type:w("start"),config:Sn.start}),O({...et,type:w("manual"),config:O({})}),O({...et,type:w("webhook"),config:Sn.webhook,binding:Zr}),O({...et,type:w("cron"),config:Sn.cron,binding:Zr}),O({...et,type:w("error"),config:Sn.error,binding:Zr}),O({...et,...ly,type:w("poll"),config:Sn.poll,binding:Zr}),O({...et,...ly,type:w("integration"),config:Sn.integration,binding:Zr})]);function uy(e){let n=v(e),t=f(n.flowId);if(n.version!=1||!Array.isArray(n.entries))return p();if(n.publication===null){if(n.inputDefs!==null||n.status!="not-published"||n.entries.length!=0||Object.hasOwn(n,"enabled"))return p();return{flowId:t,inputDefs:null,publication:null,status:"not-published",entries:[],version:1}}let r=Tt(n.publication),o=n.status;if(r.flowId!=t||typeof n.enabled!="boolean")return p();if(o!="runnable"&&o!="suspended")return p();if(!n.enabled&&n.status=="runnable")return p();let i=Hh.safeParse(n.inputDefs);if(!i.success)return p();return{flowId:t,inputDefs:i.data,publication:r,status:o,enabled:n.enabled,entries:FS(n.entries,r),version:1}}function FS(e,n){let t=P(qS).safeParse(e);if(!t.success)return p();let r=new Set;for(let o of t.data){if(r.has(o.nodeId))return p();if(r.add(o.nodeId),o.type!="start"&&o.type!="manual"&&(o.binding.flowId!=n.flowId||o.binding.triggerNodeId!=o.nodeId||o.binding.kind!=o.type||o.binding.currentPublicationId!=n.publicationId||o.binding.currentRevisionId!=n.revisionId))return p();if(o.type=="webhook"&&(!o.binding.endpointUrl||!wi(o.config.method)&&Object.keys(o.config.body).length>0))return p()}return t.data}function Pi(e,n){if(!e||typeof e!="object"||!n||typeof n!="object")return{};let t=e,r=n;if(typeof t.version!="string"||![t.pixelRatio,t.iconSize,t.width,t.height].every((o)=>Number.isInteger(o)&&o>0)||![t.bleed,r.x,r.y].every((o)=>Number.isInteger(o)&&o>=0)||r.x+t.iconSize>t.width||r.y+t.iconSize>t.height)return{};try{for(let o of[t.lightUrl,t.darkUrl])if(typeof o!="string"||!["https:","http:","data:"].includes(new URL(o).protocol))return{}}catch{return{}}return{iconSprite:t,iconSpritePosition:{x:r.x,y:r.y}}}function dy(e){return e.kind=="source"&&e.source.kind=="binding"?{kind:"value"}:e}function py(e){return{...e,cases:e.cases.map((n)=>({...n,groups:n.groups.map((t)=>({...t,expressions:t.expressions.map((r)=>({...r,left:dy(r.left),...r.right==null?{}:{right:dy(r.right)}}))}))}))}}var Zl=80;function Ti(e){let n=e.trim();if(n.length==0)return"empty";if(n.length>Zl)return"tooLong";for(let t of n){let r=t.charCodeAt(0);if(r<=31||r>=127&&r<=159)return"controlCharacter"}if(!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(n))return"specialCharacter"}function my(e,n){let t=e=="jira.on_issue_event"||e=="intercom.on_conversation_event"||e=="sentry.on_issue_alert"||e=="zoom.on_recording_ready"||e=="fireflies.on_meeting_ready"?["sourceId","eventTypes"]:e=="slackbot.on_event"?["sourceId","eventTypes","channelIds"]:e=="feishu_app_bot.on_event"?["sourceId","eventTypes","resource","chatIds"]:e=="linear.on_issue_changed"?["teamId","stateIds"]:[];return{...n,...Object.fromEntries(t.map((r)=>[r,{kind:"unset"}]))}}function gy(e,n){return{...e,nodes:Object.fromEntries(Object.entries(e.nodes).map(([t,r])=>{if((r.kind=="poll"||r.kind=="integration")&&(n==null||r.connectionId==n)){let{connectionId:i,...s}=r;return[t,s]}if(r.kind!="task")return[t,r];if("executor"in r.task){let i=r.task.executor,s=(a)=>{if(a.connectionId==="")return a;if(n!=null&&a.connectionId!=n)return a;let{connectionId:c,...l}=a;return l};if(i.kind=="connector")return[t,{...r,task:{...r.task,executor:s(i)}}];if(i.kind=="agent")return[t,{...r,task:{...r.task,executor:{...i,tools:i.tools.map(s),...i.notification==null?{}:{notification:s(i.notification)}}}}];return[t,r]}let o=r.task.capabilities?.map((i)=>{if(!("mode"in i)){if("action"in i){let{connectionId:s,...a}=i;return{...a,connections:i.connections.filter((c)=>n!=null&&c.connectionId!=n),...s!=null&&n!=null&&s!=n?{connectionId:s}:{}}}return{...i,...n==null&&(i.connectionHints?.length??0)>0?{actionHints:[...new Set([...i.actionHints??[],...i.connectionHints.map((s)=>s.action)])]}:{},...i.connectionHints==null?{}:{connectionHints:i.connectionHints.filter((s)=>n!=null&&s.connectionId!=n)}}}if(i.mode!="independent")return i;return{...i,actions:i.actions.map((s)=>{if(s.connectionId==="")return s;if(n!=null&&s.connectionId!=n)return s;let{connectionId:a,...c}=s;return c})}});return[t,o==null?r:{...r,task:{...r.task,capabilities:o}}]}))}}var WS=x({kind:w("open-flow-workflow"),version:w(1),name:R().optional(),content:pn(),presentation:re(R(),Te()).optional()});function Ni(e){Hn(e,-1);let n=WS.parse(e);return{...n,content:Pt(n.content)}}function yy(e){return Ni(JSON.parse(e))}function hy(e){if(e.kind!="sources"||!e.sources.some((t)=>t.kind=="binding"))return e;let n=e.sources.filter((t)=>t.kind!="binding");return n.length==0?{kind:"unset"}:{kind:"sources",sources:n}}function GS(e){let n=Ni(e),t=n.content.document.graph,r=gy(t),o=Object.fromEntries(Object.entries(r.nodes).map(([i,s])=>{let a=s;if("inputs"in a)a={...a,inputs:Object.fromEntries(Object.entries(a.inputs).map(([c,l])=>[c,hy(l)]))};if(a.kind=="outputs")a={...a,outputMappings:Object.fromEntries(Object.entries(a.outputMappings).map(([c,l])=>[c,hy(l)]))};if(a.kind=="condition")a=py(a);if(a.kind=="error"&&a.sourceFlowIds!=null)a={...a,sourceFlowIds:[]};if(a.kind=="poll"||a.kind=="integration")a={...a,config:my(a.definition.key,a.config)};return[i,a]}));return{file:{...n,content:{...n.content,document:{...n.content.document,bindings:{},graph:{...r,nodes:o}}}},summary:{changedNodeIds:Object.keys(o).filter((i)=>!Ie(o[i],t.nodes[i])),removedBindings:Object.keys(n.content.document.bindings).length}}}function by(e){return`${JSON.stringify(GS(e).file,null,2)}
63
- `}function wy(e){return e.replace(/(?:\.openflow)?\.json$/i,"")}var QS=an("kind",[x({kind:w("admin-delegation")}),x({kind:w("policy"),ruleId:R().min(1).nullable()})]);function zi(e){return QS.parse(e)}function ky(e){let n=v(e);if(!Array.isArray(n.bots))return p("Leina bots: expected an array.");let t=n.bots.map((r)=>{let o=v(r);if(!Array.isArray(o.platforms))return p("Leina platforms: expected an array.");return{leinaId:f(o.leinaId),name:f(o.name),status:f(o.status),platforms:o.platforms.map(f)}});if(new Set(t.map((r)=>r.leinaId)).size!=t.length)return p("Leina bots: duplicate identifiers.");return t}function YS(e){let n=v(e);if(en(n,["actionIds","allActions","triggerIds","allTriggers","configured","proxy"]),!Array.isArray(n.actionIds))return p("permissions.actionIds: expected an array.");if(!Array.isArray(n.triggerIds))return p("permissions.triggerIds: expected an array.");if(typeof n.allActions!="boolean")return p("permissions.allActions: expected a boolean.");if(typeof n.allTriggers!="boolean")return p("permissions.allTriggers: expected a boolean.");if(typeof n.configured!="boolean")return p("permissions.configured: expected a boolean.");if(typeof n.proxy!="boolean")return p("permissions.proxy: expected a boolean.");let t=n.actionIds.map(f),r=n.triggerIds.map(f);if(new Set(t).size!=t.length)return p("permissions.actionIds: duplicate IDs.");if(n.allActions&&t.length!=0)return p("permissions.actionIds: must be empty when allActions is true.");if(new Set(r).size!=r.length)return p("permissions.triggerIds: duplicate IDs.");if(n.allTriggers&&r.length!=0)return p("permissions.triggerIds: must be empty when allTriggers is true.");if(n.proxy&&(!n.allActions||!n.allTriggers||n.configured))return p("permissions.proxy: requires allActions=true, allTriggers=true and configured=false.");return{actionIds:t,triggerIds:r,allTriggers:n.allTriggers,allActions:n.allActions,configured:n.configured,proxy:n.proxy}}function Sy(e,n){let t=v(e),{policyRevision:r,status:o,isDefault:i}=t,s=Object.hasOwn(t,"displayName")&&!Object.hasOwn(t,"connectionDisplayName"),a=n&&Object.hasOwn(t,"permissions")?YS(t.permissions):void 0,c=t.permissionGroupName;if(en(t,["accessBindingId","connectionId","source",s?"displayName":"connectionDisplayName",...n&&Object.hasOwn(t,"isDefault")?["isDefault"]:[],...n&&a!=null?["permissions"]:[],...Object.hasOwn(t,"permissionGroupName")?["permissionGroupName"]:[],...r==null?[]:["policyRevision"],"providerId",...n?[]:["status"]]),r!=null&&typeof r!="string")return p("policyRevision: expected a string.");if(n&&i!==void 0&&typeof i!="boolean")return p("isDefault: expected a boolean.");if(c!==void 0&&c!==null&&typeof c!="string")return p("permissionGroupName: expected a string or null.");if(!n&&o!="active"&&o!="forbidden"&&o!="invalid"&&o!="missing")return p();let l;try{l=zi(t.source)}catch{return p("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.")}return{accessBindingId:f(t.accessBindingId),connectionId:f(t.connectionId),source:l,connectionDisplayName:f(s?t.displayName:t.connectionDisplayName),...n&&typeof i=="boolean"?{isDefault:i}:{},...a==null?{}:{permissions:a},...c===void 0?{}:{permissionGroupName:c},...r==null?{}:{policyRevision:r},providerId:f(t.providerId),...n?{}:{status:o}}}function Ul(e){if(e!="implicit"&&e!="selectable")return p("mode: expected implicit or selectable.");return e}function Nt(e){let n=v(e);en(n,["accessRevision","bindings","mode","sharedAccessDigest",..."providerIds"in n?["providerIds"]:[],..."discardedBindingCount"in n?["discardedBindingCount"]:[],"version"]);let t=ce(n.accessRevision);if(n.version!=1||t<0||!Array.isArray(n.bindings))return p();if("providerIds"in n&&!Array.isArray(n.providerIds))return p();let r=n.providerIds==null?void 0:n.providerIds.map((s)=>f(s));if(r!=null&&new Set(r).size!=r.length)return p();let o=n.discardedBindingCount==null?0:ce(n.discardedBindingCount);if(o<0)return p();let i=[];for(let s of n.bindings)try{i.push(Sy(s,!1))}catch(a){if(!(a instanceof Pe)||a.code!="response.invalid")throw a;if(s!=null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.accessBindingId=="string"&&s.accessBindingId.length>0&&typeof s.providerId=="string"&&s.providerId.length>0)i.push({accessBindingId:s.accessBindingId,providerId:s.providerId,connectionId:null,source:null,status:"invalid",connectionDisplayName:typeof s.connectionDisplayName=="string"&&s.connectionDisplayName.length>0?s.connectionDisplayName:typeof s.displayName=="string"&&s.displayName.length>0?s.displayName:s.providerId,permissionGroupName:typeof s.permissionGroupName=="string"?s.permissionGroupName:null});else o++}if(new Set(i.map((s)=>s.accessBindingId)).size!=i.length)return p();return{accessRevision:t,...o==0?{}:{discardedBindingCount:o},...r==null?{}:{providerIds:r},bindings:i,mode:Ul(n.mode),sharedAccessDigest:f(n.sharedAccessDigest),version:1}}function vy(e){if(!Array.isArray(e))return p();let n=e.map((t)=>{let r=v(t);en(r,["accessBindingId","connectionId","providerId","source","connectionDisplayName",..."permissionGroupName"in r?["permissionGroupName"]:[]]);let o;try{o=zi(r.source)}catch{return p()}if(r.permissionGroupName!=null&&typeof r.permissionGroupName!="string")return p();return{accessBindingId:f(r.accessBindingId),connectionId:f(r.connectionId),providerId:f(r.providerId),source:o,connectionDisplayName:f(r.connectionDisplayName),..."permissionGroupName"in r?{permissionGroupName:r.permissionGroupName}:{}}});if(new Set(n.map((t)=>t.accessBindingId)).size!=n.length)return p();return n}function Bl(e){let n=v(e);if(en(n,["mode","sharedAccessDigest","sharedBindings","selectedBindings","version"]),n.version!=2)return p();let t=Ul(n.mode),r=vy(n.sharedBindings),o=vy(n.selectedBindings);if(t=="implicit"&&(r.length>0||o.length>0))return p();return{mode:t,sharedAccessDigest:f(n.sharedAccessDigest),sharedBindings:r,selectedBindings:o,version:2}}function XS(e,n){let t=v(e);if(en(t,["candidates","mode","providerId","version"]),t.version!=1)return p("version: expected 1.");if(f(t.providerId)!=n)return p("providerId: does not match the requested provider.");if(!Array.isArray(t.candidates))return p("candidates: expected an array.");let r=t.candidates.map((o)=>Sy(o,!0));if(r.some((o)=>o.providerId!=n))return p("candidates[].providerId: does not match the requested provider.");if(new Set(r.map((o)=>o.accessBindingId)).size!=r.length)return p("candidates[].accessBindingId: duplicate IDs.");return{candidates:r,mode:Ul(t.mode),providerId:n,version:1}}function Iy(e,n){let t=v(e);if(en(t,["results","version"]),t.version!=1)return p("version: expected 1.");if(!Array.isArray(t.results))return p("results: expected an array.");let r=new Set(n),o=t.results.map((i)=>{let s=v(i),a=f(s.providerId);if(!r.delete(a))return p("results[].providerId: duplicate or unrequested provider.");if(!Object.hasOwn(s,"error"))return XS(s,a);en(s,["providerId","error"]);let c=v(s.error);return en(c,["code","message"]),{providerId:a,error:{code:f(c.code),message:f(c.message)}}});if(r.size!=0)return p("results: missing requested providers.");return{results:o,version:1}}function zt(e){let n=v(e);if(G(n,[...Object.hasOwn(n,"providerAccountId")?["providerAccountId"]:[],...Object.hasOwn(n,"alias")?["alias"]:[],...Object.hasOwn(n,"builtInAccount")?["builtInAccount"]:[],"connectionId","displayName","isDefault","serviceId","status"]),n.builtInAccount!==void 0&&typeof n.builtInAccount!="boolean")return p();let t=n.status;if(t!="active"&&t!="disconnected"&&t!="error"&&t!="reauth_required")return p();if(typeof n.isDefault!="boolean")return p();return{...n.providerAccountId===void 0?{}:{providerAccountId:f(n.providerAccountId)},...n.alias===void 0?{}:{alias:f(n.alias)},...n.builtInAccount===void 0?{}:{builtInAccount:n.builtInAccount},connectionId:f(n.connectionId),displayName:f(n.displayName),isDefault:n.isDefault,serviceId:f(n.serviceId),status:t}}function Cy(e,n=!1){let t=v(e),r=t.description,o=n&&Object.hasOwn(t,"value");if(G(t,["jsonSchema","nullable",...r==null?[]:["description"],...o?["value"]:[]]),r!=null&&typeof r!="string")return p();if(typeof t.nullable!="boolean")return p();return{...r==null?{}:{description:r},jsonSchema:be(t.jsonSchema),nullable:t.nullable,...o?{value:be(t.value)}:{}}}function eI(e){return Cy(e,!0)}function xy(e,n){return Object.fromEntries(Object.entries(v(e)).map(([t,r])=>[t,n(r)]))}function nI(e){let n=v(e),{homepageUrl:t,icon:r}=n;if(G(n,["actionId",...Object.hasOwn(n,"operationType")?["operationType"]:[],...Object.hasOwn(n,"inputSchema")?["inputSchema"]:[],...Object.hasOwn(n,"outputSchema")?["outputSchema"]:[],"authenticated","description",...t==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in n?["iconSprite"]:[],..."iconSpritePosition"in n?["iconSpritePosition"]:[],"inputs","name","outputs","serviceId","serviceName"]),t!=null&&typeof t!="string"||r!=null&&typeof r!="string")return p();return{...n.inputSchema===void 0?{}:{inputSchema:be(n.inputSchema)},...n.outputSchema===void 0?{}:{outputSchema:be(n.outputSchema)},actionId:f(n.actionId),...n.operationType==null?{}:{operationType:f(n.operationType)},authenticated:typeof n.authenticated=="boolean"?n.authenticated:p(),description:typeof n.description=="string"?n.description:p(),...t==null?{}:{homepageUrl:t},...r==null?{}:{icon:r},...Pi(n.iconSprite,n.iconSpritePosition),inputs:xy(n.inputs,eI),name:f(n.name),outputs:xy(n.outputs,Cy),serviceId:f(n.serviceId),serviceName:f(n.serviceName)}}function Di(e){let{defaultConnection:n,...t}=v(e),r=nI(t);if(n==null)return r;let o=zt(n);if(o.serviceId!=r.serviceId||o.status!="active")return p();return{...r,defaultConnection:o}}function Oy(e){let n=v(e),{homepageUrl:t,icon:r}=n;if(n.noSetup!==void 0&&typeof n.noSetup!="boolean")return p();if(G(n,[...Object.hasOwn(n,"noSetup")?["noSetup"]:[],"serviceId","serviceName",...t==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in n?["iconSprite"]:[],..."iconSpritePosition"in n?["iconSpritePosition"]:[]]),t!=null&&typeof t!="string"||r!=null&&typeof r!="string")return p();return{...t==null?{}:{homepageUrl:t},...r==null?{}:{icon:r},...Pi(n.iconSprite,n.iconSpritePosition),serviceId:f(n.serviceId),serviceName:f(n.serviceName),...n.noSetup===void 0?{}:{noSetup:n.noSetup}}}function Kl(e){return{actionId:e.actionId,authenticated:e.authenticated,...e.defaultConnection==null?{}:{defaultConnection:{connectionId:e.defaultConnection.connectionId,displayName:e.defaultConnection.displayName,status:e.defaultConnection.status}},description:e.description,name:e.name,serviceId:e.serviceId,serviceName:e.serviceName}}var nn=R().min(1).max(256),oI=R().regex(/^[a-z][a-z0-9_.:]{0,127}$/),iI=R().trim().min(1).max(128),Wl=O({version:w(1),sourceId:nn,revision:we().positive(),name:iI,provider:ee(["feishu","feishu_app_bot","slackbot","intercom","sentry","zoom","fireflies","jira"]),appId:nn.nullable(),workspaceId:nn.optional(),installationId:nn.optional(),organizationId:nn.optional(),projectId:nn.optional(),projectKey:nn.optional(),subscriptionStatus:ee(["idle","pending","ready","error"]).optional(),lastError:R().optional(),signingSecretConfigured:me().optional(),connectionId:nn,teamId:nn.nullable(),enabled:me(),eventTypes:P(oI),manageSubscriptions:me().nullable(),verificationTokenConfigured:me().nullable(),encryptKeyConfigured:me().nullable(),endpointUrl:R().nullable(),verifiedAt:R().nullable(),lastReceivedAt:R().nullable(),updatedAt:R(),consumers:P(O({flowId:nn,flowName:R(),triggerNodeId:nn}))}),UP=Wl.pick({appId:!0,workspaceId:!0,installationId:!0,organizationId:!0,projectId:!0,projectKey:!0,subscriptionStatus:!0,lastError:!0,signingSecretConfigured:!0,manageSubscriptions:!0,verificationTokenConfigured:!0,encryptKeyConfigured:!0,verifiedAt:!0});function Li(e){return Wl.parse(e)}function Gl(e){return O({version:w(1),sources:P(Wl),teamId:nn.nullable().optional()}).parse(e)}function Hl(e){let n=v(e);if(G(n,["version","locale","definitions","display"]),n.version!=3||!Ou(n.locale)||!Array.isArray(n.definitions))return p();let t=n.definitions.map(qr),r=v(n.display),o=new Set(t.map((s)=>s.key));if(o.size!=t.length||Object.keys(r).length!=o.size)return p();let i=Object.fromEntries(t.map((s)=>{let{key:a}=s,c=v(r[a]);return G(c,["configInputs","configInputLabels","displayName","description","outputs"]),[a,{configInputs:_y(c.configInputs,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),configInputLabels:sI(c.configInputLabels,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),displayName:f(c.displayName),description:f(c.description),outputs:_y(c.outputs,s.outputs.map((l)=>l.handle))}]}));return{version:3,locale:n.locale,definitions:t,display:i}}function _y(e,n){let t=v(e);return en(t,n),Object.fromEntries(Object.entries(t).map(([r,o])=>[r,f(o)]))}function sI(e,n){let t=v(e);if(Object.keys(t).some((r)=>!n.includes(r)))return p();return Object.fromEntries(Object.entries(t).map(([r,o])=>{let i=f(o);return i.trim().length==0?p():[r,i]}))}function Ql(e,n){if(n==null)return e;let t=n.toLowerCase();return e.filter((r)=>[r.description,r.displayName,r.key,r.name,r.provider,r.type].some((o)=>o.toLowerCase().includes(t)))}var aI=x({pointer:R().max(4096).default(""),offset:X().int().nonnegative().default(0),limit:X().int().min(1).max(100).default(20),maxBytes:X().int().min(1).max(1048576).default(15000)});var cI=Te(),jy=O({pointer:R(),type:ee(["object","array","string","number","boolean","null"]),length:X().int().nonnegative().optional(),complete:me(),value:cI.optional()}),lI=jy.extend({offset:X().int().nonnegative(),nextOffset:X().int().positive().optional(),entries:P(jy).optional()}),Ry=O({resultId:R().min(1),callId:R().min(1),toolId:R().min(1),source:an("kind",[O({kind:w("connector"),action:R().min(1)}),O({kind:w("code")})]),bytes:X().int().nonnegative(),digest:R().regex(/^[a-f0-9]{64}$/),createdAt:R().datetime()}),uI=O({version:w(1),runId:R(),results:P(Ry),nextAfter:R().optional()}),dI=O({version:w(1),runId:R(),result:Ry,page:lI});function Yl(e){return uI.parse(e)}function Xl(e){return dI.parse(e)}function Ay(e){if(!Array.isArray(e))return p();return e.map((n)=>typeof n=="string"||Number.isSafeInteger(n)?n:p())}function pI(e){let n=v(e),t=f(n.kind);if(t=="artifact"||t=="binary"||t=="nullable")return{kind:t};if(t=="schema")return{kind:t,path:n.path==null?void 0:Ay(n.path)};if(t!="keyword"||typeof n.keyword!="string"||!yi(n.keyword))return p();return{kind:t,keyword:n.keyword,path:Ay(n.path),source:n.source===void 0?void 0:be(n.source),target:n.target===void 0?void 0:be(n.target)}}function fI(e){let n=v(e),t=n.values==null?void 0:v(n.values);return{code:f(n.code),column:ce(n.column),...n.fields===void 0?{}:{fields:Array.isArray(n.fields)?n.fields.map(f):p()},line:ce(n.line),message:f(n.message),mismatch:n.mismatch==null?void 0:pI(n.mismatch),path:typeof n.path=="string"?n.path:p(),...t==null?{}:{values:Object.fromEntries(Object.entries(t).map(([r,o])=>[r,typeof o=="string"||typeof o=="number"?o:p()]))}}}function Py(e){let n=v(e);if(n.version!=1||typeof n.valid!="boolean"||!Array.isArray(n.diagnostics))return p();return{closureDigest:f(n.closureDigest),diagnostics:n.diagnostics.map(fI),engineContract:f(n.engineContract),flowId:f(n.flowId),modelVersion:ce(n.modelVersion),revisionDigest:f(n.revisionDigest),revisionId:f(n.revisionId),valid:n.valid,version:1}}var $y=(e)=>e==null?"":`?flowId=${encodeURIComponent(e)}`;function Ty(e,n){let t=new URLSearchParams({...e==null?{}:{flowId:e},...n==null?{}:{locale:n}}).toString();return{path:`/v1/connector/providers${t?`?${t}`:""}`,decode:(r)=>{let o=v(r);if(G(o,["providers","version"]),o.version!=1||!Array.isArray(o.providers))return p();return o.providers.map(Oy)}}}function Ny(e,n,t){let r=new URLSearchParams({...n==null?{}:{flowId:n},...t==null?{}:{locale:t}}).toString();return{path:`/v1/connector/actions/${encodeURIComponent(e)}${r?`?${r}`:""}`,decode:(o)=>{let i=v(o);if(G(i,["action","version"]),i.version!=1)return p();return Di(i.action)}}}function zy(e){return{path:`/v1/connector/connections${$y(e)}`,decode:(n)=>{let t=v(n);if(G(t,["connections","version"]),t.version!=1||!Array.isArray(t.connections))return p();return t.connections.map(zt)}}}function Dy(e,n){return{path:`/v1/connector/connections/${encodeURIComponent(e)}${$y(n)}`,decode:(t)=>{let r=v(t);if(G(r,["connections","serviceId","version"]),r.version!=1||f(r.serviceId)!=e||!Array.isArray(r.connections))return p();return r.connections.map(zt)}}}function Vi(e){return Array.isArray(e)?e.map(f):p()}function mI(e){let n=v(e),t=n.draft===null?null:v(n.draft),r=v(n.sharedAccess);if(t!=null&&!Array.isArray(t.connections))return p();if(!Array.isArray(r.bindings))return p();let o=ce(r.accessRevision);if(o<0)return p();return{draft:t==null?null:{...t.calledFlowIds===void 0?{}:{calledFlowIds:Vi(t.calledFlowIds)},variableNames:Vi(t.variableNames),errorSourceFlowIds:Vi(t.errorSourceFlowIds),connections:t.connections.map((i)=>{let s=v(i);return{providerId:f(s.providerId),connectionId:f(s.connectionId)}})},sharedAccess:{accessRevision:o,providerIds:Vi(r.providerIds),bindings:r.bindings.map((i)=>{let s=v(i);return{providerId:f(s.providerId),connectionId:s.connectionId===null?null:f(s.connectionId),accessBindingId:f(s.accessBindingId)}})}}}function In(e){let n=v(e),t=n.status;if(n.version!=1)return p();if(t!="active"&&t!="retiring")return p();let r=n.live==null?void 0:v(n.live);if(r!=null&&(typeof r.enabled!="boolean"||typeof r.hasStart!="boolean"))return p();return{...r==null?{}:{live:{enabled:r.enabled,hasStart:r.hasStart,publicationId:f(r.publicationId),revisionId:f(r.revisionId)}},createdAt:f(n.createdAt),...n.connectorTeamId==null?{}:{connectorTeamId:f(n.connectorTeamId)},draftRevisionId:f(n.draftRevisionId),resourceReferences:mI(n.resourceReferences),flowId:f(n.flowId),name:f(n.name),status:t,updatedAt:f(n.updatedAt),version:1}}function gI(e){let n=v(e),t=ce(n.referenceCount);if(t<0)return p();return{...In(n),referenceCount:t}}function Ly(e){let n=v(e);if(n.version!=1||!Array.isArray(n.flows))return p();let{nextCursor:t,total:r}=n;if(t!=null&&typeof t!="string")return p();if(r!=null&&!Number.isSafeInteger(r))return p();return{...t==null?{}:{nextCursor:t},flows:n.flows.map(gI),...r==null?{}:{total:r},version:1}}function Mi(e){let n=v(e);if(G(n,["name","updatedAt","value","version"]),n.version!=1||typeof n.value!="string")return p();let t=f(n.updatedAt);try{if(new Date(t).toISOString()!=t)return p()}catch{return p()}return{name:f(n.name),updatedAt:t,value:n.value,version:1}}function Vy(e){let n=v(e),{referenceCount:t,...r}=n,o=ce(t);if(o<0)return p();return{...Mi(r),referenceCount:o}}function My(e){let n=v(e);if(typeof n.enabled!="boolean")return p();return{flowId:f(n.flowId),flowName:f(n.flowName),nodeId:f(n.nodeId),nodeName:f(n.nodeName),enabled:n.enabled}}function qy(e){let n=v(e);if(G(n,["version","references"]),n.version!=1||!Array.isArray(n.references))return p();return{version:1,references:n.references.map((t)=>{let r=v(t);if(G(r,["flowId","flowName","draft","live"]),typeof r.draft!="boolean")return p();let o=r.live===null?null:v(r.live);if(o!=null){if(G(o,["publicationId","enabled"]),typeof o.enabled!="boolean")return p()}return{flowId:f(r.flowId),flowName:f(r.flowName),draft:r.draft,live:o==null?null:{publicationId:f(o.publicationId),enabled:o.enabled}}})}}function Fy(e){let n=v(e),t=n.parentRevisionId;if(n.version!=1||t!==null&&typeof t!="string")return p();return{actorId:f(n.actorId),createdAt:f(n.createdAt),digest:f(n.digest),flowId:f(n.flowId),modelVersion:ce(n.modelVersion),parentRevisionId:t,revisionId:f(n.revisionId),version:1}}function Jr(e){let n=v(e);try{return{...Fy(n),content:Pt(n.content)}}catch{return p()}}function qi(e){let n=v(e);if(n.version!=1||ce(n.revision)<1)return p();return{revision:ce(n.revision),updatedAt:f(n.updatedAt),value:Object.fromEntries(Object.entries(v(n.value)).map(([t,r])=>[t,be(r)])),version:1}}function Ur(e){let n=v(e);if(n.version!=1)return p();return{revision:Fy(n.revision),version:1}}function Zy(e){let n=v(e);if(n.version!=1||n.kind!="snapshot")return p();return{draft:Jr(n.draft),kind:"snapshot",version:1}}var hI=["canceled","completed","failed","indeterminate"],Fi=[...hI,"queued","running","starting","waiting"];var yI=new Set(Fi);function Zi(e){return typeof e=="string"&&yI.has(e)?e:p()}function By(e){let n=v(e),{source:t,startedAt:r,finishedAt:o}=n;if(n.version!=1||t!="draft"&&t!="live")return p();if(r!=null&&typeof r!="string")return p();if(o!=null&&typeof o!="string")return p();return{createdAt:f(n.createdAt),...o==null?{}:{finishedAt:o},flowId:f(n.flowId),revisionId:f(n.revisionId),runId:f(n.runId),source:t,...r==null?{}:{startedAt:r},status:Zi(n.status),version:1}}function bI(e){let n=v(e);G(n,["actions","expiresAt","nodeId","prompt","waitId","waitingSince"]);let t=n.actions;if(!Array.isArray(t)||!(t.length==1&&t[0]=="continue"||t.length==2&&t[0]=="approve"&&t[1]=="reject"))return p();return{actions:t,...n.autoContinueAt===void 0?{}:{autoContinueAt:f(n.autoContinueAt)},expiresAt:f(n.expiresAt),nodeId:f(n.nodeId),prompt:f(n.prompt),waitId:f(n.waitId),waitingSince:f(n.waitingSince)}}function Jy(e){let n=v(e);return{flowId:f(n.flowId),runId:f(n.runId),nodeId:f(n.nodeId),executionId:f(n.executionId)}}function wI(e){let n=v(e);if(!["workbench","cli","mcp","api","trigger","workflow"].includes(n.channel))return p();return{channel:n.channel,...n.actorId===void 0?{}:{actorId:f(n.actorId)}}}function Ji(e){let n=v(e),t=By(n),r=n.eventsExpiresAt;if(r!=null&&typeof r!="string")return p();if(n.waiting!==void 0||!Array.isArray(n.waits))return p();let o=n.waits.map(bI);if(new Set(o.map((a)=>a.waitId)).size!=o.length||t.status=="waiting"&&o.length==0&&(!Array.isArray(n.calls)||n.calls.length==0)||["completed","failed","canceled","indeterminate"].includes(t.status)&&o.length>0)return p();if(n.occurrenceId!==void 0&&n.triggerNodeId===void 0)return p();let i={status:t.status,waits:o};if(n.calls!==void 0&&!Array.isArray(n.calls))return p();let s={...t,...n.initiator===void 0?{}:{initiator:wI(n.initiator)},...vI(n),...n.triggerNodeId===void 0?{}:{triggerNodeId:f(n.triggerNodeId)},...n.caller===void 0?{}:{caller:Jy(n.caller)},...n.calls===void 0?{}:{calls:n.calls.map((a)=>Object.assign(Jy(a),{status:v(a).status===null?null:Zi(v(a).status)}))},closureDigest:f(n.closureDigest),engineContract:f(n.engineContract),engineDigest:f(n.engineDigest),...r==null?{}:{eventsExpiresAt:r},modelVersion:ce(n.modelVersion),sharedAccessDigest:f(n.sharedAccessDigest),revisionDigest:f(n.revisionDigest),...i};switch(t.source){case"draft":return{...s,source:"draft"};case"live":return{...s,publicationId:f(n.publicationId),source:"live",...n.occurrenceId===void 0?{}:{occurrenceId:f(n.occurrenceId),triggerNodeId:f(n.triggerNodeId)}}}}function Ky(e){let n=v(e),t=n.nextCursor;if(n.version!=1||!Array.isArray(n.runs))return p();if(t!=null&&typeof t!="string")return p();return{flowId:f(n.flowId),...t==null?{}:{nextCursor:t},runs:n.runs.map(By),version:1}}function Wy(e){let n=v(e),t=Zi(n.status);if(n.version!=1||typeof n.cancelAccepted!="boolean"||t=="queued"||t=="starting"||t=="running"||t=="waiting")return p();return{cancelAccepted:n.cancelAccepted,runId:f(n.runId),status:t,version:1}}function Gy(e){let n=v(e);G(n,["action","comment","resolutionAccepted","resolvedAt","runId","status","version","waitId"]);let{action:t,resolvedAt:r}=n;if(n.version!=1||typeof n.resolutionAccepted!="boolean"||n.comment!==null&&typeof n.comment!="string"||t!==null&&t!="approve"&&t!="continue"&&t!="reject"||r!==null&&typeof r!="string"||t===null!=(r===null)||n.resolutionAccepted&&t===null)return p();return{action:t,comment:n.comment,resolutionAccepted:n.resolutionAccepted,resolvedAt:r,runId:f(n.runId),status:Zi(n.status),version:1,waitId:f(n.waitId)}}function Hy(e){let n=v(e),t=n.status;if(n.version!=1)return p();let r={finishedAt:f(n.finishedAt),runId:f(n.runId),version:1};if(t=="completed"){if(!Object.hasOwn(n,"result"))return p();return{...r,result:n.result,status:"completed"}}if(t=="canceled")return{...r,status:"canceled"};if(t=="failed"){let o=v(n.error);return{...r,error:Uy(o),status:"failed"}}if(t=="indeterminate"){let o=v(n.error);return{...r,error:Uy(o),status:"indeterminate"}}return p()}function vI(e){let n=e.errorSource==null?void 0:v(e.errorSource);if(e.errorDispatches!=null&&!Array.isArray(e.errorDispatches))return p();return{...n==null?{}:{errorSource:{flowId:f(n.flowId),runId:f(n.runId)}},...e.errorDispatches==null?{}:{errorDispatches:e.errorDispatches.map((t)=>{let r=v(t),o=f(r.flowId);switch(r.status){case"pending":return{status:"pending",flowId:o};case"dispatched":return{status:"dispatched",flowId:o,runId:f(r.runId)};case"failed":return{status:"failed",flowId:o,message:f(r.message)};default:return p()}})}}}function Uy(e){return{code:f(e.code),message:f(e.message),...e.nodeId===void 0?{}:{nodeId:f(e.nodeId)},...e.jobId===void 0?{}:{jobId:f(e.jobId)},...e.path===void 0?{}:{path:(Array.isArray(e.path)?e.path:p()).map(f)}}}function Ui(){let e=globalThis.crypto;if(e!=null){try{if(typeof e.randomUUID=="function")return e.randomUUID()}catch{}if(typeof e.getRandomValues=="function"){let n=e.getRandomValues(new Uint8Array(16));n[6]=(n[6]??0)&15|64,n[8]=(n[8]??0)&63|128;let t=Array.from(n,(r)=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function Yy(e){return e?.kind=="run.completed"||e?.kind=="run.failed"||e?.kind=="run.canceled"||e?.kind=="run.indeterminate"}function xI(e){let n=v(e),t=ce(n.sequence);if(t<0)return p();let r={createdAt:f(n.createdAt),sequence:t},o=v(n.payload),i=n.kind;switch(i){case"run.queued":return{...r,kind:i,payload:{}};case"run.started":return{...r,kind:i,payload:{flowId:f(o.flowId),scopeId:f(o.scopeId),...o.parentScopeId===void 0?{}:{parentScopeId:f(o.parentScopeId)}}};case"run.progress":return{...r,kind:i,payload:{flowId:f(o.flowId),scopeId:f(o.scopeId),progress:Qy(o.progress)}};case"run.waiting":if(!Array.isArray(o.waitIds))return p();return{...r,kind:i,payload:{waitIds:o.waitIds.map((s)=>f(s))}};case"wait.created":{let s=o.autoContinueAt===void 0?{}:{autoContinueAt:f(o.autoContinueAt)};return{...r,kind:i,payload:{...s,expiresAt:f(o.expiresAt),nodeId:f(o.nodeId),waitId:f(o.waitId),waitingSince:f(o.waitingSince)}}}case"run.resolved":{let{action:s,source:a}=o;if(a!==void 0&&a!=="manual"&&a!=="automatic")return p();let c=a===void 0?{}:{source:a};if(s!=="approve"&&s!=="continue"&&s!=="reject")return p();if(o.comment!==null&&typeof o.comment!="string")return p();return{...r,kind:i,payload:{...c,action:s,comment:o.comment,resolvedAt:f(o.resolvedAt),waitId:f(o.waitId)}}}case"run.completed":case"run.canceled":case"run.failed":case"run.indeterminate":return{...r,kind:i,payload:{result:be(o.result)}};case"run.events-truncated":return{...r,kind:i,payload:Object.fromEntries(Object.entries(o).map(([s,a])=>[s,be(a)]))};case"node.started":case"node.completed":case"node.failed":case"node.log":case"node.progress":case"node.artifact":{let s={flowId:f(o.flowId),scopeId:f(o.scopeId),nodeId:f(o.nodeId),executionId:f(o.executionId)};switch(i){case"node.started":{let a=o.nodeKind;if(a!==void 0&&a!=="approval"&&a!=="condition"&&a!=="connector"&&a!=="javascript"&&a!=="decision"&&a!=="openapi"&&a!=="llm"&&a!=="agent"&&a!=="value"&&a!=="outputs"&&a!=="webhook-response"&&a!=="workflow"&&a!=="wait")return p();return{...r,kind:i,payload:{...s,...a===void 0?{}:{nodeKind:a},...o.nodeTitle===void 0?{}:{nodeTitle:f(o.nodeTitle)},...o.operation===void 0?{}:{operation:f(o.operation)}}}}case"node.completed":return{...r,kind:i,payload:{...s,...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(v(o.systemOutputs)).map(([a,c])=>[a,be(c)]))},outputs:Object.fromEntries(Object.entries(v(o.outputs)).map(([a,c])=>[a,be(c)]))}};case"node.failed":{let a=v(o.error);return{...r,kind:i,payload:{...s,...o.handled===!0?{handled:!0}:{},...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(v(o.systemOutputs)).map(([c,l])=>[c,be(l)]))},error:{code:f(a.code),message:f(a.message)}}}}case"node.log":{let a=o.level;if(a!=="debug"&&a!=="info"&&a!=="warn"&&a!=="error")return p();return{...r,kind:i,payload:{...s,level:a,message:f(o.message)}}}case"node.progress":return{...r,kind:i,payload:{...s,progress:Qy(o.progress)}};case"node.artifact":{let a=v(o.artifact),c=ce(a.size),l=f(a.digest);if(a.kind!="artifact"||c<0||!/^sha256:[0-9a-f]{64}$/.test(l))return p();return{...r,kind:i,payload:{...s,artifact:{kind:"artifact",id:f(a.id),name:f(a.name),size:c,digest:l,...a.mediaType===void 0?{}:{mediaType:f(a.mediaType)}}}}}}}default:return p()}}function Qy(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=100?e:p()}function kI(e){let n=v(e),t=n.eventsExpiresAt,r=ce(n.nextAfter);if(n.version!=1||!Array.isArray(n.events)||typeof n.done!="boolean"||typeof n.historyComplete!="boolean")return p();if(t!=null&&typeof t!="string")return p();if(r<0)return p();return{done:n.done,events:n.events.map(xI),...t==null?{}:{eventsExpiresAt:t},historyComplete:n.historyComplete,nextAfter:r,runId:f(n.runId),version:1}}var _=encodeURIComponent;function nt(e){return`${e}-${Ui()}`}class eu{constructor(e,n="api"){this.channel=n,this.requestControl=e}async loadOpenApiDocument(e,n){let t=v(await this.request("/v1/openapi/document",{method:"POST",body:JSON.stringify({url:e,version:1}),signal:n}));if(t.version!=1)return p();return be(t.document)}async listFlows(e={}){let n=new URLSearchParams;if(e.cursor!=null)n.set("cursor",e.cursor);if(e.limit!=null)n.set("limit",String(e.limit));if(e.includeTotal!=null)n.set("includeTotal",String(e.includeTotal));let t=n.size==0?"":`?${n}`;return Ly(await this.request(`/v1/flows${t}`,e.signal==null?void 0:{signal:e.signal}))}async listEventSources(e,n){return Gl(await this.request("/v1/event-sources"+(e==null?"":`?flowId=${_(e)}`),{signal:n}))}async listEventSourceConnections(e,n,t="feishu"){let r=v(await this.request(`/v1/event-sources/connections?kind=${t}${e==null?"":`&teamId=${_(e)}`}`,{signal:n}));if(G(r,["version","connections"]),r.version!=1||!Array.isArray(r.connections))return p();return r.connections.map(zt)}async createEventSource(e){return Li(await this.request("/v1/event-sources",{method:"POST",body:JSON.stringify(e)}))}async updateEventSource(e,n){return Li(await this.request(`/v1/event-sources/${_(e)}`,{method:"PUT",body:JSON.stringify(n)}))}async deleteEventSource(e,n){await this.request(`/v1/event-sources/${_(e)}`,{method:"DELETE",body:JSON.stringify({version:1,expectedRevision:n})})}async listVariables(){let e=v(await this.request("/v1/variables"));if(G(e,["variables","version"]),e.version!=1||!Array.isArray(e.variables))return p();return{variables:e.variables.map(Vy),version:1}}async getFlowReferences(e,n={}){let t=new URLSearchParams({direction:n.direction??"incoming",offset:String(n.offset??0),limit:String(n.limit??50)});return Ch.parse(await this.request(`/v1/flows/${_(e)}/references?${t}`,{signal:n.signal}))}async getWorkflowContract(e,n){return Ih.parse(await this.request(`/v1/flows/${_(e)}/call-contract`,{signal:n}))}async getVariableReferences(e,n){return qy(await this.request(`/v1/variables/${_(e)}/references`,{signal:n}))}async getVariable(e){return Mi(await this.request(`/v1/variables/${_(e)}`))}async putVariable(e,n){return Mi(await this.request(`/v1/variables/${_(e)}`,{body:JSON.stringify({value:n}),method:"PUT"}))}async deleteVariable(e){let n=v(await this.request(`/v1/variables/${_(e)}`,{method:"DELETE"}));if(G(n,["version"]),n.version!=1)return p()}async exportFlow(e){let n=await this.request(`/v1/flows/${_(e)}/export`);try{return Ni(n)}catch{return p()}}async importFlow(e,n={}){return In(await this.request("/v1/flows/import",{method:"POST",headers:{"Idempotency-Key":n.idempotencyKey??`flow-${Ui()}`},body:JSON.stringify({file:e,name:n.name,teamId:n.teamId,version:1})}))}async createFlow(e,n=`flow-${Ui()}`,t){return In(await this.request("/v1/flows",{body:JSON.stringify({name:e,...t==null?{}:{teamId:t},version:1}),headers:{"idempotency-key":n},method:"POST"}))}async broadcastCanvas(e,n){let t=v(await this.request(`/v1/flows/${_(e)}/canvas`,{method:"POST",body:JSON.stringify({version:1,command:n})}));if(G(t,["version","flowId","broadcast"]),t.version!=1||t.broadcast!==!0||t.flowId!==e)return p();return{version:1,flowId:f(t.flowId),broadcast:!0}}async getFlow(e){return In(await this.request(`/v1/flows/${_(e)}`))}async getErrorListeners(e,n){let t=v(await this.request(`/v1/flows/${_(e)}/error-listeners`,{signal:n}));if(t.version!=1||!Array.isArray(t.listeners))return p();return t.listeners.map(My)}async renameFlow(e,n){return In(await this.request(`/v1/flows/${_(e)}`,{body:JSON.stringify({name:n,version:1}),method:"PATCH"}))}async deleteFlow(e){return In(await this.request(`/v1/flows/${_(e)}`,{method:"DELETE"}))}async listTriggerKeys(e,n){let t=v(await this.request(`/v1/trigger-keys${n==null?"":`?locale=${encodeURIComponent(n)}`}`,{signal:e}));if(t.version!=1||!Array.isArray(t.keys))return p();return t.keys.map(Ml)}async listTriggerDefinitions(e){let n=v(await this.request("/v1/trigger-keys/catalog",{signal:e}));if(n.version!=2||!Array.isArray(n.definitions))return p();return n.definitions.map(qr)}async readCatalog(e,n,t){let r=new Headers;if(n)r.set("if-none-match",n);let o=await this.response(e.path,{headers:r,signal:t},!0),i=o.headers.get("etag")?.trim()||null;if(o.status==304)return{modified:!1,etag:i};return{modified:!0,data:e.decode(await o.json()),etag:i}}async getTriggerCatalog(e,n,t){let r=new Headers;if(n?.etag)r.set("if-none-match",n.etag);let o=await this.response(`/v1/trigger-keys/catalog?locale=${encodeURIComponent(e)}`,{headers:r,signal:t},!0);if(o.status==304){if(n==null)return p();return{...n,etag:o.headers.get("etag")?.trim()||n.etag}}return{data:Hl(await o.json()),etag:o.headers.get("etag")?.trim()||null}}async getTriggerKey(e,n){let t=v(await this.request(`/v1/trigger-keys/${_(e)}`,{signal:n}));if(t.version!=1)return p();return qr(t.definition)}async listFlowTriggerBindings(e,n){let t=v(await this.request(`/v1/flows/${_(e)}/triggers`,{signal:n}));if(t.version!=1||f(t.flowId)!=e||!Array.isArray(t.bindings))return p();return t.bindings.map(Fr)}async getFlowTriggerBinding(e,n){return sy(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}`))}async listFlowTriggerActivities(e,n,t={}){let r=new URLSearchParams;if(t.cursor!=null)r.set("cursor",t.cursor);if(t.limit!=null)r.set("limit",String(t.limit));let o=r.size==0?"":`?${r}`;return ay(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}/activities${o}`))}async testFlowPollTrigger(e,n){return cy(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}/test`,{body:JSON.stringify({version:1}),method:"POST"}))}async getEditor(e){let n=v(await this.request(`/v1/flows/${_(e)}/editor`));if(n.version!=1)return p();let t={flow:In(n.flow),draft:Jr(n.draft),live:Vl(n.live),presentation:qi(n.presentation),version:1};if(t.flow.flowId!=e||t.draft.flowId!=e||t.live.flowId!=e||t.flow.draftRevisionId!=t.draft.revisionId)return p();return t}async getPublicationPresentation(e,n,t){let r=v(await this.request(`/v1/flows/${_(e)}/publications/${_(n)}/presentation`,{signal:t}));if(r.version!=1)return p();return{version:1,presentation:r.presentation===null?null:qi(r.presentation)}}async getPresentation(e){return qi(await this.request(`/v1/flows/${_(e)}/presentation`))}async getDraft(e){return Jr(await this.request(`/v1/flows/${_(e)}/draft`))}async syncDraft(e){return Zy(await this.request(`/v1/flows/${_(e)}/draft/sync`))}async getRevision(e,n,t){return Jr(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}`,{signal:t}))}async listTriggerConfigOptions(e,n,t,r){let o=v(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}/options/${_(t)}`,{signal:r}));if(G(o,["options","version"]),o.version!=1||!Array.isArray(o.options)||o.options.length>1000)return p();return o.options.map((i)=>{let s=v(i);G(s,["value","label",...s.color==null?[]:["color"]]);let a=s.color==null?void 0:f(s.color);if(a!=null&&!/^#[0-9a-fA-F]{6}$/.test(a))return p();return a==null?{value:f(s.value),label:f(s.label)}:{value:f(s.value),label:f(s.label),color:a}})}async listConnectorTeams(e){let n=v(await this.request("/v1/connector/teams",{signal:e}));if(G(n,["enabled","teams","version"]),n.version!=1||typeof n.enabled!="boolean"||!Array.isArray(n.teams))return p();return{enabled:n.enabled,teams:n.teams.map((t)=>{let r=v(t);if(G(r,["id","name","systemCreated"]),typeof r.systemCreated!="boolean")return p();return{id:f(r.id),name:f(r.name),systemCreated:r.systemCreated}}),version:1}}async listConnectorProviders(e,n,t){let r=Ty(n,t);return this.connectorRequest(r.path,"providers",e,r.decode)}async listLeinaBots(e,n){return ky(await this.request(`/v1/connector/leina/bots?flowId=${_(e)}`,{signal:n}))}async removeConnectionUsage(e,n,t,r,o){return Ur(await this.request(`/v1/flows/${_(e)}/connection-usage/remove`,{method:"POST",headers:{"idempotency-key":o},body:JSON.stringify({connectionId:n,expectedRevisionId:t,expectedAccessRevision:r,version:1})}))}async getConnectorAccess(e,n){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access`,{signal:n}))}async getPublishedConnectorAccess(e,n,t){return Bl(await this.request(`/v1/flows/${_(e)}/connector-access?publicationId=${_(n)}`,{signal:t}))}async listProviderAccessBindingCandidates(e,n,t){return Iy(await this.request(`/v1/flows/${_(e)}/connector-access/candidates/query`,{method:"POST",body:JSON.stringify({providerIds:n,version:1}),signal:t}),n)}async setConnectorService(e,n,t,r){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access/${_(n)}/service`,{body:JSON.stringify({expectedAccessRevision:r,version:1}),method:t?"PUT":"DELETE"}))}async addProviderAccessBinding(e,n,t,r){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access/${_(n)}`,{body:JSON.stringify({accessBindingId:t,expectedAccessRevision:r,version:1}),method:"PUT"}))}async removeProviderAccessBinding(e,n,t,r){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access/${_(n)}`,{body:JSON.stringify({accessBindingId:t,expectedAccessRevision:r,version:1}),method:"DELETE"}))}async listConnectorActions(e,n,t,r){return await this.connectorActions({...r==null?{}:{locale:r},...t==null?{}:{flowId:t},...e==null?{}:{service:e}},n)}async searchConnectorActions(e,n,t,r){return await this.connectorActions({...r==null?{}:{locale:r},...t==null?{}:{flowId:t},q:e.trim()},n)}async getConnectorAction(e,n,t,r,o=!1){let i=Ny(e,t,r);return this.connectorRequest(i.path,"actions",n,i.decode,o)}async listAllConnectorConnections(e,n,t=!1){let r=zy(n);return this.connectorRequest(r.path,"connections",e,r.decode,t)}async listConnectorConnections(e,n,t,r=!1){let o=Dy(e,t);return this.connectorRequest(o.path,"connections",n,o.decode,r)}async createConnectorConnectionPage(e,n,t){let r=new URLSearchParams;if(n!=null)r.set("flowId",n);if(t!=null)r.set("teamId",t);let o=v(await this.request(`/v1/connector/connections/${_(e)}/page${r.size==0?"":`?${r}`}`,{body:JSON.stringify({version:1}),method:"POST"}));if(G(o,["url","version"]),o.version!=1)return p();try{let i=new URL(f(o.url));if(i.protocol!="http:"&&i.protocol!="https:")return p();return i.href}catch{return p()}}async readAuthoring(e,n={}){return ny.parse(await this.request(`/v1/flows/${_(e)}/authoring/read`,{method:"POST",body:JSON.stringify(n)}))}async searchAuthoring(e,n){return ty.parse(await this.request(`/v1/flows/${_(e)}/authoring/search`,{method:"POST",body:JSON.stringify(n)}))}async authoringSchema(e,n){return v(await this.request(`/v1/flows/${_(e)}/authoring/schema`,{method:"POST",body:JSON.stringify(n)}))}async editAuthoring(e,n){return ey.parse(await this.request(`/v1/flows/${_(e)}/authoring/edit`,{method:"POST",headers:{"idempotency-key":n.requestId},body:JSON.stringify(n)}))}async checkAuthoring(e,n){return Xh.parse(await this.request(`/v1/flows/${_(e)}/authoring/check`,{method:"POST",body:JSON.stringify({revisionId:n})}))}async changeDraft(e,n,t,r=nt("change")){return Ur(await this.request(`/v1/flows/${_(e)}/draft/changes`,{body:JSON.stringify({expectedRevisionId:n,operations:t,version:1}),headers:{"idempotency-key":r},method:"POST"}))}async repairDraft(e,n,t=nt("repair")){return Ur(await this.request(`/v1/flows/${_(e)}/draft/repair`,{body:JSON.stringify({expectedRevisionId:n,version:1}),headers:{"idempotency-key":t},method:"POST"}))}async upgradeDraft(e,n,t={}){return Ur(await this.request(`/v1/flows/${_(e)}/draft/upgrade`,{body:JSON.stringify({expectedRevisionId:n,version:1}),headers:{"idempotency-key":t.idempotencyKey??nt("upgrade")},method:"POST"}))}async checkFlow(e,n){return Py(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}/check`,{body:JSON.stringify({engineContract:ro,version:1}),method:"POST"}))}async getLiveDetails(e,n){let t=uy(await this.request(`/v1/flows/${_(e)}/live/details`,{signal:n}));if(t.flowId!=e)return p();return t}async getLive(e,n){return Vl(await this.request(`/v1/flows/${_(e)}/live`,{signal:n}))}async listPublications(e,n={},t){let r=new URLSearchParams;if(n.cursor!=null)r.set("cursor",n.cursor);if(n.limit!=null)r.set("limit",String(n.limit));if(n.includeTotal!=null)r.set("includeTotal",String(n.includeTotal));let o=r.size==0?"":`?${r}`;return oy(await this.request(`/v1/flows/${_(e)}/publications${o}`,{signal:t}))}async createDraftRun(e,n,t){let r=Ji(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}/runs`,{body:JSON.stringify({engineContract:ro,inputs:t.inputs??{},trigger:t.trigger,version:2}),headers:{"idempotency-key":t.idempotencyKey??nt("run"),"x-open-flow-client":this.channel},method:"POST"}));return r.source=="draft"?r:p()}async createLiveRun(e,n){let t=Ji(await this.request("/v1/runs",{body:JSON.stringify({inputs:n.inputs??{},trigger:n.trigger,publicationId:e,version:2}),headers:{"idempotency-key":n.idempotencyKey??nt("run"),"x-open-flow-client":this.channel},method:"POST"}));return t.source=="live"?t:p()}async setFlowEnabled(e,n,t){return In(await this.request(`/v1/flows/${_(e)}/enabled`,{method:"PUT",body:JSON.stringify({enabled:t,expectedPublicationId:n,version:1})}))}async publishFlow(e,n,t,r={}){return Ll(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}/publications`,{body:JSON.stringify({engineContract:ro,expectedLivePublicationId:t,version:1}),headers:{"idempotency-key":r.idempotencyKey??nt("publication")},method:"POST"}))}async getPublishOperation(e,n,t){return Ll(await this.request(`/v1/flows/${_(e)}/publish-operations/${_(n)}`,{signal:t}))}async rollbackFlow(e,n,t,r={}){return Tt(await this.request(`/v1/flows/${_(e)}/publications/${_(n)}/rollback`,{body:JSON.stringify({expectedLivePublicationId:t,version:1}),headers:{"idempotency-key":r.idempotencyKey??nt("publication")},method:"POST"}))}async getRun(e,n){return Ji(await this.request(`/v1/runs/${_(e)}`,{signal:n}))}async listRuns(e,n={}){let t=new URLSearchParams;if(n.cursor!=null)t.set("cursor",n.cursor);if(n.limit!=null)t.set("limit",String(n.limit));if(n.status!=null)t.set("status",n.status);if(n.pendingWait!=null)t.set("pendingWait",String(n.pendingWait));if(n.source!=null)t.set("source",n.source);if(n.createdFrom!=null)t.set("createdFrom",n.createdFrom);if(n.createdBefore!=null)t.set("createdBefore",n.createdBefore);if(n.runId!=null)t.set("runId",n.runId);let r=t.size==0?"":`?${t}`;return Ky(await this.request(`/v1/flows/${_(e)}/runs${r}`))}async getRunEvents(e,n={},t){let r=new URLSearchParams;if(n.after!=null)r.set("after",String(n.after));if(n.limit!=null)r.set("limit",String(n.limit));let o=r.size==0?"":`?${r}`;return kI(await this.request(`/v1/runs/${_(e)}/events${o}`,{signal:t}))}async listRunResults(e,n,t){return Yl(await this.request(`/v1/runs/${_(e)}/results${n==null?"":`?after=${encodeURIComponent(n)}`}`,{signal:t}))}async readRunResult(e,n,t={},r){let o=new URLSearchParams(Object.entries(t).map(([i,s])=>[i,String(s)]));return Xl(await this.request(`/v1/runs/${_(e)}/results/${_(n)}?${o}`,{signal:r}))}async downloadRunResult(e,n,t){return(await this.response(`/v1/runs/${_(e)}/results/${_(n)}/content`,{signal:t})).blob()}async getRunResult(e,n){return Hy(await this.request(`/v1/runs/${_(e)}/result`,{signal:n}))}async cancelRun(e){return Wy(await this.request(`/v1/runs/${_(e)}/cancel`,{body:JSON.stringify({version:1}),method:"POST"}))}async resolveRunWait(e,n,t,r){return Gy(await this.request(`/v1/runs/${_(e)}/waits/${_(n)}/resolve`,{body:JSON.stringify({action:t,comment:r,version:1}),method:"POST"}))}async connectorActions(e,n){let t=Object.entries(e).map(([o,i])=>`${_(o)}=${_(i)}`).join("&"),r=t==""?"":`?${t}`;return this.connectorRequest(`/v1/connector/actions${r}`,"actions",n,(o)=>{let i=v(o);if(G(i,["actions","version"]),i.version!=1||!Array.isArray(i.actions))return p();return i.actions.map(Di)})}async connectorRequest(e,n,t,r,o=!1){return r(await this.request(e,{signal:t}))}async response(e,n,t=!1){let r=new Headers(n.headers);if(n.body!=null)r.set("content-type","application/json");let o=await this.requestControl(e,{...n,headers:r});if(!o.ok&&!(t&&o.status==304)){let i;try{i=await o.json()}catch{return p()}let s=v(i).error,a=s==null?void 0:v(s);throw new Pe(o.status,typeof a?.code=="string"?a.code:"request.failed",typeof a?.message=="string"?a.message:`Request failed with status ${o.status}.`,a?.details==null?void 0:v(a.details))}return o}async request(e,n={}){let t=await this.response(e,n);try{return await t.json()}catch{return p()}}}import{randomUUID as _I}from"crypto";class E extends Error{constructor(e,n,t){super(n);this.code=e,this.details=t,this.name="CliError"}}function Bi(e,n){let t=e.trim();if(Ti(t)!=null)throw new E("cli.invalid-arguments",`${n} name must be between 1 and ${Zl} characters and use only letters, numbers, spaces, hyphens, or underscores.`);return t}var SI=100,nu=100,tu=100,II=new Set(["canceled","completed","failed","indeterminate"]);async function CI(e){let n=[],t=new Set,r;do{let o=await e.listFlows({cursor:r,limit:SI});if(n.push(...o.flows),r=o.nextCursor,r!=null&&t.has(r))throw new E("page.invalid-cursor","The deployment returned a repeated Flow cursor.");if(r!=null)t.add(r)}while(r!=null);return n}function OI(e,n){let t=e.find((o)=>o.flowId==n);if(t!=null)return t;let r=e.filter((o)=>o.name==n);if(r.length==1)return r[0];if(r.length>1)throw new E("flow.ambiguous",`Flow name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({flowId:o,name:i})=>({flowId:o,name:i}))});throw new E("flow.not-found",`Flow ${JSON.stringify(n)} was not found.`)}async function ve(e,n){try{return await e.getFlow(n)}catch(t){if(!(t instanceof Pe)||t.code!="flow.invalid"&&t.code!="flow.not-found")throw t}return OI(await CI(e),n)}async function Xy(e,n,t){if(t.expectedRevision!=null&&t.expectedRevision!=n.draftRevisionId&&!t.options.includes("idempotency-key"))throw new E("flow.revision-conflict","The Flow Draft changed. Inspect it before submitting a new mutation.",{expectedRevisionId:t.expectedRevision,actualRevisionId:n.draftRevisionId,flowId:n.flowId});let r=await e.getRevision(n.flowId,t.expectedRevision??n.draftRevisionId);return{draft:r,flow:n,graph:r.content.document.graph}}function EI(e,n){let t=e.find((o)=>o.actionId==n);if(t!=null)return t;let r=e.filter((o)=>o.name==n);if(r.length==1)return r[0];if(r.length>1)throw new E("connector.action-ambiguous",`Connector Action name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({actionId:o,name:i,serviceId:s})=>({actionId:o,name:i,serviceId:s}))});throw new E("connector.action-not-found",`Connector Action ${JSON.stringify(n)} was not found.`)}async function eb(e,n,t){try{return await e.getConnectorAction(n,void 0,t)}catch(r){if(!(r instanceof Pe)||r.status!=404)throw r}return EI(await e.searchConnectorActions(n,void 0,t),n)}function nb(e,n){let t=Object.entries(e.document.graph.nodes).filter((i)=>!("inputs"in i[1])),r=t?.find(([i])=>i==n);if(r!=null)return{trigger:r[1],triggerId:r[0]};let o=t?.filter(([,i])=>i.name==n)??[];if(o.length==1)return{trigger:o[0][1],triggerId:o[0][0]};if(o.length>1)throw new E("trigger.ambiguous",`Trigger name ${JSON.stringify(n)} is ambiguous.`,{candidates:o.map(([i,s])=>({name:s.name,triggerId:i}))});throw new E("trigger.not-found",`Trigger ${JSON.stringify(n)} was not found.`)}function ru(e){return`${e.displayName} ${e.key} ${e.provider} ${e.type}`}async function tb(e,n){try{return await e.getTriggerKey(n)}catch(o){if(!(o instanceof Pe)||o.status!=404)throw o}let r=(await e.listTriggerKeys()).filter((o)=>o.name==n||o.displayName==n);if(r.length==1)return await e.getTriggerKey(r[0].key);if(r.length>1)throw new E("trigger-key.ambiguous",`Trigger Key name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({displayName:o,key:i,provider:s})=>({displayName:o,key:i,provider:s}))});throw new E("trigger-key.not-found",`Trigger Key ${JSON.stringify(n)} was not found.`)}function rb(e){return`${e.displayName} ${e.connectionId} ${e.serviceId} ${e.status}${e.isDefault?"\tdefault":""}`}function ou(e){return`${e.name} ${e.actionId} ${e.serviceName} ${e.serviceId}`}function pe(e,n,t){if(e.length!=n)throw new E("cli.invalid-arguments",`Usage: ${t}`)}function F(e,n,t,r){e.stdout.write(n?`${JSON.stringify(t)}
62
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(n===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(n!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function lm(e){let n=e.anyOf;if(!Array.isArray(n)||n.length===0||e.type!==void 0)return;let t=[];for(let r of n){if(!r||typeof r!=="object")return;lm(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!t.includes(s))t.push(s)}}delete e.anyOf,e.type=t.length===1?t[0]:t}var um=new Set(["type","properties","required","additionalProperties"]),am=["oneOf","anyOf"];function cm(e){let n=e.additionalProperties;if(n===void 0||n===!1||typeof n!=="object"||n===null)return null;return Object.keys(n).length?n:null}function Va(e){let n=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!um.has(s))return null;n.push(i)}let t={},r=new Set;for(let i of n){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(t,s))continue;let a=[];for(let l of n){let u=l.properties?.[s]??cm(l);if(u===null||u===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(u)))a.push(u)}let c=a.length===1?a[0]:Va(a)??{allOf:a};_e(t,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:t};if(r.size)o.required=[...r];if(n.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of n){let a=cm(s);if(a&&!i.some((c)=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function Tv(e){let n=e.allOf;if(!Array.isArray(n)||n.length<2)return;for(let o of um)if(o in e)return;let t=n.filter((o)=>am.some((i)=>Array.isArray(o[i]))),r=null;if(!t.length)r=Va(n);else{let o=t[0],i=am.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=n.filter((c)=>c!==o),a=o[i].map((c)=>Va([...s,c]));if(a.some((c)=>!c))return;r={[i]:a}}if(!r)return;delete e.allOf,sr(e,r)}function ur(e,n){let t=e.seen.get(n);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){r(d);let h=e.seen.get(d),y=h.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(y);else sr(l,y);if(sr(l,u),a._zod.parent===d)for(let R in l){if(R==="$ref"||R==="allOf")continue;if(!(R in u))delete l[R]}if(y.$ref&&h.def)for(let R in l){if(R==="$ref"||R==="allOf")continue;if(R in h.def&&JSON.stringify(l[R])===JSON.stringify(h.def[R]))delete l[R]}}let g=a._zod.parent;if(g&&g!==d){r(g);let h=e.seen.get(g);if(h?.schema.$ref){if(l.$ref=h.schema.$ref,h.def)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(y in h.def&&JSON.stringify(l[y])===JSON.stringify(h.def[y]))delete l[y]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())lm(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);if(d)d.push(l);else a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])Tv(l)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(n)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}sr(o,t.defId?t.schema:t.def??t.schema);let i=e.metadataRegistry.get(n)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;_e(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...n["~standard"],jsonSchema:{input:ar(n,"input",e.processors),output:ar(n,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function Te(e,n){let t=n??{seen:new Set};if(t.seen.has(e))return!1;t.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Te(r.element,t);if(r.type==="set")return Te(r.valueType,t);if(r.type==="lazy")return Te(r.getter(),t);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return Te(r.innerType,t);if(r.type==="intersection")return Te(r.left,t)||Te(r.right,t);if(r.type==="record"||r.type==="map")return Te(r.keyType,t)||Te(r.valueType,t);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Te(r.in,t)||Te(r.out,t)}if(r.type==="object"){for(let o in r.shape)if(Te(r.shape[o],t))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(Te(o,t))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(Te(o,t))return!0;if(r.rest&&Te(r.rest,t))return!0;return!1}return!1}var dm=(e,n={})=>(t)=>{let r=cr({...t,processors:n});return ue(e,r),lr(r,e),ur(r,e)},ar=(e,n,t={})=>(r)=>{let{libraryOptions:o,target:i}=r??{},s=cr({...o??{},target:i,io:n,processors:t});return ue(e,s),lr(s,e),ur(s,e)};var mt=(e,n,t)=>{if(e[n]===void 0||t>e[n])e[n]=t},gt=(e,n,t)=>{if(e[n]===void 0||t<e[n])e[n]=t},pm=(e,n)=>{mt(e,"minimum",n),gt(e,"maximum",n)},ym=(e,n)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(n))e.multipleOf.push(n)},bm=(e,n)=>{e.patterns??(e.patterns=new Set),e.patterns.add(n)},wm=(e,n)=>{e.mime=e.mime?e.mime.filter((t)=>n.includes(t)):[...n]},vm=(e,n)=>{if(e.format=n,n.includes("int"))e.isInt=!0},fm=(e,n)=>mt(e,"minimum",n.minimum),mm=(e,n)=>gt(e,"maximum",n.maximum),gm=(e)=>(n,t)=>{vm(n,t.format);let[r,o]=e[t.format];mt(n,"minimum",r),gt(n,"maximum",o)},$v={greater_than:(e,n)=>mt(e,n.inclusive?"minimum":"exclusiveMinimum",n.value),less_than:(e,n)=>gt(e,n.inclusive?"maximum":"exclusiveMaximum",n.value),multiple_of:(e,n)=>ym(e,n.value),number_format:gm(io),bigint_format:gm(so),min_length:fm,max_length:mm,length_equals:(e,n)=>pm(e,n.length),min_size:fm,max_size:mm,size_equals:(e,n)=>pm(e,n.size),string_format:(e,n)=>{if(vm(e,n.format),n.pattern)bm(e,n.pattern);if(n.format==="base64"||n.format==="base64url")e.contentEncoding=n.format;if(n.local||n.precision===-1)e.laxFormat=!0},mime_type:(e,n)=>wm(e,n.mime)};function Se(e){let n={},t=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...t.checks??[]]:t.checks??[];for(let i of r)$v[i._zod.def.check]?.(n,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)mt(n,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)mt(n,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)gt(n,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)gt(n,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)ym(n,o.multipleOf);if(o.format!==void 0){if(n.format??(n.format=o.format),o.format.includes("int"))n.isInt=!0}if(o.mime)wm(n,o.mime);for(let i of o.patterns??[])bm(n,i);return n}var Nv={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},zv=new Map([[ua,qs],[Co,Ls]]),km=(e)=>zv.get(e)??e,Za=(e,n,t,r)=>{let o=t;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Se(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=Nv[a]??a,o.format==="")delete o.format;if(a==="time"||u)delete o.format}if(l)o.contentEncoding=l;if(c&&c.size>0){let d=[...c].map(km);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((g)=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))]}},Ja=(e,n,t,r)=>{let o=t,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Se(e);o.type=u?"integer":"number";let d=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),g=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),h=n.target==="draft-04"||n.target==="openapi-3.0";if(d)if(h)o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;else if(typeof i==="number")o.minimum=i;if(g)if(h)o.maximum=c,o.exclusiveMaximum=!0;else o.exclusiveMaximum=c;else if(typeof s==="number")o.maximum=s;if(a){let y=new Set;for(let N of a)if(Number.isFinite(N)&&N!==0)y.add(Math.abs(N));else Ce(e,n,o,r,`A multipleOf divisor of ${N} cannot be represented in JSON Schema`);let[S,...R]=y;if(S!==void 0)o.multipleOf=S;if(R.length)o.allOf=[...o.allOf??[],...R.map((N)=>({multipleOf:N}))]}},Ua=(e,n,t,r)=>{t.type="boolean"},Ba=(e,n,t,r)=>{Ce(e,n,t,r,"BigInt cannot be represented in JSON Schema")},Ka=(e,n,t,r)=>{Ce(e,n,t,r,"Symbols cannot be represented in JSON Schema")},Wa=(e,n,t,r)=>{if(n.target==="openapi-3.0")t.type="string",t.nullable=!0,t.enum=[null];else t.type="null"},Ga=(e,n,t,r)=>{Ce(e,n,t,r,"Undefined cannot be represented in JSON Schema")},Ha=(e,n,t,r)=>{Ce(e,n,t,r,"Void cannot be represented in JSON Schema")},Qa=(e,n,t,r)=>{t.not={}},Ya=(e,n,t,r)=>{},Xa=(e,n,t,r)=>{},ec=(e,n,t,r)=>{Ce(e,n,t,r,"Date cannot be represented in JSON Schema")},nc=(e,n,t,r)=>{let o=e._zod.def,i=Zt(o.entries);if(i.length===0){t.not={};return}if(i.every((s)=>typeof s==="number"))t.type="number";if(i.every((s)=>typeof s==="string"))t.type="string";t.enum=i},tc=(e,n,t,r)=>{let o=e._zod.def;if(o.values.length===0){t.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(Ce(e,n,t,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(Ce(e,n,t,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(t.type=s===null?"null":typeof s,n.target==="draft-04"||n.target==="openapi-3.0")t.enum=[s];else t.const=s}else{if(i.every((s)=>typeof s==="number"))t.type="number";if(i.every((s)=>typeof s==="string"))t.type="string";if(i.every((s)=>typeof s==="boolean"))t.type="boolean";if(i.every((s)=>s===null))t.type="null";t.enum=i}},rc=(e,n,t,r)=>{Ce(e,n,t,r,"NaN cannot be represented in JSON Schema")},oc=(e,n,t,r)=>{let o=t,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},ic=(e,n,t,r)=>{let o=t;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=Se(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!a)return;if(a.length===0)o.not={};else if(a.length===1)o.contentMediaType=a[0];else o.anyOf=a.map((c)=>({contentMediaType:c}))},sc=(e,n,t,r)=>{t.type="boolean"},ac=(e,n,t,r)=>{Ce(e,n,t,r,"Custom types cannot be represented in JSON Schema")},cc=(e,n,t,r)=>{Ce(e,n,t,r,"Function types cannot be represented in JSON Schema")},lc=(e,n,t,r)=>{Ce(e,n,t,r,"Transforms cannot be represented in JSON Schema")},uc=(e,n,t,r)=>{Ce(e,n,t,r,"Map cannot be represented in JSON Schema")},dc=(e,n,t,r)=>{Ce(e,n,t,r,"Set cannot be represented in JSON Schema")},pc=(e,n,t,r)=>{let o=t,i=e._zod.def,{minimum:s,maximum:a}=Se(e);if(typeof s==="number")o.minItems=s;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=ue(i.element,n,{...r,path:[...r.path,"items"]})};function dr(e){let n=e._zod.def;if(n.type==="pipe"&&n.in._zod.traits.has("$ZodTransform"))return dr(n.out);if(n.type==="catch")return dr(n.innerType);return e._zod.optin}var fc=(e,n,t,r)=>{let o=t,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Ce(e,n,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)_e(o.properties,l,ue(s[l],n,{...r,path:[...r.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let u=i.shape[l];if(n.io==="input"?dr(u)===void 0:u._zod.optout===void 0)c.push(l)}if(c.length>0)o.required=c;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(n.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=ue(i.catchall,n,{...r,path:[...r.path,"additionalProperties"]})},Qo=(e,n,t,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>ue(a,n,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));if(i)t.oneOf=s;else t.anyOf=s},mc=(e,n,t,r)=>{let o=e._zod.def,i=ue(o.left,n,{...r,path:[...r.path,"allOf",0]}),s=ue(o.right,n,{...r,path:[...r.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];t.allOf=c,n.intersections.push(c)},gc=(e,n,t,r)=>{let o=t,i=e._zod.def;o.type="array";let s=n.target==="draft-2020-12"?"prefixItems":"items",a=n.target==="draft-2020-12"?"items":n.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((S,R)=>ue(S,n,{...r,path:[...r.path,s,R]})),l=i.rest?ue(i.rest,n,{...r,path:[...r.path,a,...n.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;while(u>0){let S=i.items[u-1];if(!(n.io==="input"?dr(S)!==void 0:S._zod.optout==="optional"))break;u--}let d=i.items.length,g=!i.rest;if(n.target==="draft-2020-12"){if(o.prefixItems=c,g)o.items=!1;else if(l)o.items=l;if(u>0)o.minItems=u;if(g)o.maxItems=d}else if(n.target==="openapi-3.0"){if(o.items={anyOf:c},l)o.items.anyOf.push(l);if(u>0)o.minItems=u;if(g)o.maxItems=d}else{if(o.items=c,g)o.additionalItems=!1;else if(l)o.additionalItems=l;if(u>0)o.minItems=u;if(g)o.maxItems=d}let{minimum:h,maximum:y}=Se(e);if(typeof h==="number")o.minItems=h;if(typeof y==="number")o.maxItems=y};function Ma(e,n,t){if(n.$ref){if(t.has(n))return n;t.add(n);let y=e.get(n)?.def;if(!y)return n;let S=Ma(e,y,t);return S===y?n:S}for(let y of["anyOf","oneOf"]){let S=n[y];if(!Array.isArray(S))continue;let R=S.map((N)=>Ma(e,N,t));if(R.some((N,D)=>N!==S[D]))n={...n,[y]:R}}let r=Array.isArray(n.type)?n.type:[n.type],o=!r.includes("string")&&r.some((y)=>y==="number"||y==="integer"),i=n.enum??(n.const!==void 0?[n.const]:void 0);if(!o&&!i?.some((y)=>typeof y==="number"))return n;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:g,...h}=n;if(h.enum)h.enum=h.enum.map((y)=>typeof y==="number"?String(y):y);else if(typeof h.const==="number")h.const=String(h.const);if(!o)return h;if(h.type="string",!i)h.pattern=(r.includes("number")?Bn:Qt).source;return h}var Fa=new WeakMap;function Dv(e){let n=new Map;for(let r of e.seen.values())if(r.def&&!n.has(r.schema))n.set(r.schema,r);let t=new Map;for(let r of Fa.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||t.has(i))continue;let s=Ma(n,i,new Set);if(s!==i)t.set(i,s)}if(!t.size)return;for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&t.get(o.propertyNames);if(i)o.propertyNames=i}}var hc=(e,n,t,r)=>{let o=t,i=e._zod.def;o.type="object";let s=i.keyType,a=Se(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let u=ue(i.valueType,n,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)_e(o.patternProperties,km(d).source,u)}else{if(n.target==="draft-07"||n.target==="draft-2020-12"){o.propertyNames=ue(i.keyType,n,{...r,path:[...r.path,"propertyNames"]});let u=Fa.get(n);if(!u)u=[],Fa.set(n,u),n.deferred.push(()=>Dv(n));u.push(e)}o.additionalProperties=ue(i.valueType,n,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,l=n.io==="input"&&dr(i.valueType)!==void 0;if(c&&!i.partial&&!l){let u=[...c].filter((d)=>typeof d==="string"||typeof d==="number");if(u.length>0)o.required=u.map(String)}},yc=(e,n,t,r)=>{let o=e._zod.def,i=ue(o.innerType,n,r),s=n.seen.get(e);if(n.target==="openapi-3.0")s.ref=o.innerType,t.nullable=!0;else t.anyOf=[i,{type:"null"}]},bc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},wc=Symbol();function xm(e,n,t,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return i=!0,null});if(!i)return JSON.parse(s);return Ce(n,t,r,o,"BigInt defaults cannot be represented in JSON Schema"),wc}var vc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType;let s=xm(o.defaultValue,e,n,t,r);if(s!==wc)t.default=s},kc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);if(i.ref=o.innerType,n.io!=="input")return;let s=xm(o.defaultValue,e,n,t,r);if(s!==wc)t._prefault=s},xc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{Ce(e,n,t,r,"Dynamic catch values are not supported in JSON Schema");return}t.default=s},Sc=(e,n,t,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=n.io==="input"?i?o.out:o.in:o.out;ue(s,n,r);let a=n.seen.get(e);a.ref=s},Ic=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType,t.readOnly=!0},Cc=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},Yo=(e,n,t,r)=>{let o=e._zod.def;ue(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},Ec=(e,n,t,r)=>{let o=e._zod.innerType;ue(o,n,r);let i=n.seen.get(e);i.ref=o},hm={string:Za,number:Ja,boolean:Ua,bigint:Ba,symbol:Ka,null:Wa,undefined:Ga,void:Ha,never:Qa,any:Ya,unknown:Xa,date:ec,enum:nc,literal:tc,nan:rc,template_literal:oc,file:ic,success:sc,custom:ac,function:cc,transform:lc,map:uc,set:dc,array:pc,object:fc,union:Qo,intersection:mc,tuple:gc,record:hc,nullable:yc,nonoptional:bc,default:vc,prefault:kc,catch:xc,pipe:Sc,readonly:Ic,promise:Cc,optional:Yo,lazy:Ec};function ht(e,n){if("_idmap"in e){let r=e,o=cr({...n,processors:hm}),i={};for(let c of r._idmap.entries()){let[l,u]=c;ue(u,o)}let s={},a={registry:r,uri:n?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[l,u]=c;lr(o,u),_e(s,l,ur(o,u))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let t=cr({...n,processors:hm});return ue(e,t),lr(t,e),ur(t,e)}var el={};no(el,{ZodAny:()=>Jm,ZodArray:()=>Gm,ZodBase64:()=>Zc,ZodBase64URL:()=>Jc,ZodBigInt:()=>Gc,ZodBigIntFormat:()=>Hc,ZodBoolean:()=>Wc,ZodCIDRv4:()=>Mc,ZodCIDRv6:()=>Fc,ZodCUID:()=>$c,ZodCUID2:()=>Nc,ZodCatch:()=>gg,ZodCodec:()=>ci,ZodCreditCard:()=>qm,ZodCustom:()=>li,ZodCustomStringFormat:()=>kt,ZodDate:()=>Wm,ZodDefault:()=>lg,ZodDiscriminatedUnion:()=>Qm,ZodE164:()=>Uc,ZodEmail:()=>Rc,ZodEmoji:()=>Pc,ZodEnum:()=>mr,ZodExactOptional:()=>Yc,ZodFile:()=>ig,ZodFunction:()=>Cg,ZodGUID:()=>Ac,ZodIBAN:()=>Lm,ZodIPv4:()=>Lc,ZodIPv6:()=>Vc,ZodISODate:()=>bt,ZodISODateTime:()=>yt,ZodISODuration:()=>vt,ZodISOTime:()=>wt,ZodInstanceOf:()=>jg,ZodIntersection:()=>Ym,ZodJWT:()=>Bc,ZodKSUID:()=>qc,ZodLazy:()=>xg,ZodLiteral:()=>og,ZodMAC:()=>Dm,ZodMap:()=>tg,ZodNaN:()=>yg,ZodNanoID:()=>Tc,ZodNever:()=>Bm,ZodNonOptional:()=>Xc,ZodNull:()=>Fm,ZodNullable:()=>cg,ZodNumber:()=>Kc,ZodNumberFormat:()=>xt,ZodObject:()=>oi,ZodOptional:()=>si,ZodPipe:()=>ai,ZodPrefault:()=>dg,ZodPreprocess:()=>bg,ZodPromise:()=>Ig,ZodReadonly:()=>wg,ZodRecord:()=>fr,ZodSet:()=>rg,ZodString:()=>_c,ZodStringFormat:()=>ae,ZodSuccess:()=>mg,ZodSymbol:()=>Vm,ZodTemplateLiteral:()=>kg,ZodTransform:()=>sg,ZodTuple:()=>eg,ZodType:()=>Z,ZodULID:()=>zc,ZodURL:()=>ri,ZodUUID:()=>kn,ZodUndefined:()=>Mm,ZodUnion:()=>ii,ZodUnknown:()=>Um,ZodVoid:()=>Km,ZodXID:()=>Dc,ZodXor:()=>Hm,_ZodString:()=>jc,_default:()=>ug,_function:()=>Wk,any:()=>_k,array:()=>A,base64:()=>lk,base64url:()=>uk,bigint:()=>Ik,boolean:()=>me,catch:()=>hg,check:()=>Gk,cidrv4:()=>ak,cidrv6:()=>ck,codec:()=>Jk,creditCard:()=>pk,cuid:()=>Xv,cuid2:()=>ek,currencyCode:()=>bk,custom:()=>Hk,date:()=>Ak,describe:()=>Qk,discriminatedUnion:()=>sn,e164:()=>dk,email:()=>Zv,emoji:()=>Qv,enum:()=>W,exactOptional:()=>ag,file:()=>Vk,float32:()=>vk,float64:()=>kk,function:()=>Wk,guid:()=>Jv,hash:()=>wk,hex:()=>yk,hostname:()=>hk,httpUrl:()=>Hv,iban:()=>fk,instanceof:()=>Xk,int:()=>we,int32:()=>xk,int64:()=>Ck,intersection:()=>Xm,invertCodec:()=>Uk,ipv4:()=>ok,ipv6:()=>sk,json:()=>$e,jwt:()=>mk,keyof:()=>Pk,ksuid:()=>rk,lazy:()=>Sg,literal:()=>w,looseObject:()=>Tk,looseRecord:()=>zk,mac:()=>ik,map:()=>Dk,meta:()=>Yk,nan:()=>Zk,nanoid:()=>Yv,nativeEnum:()=>Lk,never:()=>on,nonoptional:()=>fg,null:()=>Zm,nullable:()=>ti,nullish:()=>Mk,number:()=>ne,object:()=>E,optional:()=>ni,partialRecord:()=>Nk,pipe:()=>Oc,prefault:()=>pg,preprocess:()=>_g,promise:()=>Kk,readonly:()=>vg,record:()=>re,refine:()=>Eg,set:()=>qk,strictObject:()=>k,string:()=>j,stringFormat:()=>gk,stringbool:()=>ex,success:()=>Fk,superRefine:()=>Og,symbol:()=>Ok,templateLiteral:()=>Bk,transform:()=>Qc,tuple:()=>ng,uint32:()=>Sk,uint64:()=>Ek,ulid:()=>nk,undefined:()=>jk,union:()=>Q,unknown:()=>pn,url:()=>Gv,uuid:()=>Uv,uuidv4:()=>Bv,uuidv6:()=>Kv,uuidv7:()=>Wv,void:()=>Rk,xid:()=>tk,xor:()=>$k});var Xo={};no(Xo,{endsWith:()=>Zo,gt:()=>An,gte:()=>rn,includes:()=>Mo,length:()=>ir,lowercase:()=>Lo,lt:()=>Rn,lte:()=>tn,maxLength:()=>or,maxSize:()=>pt,mime:()=>Uo,minLength:()=>Kn,minSize:()=>Pn,multipleOf:()=>dt,negative:()=>Wf,nonnegative:()=>Hf,nonpositive:()=>Gf,normalize:()=>Bo,overwrite:()=>vn,positive:()=>Kf,properties:()=>Jo,property:()=>Qf,regex:()=>qo,size:()=>rr,slugify:()=>Ho,startsWith:()=>Fo,toLowerCase:()=>Wo,toUpperCase:()=>Go,trim:()=>Ko,uppercase:()=>Vo});var Sm=new WeakSet([Object.prototype,Error.prototype]);function ei(e,n,t){Object.defineProperty(e,n,{configurable:!0,enumerable:!1,get(){let r=t(this);return Object.defineProperty(this,n,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,n,{value:r,configurable:!0,writable:!0})}})}var Im=(e,n)=>{nd.init(e,n),e.name="ZodError";let t=Object.getPrototypeOf(e);if(Sm.has(t))return;Sm.add(t),ei(t,"format",(r)=>(o)=>rd(r,o)),ei(t,"flatten",(r)=>(o)=>td(r,o)),ei(t,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Jt,2)}),ei(t,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Jt,2)}),Object.defineProperty(t,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},Vv=m("ZodError",Im),Ke=m("ZodError",Im,void 0,{Parent:Error});var Cm=Wt(Ke),Em=Gt(Ke),Om=mo(Ke),jm=go(Ke),_m=id(Ke),Rm=sd(Ke),Am=ad(Ke),Pm=cd(Ke),Tm=ld(Ke),$m=ud(Ke),Nm=dd(Ke),zm=pd(Ke);function Fv(){if(!je.localeError)Re(ba())}function Wn(){if(!je.memoizer)Re({memoizer:vf()})}var Z=m("ZodType",(e,n)=>(Fv(),V.init(e,n),e.def=n,e.type=n.type,e),{check(...e){let n=this.def;return this.clone(Je(n,{checks:[...n.checks??[],...e.map((t)=>typeof t==="function"?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,n){return un(this,e,n)},brand(){return this},register(e,n){return e.add(this,n),this},refine(e,n){return this.check(Eg(e,n))},superRefine(e,n){return this.check(Og(e,n))},overwrite(e){return this.check(vn(e))},optional(){return ni(this)},exactOptional(){return ag(this)},nullable(){return ti(this)},nullish(){return ni(ti(this))},nonoptional(e){return fg(this,e)},array(){return A(this)},or(e){return Q([this,e])},and(e){return Xm(this,e)},transform(e){return Oc(this,Qc(e))},default(e){return ug(this,e)},prefault(e){return pg(this,e)},catch(e){return hg(this,e)},pipe(e){return Oc(this,e)},readonly(){return vg(this)},describe(e){let n=this.clone();return Ve.add(n,{description:e}),n},meta(...e){if(e.length===0)return Ve.get(this);let n=this.clone();return Ve.add(n,e[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...n){return n.length===0?e(this):e(this,...n)},get "~standard"(){return Kt(this,"~standard",{...la(this),jsonSchema:{input:ar(this,"input"),output:ar(this,"output")}})},set "~standard"(e){bn(this,"~standard",e)},parse:function e(n,t){return Cm(this,n,t,{callee:e})},parseAsync:async function e(n,t){return await Em(this,n,t,{callee:e})},safeParse(e,n){return Om(this,e,n)},async safeParseAsync(e,n){return jm(this,e,n)},get spa(){return this?.safeParseAsync},set spa(e){bn(this,"spa",e)},validate(e,n){return ws(this,e,n)},validateAsync(e,n){return vs(this,e,n)},encode:function e(n,t){return _m(this,n,t,{callee:e})},decode:function e(n,t){return Rm(this,n,t,{callee:e})},encodeAsync:async function e(n,t){return await Am(this,n,t,{callee:e})},decodeAsync:async function e(n,t){return await Pm(this,n,t,{callee:e})},safeEncode(e,n){return Tm(this,e,n)},safeDecode(e,n){return $m(this,e,n)},async safeEncodeAsync(e,n){return Nm(this,e,n)},async safeDecodeAsync(e,n){return zm(this,e,n)},toJSONSchema(e){return dm(this,{})(e)},get description(){return Ve.get(this)?.description},get _def(){return this._zod.def}}),jc=m("_ZodString",(e,n)=>{ut.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Za(e,t,r,o)},po({format:(e)=>Se(e).format??null,minLength:(e)=>Se(e).minimum??null,maxLength:(e)=>Se(e).maximum??null},{regex(...e){return this.check(qo(...e))},includes(...e){return this.check(Mo(...e))},startsWith(...e){return this.check(Fo(...e))},endsWith(...e){return this.check(Zo(...e))},min(...e){return this.check(Kn(...e))},max(...e){return this.check(or(...e))},length(...e){return this.check(ir(...e))},nonempty(...e){return this.check(Kn(1,...e))},lowercase(e){return this.check(Lo(e))},uppercase(e){return this.check(Vo(e))},trim(){return this.check(Ko())},normalize(...e){return this.check(Bo(...e))},toLowerCase(){return this.check(Wo())},toUpperCase(){return this.check(Go())},slugify(){return this.check(Ho())}})),_c=m("ZodString",(e,n)=>{ut.init(e,n),jc.init(e,n)},{email(e){return this.check(wa(Rc,e))},url(e){return this.check(To(ri,e))},jwt(e){return this.check(La(Bc,e))},emoji(e){return this.check(Ca(Pc,e))},guid(e){return this.check(va(Ac,e))},uuid(e){return this.check(ka(kn,e))},uuidv4(e){return this.check(xa(kn,e))},uuidv6(e){return this.check(Sa(kn,e))},uuidv7(e){return this.check(Ia(kn,e))},nanoid(e){return this.check(Ea(Tc,e))},cuid(e){return this.check(Oa($c,e))},cuid2(e){return this.check(ja(Nc,e))},ulid(e){return this.check(_a(zc,e))},base64(e){return this.check(za(Zc,e))},base64url(e){return this.check(Da(Jc,e))},xid(e){return this.check(Ra(Dc,e))},ksuid(e){return this.check(Aa(qc,e))},ipv4(e){return this.check(Pa(Lc,e))},ipv6(e){return this.check(Ta(Vc,e))},cidrv4(e){return this.check($a(Mc,e))},cidrv6(e){return this.check(Na(Fc,e))},e164(e){return this.check(qa(Uc,e))},datetime(e){return this.check($o(yt,e))},date(e){return this.check(No(bt,e))},time(e){return this.check(zo(wt,e))},duration(e){return this.check(Do(vt,e))}});function j(e){return If(_c,e)}var ae=m("ZodStringFormat",(e,n)=>{se.init(e,n),jc.init(e,n)}),yt=m("ZodISODateTime",(e,n)=>{pp.init(e,n),ae.init(e,n)}),bt=m("ZodISODate",(e,n)=>{fp.init(e,n),ae.init(e,n)}),wt=m("ZodISOTime",(e,n)=>{mp.init(e,n),ae.init(e,n)}),vt=m("ZodISODuration",(e,n)=>{gp.init(e,n),ae.init(e,n)}),Rc=m("ZodEmail",(e,n)=>{np.init(e,n),ae.init(e,n)});function Zv(e){return wa(Rc,e)}var Ac=m("ZodGUID",(e,n)=>{Xd.init(e,n),ae.init(e,n)});function Jv(e){return va(Ac,e)}var kn=m("ZodUUID",(e,n)=>{ep.init(e,n),ae.init(e,n)});function Uv(e){return ka(kn,e)}function Bv(e){return xa(kn,e)}function Kv(e){return Sa(kn,e)}function Wv(e){return Ia(kn,e)}var ri=m("ZodURL",(e,n)=>{op.init(e,n),ae.init(e,n)});function Gv(e){return To(ri,e)}function Hv(e){return To(ri,{protocol:Ht,hostname:Ms,...C(e)})}var Pc=m("ZodEmoji",(e,n)=>{ip.init(e,n),ae.init(e,n)});function Qv(e){return Ca(Pc,e)}var Tc=m("ZodNanoID",(e,n)=>{sp.init(e,n),ae.init(e,n)});function Yv(e){return Ea(Tc,e)}var $c=m("ZodCUID",(e,n)=>{ap.init(e,n),ae.init(e,n)});function Xv(e){return Oa($c,e)}var Nc=m("ZodCUID2",(e,n)=>{cp.init(e,n),ae.init(e,n)});function ek(e){return ja(Nc,e)}var zc=m("ZodULID",(e,n)=>{lp.init(e,n),ae.init(e,n)});function nk(e){return _a(zc,e)}var Dc=m("ZodXID",(e,n)=>{up.init(e,n),ae.init(e,n)});function tk(e){return Ra(Dc,e)}var qc=m("ZodKSUID",(e,n)=>{dp.init(e,n),ae.init(e,n)});function rk(e){return Aa(qc,e)}var Lc=m("ZodIPv4",(e,n)=>{hp.init(e,n),ae.init(e,n)});function ok(e){return Pa(Lc,e)}var Dm=m("ZodMAC",(e,n)=>{wp.init(e,n),ae.init(e,n)});function ik(e){return Cf(Dm,e)}var Vc=m("ZodIPv6",(e,n)=>{bp.init(e,n),ae.init(e,n)});function sk(e){return Ta(Vc,e)}var Mc=m("ZodCIDRv4",(e,n)=>{vp.init(e,n),ae.init(e,n)});function ak(e){return $a(Mc,e)}var Fc=m("ZodCIDRv6",(e,n)=>{kp.init(e,n),ae.init(e,n)});function ck(e){return Na(Fc,e)}var Zc=m("ZodBase64",(e,n)=>{Sp.init(e,n),ae.init(e,n)});function lk(e){return za(Zc,e)}var Jc=m("ZodBase64URL",(e,n)=>{Ip.init(e,n),ae.init(e,n)});function uk(e){return Da(Jc,e)}var Uc=m("ZodE164",(e,n)=>{Cp.init(e,n),ae.init(e,n)});function dk(e){return qa(Uc,e)}var qm=m("ZodCreditCard",(e,n)=>{Ep.init(e,n),ae.init(e,n)});function pk(e){return Ef(qm,e)}var Lm=m("ZodIBAN",(e,n)=>{Op.init(e,n),ae.init(e,n)});function fk(e){return Of(Lm,e)}var Bc=m("ZodJWT",(e,n)=>{jp.init(e,n),ae.init(e,n)});function mk(e){return La(Bc,e)}var kt=m("ZodCustomStringFormat",(e,n)=>{_p.init(e,n),ae.init(e,n)});function gk(e,n,t={}){return ft(kt,e,n,t)}function hk(e){return ft(kt,"hostname",Vs,e)}function yk(e){return ft(kt,"hex",na,e)}function bk(e){return ft(kt,"currency_code",Zs,e)}function wk(e,n){let t=n?.enc??"hex",r=`${e}_${t}`,o=_n[r];if(!o)throw Error(`Unrecognized hash format: ${r}`);return ft(kt,r,o,n)}var Kc=m("ZodNumber",(e,n)=>{da.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ja(e,t,r,o),e.isFinite=!0},po({minValue:(e)=>{let{minimum:n,exclusiveMinimum:t}=Se(e);return Math.max(n??Number.NEGATIVE_INFINITY,t??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:n,exclusiveMaximum:t}=Se(e);return Math.min(n??Number.POSITIVE_INFINITY,t??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:n,multipleOf:t}=Se(e);return!!n||!!t?.some(Number.isSafeInteger)},format:(e)=>Se(e).format??null},{gt(e,n){return this.check(An(e,n))},gte(e,n){return this.check(rn(e,n))},min(e,n){return this.check(rn(e,n))},lt(e,n){return this.check(Rn(e,n))},lte(e,n){return this.check(tn(e,n))},max(e,n){return this.check(tn(e,n))},int(e){return this.check(we(e))},safe(e){return this.check(we(e))},positive(e){return this.check(An(0,e))},nonnegative(e){return this.check(rn(0,e))},negative(e){return this.check(Rn(0,e))},nonpositive(e){return this.check(tn(0,e))},multipleOf(e,n){return this.check(dt(e,n))},step(e,n){return this.check(dt(e,n))},finite(){return this}}));function ne(e){return jf(Kc,e)}var xt=m("ZodNumberFormat",(e,n)=>{Rp.init(e,n),Kc.init(e,n)});function we(e){return _f(xt,e)}function vk(e){return Rf(xt,e)}function kk(e){return Af(xt,e)}function xk(e){return Pf(xt,e)}function Sk(e){return Tf(xt,e)}var Wc=m("ZodBoolean",(e,n)=>{Eo.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ua(e,t,r,o)});function me(e){return $f(Wc,e)}var Gc=m("ZodBigInt",(e,n)=>{pa.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ba(e,t,r,o)},po({minValue:(e)=>Se(e).minimum??null,maxValue:(e)=>Se(e).maximum??null,format:(e)=>Se(e).format??null},{gte(e,n){return this.check(rn(e,n))},min(e,n){return this.check(rn(e,n))},gt(e,n){return this.check(An(e,n))},lt(e,n){return this.check(Rn(e,n))},lte(e,n){return this.check(tn(e,n))},max(e,n){return this.check(tn(e,n))},positive(e){return this.check(An(BigInt(0),e))},negative(e){return this.check(Rn(BigInt(0),e))},nonpositive(e){return this.check(tn(BigInt(0),e))},nonnegative(e){return this.check(rn(BigInt(0),e))},multipleOf(e,n){return this.check(dt(e,n))}}));function Ik(e){return Nf(Gc,e)}var Hc=m("ZodBigIntFormat",(e,n)=>{Ap.init(e,n),Gc.init(e,n)});function Ck(e){return zf(Hc,e)}function Ek(e){return Df(Hc,e)}var Vm=m("ZodSymbol",(e,n)=>{Pp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ka(e,t,r,o)});function Ok(e){return qf(Vm,e)}var Mm=m("ZodUndefined",(e,n)=>{Tp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ga(e,t,r,o)});function jk(e){return Lf(Mm,e)}var Fm=m("ZodNull",(e,n)=>{$p.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Wa(e,t,r,o)});function Zm(e){return Vf(Fm,e)}var Jm=m("ZodAny",(e,n)=>{Np.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ya(e,t,r,o)});function _k(){return Mf(Jm)}var Um=m("ZodUnknown",(e,n)=>{zp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Xa(e,t,r,o)});function pn(){return Ff(Um)}var Bm=m("ZodNever",(e,n)=>{Dp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Qa(e,t,r,o)});function on(e){return Zf(Bm,e)}var Km=m("ZodVoid",(e,n)=>{qp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ha(e,t,r,o)});function Rk(e){return Jf(Km,e)}var Wm=m("ZodDate",(e,n)=>{Lp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ec(e,t,r,o),e.min=(t,r)=>e.check(rn(t,r)),e.max=(t,r)=>e.check(tn(t,r))},po({minDate:(e)=>{let{minimum:n}=Se(e);return n?new Date(n):null},maxDate:(e)=>{let{maximum:n}=Se(e);return n?new Date(n):null}},{}));function Ak(e){return Uf(Wm,e)}var Gm=m("ZodArray",(e,n)=>{Wn(),Vp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>pc(e,t,r,o),e.element=n.element},{min(e,n){return this.check(Kn(e,n))},nonempty(e){return this.check(Kn(1,e))},max(e,n){return this.check(or(e,n))},length(e,n){return this.check(ir(e,n))},unwrap(){return this.element}});function A(e,n){return Yf(Gm,e,n)}function Pk(e){let n=e._zod.def.shape;return W(Object.keys(n))}var oi=m("ZodObject",(e,n)=>{Wn(),Zp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>fc(e,t,r,o),Sw(e,"shape",(t)=>t._zod.def.shape,!1)},{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Je(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Je(this._zod.def,{catchall:pn()}))},loose(){return this.clone(Je(this._zod.def,{catchall:pn()}))},strict(){return this.clone(Je(this._zod.def,{catchall:on()}))},strip(){return this.clone(Je(this._zod.def,{catchall:void 0}))},extend(e){return gw(this,e)},safeExtend(e){return hw(this,e)},merge(e){return yw(this,e)},pick(e){return fw(this,e)},omit(e){return mw(this,e)},partial(...e){return Bu(si,this,e[0])},exactPartial(...e){return Bu(Yc,this,e[0],"exactPartial")},required(...e){return bw(Xc,this,e[0])}});function E(e,n){let t={type:"object",shape:e??{},...C(n)};return new oi(t)}function k(e,n){return new oi({type:"object",shape:e,catchall:on(),...C(n)})}function Tk(e,n){return new oi({type:"object",shape:e,catchall:pn(),...C(n)})}var ii=m("ZodUnion",(e,n)=>{Oo.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Qo(e,t,r,o),e.options=n.options});function Q(e,n){return new ii({type:"union",options:e,...C(n)})}var Hm=m("ZodXor",(e,n)=>{ii.init(e,n),Jp.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Qo(e,t,r,o),e.options=n.options});function $k(e,n){return new Hm({type:"union",options:e,inclusive:!1,...C(n)})}var Qm=m("ZodDiscriminatedUnion",(e,n)=>{ii.init(e,n),Up.init(e,n)});function sn(e,n,t){return new Qm({type:"union",options:n,discriminator:e,...C(t)})}var Ym=m("ZodIntersection",(e,n)=>{Bp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>mc(e,t,r,o)});function Xm(e,n){return new Ym({type:"intersection",left:e,right:n})}var eg=m("ZodTuple",(e,n)=>{Wn(),fa.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>gc(e,t,r,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((n)=>new si({type:"optional",innerType:n}))})}});function ng(e,n,t){let r=n instanceof V,o=r?t:n;return new eg({type:"tuple",items:e,rest:r?n:null,...C(o)})}var fr=m("ZodRecord",(e,n)=>{Wn(),Kp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>hc(e,t,r,o),e.keyType=n.keyType,e.valueType=n.valueType});function re(e,n,t){if(!n||!n._zod)return new fr({type:"record",keyType:j(),valueType:e,...C(n)});return new fr({type:"record",keyType:e,valueType:n,...C(t)})}function Nk(e,n,t){return new fr({type:"record",keyType:e,valueType:n,...C(t),partial:!0})}function zk(e,n,t){return new fr({type:"record",keyType:e,valueType:n,mode:"loose",...C(t)})}var tg=m("ZodMap",(e,n)=>{Wn(),Wp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>uc(e,t,r,o),e.keyType=n.keyType,e.valueType=n.valueType,e.min=(...t)=>e.check(Pn(...t)),e.nonempty=(t)=>e.check(Pn(1,t)),e.max=(...t)=>e.check(pt(...t)),e.size=(...t)=>e.check(rr(...t))});function Dk(e,n,t){return new tg({type:"map",keyType:e,valueType:n,...C(t)})}var rg=m("ZodSet",(e,n)=>{Wn(),Gp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>dc(e,t,r,o),e.min=(...t)=>e.check(Pn(...t)),e.nonempty=(t)=>e.check(Pn(1,t)),e.max=(...t)=>e.check(pt(...t)),e.size=(...t)=>e.check(rr(...t))});function qk(e,n){return new rg({type:"set",valueType:e,...C(n)})}var mr=m("ZodEnum",(e,n)=>{Hp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(r,o,i)=>nc(e,r,o,i),e.enum=n.entries,e.options=[...e._zod.values];let t=new Set(Object.keys(n.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(t.has(s))i[s]=n.entries[s];else throw Error(`Key ${s} not found in enum`);return new mr({...n,checks:[],...C(o),entries:i})},e.exclude=(r,o)=>{let i={...n.entries};for(let s of r)if(t.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new mr({...n,checks:[],...C(o),entries:i})}});function W(e,n){let t=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new mr({type:"enum",entries:t,...C(n)})}function Lk(e,n){return new mr({type:"enum",entries:e,...C(n)})}var og=m("ZodLiteral",(e,n)=>{Qp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>tc(e,t,r,o),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function w(e,n){return new og({type:"literal",values:Array.isArray(e)?e:[e],...C(n)})}var ig=m("ZodFile",(e,n)=>{Yp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ic(e,t,r,o),e.min=(t,r)=>e.check(Pn(t,r)),e.max=(t,r)=>e.check(pt(t,r)),e.mime=(t,r)=>e.check(Uo(Array.isArray(t)?t:[t],r))});function Vk(e){return Xf(ig,e)}var sg=m("ZodTransform",(e,n)=>{Wn(),Xp.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>lc(e,t,r,o),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new lt(e.constructor.name);t.addIssue=(i)=>{if(typeof i==="string")t.issues.push(Jn(i,t.value,n));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=t.value;s.inst??(s.inst=e),t.issues.push(Jn(s))}};let o=n.transform(t.value,t);if(o instanceof Promise)return o.then((i)=>(t.value=i,t));return t.value=o,t}});function Qc(e){return new sg({type:"transform",transform:e})}var si=m("ZodOptional",(e,n)=>{ma.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Yo(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function ni(e){return new si({type:"optional",innerType:e})}var Yc=m("ZodExactOptional",(e,n)=>{ef.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Yo(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function ag(e){return new Yc({type:"optional",innerType:e})}var cg=m("ZodNullable",(e,n)=>{nf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>yc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function ti(e){return new cg({type:"nullable",innerType:e})}function Mk(e){return ni(ti(e))}var lg=m("ZodDefault",(e,n)=>{tf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>vc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ug(e,n){return new lg({type:"default",innerType:e,get defaultValue(){return typeof n==="function"?n():us(n)}})}var dg=m("ZodPrefault",(e,n)=>{rf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>kc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function pg(e,n){return new dg({type:"prefault",innerType:e,get defaultValue(){return typeof n==="function"?n():us(n)}})}var Xc=m("ZodNonOptional",(e,n)=>{of.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>bc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function fg(e,n){return new Xc({type:"nonoptional",innerType:e,...C(n)})}var mg=m("ZodSuccess",(e,n)=>{sf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>sc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Fk(e){return new mg({type:"success",innerType:e})}var gg=m("ZodCatch",(e,n)=>{af.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>xc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hg(e,n){return new gg({type:"catch",innerType:e,catchValue:typeof n==="function"?n:Hu(n)})}var yg=m("ZodNaN",(e,n)=>{cf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>rc(e,t,r,o)});function Zk(e){return Bf(yg,e)}var ai=m("ZodPipe",(e,n)=>{ga.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Sc(e,t,r,o),e.in=n.in,e.out=n.out});function Oc(e,n){return new ai({type:"pipe",in:e,out:n})}var ci=m("ZodCodec",(e,n)=>{ai.init(e,n),jo.init(e,n)});function Jk(e,n,t){return new ci({type:"pipe",in:e,out:n,transform:t.decode,reverseTransform:t.encode})}function Uk(e){let n=e._zod.def;return new ci({type:"pipe",in:n.out,out:n.in,transform:n.reverseTransform,reverseTransform:n.transform})}var bg=m("ZodPreprocess",(e,n)=>{ai.init(e,n),lf.init(e,n)}),wg=m("ZodReadonly",(e,n)=>{uf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ic(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function vg(e){return new wg({type:"readonly",innerType:e})}var kg=m("ZodTemplateLiteral",(e,n)=>{df.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>oc(e,t,r,o)});function Bk(e,n){return new kg({type:"template_literal",parts:e,...C(n)})}var xg=m("ZodLazy",(e,n)=>{mf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Ec(e,t,r,o),e.unwrap=()=>e._zod.def.getter()});function Sg(e){return new xg({type:"lazy",getter:e})}var Ig=m("ZodPromise",(e,n)=>{ff.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Cc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Kk(e){return new Ig({type:"promise",innerType:e})}var Cg=m("ZodFunction",(e,n)=>{pf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>cc(e,t,r,o)});function Wk(e){return new Cg({type:"function",input:Array.isArray(e?.input)?ng(e?.input):e?.input??A(pn()),output:e?.output??pn()})}var li=m("ZodCustom",(e,n)=>{gf.init(e,n),Z.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ac(e,t,r,o)});function Gk(e){let n=new le({check:"custom"});return n._zod.check=e,n}function Hk(e,n){return em(li,e??(()=>!0),n)}function Eg(e,n={}){return nm(li,e,n)}function Og(e,n){return tm(e,n)}var Qk=rm,Yk=om,jg=m("ZodInstanceOf",(e,n)=>{li.init(e,n)},{properties(e,n){return this.check(Jo(e,n))}});function Xk(e,n={}){let t=new jg({type:"custom",check:"custom",fn:(r)=>r instanceof e,abort:!0,...C(n)});return t._zod.bag.Class=e,t._zod.check=(r)=>{if(!(r.value instanceof e))r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:t,path:[...t._zod.def.path??[]]})},t}var ex=(...e)=>im({Codec:ci,Boolean:Wc,String:_c},...e);function $e(e){let n=Sg(()=>Q([j(e),ne(),me(),Zm(),A(n),re(j(),n)]));return n}function _g(e,n){return new bg({type:"pipe",in:Qc(e),out:n})}var gr={};no(gr,{ZodISODate:()=>bt,ZodISODateTime:()=>yt,ZodISODuration:()=>vt,ZodISOTime:()=>wt,date:()=>tx,datetime:()=>nx,duration:()=>ox,time:()=>rx});function nx(e){return $o(yt,e)}function tx(e){return No(bt,e)}function rx(e){return zo(wt,e)}function ox(e){return Do(vt,e)}var T={...el,...Xo,iso:gr},ix=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function sx(e,n){let t=e.$schema;if(t==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(t==="http://json-schema.org/draft-07/schema#")return"draft-7";if(t==="http://json-schema.org/draft-04/schema#")return"draft-4";return n??"draft-2020-12"}function Rg(e,n){return e.map((t,r)=>r<n?t:t.optional())}function ax(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function cx(e,n){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let t=e.slice(1).split("/").filter(Boolean);if(t.length===0)return n.rootSchema;let r=n.version==="draft-2020-12"?"$defs":"definitions";if(t[0]===r){let o=t[1]===void 0?void 0:ax(t[1]);if(!o||!n.defs[o])throw Error(`Reference not found: ${e}`);return n.defs[o]}throw Error(`Reference not found: ${e}`)}function lx(e,n){return T.transform((r)=>r).check((r)=>{let o=r.value;if(typeof o!=="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(n.minProperties!==void 0&&i.length<n.minProperties)r.issues.push({origin:"object",code:"too_small",minimum:n.minProperties,inclusive:!0,message:`Too small: expected object to have >=${n.minProperties} properties`,input:o,inst:e,continue:!0});if(n.maxProperties!==void 0&&i.length>n.maxProperties)r.issues.push({origin:"object",code:"too_big",maximum:n.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${n.maxProperties} properties`,input:o,inst:e,continue:!0});if(n.keySchema)for(let s of i){let a=n.keySchema.safeParse(s);if(a.success)continue;r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function nl(e,n){if(e===null)return"z";let t=typeof e;if(t!=="object"){if(t==="number"&&Number.isNaN(e))return null;let r=String(e);return`${t[0]}${r.length}:${r}`}if(n.has(e))return null;n.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=nl(s,n);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let s=nl(e[i],n);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{n.delete(e)}}var ux=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),dx=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function hr(e){if(typeof e!=="object"||e===null)return!1;if(Array.isArray(e))return e.some(hr);if(typeof e.$ref==="string")return!0;return Object.entries(e).some(([n,t])=>{if(ux.has(n))return hr(t);if(!dx.has(n)||typeof t!=="object"||t===null)return!1;return Object.values(t).some(hr)})}function Ag(e){return e===1?"element":"elements"}function px(e,n){return T.transform((r)=>r).check((r)=>{let o=r.value;if(!Array.isArray(o))return;if(n.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=nl(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(n.containsSchema){let i=n.minContains??1,s=n.maxContains!==void 0?n.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(n.containsSchema.safeParse(c).success&&++a>=s)break;if(a<i)r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Ag(i)}; found ${a}`,input:o,continue:!0});if(n.maxContains!==void 0&&a>n.maxContains)r.issues.push({code:"custom",message:`Array must contain at most ${n.maxContains} matching ${Ag(n.maxContains)}`,input:o,continue:!0})}}).pipe(e)}function Pg(e,n){if(e===!1)return;if(e===void 0||e===!0)return T.any();return Ne(e,n)}var fx=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Tg(e,n){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return T.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(n.refs.has(o))return n.refs.get(o);if(n.processing.has(o))return T.lazy(()=>{if(!n.refs.has(o))throw Error(`Circular reference not resolved: ${o}`);return n.refs.get(o)});n.processing.add(o);let i=cx(o,n),s=Ne(i,n);return n.refs.set(o,s),n.processing.delete(o),s}if(e.enum!==void 0){let o=e.enum;if(n.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return T.null();if(o.length===0)return T.never();if(o.length===1)return T.literal(o[0]);if(o.every((s)=>typeof s==="string"))return T.enum(o);let i=o.map((s)=>T.literal(s));if(i.length<2)return i[0];return T.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return T.literal(e.const);let t=e.type;if(Array.isArray(t)){let o=t.map((i)=>{let s={...e,type:i};return Tg(s,n)});if(o.length===0)return T.never();if(o.length===1)return o[0];return T.union(o)}if(!t)return T.any();let r;switch(t){case"string":{let o=T.string();if(e.format){let i=e.format;if(i==="email")o=o.check(T.email());else if(i==="uri"||i==="uri-reference")o=o.check(T.url());else if(i==="uuid"||i==="guid")o=o.check(T.uuid());else if(i==="date-time")o=o.check(T.iso.datetime({offset:!0}));else if(i==="date")o=o.check(T.iso.date());else if(i==="time")o=o.check(T.regex(fx));else if(i==="duration")o=o.check(T.iso.duration());else if(i==="hostname")o=o.check(T.hostname());else if(i==="ipv4")o=o.check(T.ipv4());else if(i==="ipv6")o=o.check(T.ipv6());else if(i==="mac")o=o.check(T.mac());else if(i==="cidr")o=o.check(T.cidrv4());else if(i==="cidr-v6")o=o.check(T.cidrv6());else if(i==="base64")o=o.check(T.base64());else if(i==="base64url")o=o.check(T.base64url());else if(i==="e164")o=o.check(T.e164());else if(i==="credit_card")o=o.check(T.creditCard());else if(i==="iban")o=o.check(T.iban());else if(i==="jwt")o=o.check(T.jwt());else if(i==="emoji")o=o.check(T.emoji());else if(i==="nanoid")o=o.check(T.nanoid());else if(i==="cuid")o=o.check(T.cuid());else if(i==="cuid2")o=o.check(T.cuid2());else if(i==="ulid")o=o.check(T.ulid());else if(i==="xid")o=o.check(T.xid());else if(i==="ksuid")o=o.check(T.ksuid())}if(typeof e.minLength==="number")o=o.min(e.minLength);if(typeof e.maxLength==="number")o=o.max(e.maxLength);if(e.pattern)o=o.regex(new RegExp(e.pattern));r=o;break}case"number":case"integer":{let o=t==="integer"?T.number().int():T.number();if(typeof e.minimum==="number"&&e.exclusiveMinimum!==!0)o=o.min(e.minimum);if(typeof e.maximum==="number"&&e.exclusiveMaximum!==!0)o=o.max(e.maximum);if(typeof e.exclusiveMinimum==="number")o=o.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")o=o.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")o=o.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")o=o.lt(e.maximum);if(typeof e.multipleOf==="number")o=o.multipleOf(e.multipleOf);r=o;break}case"boolean":{r=T.boolean();break}case"null":{r=T.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties==="object"?Ne(e.additionalProperties,n):void 0;for(let[d,g]of Object.entries(i)){let h=Ne(g,n);_e(o,d,s.has(d)?h:h.optional())}if(e.patternProperties){let d=e.patternProperties,g=Object.keys(d),h=[];for(let S of g){let R=Ne(d[S],n),N=T.string().regex(new RegExp(S));h.push(T.looseRecord(N,R))}let y=[];if(Object.keys(o).length>0)y.push(T.object(o).passthrough());if(y.push(...h),y.length===0)r=T.object({}).passthrough();else if(y.length===1)r=y[0];else{let S=T.intersection(y[0],y[1]);for(let R=2;R<y.length;R++)S=T.intersection(S,y[R]);r=S}if(e.additionalProperties===!1){let S=Object.keys(o),R=g.map((D)=>new RegExp(D)),N=r;r=r.check((D)=>{if(!wn(D.value))return;let L=[];for(let Oe of Object.keys(D.value)){if(S.includes(Oe))continue;if(R.some((fe)=>fe.test(Oe)))continue;L.push(Oe)}if(L.length)D.issues.push({code:"unrecognized_keys",keys:L,input:D.value,inst:N})})}}else{let d=T.object(o);if(e.additionalProperties===!1)r=d.strict();else if(a)r=d.catchall(a);else r=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties==="number"?e.minProperties:void 0,u=typeof e.maxProperties==="number"?e.maxProperties:void 0;if(c||l!==void 0||u!==void 0){let d;if(c){let g=typeof e.propertyNames==="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Ne(g,n)}r=lx(r,{keySchema:d,minProperties:l,maxProperties:u})}break}case"array":{let{prefixItems:o,items:i}=e;if(o&&Array.isArray(o)){let s=typeof e.minItems==="number"?e.minItems:0,a=o.map((d)=>Ne(d,n)),c=Rg(a,s),l=!Array.isArray(i)?Pg(i,n):void 0,u=T.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(T.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(T.maxLength(e.maxItems))}else if(Array.isArray(i)){let s=typeof e.minItems==="number"?e.minItems:0,a=i.map((d)=>Ne(d,n)),c=Rg(a,s),l=Pg(e.additionalItems,n),u=T.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(T.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(T.maxLength(e.maxItems))}else if(i!==void 0){let s=Ne(i,n),a=T.array(s);if(typeof e.minItems==="number")a=a.min(e.minItems);if(typeof e.maxItems==="number")a=a.max(e.maxItems);r=a}else r=T.array(T.any());if(e.uniqueItems===!0||e.contains!==void 0)r=px(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Ne(e.contains,n):void 0,minContains:typeof e.minContains==="number"?e.minContains:void 0,maxContains:typeof e.maxContains==="number"?e.maxContains:void 0});break}default:throw Error(`Unsupported type: ${t}`)}return r}function Ne(e,n){if(typeof e==="boolean")return e?T.any():T.never();let t=Tg(e,n),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map((l)=>Ne(l,n)),c=T.union(a);t=r?T.intersection(t,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map((l)=>Ne(l,n)),c=T.xor(a);t=r?T.intersection(t,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)t=r?t:T.any();else{let a=r?t:Ne(e.allOf[0],n),c=r?0:1;for(let l=c;l<e.allOf.length;l++)a=T.intersection(a,Ne(e.allOf[l],n));t=a}if(e.nullable===!0&&n.version==="openapi-3.0")t=T.nullable(t);if(e.readOnly===!0)t=T.readonly(t);if(e.default!==void 0)t=t.default(e.default);let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)if(a in e)o[a]=e[a];let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)if(a in e)o[a]=e[a];if(e.type==="object"&&e.$ref===void 0){if(e.propertyNames!==void 0&&!hr(e.propertyNames))o.propertyNames=e.propertyNames;for(let a of["minProperties","maxProperties"])if(e[a]!==void 0)o[a]=e[a]}if(e.type==="array"&&e.$ref===void 0){if(e.contains!==void 0&&!hr(e.contains))o.contains=e.contains;for(let a of["uniqueItems","minContains","maxContains"])if(e[a]!==void 0)o[a]=e[a]}for(let a of Object.keys(e))if(!ix.has(a))_e(o,a,e[a]);if(Object.keys(o).length>0)n.registry.add(t,o);if(e.description)t=t.describe(e.description);return t}function $g(e,n){if(typeof e==="boolean")return e?T.any():T.never();let t;try{t=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=sx(t,n?.defaultTarget),o=t.$defs||t.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:t,registry:n?.registry??Ve};return Ne(t,i)}var Ng=0;function Tn(){let e=Ng;return Ng+=1,e}function It(e){if(typeof e==="object"&&e!==null&&!Object.isFrozen(e)){for(let n of Object.getOwnPropertyNames(e)){let t=Reflect.get(e,n);It(t)}Object.freeze(e)}return e}function tl(e,n){let t={};for(let r of n)if(r in e)t[r]=e[r];return t}function ui(e){if(typeof e!=="object"||e===null)return e;else if(Array.isArray(e)){let n=[];for(let[t,r]of e.entries())n[t]=ui(r);return n}else{let n={};for(let t in e)n[t]=ui(e[t]);return n}}function St(e,n){if(e===n)return!0;if(e===null)return!1;if(typeof e!=="object")return!1;if(typeof e!==typeof n)return!1;if(Array.isArray(e)){if(!Array.isArray(n))return!1;if(e.length!==n.length)return!1;for(let[t,r]of e.entries())if(!St(r,n[t]))return!1}else{if(Array.isArray(n))return!1;for(let t in e){if(!(t in n))return!1;if(!St(e[t],n[t]))return!1}for(let t in n)if(!(t in e))return!1}return!0}var b=Object.freeze({Equals:0,Containing:1,ContainedBy:2,Rejection:3,Intersection:4}),K=$n(b.Equals),M=$n(b.Containing),J=$n(b.ContainedBy),G=$n(b.Rejection),X=$n(b.Intersection),xn=It([[b.Equals,K],[b.Containing,M],[b.ContainedBy,J],[b.Rejection,G],[b.Intersection,X]]),de=0,We=(()=>{let e=de;for(let[n,t]of xn)e|=t;return e})();function yr(e){return!!(e&K)}function br(e){return!!(e&M)}function wr(e){return!!(e&J)}function vr(e){return!!(e&G)}function kr(e){return!!(e&X)}function $n(e){return 1<<e}function rl(e){let n=de,t=0,r={push:(o)=>{if(t===0)n=o;else n=mx(n,o,e);return t+=1,n}};return Object.defineProperties(r,{result:{get:()=>n},count:{get:()=>t}}),r}function mx(e,n,t){let r=de;for(let[o,i]of xn)if(i&e){for(let[s,a]of xn)if(a&n){if(r|=t(o,s),r===We)return r}}return r}var ge=Object.freeze({Save:0,OneOf:1,AllOf:2,AnyOf:3,Not:4,Swap:5});function zg(e,n){switch(e){case ge.Save:return n[0];case ge.OneOf:return gx(n);case ge.AllOf:case ge.AnyOf:return xr(e,n);case ge.Not:case ge.Swap:return ol(e,n[0])}}function Nn(e){return ol(ge.Swap,e)}function gx(e){if(e.length===1)return e[0];let n=xr(ge.AnyOf,e),t=[];for(let i=0;i<e.length;++i)for(let s=i+1;s<e.length;++s){let a=e[i],c=e[s],l=xr(ge.AllOf,[a,c]);t.push(l)}let r=xr(ge.AnyOf,t),o=ol(ge.Not,r);return xr(ge.AllOf,[n,o])}function xr(e,n){if(n.length<0)throw Error("invalid expressions: empty array");let t;switch(e){case ge.AllOf:{t=rl(hx);break}case ge.AnyOf:{t=rl(yx);break}default:throw Error(`invalid operator ${e}`)}for(let r of n)t.push(r);return t.result}function ol(e,n){let t,r=de;switch(e){case ge.Not:{t=bx;break}case ge.Swap:{t=wx;break}default:throw Error(`invalid operator ${e}`)}for(let[o,i]of xn)if(i&n)r|=t(o);return r}function hx(e,n){let t=de;switch(e){case b.Equals:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=K;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=de;break}case b.Intersection:{t=J;break}}break}case b.Containing:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=K|M;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=G;break}case b.Intersection:{t=X|J;break}}break}case b.ContainedBy:{switch(n){case b.Equals:{t=J;break}case b.Containing:{t=J;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=de;break}case b.Intersection:{t=J;break}}break}case b.Rejection:{switch(n){case b.Equals:{t=de;break}case b.Containing:{t=G;break}case b.ContainedBy:{t=de;break}case b.Rejection:{t=G;break}case b.Intersection:{t=G;break}}break}case b.Intersection:{switch(n){case b.Equals:{t=J;break}case b.Containing:{t=X|J;break}case b.ContainedBy:{t=J;break}case b.Rejection:{t=G;break}case b.Intersection:{t=J|G|X;break}}break}}return t}function yx(e,n){let t=de;switch(e){case b.Equals:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=M;break}case b.ContainedBy:{t=K;break}case b.Rejection:{t=M;break}case b.Intersection:{t=M;break}}break}case b.Containing:{switch(n){case b.Equals:{t=M;break}case b.Containing:{t=M;break}case b.ContainedBy:{t=M;break}case b.Rejection:{t=M;break}case b.Intersection:{t=M;break}}break}case b.ContainedBy:{switch(n){case b.Equals:{t=K;break}case b.Containing:{t=M;break}case b.ContainedBy:{t=K|J;break}case b.Rejection:{t=X;break}case b.Intersection:{t=M|X;break}}break}case b.Rejection:{switch(n){case b.Equals:{t=M;break}case b.Containing:{t=M;break}case b.ContainedBy:{t=X;break}case b.Rejection:{t=G;break}case b.Intersection:{t=X;break}}break}case b.Intersection:{switch(n){case b.Equals:{t=M;break}case b.Containing:{t=M;break}case b.ContainedBy:{t=M|X;break}case b.Rejection:{t=X;break}case b.Intersection:{t=M|X;break}}break}}return t}function bx(e){let n=de;switch(e){case b.Equals:{n=G;break}case b.Containing:{n=G;break}case b.ContainedBy:{n=X;break}case b.Rejection:{n=K|M;break}case b.Intersection:{n=J|X;break}}return n}function wx(e){let n=de;switch(e){case b.Equals:{n=K;break}case b.Containing:{n=J;break}case b.ContainedBy:{n=M;break}case b.Rejection:{n=G;break}case b.Intersection:{n=X;break}}return n}var Me=Object.freeze({Leaf:0,Not:1,AllOf:2,AnyOf:3,OneOf:4});var il=(e)=>(n,t)=>{let r={parent:null,swapped:!1,expressions:null,calculation:{operator:ge.Save,results:[de],willSwap:!1,count:0}},o=[{parent:{node:r,index:0},swapped:!1,expressions:[n,t],calculation:null}],i=[];while(o.length>0||i.length>0){while(o.length>0){let u=o.pop();s(u)}while(i.length>0){let u=i.pop();c(u)}}function s(u){let d=K,[g,h]=u.expressions;if(!e.equals(g,h)){let y=e.describe(g);if(y.kind!==Me.Leaf){let[N,D]=a(y,!1);u.expressions=null,u.calculation=N;for(let[L,Oe]of D.entries())o.push({parent:{node:u,index:L},swapped:u.swapped,expressions:[Oe,h],calculation:null});return}let S=e.describe(h);if(S.kind!==Me.Leaf){let[N,D]=a(S,!0);u.expressions=null,u.calculation=N;for(let[L,Oe]of D.entries())o.push({parent:{node:u,index:L},swapped:!u.swapped,expressions:[Oe,g],calculation:null});return}if(d=e.calculate(g,h),e.observeCalculation?.(g,h,d,u.swapped),d===de)throw Error("cannot response expression as none")}u.expressions=null,u.calculation={operator:ge.Save,results:[d],willSwap:!1,count:0},i.push(u)}function a(u,d){let g=ge.Save,h;switch(u.kind){case Me.Not:{g=ge.Not,h=[u.expression];break}case Me.AllOf:{g=ge.AllOf,h=[...u.expressions];break}case Me.AnyOf:{g=ge.AnyOf,h=[...u.expressions];break}case Me.OneOf:{g=ge.OneOf,h=[...u.expressions];break}default:throw Error(`invalid kind ${u.kind}`)}return[{operator:g,willSwap:d,count:0,results:Array(h.length).fill(-1)},h]}function c(u){let{calculation:d,parent:g}=u,h=zg(d.operator,d.results);if(h===de)h=J;if(d.willSwap)h=Nn(h);if(g){let y=g.node.calculation,S=y.results;if(S[g.index]=h,y.count+=1,y.count>=S.length)i.push(g.node)}}let l=r.calculation.results[0];if(l===0)throw Error("cannot find result of root");return l};class di extends Error{constructor(e=[]){super(vx(e));this.name="SchemaError",this.items=e}}var Ct=Object.freeze({Compiled:0,External:1});function Et(e){switch(e.kind){case Ct.Compiled:{let{message:n,path:t}=e;return`${n} (at ${t.length>0?t.join("."):"$root"})`}case Ct.External:return String(e.error)}}function vx(e){switch(e.length){case 0:return"without any items";case 1:return Et(e[0]);default:return`${Et(e[0])} ... omit the rest ${e.length-1} items`}}var kx=new Set(["type","enum","const","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","items","additionalItems","maxItems","minItems","uniqueItems","contains","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames","if","then","else","allOf","anyOf","oneOf","not","format","contentMediaType","contentEncoding","definitions"]);function fn(e){return kx.has(e)}function Dg(e){for(let n in e)if(fn(n))return!1;return!0}function ze(e,...n){return{...e,path:[...e.path,...n]}}function Fe(e){if(typeof e==="boolean")throw Error("JSONSchema7Definition cannot be boolean");return e}function zn({path:e,errors:n},t,...r){n.push(qg(e,r,t))}function ee({path:e,warns:n},t,...r){n.push(qg(e,r,t))}function qg(e,n,t){return{kind:Ct.Compiled,message:t,path:[...e,...n]}}function pi(e){for(let n in e){let t=e[n];if(t===void 0)delete e[n];else if(t&&typeof t==="object"){if(Array.isArray(t)){if(t.length===0)delete e[n]}else if(xx(t))delete e[n]}}return e}function xx(e){for(let n in e)return!1;return!0}var Sr=Symbol("compiledId"),sl=Symbol("compiledKind"),al=Symbol("compiledPath"),Lg=Symbol("validatorLoader"),I=Object.freeze({Extends:0,Never:1,Any:2,Null:3,String:4,Numeric:5,Boolean:6,Object:7,Array:8,Not:9,Combination:10,EnumOrConst:11}),Dn=It(fi(I.Any,Tn(),{},()=>()=>!0)),Ir=It(fi(I.Never,Tn(),{type:"string",maxLength:0,minLength:1},()=>()=>!1));function Cr(e){if(e===null||typeof e!=="object")return!1;return Sr in e}function Ze(e){if(e===null||typeof e!=="object")return!1;return Sr in e&&sl in e}function Y(e){if(Ze(e))return e[sl];else return I.Extends}function Gn(e){if(Ze(e)||Cr(e))return e[Sr];else return e.id}function cl(e){return Ze(e)?e[al]:void 0}function ll(e){if(e===null||typeof e!=="object")return e;return Object.defineProperty(e,Sr,{value:Tn(),configurable:!1,writable:!1,enumerable:!1}),e}function ye(e,n,t,r=[]){return fi(e,Tn(),n,t&&(()=>t.compile(n)),r)}function Er(e){return fi(I.Never,Tn(),{...e},e[Lg],e[al])}function fi(e,n,t,r,o=[]){let i=null;return Object.defineProperties(t,{[sl]:{value:e,configurable:!1,writable:!1,enumerable:!1},[Sr]:{value:n,configurable:!1,writable:!1,enumerable:!1},[al]:{value:o,configurable:!1,writable:!1,enumerable:!1},[Lg]:{value:r,configurable:!1,writable:!1,enumerable:!1},isValid:{configurable:!1,enumerable:!1,get:()=>{if(r){if(!i)i=r();return i}else return}}}),t}function Fg(e,n){let t=Sx(e,n),r=Vg(e,"maxItems",n),o=Vg(e,"minItems",n),i=Ix(e,n),s=n.uniqueItems,a;if(Array.isArray(t))a=Cx(e,n);else if(n.additionalItems)ee(e,"it is needless when items is not array","additionalItems");if(!t||!i||a===null)return null;let c=!1,l=!1;if(Array.isArray(t)){if(r!==void 0&&r<=t.length)t=t.splice(r),a=Mg(a,e.delegate);let g=t.findIndex((h)=>Y(h)===I.Never);if(g!==-1){if(t=t.splice(g),a=Mg(a,e.delegate),r===void 0)r=t.length,l=!0}if(o!==void 0&&t.length<o)ee(e,`length(${t.length}) of items if less than minItems(${o})`),c=!0;if(t.length===0&&a&&Y(a)===I.Never)c=!0}else if(Y(t)===I.Never)c=!0;if(r!==void 0&&o!==void 0&&r<o){if(!l)ee(e,`maxItems(${r}) is less than minItems(${o})`);c=!0}let u=c?I.Never:I.Array,d=pi({type:"array",items:t,contains:i,uniqueItems:s,maxItems:r,minItems:o,additionalItems:a});return ye(u,d,e.delegate,e.path)}function Sx(e,{items:n}){if(!n)return ye(I.Any,{},e.delegate,e.path);if(Array.isArray(n)){let t=[],r=!1;for(let[o,i]of n.entries()){let s=ze(e,"items",o),a=De(s,Fe(i));if(!a){r=!0;continue}t.push(a)}if(r)return null;return t}else{let t=ze(e,"items"),r=Fe(n);return De(t,r)}}function Vg(e,n,t){let r=t[n];if(r===void 0)return;if(Number.isNaN(r)){ee(e,"find NaN",n);return}if(r<0){ee(e,`find invalid number ${r}`,n);return}return r}function Ix(e,{contains:n}){if(!n)return ye(I.Any,{},e.delegate,e.path);let t=ze(e,"contains"),r=Fe(n);return De(t,r)}function Cx(e,{additionalItems:n}){switch(typeof n){case"boolean":if(n)return ye(I.Any,{},e.delegate,e.path);else return!1;case"object":{let t=ze(e,"additionalItems");return De(t,n)}default:return ye(I.Any,{},e.delegate,e.path)}}function Mg(e,n){if(e===void 0)return ye(I.Never,{type:"string",maxLength:0,minLength:1},n);else if(Ze(e))return Y(e)===I.Never?e:Er(e);else return e}var Zg=Object.freeze(["allOf","anyOf","oneOf"]);function ul(e,n,t,r){if(t.length===0)return zn(e,"disable empty list",n),null;let o=[];for(let[c,l]of t.entries()){let u=ze(e,n,c),d=Fe(l),g=De(u,d);if(g)o.push(g)}if(o.length<t.length)return null;let i=0,s=0;for(let c of o)switch(Y(c)){case I.Any:{i+=1;break}case I.Never:{s+=1;break}}let a=I.Combination;switch(n){case"allOf":{if(s>0)a=I.Never;else if(i===o.length)a=I.Any;else if(!Ex(o))a=I.Never;break}case"anyOf":{if(i>0)a=I.Any;else if(s===o.length)a=I.Never;break}case"oneOf":{if(i>1)a=I.Never;else if(s===o.length)a=I.Never;else if(i===1&&s===o.length-1)a=I.Any;break}}return ye(a,{[n]:o},r,e.path)}function Ex(e){let n=null;for(let t of e){let r=Y(t);switch(r){case I.Any:case I.Never:break;default:{if(n===null)n=r;else if(n!==r)return!1;break}}}return!0}var Ae=Object.freeze({Valid:0,Invalid:1,Unknown:2});function mn(e,n){let t=e.isValid;if(t)if(t(n)===!0)return Ae.Valid;else return Ae.Invalid;else return Ae.Unknown}function Jg(e,n,t,r){let o,i=!1;if(n){if(n.length===0)return zn(e,"disable empty list","enum"),null;o=[];for(let[c,l]of n.entries())switch(mn(r,l)){case Ae.Valid:{o.push(ll(l));break}case Ae.Invalid:{ee(e,"cannot pass JSON schema of currently schema object","enum",c);break}}if(o.length===0)ee(e,"all of elements from list is rejected by currently schema object","enum")}if(t!==void 0&&mn(r,t)===Ae.Invalid)i=!0;if(o){if(o.length===0)i=!0;else if(t!==void 0){let c=!1;for(let l of o)if(St(l,t)){c=!0;break}if(!c)i=!0}}let s=i?I.Never:I.EnumOrConst,a={};if(r.type)a.type=r.type;if(o)a.enum=o;if(t!==void 0)a.const=ll(ui(t));return ye(s,a,e.delegate,e.path)}var Ox=new Set(["type","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames"]);function Bg(e,n){let t=Object.keys(n).filter((y)=>!Ox.has(y)&&fn(y));if(t.length>0)ee(e,`type="object" will exclude other keys: ${t.toSorted().join(", ")}`);let r=Ug(e,"maxProperties",n),o=Ug(e,"minProperties",n),i=jx(e,n),s=_x(e,n),a=Rx(e,n),c=Px(e,n);if(!i||!s||!a||!c)return null;let l=Ax(e,s,a,n);if(!l)return null;let u=Tx(i,s,a,l),d=$x(e,u,c,n),g=Nx(e,i,l,d,r,o)?I.Never:I.Object,h=pi({type:"object",required:d,properties:l,minProperties:o,maxProperties:r,additionalProperties:i,patternProperties:qx(s),dependencies:Lx(c,n),propertyNames:a});return ye(g,h,e.delegate,e.path)}function Ug(e,n,t){let r=t[n];if(r===void 0)return;if(Number.isNaN(r)){ee(e,"find NaN",n);return}if(r<0){ee(e,`find invalid number ${r}`,n);return}return r}function jx(e,{additionalProperties:n}){if(n===!1)return ye(I.Never,{type:"string",maxLength:0,minLength:1},e.delegate,e.path);if(typeof n!=="object")return ye(I.Any,{},e.delegate,e.path);let t=ze(e,"additionalProperties"),r=Fe(n);return De(t,r)}function _x(e,{patternProperties:n}){let t=!1,r={};for(let o in n){let i=Dx(o);if(i instanceof Error){ee(e,`property name invalid. ${o}`,"patternProperties",o);continue}let s=Fe(n[o]),a=ze(e,"patternProperties",o),c=De(a,s);if(!c){t=!0;continue}r[o]=[c,i]}if(t)return null;return r}function Rx(e,{propertyNames:n}){if(!n)return ye(I.Any,{},e.delegate,e.path);n=Fe(n);let t=ze(e,"propertyNames"),r=De(t,n);if(!r)return null;let o=Y(r);if(o!==I.String&&o!==I.Any)return Er(r);return r}function Ax(e,n,t,{properties:r}){let o=!1;if(!r)return{};let i={};for(let s in r){if(mn(t,s)===Ae.Invalid){ee(e,`key ${JSON.stringify(s)} cannot pass JSON schema from propertyNames`,"properties");continue}let a=Wg(n,s);if(a&&Y(a)===I.Never){ee(e,`key ${JSON.stringify(s)} matches a pattern that has a impossible(never) schema`,"properties");continue}let c=Fe(r[s]),l=ze(e,"properties",s),u=De(l,c);if(!u){o=!0;continue}i[s]=u}if(o)return null;return i}function Px(e,{dependencies:n}){if(!n)return[{},{}];let t={},r={};for(let o in n){let i=Fe(n[o]);if(Array.isArray(i)){let{keys:s,duplicated:a}=Kg(i);if(a)ee(e,`found duplicated property names: ${a.join(", ")}`,"dependencies",o);t[o]=s}else{let s=ze(e,"dependencies",o),a=De(s,i);if(a){let c=Y(a);if(c===I.Object||c===I.Any)r[o]=a;else if(c===I.Extends)r[o]=Ir;else r[o]=Er(a)}}}return[t,r]}function Tx(e,n,t,r){return(o)=>{if(mn(t,o)===Ae.Invalid)return!0;let i=Wg(n,o);if(i&&Y(i)===I.Never)return!0;let s=r[o]??e;if(Y(s)===I.Never)return!0;return!1}}function $x(e,n,t,{required:r}){if(!r)return[];let o=Kg(r);if(o.duplicated)ee(e,`found duplicated required keys: ${o.duplicated.join(", ")}`,"required");let i=[],s=[];for(let a of o.keys)if(zx(t,a).some((l)=>n(l)))s.push(a);else i.push(a);if(s.length>0)ee(e,`key ${s.map((a)=>JSON.stringify(a)).join(", ")} will ban by another condition`,"required");return i}function Nx(e,n,t,r,o,i){if(o!==void 0&&i!==void 0&&o<i)return ee(e,`maxProperties(${o}) is less than minProperties(${i})`),!0;if(o!==void 0&&r.length>o)return ee(e,`length(${r.length}) of required is greater than maxProperties(${o})`),!0;if(i!==void 0&&r.length<i)return ee(e,`length(${r.length}) of required is less than minProperties(${i})`),!0;if(Y(n)!==I.Never)return!1;for(let s in t){let a=t[s];if(Y(a)!==I.Never)return!1}return!0}function zx([e,n],t){let r=[t],o=new Set(r);while(r.length>0){let s=r.pop(),a=n[s],c=e[s];if(a){if(Y(a)===I.Object)i(a.required)}if(c)i(c)}function i(s){if(s){for(let a of s)if(!o.has(a))o.add(a),r.push(a)}}return[...o]}function Kg(e){let n=new Set,t=new Set;for(let r of e)if(n.has(r))t.add(r);else n.add(r);if(t.size===0)return{keys:[...e],duplicated:null};else return{keys:[...n],duplicated:[...t]}}function Wg(e,n){for(let t in e){let[r,o]=e[t];if(o.test(n))return r}return null}function Dx(e){try{return new RegExp(e,"i")}catch(n){if(n instanceof SyntaxError)return n;else throw n}}function qx(e){let n={};for(let t in e)n[t]=e[t][0];return n}function Lx([e,n],{dependencies:t}){let r={};for(let o in t){let i=e[o],s=n[o];r[o]=i||s}return r}var dl=new Set(["type","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum"]),Gg=new Set(["type","format","maxLength","minLength","pattern"]);function Qg(e,n){let{type:t}=n;switch(t){case"number":case"integer":return Vx(e,n);case"string":return Fx(e,n);case"boolean":case"null":{let r=Object.keys(n).filter((s)=>fn(s)&&s!=="type");if(r.length>0)ee(e,`key "type" will exclude other keys: ${r.toSorted().join(", ")}`);let o=t==="null"?I.Null:I.Boolean;return ye(o,{type:t},e.delegate,e.path)}default:return zn(e,`invalid type ${JSON.stringify(t)}`),null}}function Vx(e,n){let t=Object.keys(n).filter((u)=>!dl.has(u)&&fn(u));if(t.length>0)ee(e,`type=${JSON.stringify(n.type)} will exclude other keys: ${t.toSorted().join(", ")}`);let r=tl(n,dl);for(let u of dl){let d=r[u];if(u!=="type"&&d!==void 0&&Number.isNaN(d))ee(e,"found NaN",u),delete r[u]}let{maximum:o,exclusiveMaximum:i,minimum:s,exclusiveMinimum:a}=r;if(o!==void 0&&i!==void 0){if(o===i)delete r.maximum;else if(o<i)delete r.exclusiveMaximum;else if(o>i)delete r.maximum}if(s!==void 0&&a!==void 0){if(s===a)delete r.minimum;else if(s<a)delete r.exclusiveMinimum;else if(s>a)delete r.minimum}let{multipleOf:c}=r;if(c===0)delete r.multipleOf,r.type="number",ee(e,"cannot be 0","multipleOf");let l=I.Numeric;if(!Mx(r))l=I.Never;return ye(l,r,e.delegate,e.path)}function Mx(e){let{maximum:n,exclusiveMaximum:t,minimum:r,exclusiveMinimum:o}=e;if(n!==void 0&&r!==void 0)return n>=r;else if(t!==void 0&&r!==void 0)return t>r;else if(n!==void 0&&o!==void 0)return n>o;else if(t!==void 0&&o!==void 0)return t>o;else return!0}function Fx(e,n){let t=Object.keys(n).filter((a)=>!Gg.has(a)&&fn(a));if(t.length>0)ee(e,`type="string" will exclude other keys: ${t.toSorted().join(", ")}`);let r=tl(n,Gg);Hg(e,r,"maxLength"),Hg(e,r,"minLength");let{maxLength:o,minLength:i}=r,s=I.String;if(o!==void 0){if(o<0)s=I.Never;else if(o!==void 0&&i!==void 0&&o<i)s=I.Never}return ye(s,r,e.delegate,e.path)}function Hg(e,n,t){let r=n[t];if(r!==void 0){if(Number.isNaN(r))ee(e,"found NaN",t),delete n[t]}}var Yg=Object.freeze([]);function mi(e,n,t,r){if(Ze(e))return{schema:e,warns:Yg};if(n.isExtendsSchema(e))return{schema:e,warns:Yg};if(r){let s=r.isSchema(e);if(typeof s==="object"){let a=[];for(let c of s)a.push({kind:Ct.External,error:c});if(a.length>0)return a}else if(s===!1)throw Error("it is not a JSON Schema 7")}let o={delegate:r,payload:t,extends:n,path:[],errors:[],warns:[]},i=De(o,e);if(i)Xg(o.errors.length===0,"found errors (it should be empty)");else return Xg(o.errors.length>0,"cannot found any errors"),o.errors;return{schema:i,warns:o.warns}}function Xg(e,n){if(!e)throw Error(n)}function De(e,n){if(e.extends.isExtendsSchema(n))return n;if(Ze(n))return n;let t=e.extends.tryCompiledExtendsSchema(n,e.payload);if(t)return t;let r=n,o=!1,{enum:i,const:s}=n;if(i||s!==void 0){let{enum:c,const:l,...u}=n;r=u,o=!0}let a=Zx(e,r);if(a&&o)a=Jg(e,i,s,a);if(!a)return null;return a}function Zx(e,n){for(let t of Zg){let r=n[t];if(r){let o=Object.keys(n).filter((s)=>fn(s)&&s!==t);if(o.length>0)ee(e,`composition key ${JSON.stringify(t)} will exclude other keys: ${o.toSorted().join(", ")}`);let i=ul(e,t,r);if(!i)return null;return i}}{let t=Fe(n.not);if(t){let r=Object.keys(n).filter((a)=>fn(a)&&a!=="not");if(r.length>0)ee(e,`key "not" will exclude other keys: ${r.toSorted().join(", ")}`);let o=ze(e,"not"),i=De(o,t);if(!i)return null;let s=I.Not;switch(Y(i)){case I.Never:{s=I.Any;break}case I.Any:{s=I.Never;break}}return ye(s,{not:i},e.delegate,e.path)}}if(n.type){let{type:t}=n;if(Array.isArray(t)){let{type:r,...o}=n;return ul(e,"anyOf",t.map((i)=>({...o,type:i})))}switch(t){case"object":return Bg(e,n);case"array":return Fg(e,n);default:return Qg(e,n)}}if(Dg(n))return ye(I.Any,{},e.delegate,e.path);return zn(e,"unrecognized"),null}class pl{constructor(e){let n=Object.freeze(e.toSorted());if(n.length>32)throw Error(`cannot define ${n.length} keys which is greater than 32`);this.keys=n,this.clazz=class extends eh{constructor(t){super(n,t)}};for(let[t,r]of this.keys.entries()){let o=1<<t;Object.defineProperty(this.clazz.prototype,r,{enumerable:!0,get:function(){return!!(this.int32&o)},set:function(s){if(s)this.int32|=o;else this.int32&=~o}})}}toBundle(e){let n=0;if(typeof e==="number")n=e;else if(e){for(let[t,r]of this.keys.entries())if(e[r])n|=1<<t}return new this.clazz(n)}}class eh{constructor(e,n){this.keys=e,this.int32=n}toInt32(){return this.int32}toString(){let e={};for(let n of this.keys)e[n]=this[n];return JSON.stringify(e)}}function gi(e){return new nh(e)}class nh{constructor(e){this.description=new pl(e)}get keys(){return this.description.keys}variable(e){let n;if(e)n=this.description.toBundle(e).toInt32();return new th(this.description,n)}}class th{constructor(e,n){this.values=new Set;if(this.description=e,n!==void 0)this.values.add(n)}[Symbol.iterator](){let e=this.values[Symbol.iterator]();return{next:()=>{let n=e.next();if(n.done)return n;else return{done:!1,value:this.description.toBundle(n.value)}}}}assign(e){let{values:n}=e;for(let t of n)this.values.add(t);return this}push(e,n){let t=new Set;for(let r of this.values)for(let[o,i]of xn)if(e&i){let s=this.description.toBundle(r);n(o,s),t.add(s.toInt32())}this.values=t}update(e){let n=new Set;for(let t of this.values){let r=this.description.toBundle(t);e(r),n.add(r.toInt32())}this.values=n}}function qn(e,n){let[t]=e,[r]=n;if(t.num<r.num)return Jx(e,n);else if(t.num>r.num)return Ux(e,n);else return Bx(e,n)}function Jx(e,n){let[t,r]=e,[o,i]=n;if(r.num<=o.num){let s=r.exclusive,a=o.exclusive;if(r.num<o.num||s||a)return{left:{fromLeft:!0,range:e},right:{fromLeft:!1,range:n}}}if(r.num<=i.num){let s=!0,a=!1;if(r.num===i.num){let c=r.exclusive,l=i.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!1,range:[He(r),i]};return{left:{fromLeft:!0,range:[t,He(o)]},center:[o,r],right:c}}}return{left:{fromLeft:!0,range:[t,He(o)]},center:[o,i],right:{fromLeft:!0,range:[He(i),r]}}}function Ux(e,n){let[t,r]=e,[o,i]=n;if(t.num>=i.num){let s=i.exclusive,a=t.exclusive;if(t.num>i.num||s||a)return{left:{fromLeft:!1,range:n},right:{fromLeft:!0,range:e}}}if(i.num<=r.num){let s=!0,a=!1;if(r.num===i.num){let c=i.exclusive,l=r.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!0,range:[He(i),r]};return{left:{fromLeft:!1,range:[o,He(t)]},center:[t,i],right:c}}}return{left:{fromLeft:!1,range:[o,He(t)]},center:[t,r],right:{fromLeft:!1,range:[He(r),i]}}}function Bx(e,n){let[t,r]=e,[o,i]=n,s=t.exclusive,a=o.exclusive,c,l=t;if(!s&&a)l=o,c={fromLeft:!0,range:[t,He(o)]};else if(s&&!a)c={fromLeft:!1,range:[o,He(t)]};if(r.num<=i.num){let u=!0,d=!1;if(r.num===i.num){let g=r.exclusive,h=i.exclusive;u=g!==h,d=!g&&h}if(!d){let g;if(u)g={fromLeft:!1,range:[He(r),i]};return{left:c,center:[l,r],right:g}}}return{left:c,center:[l,i],right:{fromLeft:!0,range:[He(i),r]}}}function He(e){return{num:e.num,exclusive:!e.exclusive}}var Ot=(e)=>(n=e,t=Number.POSITIVE_INFINITY,r=e,o=Number.POSITIVE_INFINITY)=>{let{left:i,center:s,right:a}=qn([{num:n,exclusive:!1},{num:t,exclusive:!1}],[{num:r,exclusive:!1},{num:o,exclusive:!1}]),c,l,u;if(i)c={min:i.range[0].num,max:i.range[1].num,isFrom1:i.fromLeft};if(a)l={min:a.range[0].num,max:a.range[1].num,isFrom1:a.fromLeft};if(s)u={min:s[0].num,max:s[1].num};return{left:c,right:l,intersection:u}};function jt({left:e,right:n,intersection:t}){if(!t)return b.Rejection;let r=!1,o=!1;if(e)if(e.isFrom1)r=!0;else o=!0;if(n)if(n.isFrom1)r=!0;else o=!0;if(r&&o)return b.Intersection;if(r)return b.Containing;if(o)return b.ContainedBy;return b.Equals}var Kx=Ot(0),Wx=gi(["hasCommon","hasExtra1","hasExtra2","hasRejection","hasCommonBroken"]);function oh({calculate:e},n,t){let r=Kx(n.minItems,n.maxItems,t.minItems,t.maxItems),o=jt(r);if(o===b.Rejection)return G;let[i,s]=rh(n),[a,c]=rh(t),l=Math.max(i.length,a.length)+1,u=Math.min(l,r.intersection.max),d=Wx.variable({}),g=Math.min(n.minItems??0,t.minItems??0);for(let y=0;y<u;y++){let S=i[y]??s,R=a[y]??c,N=e(S,R);d.push(N,(D,L)=>{switch(D){case b.Equals:{if(!L.hasRejection)L.hasCommon=!0;break}case b.Containing:{if(!L.hasRejection)L.hasCommon=!0;L.hasExtra1=!0;break}case b.ContainedBy:{if(!L.hasRejection)L.hasCommon=!0;L.hasExtra2=!0;break}case b.Intersection:{if(!L.hasRejection)L.hasCommon=!0;L.hasExtra1=!0,L.hasExtra2=!0;break}case b.Rejection:{if(y<g)L.hasCommonBroken=!0;L.hasRejection=!0,L.hasExtra1=!0,L.hasExtra2=!0;break}}})}d.update((y)=>{switch(o){case b.Containing:{y.hasExtra1=!0;break}case b.ContainedBy:{y.hasExtra2=!0;break}case b.Intersection:{y.hasExtra1=!0,y.hasExtra2=!0;break}}if(n.uniqueItems&&!t.uniqueItems&&(t.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra2=!0;else if(!n.uniqueItems&&t.uniqueItems&&(n.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra1=!0;if(n.maxItems===0||t.maxItems===0){if(y.hasCommon=!0,n.maxItems!==0)y.hasExtra1=!0;if(t.maxItems!==0)y.hasExtra2=!0}});let h=de;for(let{hasExtra1:y,hasExtra2:S,hasCommon:R,hasCommonBroken:N}of d){let D=R;if(N)D=!1;if(!D)h|=G;else if(y&&S)h|=X;else if(y)h|=M;else if(S)h|=J;else h|=K}return h}function rh({items:e,additionalItems:n}){if(Array.isArray(e))return[e,n??Dn];else return[[],e??Dn]}function ih(e){let n=new Map;return(t,r)=>{let o=Cr(t),i=Cr(r);if(o!==i)return!1;if(!o)return t===r;return ah(n,t,r,e)}}function sh(e){let n=new Map;return(t,r)=>ah(n,t,r,e)}function ah(e,n,t,r){let o=Gn(n),i=Gn(t),s=`${o}/${i}`,a=e.get(s);if(a===void 0)e.set(s,a=r(n,t));return a}function lh(e,n,t){let r=fl(n),o=fl(t),i=!1,s=!1,a=!1;for(let c of r){if(ch(e,o,c))a=!0;else i=!0;if(i&&a)break}for(let c of o){if(ch(e,r,c))a=!0;else s=!0;if(s&&a)break}if(!a)return G;if(i&&s)return X;if(i)return M;if(s)return J;return K}function ml(e,n){let t=!1,r=!1;for(let o of fl(e)){switch(mn(n,o)){case Ae.Valid:{t=!0;break}case Ae.Invalid:{r=!0;break}case Ae.Unknown:return We}if(t&&r)break}if(t&&r)return X;if(t)return K|J;if(r)return G;if(Y(n)===I.Never)return K;return J}function fl({const:e,enum:n}){if(e!==void 0)return[e];if(n)return n;throw Error("invalid branch")}function ch({isEquals:e},n,t){for(let r of n)if(e(r,t))return!0;return!1}function uh(e){function n(s,a){let c=e.isExtendsSchema(s),l=e.isExtendsSchema(a);if(c||l)return e.equals(s,a);else return r(s,a)}let t=new Map;function r(s,a){let c=Gn(s),l=Gn(a);if(c===l)return!0;let u=`${c}/${l}`,d=t.get(u);if(d===void 0)d=o(s,a),t.set(u,d);return d}function o(s,a){if(Array.isArray(s)){if(!Array.isArray(a))return!1;if(s.length!==a.length)return!1;for(let[c,l]of s.entries())if(!i(l,a[c]))return!1}else{if(Array.isArray(a))return!1;for(let c in s){if(!(c in a))return!1;let l=Reflect.get(s,c),u=Reflect.get(a,c);if(!i(l,u))return!1}for(let c in a)if(!(c in s))return!1}return!0}function i(s,a){if(s===a)return!0;if(s===null||a===null)return!1;if(typeof s!=="object")return!1;if(typeof s!==typeof a)return!1;if(Ze(s)&&Ze(a))return r(s,a);return o(s,a)}return n}function Or(e){let n=jr(e),t=e.multipleOf??1,r=an(n,t);if(!r)return null;return{multipleOf:t,range:r}}function dh([e,n]){if(e.num!==n.num)return!1;if(e.exclusive)return!1;if(n.exclusive)return!1;return!0}function an(e,n){if(!e)return;let[t,r]=e,o=Gx(t.num,n),i=Hx(r.num,n);if(o===t.num&&t.exclusive)o+=n;if(i===r.num&&r.exclusive)i-=n;if(o>i)return;if(o===i){if(o===Number.POSITIVE_INFINITY)return;if(o===Number.NEGATIVE_INFINITY)return}return[{num:o,exclusive:!1},{num:i,exclusive:!1}]}function Gx(e,n){return Math.ceil(e/n)*n}function Hx(e,n){return Math.floor(e/n)*n}function fh(e,n){let t=jr(e),r=jr(n),{left:o,right:i,center:s}=qn(t,r);if(!s)return G;let a=!1,c=!1;if(o)if(o.fromLeft)a=!0;else c=!0;if(i)if(i.fromLeft)a=!0;else c=!0;if(a&&c)return X;if(a)return M;if(c)return J;return K}function gl(e,n){let t=jr(e),r=Or(n);if(!r)return M;let o=qn(t,r.range),i=an(o.center,r.multipleOf),s=ph(o.left,r.multipleOf),a=ph(o.right,r.multipleOf);if(!o.center)return G;let c=!1,l=!1;if(o.left?.fromLeft)c=!0;if(o.right?.fromLeft)c=!0;if(!i||!dh(o.center))c=!0;if(s)l=!0;if(a)l=!0;if(c&&l)return X;if(c)return M;if(l)return J;return K}function jr(e){let n,t;if(e.exclusiveMinimum!==void 0)n={num:e.exclusiveMinimum,exclusive:!0};else if(e.minimum!==void 0)n={num:e.minimum,exclusive:!1};else n={num:Number.NEGATIVE_INFINITY,exclusive:!0};if(e.exclusiveMaximum!==void 0)t={num:e.exclusiveMaximum,exclusive:!0};else if(e.maximum!==void 0)t={num:e.maximum,exclusive:!1};else t={num:Number.POSITIVE_INFINITY,exclusive:!0};return[n,t]}function ph(e,n){if(!e)return;if(e.fromLeft)return;return an(e.range,n)}function hh(e,n){let t=Or(e),r=Or(n);if(!t&&!r)return K;if(!t)return J;if(!r)return M;let{range:o,multipleOf:i}=t,{range:s,multipleOf:a}=r,c=qn(o,s),l,u=0;if(c.center)u=Qx(i,a),l=an(c.center,u);if(!l)return G;let d=!1,g=!1,{left:h,right:y}=c;if(h&&an(h.range,h.fromLeft?i:a))if(h.fromLeft)d=!0;else g=!0;if(y&&an(y.range,y.fromLeft?i:a))if(y.fromLeft)d=!0;else g=!0;if(d=d||mh(t,l,u),g=g||mh(r,l,u),d&&g)return X;if(d)return M;if(g)return J;return K}function mh({range:e,multipleOf:n},t,r){let o=qn(e,t);if(an(o.left?.range,n))return!0;if(an(o.right?.range,n))return!0;let i=an(o.center,n);if(!i)return!1;let s=gh(t);if(gh(i)>s)return!0;if(s===1)return!1;if(n<r)return!0;return!1}function Qx(e,n){return e*n/yh(e,n)}function yh(e,n){if(e===0)return n;return yh(n%e,e)}function gh(e){if(!e)return 0;let[n,t]=e;return t.num-n.num+1}function hl(e,n){if(bh(e)||bh(n))return We;let t=wh(e),r=wh(n);if(t&&r)return fh(e,n);else if(t)return gl(e,n);else if(r)return Nn(gl(n,e));else return hh(e,n)}function bh(e){let{multipleOf:n}=e;if(n===void 0)return!1;if(!Number.isInteger(n))return!0;if(n<0)return!0;return!1}function wh(e){let{multipleOf:n}=e;if(n!==void 0&&Number.isInteger(n))return!1;if(e.type==="integer")return!1;return!0}var Yx=Ot(0),Xx=gi(["hasCommonInRequired","hasCommonOutRequired","hasExtra1","hasExtra2","hasRejection"]);function xh(e,n,t){if(eS(n,t))return G;let r=nS(n,t);if(!r)return G;let o=vh(n),i=vh(t),s=(S)=>{let R=o(S),N=i(S);if(kh(R,N))return e.calculate(R,N);else return de},{commonRequired:a,extraRequired1:c,extraRequired2:l}=r,u=Xx.variable({});for(let S of[...a].toSorted())u.push(s(S),rS);for(let S of[...c].toSorted())u.push(s(S),oS);for(let S of[...l].toSorted())u.push(s(S),iS);let{hasOptional1:d,hasOptional2:g}=r;if(d||g){let S=sS(d,g);for(let D of[...tS(n,t)].toSorted()){let L=s(D);if(L!==de)u.push(L,S)}let R=n.additionalProperties??Dn,N=t.additionalProperties??Dn;if(kh(R,N)){let D=e.calculate(R,N);u.push(D,S)}}u.update((S)=>{if(!S.hasRejection){if(c.size>0)S.hasExtra2=!0;if(l.size>0)S.hasExtra1=!0}});let{requiredKeysCount:h}=r,y=de;for(let{hasExtra1:S,hasExtra2:R,hasCommonInRequired:N,hasCommonOutRequired:D,hasRejection:L}of u)if(!N&&h>0)y|=G;else if(!D&&h===0)y|=G;else if(L)y|=G;else if(S&&R)y|=X;else if(S)y|=M;else if(R)y|=J;else y|=K;return y}function eS(e,n){let t=Yx(e.minProperties,e.maxProperties,n.minProperties,n.maxProperties);return jt(t)===b.Rejection}function nS(e,n){let t=new Set(e.required),r=new Set(n.required),o=new Set,i=new Set,s=t.size,a=r.size;for(let d of t){if(r.has(d))o.add(d);i.add(d)}for(let d of r){if(t.has(d))o.add(d);i.add(d)}let c=i.size;for(let d of o)t.delete(d),r.delete(d);let l=e.maxProperties??Number.MAX_SAFE_INTEGER,u=n.maxProperties??Number.MAX_SAFE_INTEGER;if(c>l||c>u)return null;return{requiredKeysCount:c,extraRequired1:t,extraRequired2:r,commonRequired:o,hasOptional1:l>s,hasOptional2:u>a}}function tS(e,n){let t=new Set(e.required),r=e.properties,o=n.properties,i=e.required,s=n.required;if(r)for(let a in r)t.add(a);if(o)for(let a in o)t.add(a);if(i)for(let a of i)t.delete(a);if(s)for(let a of s)t.delete(a);return t}var rS=(e,n)=>{switch(e){case b.Equals:{n.hasCommonInRequired=!0;break}case b.Containing:{n.hasExtra1=!0,n.hasCommonInRequired=!0;break}case b.ContainedBy:{n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case b.Intersection:{n.hasExtra1=!0,n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case b.Rejection:{n.hasRejection=!0;break}}},oS=(e,n)=>{switch(e){case b.Equals:case b.ContainedBy:{n.hasCommonInRequired=!0;break}case b.Intersection:case b.Containing:{n.hasExtra1=!0,n.hasCommonInRequired=!0;break}case b.Rejection:{n.hasRejection=!0;break}}},iS=(e,n)=>{switch(e){case b.Equals:case b.Containing:{n.hasCommonInRequired=!0;break}case b.Intersection:case b.ContainedBy:{n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case b.Rejection:{n.hasRejection=!0;break}}},sS=(e,n)=>(t,r)=>{if(r.hasRejection)return;let o=!1,i=!1,s=!1;switch(t){case b.Equals:{s=!0;break}case b.Containing:{o=!0,s=!0;break}case b.ContainedBy:{i=!0,s=!0;break}case b.Intersection:{o=!0,i=!0,s=!0;break}case b.Rejection:{o=!0,i=!0;break}}if(e&&o)r.hasExtra1=!0;if(n&&i)r.hasExtra2=!0;if(e&&n&&s)r.hasCommonOutRequired=!0};function vh(e){let{properties:n,propertyNames:t,additionalProperties:r}=e,o=[];if(e.patternProperties)for(let i in e.patternProperties){let s=e.patternProperties[i],a=new RegExp(i,"i");o.push({pattern:a,schema:s})}return(i)=>{if(t&&mn(t,i)===Ae.Invalid)return Ir;for(let{pattern:a,schema:c}of o)if(a.test(i))return c;let s=(n&&n[i])??r;if(!s)return Dn;return s}}function kh(e,n){let t=Y(e),r=Y(n);return t!==I.Never||r!==I.Never}var aS=Ot(0);function Sh(e,n){if(n.format&&!e.format)return M;if(e.format&&n.format&&e.format!==n.format)return We;let t=aS(e.minLength,e.maxLength,n.minLength,n.maxLength),r=jt(t),o=!!e.pattern,i=!!n.pattern;switch(r){case b.Rejection:return G;case b.Containing:return o?We:M;case b.ContainedBy:return i?We:J;case b.Equals:{if(o&&i)return e.pattern===n.pattern?K:We;if(o)return K|J;if(i)return K|M;return K}case b.Intersection:{if(o&&i)return We;if(o)return X|G|J;if(i)return X|G|M;return X}}}function Ch(e,n,t){let r={},o=[],i=sh(lS(e,r)),s=cS(),a=uh(e);r.isEquals=ih(St),r.calculate=il({describe:s,equals:a,calculate:i,observeCalculation:(l,u,d,g)=>{let h=g?Nn(d):d;if(!uS(h))return;let y=g?Ih(u,l):Ih(l,u);if(y)o.push(y)}}),Object.freeze(r);let c=r.calculate(n,t);return{errorPath:o[0],expression:c}}var cS=()=>(e)=>{let n;switch(Y(e)){case I.Not:{n={kind:Me.Not,expression:e.not};break}case I.Combination:{if("allOf"in e)n={kind:Me.AllOf,expressions:yl(e.allOf,I.Any)};else if("anyOf"in e)n={kind:Me.AnyOf,expressions:yl(e.anyOf,I.Never)};else if("oneOf"in e)n={kind:Me.OneOf,expressions:yl(e.oneOf,I.Never)};else throw Error(`invalid combination JSON Schema: ${JSON.stringify(e)}`);break}default:{n={kind:Me.Leaf};break}}return n},lS=(e,n)=>(t,r)=>{let o=Y(t),i=Y(r);if(o===I.Extends||i===I.Extends)return e.calculate(t,r);switch(o){case I.Any:return i===I.Any?K:M;case I.Never:return i===I.Never?K:J}switch(i){case I.Any:return J;case I.Never:return M}if(o===I.EnumOrConst&&i===I.EnumOrConst)return lh(n,t,r);if(o===I.EnumOrConst)return ml(t,r);if(i===I.EnumOrConst)return Nn(ml(r,t));if(o!==i)return G;switch(o){case I.Null:return K;case I.Numeric:return hl(t,r);case I.String:return Sh(t,r);case I.Boolean:return K;case I.Object:return xh(n,t,r);case I.Array:return oh(n,t,r);default:throw Error(`invalid kind ${o}`)}};function yl(e,n){return e.filter((t)=>Y(t)!==n)}function uS(e){return!yr(e)&&!wr(e)&&(br(e)||kr(e)||vr(e))}function Ih(e,n){let t=cl(n);if(!t)return;let r=Y(e),o=Y(n);if(r!==o)return[...t,"type"];let i=e,s=n;switch(o){case I.String:{if((i.minLength??0)<(s.minLength??0))return[...t,"minLength"];if((i.maxLength??Number.POSITIVE_INFINITY)>(s.maxLength??Number.POSITIVE_INFINITY))return[...t,"maxLength"];if(i.pattern!==s.pattern&&s.pattern)return[...t,"pattern"];if(i.format!==s.format&&s.format)return[...t,"format"];break}case I.Numeric:{if((i.minimum??i.exclusiveMinimum??Number.NEGATIVE_INFINITY)<(s.minimum??s.exclusiveMinimum??Number.NEGATIVE_INFINITY))return[...t,s.exclusiveMinimum==null?"minimum":"exclusiveMinimum"];if((i.maximum??i.exclusiveMaximum??Number.POSITIVE_INFINITY)>(s.maximum??s.exclusiveMaximum??Number.POSITIVE_INFINITY))return[...t,s.exclusiveMaximum==null?"maximum":"exclusiveMaximum"];if(i.multipleOf!==s.multipleOf&&s.multipleOf!=null)return[...t,"multipleOf"];break}case I.Array:{if((i.minItems??0)<(s.minItems??0))return[...t,"minItems"];if((i.maxItems??Number.POSITIVE_INFINITY)>(s.maxItems??Number.POSITIVE_INFINITY))return[...t,"maxItems"];if(!i.uniqueItems&&s.uniqueItems)return[...t,"uniqueItems"];break}case I.Object:{let a=new Set(i.required??[]);if((s.required??[]).some((c)=>!a.has(c)))return[...t,"required"];if((i.minProperties??0)<(s.minProperties??0))return[...t,"minProperties"];if((i.maxProperties??Number.POSITIVE_INFINITY)>(s.maxProperties??Number.POSITIVE_INFINITY))return[...t,"maxProperties"];break}case I.EnumOrConst:return[...t,s.const===void 0?"enum":"const"]}return t}class _r{constructor(e=[]){this.extendsSchemaClasses=Object.freeze([...e])}tryCompiledExtendsSchema(e,n){for(let t of this.extendsSchemaClasses)if(t.isMatch(e))return new t(Tn(),e,n);return null}isExtendsSchema(e){for(let n of this.extendsSchemaClasses)if(e instanceof n)return!0;return!1}calculate(e,n){let t=this.findMatchedClass(e,n),r=!(e instanceof t),o=de,i;if(r)i=n.compare(e);else i=e.compare(n);for(let s of i){if(r)s=_r.swap(s);o|=$n(s)}return o}equals(e,n){let t=this.findMatchedClass(e,n);if(!(e instanceof t))return n.equals(e);else return e.equals(n)}findMatchedClass(e,n){for(let t of this.extendsSchemaClasses){if(e instanceof t)return t;if(n instanceof t)return t}throw Error("Invalid schema")}static swap(e){switch(e){case b.Containing:return b.ContainedBy;case b.ContainedBy:return b.Containing;default:return e}}}function Eh(e,n,t=!1){let r=n(e);if(Array.isArray(r)){let s=[];throw bl(s,r,"$"),new di(s)}let{schema:o,warns:i}=r;if(t&&i.length>0){console.warn(`found ${i.length} warns after compile schema`);for(let s of i)console.warn(Et(s))}return o}function Oh(e,n,t,r=!1){let o=t(e),i=t(n);if(Array.isArray(o)||Array.isArray(i)){let u=[];if(Array.isArray(o))bl(u,o,"$1");if(Array.isArray(i))bl(u,i,"$2");throw new di(u)}let{schema:s,warns:a}=o,{schema:c,warns:l}=i;if(r){if(a.length>0)console.warn(`found ${a.length} warns after compile superSchema`);for(let u of a)console.warn(Et(u));if(l.length>0)console.warn(`found ${l.length} warns after compile subSchema`);for(let u of l)console.warn(Et(u))}return[s,c]}function bl(e,n,t){for(let r of n){let o={...r,path:[t,...r.path]};e.push(o)}}var Rr=Object.freeze({True:0,False:1,Unknown:2});function wl({extendsSchemaClasses:e,delegate:n}={}){let t=new _r(e);return Object.freeze({compile:(o,i,s)=>Eh(o,(c)=>mi(c,t,i,n),s),isSubset:(o,i,s=!1)=>{let a=(y)=>mi(y,t,void 0,n),[c,l]=Oh(o,i,a,s),{errorPath:u,expression:d}=Ch(t,c,l),g=yr(d)||wr(d),h=br(d)||kr(d)||vr(d);if(g&&!h)return{result:Rr.True};if(!g&&h)return{errorPath:u,result:Rr.False};return{result:Rr.Unknown}}})}var hi=(e)=>typeof e==="string";var dS=Array.isArray;var pS=(e)=>e!==null&&typeof e==="object";var fS=(e)=>pS(e)&&!dS(e),Hn=(e)=>fS(e)?e:void 0;function mS(e){return Hn(e)?.type==="string"}function gS(e){let n=Hn(e),t=Hn(n?.error);if(n==null||t==null||n.packageId!=null&&!hi(n.packageId)||t.message!=null&&!hi(t.message))throw TypeError("Invalid schema comparison context.")}function hS(e){if(e==null)return{error:{}};return gS(e),e}class Ln{static setError(e,n,t){if(e instanceof Ln)e.context.error.message=t;else if(n instanceof Ln)n.context.error.message=t}constructor(e,n,t){this.id=e,this.value=n,this.context=hS(t)}compare(e){if(Ze(e)&&Y(e)===I.Any)return[b.ContainedBy];return this.compareImpl(e)}}class Ar extends Ln{static isMatch(e){let n=Hn(e)?.enum;return Array.isArray(n)&&n.every((t)=>hi(t))}constructor(e,n,t){if(!Ar.isMatch(n))throw TypeError("Invalid single-select schema.");super(e,n,t)}compareImpl(e){if(mS(e))return[b.ContainedBy];if(e instanceof Ar){let n=new Set(this.value.enum),t=b.Equals;for(let r of e.value.enum){if(!n.has(r))t=b.ContainedBy;n.delete(r)}if(n.size===0)return[t];if(n.size===this.value.enum.length)return[b.Rejection];return[b.Intersection]}return[b.Rejection]}equals(e){if(e instanceof Ar){let n=new Set(this.value.enum);for(let t of e.value.enum){if(!n.has(t))return!1;n.delete(t)}return n.size===0}return!1}}class Pr extends Ln{static isMatch(e){return Hn(e)?.contentMediaType==="oomol/bin"}constructor(e,n,t){if(!Pr.isMatch(n))throw TypeError("Invalid binary schema.");super(e,n,t)}compareImpl(e){if(e instanceof Pr)return[b.Equals];else return Ln.setError(this,e,"edgeError.binDiffType"),[b.Rejection]}equals(e){return e instanceof Pr}}class Tr extends Ln{static isMatch(e){return Hn(e)?.contentMediaType==="oomol/artifact"}constructor(e,n,t){if(!Tr.isMatch(n))throw TypeError("Invalid Artifact schema.");super(e,n,t)}compareImpl(e){if(e instanceof Tr)return[b.Equals];return Ln.setError(this,e,"edgeError.artifactDiffType"),[b.Rejection]}equals(e){return e instanceof Tr}}function jh(){return wl({extendsSchemaClasses:[Ar,Pr,Tr]})}var L_=jh();var yS=new Set(["const","enum","exclusiveMaximum","exclusiveMinimum","maximum","maxItems","maxLength","maxProperties","minimum","minItems","minLength","minProperties","multipleOf","pattern","required","type"]);function yi(e){return yS.has(e)}var bi=E({handle:j().min(1),jsonSchema:$e(),nullable:me(),description:j().optional()}),H_=k({inputs:A(bi).nullable(),outputs:A(bi).nullable()});var _h=E({version:w(1),flowId:j().min(1),name:j(),revisionId:j().min(1),publicationId:j().min(1),inputs:A(bi),outputs:A(bi).nullable()});var Rh=E({version:w(1),direction:W(["incoming","outgoing"]),total:we().nonnegative(),nextOffset:we().nonnegative().optional(),references:A(E({flowId:j(),name:j().nullable(),available:me(),draft:me(),live:E({publicationId:j(),enabled:me()}).nullable()}))});var vl=["GET","POST","PUT","PATCH","DELETE"];function wi(e){return e!=="GET"}var kl={choice:255,score:10};function Ah(e){if(e.type==="noul"||e.criteria.length<=kl[e.type])return e;if(e.type==="choice")return{...e,criteria:e.criteria.slice(0,kl.choice)};return{...e,criteria:e.criteria.slice(0,kl.score)}}function wS(e){let n=e.map(Ah);return n.every((t,r)=>t===e[r])?e:n}function Ph(e){if(e.executor.kind!=="decision")return e;let n=e.executor.questions,t=wS(n);if(t===n)return e;let r=e.outputs.map((o)=>{if(!("handle"in o))return o;let i=n.findIndex((s)=>s.name===o.handle);if(i<0||n[i]===t[i]||!xe(o.jsonSchema,Th(n[i])))return o;return{...o,jsonSchema:vS(t[i])}});return{...e,executor:{...e.executor,questions:t},outputs:r}}var xl={type:"number",minimum:0,maximum:1};function vS(e){return Th(Ah(e))}function Th(e){let n={type:{const:e.type}};if(e.type==="noul")n.noul=xl;else{let t=e.type==="choice"?e.criteria.map((r)=>r.name):e.criteria.map((r,o)=>String(o));if(n.confidence=xl,n.probabilities={type:"object",properties:Object.fromEntries(t.map((r)=>[r,xl])),required:t,additionalProperties:!1},e.type==="choice")n.choice={type:"string",...t.length?{enum:t}:{}};else n.score={type:"number",minimum:0,maximum:Math.max(0,t.length-1)},n.legend={type:"object",properties:Object.fromEntries(t.map((r)=>[r,{type:"string"}])),required:t,additionalProperties:!1}}return{type:"object",properties:n,required:Object.keys(n)}}function Sl(e){for(let n of Object.values(e.graph.nodes)){if(n.kind!="task"||!("executor"in n.task)||!["openapi","http-request"].includes(n.task.executor.kind))continue;for(let[t,r]of Object.entries(n.inputs))if(t.startsWith("auth.")&&r.kind=="value")throw TypeError("HTTP authentication accepts deployment variables and upstream outputs only.")}}var $h=k({mode:W(["fields","object"]).default("fields"),names:A(j()).default([])}),vi=k({method:W(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]).default("GET"),query:$h.default({mode:"fields",names:[]}),headers:$h.default({mode:"fields",names:[]}),bodyFormat:W(["none","json","text","form"]).default("none"),authentication:Q([k({type:w("none")}),k({type:W(["bearer","basic"])}),k({type:w("apiKey"),name:j(),in:W(["header","query"])})]).default({type:"none"}),responseFormat:W(["auto","json","text"]).default("auto"),statusPolicy:W(["success","all"]).default("success")}),zh=vi.extend({kind:w("http-request")});function Qn(e,n=0){if(n>64)throw TypeError("Value exceeds the maximum JSON depth.");if(e!=null&&typeof e=="object")for(let t of Object.values(e))Qn(t,n+1)}var Il=["code","connector","openapi","http-request","llm","decision"],ki={maxRetries:5,minIntervalMs:1000,maxIntervalMs:60000,intervalStepMs:1000};var gn=k({maxRetries:ne().int().min(0).max(ki.maxRetries),intervalMs:ne().int().min(ki.minIntervalMs).max(ki.maxIntervalMs).multipleOf(ki.intervalStepMs)});var Vn=A(Q([E({type:w("cron"),expression:j(),timezone:j()}),E({type:w("every"),unit:W(["day","hour","minute","month","week"]),value:ne()})]));function Dh(e){try{return Intl.DateTimeFormat("en",{timeZone:e}),!0}catch{return!1}}var _t=sn("kind",[k({kind:w("after"),durationMs:ne().nullable()}),k({kind:w("at"),at:j(),timezone:j().optional()})]),Cl=sn("kind",[_t.options[0].extend({durationMs:ne().int().positive().max(Number.MAX_SAFE_INTEGER)}),_t.options[1].extend({at:gr.datetime({offset:!0}),timezone:j().refine(Dh,"Select a valid IANA timezone.").optional()})]);var Nr={defaultMs:30000,minMs:1000,maxMs:60000};var qh={jsonSchema:{type:"object",additionalProperties:{type:["string","number","boolean"]}},nullable:!0};var SS=[{handle:"body",jsonSchema:{},nullable:!0,value:""},{handle:"statusCode",jsonSchema:{type:"number"},nullable:!1,value:200},{handle:"headers",jsonSchema:qh.jsonSchema,nullable:!1,value:{}}];var Oi=11,x=j(),Si=x.describe('Account selection: omit while unconfigured; use an account ID to select it; use "" to explicitly defer configuration. Deferred Actions fail if called; deferred Agent tools are excluded from the callable tool set. Not supported by Triggers.'),et=$e(),zr=A(x),Mn=E({description:x.optional(),jsonSchema:et,nullable:me(),handle:x}),IS=A(Mn.strict()),Qe=Mn.extend({value:et.optional()}),Lh=E({collapsed:me().optional(),group:x}),CS=E({kind:w("node"),nodeId:x,output:x,system:w(!0).optional(),field:x.optional()}),Fh=Q([CS,E({kind:w("binding"),bindingId:x})]),Dr=Q([E({kind:w("unset")}),E({kind:w("value"),value:et})]),El=Q([Dr,E({kind:w("sources"),sources:A(Fh)})]),Zh=re(x,El),At={inputs:A(Q([Qe,Lh])),outputs:A(Q([Mn,Lh]))},ES=k({kind:w("connector"),action:x,connectionId:x.optional(),connections:A(k({connectionId:x,alias:x.optional()}))}),Al=Q([ES,k({kind:w("connector"),mode:w("shared")}),k({kind:w("connector"),mode:w("independent"),actions:A(k({action:x,connectionId:Si.optional()}))}),k({kind:w("connector"),actionHints:A(x).optional(),connectionHints:A(k({action:x,connectionId:x,alias:x.optional()})).optional()})]),Jh=k({kind:w("workflow"),name:x,flowId:x,revisionId:x,inputs:A(Mn),outputs:A(Mn).nullable()}),Ii=Q([Al,Jh]),Ol=E({...At,name:x,moduleId:x,capabilities:A(Ii).optional()}),Uh=Q([E({kind:w("value"),value:et}),E({kind:w("input"),input:x})]),OS=Q([Uh,E({kind:w("model")})]),ji={id:x,name:x,description:x,approval:me(),inputs:A(Qe.extend({source:OS}))},Pl=E({...ji,kind:w("connector").optional(),action:x,connectionId:Si.optional()}),Tl=Jh.extend(ji),jS=sn("type",[k({name:x,instructions:x,type:w("noul"),criteria:k({true:x.optional(),false:x.optional()}).optional()}),k({name:x,instructions:x,type:w("choice"),criteria:A(k({name:x,description:x}))}),k({name:x,instructions:x,type:w("score"),criteria:zr})]),Rt=E({...At,name:x,executor:Q([E({kind:w("connector"),action:x,connectionId:Si.optional(),outputMode:w("value").optional()}),E({kind:w("openapi"),sourceUrl:x,method:x,path:x,serverUrl:x,document:et,auth:A(E({id:x,type:W(["bearer","basic","apiKey"]),name:x.optional(),in:W(["header","query"]).optional()}))}),k({kind:w("decision"),questions:A(jS)}),E({kind:w("llm"),mode:W(["chat","json"])}),E({kind:w("agent"),code:me().optional(),model:x,prompt:x,maxRounds:ne(),tools:A(Q([Tl,Pl])),notification:E({action:x,connectionId:Si.optional(),inputDefinitions:A(Qe),messageHandle:x,inputs:re(x,Uh)}).optional()}),k({kind:w("workflow"),flowId:x,revisionId:x}),zh])}),jl=Rt.transform(Ph),Vh=Q([E({kind:w("value"),value:et.optional(),jsonSchema:et.optional()}),E({kind:w("source"),source:Fh})]),Ci={matchMode:W(["first","all"]),cases:A(E({description:x.optional(),output:x,groups:A(E({expressions:A(E({left:Vh,operator:W(["!=","<","<=","==",">",">=","contains","endsWith","hasKey","hasValue","isEmpty","isFalse","isNotEmpty","isNotNull","isNull","isTrue","notContains","notHasKey","notHasValue","startsWith"]),right:Vh.optional()}))}))}))},qr={inputDefinitions:A(Qe),prompt:x},_S=E({allowedMethods:on().optional(),allowedOrigins:zr.optional(),noResponseBody:on().optional(),responseBody:sn("kind",[k({kind:w("workflow-outputs"),output:x.optional(),timeoutMs:ne().int().min(Nr.minMs).max(Nr.maxMs).optional()}),k({kind:w("webhook-response"),nodeId:x.optional(),timeoutMs:ne().int().min(Nr.minMs).max(Nr.maxMs).optional()})]).optional(),responseData:x.optional(),responseHeaders:re(x,x).optional(),responseHeadersSource:k({kind:w("workflow-outputs"),output:x.optional()}).optional(),responseHeaderOutputs:re(x,x).optional(),responseStatusCode:ne().int().min(200).max(599).optional(),responseStatusCodeOutput:x.optional()}),Ei={bodyFields:A(Qe),method:W(vl),options:_S.optional()},Mh={configInputs:At.inputs,definitionVersion:w(2),description:x,displayName:x,key:x,name:x,outputs:A(Mn).refine((e)=>new Set(e.map((n)=>n.handle)).size===e.length,"Duplicate Trigger output handle."),provider:x},RS=E({body:E({allowArray:me(),allowEmpty:me(),formats:A(W(["form","json","multipart","text"]))}),methods:A(W(["DELETE","GET","HEAD","PATCH","POST","PUT"])),successStatus:ne()}),_l=A(x.min(1)).refine((e)=>new Set(e).size===e.length,"Duplicate source Flow ID."),Yn={name:x,description:x.optional(),icon:x.optional()},Xn={maxExecutions:ne().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),inputs:Zh,name:x.optional(),description:x.optional(),icon:x.optional(),timeoutMs:ne().optional(),retry:gn.optional(),onError:W(["stop","error"]).optional()},xi=Q([k({...Xn,kind:w("webhook-response"),retry:on().optional(),onError:on().optional()}),k({...Xn,kind:w("outputs"),outputDefs:A(Mn.strict()),outputMappings:Zh}).omit({inputs:!0}),E({...Xn,inputs:re(x,on()),kind:w("condition"),...Ci}),E({...Xn,inputs:pn().transform(()=>({})).default({}),kind:w("value"),values:A(Qe)}),E({...Xn,kind:w("task"),task:Q([Ol,jl]),additionalInputs:A(Qe).optional()}),k({...Xn,kind:w("approval"),...qr}).omit({timeoutMs:!0}),k({...Xn,kind:w("wait"),...qr,autoContinue:_t.optional()}).omit({timeoutMs:!0}),E({...Yn,kind:w("manual")}),k({...Yn,kind:w("start"),inputDefs:IS}),k({...Yn,kind:w("error"),sourceFlowIds:_l.optional()}),E({...Yn,kind:w("webhook"),...Ei}),E({...Yn,kind:w("cron"),cronTimes:Vn}),E({...Yn,kind:w("poll"),connectionId:x.min(1).optional(),config:re(x,Dr),definition:E({...Mh,type:w("poll")}),pollTimes:Vn}),E({...Yn,kind:w("integration"),connectionId:x.min(1).optional(),config:re(x,Dr),definition:E({...Mh,type:w("integration"),endpoint:RS})})]),ln={input:Qe,port:Mn,ports:At,condition:k(Ci),wait:k(qr),waitAutoContinue:Cl,webhook:k(Ei),schedule:Vn,capabilities:A(Ii),connector:Rt.shape.executor.options[0].omit({kind:!0}).strict(),openapi:Rt.shape.executor.options[1].omit({kind:!0}).strict(),decision:Rt.shape.executor.options[2].omit({kind:!0}).strict(),llm:Rt.shape.executor.options[3].omit({kind:!0}).strict(),agent:Rt.shape.executor.options[4].omit({kind:!0,notification:!0}).strict()},Rl=E({source:x,target:x,sourceHandle:x.optional()}),Ee={nodeId:x,target:on().optional()},AS=E({nodes:re(x,xi),edges:A(Rl).default([])}),Bh=E({kind:w("variable"),target:x}),Kh=E({name:x,imports:zr,source:x}),PS=_g(TS,E({bindings:re(x,Bh),graph:AS})),Wh=E({modelVersion:Q([w(2),w(4),w(5),w(6),w(7),w(8),w(9),w(10),w(Oi)]),document:PS,modules:re(x,Kh)}),PR=Wh.extend({kind:w("open-flow-flow-revision"),version:w(1)});function TS(e){let n=cn(e);if(n.tasks!==void 0&&(n.tasks===null||typeof n.tasks!=="object"||Array.isArray(n.tasks)||Object.keys(n.tasks).length>0))throw TypeError("Independent Task definitions are no longer supported.");if(Object.values(cn(cn(n.graph).nodes)).some((r)=>Object.hasOwn(cn(r),"taskId")))throw TypeError("Task references are no longer supported.");let t=n.subflows;if(t!==void 0&&(t===null||typeof t!=="object"||Array.isArray(t)||Object.keys(t).length>0))throw TypeError("Subflows are no longer supported.");if(Object.values(cn(cn(n.graph).nodes)).some((r)=>cn(r).kind==="subflow"))throw TypeError("Subflow nodes are no longer supported.");if(["inputDefs","outputDefs","outputMappings"].some((r)=>Object.hasOwn(n,r)))throw TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");if(Object.values(cn(cn(n.graph).nodes)).some((r)=>cn(r).kind=="start"&&Object.hasOwn(cn(r),"parameters")))throw TypeError("Legacy Start.parameters is unsupported; configure node.inputDefs.");return e}function cn(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Pt(e){Qn(e);let n=Wh.parse(e);return NS(n),Sl(n.document),n}var $S={"graph.trigger.sources.set":{nodeId:x,before:_l.optional(),value:_l.optional()},"binding.create":{bindingId:x,binding:Bh},"binding.delete":{bindingId:x},"binding.target.set":{bindingId:x,before:x,value:x},"graph.edge.connect":{edge:Rl,target:on().optional()},"graph.edge.disconnect":{edge:Rl,target:on().optional()},"graph.node.create":{...Ee,node:xi},"graph.node.replace":{...Ee,before:xi,node:xi},"graph.node.delete":Ee,"graph.node.field.set":Q([E({...Ee,kind:w("graph.node.field.set"),field:w("retry"),before:gn.optional(),value:gn.optional()}),E({...Ee,kind:w("graph.node.field.set"),field:w("connectionId"),before:x.min(1).optional(),value:x.min(1).optional()}),E({...Ee,kind:w("graph.node.field.set"),field:W(["description","icon","name","onError"]),before:x.optional(),value:x.optional()}),E({...Ee,kind:w("graph.node.field.set"),field:w("maxExecutions"),before:ne().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),value:ne().int().positive().max(Number.MAX_SAFE_INTEGER).optional()}),E({...Ee,kind:w("graph.node.field.set"),field:w("timeoutMs"),before:ne().optional(),value:ne().optional()})]),"graph.node.input.set":{...Ee,handle:x,before:El.optional(),value:El.optional()},"graph.node.additional-inputs.set":{...Ee,before:A(Qe).optional(),value:A(Qe).optional()},"graph.node.condition.set":{...Ee,before:E(Ci),value:E(Ci)},"graph.node.values.set":{...Ee,before:A(Qe),value:A(Qe)},"graph.node.resolution.set":{...Ee,before:k({...qr,autoContinue:_t.optional()}),value:k({...qr,autoContinue:_t.optional()})},"graph.node.webhook.set":{...Ee,before:E(Ei),value:E(Ei)},"graph.node.task.ports.set":{...Ee,before:E(At),value:E(At)},"graph.node.task.name.set":{...Ee,before:x,value:x},"graph.node.task.capabilities.set":{...Ee,before:A(Ii).optional(),value:A(Ii).optional()},"graph.trigger.config.set":{nodeId:x,name:x,before:Dr.optional(),value:Dr.optional()},"graph.trigger.schedule.set":{nodeId:x,before:Vn,value:Vn},"module.create":{moduleId:x,module:Kh},"module.delete":{moduleId:x},"module.rename":{moduleId:x,before:x,name:x},"module.source.replace":{moduleId:x,beforeImports:zr,beforeSource:x,imports:zr,source:x},"graph.node.task.set":{...Ee,before:Q([Ol,jl]),value:Q([Ol,jl])}},Gh=new Map(Object.entries($S).map(([e,n])=>[e,n instanceof Z?n:E({kind:w(e),...n})])),TR=A(Q([...Gh.values()])).min(1);function Lr(e,n,t){try{return t(e)}catch(r){if(!(r instanceof Vv))throw r;throw TypeError(`operations[${n}]: ${r.issues.map((o)=>`${o.path.join(".")}: ${o.message}`).join("; ")}`,{cause:r})}}function Hh(e,n){let{kind:t}=Lr(e,n,E({kind:x}).parse),r=Gh.get(t);if(r==null)throw TypeError(`operations[${n}]: Unknown operation ${JSON.stringify(t)}.`);return Lr(e,n,r.parse)}function NS(e){if(e.modelVersion<11&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("executor"in n.task)&&n.task.executor.kind=="http-request"))throw TypeError("HTTP Request requires Flow model version 11.");if(e.modelVersion<11&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("moduleId"in n.task?n.task.capabilities?.some((t)=>t.kind=="workflow"):n.task.executor.kind=="agent"&&n.task.executor.tools.some((t)=>t.kind=="workflow"))))throw TypeError("Workflow tools require Flow model version 11.");if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="webhook"&&(n.options?.responseBody!=null||n.options?.responseStatusCodeOutput!=null||n.options?.responseHeadersSource!=null||n.options?.responseHeaderOutputs!=null)))throw TypeError("Dynamic Webhook responses require Flow model version 10.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((n)=>("retry"in n)&&n.retry!=null))throw TypeError("Node retries require Flow model version 9.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((n)=>{if(n.onError!=null)return!0;if([...Object.values("inputs"in n?n.inputs:{}),...Object.values(n.kind=="outputs"?n.outputMappings:{})].some((r)=>r.kind=="sources"&&r.sources.some((o)=>o.kind=="node"&&o.system)))return!0;return n.kind=="condition"&&n.cases.some((r)=>r.groups.some((o)=>o.expressions.some((i)=>[i.left,i.right].some((s)=>s?.kind=="source"&&s.source.kind=="node"&&s.source.system))))}))throw TypeError("Node error handling requires Flow model version 9.");if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((n)=>n.kind==="webhook-response"))throw TypeError("Webhook response nodes require Flow model version 10.");if(e.modelVersion<8&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="outputs"))throw TypeError("Workflow outputs require Flow model version 8.");if(e.modelVersion<7&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="start"))throw TypeError("Start Triggers require Flow model version 7.");if(e.modelVersion<6&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("executor"in n.task)))throw TypeError("Node-owned managed Tasks require Flow model version 6.");if(e.modelVersion<5&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="error"))throw TypeError("Error workflows require Flow model version 5.")}var Qh=k({mode:W(["chat","json"]),resultSchema:$e(),model:$e().optional().describe("Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence."),template:$e().optional().describe('Default message templates: [{role: "system" | "user" | "assistant", content: "Text with {{namedInput}}"}].'),messages:$e().optional().describe("Default conversation history, prepended without template interpolation; an array of {role, content} or null.")});var qS=Q([k({schemes:A(j().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.")}),k({type:W(["bearer","basic"])}),k({type:w("apiKey"),name:j().min(1),in:W(["header","query"])})]),Yh=k({sourceUrl:j().min(1),path:j().min(1),method:j().min(1),serverUrl:j().optional(),authentication:qS.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")});var z=j().min(1),Ye=$e(),ql=re(z,Ye),_i=["start","outputs","webhook-response","workflow","webhook","cron","error","poll","integration","code","connector","agent","llm","decision","openapi","http-request","condition","value","wait","approval"],Ll=W(_i),hn=z.describe('An existing node reference returned by read/search, or $alias for a preceding node.add in this edit batch. For node.add.as "step", reference "$step", never bare "step". Aliases are local to one batch.'),$l=k({kind:w("output"),node:hn,port:z.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),field:j().optional()}),Nl=k({kind:w("system"),node:hn,port:w("error"),field:j().optional()}),zl=k({kind:w("variable"),name:z}),Xh=Q([$l,Nl,zl,k({kind:w("value"),value:Ye}),k({kind:w("unset")}),k({kind:w("default")}),k({kind:w("sources"),sources:A(Q([$l,Nl,zl])).min(1)})]),ey=Q([k({kind:w("value"),value:Ye.optional(),schema:Ye.optional()}),$l,Nl,zl]),ny=re(z,ji.inputs.element.shape.source).optional().describe("Tool input sources by name. The platform resolves types from the selected Action or workflow. New inputs default to model-provided; omitted existing sources are preserved."),LS=Q([Tl.omit({id:!0,inputs:!0,outputs:!0,revisionId:!0}).extend({inputs:ny}).strict(),Pl.omit({id:!0,inputs:!0}).extend({inputs:ny}).strict()]),VS=A(Q([Al,k({kind:w("workflow"),name:z,flowId:z})])),MS=k({...ln.connector.shape,messageHandle:z,inputs:re(z,Q([k({kind:w("value"),value:Ye}),k({kind:w("input"),input:z})]))}),Ri=k({schema:Ye.optional(),nullable:me().optional(),description:j().optional()}),Tt=re(z,Ri.extend({default:Ye.optional()})).describe("Optional business input constraints by name. A binding to a new Code, Agent, LLM, Wait or Approval input automatically declares an input accepting any JSON. Existing constraints are preserved. Omitted schema accepts any JSON; omitted nullable is true. Use default for inherited values; input.set supplies data."),iy=re(z,Ri).describe("Workflow input definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Supply call values as trigger.outputs."),FS=iy.describe("Workflow output definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Set values on the Outputs node with input.set or node.add.inputs."),sy=re(z,Ri.extend({schema:Ye,nullable:me()})),ty=re(z,Ri).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true."),Dl=k({left:ey,operator:ln.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,right:ey.optional()}),ry=k({all:A(Dl)}),ZS=Q([Dl,ry,k({any:A(Q([Dl,ry]))})]),Sn={"webhook-response":k({}),workflow:k({flowId:z}),start:k({inputDefs:iy.default({})}),outputs:k({outputDefs:FS.default({})}),error:k({sourceFlowIds:A(z).optional()}),webhook:ln.webhook.omit({bodyFields:!0}).extend({body:Tt}).strict(),cron:k({schedule:ln.schedule}),poll:k({key:z,connectionId:z.optional(),schedule:ln.schedule}),integration:k({key:z,connectionId:z.optional()}),code:k({inputs:Tt,outputs:ty,capabilities:VS.optional()}),connector:ln.connector.omit({outputMode:!0}).strict(),openapi:Yh,"http-request":vi,agent:ln.agent.omit({prompt:!0,tools:!0}).extend({inputs:Tt,resultSchema:Ye.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),tools:A(LS),notification:MS.optional()}).strict(),llm:Qh.extend({inputs:Tt}),decision:ln.decision,condition:k({match:W(["first","all"]),branches:A(k({name:z,description:j().optional(),when:ZS}))}),value:k({values:ql,outputs:ty}),wait:k({inputs:Tt,autoContinue:ln.waitAutoContinue.optional().describe("Wait only. Omit to disable; clear config.autoContinue to remove. after counts from each wait registration; at requires an explicit offset and continues immediately if already past. Optional timezone preserves the editor zone; at remains the absolute instant. Server requires the deadline to precede the 7-day expiry.")}),approval:k({inputs:Tt})},JS={onError:W(["stop","error"]).optional(),name:z.optional(),description:j().optional(),icon:j().optional(),maxExecutions:we().positive().optional(),timeoutMs:ne().nonnegative().optional(),retry:gn.partial().optional().describe('Node retry policy for Code, Connector, OpenAPI, LLM and AI Decision. Omitted update fields preserve the policy; use clear: [["retry"]] to disable it. maxRetries counts additional attempts; intervalMs is 1000\u201360000 in whole seconds.')},US=k({...JS,config:ql.optional().describe('Recursively merge configuration; omitted fields remain unchanged and arrays replace as a whole. This includes schema objects: {} does not clear an existing schema. Use clear paths to remove fields, e.g. ["config","inputs","amount","schema","type"].')}),BS=sn("op",[k({op:w("node.add"),as:z.regex(/^[A-Za-z][\w-]*$/).describe("Unique batch-local alias without the $ prefix. Later edits must reference this new node as $alias; the bare alias is not its node ID."),type:Ll,name:z,onError:W(["stop","error"]).optional(),retry:gn.optional(),config:ql.optional(),inputs:re(z,Xh).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),code:j().optional(),prompt:j().optional()}),k({op:w("node.update"),node:hn,set:US.optional(),clear:A(A(z).min(1)).optional()}),k({op:w("node.refresh"),node:hn,tool:z.optional().describe("Name of a workflow tool on an Agent or Code node. Omit for a Call Workflow node.")}),k({op:w("node.remove"),node:hn}),k({op:w("input.set"),node:hn,input:z,source:Xh}),k({op:W(["edge.connect","edge.disconnect"]),source:hn,target:hn,branch:z.optional()}),k({op:w("text.edit"),node:hn,field:W(["code","prompt"]),oldText:z,newText:j()}),k({op:w("text.set"),node:hn,field:W(["code","prompt"]),text:j()})]),Vr=k({baseRevision:z,requestId:z.max(256),edits:A(BS).min(1).max(1000)}),Ai=k({revision:z.optional().describe("Fixed revision from a previous read; omit to read the current draft."),nodes:A(z).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),text:k({node:z,field:W(["code","prompt"]),start:we().positive().default(1),lines:we().min(1).max(200).default(80)}).optional().describe("Read code or prompt by line (1-based). Mutually exclusive with nodes. Follow nextStart at the same revision until truncated is false.")}).refine((e)=>e.nodes==null||e.text==null,"Choose nodes or text.").meta({not:{required:["nodes","text"]},description:"Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."}),Vl=k({revisionId:z}),Pi=k({revision:z.optional(),query:z.max(1000),type:Ll.optional(),offset:we().nonnegative().default(0),limit:we().min(1).max(100).default(20)}),ay=k({type:Ll.optional(),action:z.optional()}).refine((e)=>e.type==null||e.action==null,"Choose type or action."),oy={read:{schema:Ai,guidance:"Read Start and Outputs node details for their interface definitions and data sources. Choose one mode: outline (omit nodes and text), node details (nodes), or text excerpt (text). nodes and text are mutually exclusive. Text defaults to 80 lines, at most 200 lines and 24000 characters. For the complete text, repeat at nextStart with the same revision until truncated is false.",examples:[{},{revision:"REVISION",nodes:["NODE"]},{revision:"REVISION",text:{node:"NODE",field:"prompt",start:1,lines:80}}]},search:{schema:Pi,guidance:"Search names, configurations and text. Keep the returned revision when following nextOffset or reading a match.",examples:[{query:"Customer summary",type:"agent"}]},edit:{schema:Vr,guidance:'Edit Start config.inputDefs and Outputs config.outputDefs through node.add or node.update; clear paths are relative to the node, e.g. ["config","inputDefs","amount"]. Set Outputs values with input.set. Use the observed revision as baseRevision and a stable requestId. Edits are ordered and atomic. node.add.as declares a batch-local alias without $. Every later reference to that new node must use $alias, including node, edge source/target and output source node fields; a bare alias is not the node ID. Use returned node references in later batches. Updates recursively merge objects (including schemas); {} preserves existing fields. Arrays replace as a whole. Remove fields with clear paths. Text replacement requires exactly one match. Read the target text first. A saved draft can have validation diagnostics.',examples:[{baseRevision:"REVISION",requestId:"CREATE_REQUEST",edits:[{op:"node.add",as:"start",type:"start",name:"Start"},{op:"node.add",as:"step",type:"code",name:"Process",code:"export default ({value}) => ({result:value})"},{op:"edge.connect",source:"$start",target:"$step"},{op:"node.update",node:"$step",set:{description:"Created and connected in one atomic edit."}}]},{baseRevision:"REVISION",requestId:"REQUEST",edits:[{op:"text.edit",node:"NODE",field:"prompt",oldText:"Original rule.",newText:"Updated rule."}]}]},check:{schema:Vl,guidance:"Check a fixed revision. In the CLI, pass this identity with --revision REVISION.",examples:[{revisionId:"REVISION"}]}};function Ml(e){if(!Object.hasOwn(oy,e))return;let n=oy[e];return{request:ht(n.schema,{io:"input"}),guidance:n.guidance,examples:n.examples}}function Fl(e){return e==null?{types:_i,request:ht(Vr),guidance:"Read a node type schema before creating or configuring it. Use $alias to reference a preceding node.add in the same batch. Read returns stable node references. Long code and prompt fields use text reads and edits. Changes use the observed baseRevision and a stable requestId."}:{type:e,onError:Il.some((n)=>n==e)?{enum:["stop","error"]}:!1,retry:Il.some((n)=>n==e)?ht(gn):!1,inputSources:["poll","integration"].includes(e)?["value","unset","default"]:["start","outputs","error","cron","webhook","value","condition"].includes(e)?[]:["value","unset","default","output","system","variable","sources"],extensibleInputs:["code","agent","llm","wait","approval"].includes(e),guidance:e=="webhook-response"?'Prepare an HTTP response using fixed inputs body (any JSON, default empty text), statusCode (number, default 200) and headers (scalar-valued object, default {}). Select this node in Webhook options.responseBody as {kind: "webhook-response", nodeId: "node reference", timeoutMs: 30000}. Its first completion responds immediately while the Run continues. It has no business outputs. Multiple response nodes are allowed; each Webhook selects one reachable node.':e=="outputs"?"Declare output fields through config.outputDefs. Set their values through node.add.inputs or input.set. Outputs is a singleton execution sink; it waits for its predecessors and produces workflow business outputs independently of node logs. No downstream edges or data references to Outputs are allowed.":e=="webhook"?'Use options.responseBody: {kind: "webhook-response", nodeId: "node ID or $alias", timeoutMs: 30000} to respond on the selected node\u2019s first completion while the Run continues. Body, statusCode and headers come exclusively from that node; clear workflow-output-only status/header references when switching. Alternatively configure options.responseBody as {kind: "workflow-outputs", output?: "top-level output name", timeoutMs?: 30000} to respond after the Run succeeds. Omit output for the complete object. Connect Webhook to Outputs. Timeout is 1000\u201360000 ms; HTTP timeout does not cancel the Run. Strings return text; other values return JSON. Only in this mode, options.responseStatusCodeOutput can select a numeric top-level workflow output as the HTTP status, overriding the preserved fixed responseStatusCode (default 200). Its runtime value must be an integer from 200 to 599, excluding 204, 205, 304; missing or invalid values return 500. Use responseHeaders for fixed text headers. In workflow-output mode, responseHeaderOutputs maps header names to top-level output names; values can be string, number or boolean and are converted to text. Alternatively responseHeadersSource: {kind: "workflow-outputs", output?: "object field"} replaces the entire header object (omit output for all outputs), preserving but ignoring per-header settings. Missing, null, complex or invalid header values return 500 without fallback. Header restrictions and Content-Type policy still apply. Omit responseBody for immediate responseData. Clear options.responseBody, options.responseStatusCodeOutput, options.responseHeadersSource and options.responseHeaderOutputs explicitly to switch back.':e=="start"?"Declare workflow inputs through config.inputDefs; read them in Start node details. REST calls and manual runs supply them as trigger.outputs. Downstream nodes bind these parameters as Start outputs. Start has no input sources or defaults; non-nullable parameters are required, and omitted nullable parameters become null.":e=="condition"?"Edit branch operands through config.branches. A branch can test one expression, all expressions, or any alternatives. Unmatched execution uses branch otherwise.":["poll","integration"].includes(e)?"Configure static parameters with node.add.inputs or input.set. Definitions come from the selected Trigger key; execution output and variable sources are unavailable.":e=="llm"?"Configure model settings, message templates and history as defaults. Input bindings with the same names override these defaults; named business inputs can be bound directly. Template strings interpolate {{name}}.":e=="http-request"?"Configure method, query/headers modes and names, bodyFormat, authentication, responseFormat and statusPolicy. Bind url, query.<name>/header.<name> or whole query/headers objects, body and auth.token (Basic: auth.username/auth.password). Credentials accept variables or upstream outputs only. Outputs: body, statusCode, headers. Authentication is replaced as a complete choice.":e=="openapi"?"Select an operation; the tool resolves its ports and authentication. Read authenticationChoices from node details. authentication is replaced as a complete choice. Bind advertised credentials through inputs.":e=="workflow"?"Select another workflow with config.flowId. A workflow cannot call itself, including in a disconnected node. Owned unpublished or unavailable targets may be saved as incomplete drafts. Use node.refresh to load the current published interface.":e=="agent"?'Tools accept Connector Actions or {kind: "workflow", flowId, name, description, approval, inputs}. Workflow parameter sources use model, input or value. The platform derives the interface. Refresh a workflow tool with node.refresh and tool: its name.':e=="code"?'Select workflows through config.capabilities: [{kind: "workflow", flowId, name}]. Call context.workflows.call(name, input) and await its business output. The platform derives input/output types. Refresh a selected workflow tool with node.refresh and tool: its name. Calls obey node and Run time limits.':"Supply business configuration and input data. Fixed definitions are assembled by the tool. Existing constraints and defaults are preserved on partial updates.",example:{op:"node.add",as:"step",type:e,name:"Step",...{start:{config:{inputDefs:{}}},outputs:{config:{outputDefs:{}}},workflow:{config:{flowId:"<Flow ID>"}},connector:{config:{action:"<Action ID>",connectionId:"<Connection ID>"}},poll:{config:{key:"<Trigger key>",schedule:[{type:"every",unit:"minute",value:5}]}},integration:{config:{key:"<Trigger key>"}},"http-request":{config:{},inputs:{url:{kind:"value",value:"https://example.com"}}},openapi:{config:{sourceUrl:"https://example.com/openapi.json",path:"/items",method:"get"}},code:{code:"export default ({value}) => ({result:value})",inputs:{value:{kind:"value",value:"Hello"}}},condition:{config:{match:"first",branches:[{name:"yes",when:{left:{kind:"value",value:120},operator:">",right:{kind:"value",value:100}}}]}},value:{config:{values:{threshold:100,region:"EU"}}},webhook:{config:{method:"POST",body:{orderId:{schema:{type:"string"},nullable:!1}}}},wait:{prompt:"Continue processing this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},approval:{prompt:"Approve this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},llm:{config:{model:{model:"deepseek-v4-flash"},template:[{role:"user",content:"Summarize {{order}}."}]},inputs:{order:{kind:"value",value:{orderId:"A-1",total:42}}}},agent:{config:{model:"deepseek-v4-flash"},inputs:{orders:{kind:"value",value:[{orderId:"A-1",total:42}]}},prompt:"Summarize {{orders}}."}}[e]},configuration:ht(Sn[e].partial()),texts:e=="code"?["code"]:["agent","wait","approval"].includes(e)?["prompt"]:[]}}var cy=E({code:z,message:j(),nodes:A(z),field:j().optional(),line:ne().optional(),column:ne().optional()}),ly=E({flowId:z,revisionId:z,valid:me(),diagnostics:A(cy),version:w(1)}),uy=E({flowId:z,saved:w(!0),revision:z,nodes:re(z,z),changes:A(E({index:we(),op:z,node:z.optional()})),validation:E({status:W(["valid","invalid","unavailable"]),diagnostics:A(cy).optional()}),version:w(1)}),dy=E({flowId:z,revision:z,data:E({nodes:A(re(j(),Ye)).optional(),edges:A(Ye).optional(),text:re(j(),Ye).optional()}),version:w(1)}),py=E({flowId:z,revision:z,data:E({matches:A(E({node:z.optional(),field:z,line:we().optional(),excerpt:j()})),total:we(),nextOffset:we().optional()}),version:w(1)});var q={authenticationRequired:"authentication.required",authorizationDenied:"authorization.denied",bindingUnresolved:"binding.unresolved",connectorActionNotFound:"connector.action-not-found",connectorAccessConflict:"connector.access-conflict",connectorAccessInvalid:"connector.access-invalid",connectorAccessRequired:"connector.access-required",connectorAccessUnsupported:"connector.access-unsupported",connectorUnconfigured:"connector.unconfigured",connectorUnavailable:"connector.unavailable",connectorConsoleUnconfigured:"connector.console-unconfigured",engineUnavailable:"engine.unavailable",engineUnsupported:"engine.unsupported",eventSourceInvalid:"event-source.invalid",eventSourceIdentityUnavailable:"event-source.identity-unavailable",eventSourceNotFound:"event-source.not-found",eventSourceConflict:"event-source.conflict",flowInvalid:"flow.invalid",flowRepairRequired:"flow.repair-required",flowUpgradeRequired:"flow.upgrade-required",flowNotFound:"flow.not-found",flowBusy:"flow.busy",flowConflict:"flow.conflict",flowPresentationConflict:"flow.presentation-conflict",flowRevisionConflict:"flow.revision-conflict",liveConflict:"live.conflict",liveNotFound:"live.not-found",pageInvalidCursor:"page.invalid-cursor",publicationConflict:"publication.conflict",publicationNotFound:"publication.not-found",publicationUnsupported:"publication.unsupported",publishOperationNotFound:"publication.operation-not-found",routeNotFound:"route.not-found",runConflict:"run.conflict",runEventsExpired:"run.events-expired",runInvalid:"run.invalid",runNotFound:"run.not-found",runNotTerminal:"run.not-terminal",runOverloaded:"run.overloaded",runWaitNotFound:"run.wait-not-found",triggerKeyInvalid:"trigger-key.invalid",triggerKeyNotFound:"trigger-key.not-found",triggerNotFound:"trigger.not-found",variableInvalid:"variable.invalid",variableLimitReached:"variable.limit-reached",variableNotFound:"variable.not-found"},WS={[q.eventSourceInvalid]:{status:400},[q.eventSourceIdentityUnavailable]:{status:409},[q.eventSourceNotFound]:{status:404},[q.eventSourceConflict]:{status:409},[q.authenticationRequired]:{status:401},[q.authorizationDenied]:{status:403},[q.bindingUnresolved]:{status:409},[q.connectorActionNotFound]:{status:404},[q.connectorAccessConflict]:{status:412},[q.connectorAccessInvalid]:{status:409},[q.connectorAccessRequired]:{status:409},[q.connectorAccessUnsupported]:{status:409},[q.connectorUnconfigured]:{status:503},[q.connectorUnavailable]:{status:503},[q.connectorConsoleUnconfigured]:{status:503},[q.engineUnavailable]:{status:503},[q.engineUnsupported]:{status:409},[q.flowInvalid]:{status:400},[q.flowRepairRequired]:{status:409},[q.flowUpgradeRequired]:{status:409},[q.flowNotFound]:{status:404},[q.flowBusy]:{status:409},[q.flowConflict]:{status:409},[q.flowPresentationConflict]:{status:412},[q.flowRevisionConflict]:{status:412},[q.liveConflict]:{status:412},[q.liveNotFound]:{status:404},[q.pageInvalidCursor]:{status:400},[q.publicationConflict]:{status:409},[q.publicationNotFound]:{status:404},[q.publicationUnsupported]:{status:409},[q.publishOperationNotFound]:{status:404},[q.routeNotFound]:{status:404},[q.runConflict]:{status:409},[q.runEventsExpired]:{status:410},[q.runInvalid]:{status:400},[q.runNotFound]:{status:404},[q.runNotTerminal]:{status:409},[q.runOverloaded]:{status:429},[q.runWaitNotFound]:{status:404},[q.triggerKeyInvalid]:{status:409},[q.triggerKeyNotFound]:{status:404},[q.triggerNotFound]:{status:404},[q.variableInvalid]:{status:400},[q.variableLimitReached]:{status:409},[q.variableNotFound]:{status:404}};class Pe extends Error{constructor(e,n,t,r){super(t);this.code=n,this.details=r,this.name="ApiError",this.status=e}}class fy extends Pe{constructor(e){super(502,"response.invalid",`The Control API returned an invalid response.${e==null?"":` ${e}`}`);this.detail=e}}function p(e){throw new fy(e)}function v(e){if(e==null||typeof e!="object"||Array.isArray(e))return p("Expected an object.");return e}function f(e){return typeof e=="string"&&e.length>0?e:p("Expected a non-empty string.")}function H(e,n){let t=n.filter((r)=>!Object.hasOwn(e,r));if(t.length>0)p(`Missing fields: ${t.join(", ")}.`)}function Xe(e,n){let t=Object.keys(e);if(t.length!=n.length||t.some((r)=>!n.includes(r))){let r=n.filter((i)=>!Object.hasOwn(e,i)),o=t.filter((i)=>!n.includes(i));p([r.length>0?`Missing fields: ${r.join(", ")}.`:"",o.length>0?`Unexpected fields: ${o.join(", ")}.`:""].filter(Boolean).join(" "))}}function ce(e){return Number.isSafeInteger(e)?e:p("Expected a safe integer.")}function be(e){if(e===null||typeof e=="boolean"||typeof e=="string")return e;if(typeof e=="number"&&Number.isFinite(e))return e;if(Array.isArray(e))return e.map(be);let n=v(e);return Object.fromEntries(Object.entries(n).map(([t,r])=>[t,be(r)]))}function Ti(e){if(e==null)return;return f(e)}function $t(e){let n=v(e),t=n.liveEnd==null?void 0:v(n.liveEnd);if(t!=null&&typeof t.enabled!="boolean")return p();let{operation:r,sourcePublicationId:o}=n;if(n.version!=1)return p();if(r!="publish"&&r!="rollback")return p();if(o!=null&&typeof o!="string")return p();return{...t==null?{}:{liveEnd:{enabled:t.enabled,endedAt:f(t.endedAt)}},actorId:f(n.actorId),closureDigest:f(n.closureDigest),createdAt:f(n.createdAt),engineContract:f(n.engineContract),flowId:f(n.flowId),modelVersion:ce(n.modelVersion),operation:r,publicationId:f(n.publicationId),sharedAccessDigest:f(n.sharedAccessDigest),revisionDigest:f(n.revisionDigest),revisionId:f(n.revisionId),...o==null?{}:{sourcePublicationId:o},version:1}}function Zl(e){let n=v(e),t=n.status,r={createdAt:f(n.createdAt),flowId:f(n.flowId),operationId:f(n.operationId),revisionId:f(n.revisionId),updatedAt:f(n.updatedAt),version:1};if(n.version!=1)return p();switch(t){case"pending":return H(n,["createdAt","flowId","operationId","revisionId","status","updatedAt","version"]),{...r,status:t};case"succeeded":return H(n,["createdAt","flowId","operationId","publicationId","revisionId","status","updatedAt","version"]),{...r,publicationId:f(n.publicationId),status:t};case"failed":{H(n,["createdAt","flowId","issue","operationId","revisionId","status","updatedAt","version"]);let o=v(n.issue),i=o.nodeId;return H(o,["code","message",...i==null?[]:["nodeId"]]),{...r,issue:{code:f(o.code),message:f(o.message),...i==null?{}:{nodeId:f(i)}},status:t}}default:return p()}}function Jl(e){let n=v(e),{status:t,publication:r}=n;if(n.version!=1||typeof n.hasUnpublishedChanges!="boolean")return p();if(t!="not-published"&&t!="runnable"&&t!="suspended")return p();if(t=="not-published"&&r!==null)return p();if(t!="not-published"&&r===null)return p();return{flowId:f(n.flowId),hasUnpublishedChanges:n.hasUnpublishedChanges,publication:r===null?null:$t(r),revision:ce(n.revision),status:t,version:1}}function my(e){let n=v(e),{nextCursor:t,total:r}=n;if(n.version!=1||!Array.isArray(n.publications))return p();if(t!=null&&typeof t!="string")return p();if(r!=null&&!Number.isSafeInteger(r))return p();return{...t==null?{}:{nextCursor:t},publications:n.publications.map($t),...r==null?{}:{total:r},version:1}}var gy=A(Q([k({handle:j().min(1),description:j().optional(),jsonSchema:$e(),nullable:me(),value:$e().optional()}),k({group:j(),collapsed:me().optional()})]));function Ul(e){let n=v(e),t=n.type;if(t!="integration"&&t!="poll")return p();return{description:typeof n.description=="string"?n.description:p(),displayName:f(n.displayName),key:f(n.key),name:f(n.name),provider:f(n.provider),type:t}}function Mr(e){let n=v(e),t=Ul(n),r={configInputs:gy.parse(n.configInputs),definitionVersion:n.definitionVersion===2?2:p(),description:t.description,displayName:t.displayName,key:t.key,name:t.name,outputs:(Array.isArray(n.outputs)?n.outputs:p()).map((l)=>{let u=v(l);return Object.assign({handle:f(u.handle),jsonSchema:be(u.jsonSchema),nullable:typeof u.nullable==="boolean"?u.nullable:p()},u.description==null?{}:{description:f(u.description)})}),provider:t.provider};if(t.type=="poll")return{...r,type:"poll"};let o=v(n.endpoint),i=v(o.body);if(!Array.isArray(o.methods)||!Array.isArray(i.formats)||typeof i.allowArray!="boolean"||typeof i.allowEmpty!="boolean")return p();let s=o.methods.map(f),a=i.formats.map(f),c=ce(o.successStatus);if(s.some((l)=>!["DELETE","GET","HEAD","PATCH","POST","PUT"].includes(l))||a.some((l)=>!["form","json","multipart","text"].includes(l))||c<200||c>299)return p();return{...r,endpoint:{body:{allowArray:i.allowArray,allowEmpty:i.allowEmpty,formats:a},methods:s,successStatus:c},type:"integration"}}var GS=new Set(["error","cron","integration","poll","webhook"]),HS=new Set(["failed","healthy","initializing","needs_reauth","suspended"]),QS=new Set(["delivery.failed","health.failed","health.needs_reauth","health.recovered","health.suspended","operator.paused","operator.resumed"]);function Fr(e){let n=v(e),t=n.health,r=n.listener==null?void 0:v(n.listener);if(r!=null&&r.health!="healthy"&&r.health!="failed"&&r.health!="needs_reauth")return p();let o=n.kind,i=ce(n.runtimeVersion);if(n.version!=1||typeof t!="string"||!HS.has(t))return p();if(typeof o!="string"||!GS.has(o))return p();if(i<=0)return p();return{...n.currentPublicationId==null?{}:{currentPublicationId:f(n.currentPublicationId)},...n.currentRevisionId==null?{}:{currentRevisionId:f(n.currentRevisionId)},...n.endpointUrl==null?{}:{endpointUrl:f(n.endpointUrl)},...r==null?{}:{listener:{health:r.health,...r.lastErrorCode==null?{}:{lastErrorCode:f(r.lastErrorCode)}}},flowId:f(n.flowId),health:t,kind:o,...n.lastErrorCode==null?{}:{lastErrorCode:f(n.lastErrorCode)},runtimeVersion:i,triggerNodeId:f(n.triggerNodeId),updatedAt:f(n.updatedAt),version:1}}function hy(e){let n=v(e);if(n.version!=1)return p();return{binding:Fr(n.binding),version:1}}function YS(e){let n=v(e),t=n.kind;if(typeof t!="string"||!QS.has(t))return p();let r=Ti(n.errorCode),o=Ti(n.errorMessage);if(o!=null&&o.length>512)return p();return{activityId:f(n.activityId),createdAt:f(n.createdAt),...r==null?{}:{errorCode:r},...o==null?{}:{errorMessage:o},kind:t}}function yy(e){let n=v(e),t=Ti(n.nextCursor);if(n.version!=1||!Array.isArray(n.activities))return p();return{activities:n.activities.map(YS),...t==null?{}:{nextCursor:t},version:1}}function by(e){let n=v(e),t=ce(n.filtered);if(n.version!=1||!Array.isArray(n.events)||typeof n.hasMore!="boolean"||t<0)return p();return{events:n.events.map((r)=>{let o=v(r);return Object.fromEntries(Object.entries(o).map(([i,s])=>[i,be(s)]))}),filtered:t,hasMore:n.hasMore,version:1}}var nt={nodeId:j().min(1),name:j(),description:j().optional()},Zr=pn().transform(Fr),wy={provider:j().min(1),inputs:re(j(),sn("kind",[E({kind:w("value"),value:$e()}),E({kind:w("unset")})]))},eI=sn("type",[E({...nt,type:w("start"),config:Sn.start}),E({...nt,type:w("manual"),config:E({})}),E({...nt,type:w("webhook"),config:Sn.webhook,binding:Zr}),E({...nt,type:w("cron"),config:Sn.cron,binding:Zr}),E({...nt,type:w("error"),config:Sn.error,binding:Zr}),E({...nt,...wy,type:w("poll"),config:Sn.poll,binding:Zr}),E({...nt,...wy,type:w("integration"),config:Sn.integration,binding:Zr})]);function vy(e){let n=v(e),t=f(n.flowId);if(n.version!=1||!Array.isArray(n.entries))return p();if(n.publication===null){if(n.inputDefs!==null||n.status!="not-published"||n.entries.length!=0||Object.hasOwn(n,"enabled"))return p();return{flowId:t,inputDefs:null,publication:null,status:"not-published",entries:[],version:1}}let r=$t(n.publication),o=n.status;if(r.flowId!=t||typeof n.enabled!="boolean")return p();if(o!="runnable"&&o!="suspended")return p();if(!n.enabled&&n.status=="runnable")return p();let i=sy.safeParse(n.inputDefs);if(!i.success)return p();return{flowId:t,inputDefs:i.data,publication:r,status:o,enabled:n.enabled,entries:nI(n.entries,r),version:1}}function nI(e,n){let t=A(eI).safeParse(e);if(!t.success)return p();let r=new Set;for(let o of t.data){if(r.has(o.nodeId))return p();if(r.add(o.nodeId),o.type!="start"&&o.type!="manual"&&(o.binding.flowId!=n.flowId||o.binding.triggerNodeId!=o.nodeId||o.binding.kind!=o.type||o.binding.currentPublicationId!=n.publicationId||o.binding.currentRevisionId!=n.revisionId))return p();if(o.type=="webhook"&&(!o.binding.endpointUrl||!wi(o.config.method)&&Object.keys(o.config.body).length>0))return p()}return t.data}function $i(e,n){if(!e||typeof e!="object"||!n||typeof n!="object")return{};let t=e,r=n;if(typeof t.version!="string"||![t.pixelRatio,t.iconSize,t.width,t.height].every((o)=>Number.isInteger(o)&&o>0)||![t.bleed,r.x,r.y].every((o)=>Number.isInteger(o)&&o>=0)||r.x+t.iconSize>t.width||r.y+t.iconSize>t.height)return{};try{for(let o of[t.lightUrl,t.darkUrl])if(typeof o!="string"||!["https:","http:","data:"].includes(new URL(o).protocol))return{}}catch{return{}}return{iconSprite:t,iconSpritePosition:{x:r.x,y:r.y}}}function ky(e){return e.kind=="source"&&e.source.kind=="binding"?{kind:"value"}:e}function xy(e){return{...e,cases:e.cases.map((n)=>({...n,groups:n.groups.map((t)=>({...t,expressions:t.expressions.map((r)=>({...r,left:ky(r.left),...r.right==null?{}:{right:ky(r.right)}}))}))}))}}var Wl=80;function zi(e){let n=e.trim();if(n.length==0)return"empty";if(n.length>Wl)return"tooLong";for(let t of n){let r=t.charCodeAt(0);if(r<=31||r>=127&&r<=159)return"controlCharacter"}if(!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(n))return"specialCharacter"}function Iy(e,n){let t=e=="jira.on_issue_event"||e=="intercom.on_conversation_event"||e=="sentry.on_issue_alert"||e=="zoom.on_recording_ready"||e=="fireflies.on_meeting_ready"?["sourceId","eventTypes"]:e=="slackbot.on_event"?["sourceId","eventTypes","channelIds"]:e=="feishu_app_bot.on_event"?["sourceId","eventTypes","resource","chatIds"]:e=="linear.on_issue_changed"?["teamId","stateIds"]:[];return{...n,...Object.fromEntries(t.map((r)=>[r,{kind:"unset"}]))}}function Cy(e,n){return{...e,nodes:Object.fromEntries(Object.entries(e.nodes).map(([t,r])=>{if((r.kind=="poll"||r.kind=="integration")&&(n==null||r.connectionId==n)){let{connectionId:i,...s}=r;return[t,s]}if(r.kind!="task")return[t,r];if("executor"in r.task){let i=r.task.executor,s=(a)=>{if(a.connectionId==="")return a;if(n!=null&&a.connectionId!=n)return a;let{connectionId:c,...l}=a;return l};if(i.kind=="connector")return[t,{...r,task:{...r.task,executor:s(i)}}];if(i.kind=="agent")return[t,{...r,task:{...r.task,executor:{...i,tools:i.tools.map(s),...i.notification==null?{}:{notification:s(i.notification)}}}}];return[t,r]}let o=r.task.capabilities?.map((i)=>{if(i.kind=="workflow")return i;if(!("mode"in i)){if("action"in i){let{connectionId:s,...a}=i;return{...a,connections:i.connections.filter((c)=>n!=null&&c.connectionId!=n),...s!=null&&n!=null&&s!=n?{connectionId:s}:{}}}return{...i,...n==null&&(i.connectionHints?.length??0)>0?{actionHints:[...new Set([...i.actionHints??[],...i.connectionHints.map((s)=>s.action)])]}:{},...i.connectionHints==null?{}:{connectionHints:i.connectionHints.filter((s)=>n!=null&&s.connectionId!=n)}}}if(i.mode!="independent")return i;return{...i,actions:i.actions.map((s)=>{if(s.connectionId==="")return s;if(n!=null&&s.connectionId!=n)return s;let{connectionId:a,...c}=s;return c})}});return[t,o==null?r:{...r,task:{...r.task,capabilities:o}}]}))}}var aI=k({kind:w("open-flow-workflow"),version:w(1),name:j().optional(),content:pn(),presentation:re(j(),$e()).optional()});function Di(e){Qn(e,-1);let n=aI.parse(e);return{...n,content:Pt(n.content)}}function Oy(e){return Di(JSON.parse(e))}function Ey(e){if(e.kind!="sources"||!e.sources.some((t)=>t.kind=="binding"))return e;let n=e.sources.filter((t)=>t.kind!="binding");return n.length==0?{kind:"unset"}:{kind:"sources",sources:n}}function cI(e){let n=Di(e),t=n.content.document.graph,r=Cy(t),o=Object.fromEntries(Object.entries(r.nodes).map(([i,s])=>{let a=s;if("inputs"in a)a={...a,inputs:Object.fromEntries(Object.entries(a.inputs).map(([c,l])=>[c,Ey(l)]))};if(a.kind=="outputs")a={...a,outputMappings:Object.fromEntries(Object.entries(a.outputMappings).map(([c,l])=>[c,Ey(l)]))};if(a.kind=="condition")a=xy(a);if(a.kind=="error"&&a.sourceFlowIds!=null)a={...a,sourceFlowIds:[]};if(a.kind=="poll"||a.kind=="integration")a={...a,config:Iy(a.definition.key,a.config)};return[i,a]}));return{file:{...n,content:{...n.content,document:{...n.content.document,bindings:{},graph:{...r,nodes:o}}}},summary:{changedNodeIds:Object.keys(o).filter((i)=>!xe(o[i],t.nodes[i])),removedBindings:Object.keys(n.content.document.bindings).length}}}function jy(e){return`${JSON.stringify(cI(e).file,null,2)}
63
+ `}function _y(e){return e.replace(/(?:\.openflow)?\.json$/i,"")}var uI=sn("kind",[k({kind:w("admin-delegation")}),k({kind:w("policy"),ruleId:j().min(1).nullable()})]);function qi(e){return uI.parse(e)}function Py(e){let n=v(e);if(!Array.isArray(n.bots))return p("Leina bots: expected an array.");let t=n.bots.map((r)=>{let o=v(r);if(!Array.isArray(o.platforms))return p("Leina platforms: expected an array.");return{leinaId:f(o.leinaId),name:f(o.name),status:f(o.status),platforms:o.platforms.map(f)}});if(new Set(t.map((r)=>r.leinaId)).size!=t.length)return p("Leina bots: duplicate identifiers.");return t}function dI(e){let n=v(e);if(Xe(n,["actionIds","allActions","triggerIds","allTriggers","configured","proxy"]),!Array.isArray(n.actionIds))return p("permissions.actionIds: expected an array.");if(!Array.isArray(n.triggerIds))return p("permissions.triggerIds: expected an array.");if(typeof n.allActions!="boolean")return p("permissions.allActions: expected a boolean.");if(typeof n.allTriggers!="boolean")return p("permissions.allTriggers: expected a boolean.");if(typeof n.configured!="boolean")return p("permissions.configured: expected a boolean.");if(typeof n.proxy!="boolean")return p("permissions.proxy: expected a boolean.");let t=n.actionIds.map(f),r=n.triggerIds.map(f);if(new Set(t).size!=t.length)return p("permissions.actionIds: duplicate IDs.");if(n.allActions&&t.length!=0)return p("permissions.actionIds: must be empty when allActions is true.");if(new Set(r).size!=r.length)return p("permissions.triggerIds: duplicate IDs.");if(n.allTriggers&&r.length!=0)return p("permissions.triggerIds: must be empty when allTriggers is true.");if(n.proxy&&(!n.allActions||!n.allTriggers||n.configured))return p("permissions.proxy: requires allActions=true, allTriggers=true and configured=false.");return{actionIds:t,triggerIds:r,allTriggers:n.allTriggers,allActions:n.allActions,configured:n.configured,proxy:n.proxy}}function Ty(e,n){let t=v(e),{policyRevision:r,status:o,isDefault:i}=t,s=Object.hasOwn(t,"displayName")&&!Object.hasOwn(t,"connectionDisplayName"),a=n&&Object.hasOwn(t,"permissions")?dI(t.permissions):void 0,c=t.permissionGroupName;if(Xe(t,["accessBindingId","connectionId","source",s?"displayName":"connectionDisplayName",...n&&Object.hasOwn(t,"isDefault")?["isDefault"]:[],...n&&a!=null?["permissions"]:[],...Object.hasOwn(t,"permissionGroupName")?["permissionGroupName"]:[],...r==null?[]:["policyRevision"],"providerId",...n?[]:["status"]]),r!=null&&typeof r!="string")return p("policyRevision: expected a string.");if(n&&i!==void 0&&typeof i!="boolean")return p("isDefault: expected a boolean.");if(c!==void 0&&c!==null&&typeof c!="string")return p("permissionGroupName: expected a string or null.");if(!n&&o!="active"&&o!="forbidden"&&o!="invalid"&&o!="missing")return p();let l;try{l=qi(t.source)}catch{return p("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.")}return{accessBindingId:f(t.accessBindingId),connectionId:f(t.connectionId),source:l,connectionDisplayName:f(s?t.displayName:t.connectionDisplayName),...n&&typeof i=="boolean"?{isDefault:i}:{},...a==null?{}:{permissions:a},...c===void 0?{}:{permissionGroupName:c},...r==null?{}:{policyRevision:r},providerId:f(t.providerId),...n?{}:{status:o}}}function Hl(e){if(e!="implicit"&&e!="selectable")return p("mode: expected implicit or selectable.");return e}function Nt(e){let n=v(e);Xe(n,["accessRevision","bindings","mode","sharedAccessDigest",..."providerIds"in n?["providerIds"]:[],..."discardedBindingCount"in n?["discardedBindingCount"]:[],"version"]);let t=ce(n.accessRevision);if(n.version!=1||t<0||!Array.isArray(n.bindings))return p();if("providerIds"in n&&!Array.isArray(n.providerIds))return p();let r=n.providerIds==null?void 0:n.providerIds.map((s)=>f(s));if(r!=null&&new Set(r).size!=r.length)return p();let o=n.discardedBindingCount==null?0:ce(n.discardedBindingCount);if(o<0)return p();let i=[];for(let s of n.bindings)try{i.push(Ty(s,!1))}catch(a){if(!(a instanceof Pe)||a.code!="response.invalid")throw a;if(s!=null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.accessBindingId=="string"&&s.accessBindingId.length>0&&typeof s.providerId=="string"&&s.providerId.length>0)i.push({accessBindingId:s.accessBindingId,providerId:s.providerId,connectionId:null,source:null,status:"invalid",connectionDisplayName:typeof s.connectionDisplayName=="string"&&s.connectionDisplayName.length>0?s.connectionDisplayName:typeof s.displayName=="string"&&s.displayName.length>0?s.displayName:s.providerId,permissionGroupName:typeof s.permissionGroupName=="string"?s.permissionGroupName:null});else o++}if(new Set(i.map((s)=>s.accessBindingId)).size!=i.length)return p();return{accessRevision:t,...o==0?{}:{discardedBindingCount:o},...r==null?{}:{providerIds:r},bindings:i,mode:Hl(n.mode),sharedAccessDigest:f(n.sharedAccessDigest),version:1}}function Ry(e){if(!Array.isArray(e))return p();let n=e.map((t)=>{let r=v(t);Xe(r,["accessBindingId","connectionId","providerId","source","connectionDisplayName",..."permissionGroupName"in r?["permissionGroupName"]:[]]);let o;try{o=qi(r.source)}catch{return p()}if(r.permissionGroupName!=null&&typeof r.permissionGroupName!="string")return p();return{accessBindingId:f(r.accessBindingId),connectionId:f(r.connectionId),providerId:f(r.providerId),source:o,connectionDisplayName:f(r.connectionDisplayName),..."permissionGroupName"in r?{permissionGroupName:r.permissionGroupName}:{}}});if(new Set(n.map((t)=>t.accessBindingId)).size!=n.length)return p();return n}function Ql(e){let n=v(e);if(Xe(n,["mode","sharedAccessDigest","sharedBindings","selectedBindings","version"]),n.version!=2)return p();let t=Hl(n.mode),r=Ry(n.sharedBindings),o=Ry(n.selectedBindings);if(t=="implicit"&&(r.length>0||o.length>0))return p();return{mode:t,sharedAccessDigest:f(n.sharedAccessDigest),sharedBindings:r,selectedBindings:o,version:2}}function pI(e,n){let t=v(e);if(Xe(t,["candidates","mode","providerId","version"]),t.version!=1)return p("version: expected 1.");if(f(t.providerId)!=n)return p("providerId: does not match the requested provider.");if(!Array.isArray(t.candidates))return p("candidates: expected an array.");let r=t.candidates.map((o)=>Ty(o,!0));if(r.some((o)=>o.providerId!=n))return p("candidates[].providerId: does not match the requested provider.");if(new Set(r.map((o)=>o.accessBindingId)).size!=r.length)return p("candidates[].accessBindingId: duplicate IDs.");return{candidates:r,mode:Hl(t.mode),providerId:n,version:1}}function $y(e,n){let t=v(e);if(Xe(t,["results","version"]),t.version!=1)return p("version: expected 1.");if(!Array.isArray(t.results))return p("results: expected an array.");let r=new Set(n),o=t.results.map((i)=>{let s=v(i),a=f(s.providerId);if(!r.delete(a))return p("results[].providerId: duplicate or unrequested provider.");if(!Object.hasOwn(s,"error"))return pI(s,a);Xe(s,["providerId","error"]);let c=v(s.error);return Xe(c,["code","message"]),{providerId:a,error:{code:f(c.code),message:f(c.message)}}});if(r.size!=0)return p("results: missing requested providers.");return{results:o,version:1}}function zt(e){let n=v(e);if(H(n,[...Object.hasOwn(n,"providerAccountId")?["providerAccountId"]:[],...Object.hasOwn(n,"alias")?["alias"]:[],...Object.hasOwn(n,"builtInAccount")?["builtInAccount"]:[],"connectionId","displayName","isDefault","serviceId","status"]),n.builtInAccount!==void 0&&typeof n.builtInAccount!="boolean")return p();let t=n.status;if(t!="active"&&t!="disconnected"&&t!="error"&&t!="reauth_required")return p();if(typeof n.isDefault!="boolean")return p();return{...n.providerAccountId===void 0?{}:{providerAccountId:f(n.providerAccountId)},...n.alias===void 0?{}:{alias:f(n.alias)},...n.builtInAccount===void 0?{}:{builtInAccount:n.builtInAccount},connectionId:f(n.connectionId),displayName:f(n.displayName),isDefault:n.isDefault,serviceId:f(n.serviceId),status:t}}function Ny(e,n=!1){let t=v(e),r=t.description,o=n&&Object.hasOwn(t,"value");if(H(t,["jsonSchema","nullable",...r==null?[]:["description"],...o?["value"]:[]]),r!=null&&typeof r!="string")return p();if(typeof t.nullable!="boolean")return p();return{...r==null?{}:{description:r},jsonSchema:be(t.jsonSchema),nullable:t.nullable,...o?{value:be(t.value)}:{}}}function fI(e){return Ny(e,!0)}function Ay(e,n){return Object.fromEntries(Object.entries(v(e)).map(([t,r])=>[t,n(r)]))}function mI(e){let n=v(e),{homepageUrl:t,icon:r}=n;if(H(n,["actionId",...Object.hasOwn(n,"operationType")?["operationType"]:[],...Object.hasOwn(n,"inputSchema")?["inputSchema"]:[],...Object.hasOwn(n,"outputSchema")?["outputSchema"]:[],"authenticated","description",...t==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in n?["iconSprite"]:[],..."iconSpritePosition"in n?["iconSpritePosition"]:[],"inputs","name","outputs","serviceId","serviceName"]),t!=null&&typeof t!="string"||r!=null&&typeof r!="string")return p();return{...n.inputSchema===void 0?{}:{inputSchema:be(n.inputSchema)},...n.outputSchema===void 0?{}:{outputSchema:be(n.outputSchema)},actionId:f(n.actionId),...n.operationType==null?{}:{operationType:f(n.operationType)},authenticated:typeof n.authenticated=="boolean"?n.authenticated:p(),description:typeof n.description=="string"?n.description:p(),...t==null?{}:{homepageUrl:t},...r==null?{}:{icon:r},...$i(n.iconSprite,n.iconSpritePosition),inputs:Ay(n.inputs,fI),name:f(n.name),outputs:Ay(n.outputs,Ny),serviceId:f(n.serviceId),serviceName:f(n.serviceName)}}function Li(e){let{defaultConnection:n,...t}=v(e),r=mI(t);if(n==null)return r;let o=zt(n);if(o.serviceId!=r.serviceId||o.status!="active")return p();return{...r,defaultConnection:o}}function zy(e){let n=v(e),{homepageUrl:t,icon:r}=n;if(n.noSetup!==void 0&&typeof n.noSetup!="boolean")return p();if(H(n,[...Object.hasOwn(n,"noSetup")?["noSetup"]:[],"serviceId","serviceName",...t==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in n?["iconSprite"]:[],..."iconSpritePosition"in n?["iconSpritePosition"]:[]]),t!=null&&typeof t!="string"||r!=null&&typeof r!="string")return p();return{...t==null?{}:{homepageUrl:t},...r==null?{}:{icon:r},...$i(n.iconSprite,n.iconSpritePosition),serviceId:f(n.serviceId),serviceName:f(n.serviceName),...n.noSetup===void 0?{}:{noSetup:n.noSetup}}}function Yl(e){return{actionId:e.actionId,authenticated:e.authenticated,...e.defaultConnection==null?{}:{defaultConnection:{connectionId:e.defaultConnection.connectionId,displayName:e.defaultConnection.displayName,status:e.defaultConnection.status}},description:e.description,name:e.name,serviceId:e.serviceId,serviceName:e.serviceName}}var en=j().min(1).max(256),yI=j().regex(/^[a-z][a-z0-9_.:]{0,127}$/),bI=j().trim().min(1).max(128),Xl=E({version:w(1),sourceId:en,revision:we().positive(),name:bI,provider:W(["feishu","feishu_app_bot","slackbot","intercom","sentry","zoom","fireflies","jira"]),appId:en.nullable(),workspaceId:en.optional(),installationId:en.optional(),organizationId:en.optional(),projectId:en.optional(),projectKey:en.optional(),subscriptionStatus:W(["idle","pending","ready","error"]).optional(),lastError:j().optional(),signingSecretConfigured:me().optional(),connectionId:en,teamId:en.nullable(),enabled:me(),eventTypes:A(yI),manageSubscriptions:me().nullable(),verificationTokenConfigured:me().nullable(),encryptKeyConfigured:me().nullable(),endpointUrl:j().nullable(),verifiedAt:j().nullable(),lastReceivedAt:j().nullable(),updatedAt:j(),consumers:A(E({flowId:en,flowName:j(),triggerNodeId:en}))}),y0=Xl.pick({appId:!0,workspaceId:!0,installationId:!0,organizationId:!0,projectId:!0,projectKey:!0,subscriptionStatus:!0,lastError:!0,signingSecretConfigured:!0,manageSubscriptions:!0,verificationTokenConfigured:!0,encryptKeyConfigured:!0,verifiedAt:!0});function Vi(e){return Xl.parse(e)}function eu(e){return E({version:w(1),sources:A(Xl),teamId:en.nullable().optional()}).parse(e)}function nu(e){let n=v(e);if(H(n,["version","locale","definitions","display"]),n.version!=3||!Au(n.locale)||!Array.isArray(n.definitions))return p();let t=n.definitions.map(Mr),r=v(n.display),o=new Set(t.map((s)=>s.key));if(o.size!=t.length||Object.keys(r).length!=o.size)return p();let i=Object.fromEntries(t.map((s)=>{let{key:a}=s,c=v(r[a]);return H(c,["configInputs","configInputLabels","displayName","description","outputs"]),[a,{configInputs:qy(c.configInputs,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),configInputLabels:wI(c.configInputLabels,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),displayName:f(c.displayName),description:f(c.description),outputs:qy(c.outputs,s.outputs.map((l)=>l.handle))}]}));return{version:3,locale:n.locale,definitions:t,display:i}}function qy(e,n){let t=v(e);return Xe(t,n),Object.fromEntries(Object.entries(t).map(([r,o])=>[r,f(o)]))}function wI(e,n){let t=v(e);if(Object.keys(t).some((r)=>!n.includes(r)))return p();return Object.fromEntries(Object.entries(t).map(([r,o])=>{let i=f(o);return i.trim().length==0?p():[r,i]}))}function tu(e,n){if(n==null)return e;let t=n.toLowerCase();return e.filter((r)=>[r.description,r.displayName,r.key,r.name,r.provider,r.type].some((o)=>o.toLowerCase().includes(t)))}var vI=k({pointer:j().max(4096).default(""),offset:ne().int().nonnegative().default(0),limit:ne().int().min(1).max(100).default(20),maxBytes:ne().int().min(1).max(1048576).default(15000)});var kI=$e(),Ly=E({pointer:j(),type:W(["object","array","string","number","boolean","null"]),length:ne().int().nonnegative().optional(),complete:me(),value:kI.optional()}),xI=Ly.extend({offset:ne().int().nonnegative(),nextOffset:ne().int().positive().optional(),entries:A(Ly).optional()}),Vy=E({resultId:j().min(1),callId:j().min(1),toolId:j().min(1),source:sn("kind",[E({kind:w("connector"),action:j().min(1)}),E({kind:w("code")}),E({kind:w("workflow"),flowId:j().min(1)})]),bytes:ne().int().nonnegative(),digest:j().regex(/^[a-f0-9]{64}$/),createdAt:j().datetime()}),SI=E({version:w(1),runId:j(),results:A(Vy),nextAfter:j().optional()}),II=E({version:w(1),runId:j(),result:Vy,page:xI});function ru(e){return SI.parse(e)}function ou(e){return II.parse(e)}function My(e){if(!Array.isArray(e))return p();return e.map((n)=>typeof n=="string"||Number.isSafeInteger(n)?n:p())}function CI(e){let n=v(e),t=f(n.kind);if(t=="artifact"||t=="binary"||t=="nullable")return{kind:t};if(t=="schema")return{kind:t,path:n.path==null?void 0:My(n.path)};if(t!="keyword"||typeof n.keyword!="string"||!yi(n.keyword))return p();return{kind:t,keyword:n.keyword,path:My(n.path),source:n.source===void 0?void 0:be(n.source),target:n.target===void 0?void 0:be(n.target)}}function EI(e){let n=v(e),t=n.values==null?void 0:v(n.values);return{code:f(n.code),column:ce(n.column),...n.fields===void 0?{}:{fields:Array.isArray(n.fields)?n.fields.map(f):p()},line:ce(n.line),message:f(n.message),mismatch:n.mismatch==null?void 0:CI(n.mismatch),path:typeof n.path=="string"?n.path:p(),...t==null?{}:{values:Object.fromEntries(Object.entries(t).map(([r,o])=>[r,typeof o=="string"||typeof o=="number"?o:p()]))}}}function Fy(e){let n=v(e);if(n.version!=1||typeof n.valid!="boolean"||!Array.isArray(n.diagnostics))return p();return{closureDigest:f(n.closureDigest),diagnostics:n.diagnostics.map(EI),engineContract:f(n.engineContract),flowId:f(n.flowId),modelVersion:ce(n.modelVersion),revisionDigest:f(n.revisionDigest),revisionId:f(n.revisionId),valid:n.valid,version:1}}var Zy=(e)=>e==null?"":`?flowId=${encodeURIComponent(e)}`;function Jy(e,n){let t=new URLSearchParams({...e==null?{}:{flowId:e},...n==null?{}:{locale:n}}).toString();return{path:`/v1/connector/providers${t?`?${t}`:""}`,decode:(r)=>{let o=v(r);if(H(o,["providers","version"]),o.version!=1||!Array.isArray(o.providers))return p();return o.providers.map(zy)}}}function Uy(e,n,t){let r=new URLSearchParams({...n==null?{}:{flowId:n},...t==null?{}:{locale:t}}).toString();return{path:`/v1/connector/actions/${encodeURIComponent(e)}${r?`?${r}`:""}`,decode:(o)=>{let i=v(o);if(H(i,["action","version"]),i.version!=1)return p();return Li(i.action)}}}function By(e){return{path:`/v1/connector/connections${Zy(e)}`,decode:(n)=>{let t=v(n);if(H(t,["connections","version"]),t.version!=1||!Array.isArray(t.connections))return p();return t.connections.map(zt)}}}function Ky(e,n){return{path:`/v1/connector/connections/${encodeURIComponent(e)}${Zy(n)}`,decode:(t)=>{let r=v(t);if(H(r,["connections","serviceId","version"]),r.version!=1||f(r.serviceId)!=e||!Array.isArray(r.connections))return p();return r.connections.map(zt)}}}function Mi(e){return Array.isArray(e)?e.map(f):p()}function OI(e){let n=v(e),t=n.draft===null?null:v(n.draft),r=v(n.sharedAccess);if(t!=null&&!Array.isArray(t.connections))return p();if(!Array.isArray(r.bindings))return p();let o=ce(r.accessRevision);if(o<0)return p();return{draft:t==null?null:{...t.calledFlowIds===void 0?{}:{calledFlowIds:Mi(t.calledFlowIds)},variableNames:Mi(t.variableNames),errorSourceFlowIds:Mi(t.errorSourceFlowIds),connections:t.connections.map((i)=>{let s=v(i);return{providerId:f(s.providerId),connectionId:f(s.connectionId)}})},sharedAccess:{accessRevision:o,providerIds:Mi(r.providerIds),bindings:r.bindings.map((i)=>{let s=v(i);return{providerId:f(s.providerId),connectionId:s.connectionId===null?null:f(s.connectionId),accessBindingId:f(s.accessBindingId)}})}}}function In(e){let n=v(e),t=n.status;if(n.version!=1)return p();if(t!="active"&&t!="retiring")return p();let r=n.live==null?void 0:v(n.live);if(r!=null&&(typeof r.enabled!="boolean"||typeof r.hasStart!="boolean"))return p();return{...r==null?{}:{live:{enabled:r.enabled,hasStart:r.hasStart,publicationId:f(r.publicationId),revisionId:f(r.revisionId)}},createdAt:f(n.createdAt),...n.connectorTeamId==null?{}:{connectorTeamId:f(n.connectorTeamId)},draftRevisionId:f(n.draftRevisionId),resourceReferences:OI(n.resourceReferences),flowId:f(n.flowId),name:f(n.name),status:t,updatedAt:f(n.updatedAt),version:1}}function jI(e){let n=v(e),t=ce(n.referenceCount);if(t<0)return p();return{...In(n),referenceCount:t}}function Wy(e){let n=v(e);if(n.version!=1||!Array.isArray(n.flows))return p();let{nextCursor:t,total:r}=n;if(t!=null&&typeof t!="string")return p();if(r!=null&&!Number.isSafeInteger(r))return p();return{...t==null?{}:{nextCursor:t},flows:n.flows.map(jI),...r==null?{}:{total:r},version:1}}function Fi(e){let n=v(e);if(H(n,["name","updatedAt","value","version"]),n.version!=1||typeof n.value!="string")return p();let t=f(n.updatedAt);try{if(new Date(t).toISOString()!=t)return p()}catch{return p()}return{name:f(n.name),updatedAt:t,value:n.value,version:1}}function Gy(e){let n=v(e),{referenceCount:t,...r}=n,o=ce(t);if(o<0)return p();return{...Fi(r),referenceCount:o}}function Hy(e){let n=v(e);if(typeof n.enabled!="boolean")return p();return{flowId:f(n.flowId),flowName:f(n.flowName),nodeId:f(n.nodeId),nodeName:f(n.nodeName),enabled:n.enabled}}function Qy(e){let n=v(e);if(H(n,["version","references"]),n.version!=1||!Array.isArray(n.references))return p();return{version:1,references:n.references.map((t)=>{let r=v(t);if(H(r,["flowId","flowName","draft","live"]),typeof r.draft!="boolean")return p();let o=r.live===null?null:v(r.live);if(o!=null){if(H(o,["publicationId","enabled"]),typeof o.enabled!="boolean")return p()}return{flowId:f(r.flowId),flowName:f(r.flowName),draft:r.draft,live:o==null?null:{publicationId:f(o.publicationId),enabled:o.enabled}}})}}function Yy(e){let n=v(e),t=n.parentRevisionId;if(n.version!=1||t!==null&&typeof t!="string")return p();return{actorId:f(n.actorId),createdAt:f(n.createdAt),digest:f(n.digest),flowId:f(n.flowId),modelVersion:ce(n.modelVersion),parentRevisionId:t,revisionId:f(n.revisionId),version:1}}function Jr(e){let n=v(e);try{return{...Yy(n),content:Pt(n.content)}}catch{return p()}}function Zi(e){let n=v(e);if(n.version!=1||ce(n.revision)<1)return p();return{revision:ce(n.revision),updatedAt:f(n.updatedAt),value:Object.fromEntries(Object.entries(v(n.value)).map(([t,r])=>[t,be(r)])),version:1}}function Ur(e){let n=v(e);if(n.version!=1)return p();return{revision:Yy(n.revision),version:1}}function Xy(e){let n=v(e);if(n.version!=1||n.kind!="snapshot")return p();return{draft:Jr(n.draft),kind:"snapshot",version:1}}var _I=["canceled","completed","failed","indeterminate"],Ji=[..._I,"queued","running","starting","waiting"];var RI=new Set(Ji);function Ui(e){return typeof e=="string"&&RI.has(e)?e:p()}function tb(e){let n=v(e),{source:t,startedAt:r,finishedAt:o}=n;if(n.version!=1||t!="draft"&&t!="live")return p();if(r!=null&&typeof r!="string")return p();if(o!=null&&typeof o!="string")return p();return{createdAt:f(n.createdAt),...o==null?{}:{finishedAt:o},flowId:f(n.flowId),revisionId:f(n.revisionId),runId:f(n.runId),source:t,...r==null?{}:{startedAt:r},status:Ui(n.status),version:1}}function AI(e){let n=v(e);H(n,["actions","expiresAt","nodeId","prompt","waitId","waitingSince"]);let t=n.actions;if(!Array.isArray(t)||!(t.length==1&&t[0]=="continue"||t.length==2&&t[0]=="approve"&&t[1]=="reject"))return p();return{actions:t,...n.autoContinueAt===void 0?{}:{autoContinueAt:f(n.autoContinueAt)},expiresAt:f(n.expiresAt),nodeId:f(n.nodeId),prompt:f(n.prompt),waitId:f(n.waitId),waitingSince:f(n.waitingSince)}}function eb(e){let n=v(e);return{flowId:f(n.flowId),runId:f(n.runId),nodeId:f(n.nodeId),executionId:f(n.executionId),...n.callId==null?{}:{callId:f(n.callId)}}}function PI(e){let n=v(e);if(!["workbench","cli","mcp","api","trigger","workflow"].includes(n.channel))return p();return{channel:n.channel,...n.actorId===void 0?{}:{actorId:f(n.actorId)}}}function Bi(e){let n=v(e),t=tb(n),r=n.eventsExpiresAt;if(r!=null&&typeof r!="string")return p();if(n.waiting!==void 0||!Array.isArray(n.waits))return p();let o=n.waits.map(AI);if(new Set(o.map((a)=>a.waitId)).size!=o.length||t.status=="waiting"&&o.length==0&&(!Array.isArray(n.calls)||n.calls.length==0)||["completed","failed","canceled","indeterminate"].includes(t.status)&&o.length>0)return p();if(n.occurrenceId!==void 0&&n.triggerNodeId===void 0)return p();let i={status:t.status,waits:o};if(n.calls!==void 0&&!Array.isArray(n.calls))return p();let s={...t,...n.initiator===void 0?{}:{initiator:PI(n.initiator)},...TI(n),...n.triggerNodeId===void 0?{}:{triggerNodeId:f(n.triggerNodeId)},...n.caller===void 0?{}:{caller:eb(n.caller)},...n.calls===void 0?{}:{calls:n.calls.map((a)=>Object.assign(eb(a),{status:v(a).status===null?null:Ui(v(a).status)}))},closureDigest:f(n.closureDigest),engineContract:f(n.engineContract),engineDigest:f(n.engineDigest),...r==null?{}:{eventsExpiresAt:r},modelVersion:ce(n.modelVersion),sharedAccessDigest:f(n.sharedAccessDigest),revisionDigest:f(n.revisionDigest),...i};switch(t.source){case"draft":return{...s,source:"draft"};case"live":return{...s,publicationId:f(n.publicationId),source:"live",...n.occurrenceId===void 0?{}:{occurrenceId:f(n.occurrenceId),triggerNodeId:f(n.triggerNodeId)}}}}function rb(e){let n=v(e),t=n.nextCursor;if(n.version!=1||!Array.isArray(n.runs))return p();if(t!=null&&typeof t!="string")return p();return{flowId:f(n.flowId),...t==null?{}:{nextCursor:t},runs:n.runs.map(tb),version:1}}function ob(e){let n=v(e),t=Ui(n.status);if(n.version!=1||typeof n.cancelAccepted!="boolean"||t=="queued"||t=="starting"||t=="running"||t=="waiting")return p();return{cancelAccepted:n.cancelAccepted,runId:f(n.runId),status:t,version:1}}function ib(e){let n=v(e);H(n,["action","comment","resolutionAccepted","resolvedAt","runId","status","version","waitId"]);let{action:t,resolvedAt:r}=n;if(n.version!=1||typeof n.resolutionAccepted!="boolean"||n.comment!==null&&typeof n.comment!="string"||t!==null&&t!="approve"&&t!="continue"&&t!="reject"||r!==null&&typeof r!="string"||t===null!=(r===null)||n.resolutionAccepted&&t===null)return p();return{action:t,comment:n.comment,resolutionAccepted:n.resolutionAccepted,resolvedAt:r,runId:f(n.runId),status:Ui(n.status),version:1,waitId:f(n.waitId)}}function sb(e){let n=v(e),t=n.status;if(n.version!=1)return p();let r={finishedAt:f(n.finishedAt),runId:f(n.runId),version:1};if(t=="completed"){if(!Object.hasOwn(n,"result"))return p();return{...r,result:n.result,status:"completed"}}if(t=="canceled")return{...r,status:"canceled"};if(t=="failed"){let o=v(n.error);return{...r,error:nb(o),status:"failed"}}if(t=="indeterminate"){let o=v(n.error);return{...r,error:nb(o),status:"indeterminate"}}return p()}function TI(e){let n=e.errorSource==null?void 0:v(e.errorSource);if(e.errorDispatches!=null&&!Array.isArray(e.errorDispatches))return p();return{...n==null?{}:{errorSource:{flowId:f(n.flowId),runId:f(n.runId)}},...e.errorDispatches==null?{}:{errorDispatches:e.errorDispatches.map((t)=>{let r=v(t),o=f(r.flowId);switch(r.status){case"pending":return{status:"pending",flowId:o};case"dispatched":return{status:"dispatched",flowId:o,runId:f(r.runId)};case"failed":return{status:"failed",flowId:o,message:f(r.message)};default:return p()}})}}}function nb(e){return{code:f(e.code),message:f(e.message),...e.nodeId===void 0?{}:{nodeId:f(e.nodeId)},...e.jobId===void 0?{}:{jobId:f(e.jobId)},...e.path===void 0?{}:{path:(Array.isArray(e.path)?e.path:p()).map(f)}}}function Ki(){let e=globalThis.crypto;if(e!=null){try{if(typeof e.randomUUID=="function")return e.randomUUID()}catch{}if(typeof e.getRandomValues=="function"){let n=e.getRandomValues(new Uint8Array(16));n[6]=(n[6]??0)&15|64,n[8]=(n[8]??0)&63|128;let t=Array.from(n,(r)=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function cb(e){return e?.kind=="run.completed"||e?.kind=="run.failed"||e?.kind=="run.canceled"||e?.kind=="run.indeterminate"}function $I(e){let n=v(e),t=ce(n.sequence);if(t<0)return p();let r={createdAt:f(n.createdAt),sequence:t},o=v(n.payload),i=n.kind;switch(i){case"run.queued":return{...r,kind:i,payload:{}};case"run.started":return{...r,kind:i,payload:{flowId:f(o.flowId),scopeId:f(o.scopeId),...o.parentScopeId===void 0?{}:{parentScopeId:f(o.parentScopeId)}}};case"run.progress":return{...r,kind:i,payload:{flowId:f(o.flowId),scopeId:f(o.scopeId),progress:ab(o.progress)}};case"run.waiting":if(!Array.isArray(o.waitIds))return p();return{...r,kind:i,payload:{waitIds:o.waitIds.map((s)=>f(s))}};case"wait.created":{let s=o.autoContinueAt===void 0?{}:{autoContinueAt:f(o.autoContinueAt)};return{...r,kind:i,payload:{...s,expiresAt:f(o.expiresAt),nodeId:f(o.nodeId),waitId:f(o.waitId),waitingSince:f(o.waitingSince)}}}case"run.resolved":{let{action:s,source:a}=o;if(a!==void 0&&a!=="manual"&&a!=="automatic")return p();let c=a===void 0?{}:{source:a};if(s!=="approve"&&s!=="continue"&&s!=="reject")return p();if(o.comment!==null&&typeof o.comment!="string")return p();return{...r,kind:i,payload:{...c,action:s,comment:o.comment,resolvedAt:f(o.resolvedAt),waitId:f(o.waitId)}}}case"run.completed":case"run.canceled":case"run.failed":case"run.indeterminate":return{...r,kind:i,payload:{result:be(o.result)}};case"run.events-truncated":return{...r,kind:i,payload:Object.fromEntries(Object.entries(o).map(([s,a])=>[s,be(a)]))};case"node.started":case"node.completed":case"node.failed":case"node.log":case"node.progress":case"node.artifact":{let s={flowId:f(o.flowId),scopeId:f(o.scopeId),nodeId:f(o.nodeId),executionId:f(o.executionId)};switch(i){case"node.started":{let a=o.nodeKind;if(a!==void 0&&a!=="approval"&&a!=="condition"&&a!=="connector"&&a!=="javascript"&&a!=="decision"&&a!=="openapi"&&a!=="http-request"&&a!=="llm"&&a!=="agent"&&a!=="value"&&a!=="outputs"&&a!=="webhook-response"&&a!=="workflow"&&a!=="wait")return p();return{...r,kind:i,payload:{...s,...a===void 0?{}:{nodeKind:a},...o.nodeTitle===void 0?{}:{nodeTitle:f(o.nodeTitle)},...o.operation===void 0?{}:{operation:f(o.operation)}}}}case"node.completed":return{...r,kind:i,payload:{...s,...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(v(o.systemOutputs)).map(([a,c])=>[a,be(c)]))},outputs:Object.fromEntries(Object.entries(v(o.outputs)).map(([a,c])=>[a,be(c)]))}};case"node.failed":{let a=v(o.error);return{...r,kind:i,payload:{...s,...o.handled===!0?{handled:!0}:{},...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(v(o.systemOutputs)).map(([c,l])=>[c,be(l)]))},error:{code:f(a.code),message:f(a.message)}}}}case"node.log":{let a=o.level;if(a!=="debug"&&a!=="info"&&a!=="warn"&&a!=="error")return p();return{...r,kind:i,payload:{...s,level:a,message:f(o.message)}}}case"node.progress":return{...r,kind:i,payload:{...s,progress:ab(o.progress)}};case"node.artifact":{let a=v(o.artifact),c=ce(a.size),l=f(a.digest);if(a.kind!="artifact"||c<0||!/^sha256:[0-9a-f]{64}$/.test(l))return p();return{...r,kind:i,payload:{...s,artifact:{kind:"artifact",id:f(a.id),name:f(a.name),size:c,digest:l,...a.mediaType===void 0?{}:{mediaType:f(a.mediaType)}}}}}}}default:return p()}}function ab(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=100?e:p()}function NI(e){let n=v(e),t=n.eventsExpiresAt,r=ce(n.nextAfter);if(n.version!=1||!Array.isArray(n.events)||typeof n.done!="boolean"||typeof n.historyComplete!="boolean")return p();if(t!=null&&typeof t!="string")return p();if(r<0)return p();return{done:n.done,events:n.events.map($I),...t==null?{}:{eventsExpiresAt:t},historyComplete:n.historyComplete,nextAfter:r,runId:f(n.runId),version:1}}var _=encodeURIComponent;function tt(e){return`${e}-${Ki()}`}class iu{constructor(e,n="api"){this.channel=n,this.requestControl=e}async loadOpenApiDocument(e,n){let t=v(await this.request("/v1/openapi/document",{method:"POST",body:JSON.stringify({url:e,version:1}),signal:n}));if(t.version!=1)return p();return be(t.document)}async listFlows(e={}){let n=new URLSearchParams;if(e.cursor!=null)n.set("cursor",e.cursor);if(e.limit!=null)n.set("limit",String(e.limit));if(e.includeTotal!=null)n.set("includeTotal",String(e.includeTotal));let t=n.size==0?"":`?${n}`;return Wy(await this.request(`/v1/flows${t}`,e.signal==null?void 0:{signal:e.signal}))}async listEventSources(e,n){return eu(await this.request("/v1/event-sources"+(e==null?"":`?flowId=${_(e)}`),{signal:n}))}async listEventSourceConnections(e,n,t="feishu"){let r=v(await this.request(`/v1/event-sources/connections?kind=${t}${e==null?"":`&teamId=${_(e)}`}`,{signal:n}));if(H(r,["version","connections"]),r.version!=1||!Array.isArray(r.connections))return p();return r.connections.map(zt)}async createEventSource(e){return Vi(await this.request("/v1/event-sources",{method:"POST",body:JSON.stringify(e)}))}async updateEventSource(e,n){return Vi(await this.request(`/v1/event-sources/${_(e)}`,{method:"PUT",body:JSON.stringify(n)}))}async deleteEventSource(e,n){await this.request(`/v1/event-sources/${_(e)}`,{method:"DELETE",body:JSON.stringify({version:1,expectedRevision:n})})}async listVariables(){let e=v(await this.request("/v1/variables"));if(H(e,["variables","version"]),e.version!=1||!Array.isArray(e.variables))return p();return{variables:e.variables.map(Gy),version:1}}async getFlowReferences(e,n={}){let t=new URLSearchParams({direction:n.direction??"incoming",offset:String(n.offset??0),limit:String(n.limit??50)});return Rh.parse(await this.request(`/v1/flows/${_(e)}/references?${t}`,{signal:n.signal}))}async getWorkflowContract(e,n){return _h.parse(await this.request(`/v1/flows/${_(e)}/call-contract`,{signal:n}))}async getVariableReferences(e,n){return Qy(await this.request(`/v1/variables/${_(e)}/references`,{signal:n}))}async getVariable(e){return Fi(await this.request(`/v1/variables/${_(e)}`))}async putVariable(e,n){return Fi(await this.request(`/v1/variables/${_(e)}`,{body:JSON.stringify({value:n}),method:"PUT"}))}async deleteVariable(e){let n=v(await this.request(`/v1/variables/${_(e)}`,{method:"DELETE"}));if(H(n,["version"]),n.version!=1)return p()}async exportFlow(e){let n=await this.request(`/v1/flows/${_(e)}/export`);try{return Di(n)}catch{return p()}}async importFlow(e,n={}){return In(await this.request("/v1/flows/import",{method:"POST",headers:{"Idempotency-Key":n.idempotencyKey??`flow-${Ki()}`},body:JSON.stringify({file:e,name:n.name,teamId:n.teamId,version:1})}))}async createFlow(e,n=`flow-${Ki()}`,t){return In(await this.request("/v1/flows",{body:JSON.stringify({name:e,...t==null?{}:{teamId:t},version:1}),headers:{"idempotency-key":n},method:"POST"}))}async broadcastCanvas(e,n){let t=v(await this.request(`/v1/flows/${_(e)}/canvas`,{method:"POST",body:JSON.stringify({version:1,command:n})}));if(H(t,["version","flowId","broadcast"]),t.version!=1||t.broadcast!==!0||t.flowId!==e)return p();return{version:1,flowId:f(t.flowId),broadcast:!0}}async getFlow(e){return In(await this.request(`/v1/flows/${_(e)}`))}async getErrorListeners(e,n){let t=v(await this.request(`/v1/flows/${_(e)}/error-listeners`,{signal:n}));if(t.version!=1||!Array.isArray(t.listeners))return p();return t.listeners.map(Hy)}async renameFlow(e,n){return In(await this.request(`/v1/flows/${_(e)}`,{body:JSON.stringify({name:n,version:1}),method:"PATCH"}))}async deleteFlow(e){return In(await this.request(`/v1/flows/${_(e)}`,{method:"DELETE"}))}async listTriggerKeys(e,n){let t=v(await this.request(`/v1/trigger-keys${n==null?"":`?locale=${encodeURIComponent(n)}`}`,{signal:e}));if(t.version!=1||!Array.isArray(t.keys))return p();return t.keys.map(Ul)}async listTriggerDefinitions(e){let n=v(await this.request("/v1/trigger-keys/catalog",{signal:e}));if(n.version!=2||!Array.isArray(n.definitions))return p();return n.definitions.map(Mr)}async readCatalog(e,n,t){let r=new Headers;if(n)r.set("if-none-match",n);let o=await this.response(e.path,{headers:r,signal:t},!0),i=o.headers.get("etag")?.trim()||null;if(o.status==304)return{modified:!1,etag:i};return{modified:!0,data:e.decode(await o.json()),etag:i}}async getTriggerCatalog(e,n,t){let r=new Headers;if(n?.etag)r.set("if-none-match",n.etag);let o=await this.response(`/v1/trigger-keys/catalog?locale=${encodeURIComponent(e)}`,{headers:r,signal:t},!0);if(o.status==304){if(n==null)return p();return{...n,etag:o.headers.get("etag")?.trim()||n.etag}}return{data:nu(await o.json()),etag:o.headers.get("etag")?.trim()||null}}async getTriggerKey(e,n){let t=v(await this.request(`/v1/trigger-keys/${_(e)}`,{signal:n}));if(t.version!=1)return p();return Mr(t.definition)}async listFlowTriggerBindings(e,n){let t=v(await this.request(`/v1/flows/${_(e)}/triggers`,{signal:n}));if(t.version!=1||f(t.flowId)!=e||!Array.isArray(t.bindings))return p();return t.bindings.map(Fr)}async getFlowTriggerBinding(e,n){return hy(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}`))}async listFlowTriggerActivities(e,n,t={}){let r=new URLSearchParams;if(t.cursor!=null)r.set("cursor",t.cursor);if(t.limit!=null)r.set("limit",String(t.limit));let o=r.size==0?"":`?${r}`;return yy(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}/activities${o}`))}async testFlowPollTrigger(e,n){return by(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}/test`,{body:JSON.stringify({version:1}),method:"POST"}))}async getEditor(e){let n=v(await this.request(`/v1/flows/${_(e)}/editor`));if(n.version!=1)return p();let t={flow:In(n.flow),draft:Jr(n.draft),live:Jl(n.live),presentation:Zi(n.presentation),version:1};if(t.flow.flowId!=e||t.draft.flowId!=e||t.live.flowId!=e||t.flow.draftRevisionId!=t.draft.revisionId)return p();return t}async getPublicationPresentation(e,n,t){let r=v(await this.request(`/v1/flows/${_(e)}/publications/${_(n)}/presentation`,{signal:t}));if(r.version!=1)return p();return{version:1,presentation:r.presentation===null?null:Zi(r.presentation)}}async getPresentation(e){return Zi(await this.request(`/v1/flows/${_(e)}/presentation`))}async getDraft(e){return Jr(await this.request(`/v1/flows/${_(e)}/draft`))}async syncDraft(e){return Xy(await this.request(`/v1/flows/${_(e)}/draft/sync`))}async getRevision(e,n,t){return Jr(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}`,{signal:t}))}async listTriggerConfigOptions(e,n,t,r){let o=v(await this.request(`/v1/flows/${_(e)}/triggers/${_(n)}/options/${_(t)}`,{signal:r}));if(H(o,["options","version"]),o.version!=1||!Array.isArray(o.options)||o.options.length>1000)return p();return o.options.map((i)=>{let s=v(i);H(s,["value","label",...s.color==null?[]:["color"]]);let a=s.color==null?void 0:f(s.color);if(a!=null&&!/^#[0-9a-fA-F]{6}$/.test(a))return p();return a==null?{value:f(s.value),label:f(s.label)}:{value:f(s.value),label:f(s.label),color:a}})}async listConnectorTeams(e){let n=v(await this.request("/v1/connector/teams",{signal:e}));if(H(n,["enabled","teams","version"]),n.version!=1||typeof n.enabled!="boolean"||!Array.isArray(n.teams))return p();return{enabled:n.enabled,teams:n.teams.map((t)=>{let r=v(t);if(H(r,["id","name","systemCreated"]),typeof r.systemCreated!="boolean")return p();return{id:f(r.id),name:f(r.name),systemCreated:r.systemCreated}}),version:1}}async listConnectorProviders(e,n,t){let r=Jy(n,t);return this.connectorRequest(r.path,"providers",e,r.decode)}async listLeinaBots(e,n){return Py(await this.request(`/v1/connector/leina/bots?flowId=${_(e)}`,{signal:n}))}async removeConnectionUsage(e,n,t,r,o){return Ur(await this.request(`/v1/flows/${_(e)}/connection-usage/remove`,{method:"POST",headers:{"idempotency-key":o},body:JSON.stringify({connectionId:n,expectedRevisionId:t,expectedAccessRevision:r,version:1})}))}async getConnectorAccess(e,n){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access`,{signal:n}))}async getPublishedConnectorAccess(e,n,t){return Ql(await this.request(`/v1/flows/${_(e)}/connector-access?publicationId=${_(n)}`,{signal:t}))}async listProviderAccessBindingCandidates(e,n,t){return $y(await this.request(`/v1/flows/${_(e)}/connector-access/candidates/query`,{method:"POST",body:JSON.stringify({providerIds:n,version:1}),signal:t}),n)}async setConnectorService(e,n,t,r){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access/${_(n)}/service`,{body:JSON.stringify({expectedAccessRevision:r,version:1}),method:t?"PUT":"DELETE"}))}async addProviderAccessBinding(e,n,t,r){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access/${_(n)}`,{body:JSON.stringify({accessBindingId:t,expectedAccessRevision:r,version:1}),method:"PUT"}))}async removeProviderAccessBinding(e,n,t,r){return Nt(await this.request(`/v1/flows/${_(e)}/connector-access/${_(n)}`,{body:JSON.stringify({accessBindingId:t,expectedAccessRevision:r,version:1}),method:"DELETE"}))}async listConnectorActions(e,n,t,r){return await this.connectorActions({...r==null?{}:{locale:r},...t==null?{}:{flowId:t},...e==null?{}:{service:e}},n)}async searchConnectorActions(e,n,t,r){return await this.connectorActions({...r==null?{}:{locale:r},...t==null?{}:{flowId:t},q:e.trim()},n)}async getConnectorAction(e,n,t,r,o=!1){let i=Uy(e,t,r);return this.connectorRequest(i.path,"actions",n,i.decode,o)}async listAllConnectorConnections(e,n,t=!1){let r=By(n);return this.connectorRequest(r.path,"connections",e,r.decode,t)}async listConnectorConnections(e,n,t,r=!1){let o=Ky(e,t);return this.connectorRequest(o.path,"connections",n,o.decode,r)}async createConnectorConnectionPage(e,n,t){let r=new URLSearchParams;if(n!=null)r.set("flowId",n);if(t!=null)r.set("teamId",t);let o=v(await this.request(`/v1/connector/connections/${_(e)}/page${r.size==0?"":`?${r}`}`,{body:JSON.stringify({version:1}),method:"POST"}));if(H(o,["url","version"]),o.version!=1)return p();try{let i=new URL(f(o.url));if(i.protocol!="http:"&&i.protocol!="https:")return p();return i.href}catch{return p()}}async readAuthoring(e,n={}){return dy.parse(await this.request(`/v1/flows/${_(e)}/authoring/read`,{method:"POST",body:JSON.stringify(n)}))}async searchAuthoring(e,n){return py.parse(await this.request(`/v1/flows/${_(e)}/authoring/search`,{method:"POST",body:JSON.stringify(n)}))}async authoringSchema(e,n){return v(await this.request(`/v1/flows/${_(e)}/authoring/schema`,{method:"POST",body:JSON.stringify(n)}))}async editAuthoring(e,n){return uy.parse(await this.request(`/v1/flows/${_(e)}/authoring/edit`,{method:"POST",headers:{"idempotency-key":n.requestId},body:JSON.stringify(n)}))}async checkAuthoring(e,n){return ly.parse(await this.request(`/v1/flows/${_(e)}/authoring/check`,{method:"POST",body:JSON.stringify({revisionId:n})}))}async changeDraft(e,n,t,r=tt("change")){return Ur(await this.request(`/v1/flows/${_(e)}/draft/changes`,{body:JSON.stringify({expectedRevisionId:n,operations:t,version:1}),headers:{"idempotency-key":r},method:"POST"}))}async repairDraft(e,n,t=tt("repair")){return Ur(await this.request(`/v1/flows/${_(e)}/draft/repair`,{body:JSON.stringify({expectedRevisionId:n,version:1}),headers:{"idempotency-key":t},method:"POST"}))}async upgradeDraft(e,n,t={}){return Ur(await this.request(`/v1/flows/${_(e)}/draft/upgrade`,{body:JSON.stringify({expectedRevisionId:n,version:1}),headers:{"idempotency-key":t.idempotencyKey??tt("upgrade")},method:"POST"}))}async checkFlow(e,n){return Fy(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}/check`,{body:JSON.stringify({engineContract:ro,version:1}),method:"POST"}))}async getLiveDetails(e,n){let t=vy(await this.request(`/v1/flows/${_(e)}/live/details`,{signal:n}));if(t.flowId!=e)return p();return t}async getLive(e,n){return Jl(await this.request(`/v1/flows/${_(e)}/live`,{signal:n}))}async listPublications(e,n={},t){let r=new URLSearchParams;if(n.cursor!=null)r.set("cursor",n.cursor);if(n.limit!=null)r.set("limit",String(n.limit));if(n.includeTotal!=null)r.set("includeTotal",String(n.includeTotal));let o=r.size==0?"":`?${r}`;return my(await this.request(`/v1/flows/${_(e)}/publications${o}`,{signal:t}))}async createDraftRun(e,n,t){let r=Bi(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}/runs`,{body:JSON.stringify({engineContract:ro,inputs:t.inputs??{},trigger:t.trigger,version:2}),headers:{"idempotency-key":t.idempotencyKey??tt("run"),"x-open-flow-client":this.channel},method:"POST"}));return r.source=="draft"?r:p()}async createLiveRun(e,n){let t=Bi(await this.request("/v1/runs",{body:JSON.stringify({inputs:n.inputs??{},trigger:n.trigger,publicationId:e,version:2}),headers:{"idempotency-key":n.idempotencyKey??tt("run"),"x-open-flow-client":this.channel},method:"POST"}));return t.source=="live"?t:p()}async setFlowEnabled(e,n,t){return In(await this.request(`/v1/flows/${_(e)}/enabled`,{method:"PUT",body:JSON.stringify({enabled:t,expectedPublicationId:n,version:1})}))}async publishFlow(e,n,t,r={}){return Zl(await this.request(`/v1/flows/${_(e)}/revisions/${_(n)}/publications`,{body:JSON.stringify({engineContract:ro,expectedLivePublicationId:t,version:1}),headers:{"idempotency-key":r.idempotencyKey??tt("publication")},method:"POST"}))}async getPublishOperation(e,n,t){return Zl(await this.request(`/v1/flows/${_(e)}/publish-operations/${_(n)}`,{signal:t}))}async rollbackFlow(e,n,t,r={}){return $t(await this.request(`/v1/flows/${_(e)}/publications/${_(n)}/rollback`,{body:JSON.stringify({expectedLivePublicationId:t,version:1}),headers:{"idempotency-key":r.idempotencyKey??tt("publication")},method:"POST"}))}async getRun(e,n){return Bi(await this.request(`/v1/runs/${_(e)}`,{signal:n}))}async listRuns(e,n={}){let t=new URLSearchParams;if(n.cursor!=null)t.set("cursor",n.cursor);if(n.limit!=null)t.set("limit",String(n.limit));if(n.status!=null)t.set("status",n.status);if(n.pendingWait!=null)t.set("pendingWait",String(n.pendingWait));if(n.source!=null)t.set("source",n.source);if(n.createdFrom!=null)t.set("createdFrom",n.createdFrom);if(n.createdBefore!=null)t.set("createdBefore",n.createdBefore);if(n.runId!=null)t.set("runId",n.runId);let r=t.size==0?"":`?${t}`;return rb(await this.request(`/v1/flows/${_(e)}/runs${r}`))}async getRunEvents(e,n={},t){let r=new URLSearchParams;if(n.after!=null)r.set("after",String(n.after));if(n.limit!=null)r.set("limit",String(n.limit));let o=r.size==0?"":`?${r}`;return NI(await this.request(`/v1/runs/${_(e)}/events${o}`,{signal:t}))}async listRunResults(e,n,t){return ru(await this.request(`/v1/runs/${_(e)}/results${n==null?"":`?after=${encodeURIComponent(n)}`}`,{signal:t}))}async readRunResult(e,n,t={},r){let o=new URLSearchParams(Object.entries(t).map(([i,s])=>[i,String(s)]));return ou(await this.request(`/v1/runs/${_(e)}/results/${_(n)}?${o}`,{signal:r}))}async downloadRunResult(e,n,t){return(await this.response(`/v1/runs/${_(e)}/results/${_(n)}/content`,{signal:t})).blob()}async getRunResult(e,n){return sb(await this.request(`/v1/runs/${_(e)}/result`,{signal:n}))}async cancelRun(e){return ob(await this.request(`/v1/runs/${_(e)}/cancel`,{body:JSON.stringify({version:1}),method:"POST"}))}async resolveRunWait(e,n,t,r){return ib(await this.request(`/v1/runs/${_(e)}/waits/${_(n)}/resolve`,{body:JSON.stringify({action:t,comment:r,version:1}),method:"POST"}))}async connectorActions(e,n){let t=Object.entries(e).map(([o,i])=>`${_(o)}=${_(i)}`).join("&"),r=t==""?"":`?${t}`;return this.connectorRequest(`/v1/connector/actions${r}`,"actions",n,(o)=>{let i=v(o);if(H(i,["actions","version"]),i.version!=1||!Array.isArray(i.actions))return p();return i.actions.map(Li)})}async connectorRequest(e,n,t,r,o=!1){return r(await this.request(e,{signal:t}))}async response(e,n,t=!1){let r=new Headers(n.headers);if(n.body!=null)r.set("content-type","application/json");let o=await this.requestControl(e,{...n,headers:r});if(!o.ok&&!(t&&o.status==304)){let i;try{i=await o.json()}catch{return p()}let s=v(i).error,a=s==null?void 0:v(s);throw new Pe(o.status,typeof a?.code=="string"?a.code:"request.failed",typeof a?.message=="string"?a.message:`Request failed with status ${o.status}.`,a?.details==null?void 0:v(a.details))}return o}async request(e,n={}){let t=await this.response(e,n);try{return await t.json()}catch{return p()}}}import{randomUUID as MI}from"crypto";class O extends Error{constructor(e,n,t){super(n);this.code=e,this.details=t,this.name="CliError"}}function Wi(e,n){let t=e.trim();if(zi(t)!=null)throw new O("cli.invalid-arguments",`${n} name must be between 1 and ${Wl} characters and use only letters, numbers, spaces, hyphens, or underscores.`);return t}var zI=100,su=100,au=100,DI=new Set(["canceled","completed","failed","indeterminate"]);async function qI(e){let n=[],t=new Set,r;do{let o=await e.listFlows({cursor:r,limit:zI});if(n.push(...o.flows),r=o.nextCursor,r!=null&&t.has(r))throw new O("page.invalid-cursor","The deployment returned a repeated Flow cursor.");if(r!=null)t.add(r)}while(r!=null);return n}function LI(e,n){let t=e.find((o)=>o.flowId==n);if(t!=null)return t;let r=e.filter((o)=>o.name==n);if(r.length==1)return r[0];if(r.length>1)throw new O("flow.ambiguous",`Flow name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({flowId:o,name:i})=>({flowId:o,name:i}))});throw new O("flow.not-found",`Flow ${JSON.stringify(n)} was not found.`)}async function ve(e,n){try{return await e.getFlow(n)}catch(t){if(!(t instanceof Pe)||t.code!="flow.invalid"&&t.code!="flow.not-found")throw t}return LI(await qI(e),n)}async function lb(e,n,t){if(t.expectedRevision!=null&&t.expectedRevision!=n.draftRevisionId&&!t.options.includes("idempotency-key"))throw new O("flow.revision-conflict","The Flow Draft changed. Inspect it before submitting a new mutation.",{expectedRevisionId:t.expectedRevision,actualRevisionId:n.draftRevisionId,flowId:n.flowId});let r=await e.getRevision(n.flowId,t.expectedRevision??n.draftRevisionId);return{draft:r,flow:n,graph:r.content.document.graph}}function VI(e,n){let t=e.find((o)=>o.actionId==n);if(t!=null)return t;let r=e.filter((o)=>o.name==n);if(r.length==1)return r[0];if(r.length>1)throw new O("connector.action-ambiguous",`Connector Action name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({actionId:o,name:i,serviceId:s})=>({actionId:o,name:i,serviceId:s}))});throw new O("connector.action-not-found",`Connector Action ${JSON.stringify(n)} was not found.`)}async function ub(e,n,t){try{return await e.getConnectorAction(n,void 0,t)}catch(r){if(!(r instanceof Pe)||r.status!=404)throw r}return VI(await e.searchConnectorActions(n,void 0,t),n)}function db(e,n){let t=Object.entries(e.document.graph.nodes).filter((i)=>!("inputs"in i[1])),r=t?.find(([i])=>i==n);if(r!=null)return{trigger:r[1],triggerId:r[0]};let o=t?.filter(([,i])=>i.name==n)??[];if(o.length==1)return{trigger:o[0][1],triggerId:o[0][0]};if(o.length>1)throw new O("trigger.ambiguous",`Trigger name ${JSON.stringify(n)} is ambiguous.`,{candidates:o.map(([i,s])=>({name:s.name,triggerId:i}))});throw new O("trigger.not-found",`Trigger ${JSON.stringify(n)} was not found.`)}function cu(e){return`${e.displayName} ${e.key} ${e.provider} ${e.type}`}async function pb(e,n){try{return await e.getTriggerKey(n)}catch(o){if(!(o instanceof Pe)||o.status!=404)throw o}let r=(await e.listTriggerKeys()).filter((o)=>o.name==n||o.displayName==n);if(r.length==1)return await e.getTriggerKey(r[0].key);if(r.length>1)throw new O("trigger-key.ambiguous",`Trigger Key name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({displayName:o,key:i,provider:s})=>({displayName:o,key:i,provider:s}))});throw new O("trigger-key.not-found",`Trigger Key ${JSON.stringify(n)} was not found.`)}function fb(e){return`${e.displayName} ${e.connectionId} ${e.serviceId} ${e.status}${e.isDefault?"\tdefault":""}`}function lu(e){return`${e.name} ${e.actionId} ${e.serviceName} ${e.serviceId}`}function pe(e,n,t){if(e.length!=n)throw new O("cli.invalid-arguments",`Usage: ${t}`)}function F(e,n,t,r){e.stdout.write(n?`${JSON.stringify(t)}
64
64
  `:`${r}
65
- `)}function qn(e){return`${e.name} ${e.flowId} ${e.status}`}function Br(e){return`${e.operation} ${e.publicationId} ${e.revisionId} ${e.createdAt}`}function Kr(e){let n=e.source=="draft"?"":` ${e.publicationId}`;return`${e.source} ${e.status} ${e.runId} ${e.revisionId}${n}${e.waits.length==0?"":`
66
- ${JSON.stringify(e.waits)}`}`}function ob(e){return`${e.source} ${e.status} ${e.runId} ${e.revisionId}`}function ib(e){return`${e.sequence} ${e.kind} ${JSON.stringify(e.payload)}`}async function Cn(e,n,t,r){try{if(e=="-")return await r.readStdin();if(!e.startsWith("@"))return e;let o=e.slice(1);if(o.length==0)throw new E("cli.invalid-arguments",`${n} @ requires a file path.`);return await r.readFile(o)}catch(o){if(o instanceof E)throw o;throw new E(t,o instanceof Error?o.message:String(o))}}async function sb(e,n){if(e.input==null)return{};let t=await Cn(e.input,"--input","run.input-unreadable",n),r;try{r=JSON.parse(t)}catch{throw new E("run.input-invalid","Run input must be valid JSON.")}if(r==null||typeof r!="object"||Array.isArray(r))throw new E("run.input-invalid","Run input must be an object keyed by node ID.");for(let o of Object.values(r))if(o==null||typeof o!="object"||Array.isArray(o))throw new E("run.input-invalid","Each Run input node must contain an object keyed by input handle.");return r}async function Wr(e,n,t){let r=new Set,o;do{let i=await e.listPublications(n,{cursor:o,limit:nu}),s=i.publications.find((a)=>a.publicationId==t);if(s!=null)return s;if(o=i.nextCursor,o!=null&&r.has(o))throw new E("page.invalid-cursor","The deployment returned a repeated Publication cursor.");if(o!=null)r.add(o)}while(o!=null);throw new E("publication.not-found",`Publication ${JSON.stringify(t)} was not found.`)}async function iu(e,n,t,r=60000){let o=Date.now()+r,i=n;while(!II.has(i.status)&&i.waits.length==0){let s=o-Date.now();if(s<=0)return{run:i,timedOut:!0};if(await t.wait(Math.min(1000,s)),Date.now()>=o)return{run:i,timedOut:!0};try{i=await e.getRun(i.runId,AbortSignal.timeout(Math.max(1,o-Date.now())))}catch(a){if(Date.now()>=o||a instanceof Error&&a.name=="TimeoutError")return{run:i,timedOut:!0};throw new E("run.wait-failed",a instanceof Error?a.message:String(a),{runId:i.runId})}}return{run:i,timedOut:!1}}function Gr(e,n=!1){if(n)return 3;if(e.waits.length>0)return 2;return e.status=="failed"||e.status=="canceled"||e.status=="indeterminate"?1:0}function ab(e){return new E(e.code,e.message,{status:e.status,...e.details})}async function su(e,n,t,r,o=60000){let i=Date.now()+o,s=t;while(s.status=="pending"){let a=i-Date.now();if(a<=0)return{operation:s,timedOut:!0};if(await r.wait(Math.min(1000,a)),Date.now()>=i)return{operation:s,timedOut:!0};try{s=await e.getPublishOperation(n,s.operationId,AbortSignal.timeout(Math.max(1,i-Date.now())))}catch(c){if(Date.now()>=i||c instanceof Error&&c.name=="TimeoutError")return{operation:s,timedOut:!0};throw new E("publication.wait-failed",c instanceof Error?c.message:String(c),{flowId:n,operationId:s.operationId})}}return{operation:s,timedOut:!1}}var jI=new Set(Fi);function cb(e){let n=_I(),t,r=[],o=[],i,s,a,c,l,u,d,g,h,y,S,j,N,D,V,Ee,fe,ie,Le,rt=!1,ot,it=!1,st,Vt,Yr=[],wu="draft",Qi,Yi,vu=!1,Xi,es,ns,xu=[],ku=!1,Su=!1;for(let Mt=0;Mt<e.length;Mt+=1){let qt=e[Mt],Xr=qt.startsWith("--")?qt.indexOf("="):-1,A=Xr<0?qt:qt.slice(0,Xr),eo=Xr<0?void 0:qt.slice(Xr+1);if(eo!=null&&["--json","--follow","--wait","--yes","--full","--pending-wait"].includes(A))throw new E("cli.invalid-arguments",`${A} does not accept a value.`);if(A.startsWith("--")){let U=A.slice(2);if(o.includes(U)&&U!="set"&&U!="unset")throw new E("cli.invalid-arguments",`Duplicate option --${U}.`);o.push(U)}if(A=="--json")it=!0;else if(A=="--follow")rt=!0;else if(A=="--wait")ku=!0;else if(A=="--yes")Su=!0;else if(A=="--pending-wait")Qi=!0;else if(A=="--full")vu=!0;else if(A=="--idempotency-key"||A=="--expected-publication"||A=="--revision"||A=="--publication"||A=="--pointer"||A=="--offset"||A=="--max-bytes"||A=="--code"||A=="--connection"||A=="--cron"||A=="--description"||A=="--every"||A=="--expected-revision"||A=="--file"||A=="--flow"||A=="--name"||A=="--source"||A=="--input"||A=="--trigger"||A=="--outputs"||A=="--status"||A=="--cursor"||A=="--limit"||A=="--after"||A=="--comment"||A=="--timeout"||A=="--timezone"||A=="--set"||A=="--unset"){let U=eo??e[Mt+1];if(U==null||U.length==0||eo==null&&U.startsWith("-")&&U!="-")throw new E("cli.invalid-arguments",`${A} requires a value.`);if(eo==null)Mt++;if(A=="--idempotency-key")n=U;else if(A=="--expected-publication")t=U;else if(A=="--revision")a=U;else if(A=="--publication")c=U;else if(A=="--pointer")l=U;else if(A=="--after")h=U;else if(A=="--code")S=U;else if(A=="--connection")j=U;else if(A=="--cron")N=U;else if(A=="--description")V=U;else if(A=="--every")Ee=U;else if(A=="--expected-revision")fe=U;else if(A=="--file")ie=U;else if(A=="--flow")Le=U;else if(A=="--name")Vt=U;else if(A=="--comment")Xi=U;else if(A=="--input")ot=U;else if(A=="--trigger")i=U;else if(A=="--outputs")s=U;else if(A=="--cursor")D=U;else if(A=="--timezone")ns=U;else if(A=="--set")Yr.push(U);else if(A=="--unset")xu.push(U);else if(A=="--source"){if(U!="draft"&&U!="live")throw new E("cli.invalid-arguments","--source must be draft or live.");wu=U}else if(A=="--status"){if(!jI.has(U))throw new E("cli.invalid-arguments",`Unknown Run status ${JSON.stringify(U)}.`);Yi=U}else{let On=Number(U),Wb=A=="--offset"?0:1;if(!Number.isSafeInteger(On)||On<Wb||A=="--limit"&&On>100||A=="--max-bytes"&&On>1048576)throw new E("cli.invalid-arguments",`${A} has an invalid value.`);if(A=="--limit")st=On;else if(A=="--offset")u=On;else if(A=="--max-bytes")d=On;else es=On}}else if(A.startsWith("-"))throw new E("cli.invalid-arguments",`Unknown option ${JSON.stringify(A)}.`);else r.push(A)}if(h!=null){if(r[0]=="runs"&&r[1]=="results")g=h;else if(y=Number(h),!Number.isSafeInteger(y)||y<0)throw new E("cli.invalid-arguments","--after must be a non-negative event sequence.")}return{idempotencyKey:n,...g==null?{}:{resultAfter:g},...d==null?{}:{maxBytes:d},...u==null?{}:{offset:u},...l==null?{}:{pointer:l},...a==null?{}:{revision:a},...c==null?{}:{publication:c},...Xi==null?{}:{comment:Xi},...t==null?{}:{expectedPublication:t},...y==null?{}:{after:y},...S==null?{}:{code:S},...j==null?{}:{connection:j},...N==null?{}:{cron:N},...D==null?{}:{cursor:D},...V==null?{}:{description:V},...Ee==null?{}:{every:Ee},...fe==null?{}:{expectedRevision:fe},...ie==null?{}:{file:ie},...Le==null?{}:{flow:Le},follow:rt,...ot==null?{}:{input:ot},json:it,...st==null?{}:{limit:st},...Vt==null?{}:{name:Vt},positionals:r,options:o,...i==null?{}:{trigger:i},...s==null?{}:{outputs:s},sets:Yr,source:wu,...Yi==null?{}:{status:Yi},...Qi==null?{}:{pendingWait:Qi},full:vu,...es==null?{}:{timeoutMs:es},...ns==null?{}:{timezone:ns},unsets:xu,wait:ku,yes:Su}}var RI=0.1,AI=3,tt=an("type",[x({type:w("focus"),nodeId:R().min(1)}),x({type:w("zoom"),zoom:X().min(RI).max(AI)}),x({type:w("pan"),dx:X(),dy:X()}),x({type:w("fit")})]);var au=R().trim().refine((e)=>[...e].length<=2000,"Wait comment must contain at most 2,000 Unicode code points.").nullable().optional();var Dt=R().min(1),ZI=Te(),JI=x({kind:w("graph.trigger.create"),nodeId:Dt,key:Dt,connectionId:Dt.optional(),name:Dt.optional(),config:re(Dt,ZI),schedule:Mn.readonly().optional()});function cu(e){return Hn(e),P(pn()).min(1).parse(e).map((n,t)=>{let{kind:r}=Vr(n,t,O({kind:Dt}).parse);return r=="graph.trigger.create"?Vr(n,t,JI.parse):qh(n,t)})}var lb=[{snapshot:{configInputs:[{handle:"baseId",jsonSchema:{type:"string",pattern:"^app[A-Za-z0-9]{14}$"},nullable:!1},{handle:"formula",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"tableIdOrName",jsonSchema:{type:"string",minLength:1,maxLength:255},nullable:!1},{handle:"triggerField",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^[^}]*$"},nullable:!1},{handle:"view",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"fields",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"maxRecordsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:1000},nullable:!1,value:200}],definitionVersion:2,description:"Polls an Airtable table and triggers when a record is created or updated, ordered by a time field.",displayName:"Record Created or Updated",key:"airtable.on_record_changed",name:"on_record_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{baseId:{type:"string"},createdTime:{type:"string"},fields:{type:"object"},recordId:{type:"string"},tableIdOrName:{type:"string"},triggerField:{type:"string"},triggerFieldValue:{type:"string"}},additionalProperties:!1,required:["baseId","tableIdOrName","recordId","createdTime","triggerField","triggerFieldValue","fields"]}},nullable:!1}],provider:"airtable",type:"poll"},options:!1},{snapshot:{key:"asana.on_task_event",provider:"asana",name:"on_task_event",displayName:"Project Task Event",description:"Receives tasks added to a project, completion changes, and selected custom field changes. Task details represent current state, not historical state.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!0},successStatus:200},configInputs:[{handle:"projectId",jsonSchema:{type:"string",minLength:1,title:"Project ID"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["task.added","task.completed","task.field_changed"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["task.added","task.completed"]},{handle:"customFieldId",jsonSchema:{type:"string",minLength:1,title:"Custom field ID"},nullable:!0}],outputs:[{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},task:{type:"object"},change:{type:"object"}},required:["event","task","change"]}},nullable:!1}]},callback:{headers:["x-hook-secret","x-hook-signature"],query:[]},options:!1},{snapshot:{key:"calendly.on_booking_event",provider:"calendly",name:"on_booking_event",displayName:"Booking Created or Canceled",description:"Receives bookings and cancellations, preserving reschedule links. Requires a Personal Access Token connection.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"scope",jsonSchema:{type:"string",enum:["user","organization"],title:"Scope"},nullable:!1,value:"user"},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["invitee.created","invitee.canceled"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["invitee.created","invitee.canceled"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["invitee.created","invitee.canceled"]},nullable:!1},{handle:"inviteeUri",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["calendly-webhook-signature"],query:[]},options:!1},{snapshot:{key:"clickup.on_task_event",provider:"clickup",name:"on_task_event",displayName:"Task Event",description:"Receives task creation, status changes, and new comments in a ClickUp Workspace or List.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"workspaceId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"Workspace ID"},nullable:!1},{handle:"listId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"List ID"},nullable:!0},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["taskCreated","taskStatusUpdated","taskCommentPosted"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},nullable:!1},{handle:"taskId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-signature"],query:[]},options:!1},{snapshot:{key:"feishu_app_bot.on_event",provider:"feishu_app_bot",name:"on_event",displayName:"Application Event",description:"Receives selected Feishu application events through a shared event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.]{0,127}$"},minItems:1,maxItems:200,uniqueItems:!0,title:"Event types"},nullable:!1},{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",minLength:1,maxLength:256},maxItems:100,uniqueItems:!0,title:"Chat IDs"},nullable:!0,description:"Leave empty to receive events from all chats available to the source."},{handle:"resource",jsonSchema:{type:"object",properties:{kind:{type:"string",enum:["document","calendar","approval"]},id:{type:"string",minLength:1,maxLength:256},documentType:{type:"string",enum:["doc","docx","sheet","bitable","file","folder"]}},additionalProperties:!1,required:["kind","id"],title:"Resource subscription"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"tenantKey",jsonSchema:{type:"string"},nullable:!1},{handle:"occurredAt",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"feishu"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},verificationToken:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},manageSubscriptions:{type:"boolean"}},required:["version","name","connectionId","teamId","verificationToken","encryptKey","eventTypes","manageSubscriptions"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"feishu",provider:"feishu_app_bot",triggerId:"feishu_app_bot.on_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"feishu"},{snapshot:{key:"fireflies.on_meeting_ready",provider:"fireflies",name:"on_meeting_ready",displayName:"Meeting Transcript or Summary Ready",description:"Receives separate transcript and summary readiness events through Fireflies Webhooks V2 after checking meeting access.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["meeting.transcribed","meeting.summarized"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"fireflies"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]}}},required:["kind","version","name","connectionId","teamId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"fireflies",provider:"fireflies",triggerId:"fireflies.on_meeting_ready",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"fireflies"},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["*","branch_protection_configuration","branch_protection_rule","check_run","check_suite","code_scanning_alert","commit_comment","create","custom_property_values","delete","dependabot_alert","deploy_key","deployment","deployment_status","discussion","discussion_comment","fork","gollum","issue_comment","issue_dependencies","issues","label","member","meta","milestone","package","page_build","project","project_card","project_column","public","pull_request","pull_request_review","pull_request_review_comment","pull_request_review_thread","push","registry_package","release","repository","repository_advisory","repository_import","repository_ruleset","repository_vulnerability_alert","secret_scanning_alert","secret_scanning_alert_location","secret_scanning_scan","security_and_analysis","star","status","sub_issues","team_add","watch","workflow_job","workflow_run"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1}],definitionVersion:2,description:"Triggers when selected GitHub webhook events occur in a repository.",displayName:"Repository Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.on_repo_event",name:"on_repo_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"github",type:"integration"},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1},{handle:"number",jsonSchema:{type:"integer",minimum:1},nullable:!1,description:"Number of the pull request to watch."}],definitionVersion:2,description:"Watches one pull request using notifications and periodic checks. Starts from its current state; reports observed changes, not every intermediate transition or review event.",displayName:"Watch Pull Request",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.watch_pull_request",name:"watch_pull_request",provider:"github",type:"integration",outputs:[{handle:"pullRequest",jsonSchema:{type:"object",properties:{id:{type:"integer"},number:{type:"integer"},title:{type:"string"},url:{type:"string"},state:{type:"string",enum:["open","closed"]},draft:{type:"boolean"},merged:{type:"boolean"},updatedAt:{type:"string"},headSha:{type:"string"},baseSha:{type:"string"}},additionalProperties:!1,required:["id","number","title","url","state","draft","merged","updatedAt","headSha","baseSha"]},nullable:!1},{handle:"version",jsonSchema:{type:"string"},nullable:!1}]},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["push","tag_push","issues","confidential_issues","note","confidential_note","merge_requests","job","pipeline","wiki_page","deployment","feature_flag","releases","milestone","emoji","resource_access_token","resource_deploy_token"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"project",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^(?:[0-9]+|(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*(?:/(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*)*)$"},nullable:!1},{handle:"pushBranchFilter",jsonSchema:{type:"string",maxLength:255},nullable:!1,value:""}],definitionVersion:2,description:"Triggers when selected GitLab webhook events occur in a project.",displayName:"Project Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"gitlab.on_project_event",name:"on_project_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"gitlabEvent",jsonSchema:{type:"string"},nullable:!1}],provider:"gitlab",type:"integration"},callback:{headers:["idempotency-key","x-gitlab-event","x-gitlab-token"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"labelNamesOrIds",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,description:"Only trigger on messages carrying all of these labels, referenced by name or ID.",value:[]},{handle:"readStatus",jsonSchema:{type:"string",enum:["Read","Unread","All"]},nullable:!1,value:"All"},{handle:"search",jsonSchema:{type:"string"},nullable:!1,description:"Gmail search-syntax query the message must match.",value:""},{handle:"sender",jsonSchema:{type:"string"},nullable:!1,description:"Only trigger on messages whose sender matches this address or name.",value:""},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on draft messages."},{handle:"includeSpamAndTrash",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages in SPAM and TRASH."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls the Gmail mailbox and triggers when a new message is received.",displayName:"New Message Received",key:"gmail.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{historyId:{type:["string","null"]},labelIds:{type:"array",items:{type:"string"}},messageId:{type:"string"},messageTimestamp:{type:"string"},sender:{type:"string"},subject:{type:"string"},threadId:{type:"string"},to:{type:"string"}},additionalProperties:!1,required:["messageId","threadId","historyId","labelIds","subject","sender","to","messageTimestamp"]}},nullable:!1}],provider:"gmail",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"calendarId",jsonSchema:{type:"string",minLength:1,maxLength:1024},nullable:!1},{handle:"changes",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","cancelled"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated","cancelled"]},{handle:"matchTerm",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxEventsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100}],definitionVersion:2,description:"Polls a Google Calendar and triggers when an event is created, updated or cancelled.",displayName:"Event Changed",key:"googlecalendar.on_event_changed",name:"on_event_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{attendeeEmails:{type:"array",items:{type:"string"}},calendarId:{type:"string"},changeType:{type:"string",enum:["created","updated","cancelled"]},created:{type:["string","null"]},creatorEmail:{type:["string","null"]},description:{type:["string","null"]},end:{type:["object","null"]},eventId:{type:"string"},eventType:{type:["string","null"]},htmlLink:{type:["string","null"]},isAllDay:{type:"boolean"},location:{type:["string","null"]},organizerEmail:{type:["string","null"]},recurringEventId:{type:["string","null"]},start:{type:["object","null"]},status:{type:"string"},summary:{type:["string","null"]},updated:{type:["string","null"]}},additionalProperties:!1,required:["changeType","calendarId","eventId","status","summary","description","location","htmlLink","start","end","isAllDay","organizerEmail","creatorEmail","attendeeEmails","recurringEventId","eventType","created","updated"]}},nullable:!1}],provider:"googlecalendar",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Uses a Google Drive changes.watch channel and triggers when Drive changes are available.",displayName:"Changes Detected",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.changes_detected",name:"changes_detected",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeId:{type:"string"},changeType:{type:["string","null"]},driveId:{type:["string","null"]},file:{type:["object","null"]},fileId:{type:["string","null"]},notification:{type:"object",properties:{changedTypes:{type:"array",items:{type:"string"}},messageNumber:{type:["string","null"]},resourceState:{type:"string"},resourceUri:{type:["string","null"]}},additionalProperties:!1,required:["resourceState","changedTypes","messageNumber","resourceUri"]},removed:{type:"boolean"},time:{type:["string","null"]}},additionalProperties:!1,required:["changeId","changeType","removed","time","fileId","driveId","file","notification"]}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"changeType",jsonSchema:{type:"string",enum:["created","updated"]},nullable:!1},{handle:"driveId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{0,512}$"},nullable:!1,value:""},{handle:"folderId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{2,512}$"},nullable:!1},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"mimeTypes",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"namePrefix",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxFilesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls one Google Drive folder and triggers when a file or folder directly inside it is created or updated.",displayName:"File or Folder Change in a Folder",key:"googledrive.on_file_change",name:"on_file_change",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdTime:{type:["string","null"]},driveId:{type:["string","null"]},eventType:{type:"string",enum:["file_created","file_updated","folder_created","folder_updated"]},fileId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifyingUser:{type:["object","null"]},mimeType:{type:"string"},modifiedTime:{type:["string","null"]},name:{type:"string"},parents:{type:"array",items:{type:"string"}},size:{type:"string"},webViewLink:{type:["string","null"]}},additionalProperties:!1,required:["eventType","itemType","fileId","name","mimeType","createdTime","modifiedTime","parents","webViewLink","driveId","lastModifyingUser"]}},nullable:!1}],provider:"googledrive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Monitors Drive changes using notifications and periodic scans of the same change stream.",displayName:"Watch Changes",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.watch_changes",name:"watch_changes",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object"}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"columnRange",jsonSchema:{type:"string",pattern:"^[A-Za-z]{1,3}(?::[A-Za-z]{1,3})?$"},nullable:!1,value:"A:ZZZ"},{handle:"sheet",jsonSchema:{type:"string",minLength:1},nullable:!1},{handle:"spreadsheetId",jsonSchema:{type:"string",minLength:1},nullable:!1},{group:"Advanced settings",collapsed:!0},{handle:"dateTimeRender",jsonSchema:{type:"string",enum:["FORMATTED_STRING","SERIAL_NUMBER"]},nullable:!1,value:"FORMATTED_STRING"},{handle:"firstDataRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:2},{handle:"headerRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:1},{handle:"maxRowsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100},{handle:"valueRender",jsonSchema:{type:"string",enum:["UNFORMATTED_VALUE","FORMATTED_VALUE","FORMULA"]},nullable:!1,value:"UNFORMATTED_VALUE"}],definitionVersion:2,description:"Polls a sheet and triggers once for every new row appended below the last row already seen.",displayName:"New Row Added",key:"googlesheets.on_row_added",name:"on_row_added",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{row:{type:"object"},rowNumber:{type:"integer"},sheetId:{type:"integer"},sheetTitle:{type:"string"},spreadsheetId:{type:"string"},values:{type:"array",items:{}}},additionalProperties:!1,required:["spreadsheetId","sheetId","sheetTitle","rowNumber","row","values"]}},nullable:!1}],provider:"googlesheets",type:"poll"},options:!1},{snapshot:{key:"intercom.on_conversation_event",provider:"intercom",name:"on_conversation_event",displayName:"Customer Conversation or Ticket",description:"Receives customer conversations, customer replies and new tickets from a verified Intercom application event source. Administrator replies are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["conversation.user.created","conversation.user.replied","ticket.created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"workspaceId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object",properties:{},additionalProperties:!0},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"intercom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"intercom",provider:"intercom",triggerId:"intercom.on_conversation_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"intercom"},{snapshot:{key:"jira.on_issue_event",provider:"jira",name:"on_issue_event",displayName:"Issue or Comment Event",description:"Receives Jira Cloud issue creation, issue updates and new comments through a shared project webhook with automatic renewal.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["jira:issue_created","jira:issue_updated","comment_created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"cloudId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"jira"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},project:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]}}},required:["kind","version","name","connectionId","teamId","project","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"jira",provider:"jira",triggerId:"jira.on_issue_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!0},options:!1,eventSource:"jira"},{snapshot:{configInputs:[{handle:"teamId",jsonSchema:{type:"string",pattern:"^[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}$",title:"Team ID"},nullable:!1,description:"Linear Team UUID. Use Copy model UUID in Linear to find it."},{handle:"stateIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[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}$"},maxItems:50,uniqueItems:!0,title:"Issue statuses"},nullable:!1,value:[],description:"Choose statuses from the selected Team. Empty means all statuses. Matches the current status, not every transition into it."}],definitionVersion:2,description:"Watches new and updated issues in a Linear team with periodic checks. Starts from now without running existing issues. Reports observed current states, not deletions or every intermediate status change.",displayName:"Issue Created or Updated",key:"linear.on_issue_changed",name:"on_issue_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{id:{type:"string"},identifier:{type:"string"},title:{type:"string"},url:{type:"string"},teamId:{type:"string"},createdAt:{type:"string"},updatedAt:{type:"string"},state:{type:"object",properties:{id:{type:"string"},name:{type:"string"},type:{type:"string"}},additionalProperties:!1,required:["id","name","type"]}},additionalProperties:!1,required:["id","identifier","title","url","teamId","createdAt","updatedAt","state"]}},nullable:!1}],provider:"linear",type:"poll"},options:!0},{snapshot:{configInputs:[{handle:"dataSourceId",jsonSchema:{type:"string",pattern:"^(?:|[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})$"},nullable:!1,value:""},{handle:"databaseId",jsonSchema:{type:"string",pattern:"^[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}$"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["page_added","page_updated"]},minItems:1,uniqueItems:!0},nullable:!1,value:["page_added"]},{group:"Advanced settings",collapsed:!0},{handle:"includeProperties",jsonSchema:{type:"boolean"},nullable:!1,value:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Notion database and triggers when a page is added to it or an existing page is edited.",displayName:"Database Page Added or Updated",key:"notion.on_database_page_event",name:"on_database_page_event",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdBy:{type:"object"},createdTime:{type:"string"},dataSourceId:{type:"string"},databaseId:{type:"string"},event:{type:"string",enum:["page_added","page_updated"]},lastEditedBy:{type:"object"},lastEditedTime:{type:"string"},pageId:{type:"string"},properties:{type:"object"},title:{type:"string"},url:{type:"string"}},additionalProperties:!1,required:["event","pageId","databaseId","dataSourceId","url","title","createdTime","lastEditedTime","createdBy","lastEditedBy"]}},nullable:!1}],provider:"notion",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","deleted"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated"]},{handle:"itemId",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"parentFolderId",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls the OneDrive change feed and triggers when a file or folder is created, updated or deleted.",displayName:"File or Folder Changed",key:"one_drive.on_item_changed",name:"on_item_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeType:{type:"string",enum:["created","updated","deleted"]},createdDateTime:{type:["string","null"]},driveId:{type:["string","null"]},eTag:{type:["string","null"]},itemId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifiedDateTime:{type:["string","null"]},mimeType:{type:["string","null"]},name:{type:"string"},parentFolderId:{type:["string","null"]},size:{type:["number","null"]},webUrl:{type:"string"}},additionalProperties:!1,required:["itemId","name","changeType","itemType","size","mimeType","webUrl","parentFolderId","driveId","createdDateTime","lastModifiedDateTime","eTag"]}},nullable:!1}],provider:"one_drive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"folder",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_=-]*$"},nullable:!1,value:"inbox",description:"A well-known mail folder name, folder ID, or an empty string for the whole mailbox."},{handle:"readStatus",jsonSchema:{type:"string",enum:["All","Read","Unread"]},nullable:!1,value:"All"},{handle:"senderAddress",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Exact sender address, or empty for any sender."},{handle:"subjectContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Case-insensitive subject text."},{handle:"withAttachmentsOnly",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Microsoft Outlook mail folder and triggers when a new message arrives.",displayName:"New Message Received",key:"outlook.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{bodyPreview:{type:"string"},categories:{type:"array",items:{type:"string"}},conversationId:{type:"string"},from:{type:"string"},fromName:{type:"string"},hasAttachments:{type:"boolean"},importance:{type:"string"},internetMessageId:{type:"string"},isDraft:{type:"boolean"},isRead:{type:"boolean"},messageId:{type:"string"},parentFolderId:{type:"string"},receivedDateTime:{type:"string"},subject:{type:"string"},to:{type:"array",items:{type:"string"}},webLink:{type:"string"}},additionalProperties:!1,required:["messageId","internetMessageId","conversationId","subject","bodyPreview","from","fromName","to","receivedDateTime","hasAttachments","isRead","isDraft","importance","categories","parentFolderId","webLink"]}},nullable:!1}],provider:"outlook",type:"poll"},options:!1},{snapshot:{key:"pandadoc.on_document_event",provider:"pandadoc",name:"on_document_event",displayName:"Document Status Changed",description:"Receives document status changes in the connected workspace, optionally only when the entire document is completed.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!0,allowEmpty:!1},successStatus:200},configInputs:[{handle:"completedOnly",jsonSchema:{type:"boolean",title:"Completed documents only"},nullable:!1,value:!0}],outputs:[{handle:"events",nullable:!1,jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},data:{type:"object"}},required:["event","data"]}}}]},callback:{headers:[],query:["signature"]},options:!1},{snapshot:{key:"pipedrive.on_crm_event",provider:"pipedrive",name:"on_crm_event",displayName:"Deal or Contact Event",description:"Receives new deals or contacts, or actual changes to a deal stage or status using Pipedrive Webhooks v2.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventType",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"],title:"Event"},nullable:!1,value:"deal.created"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["authorization"],query:[]},options:!1},{snapshot:{key:"resend.on_email_event",provider:"resend",name:"on_email_event",displayName:"Email Received, Bounced or Complained",description:"Receives inbound email, bounce, and complaint notifications. Read message bodies and attachments with Actions.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["email.received","email.bounced","email.complained"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["email.received","email.bounced","email.complained"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["email.received","email.bounced","email.complained"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"emailId",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["svix-id","svix-signature","svix-timestamp"],query:[]},options:!1},{snapshot:{key:"sentry.on_issue_alert",provider:"sentry",name:"on_issue_alert",displayName:"Issue Alert",description:"Receives Issue Alert Rule notifications from a verified Sentry Custom Integration installation.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"projectIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]+$"},uniqueItems:!0,title:"Project IDs"},nullable:!0},{handle:"ruleNames",jsonSchema:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0,title:"Alert rule names"},nullable:!0},{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["issue.alert"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["issue.alert"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"organizationId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"sentry"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},installationId:{type:"string",minLength:1,maxLength:256},organizationId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"issue.alert"}}},required:["kind","version","name","connectionId","teamId","appId","installationId","organizationId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"sentry",provider:"sentry",triggerId:"sentry.on_issue_alert",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"sentry"},{snapshot:{configInputs:[{handle:"topics",jsonSchema:{type:"array",items:{type:"string",enum:["app/scopes_update","app/uninstalled","app_purchases_one_time/update","app_subscriptions/approaching_capped_amount","app_subscriptions/update","bulk_operations/finish","carts/create","carts/update","channels/delete","checkout_and_accounts_configurations/update","checkouts/create","checkouts/delete","checkouts/update","collection_listings/add","collection_listings/remove","collection_listings/update","collection_publications/create","collection_publications/delete","collection_publications/update","collections/create","collections/delete","collections/update","companies/create","companies/delete","companies/update","company_contact_roles/assign","company_contact_roles/revoke","company_contacts/create","company_contacts/delete","company_contacts/update","company_locations/create","company_locations/delete","company_locations/update","customer.joined_segment","customer.left_segment","customer.tags_added","customer.tags_removed","customer_account_settings/update","customer_groups/create","customer_groups/delete","customer_groups/update","customers/create","customers/delete","customers/disable","customers/enable","customers/purchasing_summary","customers/update","customers_email_marketing_consent/update","customers_marketing_consent/update","delivery_promise_settings/update","disputes/create","disputes/update","domains/create","domains/destroy","domains/update","draft_orders/create","draft_orders/delete","draft_orders/update","fulfillment_events/create","fulfillment_events/delete","fulfillment_holds/added","fulfillment_holds/released","fulfillment_orders/cancellation_request_accepted","fulfillment_orders/cancellation_request_rejected","fulfillment_orders/cancellation_request_submitted","fulfillment_orders/cancelled","fulfillment_orders/fulfillment_request_accepted","fulfillment_orders/fulfillment_request_rejected","fulfillment_orders/fulfillment_request_submitted","fulfillment_orders/fulfillment_service_failed_to_complete","fulfillment_orders/hold_released","fulfillment_orders/line_items_prepared_for_local_delivery","fulfillment_orders/line_items_prepared_for_pickup","fulfillment_orders/manually_reported_progress_stopped","fulfillment_orders/merged","fulfillment_orders/moved","fulfillment_orders/order_routing_complete","fulfillment_orders/placed_on_hold","fulfillment_orders/progress_reported","fulfillment_orders/rescheduled","fulfillment_orders/scheduled_fulfillment_order_ready","fulfillment_orders/split","fulfillments/create","fulfillments/update","inventory_items/create","inventory_items/delete","inventory_items/update","inventory_levels/connect","inventory_levels/disconnect","inventory_levels/update","locales/create","locales/destroy","locales/update","locations/activate","locations/create","locations/deactivate","locations/delete","locations/update","machine_translation_batch/completed","metafield_definitions/create","metafield_definitions/delete","metafield_definitions/update","order_transactions/create","orders/cancelled","orders/create","orders/delete","orders/edited","orders/fulfilled","orders/link_requested","orders/paid","orders/partially_fulfilled","orders/risk_assessment_changed","orders/shopify_protect_eligibility_changed","orders/updated","payment_schedules/due","payment_terms/create","payment_terms/delete","payment_terms/update","product_feeds/create","product_feeds/full_sync","product_feeds/full_sync_finish","product_feeds/incremental_sync","product_feeds/update","product_listings/add","product_listings/remove","product_listings/update","product_publications/create","product_publications/delete","product_publications/update","products/create","products/delete","products/update","profiles/create","profiles/delete","profiles/update","publications/delete","refunds/create","returns/approve","returns/cancel","returns/close","returns/decline","returns/process","returns/reopen","returns/request","returns/update","reverse_deliveries/attach_deliverable","reverse_fulfillment_orders/dispose","scheduled_product_listings/add","scheduled_product_listings/remove","scheduled_product_listings/update","segments/create","segments/delete","segments/update","selling_plan_groups/create","selling_plan_groups/delete","selling_plan_groups/update","shop/update","subscription_billing_attempts/challenged","subscription_billing_attempts/failure","subscription_billing_attempts/success","subscription_billing_cycle_edits/create","subscription_billing_cycle_edits/delete","subscription_billing_cycle_edits/update","subscription_billing_cycles/skip","subscription_billing_cycles/unskip","subscription_contracts/activate","subscription_contracts/cancel","subscription_contracts/create","subscription_contracts/expire","subscription_contracts/fail","subscription_contracts/pause","subscription_contracts/update","tax_partners/update","tax_summaries/create","tender_transactions/create","themes/create","themes/delete","themes/publish","themes/update","variants/in_stock","variants/out_of_stock"]},minItems:1,maxItems:20,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when selected Shopify webhook topics occur in the connected store.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"shopify.on_shop_event",name:"on_shop_event",outputs:[{handle:"apiVersion",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"shopDomain",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"triggeredAt",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"shopify",type:"integration"},callback:{headers:["x-shopify-api-version","x-shopify-event-id","x-shopify-shop-domain","x-shopify-topic","x-shopify-triggered-at","x-shopify-webhook-id"],query:["open_flow_callback"]},options:!1},{snapshot:{configInputs:[{handle:"channelId",jsonSchema:{type:"string",pattern:"^[CDG][A-Z0-9]{2,31}$"},nullable:!1,description:"Slack conversation ID to watch, e.g. C0122KQ70S7E."},{handle:"fromUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Only trigger on messages written by these Slack user IDs. Empty means any author."},{handle:"ignoreUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Never trigger on messages written by these Slack user IDs."},{handle:"textContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Only trigger when message text contains this string, case-insensitively."},{group:"Advanced settings",collapsed:!0},{handle:"includeBotMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages posted by bots and apps."},{handle:"includeSystemMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on Slack system notices."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:15,description:"Maximum number of messages processed per poll."}],definitionVersion:2,description:"Polls one Slack conversation and triggers when a new message is posted to it.",displayName:"New Channel Message",key:"slack.on_message_posted",name:"on_message_posted",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{botId:{type:["string","null"]},channelId:{type:"string"},files:{type:"array",items:{type:"object",properties:{id:{type:"string"},mimetype:{type:"string"},name:{type:"string"}},additionalProperties:!1,required:["id","name","mimetype"]}},messageTs:{type:"string"},subtype:{type:["string","null"]},text:{type:"string"},threadTs:{type:["string","null"]},userId:{type:["string","null"]}},additionalProperties:!1,required:["channelId","messageTs","threadTs","userId","botId","subtype","text","files"]}},nullable:!1}],provider:"slack",type:"poll"},options:!1},{snapshot:{key:"slackbot.on_event",provider:"slackbot",name:"on_event",displayName:"Mention or Direct Message",description:"Receives user mentions and new direct messages through a shared Slack application event source. Slack Connect events are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["app_mention","message.im"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["app_mention","message.im"]},{handle:"channelIds",jsonSchema:{type:"array",items:{type:"string",minLength:1},maxItems:100,uniqueItems:!0,title:"Channel IDs"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"teamId",jsonSchema:{type:"string"},nullable:!1},{handle:"channel",jsonSchema:{type:"string"},nullable:!1},{handle:"user",jsonSchema:{type:"string"},nullable:!1},{handle:"text",jsonSchema:{type:"string"},nullable:!1},{handle:"ts",jsonSchema:{type:"string"},nullable:!1},{handle:"threadTs",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"slack"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",pattern:"^A[A-Z0-9]+$"},workspaceId:{type:"string",pattern:"^T[A-Z0-9]+$"},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["app_mention","message.im"]}}},required:["kind","version","name","connectionId","teamId","appId","workspaceId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"slack",provider:"slackbot",triggerId:"slackbot.on_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"slack"},{snapshot:{configInputs:[{handle:"apiVersion",jsonSchema:{type:"string",maxLength:40},nullable:!1,value:""},{handle:"events",jsonSchema:{type:"array",items:{type:"string",maxLength:120,pattern:"^(\\*|[a-z0-9_]+(?:\\.[a-z0-9_]+)+)$"},minItems:1,uniqueItems:!0},nullable:!1},{handle:"includeConnectedAccounts",jsonSchema:{type:"boolean"},nullable:!1,value:!1}],definitionVersion:2,description:"Triggers when selected Stripe events happen on the connected account.",displayName:"Account Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"stripe.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"livemode",jsonSchema:{type:"boolean"},nullable:!1}],provider:"stripe",type:"integration"},callback:{headers:["stripe-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form"},nullable:!1,description:"Choose a form accessible to this Connection."}],definitionVersion:2,description:"Receives new Tally form submissions through a signed, automatically managed webhook.",displayName:"Form Response",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"tally.on_form_response",name:"on_form_response",outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},createdAt:{type:"string"},formId:{type:"string"},submissionId:{type:"string"},responseId:{type:"string"},fields:{type:"array",items:{type:"object",properties:{key:{type:"string"},type:{type:"string"},label:{type:["string","null"]},value:{},options:{type:"array",items:{type:"object"}}},required:["key","type","label","value"]}}},required:["eventId","createdAt","formId","submissionId","responseId","fields"]}}],provider:"tally",type:"integration"},callback:{headers:["tally-signature"],query:[]},options:!0},{snapshot:{configInputs:[{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^-?[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram chat IDs. Empty means every chat."},{handle:"dropPendingUpdates",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Discard updates queued before the webhook is created or resumed."},{handle:"updates",jsonSchema:{type:"array",items:{enum:["*","message","edited_message","channel_post","edited_channel_post","business_connection","business_message","edited_business_message","deleted_business_messages","guest_message","message_reaction","message_reaction_count","inline_query","chosen_inline_result","callback_query","shipping_query","pre_checkout_query","purchased_paid_media","poll","poll_answer","my_chat_member","chat_member","chat_join_request","chat_boost","removed_chat_boost","managed_bot","subscription"]},minItems:1,uniqueItems:!0},nullable:!1,description:"Telegram update types that trigger a Run. Use * for the Telegram default set."},{handle:"userIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram user IDs. Empty means every user."}],definitionVersion:2,description:"Triggers when the connected Telegram bot receives a selected update.",displayName:"Bot Update",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"telegram.on_update",name:"on_update",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"telegram",type:"integration"},callback:{headers:["x-telegram-bot-api-secret-token"],query:[]},options:!1},{snapshot:{key:"typeform.on_form_response",provider:"typeform",name:"on_form_response",displayName:"Completed Form Response",description:"Receives complete Typeform submissions through an automatically managed signed webhook.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form ID"},nullable:!1}],outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},form_id:{type:"string"},token:{type:"string"},submitted_at:{type:"string"},answers:{type:"array",items:{type:"object"}},definition:{type:"object"}},required:["eventId","form_id","token","submitted_at","answers"]}}]},callback:{headers:["typeform-signature"],query:[]},options:!1},{snapshot:{key:"vercel.on_deployment_event",provider:"vercel",name:"on_deployment_event",displayName:"Deployment Ready or Failed",description:"Receives successful and failed deployments for a Vercel project.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"teamId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Team ID"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Project ID"},nullable:!1},{handle:"environment",jsonSchema:{type:"string",enum:["all","production","preview"],title:"Environment"},nullable:!1,value:"all"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deployment.ready","deployment.error"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"deploymentId",jsonSchema:{type:"string"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-vercel-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["coupon.created","coupon.updated","coupon.deleted","coupon.restored","customer.created","customer.updated","customer.deleted","order.created","order.updated","order.deleted","order.restored","product.created","product.updated","product.deleted","product.restored","product.published"]},minItems:1,maxItems:16,uniqueItems:!0},nullable:!1},{handle:"webhookName",jsonSchema:{type:"string",minLength:1,maxLength:120},nullable:!1,value:"OOMOL Trigger"}],definitionVersion:2,description:"Triggers when selected WooCommerce store events occur.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"woocommerce.on_store_event",name:"on_store_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"resource",jsonSchema:{type:"string"},nullable:!1},{handle:"source",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"woocommerce",type:"integration"},callback:{headers:["x-wc-webhook-delivery-id","x-wc-webhook-event","x-wc-webhook-id","x-wc-webhook-resource","x-wc-webhook-signature","x-wc-webhook-source","x-wc-webhook-topic"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["zen:event-type:ticket.agent_assignment_changed","zen:event-type:ticket.attachment_linked_to_comment","zen:event-type:ticket.attachment_redacted_from_comment","zen:event-type:ticket.brand_changed","zen:event-type:ticket.comment_added","zen:event-type:ticket.comment_made_private","zen:event-type:ticket.comment_redacted","zen:event-type:ticket.created","zen:event-type:ticket.csat_received","zen:event-type:ticket.csat_requested","zen:event-type:ticket.custom_field_changed","zen:event-type:ticket.custom_status_changed","zen:event-type:ticket.description_changed","zen:event-type:ticket.email_ccs_changed","zen:event-type:ticket.external_id_changed","zen:event-type:ticket.followers_changed","zen:event-type:ticket.form_changed","zen:event-type:ticket.group_assignment_changed","zen:event-type:ticket.marked_as_spam","zen:event-type:ticket.merged","zen:event-type:ticket.next_sla_breach_changed","zen:event-type:ticket.ola_policy_changed","zen:event-type:ticket.organization_changed","zen:event-type:ticket.permanently_deleted","zen:event-type:ticket.priority_changed","zen:event-type:ticket.problem_link_changed","zen:event-type:ticket.requester_changed","zen:event-type:ticket.schedule_changed","zen:event-type:ticket.sla_policy_changed","zen:event-type:ticket.soft_deleted","zen:event-type:ticket.status_changed","zen:event-type:ticket.subject_changed","zen:event-type:ticket.submitter_changed","zen:event-type:ticket.tags_changed","zen:event-type:ticket.task_due_at_changed","zen:event-type:ticket.type_changed","zen:event-type:ticket.undeleted","zen:event-type:organization.created","zen:event-type:organization.custom_field_changed","zen:event-type:organization.deleted","zen:event-type:organization.external_id_changed","zen:event-type:organization.name_changed","zen:event-type:organization.tags_changed","zen:event-type:user.active_changed","zen:event-type:user.alias_changed","zen:event-type:user.created","zen:event-type:user.custom_field_changed","zen:event-type:user.custom_role_changed","zen:event-type:user.default_group_changed","zen:event-type:user.deleted","zen:event-type:user.details_changed","zen:event-type:user.external_id_changed","zen:event-type:user.group_membership_created","zen:event-type:user.group_membership_deleted","zen:event-type:user.identity_changed","zen:event-type:user.identity_created","zen:event-type:user.identity_deleted","zen:event-type:user.last_login_changed","zen:event-type:user.merged","zen:event-type:user.name_changed","zen:event-type:user.notes_changed","zen:event-type:user.only_private_comments_changed","zen:event-type:user.organization_membership_created","zen:event-type:user.organization_membership_deleted","zen:event-type:user.password_changed","zen:event-type:user.photo_changed","zen:event-type:user.role_changed","zen:event-type:user.suspended_changed","zen:event-type:user.tags_changed","zen:event-type:user.time_zone_changed"]},minItems:1,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when one of the selected Zendesk account events occurs.",displayName:"Event Subscription",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"zendesk.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"subject",jsonSchema:{type:"string"},nullable:!1}],provider:"zendesk",type:"integration"},callback:{headers:["x-zendesk-webhook-signature","x-zendesk-webhook-signature-timestamp"],query:[]},options:!1},{snapshot:{key:"zoom.on_recording_ready",provider:"zoom",name:"on_recording_ready",displayName:"Cloud Recording Ready",description:"Receives completed cloud recordings hosted by the connected Zoom user through a verified application event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["recording.completed"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["recording.completed"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingUuid",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"zoom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"recording.completed"}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"zoom",provider:"zoom",triggerId:"zoom.on_recording_ready",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"zoom"}];function ub(e){return jg(e).extend({name:R().trim().min(1).max(128)})}var db=lb.flatMap((e)=>("source"in e)&&e.source!=null?[e.source]:[]),pb=te(db.map((e)=>ub(e.createSchema))),fb=ub(db[0].updateSchema),mb=x({version:w(1),expectedRevision:we().positive()});var gb={start:"A Start node with a required message parameter. Supply it through trigger.outputs.",error:"A Flow Error node. Select upstream Flows, then publish and enable this Flow to listen for failures in their automatic runs.",webhook:"A Webhook start node.","webhook-response":"An HTTP response node with body, statusCode and headers inputs. Select it from a reachable Webhook.",cron:"An hourly scheduled start node.",poll:"Gmail polling by key; replace CONNECTION_ID with an active Gmail connection.",integration:"Telegram webhook integration by key; replace CONNECTION_ID with an active Telegram connection.",decision:"AI Decision evaluates named questions against target and returns a complete answer object per output. Configure target before running.",openapi:"A fixed JSON API operation. Replace the example document and URL before running.",connector:"A Connector Task and its node. Replace ACTION_ID, CONNECTION_ID and port definitions using connector_get / connector show. Set connectionId to an empty string to defer account configuration; execution will require an account.",code:"A JavaScript module and its node. Use Code for custom computation; use Connector Tasks for existing actions.",condition:"A condition with true and false execution branches.",value:"A fixed value node.",approval:"An Approval with approve and reject decision branches and a built-in notification output.",wait:"A Wait with a continue action and a built-in notification output.",agent:"An Agent with code computation enabled. Configure a model available in the deployment.","llm-chat":"An LLM chat Task and its node; configure a model available in the deployment.","llm-json":"An LLM JSON Task and its node; configure a model available in the deployment.","poll-notification":"Gmail events \u2192 JavaScript text formatting \u2192 Connector notification. Replace connection/action IDs and match the notification input ports."},BI=Object.keys(gb),KI=BI.map((e)=>({name:e,description:gb[e]}));var sN=x({comment:au}),Hr=Te(),Se=R().min(1),xe=w(1),lu=Se.refine((e)=>e==e.trim()&&Ti(e)==null,"Flow name is invalid."),hb=re(R(),re(R(),Hr)),yb=x({nodeId:Se,outputs:re(R(),Hr)}),ne={canvas:x({command:tt,version:xe}),authoringCheck:Nl,authoringEdit:Mr,authoringRead:ji,authoringSearch:Ri,authoringSchema:Qh,loadOpenApiDocument:x({url:R().min(1).max(8192),version:xe}),createEventSource:pb,updateEventSource:fb,eventSourceRevision:mb,importFlow:x({file:Hr,name:lu.optional(),teamId:Se.optional(),version:xe}),createFlow:x({name:lu,teamId:Se.optional(),version:xe}),renameFlow:x({name:lu,version:xe}),changeDraft:x({expectedRevisionId:Se,operations:P(Hr).min(1),version:xe}),repairDraft:x({expectedRevisionId:Se,version:xe}),upgradeDraft:x({expectedRevisionId:Se,version:xe}),setEnabled:x({enabled:me(),expectedPublicationId:Se,version:xe}),updatePresentation:x({expectedRevision:we().positive(),value:re(R(),Hr),version:xe}),checkFlow:x({engineContract:Se,version:xe}),publishFlow:x({engineContract:Se,expectedLivePublicationId:Se.nullable(),version:xe}),rollbackFlow:x({expectedLivePublicationId:Se,version:xe}),createDraftRun:x({engineContract:Se,inputs:hb,trigger:yb,version:w(2)}),createLiveRun:x({publicationId:Se,inputs:hb,trigger:yb,version:w(2)}),resolveWait:x({action:ee(["approve","continue","reject"]),comment:au,version:xe}),putVariable:x({value:R().refine((e)=>new TextEncoder().encode(e).byteLength<=65536,"Variable value is too large.")}),queryConnectorAccessCandidates:x({providerIds:P(Se.max(256)).min(1).refine((e)=>new Set(e).size==e.length,"Duplicate provider IDs."),version:xe}),removeConnectionUsage:x({connectionId:Se,expectedRevisionId:Se,expectedAccessRevision:we().nonnegative(),version:xe}),setConnectorService:x({expectedAccessRevision:we().nonnegative(),version:xe}),addProviderAccessBinding:x({accessBindingId:Se,expectedAccessRevision:we().nonnegative(),version:xe}),removeProviderAccessBinding:x({accessBindingId:Se,expectedAccessRevision:we().nonnegative(),version:xe}),versionOnly:x({version:xe})};function oe(e){return(n)=>e.parse(n)}var Ki={canvas:oe(ne.canvas),authoringCheck:oe(ne.authoringCheck),authoringEdit:oe(ne.authoringEdit),authoringRead:oe(ne.authoringRead),authoringSearch:oe(ne.authoringSearch),authoringSchema:oe(ne.authoringSchema),loadOpenApiDocument:oe(ne.loadOpenApiDocument),createEventSource:oe(ne.createEventSource),updateEventSource:oe(ne.updateEventSource),eventSourceRevision:oe(ne.eventSourceRevision),importFlow:oe(ne.importFlow),createFlow:oe(ne.createFlow),renameFlow:oe(ne.renameFlow),changeDraft(e){let n=ne.changeDraft.parse(e);return{...n,operations:cu(n.operations)}},repairDraft:oe(ne.repairDraft),upgradeDraft:oe(ne.upgradeDraft),setEnabled:oe(ne.setEnabled),updatePresentation:oe(ne.updatePresentation),checkFlow:oe(ne.checkFlow),publishFlow:oe(ne.publishFlow),rollbackFlow:oe(ne.rollbackFlow),createDraftRun:oe(ne.createDraftRun),createLiveRun:oe(ne.createLiveRun),resolveWait:oe(ne.resolveWait),putVariable:oe(ne.putVariable),queryConnectorAccessCandidates:oe(ne.queryConnectorAccessCandidates),removeConnectionUsage:oe(ne.removeConnectionUsage),setConnectorService:oe(ne.setConnectorService),addProviderAccessBinding:oe(ne.addProviderAccessBinding),removeProviderAccessBinding:oe(ne.removeProviderAccessBinding),versionOnly:oe(ne.versionOnly)};var uu=["expected-revision","idempotency-key"],du=["cursor","limit"],bb=[["canvas","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["read","<flow> [--input JSON|@file|- | --file path|-]",["input","file"]],["search","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["edit","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["list","[--cursor <cursor>] [--limit <count>]",du],["export","<flow>",[]],["import","--file <path|->",["file","name","idempotency-key"]],["create","<name>",["idempotency-key"]],["show","<flow>",[]],["live","<flow>",[]],["rename","<flow> <new-name>",[]],["delete","<flow> --yes",["yes"]],["check","<flow> [--revision <revisionId>]",["revision"]],["enable","<flow> --expected-publication <publicationId>",["expected-publication"]],["disable","<flow> --expected-publication <publicationId>",["expected-publication"]],["connector code-access","<flow> [--publication <publicationId>]",["publication"]],["connector candidates","<flow> <provider> [provider ...]",[]],["connector code-allow","<flow> <provider> <binding> <access-revision>",[]],["connector code-remove","<flow> <provider> <binding> <access-revision>",[]],["connector remove-usage","<flow> <connection> <access-revision>",uu],["connector providers","[--flow <flow>]",["flow"]],["connector teams","",[]],["connector search","<query> [--flow <flow>]",["flow"]],["connector show","<action> [--flow <flow>]",["flow"]],["connector connections","<service> [--flow <flow>]",["flow"]],["event-source list","",[]],["trigger search","[query]",[]],["trigger show","<key>",[]],["run","<flow>",[...uu,"expected-publication","source","trigger","outputs","input","wait","timeout"]],["runs list","--flow <flow>",["flow","status","pending-wait",...du]],["runs show","<run>",[]],["runs wait","<run>",["timeout"]],["runs resolve","<run> <wait> <continue|approve|reject>",["comment"]],["runs events","<run>",["after","limit","follow","timeout"]],["runs result","<run>",[]],["runs results","<run> [--after <resultId>]",["after"]],["runs read-result","<run> <result>",["pointer","offset","limit","max-bytes"]],["runs download-result","<run> <result>",[]],["runs cancel","<run>",[]],["publish","<flow>",[...uu,"expected-publication","timeout"]],["publications list","<flow>",du],["publications show","<flow> <publication>",[]],["publications wait","<flow> <operation>",["timeout"]],["publications operation","<flow> <operation>",[]],["rollback","<flow> <publication>",["expected-publication","idempotency-key"]],["open","[flow]",[]],["workbench","[flow]",[]],["schema","[read|search|edit|check|node-type]",["flow","input"]]],GI={revision:{description:"Exact Revision to read or check; defaults to the current Draft.",type:"string"},publication:{description:"Exact Publication ID whose fixed Code connections are read; defaults to the Draft.",type:"string"},pointer:{description:"JSON Pointer within the stored result; defaults to the root.",type:"string"},offset:{description:"Page offset at the selected pointer.",type:"integer",minimum:0,default:0},"max-bytes":{description:"Maximum result page bytes.",type:"integer",minimum:1,maximum:1048576,default:15000},"expected-revision":{description:"Base Revision ID from read. Required with an explicit idempotency key for draft edits and draft runs.",type:"string"},"expected-publication":{description:"Fixed Publication ID. Use none when publishing without a Live Publication.",type:"string"},"idempotency-key":{description:"Stable identity of one mutation. Reuse only with the identical arguments and base identity.",type:"string"},source:{description:"Execution source.",type:"string",enum:["draft","live"],default:"draft"},trigger:{description:"Exact Trigger ID or unambiguous name. The Start node is selected automatically; a sole legacy Manual Trigger remains supported.",type:"string"},timeout:{description:"Wait budget in milliseconds; expiration does not cancel the operation. For node set, the node execution timeout.",type:"integer",minimum:1,default:60000},limit:{description:"Maximum items in one page.",type:"integer",minimum:1,maximum:100,default:100},after:{description:"Resume events after this sequence number; use nextAfter from the preceding response.",type:"integer",minimum:0,default:0},cursor:{description:"Opaque nextCursor from the preceding page; keep the same filters.",type:"string"},comment:{description:"Optional plain-text Wait decision comment (up to 2,000 Unicode code points).",type:"string"},"pending-wait":{description:"List runs with unresolved waits, including running and queued runs.",type:"boolean"},status:{description:"Filter runs by status.",type:"string",enum:["queued","starting","running","waiting","completed","failed","canceled","indeterminate"]},file:{description:"Authoring request or workflow JSON file path, or - for stdin.",type:"string"},code:{description:"JavaScript source, @file, or - for stdin.",type:"string"},input:{description:"Authoring request JSON; literal JSON, @file, or -. For run, node ID to input values.",type:"string"},outputs:{description:"Start parameters or other Trigger outputs: literal JSON, @file, or -. Defaults to {}.",type:"string"},set:{description:"handle=value; repeat for multiple fields. Values use port schemas, JSON, @file, or -.",type:"string"},unset:{description:"Input/config handle to remove; repeat for multiple fields.",type:"string"},connection:{description:"Exact active Connection ID, unambiguous display name, or default.",type:"string"},flow:{description:"Exact Flow ID or unambiguous name; fixes Connector Team scope.",type:"string"},name:{description:"Display name.",type:"string"},description:{description:"Trigger description.",type:"string"},cron:{description:"Cron expression; combine with --timezone. Mutually exclusive with --every.",type:"string"},timezone:{description:"IANA time zone for --cron.",type:"string"},every:{description:"Interval such as 5m, 1h, or 1d. Mutually exclusive with --cron.",type:"string"},wait:{description:"Wait until terminal, waiting for an action, or the wait budget expires."},follow:{description:"Stream event pages as NDJSON with --json; stop on terminal, Wait, or timeout."},full:{description:"Include complete Revision content, schemas, source code and revision metadata."},yes:{description:"Confirm the requested deletion."},json:{description:"Machine-readable JSON results and errors; NDJSON for followed events."},help:{description:"Show this command contract without contacting the host."}};function pu(e,n="oo flow"){let t=e.join(" ");return bb.filter(([r])=>t==""||r==t||r.startsWith(`${t} `)).map(([r,o,i])=>({command:r,usage:`${n} ${r} ${o} [--json]`,options:[...i,"json","help"].map((s)=>Object.assign({name:`--${s}`,value:!["json","help","wait","follow","full","yes","pending-wait"].includes(s),repeatable:s=="set"||s=="unset"},GI[s],r=="runs results"&&s=="after"?{type:"string",minimum:void 0,default:void 0,description:"Result ID from nextAfter on the preceding page."}:{},r=="runs read-result"&&s=="limit"?{default:20}:{}))}))}function wb(e){return bb.find(([n])=>n==e.slice(0,n.split(" ").length).join(" "))?.[2]}function vb(e="edits"){let n=zl(e);if(n!=null)return n;if(e=="edits")return Dl();if(e=="outputs")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",description:"Named Start parameters or other Trigger outputs. Start uses the workflow inputDefs returned by flow read; other triggers define their own output contracts. Omitted nullable Start parameters become null; required parameters must be supplied."};if(Ei.includes(e))return Dl(e);if(e=="input")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",additionalProperties:{type:"object",additionalProperties:!0},description:"Node ID -> input handle -> JSON value."};return}function fu(e){if(e=="canvas")return{request:gt(tt,{io:"input"}),guidance:"Broadcast transient viewport commands; success does not confirm execution. No Presentation save, offline queue or replay. Pan uses screen pixels; zoom is an absolute ratio (0.1\u20133); fit includes all nodes. Repeating pan moves again; do not automatically retry an uncertain response.",examples:[{type:"focus",nodeId:"NODE_ID"},{type:"zoom",zoom:0.8},{type:"pan",dx:200,dy:-100},{type:"fit"}]};return zl(e)}function xb(e,n="oo flow"){if(e=="export")return[`${n} export FLOW_ID > template.openflow.json`];if(e=="import")return[`${n} import --file template.openflow.json --name "Imported workflow" --idempotency-key IMPORT_KEY --json`];if(e=="schema")return[`${n} schema read --json`,`${n} schema agent --json`,`${n} schema --flow FLOW_ID --input '{"action":"ACTION_ID"}' --json`];let t=fu(e);if(t==null)return HI(n);if(e=="check")return[`${n} check FLOW_ID --revision REVISION --json`];return t.examples.map((r)=>`${n} ${e} FLOW_ID${Object.keys(r).length==0?"":` --input '${JSON.stringify(r)}'`} --json`)}function HI(e){return[`${e} list --limit 20 --json`,`${e} read FLOW_ID --json`,`${e} live FLOW_ID --json`,`${e} schema code --json`,`${e} edit FLOW_ID --file edits.json --json`,`${e} connector search email --flow FLOW_ID --json`,`${e} run FLOW_ID --expected-revision REVISION_ID --idempotency-key RUN_KEY --wait --timeout 60000 --json`,`${e} runs wait RUN_ID --timeout 60000 --json`,`${e} runs resolve RUN_ID WAIT_ID approve --json`,`${e} runs events RUN_ID --after 0 --follow --timeout 60000 --json`]}import{basename as YI}from"path";async function kb(e,n,t,r,o){let[i,s,a,...c]=t;switch(i){case"code-access":case"candidates":case"code-allow":case"code-remove":case"remove-usage":{let l=i=="code-access"?1:i=="candidates"?2:i=="remove-usage"?3:4;if(i=="candidates"?t.length<l+1:t.length!=l+1)throw new E("cli.invalid-arguments",`Invalid arguments for connector ${i}. See --help.`);let u=QI(n),d;if(i=="code-access")d=r.publication==null?await e.getConnectorAccess(u):await e.getPublishedConnectorAccess(u,r.publication);else if(i=="candidates")d=await e.listProviderAccessBindingCandidates(u,t.slice(2));else{let g=Number(t.at(-1));if(!Number.isSafeInteger(g)||g<0)throw new E("cli.invalid-arguments","Access revision must be a nonnegative integer.");if(i=="remove-usage"){let h=await Xy(e,n,r);d=await e.removeConnectionUsage(u,a,h.draft.revisionId,g,r.idempotencyKey)}else if(i=="code-allow")d=await e.addProviderAccessBinding(u,a,c[0],g);else d=await e.removeProviderAccessBinding(u,a,c[0],g)}F(o,r.json,{...d,kind:`connector.${i}`},JSON.stringify(d,null,2));return}case"providers":{if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector providers [--flow <flow>] [--json]`);let l=await e.listConnectorProviders(void 0,n?.flowId);F(o,r.json,{providers:l,kind:"connector.providers",version:1},l.map((u)=>`${u.serviceName} ${u.serviceId}`).join(`
67
- `));return}case"teams":{if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector teams [--json]`);let l=await e.listConnectorTeams();F(o,r.json,{...l,kind:"connector.teams"},l.teams.map((u)=>`${u.name} ${u.id}`).join(`
68
- `));return}case"search":{if(s==null||a!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector search <query> [--json]`);let l=s.trim();if(l.length==0||l.length>256)throw new E("cli.invalid-arguments","Connector search query must contain 1\u2013256 characters.");let u=await e.searchConnectorActions(l,void 0,n?.flowId);F(o,r.json,{actions:u.map(Kl),kind:"connector.search",query:l,version:1},u.map(ou).join(`
69
- `));return}case"show":{if(s==null||a!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector show <action> [--json]`);let l=await eb(e,s,n?.flowId);F(o,r.json,{action:l,kind:"connector.show",version:1},ou(l));return}case"connections":{if(s==null||a!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector connections <service> [--json]`);let l=await e.listConnectorConnections(s,void 0,n?.flowId);F(o,r.json,{connections:l,kind:"connector.connections",serviceId:s,version:1},l.map(rb).join(`
70
- `));return}default:throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector <providers|teams|search|show|connections> ...`)}}async function Sb(e,n,t,r){let[o,i,s]=n;switch(o){case"search":{if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger search [query] [--json]`);let a=i?.trim().toLowerCase();if(a!=null&&(a.length==0||a.length>256))throw new E("cli.invalid-arguments","Trigger search query must contain 1\u2013256 characters.");let c=Ql(await e.listTriggerKeys(),a);F(r,t.json,{keys:c,kind:"trigger.search",query:a,version:1},c.map(ru).join(`
71
- `));return}case"show":{if(i==null||s!=null)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger show <key> [--json]`);let a=await tb(e,i);F(r,t.json,{definition:a,kind:"trigger.show",version:1},ru(a));return}default:throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger <search|show> ...`)}}function QI(e){if(e==null)throw new E("cli.invalid-arguments","A Flow reference is required.");return e.flowId}function Wi(e){if(e.publication==null)return`not-published ${e.flowId}`;return[`live ${e.flowId} ${e.publication.publicationId} ${e.publication.revisionId} ${e.status} enabled=${e.enabled}`,`inputDefs=${JSON.stringify(e.inputDefs)}`,...e.entries.flatMap((n)=>[`${n.type} ${n.nodeId} ${n.name}`,..."binding"in n?[` health=${n.binding.health}${n.binding.lastErrorCode==null?"":` error=${n.binding.lastErrorCode}`}`,...n.binding.listener==null?[]:[` listener=${JSON.stringify(n.binding.listener)}`],...n.binding.endpointUrl==null?[]:[` url=${n.binding.endpointUrl}`]]:[],..."provider"in n?[` provider=${n.provider} inputs=${JSON.stringify(n.inputs)}`]:[],` config=${JSON.stringify(n.config)}`])].join(`
72
- `)}async function Ib(e,n,t,r){pe(n,1,`${r.commandPrefix??"oo flow"} run <flow> [--source draft|live] [--trigger <name|id>] [--outputs <json|@file|->] [--input <json|@file|->] [--wait] [--json]`);let o=await ve(e,n[0]),i=await sb(t,r),s=t.source=="live"?t.expectedPublication==null?await e.getLive(o.flowId):{publication:await Wr(e,o.flowId,t.expectedPublication)}:void 0;if(t.source=="live"&&s?.publication==null)throw new E("live.not-found",`Flow ${JSON.stringify(n[0])} has no Live Publication.`);let a=s?.publication?.revisionId??t.expectedRevision??o.draftRevisionId,c=await e.getRevision(o.flowId,a),l=Object.entries(c.content.document.graph.nodes).filter(([,D])=>!("inputs"in D)),u=l.filter(([,D])=>D.kind=="start"),d=u.length==1?u[0][0]:l.length==1&&l[0]?.[1].kind=="manual"?l[0][0]:void 0,g=t.trigger??d;if(g==null)throw new E("run.trigger-required","Choose a start node with --trigger <name|id>.",{candidates:l.map(([D,V])=>({triggerId:D,name:V.name}))});let h=nb(c.content,g),y={};if(t.outputs!=null){let D=await Cn(t.outputs,"--outputs","run.input-unreadable",r);try{let V=JSON.parse(D);if(V==null||typeof V!=="object"||Array.isArray(V))throw Error("Expected output object.");y=V}catch{throw new E("run.input-invalid","Trigger outputs must be valid JSON.")}}let S={nodeId:h.triggerId,outputs:y},j;if(s?.publication!=null)j=await e.createLiveRun(s.publication.publicationId,{inputs:i,trigger:S,idempotencyKey:t.idempotencyKey});else j=await e.createDraftRun(o.flowId,a,{inputs:i,trigger:S,idempotencyKey:t.idempotencyKey});let N=t.wait?await iu(e,j,r,t.timeoutMs):{run:j,timedOut:!1};return F(r,t.json,{kind:"run.create",idempotencyKey:t.idempotencyKey,...N,version:1},Kr(N.run)),Gr(N.run,N.timedOut)}async function Cb(e,n,t,r){let[o,...i]=n;switch(o){case"list":{if(pe(i,0,`${r.commandPrefix??"oo flow"} runs list --flow <flow> [--status <status>] [--pending-wait] [--cursor <cursor>] [--limit <count>] [--json]`),t.flow==null)throw new E("cli.invalid-arguments",`${r.commandPrefix??"oo flow"} runs list requires --flow <flow>.`);let s=await ve(e,t.flow),a=await e.listRuns(s.flowId,{...t.cursor==null?{}:{cursor:t.cursor},limit:t.limit??tu,...t.status==null?{}:{status:t.status},...t.pendingWait==null?{}:{pendingWait:t.pendingWait}});F(r,t.json,{kind:"run.list",...a,version:1},a.runs.map(ob).join(`
73
- `));return}case"show":{pe(i,1,`${r.commandPrefix??"oo flow"} runs show <run> [--json]`);let s=await e.getRun(i[0]);F(r,t.json,{kind:"run.show",run:s,version:1},Kr(s));return}case"wait":{pe(i,1,`${r.commandPrefix??"oo flow"} runs wait <run> [--timeout <milliseconds>] [--json]`);let s=i[0],a=Date.now()+(t.timeoutMs??60000);try{let c=await e.getRun(s,AbortSignal.timeout(t.timeoutMs??60000)),l=await iu(e,c,r,Math.max(0,a-Date.now()));return F(r,t.json,{kind:"run.wait",runId:s,...l,version:1},Kr(l.run)),Gr(l.run,l.timedOut)}catch(c){if(Date.now()>=a||c instanceof Error&&c.name=="TimeoutError")return F(r,t.json,{kind:"run.wait",runId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(c instanceof E)throw c;throw new E("run.wait-failed",c instanceof Error?c.message:String(c),{runId:s})}}case"resolve":{pe(i,3,`${r.commandPrefix??"oo flow"} runs resolve <run> <wait> <continue|approve|reject> [--comment <text>] [--json]`);let[s,a,c]=i;if(c!="continue"&&c!="approve"&&c!="reject")throw new E("cli.invalid-arguments","Invalid Wait action.");let l=await e.resolveRunWait(s,a,c,t.comment);F(r,t.json,{kind:"run.resolve",resolution:l,version:1},JSON.stringify(l));return}case"events":{pe(i,1,`${r.commandPrefix??"oo flow"} runs events <run> [--after <sequence>] [--limit <count>] [--follow] [--timeout <milliseconds>] [--json]`);let s=i[0],a=t.after??0,c=Date.now()+(t.timeoutMs??60000),l;try{do{if(t.follow&&Date.now()>=c)break;let u=await e.getRunEvents(s,{after:a,limit:t.limit??tu},t.follow?AbortSignal.timeout(Math.max(1,c-Date.now())):void 0);if(a=u.nextAfter,F(r,t.json,{...u,kind:"run.events",runId:s,version:1},u.events.map(ib).join(`
74
- `)),!t.follow)return;if(l=await e.getRun(s,AbortSignal.timeout(Math.max(1,c-Date.now()))),Yy(u.events.at(-1)))return Gr(l);if(t.after!=null&&u.events.length==0&&u.done)return Gr(l);if(l.waits.length>0)return F(r,t.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!1,version:1},Kr(l)),2;let d=c-Date.now();if(d<=0)break;if(u.events.length==0)await r.wait(Math.min(1000,d))}while(t.follow)}catch(u){if(!t.follow||Date.now()<c&&!(u instanceof Error&&u.name=="TimeoutError"))throw new E("run.events-failed",u instanceof Error?u.message:String(u),{runId:s,nextAfter:a})}return F(r,t.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!0,version:1},`timeout ${s} ${a}`),3}case"results":{pe(i,1,`${r.commandPrefix??"oo flow"} runs results <run> [--after <resultId>]`);let s=await e.listRunResults(i[0],t.resultAfter);F(r,t.json,{kind:"run.results",...s},JSON.stringify(s));return}case"read-result":{pe(i,2,`${r.commandPrefix??"oo flow"} runs read-result <run> <result> [--pointer <pointer>] [--offset <offset>] [--limit <limit>] [--max-bytes <bytes>]`);let s=await e.readRunResult(i[0],i[1],{pointer:t.pointer??"",offset:t.offset??0,...t.limit==null?{}:{limit:t.limit},...t.maxBytes==null?{}:{maxBytes:t.maxBytes}});F(r,t.json,{kind:"run.result-page",...s},JSON.stringify(s));return}case"download-result":{pe(i,2,`${r.commandPrefix??"oo flow"} runs download-result <run> <result>`);let s=await e.downloadRunResult(i[0],i[1]);r.stdout.write(await s.text());return}case"result":{pe(i,1,`${r.commandPrefix??"oo flow"} runs result <run> [--json]`);let s=await e.getRunResult(i[0]);return F(r,t.json,{kind:"run.result",result:s,version:1},JSON.stringify(s)),s.status=="completed"?0:1}case"cancel":{pe(i,1,`${r.commandPrefix??"oo flow"} runs cancel <run> [--json]`);let s=await e.cancelRun(i[0]);F(r,t.json,{cancellation:s,kind:"run.cancel",version:1},`${s.status} ${s.runId} ${s.cancelAccepted?"accepted":"already-terminal"}`);return}default:throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} runs <list|show|wait|resolve|events|result|results|read-result|download-result|cancel>`)}}async function Ob(e,n,t,r){pe(n,1,`${r.commandPrefix??"oo flow"} publish <flow> [--json]`);let o=await ve(e,n[0]),i=t.expectedPublication=="none"?null:t.expectedPublication??(await e.getLive(o.flowId)).publication?.publicationId??null,s=await e.publishFlow(o.flowId,t.expectedRevision??o.draftRevisionId,i,{idempotencyKey:t.idempotencyKey}),a=await su(e,o.flowId,s,r,t.timeoutMs);if(s=a.operation,s.status=="pending")return F(r,t.json,{kind:"publication.publish",expectedPublicationId:i,idempotencyKey:t.idempotencyKey,flowId:o.flowId,...a,version:1},JSON.stringify(s)),3;if(s.status=="failed")throw new E(s.issue.code,s.issue.message,{...s.issue.nodeId==null?{}:{nodeId:s.issue.nodeId},operationId:s.operationId,flowId:o.flowId,idempotencyKey:t.idempotencyKey});let c=[],l=`${r.commandPrefix??"oo flow"} live ${o.flowId} --json`,u;try{if(u=await e.getLiveDetails(o.flowId),u.publication?.publicationId!=s.publicationId)c.push({code:"live.publication-changed",message:`Publication ${s.publicationId} succeeded. Current Live is ${u.publication?.publicationId??"not-published"}; the returned entries describe that current version.`})}catch{c.push({code:"live.details-read-failed",message:`Publication ${s.publicationId} succeeded, but its current online entries could not be read. Query ${l}.`})}let d=u?.publication?.publicationId==s.publicationId?u.publication:void 0;if(d==null)try{d=await Wr(e,o.flowId,s.publicationId)}catch{c.push({code:"publication.read-failed",message:`Publication ${s.publicationId} succeeded, but its metadata could not be read. Query ${l}.`})}F(r,t.json,{kind:"publication.publish",expectedPublicationId:i,idempotencyKey:t.idempotencyKey,operation:s,...d==null?{}:{publication:d},...u==null?{}:{live:u},...c.length==0?{}:{warnings:c},version:1},[d==null?`published ${s.publicationId} ${s.revisionId}`:Br(d),...u==null?[]:[Wi(u)],...c.map((g)=>`Warning: ${g.message}`)].join(`
75
- `))}async function Eb(e,n,t,r){let[o,i,s,...a]=n;if(i==null||a.length>0)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`);let c=await ve(e,i);if(o=="list"){if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications list <flow> [--cursor <cursor>] [--limit <count>]`);let l=await e.listPublications(c.flowId,{...t.cursor==null?{}:{cursor:t.cursor},limit:t.limit??nu});F(r,t.json,{flow:c,kind:"publication.list",...l,version:1},l.publications.map(Br).join(`
76
- `));return}if((o=="operation"||o=="wait")&&s!=null){let l=Date.now()+(t.timeoutMs??60000);try{let u=await e.getPublishOperation(c.flowId,s,o=="wait"?AbortSignal.timeout(t.timeoutMs??60000):void 0),d=o=="wait"?await su(e,c.flowId,u,r,Math.max(0,l-Date.now())):{operation:u,timedOut:!1};return F(r,t.json,{kind:`publication.${o}`,flowId:c.flowId,...d,version:1},JSON.stringify(d.operation)),d.operation.status=="failed"?1:d.operation.status=="pending"?3:0}catch(u){if(o=="wait"&&(Date.now()>=l||u instanceof Error&&u.name=="TimeoutError"))return F(r,t.json,{kind:"publication.wait",flowId:c.flowId,operationId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(u instanceof E)throw u;throw new E("publication.wait-failed",u instanceof Error?u.message:String(u),{flowId:c.flowId,operationId:s})}}if(o=="show"&&s!=null){let l=await Wr(e,c.flowId,s);F(r,t.json,{kind:"publication.show",publication:l,version:1},Br(l));return}throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`)}async function _b(e,n,t,r){pe(n,2,`${r.commandPrefix??"oo flow"} rollback <flow> <publication> [--json]`);let o=await ve(e,n[0]),i=await Wr(e,o.flowId,n[1]),s=t.expectedPublication??(await e.getLive(o.flowId)).publication?.publicationId;if(s==null)throw new E("live.not-found",`Flow ${JSON.stringify(n[0])} has no Live Publication.`);let a=await e.rollbackFlow(o.flowId,i.publicationId,s,{idempotencyKey:t.idempotencyKey});F(r,t.json,{kind:"publication.rollback",expectedPublicationId:s,idempotencyKey:t.idempotencyKey,publication:a,version:1},Br(a))}async function jb(e,n,t,r){let[o,...i]=t.positionals;switch(o){case"canvas":{if(pe(i,1,`${r.commandPrefix??"oo flow"} canvas <flow> (--input JSON|@file|- | --file path|-) [--json]`),t.file!=null&&t.input!=null)throw new E("cli.invalid-arguments","Choose --input or --file.");let s=t.file==null?t.input:t.file=="-"?"-":`@${t.file}`;if(s==null)throw new E("cli.invalid-arguments","Canvas requires --input or --file.");let a=tt.safeParse(JSON.parse(await Cn(s,"input","flow.authoring-unreadable",r)));if(!a.success)throw new E("cli.invalid-arguments",a.error.message);let c=await ve(e,i[0]),l=await e.broadcastCanvas(c.flowId,a.data);F(r,t.json,{...l,kind:"flow.canvas"},`Broadcast canvas ${a.data.type} for ${c.flowId}; execution is not confirmed.`);return}case"read":case"search":case"edit":{pe(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> [--input JSON|@file|-] [--file path|-] --json`);let s=await ve(e,i[0]);if(t.file!=null&&t.input!=null)throw new E("cli.invalid-arguments","Choose --input or --file.");let a=t.file==null?t.input:t.file=="-"?"-":`@${t.file}`,c=a==null?{}:JSON.parse(await Cn(a,"input","flow.authoring-unreadable",r)),l=o=="read"?await e.readAuthoring(s.flowId,Ki.authoringRead(c)):o=="search"?await e.searchAuthoring(s.flowId,Ki.authoringSearch(c)):await e.editAuthoring(s.flowId,Ki.authoringEdit(c));r.stdout.write(`${JSON.stringify(l)}
77
- `);return}case"connector":{let a=["code-access","candidates","code-allow","code-remove","remove-usage"].includes(i[0]??"")?await XI(e,i.slice(1)):t.flow==null?void 0:await ve(e,t.flow);return await kb(e,a,i,t,r)}case"event-source":{if(i.length!=1||i[0]!="list")throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} event-source list [--json]`);let s=await e.listEventSources(),a=`No event sources are visible to this identity. Run "${r.commandPrefix??"oo flow"} workbench" to create and verify a Feishu event source, then list again.`;F(r,t.json,{...s,kind:"event-source.list",...s.sources.length==0?{guidance:a}:{}},s.sources.length==0?a:s.sources.map((c)=>[c.sourceId,c.name,c.teamId??"-",c.connectionId,!c.enabled?"disabled":c.verifiedAt==null?"unverified":"verified",c.eventTypes.join(",")].join("\t")).join(`
78
- `));return}case"run":return await Ib(e,i,t,r);case"runs":return await Cb(e,i,t,r);case"publish":return await Ob(e,i,t,r);case"publications":return await Eb(e,i,t,r);case"rollback":return await _b(e,i,t,r);case"trigger":return await Sb(e,i,t,r);case"open":case"workbench":{if(i.length>1)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} ${o} [flow] [--json]`);if(n.getWorkbenchUrl==null)throw new E("workbench.unavailable","This CLI host cannot provide a Workbench URL.");let s=i[0]==null?void 0:await ve(e,i[0]),a=await n.getWorkbenchUrl(s?.flowId);if(o=="open")await r.openUrl(a);F(r,t.json,{...s==null?{}:{flow:s},kind:`flow.${o}`,url:a,version:1},a);return}case"list":{pe(i,0,`${r.commandPrefix??"oo flow"} list [--json]`);let s=await e.listFlows({cursor:t.cursor,limit:t.limit??100});F(r,t.json,{...s,kind:"flow.list",version:1},s.flows.map(qn).join(`
79
- `));return}case"export":{pe(i,1,`${r.commandPrefix??"oo flow"} export <flow>`);let s=await ve(e,i[0]);r.stdout.write(by(await e.exportFlow(s.flowId)));return}case"import":{if(pe(i,0,`${r.commandPrefix??"oo flow"} import --file <path|-> [--name name] [--json]`),t.file==null)throw new E("cli.invalid-arguments","Import requires --file <path|->.");let s=yy(await Cn(t.file=="-"?"-":`@${t.file}`,"file","flow.import-unreadable",r)),a=t.name??s.name??(t.file=="-"?Eu(r.language??"en"):wy(YI(t.file))),c=await e.importFlow(s,{name:Bi(a,"Flow"),idempotencyKey:t.idempotencyKey});F(r,t.json,{flow:c,idempotencyKey:t.idempotencyKey,kind:"flow.import",version:1},qn(c));return}case"create":{pe(i,1,`${r.commandPrefix??"oo flow"} create <name> [--json]`);let s=await e.createFlow(Bi(i[0],"Flow"),t.idempotencyKey);F(r,t.json,{flow:s,idempotencyKey:t.idempotencyKey,kind:"flow.create",version:1},qn(s));return}case"live":{pe(i,1,`${r.commandPrefix??"oo flow"} live <flow> [--json]`);let s=await ve(e,i[0]),a=await e.getLiveDetails(s.flowId);F(r,t.json,{kind:"flow.live",live:a,version:1},Wi(a));return}case"show":{pe(i,1,`${r.commandPrefix??"oo flow"} show <flow> [--json]`);let s=await ve(e,i[0]);F(r,t.json,{flow:s,kind:"flow.show",version:1},qn(s));return}case"rename":{pe(i,2,`${r.commandPrefix??"oo flow"} rename <flow> <new-name> [--json]`);let s=await ve(e,i[0]),a=await e.renameFlow(s.flowId,Bi(i[1],"Flow"));F(r,t.json,{flow:a,kind:"flow.rename",version:1},qn(a));return}case"delete":{if(pe(i,1,`${r.commandPrefix??"oo flow"} delete <flow> --yes [--json]`),!t.yes)throw new E("flow.confirmation-required","Flow deletion requires --yes.");let s=await ve(e,i[0]),a=await e.deleteFlow(s.flowId);F(r,t.json,{flow:a,kind:"flow.delete",version:1},qn(a));return}case"enable":case"disable":{if(pe(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> --expected-publication <publicationId>`),t.expectedPublication==null||t.expectedPublication=="none")throw new E("cli.invalid-arguments","--expected-publication must identify the observed Live publication.");let s=await ve(e,i[0]),a=await e.setFlowEnabled(s.flowId,t.expectedPublication,o=="enable");F(r,t.json,{flow:a,kind:`flow.${o}`,version:1},qn(a));return}case"check":{pe(i,1,`${r.commandPrefix??"oo flow"} check <flow> [--revision <revisionId>] [--json]`);let s=await ve(e,i[0]),a=t.revision??s.draftRevisionId,c=await e.checkAuthoring(s.flowId,a);return F(r,t.json,{check:c,valid:c.valid,revisionId:a,kind:"flow.check",scope:"revision",version:1},`${c.valid?"valid":"invalid"} revision ${s.name} ${s.flowId}`),c.valid?0:1}default:throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} <list|create|show|live|read|search|edit|canvas|schema|rename|delete|check|enable|disable|connector|event-source|trigger|run|runs|publish|publications|rollback|workbench>`)}}async function XI(e,n){let t=n[0];if(t==null)throw new E("cli.invalid-arguments","A Flow reference is required.");return await ve(e,t)}var Lt={};var Ab=(e)=>e,Gi=Object.is,eC=(e,n)=>{if(Gi(e,n))return!0;if(!Array.isArray(e)||!Array.isArray(n))return!1;let t=e.length;if(n.length!==t)return!1;for(let r=0;r<t;r++)if(!Gi(e[r],n[r]))return!1;return!0},nC=(e)=>e.value,tC=(e)=>e.map(nC),rC=(e)=>e.$version,Hi=(e,n)=>{try{e(n)}catch(t){console.error(t)}},Pb=(e,n)=>(e.set=n,e);var oC=Promise.resolve(),mu=new Set,iC=new Set,Qr=mu,gu,sC=()=>{let e=Qr;Qr=Qr===mu?iC:mu,gu=!1;for(let n of e)n.t();e.clear()},aC=(e)=>{Qr.add(e),gu=gu||oC.then(sC)},cC=(e)=>Qr.delete(e);var Rb=new FinalizationRegistry(Hi),$b=class{constructor(e,n,t){if(this.#r=e,this.q=(n?.equal??Gi)||void 0,this.e=n?.eager,this.m=n?.name,this.#n=n?.onDisposeValue,t){let r=new WeakRef(this),o=()=>{if(i){let s=i;i=void 0,s()}},i=t(()=>{let s=r.deref();if(s)s.n();else o()});if(i)Rb.register(this,this.#e=o)}}g=this;b=new Map;s=4;v;c=Lt;q;e;m;u=()=>{if(this.s&4){this.s&=-5;let e=this.#r();if(this.c===Lt)this.w(e);else if(!this.q?.(e,this.c)){if(this.w(e),this.s&1)this.s|=2}}return this.c};n=()=>{if(this.#o)console.error(this.c,Error(`${this.m||""} disposed`));if(this.s|=4,this.b.size){if(this.s|=1,this[3])this.#t(3);if(this[2]){if(this.u(),this.s&2)this.#t(2)}if(this[1])aC(this);else this.s&=-4}};a(e,n){let t=this.b.get(e);if(t)this[t]--;return this.b.set(e,n),this[n]++,()=>this.r(e)}r(e){if(e){let n=this.b.get(e);if(n)this.b.delete(e),this[n]--}else this.b.clear(),this[1]=this[2]=this[3]=0,cC(this)}t(){if(this[1]){if(this.u(),this.s&2)this.#t(1)}this.s&=-4}d(){let e=this.c;if(this.r(),Rb.unregister(this),this.#e?.(),this.#o=!0,this.#n&&e!==Lt)this.#n(e)}w(e){this.w=this.q?.(e,e)?this.y:this.x,this.w(e)}x(e){let n=this.c;if(this.c=e,this.v=Symbol(),this.#n&&n!==Lt&&n!==e)this.#n(n)}y(e){let n=this.c;if(this.c=this.v=e,this.#n&&n!==Lt&&n!==e)this.#n(n)}[1]=0;[2]=0;[3]=0;#e;#n;#r;#t(e){for(let[n,t]of this.b)if(t===e)Hi(n,this.c)}#o},lC=class{#e=new WeakSet;constructor(e){this.g=e.g,this.e=e.e,this.u=e.u,this.n=e.n,this.b=e.b}get v(){return this.g.v}g;b;e;u;n;a(e,n){return this.#e.add(e),this.g.a(e,n)}r(e){if(e){if(this.#e.has(e))this.#e.delete(e),this.g.r(e)}else for(let n of this.g.b.keys())this.r(n)}d(){this.r()}},hu=class{#e;constructor(e){this.#e=e,this.get=e.u,e.u()}get name(){return this.#e.m}get $version(){return this.get(),this.#e.v}get value(){return this.get()}set value(e){this.set?.(e)}set;get;ref(e){let n=new hu(new lC(this.#e));return e&&this.set?Pb(n,this.set):n}reaction(e,n=this.#e.e){return this.#e.a(e,n?2:1)}subscribe(e,n=this.#e.e){let t=this.reaction(e,n);return Hi(e,this.get()),t}$valCompute(e){return this.#e.a(e,3)}unsubscribe(e){this.#e.r(e)}dispose(){this.#e.d()}toString(){return String(this.get())}toJSON(e){let n=this.get();return n&&n.toJSON?n.toJSON(e):n}},uC=(e,n)=>{let t=e,o=new $b(()=>t,n),i=(a)=>{if(!o.q?.(a,t))t=a,o.n()};return[new hu(o),i]},yu=(e,n)=>Pb(...uC(e,n));var Tb=(e,n,t)=>new hu(new $b(e,t,n)),Nb=(e,n=Ab,t)=>{let r,o;return Tb(()=>{let i=e.map(rC);if(!o||!eC(i,o))o=i,r=n(tC(e));return r},(i)=>{let s=e.map((a)=>a.$valCompute(i));return()=>s.forEach(Hi)},t)};var bu=(e,n=Ab,t)=>{let r,o=Lt;return Tb(()=>{let i=e.$version;if(!Gi(i,o))o=i,r=n(e.value);return r},(i)=>e.$valCompute(i),t)};var zb=(e,n={},t="")=>{for(let[r,o]of Object.entries(e))if(typeof o==="string")n[t+r]=o;else zb(o,n,t+r+".");return n},dC=(e)=>{let n=[],t=[],r=/{{(\S+?)}}/gi,o,i=0;while(o=r.exec(e))n.push(e.slice(i,o.index),""),t.push(o[1]),i=o.index+o[0].length;if(n.push(e.slice(i)),t.length<=0)return!1;return(s)=>{for(let a=t.length-1;a>=0;a--)n[a*2+1]=s[t[a]]??t[a];return n.join("")}},Db=class e{constructor(n,t,r){this.t=(i,s)=>this.t$.get()(i,s),this.fetcher=r?.fetcher;let o=new Map;this.locales$=yu(t),this.lang$=yu(n),this.locale$=Nb([this.lang$,this.locales$],([i,s])=>s[i]||{}),this.a=bu(this.locale$,zb),this.t$=bu(this.a,(i)=>((s,a,c)=>{if(c){let l=c["@"];if(l!=null){let u=`${a}@${l}`;if(s[u])a=u}else{let u=c[":option"];if(u!=null){let d;a=s[d=`${a}.${u}`]||s[d=`${a}.other`]?d:a}}if(s[a]){let u=o.get(a);if(u??o.set(a,u=dC(s[a])),u)return u(c)}}return s[a]||a}).bind(o.clear(),i))}static async preload(n,t){return new e(n,{[n]:await t(n)},{fetcher:t})}get lang(){return this.lang$.value}get locales(){return this.locales$.value}get locale(){return this.locale$.value}async switchLang(n){if(!this.locales$.value[n]&&this.fetcher)this.addLocale(n,await this.fetcher(n));this.lang$.set(n)}hasKey(n){return!!this.a.value[n]}addLocale(n,t){this.locales$.set({...this.locales,[n]:t})}dispose(){this.lang$.dispose(),this.t$.dispose(),this.locales$.dispose(),this.locale$.dispose(),this.a.dispose()}};var Lb={help:{usage:"Usage: {{command}}",title:"Open Flow commands",options:"Options: --json, --cursor <cursor>, --limit <count>"}};var Vb={help:{usage:"Utilisation : {{command}}",title:"Commandes Open Flow",options:"Options : --json, --cursor <cursor>, --limit <count>"}};var Mb={help:{usage:"\u4F7F\u3044\u65B9\uFF1A{{command}}",title:"Open Flow \u30B3\u30DE\u30F3\u30C9",options:"\u30AA\u30D7\u30B7\u30E7\u30F3\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var qb={help:{usage:"\uC0AC\uC6A9\uBC95: {{command}}",title:"Open Flow \uBA85\uB839\uC5B4",options:"\uC635\uC158: --json, --cursor <cursor>, --limit <count>"}};var Fb={help:{usage:"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435: {{command}}",title:"\u041A\u043E\u043C\u0430\u043D\u0434\u044B Open Flow",options:"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B: --json, --cursor <cursor>, --limit <count>"}};var Zb={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9009\u9879\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var Jb={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9078\u9805\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var wC={en:Lb,"zh-CN":Zb,"zh-TW":Jb,ja:Mb,ko:qb,ru:Fb,fr:Vb},vC=Object.fromEntries(rs.map((e)=>[e,wC[e]]));function Ub(e=Cu){return new Db(to([e]),vC)}function xC(e,n){let t=n.filter((i)=>!i.startsWith("-")),r=pu(t,e.commandPrefix);while(r.length==0&&t.length>0)t.pop(),r=pu(t,e.commandPrefix);let o=Ub(e.language);try{let i=r.length==1?fu(r[0].command):void 0,s=xb(r.length==1?r[0].command:"",e.commandPrefix),a={kind:"cli.help",version:1,commands:r.length==1?r:r.map(({command:c,usage:l})=>({command:c,usage:l})),...i==null?{}:{request:i.request},examples:s,exitCodes:{0:"Success or accepted asynchronous operation.",1:"Error or unsuccessful terminal Run.",2:"Run is waiting for an explicit action; inspect run.waits.",3:"Waiting timed out or publication is pending; the operation continues."},notes:i==null?[...e.scopeGuidance??["The oo host selects the team for the whole invocation with --team <name>; Flow commands use that authenticated scope."],"--timeout is a wait budget in milliseconds (default 60000).","--follow --json writes NDJSON pages immediately; resume from nextAfter.","Use read/search to locate nodes, schema read|search|edit|check for requests, and schema <type> for configuration and ports.","Use edit with baseRevision, requestId and an ordered edits array. Read selected text before an exact text.edit.","Retry mutations with the same idempotency key, fixed revision/publication and identical arguments."]:[i.guidance,...r[0].command=="check"?[]:["Use either --input (literal JSON, @file, or - for stdin) or --file (path or -), never both."]]};return n.includes("--json")?JSON.stringify(a):[o.t("help.title"),"",...r.map((c)=>r.length!=1?c.usage:`${c.usage}
65
+ `)}function Fn(e){return`${e.name} ${e.flowId} ${e.status}`}function Br(e){return`${e.operation} ${e.publicationId} ${e.revisionId} ${e.createdAt}`}function Kr(e){let n=e.source=="draft"?"":` ${e.publicationId}`;return`${e.source} ${e.status} ${e.runId} ${e.revisionId}${n}${e.waits.length==0?"":`
66
+ ${JSON.stringify(e.waits)}`}`}function mb(e){return`${e.source} ${e.status} ${e.runId} ${e.revisionId}`}function gb(e){return`${e.sequence} ${e.kind} ${JSON.stringify(e.payload)}`}async function Cn(e,n,t,r){try{if(e=="-")return await r.readStdin();if(!e.startsWith("@"))return e;let o=e.slice(1);if(o.length==0)throw new O("cli.invalid-arguments",`${n} @ requires a file path.`);return await r.readFile(o)}catch(o){if(o instanceof O)throw o;throw new O(t,o instanceof Error?o.message:String(o))}}async function hb(e,n){if(e.input==null)return{};let t=await Cn(e.input,"--input","run.input-unreadable",n),r;try{r=JSON.parse(t)}catch{throw new O("run.input-invalid","Run input must be valid JSON.")}if(r==null||typeof r!="object"||Array.isArray(r))throw new O("run.input-invalid","Run input must be an object keyed by node ID.");for(let o of Object.values(r))if(o==null||typeof o!="object"||Array.isArray(o))throw new O("run.input-invalid","Each Run input node must contain an object keyed by input handle.");return r}async function Wr(e,n,t){let r=new Set,o;do{let i=await e.listPublications(n,{cursor:o,limit:su}),s=i.publications.find((a)=>a.publicationId==t);if(s!=null)return s;if(o=i.nextCursor,o!=null&&r.has(o))throw new O("page.invalid-cursor","The deployment returned a repeated Publication cursor.");if(o!=null)r.add(o)}while(o!=null);throw new O("publication.not-found",`Publication ${JSON.stringify(t)} was not found.`)}async function uu(e,n,t,r=60000){let o=Date.now()+r,i=n;while(!DI.has(i.status)&&i.waits.length==0){let s=o-Date.now();if(s<=0)return{run:i,timedOut:!0};if(await t.wait(Math.min(1000,s)),Date.now()>=o)return{run:i,timedOut:!0};try{i=await e.getRun(i.runId,AbortSignal.timeout(Math.max(1,o-Date.now())))}catch(a){if(Date.now()>=o||a instanceof Error&&a.name=="TimeoutError")return{run:i,timedOut:!0};throw new O("run.wait-failed",a instanceof Error?a.message:String(a),{runId:i.runId})}}return{run:i,timedOut:!1}}function Gr(e,n=!1){if(n)return 3;if(e.waits.length>0)return 2;return e.status=="failed"||e.status=="canceled"||e.status=="indeterminate"?1:0}function yb(e){return new O(e.code,e.message,{status:e.status,...e.details})}async function du(e,n,t,r,o=60000){let i=Date.now()+o,s=t;while(s.status=="pending"){let a=i-Date.now();if(a<=0)return{operation:s,timedOut:!0};if(await r.wait(Math.min(1000,a)),Date.now()>=i)return{operation:s,timedOut:!0};try{s=await e.getPublishOperation(n,s.operationId,AbortSignal.timeout(Math.max(1,i-Date.now())))}catch(c){if(Date.now()>=i||c instanceof Error&&c.name=="TimeoutError")return{operation:s,timedOut:!0};throw new O("publication.wait-failed",c instanceof Error?c.message:String(c),{flowId:n,operationId:s.operationId})}}return{operation:s,timedOut:!1}}var FI=new Set(Ji);function bb(e){let n=MI(),t,r=[],o=[],i,s,a,c,l,u,d,g,h,y,S,R,N,D,L,Oe,fe,ie,qe,ot=!1,it,st=!1,at,Lt,Yr=[],Iu="draft",Xi,es,Cu=!1,ns,ts,rs,Eu=[],Ou=!1,ju=!1;for(let Vt=0;Vt<e.length;Vt+=1){let Mt=e[Vt],Xr=Mt.startsWith("--")?Mt.indexOf("="):-1,P=Xr<0?Mt:Mt.slice(0,Xr),eo=Xr<0?void 0:Mt.slice(Xr+1);if(eo!=null&&["--json","--follow","--wait","--yes","--full","--pending-wait"].includes(P))throw new O("cli.invalid-arguments",`${P} does not accept a value.`);if(P.startsWith("--")){let U=P.slice(2);if(o.includes(U)&&U!="set"&&U!="unset")throw new O("cli.invalid-arguments",`Duplicate option --${U}.`);o.push(U)}if(P=="--json")st=!0;else if(P=="--follow")ot=!0;else if(P=="--wait")Ou=!0;else if(P=="--yes")ju=!0;else if(P=="--pending-wait")Xi=!0;else if(P=="--full")Cu=!0;else if(P=="--idempotency-key"||P=="--expected-publication"||P=="--revision"||P=="--publication"||P=="--pointer"||P=="--offset"||P=="--max-bytes"||P=="--code"||P=="--connection"||P=="--cron"||P=="--description"||P=="--every"||P=="--expected-revision"||P=="--file"||P=="--flow"||P=="--name"||P=="--source"||P=="--input"||P=="--trigger"||P=="--outputs"||P=="--status"||P=="--cursor"||P=="--limit"||P=="--after"||P=="--comment"||P=="--timeout"||P=="--timezone"||P=="--set"||P=="--unset"){let U=eo??e[Vt+1];if(U==null||U.length==0||eo==null&&U.startsWith("-")&&U!="-")throw new O("cli.invalid-arguments",`${P} requires a value.`);if(eo==null)Vt++;if(P=="--idempotency-key")n=U;else if(P=="--expected-publication")t=U;else if(P=="--revision")a=U;else if(P=="--publication")c=U;else if(P=="--pointer")l=U;else if(P=="--after")h=U;else if(P=="--code")S=U;else if(P=="--connection")R=U;else if(P=="--cron")N=U;else if(P=="--description")L=U;else if(P=="--every")Oe=U;else if(P=="--expected-revision")fe=U;else if(P=="--file")ie=U;else if(P=="--flow")qe=U;else if(P=="--name")Lt=U;else if(P=="--comment")ns=U;else if(P=="--input")it=U;else if(P=="--trigger")i=U;else if(P=="--outputs")s=U;else if(P=="--cursor")D=U;else if(P=="--timezone")rs=U;else if(P=="--set")Yr.push(U);else if(P=="--unset")Eu.push(U);else if(P=="--source"){if(U!="draft"&&U!="live")throw new O("cli.invalid-arguments","--source must be draft or live.");Iu=U}else if(P=="--status"){if(!FI.has(U))throw new O("cli.invalid-arguments",`Unknown Run status ${JSON.stringify(U)}.`);es=U}else{let En=Number(U),ow=P=="--offset"?0:1;if(!Number.isSafeInteger(En)||En<ow||P=="--limit"&&En>100||P=="--max-bytes"&&En>1048576)throw new O("cli.invalid-arguments",`${P} has an invalid value.`);if(P=="--limit")at=En;else if(P=="--offset")u=En;else if(P=="--max-bytes")d=En;else ts=En}}else if(P.startsWith("-"))throw new O("cli.invalid-arguments",`Unknown option ${JSON.stringify(P)}.`);else r.push(P)}if(h!=null){if(r[0]=="runs"&&r[1]=="results")g=h;else if(y=Number(h),!Number.isSafeInteger(y)||y<0)throw new O("cli.invalid-arguments","--after must be a non-negative event sequence.")}return{idempotencyKey:n,...g==null?{}:{resultAfter:g},...d==null?{}:{maxBytes:d},...u==null?{}:{offset:u},...l==null?{}:{pointer:l},...a==null?{}:{revision:a},...c==null?{}:{publication:c},...ns==null?{}:{comment:ns},...t==null?{}:{expectedPublication:t},...y==null?{}:{after:y},...S==null?{}:{code:S},...R==null?{}:{connection:R},...N==null?{}:{cron:N},...D==null?{}:{cursor:D},...L==null?{}:{description:L},...Oe==null?{}:{every:Oe},...fe==null?{}:{expectedRevision:fe},...ie==null?{}:{file:ie},...qe==null?{}:{flow:qe},follow:ot,...it==null?{}:{input:it},json:st,...at==null?{}:{limit:at},...Lt==null?{}:{name:Lt},positionals:r,options:o,...i==null?{}:{trigger:i},...s==null?{}:{outputs:s},sets:Yr,source:Iu,...es==null?{}:{status:es},...Xi==null?{}:{pendingWait:Xi},full:Cu,...ts==null?{}:{timeoutMs:ts},...rs==null?{}:{timezone:rs},unsets:Eu,wait:Ou,yes:ju}}var ZI=0.1,JI=3,rt=sn("type",[k({type:w("focus"),nodeId:j().min(1)}),k({type:w("zoom"),zoom:ne().min(ZI).max(JI)}),k({type:w("pan"),dx:ne(),dy:ne()}),k({type:w("fit")})]);var pu=j().trim().refine((e)=>[...e].length<=2000,"Wait comment must contain at most 2,000 Unicode code points.").nullable().optional();var Dt=j().min(1),iC=$e(),sC=k({kind:w("graph.trigger.create"),nodeId:Dt,key:Dt,connectionId:Dt.optional(),name:Dt.optional(),config:re(Dt,iC),schedule:Vn.readonly().optional()});function fu(e){return Qn(e),A(pn()).min(1).parse(e).map((n,t)=>{let{kind:r}=Lr(n,t,E({kind:Dt}).parse);return r=="graph.trigger.create"?Lr(n,t,sC.parse):Hh(n,t)})}var wb=[{snapshot:{configInputs:[{handle:"baseId",jsonSchema:{type:"string",pattern:"^app[A-Za-z0-9]{14}$"},nullable:!1},{handle:"formula",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"tableIdOrName",jsonSchema:{type:"string",minLength:1,maxLength:255},nullable:!1},{handle:"triggerField",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^[^}]*$"},nullable:!1},{handle:"view",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"fields",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"maxRecordsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:1000},nullable:!1,value:200}],definitionVersion:2,description:"Polls an Airtable table and triggers when a record is created or updated, ordered by a time field.",displayName:"Record Created or Updated",key:"airtable.on_record_changed",name:"on_record_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{baseId:{type:"string"},createdTime:{type:"string"},fields:{type:"object"},recordId:{type:"string"},tableIdOrName:{type:"string"},triggerField:{type:"string"},triggerFieldValue:{type:"string"}},additionalProperties:!1,required:["baseId","tableIdOrName","recordId","createdTime","triggerField","triggerFieldValue","fields"]}},nullable:!1}],provider:"airtable",type:"poll"},options:!1},{snapshot:{key:"asana.on_task_event",provider:"asana",name:"on_task_event",displayName:"Project Task Event",description:"Receives tasks added to a project, completion changes, and selected custom field changes. Task details represent current state, not historical state.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!0},successStatus:200},configInputs:[{handle:"projectId",jsonSchema:{type:"string",minLength:1,title:"Project ID"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["task.added","task.completed","task.field_changed"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["task.added","task.completed"]},{handle:"customFieldId",jsonSchema:{type:"string",minLength:1,title:"Custom field ID"},nullable:!0}],outputs:[{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},task:{type:"object"},change:{type:"object"}},required:["event","task","change"]}},nullable:!1}]},callback:{headers:["x-hook-secret","x-hook-signature"],query:[]},options:!1},{snapshot:{key:"calendly.on_booking_event",provider:"calendly",name:"on_booking_event",displayName:"Booking Created or Canceled",description:"Receives bookings and cancellations, preserving reschedule links. Requires a Personal Access Token connection.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"scope",jsonSchema:{type:"string",enum:["user","organization"],title:"Scope"},nullable:!1,value:"user"},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["invitee.created","invitee.canceled"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["invitee.created","invitee.canceled"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["invitee.created","invitee.canceled"]},nullable:!1},{handle:"inviteeUri",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["calendly-webhook-signature"],query:[]},options:!1},{snapshot:{key:"clickup.on_task_event",provider:"clickup",name:"on_task_event",displayName:"Task Event",description:"Receives task creation, status changes, and new comments in a ClickUp Workspace or List.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"workspaceId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"Workspace ID"},nullable:!1},{handle:"listId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"List ID"},nullable:!0},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["taskCreated","taskStatusUpdated","taskCommentPosted"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},nullable:!1},{handle:"taskId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-signature"],query:[]},options:!1},{snapshot:{key:"feishu_app_bot.on_event",provider:"feishu_app_bot",name:"on_event",displayName:"Application Event",description:"Receives selected Feishu application events through a shared event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.]{0,127}$"},minItems:1,maxItems:200,uniqueItems:!0,title:"Event types"},nullable:!1},{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",minLength:1,maxLength:256},maxItems:100,uniqueItems:!0,title:"Chat IDs"},nullable:!0,description:"Leave empty to receive events from all chats available to the source."},{handle:"resource",jsonSchema:{type:"object",properties:{kind:{type:"string",enum:["document","calendar","approval"]},id:{type:"string",minLength:1,maxLength:256},documentType:{type:"string",enum:["doc","docx","sheet","bitable","file","folder"]}},additionalProperties:!1,required:["kind","id"],title:"Resource subscription"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"tenantKey",jsonSchema:{type:"string"},nullable:!1},{handle:"occurredAt",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"feishu"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},verificationToken:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},manageSubscriptions:{type:"boolean"}},required:["version","name","connectionId","teamId","verificationToken","encryptKey","eventTypes","manageSubscriptions"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"feishu",provider:"feishu_app_bot",triggerId:"feishu_app_bot.on_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"feishu"},{snapshot:{key:"fireflies.on_meeting_ready",provider:"fireflies",name:"on_meeting_ready",displayName:"Meeting Transcript or Summary Ready",description:"Receives separate transcript and summary readiness events through Fireflies Webhooks V2 after checking meeting access.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["meeting.transcribed","meeting.summarized"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"fireflies"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]}}},required:["kind","version","name","connectionId","teamId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"fireflies",provider:"fireflies",triggerId:"fireflies.on_meeting_ready",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"fireflies"},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["*","branch_protection_configuration","branch_protection_rule","check_run","check_suite","code_scanning_alert","commit_comment","create","custom_property_values","delete","dependabot_alert","deploy_key","deployment","deployment_status","discussion","discussion_comment","fork","gollum","issue_comment","issue_dependencies","issues","label","member","meta","milestone","package","page_build","project","project_card","project_column","public","pull_request","pull_request_review","pull_request_review_comment","pull_request_review_thread","push","registry_package","release","repository","repository_advisory","repository_import","repository_ruleset","repository_vulnerability_alert","secret_scanning_alert","secret_scanning_alert_location","secret_scanning_scan","security_and_analysis","star","status","sub_issues","team_add","watch","workflow_job","workflow_run"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1}],definitionVersion:2,description:"Triggers when selected GitHub webhook events occur in a repository.",displayName:"Repository Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.on_repo_event",name:"on_repo_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"github",type:"integration"},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1},{handle:"number",jsonSchema:{type:"integer",minimum:1},nullable:!1,description:"Number of the pull request to watch."}],definitionVersion:2,description:"Watches one pull request using notifications and periodic checks. Starts from its current state; reports observed changes, not every intermediate transition or review event.",displayName:"Watch Pull Request",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.watch_pull_request",name:"watch_pull_request",provider:"github",type:"integration",outputs:[{handle:"pullRequest",jsonSchema:{type:"object",properties:{id:{type:"integer"},number:{type:"integer"},title:{type:"string"},url:{type:"string"},state:{type:"string",enum:["open","closed"]},draft:{type:"boolean"},merged:{type:"boolean"},updatedAt:{type:"string"},headSha:{type:"string"},baseSha:{type:"string"}},additionalProperties:!1,required:["id","number","title","url","state","draft","merged","updatedAt","headSha","baseSha"]},nullable:!1},{handle:"version",jsonSchema:{type:"string"},nullable:!1}]},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["push","tag_push","issues","confidential_issues","note","confidential_note","merge_requests","job","pipeline","wiki_page","deployment","feature_flag","releases","milestone","emoji","resource_access_token","resource_deploy_token"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"project",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^(?:[0-9]+|(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*(?:/(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*)*)$"},nullable:!1},{handle:"pushBranchFilter",jsonSchema:{type:"string",maxLength:255},nullable:!1,value:""}],definitionVersion:2,description:"Triggers when selected GitLab webhook events occur in a project.",displayName:"Project Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"gitlab.on_project_event",name:"on_project_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"gitlabEvent",jsonSchema:{type:"string"},nullable:!1}],provider:"gitlab",type:"integration"},callback:{headers:["idempotency-key","x-gitlab-event","x-gitlab-token"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"labelNamesOrIds",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,description:"Only trigger on messages carrying all of these labels, referenced by name or ID.",value:[]},{handle:"readStatus",jsonSchema:{type:"string",enum:["Read","Unread","All"]},nullable:!1,value:"All"},{handle:"search",jsonSchema:{type:"string"},nullable:!1,description:"Gmail search-syntax query the message must match.",value:""},{handle:"sender",jsonSchema:{type:"string"},nullable:!1,description:"Only trigger on messages whose sender matches this address or name.",value:""},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on draft messages."},{handle:"includeSpamAndTrash",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages in SPAM and TRASH."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls the Gmail mailbox and triggers when a new message is received.",displayName:"New Message Received",key:"gmail.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{historyId:{type:["string","null"]},labelIds:{type:"array",items:{type:"string"}},messageId:{type:"string"},messageTimestamp:{type:"string"},sender:{type:"string"},subject:{type:"string"},threadId:{type:"string"},to:{type:"string"}},additionalProperties:!1,required:["messageId","threadId","historyId","labelIds","subject","sender","to","messageTimestamp"]}},nullable:!1}],provider:"gmail",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"calendarId",jsonSchema:{type:"string",minLength:1,maxLength:1024},nullable:!1},{handle:"changes",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","cancelled"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated","cancelled"]},{handle:"matchTerm",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxEventsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100}],definitionVersion:2,description:"Polls a Google Calendar and triggers when an event is created, updated or cancelled.",displayName:"Event Changed",key:"googlecalendar.on_event_changed",name:"on_event_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{attendeeEmails:{type:"array",items:{type:"string"}},calendarId:{type:"string"},changeType:{type:"string",enum:["created","updated","cancelled"]},created:{type:["string","null"]},creatorEmail:{type:["string","null"]},description:{type:["string","null"]},end:{type:["object","null"]},eventId:{type:"string"},eventType:{type:["string","null"]},htmlLink:{type:["string","null"]},isAllDay:{type:"boolean"},location:{type:["string","null"]},organizerEmail:{type:["string","null"]},recurringEventId:{type:["string","null"]},start:{type:["object","null"]},status:{type:"string"},summary:{type:["string","null"]},updated:{type:["string","null"]}},additionalProperties:!1,required:["changeType","calendarId","eventId","status","summary","description","location","htmlLink","start","end","isAllDay","organizerEmail","creatorEmail","attendeeEmails","recurringEventId","eventType","created","updated"]}},nullable:!1}],provider:"googlecalendar",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Uses a Google Drive changes.watch channel and triggers when Drive changes are available.",displayName:"Changes Detected",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.changes_detected",name:"changes_detected",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeId:{type:"string"},changeType:{type:["string","null"]},driveId:{type:["string","null"]},file:{type:["object","null"]},fileId:{type:["string","null"]},notification:{type:"object",properties:{changedTypes:{type:"array",items:{type:"string"}},messageNumber:{type:["string","null"]},resourceState:{type:"string"},resourceUri:{type:["string","null"]}},additionalProperties:!1,required:["resourceState","changedTypes","messageNumber","resourceUri"]},removed:{type:"boolean"},time:{type:["string","null"]}},additionalProperties:!1,required:["changeId","changeType","removed","time","fileId","driveId","file","notification"]}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"changeType",jsonSchema:{type:"string",enum:["created","updated"]},nullable:!1},{handle:"driveId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{0,512}$"},nullable:!1,value:""},{handle:"folderId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{2,512}$"},nullable:!1},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"mimeTypes",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"namePrefix",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxFilesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls one Google Drive folder and triggers when a file or folder directly inside it is created or updated.",displayName:"File or Folder Change in a Folder",key:"googledrive.on_file_change",name:"on_file_change",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdTime:{type:["string","null"]},driveId:{type:["string","null"]},eventType:{type:"string",enum:["file_created","file_updated","folder_created","folder_updated"]},fileId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifyingUser:{type:["object","null"]},mimeType:{type:"string"},modifiedTime:{type:["string","null"]},name:{type:"string"},parents:{type:"array",items:{type:"string"}},size:{type:"string"},webViewLink:{type:["string","null"]}},additionalProperties:!1,required:["eventType","itemType","fileId","name","mimeType","createdTime","modifiedTime","parents","webViewLink","driveId","lastModifyingUser"]}},nullable:!1}],provider:"googledrive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Monitors Drive changes using notifications and periodic scans of the same change stream.",displayName:"Watch Changes",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.watch_changes",name:"watch_changes",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object"}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"columnRange",jsonSchema:{type:"string",pattern:"^[A-Za-z]{1,3}(?::[A-Za-z]{1,3})?$"},nullable:!1,value:"A:ZZZ"},{handle:"sheet",jsonSchema:{type:"string",minLength:1},nullable:!1},{handle:"spreadsheetId",jsonSchema:{type:"string",minLength:1},nullable:!1},{group:"Advanced settings",collapsed:!0},{handle:"dateTimeRender",jsonSchema:{type:"string",enum:["FORMATTED_STRING","SERIAL_NUMBER"]},nullable:!1,value:"FORMATTED_STRING"},{handle:"firstDataRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:2},{handle:"headerRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:1},{handle:"maxRowsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100},{handle:"valueRender",jsonSchema:{type:"string",enum:["UNFORMATTED_VALUE","FORMATTED_VALUE","FORMULA"]},nullable:!1,value:"UNFORMATTED_VALUE"}],definitionVersion:2,description:"Polls a sheet and triggers once for every new row appended below the last row already seen.",displayName:"New Row Added",key:"googlesheets.on_row_added",name:"on_row_added",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{row:{type:"object"},rowNumber:{type:"integer"},sheetId:{type:"integer"},sheetTitle:{type:"string"},spreadsheetId:{type:"string"},values:{type:"array",items:{}}},additionalProperties:!1,required:["spreadsheetId","sheetId","sheetTitle","rowNumber","row","values"]}},nullable:!1}],provider:"googlesheets",type:"poll"},options:!1},{snapshot:{key:"intercom.on_conversation_event",provider:"intercom",name:"on_conversation_event",displayName:"Customer Conversation or Ticket",description:"Receives customer conversations, customer replies and new tickets from a verified Intercom application event source. Administrator replies are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["conversation.user.created","conversation.user.replied","ticket.created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"workspaceId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object",properties:{},additionalProperties:!0},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"intercom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"intercom",provider:"intercom",triggerId:"intercom.on_conversation_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"intercom"},{snapshot:{key:"jira.on_issue_event",provider:"jira",name:"on_issue_event",displayName:"Issue or Comment Event",description:"Receives Jira Cloud issue creation, issue updates and new comments through a shared project webhook with automatic renewal.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["jira:issue_created","jira:issue_updated","comment_created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"cloudId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"jira"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},project:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]}}},required:["kind","version","name","connectionId","teamId","project","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"jira",provider:"jira",triggerId:"jira.on_issue_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!0},options:!1,eventSource:"jira"},{snapshot:{configInputs:[{handle:"teamId",jsonSchema:{type:"string",pattern:"^[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}$",title:"Team ID"},nullable:!1,description:"Linear Team UUID. Use Copy model UUID in Linear to find it."},{handle:"stateIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[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}$"},maxItems:50,uniqueItems:!0,title:"Issue statuses"},nullable:!1,value:[],description:"Choose statuses from the selected Team. Empty means all statuses. Matches the current status, not every transition into it."}],definitionVersion:2,description:"Watches new and updated issues in a Linear team with periodic checks. Starts from now without running existing issues. Reports observed current states, not deletions or every intermediate status change.",displayName:"Issue Created or Updated",key:"linear.on_issue_changed",name:"on_issue_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{id:{type:"string"},identifier:{type:"string"},title:{type:"string"},url:{type:"string"},teamId:{type:"string"},createdAt:{type:"string"},updatedAt:{type:"string"},state:{type:"object",properties:{id:{type:"string"},name:{type:"string"},type:{type:"string"}},additionalProperties:!1,required:["id","name","type"]}},additionalProperties:!1,required:["id","identifier","title","url","teamId","createdAt","updatedAt","state"]}},nullable:!1}],provider:"linear",type:"poll"},options:!0},{snapshot:{configInputs:[{handle:"dataSourceId",jsonSchema:{type:"string",pattern:"^(?:|[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})$"},nullable:!1,value:""},{handle:"databaseId",jsonSchema:{type:"string",pattern:"^[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}$"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["page_added","page_updated"]},minItems:1,uniqueItems:!0},nullable:!1,value:["page_added"]},{group:"Advanced settings",collapsed:!0},{handle:"includeProperties",jsonSchema:{type:"boolean"},nullable:!1,value:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Notion database and triggers when a page is added to it or an existing page is edited.",displayName:"Database Page Added or Updated",key:"notion.on_database_page_event",name:"on_database_page_event",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdBy:{type:"object"},createdTime:{type:"string"},dataSourceId:{type:"string"},databaseId:{type:"string"},event:{type:"string",enum:["page_added","page_updated"]},lastEditedBy:{type:"object"},lastEditedTime:{type:"string"},pageId:{type:"string"},properties:{type:"object"},title:{type:"string"},url:{type:"string"}},additionalProperties:!1,required:["event","pageId","databaseId","dataSourceId","url","title","createdTime","lastEditedTime","createdBy","lastEditedBy"]}},nullable:!1}],provider:"notion",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","deleted"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated"]},{handle:"itemId",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"parentFolderId",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls the OneDrive change feed and triggers when a file or folder is created, updated or deleted.",displayName:"File or Folder Changed",key:"one_drive.on_item_changed",name:"on_item_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeType:{type:"string",enum:["created","updated","deleted"]},createdDateTime:{type:["string","null"]},driveId:{type:["string","null"]},eTag:{type:["string","null"]},itemId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifiedDateTime:{type:["string","null"]},mimeType:{type:["string","null"]},name:{type:"string"},parentFolderId:{type:["string","null"]},size:{type:["number","null"]},webUrl:{type:"string"}},additionalProperties:!1,required:["itemId","name","changeType","itemType","size","mimeType","webUrl","parentFolderId","driveId","createdDateTime","lastModifiedDateTime","eTag"]}},nullable:!1}],provider:"one_drive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"folder",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_=-]*$"},nullable:!1,value:"inbox",description:"A well-known mail folder name, folder ID, or an empty string for the whole mailbox."},{handle:"readStatus",jsonSchema:{type:"string",enum:["All","Read","Unread"]},nullable:!1,value:"All"},{handle:"senderAddress",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Exact sender address, or empty for any sender."},{handle:"subjectContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Case-insensitive subject text."},{handle:"withAttachmentsOnly",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Microsoft Outlook mail folder and triggers when a new message arrives.",displayName:"New Message Received",key:"outlook.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{bodyPreview:{type:"string"},categories:{type:"array",items:{type:"string"}},conversationId:{type:"string"},from:{type:"string"},fromName:{type:"string"},hasAttachments:{type:"boolean"},importance:{type:"string"},internetMessageId:{type:"string"},isDraft:{type:"boolean"},isRead:{type:"boolean"},messageId:{type:"string"},parentFolderId:{type:"string"},receivedDateTime:{type:"string"},subject:{type:"string"},to:{type:"array",items:{type:"string"}},webLink:{type:"string"}},additionalProperties:!1,required:["messageId","internetMessageId","conversationId","subject","bodyPreview","from","fromName","to","receivedDateTime","hasAttachments","isRead","isDraft","importance","categories","parentFolderId","webLink"]}},nullable:!1}],provider:"outlook",type:"poll"},options:!1},{snapshot:{key:"pandadoc.on_document_event",provider:"pandadoc",name:"on_document_event",displayName:"Document Status Changed",description:"Receives document status changes in the connected workspace, optionally only when the entire document is completed.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!0,allowEmpty:!1},successStatus:200},configInputs:[{handle:"completedOnly",jsonSchema:{type:"boolean",title:"Completed documents only"},nullable:!1,value:!0}],outputs:[{handle:"events",nullable:!1,jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},data:{type:"object"}},required:["event","data"]}}}]},callback:{headers:[],query:["signature"]},options:!1},{snapshot:{key:"pipedrive.on_crm_event",provider:"pipedrive",name:"on_crm_event",displayName:"Deal or Contact Event",description:"Receives new deals or contacts, or actual changes to a deal stage or status using Pipedrive Webhooks v2.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventType",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"],title:"Event"},nullable:!1,value:"deal.created"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["authorization"],query:[]},options:!1},{snapshot:{key:"resend.on_email_event",provider:"resend",name:"on_email_event",displayName:"Email Received, Bounced or Complained",description:"Receives inbound email, bounce, and complaint notifications. Read message bodies and attachments with Actions.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["email.received","email.bounced","email.complained"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["email.received","email.bounced","email.complained"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["email.received","email.bounced","email.complained"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"emailId",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["svix-id","svix-signature","svix-timestamp"],query:[]},options:!1},{snapshot:{key:"sentry.on_issue_alert",provider:"sentry",name:"on_issue_alert",displayName:"Issue Alert",description:"Receives Issue Alert Rule notifications from a verified Sentry Custom Integration installation.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"projectIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]+$"},uniqueItems:!0,title:"Project IDs"},nullable:!0},{handle:"ruleNames",jsonSchema:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0,title:"Alert rule names"},nullable:!0},{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["issue.alert"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["issue.alert"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"organizationId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"sentry"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},installationId:{type:"string",minLength:1,maxLength:256},organizationId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"issue.alert"}}},required:["kind","version","name","connectionId","teamId","appId","installationId","organizationId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"sentry",provider:"sentry",triggerId:"sentry.on_issue_alert",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"sentry"},{snapshot:{configInputs:[{handle:"topics",jsonSchema:{type:"array",items:{type:"string",enum:["app/scopes_update","app/uninstalled","app_purchases_one_time/update","app_subscriptions/approaching_capped_amount","app_subscriptions/update","bulk_operations/finish","carts/create","carts/update","channels/delete","checkout_and_accounts_configurations/update","checkouts/create","checkouts/delete","checkouts/update","collection_listings/add","collection_listings/remove","collection_listings/update","collection_publications/create","collection_publications/delete","collection_publications/update","collections/create","collections/delete","collections/update","companies/create","companies/delete","companies/update","company_contact_roles/assign","company_contact_roles/revoke","company_contacts/create","company_contacts/delete","company_contacts/update","company_locations/create","company_locations/delete","company_locations/update","customer.joined_segment","customer.left_segment","customer.tags_added","customer.tags_removed","customer_account_settings/update","customer_groups/create","customer_groups/delete","customer_groups/update","customers/create","customers/delete","customers/disable","customers/enable","customers/purchasing_summary","customers/update","customers_email_marketing_consent/update","customers_marketing_consent/update","delivery_promise_settings/update","disputes/create","disputes/update","domains/create","domains/destroy","domains/update","draft_orders/create","draft_orders/delete","draft_orders/update","fulfillment_events/create","fulfillment_events/delete","fulfillment_holds/added","fulfillment_holds/released","fulfillment_orders/cancellation_request_accepted","fulfillment_orders/cancellation_request_rejected","fulfillment_orders/cancellation_request_submitted","fulfillment_orders/cancelled","fulfillment_orders/fulfillment_request_accepted","fulfillment_orders/fulfillment_request_rejected","fulfillment_orders/fulfillment_request_submitted","fulfillment_orders/fulfillment_service_failed_to_complete","fulfillment_orders/hold_released","fulfillment_orders/line_items_prepared_for_local_delivery","fulfillment_orders/line_items_prepared_for_pickup","fulfillment_orders/manually_reported_progress_stopped","fulfillment_orders/merged","fulfillment_orders/moved","fulfillment_orders/order_routing_complete","fulfillment_orders/placed_on_hold","fulfillment_orders/progress_reported","fulfillment_orders/rescheduled","fulfillment_orders/scheduled_fulfillment_order_ready","fulfillment_orders/split","fulfillments/create","fulfillments/update","inventory_items/create","inventory_items/delete","inventory_items/update","inventory_levels/connect","inventory_levels/disconnect","inventory_levels/update","locales/create","locales/destroy","locales/update","locations/activate","locations/create","locations/deactivate","locations/delete","locations/update","machine_translation_batch/completed","metafield_definitions/create","metafield_definitions/delete","metafield_definitions/update","order_transactions/create","orders/cancelled","orders/create","orders/delete","orders/edited","orders/fulfilled","orders/link_requested","orders/paid","orders/partially_fulfilled","orders/risk_assessment_changed","orders/shopify_protect_eligibility_changed","orders/updated","payment_schedules/due","payment_terms/create","payment_terms/delete","payment_terms/update","product_feeds/create","product_feeds/full_sync","product_feeds/full_sync_finish","product_feeds/incremental_sync","product_feeds/update","product_listings/add","product_listings/remove","product_listings/update","product_publications/create","product_publications/delete","product_publications/update","products/create","products/delete","products/update","profiles/create","profiles/delete","profiles/update","publications/delete","refunds/create","returns/approve","returns/cancel","returns/close","returns/decline","returns/process","returns/reopen","returns/request","returns/update","reverse_deliveries/attach_deliverable","reverse_fulfillment_orders/dispose","scheduled_product_listings/add","scheduled_product_listings/remove","scheduled_product_listings/update","segments/create","segments/delete","segments/update","selling_plan_groups/create","selling_plan_groups/delete","selling_plan_groups/update","shop/update","subscription_billing_attempts/challenged","subscription_billing_attempts/failure","subscription_billing_attempts/success","subscription_billing_cycle_edits/create","subscription_billing_cycle_edits/delete","subscription_billing_cycle_edits/update","subscription_billing_cycles/skip","subscription_billing_cycles/unskip","subscription_contracts/activate","subscription_contracts/cancel","subscription_contracts/create","subscription_contracts/expire","subscription_contracts/fail","subscription_contracts/pause","subscription_contracts/update","tax_partners/update","tax_summaries/create","tender_transactions/create","themes/create","themes/delete","themes/publish","themes/update","variants/in_stock","variants/out_of_stock"]},minItems:1,maxItems:20,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when selected Shopify webhook topics occur in the connected store.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"shopify.on_shop_event",name:"on_shop_event",outputs:[{handle:"apiVersion",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"shopDomain",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"triggeredAt",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"shopify",type:"integration"},callback:{headers:["x-shopify-api-version","x-shopify-event-id","x-shopify-shop-domain","x-shopify-topic","x-shopify-triggered-at","x-shopify-webhook-id"],query:["open_flow_callback"]},options:!1},{snapshot:{configInputs:[{handle:"channelId",jsonSchema:{type:"string",pattern:"^[CDG][A-Z0-9]{2,31}$"},nullable:!1,description:"Slack conversation ID to watch, e.g. C0122KQ70S7E."},{handle:"fromUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Only trigger on messages written by these Slack user IDs. Empty means any author."},{handle:"ignoreUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Never trigger on messages written by these Slack user IDs."},{handle:"textContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Only trigger when message text contains this string, case-insensitively."},{group:"Advanced settings",collapsed:!0},{handle:"includeBotMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages posted by bots and apps."},{handle:"includeSystemMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on Slack system notices."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:15,description:"Maximum number of messages processed per poll."}],definitionVersion:2,description:"Polls one Slack conversation and triggers when a new message is posted to it.",displayName:"New Channel Message",key:"slack.on_message_posted",name:"on_message_posted",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{botId:{type:["string","null"]},channelId:{type:"string"},files:{type:"array",items:{type:"object",properties:{id:{type:"string"},mimetype:{type:"string"},name:{type:"string"}},additionalProperties:!1,required:["id","name","mimetype"]}},messageTs:{type:"string"},subtype:{type:["string","null"]},text:{type:"string"},threadTs:{type:["string","null"]},userId:{type:["string","null"]}},additionalProperties:!1,required:["channelId","messageTs","threadTs","userId","botId","subtype","text","files"]}},nullable:!1}],provider:"slack",type:"poll"},options:!1},{snapshot:{key:"slackbot.on_event",provider:"slackbot",name:"on_event",displayName:"Mention or Direct Message",description:"Receives user mentions and new direct messages through a shared Slack application event source. Slack Connect events are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["app_mention","message.im"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["app_mention","message.im"]},{handle:"channelIds",jsonSchema:{type:"array",items:{type:"string",minLength:1},maxItems:100,uniqueItems:!0,title:"Channel IDs"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"teamId",jsonSchema:{type:"string"},nullable:!1},{handle:"channel",jsonSchema:{type:"string"},nullable:!1},{handle:"user",jsonSchema:{type:"string"},nullable:!1},{handle:"text",jsonSchema:{type:"string"},nullable:!1},{handle:"ts",jsonSchema:{type:"string"},nullable:!1},{handle:"threadTs",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"slack"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",pattern:"^A[A-Z0-9]+$"},workspaceId:{type:"string",pattern:"^T[A-Z0-9]+$"},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["app_mention","message.im"]}}},required:["kind","version","name","connectionId","teamId","appId","workspaceId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"slack",provider:"slackbot",triggerId:"slackbot.on_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"slack"},{snapshot:{configInputs:[{handle:"apiVersion",jsonSchema:{type:"string",maxLength:40},nullable:!1,value:""},{handle:"events",jsonSchema:{type:"array",items:{type:"string",maxLength:120,pattern:"^(\\*|[a-z0-9_]+(?:\\.[a-z0-9_]+)+)$"},minItems:1,uniqueItems:!0},nullable:!1},{handle:"includeConnectedAccounts",jsonSchema:{type:"boolean"},nullable:!1,value:!1}],definitionVersion:2,description:"Triggers when selected Stripe events happen on the connected account.",displayName:"Account Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"stripe.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"livemode",jsonSchema:{type:"boolean"},nullable:!1}],provider:"stripe",type:"integration"},callback:{headers:["stripe-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form"},nullable:!1,description:"Choose a form accessible to this Connection."}],definitionVersion:2,description:"Receives new Tally form submissions through a signed, automatically managed webhook.",displayName:"Form Response",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"tally.on_form_response",name:"on_form_response",outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},createdAt:{type:"string"},formId:{type:"string"},submissionId:{type:"string"},responseId:{type:"string"},fields:{type:"array",items:{type:"object",properties:{key:{type:"string"},type:{type:"string"},label:{type:["string","null"]},value:{},options:{type:"array",items:{type:"object"}}},required:["key","type","label","value"]}}},required:["eventId","createdAt","formId","submissionId","responseId","fields"]}}],provider:"tally",type:"integration"},callback:{headers:["tally-signature"],query:[]},options:!0},{snapshot:{configInputs:[{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^-?[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram chat IDs. Empty means every chat."},{handle:"dropPendingUpdates",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Discard updates queued before the webhook is created or resumed."},{handle:"updates",jsonSchema:{type:"array",items:{enum:["*","message","edited_message","channel_post","edited_channel_post","business_connection","business_message","edited_business_message","deleted_business_messages","guest_message","message_reaction","message_reaction_count","inline_query","chosen_inline_result","callback_query","shipping_query","pre_checkout_query","purchased_paid_media","poll","poll_answer","my_chat_member","chat_member","chat_join_request","chat_boost","removed_chat_boost","managed_bot","subscription"]},minItems:1,uniqueItems:!0},nullable:!1,description:"Telegram update types that trigger a Run. Use * for the Telegram default set."},{handle:"userIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram user IDs. Empty means every user."}],definitionVersion:2,description:"Triggers when the connected Telegram bot receives a selected update.",displayName:"Bot Update",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"telegram.on_update",name:"on_update",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"telegram",type:"integration"},callback:{headers:["x-telegram-bot-api-secret-token"],query:[]},options:!1},{snapshot:{key:"typeform.on_form_response",provider:"typeform",name:"on_form_response",displayName:"Completed Form Response",description:"Receives complete Typeform submissions through an automatically managed signed webhook.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form ID"},nullable:!1}],outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},form_id:{type:"string"},token:{type:"string"},submitted_at:{type:"string"},answers:{type:"array",items:{type:"object"}},definition:{type:"object"}},required:["eventId","form_id","token","submitted_at","answers"]}}]},callback:{headers:["typeform-signature"],query:[]},options:!1},{snapshot:{key:"vercel.on_deployment_event",provider:"vercel",name:"on_deployment_event",displayName:"Deployment Ready or Failed",description:"Receives successful and failed deployments for a Vercel project.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"teamId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Team ID"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Project ID"},nullable:!1},{handle:"environment",jsonSchema:{type:"string",enum:["all","production","preview"],title:"Environment"},nullable:!1,value:"all"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deployment.ready","deployment.error"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"deploymentId",jsonSchema:{type:"string"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-vercel-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["coupon.created","coupon.updated","coupon.deleted","coupon.restored","customer.created","customer.updated","customer.deleted","order.created","order.updated","order.deleted","order.restored","product.created","product.updated","product.deleted","product.restored","product.published"]},minItems:1,maxItems:16,uniqueItems:!0},nullable:!1},{handle:"webhookName",jsonSchema:{type:"string",minLength:1,maxLength:120},nullable:!1,value:"OOMOL Trigger"}],definitionVersion:2,description:"Triggers when selected WooCommerce store events occur.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"woocommerce.on_store_event",name:"on_store_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"resource",jsonSchema:{type:"string"},nullable:!1},{handle:"source",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"woocommerce",type:"integration"},callback:{headers:["x-wc-webhook-delivery-id","x-wc-webhook-event","x-wc-webhook-id","x-wc-webhook-resource","x-wc-webhook-signature","x-wc-webhook-source","x-wc-webhook-topic"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["zen:event-type:ticket.agent_assignment_changed","zen:event-type:ticket.attachment_linked_to_comment","zen:event-type:ticket.attachment_redacted_from_comment","zen:event-type:ticket.brand_changed","zen:event-type:ticket.comment_added","zen:event-type:ticket.comment_made_private","zen:event-type:ticket.comment_redacted","zen:event-type:ticket.created","zen:event-type:ticket.csat_received","zen:event-type:ticket.csat_requested","zen:event-type:ticket.custom_field_changed","zen:event-type:ticket.custom_status_changed","zen:event-type:ticket.description_changed","zen:event-type:ticket.email_ccs_changed","zen:event-type:ticket.external_id_changed","zen:event-type:ticket.followers_changed","zen:event-type:ticket.form_changed","zen:event-type:ticket.group_assignment_changed","zen:event-type:ticket.marked_as_spam","zen:event-type:ticket.merged","zen:event-type:ticket.next_sla_breach_changed","zen:event-type:ticket.ola_policy_changed","zen:event-type:ticket.organization_changed","zen:event-type:ticket.permanently_deleted","zen:event-type:ticket.priority_changed","zen:event-type:ticket.problem_link_changed","zen:event-type:ticket.requester_changed","zen:event-type:ticket.schedule_changed","zen:event-type:ticket.sla_policy_changed","zen:event-type:ticket.soft_deleted","zen:event-type:ticket.status_changed","zen:event-type:ticket.subject_changed","zen:event-type:ticket.submitter_changed","zen:event-type:ticket.tags_changed","zen:event-type:ticket.task_due_at_changed","zen:event-type:ticket.type_changed","zen:event-type:ticket.undeleted","zen:event-type:organization.created","zen:event-type:organization.custom_field_changed","zen:event-type:organization.deleted","zen:event-type:organization.external_id_changed","zen:event-type:organization.name_changed","zen:event-type:organization.tags_changed","zen:event-type:user.active_changed","zen:event-type:user.alias_changed","zen:event-type:user.created","zen:event-type:user.custom_field_changed","zen:event-type:user.custom_role_changed","zen:event-type:user.default_group_changed","zen:event-type:user.deleted","zen:event-type:user.details_changed","zen:event-type:user.external_id_changed","zen:event-type:user.group_membership_created","zen:event-type:user.group_membership_deleted","zen:event-type:user.identity_changed","zen:event-type:user.identity_created","zen:event-type:user.identity_deleted","zen:event-type:user.last_login_changed","zen:event-type:user.merged","zen:event-type:user.name_changed","zen:event-type:user.notes_changed","zen:event-type:user.only_private_comments_changed","zen:event-type:user.organization_membership_created","zen:event-type:user.organization_membership_deleted","zen:event-type:user.password_changed","zen:event-type:user.photo_changed","zen:event-type:user.role_changed","zen:event-type:user.suspended_changed","zen:event-type:user.tags_changed","zen:event-type:user.time_zone_changed"]},minItems:1,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when one of the selected Zendesk account events occurs.",displayName:"Event Subscription",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"zendesk.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"subject",jsonSchema:{type:"string"},nullable:!1}],provider:"zendesk",type:"integration"},callback:{headers:["x-zendesk-webhook-signature","x-zendesk-webhook-signature-timestamp"],query:[]},options:!1},{snapshot:{key:"zoom.on_recording_ready",provider:"zoom",name:"on_recording_ready",displayName:"Cloud Recording Ready",description:"Receives completed cloud recordings hosted by the connected Zoom user through a verified application event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["recording.completed"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["recording.completed"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingUuid",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"zoom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"recording.completed"}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"zoom",provider:"zoom",triggerId:"zoom.on_recording_ready",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"zoom"}];function vb(e){return $g(e).extend({name:j().trim().min(1).max(128)})}var kb=wb.flatMap((e)=>("source"in e)&&e.source!=null?[e.source]:[]),xb=Q(kb.map((e)=>vb(e.createSchema))),Sb=vb(kb[0].updateSchema),Ib=k({version:w(1),expectedRevision:we().positive()});var Cb={start:"A Start node with a required message parameter. Supply it through trigger.outputs.",error:"A Flow Error node. Select upstream Flows, then publish and enable this Flow to listen for failures in their automatic runs.",webhook:"A Webhook start node.","webhook-response":"An HTTP response node with body, statusCode and headers inputs. Select it from a reachable Webhook.",cron:"An hourly scheduled start node.",poll:"Gmail polling by key; replace CONNECTION_ID with an active Gmail connection.",integration:"Telegram webhook integration by key; replace CONNECTION_ID with an active Telegram connection.",decision:"AI Decision evaluates named questions against target and returns a complete answer object per output. Configure target before running.","http-request":"A single HTTP request. Bind url and request inputs; outputs are body, statusCode and headers.",openapi:"A fixed JSON API operation. Replace the example document and URL before running.",connector:"A Connector Task and its node. Replace ACTION_ID, CONNECTION_ID and port definitions using connector_get / connector show. Set connectionId to an empty string to defer account configuration; execution will require an account.",code:"A JavaScript module and its node. Use Code for custom computation; use Connector Tasks for existing actions.",condition:"A condition with true and false execution branches.",value:"A fixed value node.",approval:"An Approval with approve and reject decision branches and a built-in notification output.",wait:"A Wait with a continue action and a built-in notification output.",agent:"An Agent with code computation enabled. Configure a model available in the deployment.","llm-chat":"An LLM chat Task and its node; configure a model available in the deployment.","llm-json":"An LLM JSON Task and its node; configure a model available in the deployment.","poll-notification":"Gmail events \u2192 JavaScript text formatting \u2192 Connector notification. Replace connection/action IDs and match the notification input ports."},cC=Object.keys(Cb),lC=cC.map((e)=>({name:e,description:Cb[e]}));var NN=k({comment:pu}),Hr=$e(),Ie=j().min(1),ke=w(1),mu=Ie.refine((e)=>e==e.trim()&&zi(e)==null,"Flow name is invalid."),Eb=re(j(),re(j(),Hr)),Ob=k({nodeId:Ie,outputs:re(j(),Hr)}),te={canvas:k({command:rt,version:ke}),authoringCheck:Vl,authoringEdit:Vr,authoringRead:Ai,authoringSearch:Pi,authoringSchema:ay,loadOpenApiDocument:k({url:j().min(1).max(8192),version:ke}),createEventSource:xb,updateEventSource:Sb,eventSourceRevision:Ib,importFlow:k({file:Hr,name:mu.optional(),teamId:Ie.optional(),version:ke}),createFlow:k({name:mu,teamId:Ie.optional(),version:ke}),renameFlow:k({name:mu,version:ke}),changeDraft:k({expectedRevisionId:Ie,operations:A(Hr).min(1),version:ke}),repairDraft:k({expectedRevisionId:Ie,version:ke}),upgradeDraft:k({expectedRevisionId:Ie,version:ke}),setEnabled:k({enabled:me(),expectedPublicationId:Ie,version:ke}),updatePresentation:k({expectedRevision:we().positive(),value:re(j(),Hr),version:ke}),checkFlow:k({engineContract:Ie,version:ke}),publishFlow:k({engineContract:Ie,expectedLivePublicationId:Ie.nullable(),version:ke}),rollbackFlow:k({expectedLivePublicationId:Ie,version:ke}),createDraftRun:k({engineContract:Ie,inputs:Eb,trigger:Ob,version:w(2)}),createLiveRun:k({publicationId:Ie,inputs:Eb,trigger:Ob,version:w(2)}),resolveWait:k({action:W(["approve","continue","reject"]),comment:pu,version:ke}),putVariable:k({value:j().refine((e)=>new TextEncoder().encode(e).byteLength<=65536,"Variable value is too large.")}),queryConnectorAccessCandidates:k({providerIds:A(Ie.max(256)).min(1).refine((e)=>new Set(e).size==e.length,"Duplicate provider IDs."),version:ke}),removeConnectionUsage:k({connectionId:Ie,expectedRevisionId:Ie,expectedAccessRevision:we().nonnegative(),version:ke}),setConnectorService:k({expectedAccessRevision:we().nonnegative(),version:ke}),addProviderAccessBinding:k({accessBindingId:Ie,expectedAccessRevision:we().nonnegative(),version:ke}),removeProviderAccessBinding:k({accessBindingId:Ie,expectedAccessRevision:we().nonnegative(),version:ke}),versionOnly:k({version:ke})};function oe(e){return(n)=>e.parse(n)}var Gi={canvas:oe(te.canvas),authoringCheck:oe(te.authoringCheck),authoringEdit:oe(te.authoringEdit),authoringRead:oe(te.authoringRead),authoringSearch:oe(te.authoringSearch),authoringSchema:oe(te.authoringSchema),loadOpenApiDocument:oe(te.loadOpenApiDocument),createEventSource:oe(te.createEventSource),updateEventSource:oe(te.updateEventSource),eventSourceRevision:oe(te.eventSourceRevision),importFlow:oe(te.importFlow),createFlow:oe(te.createFlow),renameFlow:oe(te.renameFlow),changeDraft(e){let n=te.changeDraft.parse(e);return{...n,operations:fu(n.operations)}},repairDraft:oe(te.repairDraft),upgradeDraft:oe(te.upgradeDraft),setEnabled:oe(te.setEnabled),updatePresentation:oe(te.updatePresentation),checkFlow:oe(te.checkFlow),publishFlow:oe(te.publishFlow),rollbackFlow:oe(te.rollbackFlow),createDraftRun:oe(te.createDraftRun),createLiveRun:oe(te.createLiveRun),resolveWait:oe(te.resolveWait),putVariable:oe(te.putVariable),queryConnectorAccessCandidates:oe(te.queryConnectorAccessCandidates),removeConnectionUsage:oe(te.removeConnectionUsage),setConnectorService:oe(te.setConnectorService),addProviderAccessBinding:oe(te.addProviderAccessBinding),removeProviderAccessBinding:oe(te.removeProviderAccessBinding),versionOnly:oe(te.versionOnly)};var gu=["expected-revision","idempotency-key"],hu=["cursor","limit"],jb=[["canvas","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["read","<flow> [--input JSON|@file|- | --file path|-]",["input","file"]],["search","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["edit","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["list","[--cursor <cursor>] [--limit <count>]",hu],["export","<flow>",[]],["import","--file <path|->",["file","name","idempotency-key"]],["create","<name>",["idempotency-key"]],["show","<flow>",[]],["live","<flow>",[]],["rename","<flow> <new-name>",[]],["delete","<flow> --yes",["yes"]],["check","<flow> [--revision <revisionId>]",["revision"]],["enable","<flow> --expected-publication <publicationId>",["expected-publication"]],["disable","<flow> --expected-publication <publicationId>",["expected-publication"]],["connector code-access","<flow> [--publication <publicationId>]",["publication"]],["connector candidates","<flow> <provider> [provider ...]",[]],["connector code-allow","<flow> <provider> <binding> <access-revision>",[]],["connector code-remove","<flow> <provider> <binding> <access-revision>",[]],["connector remove-usage","<flow> <connection> <access-revision>",gu],["connector providers","[--flow <flow>]",["flow"]],["connector teams","",[]],["connector search","<query> [--flow <flow>]",["flow"]],["connector show","<action> [--flow <flow>]",["flow"]],["connector connections","<service> [--flow <flow>]",["flow"]],["event-source list","",[]],["trigger search","[query]",[]],["trigger show","<key>",[]],["run","<flow>",[...gu,"expected-publication","source","trigger","outputs","input","wait","timeout"]],["runs list","--flow <flow>",["flow","status","pending-wait",...hu]],["runs show","<run>",[]],["runs wait","<run>",["timeout"]],["runs resolve","<run> <wait> <continue|approve|reject>",["comment"]],["runs events","<run>",["after","limit","follow","timeout"]],["runs result","<run>",[]],["runs results","<run> [--after <resultId>]",["after"]],["runs read-result","<run> <result>",["pointer","offset","limit","max-bytes"]],["runs download-result","<run> <result>",[]],["runs cancel","<run>",[]],["publish","<flow>",[...gu,"expected-publication","timeout"]],["publications list","<flow>",hu],["publications show","<flow> <publication>",[]],["publications wait","<flow> <operation>",["timeout"]],["publications operation","<flow> <operation>",[]],["rollback","<flow> <publication>",["expected-publication","idempotency-key"]],["open","[flow]",[]],["workbench","[flow]",[]],["schema","[read|search|edit|check|node-type]",["flow","input"]]],dC={revision:{description:"Exact Revision to read or check; defaults to the current Draft.",type:"string"},publication:{description:"Exact Publication ID whose fixed Code connections are read; defaults to the Draft.",type:"string"},pointer:{description:"JSON Pointer within the stored result; defaults to the root.",type:"string"},offset:{description:"Page offset at the selected pointer.",type:"integer",minimum:0,default:0},"max-bytes":{description:"Maximum result page bytes.",type:"integer",minimum:1,maximum:1048576,default:15000},"expected-revision":{description:"Base Revision ID from read. Required with an explicit idempotency key for draft edits and draft runs.",type:"string"},"expected-publication":{description:"Fixed Publication ID. Use none when publishing without a Live Publication.",type:"string"},"idempotency-key":{description:"Stable identity of one mutation. Reuse only with the identical arguments and base identity.",type:"string"},source:{description:"Execution source.",type:"string",enum:["draft","live"],default:"draft"},trigger:{description:"Exact Trigger ID or unambiguous name. The Start node is selected automatically; a sole legacy Manual Trigger remains supported.",type:"string"},timeout:{description:"Wait budget in milliseconds; expiration does not cancel the operation. For node set, the node execution timeout.",type:"integer",minimum:1,default:60000},limit:{description:"Maximum items in one page.",type:"integer",minimum:1,maximum:100,default:100},after:{description:"Resume events after this sequence number; use nextAfter from the preceding response.",type:"integer",minimum:0,default:0},cursor:{description:"Opaque nextCursor from the preceding page; keep the same filters.",type:"string"},comment:{description:"Optional plain-text Wait decision comment (up to 2,000 Unicode code points).",type:"string"},"pending-wait":{description:"List runs with unresolved waits, including running and queued runs.",type:"boolean"},status:{description:"Filter runs by status.",type:"string",enum:["queued","starting","running","waiting","completed","failed","canceled","indeterminate"]},file:{description:"Authoring request or workflow JSON file path, or - for stdin.",type:"string"},code:{description:"JavaScript source, @file, or - for stdin.",type:"string"},input:{description:"Authoring request JSON; literal JSON, @file, or -. For run, node ID to input values.",type:"string"},outputs:{description:"Start parameters or other Trigger outputs: literal JSON, @file, or -. Defaults to {}.",type:"string"},set:{description:"handle=value; repeat for multiple fields. Values use port schemas, JSON, @file, or -.",type:"string"},unset:{description:"Input/config handle to remove; repeat for multiple fields.",type:"string"},connection:{description:"Exact active Connection ID, unambiguous display name, or default.",type:"string"},flow:{description:"Exact Flow ID or unambiguous name; fixes Connector Team scope.",type:"string"},name:{description:"Display name.",type:"string"},description:{description:"Trigger description.",type:"string"},cron:{description:"Cron expression; combine with --timezone. Mutually exclusive with --every.",type:"string"},timezone:{description:"IANA time zone for --cron.",type:"string"},every:{description:"Interval such as 5m, 1h, or 1d. Mutually exclusive with --cron.",type:"string"},wait:{description:"Wait until terminal, waiting for an action, or the wait budget expires."},follow:{description:"Stream event pages as NDJSON with --json; stop on terminal, Wait, or timeout."},full:{description:"Include complete Revision content, schemas, source code and revision metadata."},yes:{description:"Confirm the requested deletion."},json:{description:"Machine-readable JSON results and errors; NDJSON for followed events."},help:{description:"Show this command contract without contacting the host."}};function yu(e,n="oo flow"){let t=e.join(" ");return jb.filter(([r])=>t==""||r==t||r.startsWith(`${t} `)).map(([r,o,i])=>({command:r,usage:`${n} ${r} ${o} [--json]`,options:[...i,"json","help"].map((s)=>Object.assign({name:`--${s}`,value:!["json","help","wait","follow","full","yes","pending-wait"].includes(s),repeatable:s=="set"||s=="unset"},dC[s],r=="runs results"&&s=="after"?{type:"string",minimum:void 0,default:void 0,description:"Result ID from nextAfter on the preceding page."}:{},r=="runs read-result"&&s=="limit"?{default:20}:{}))}))}function _b(e){return jb.find(([n])=>n==e.slice(0,n.split(" ").length).join(" "))?.[2]}function Rb(e="edits"){let n=Ml(e);if(n!=null)return n;if(e=="edits")return Fl();if(e=="outputs")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",description:"Named Start parameters or other Trigger outputs. Start uses the workflow inputDefs returned by flow read; other triggers define their own output contracts. Omitted nullable Start parameters become null; required parameters must be supplied."};if(_i.includes(e))return Fl(e);if(e=="input")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",additionalProperties:{type:"object",additionalProperties:!0},description:"Node ID -> input handle -> JSON value."};return}function bu(e){if(e=="canvas")return{request:ht(rt,{io:"input"}),guidance:"Broadcast transient viewport commands; success does not confirm execution. No Presentation save, offline queue or replay. Pan uses screen pixels; zoom is an absolute ratio (0.1\u20133); fit includes all nodes. Repeating pan moves again; do not automatically retry an uncertain response.",examples:[{type:"focus",nodeId:"NODE_ID"},{type:"zoom",zoom:0.8},{type:"pan",dx:200,dy:-100},{type:"fit"}]};return Ml(e)}function Ab(e,n="oo flow"){if(e=="export")return[`${n} export FLOW_ID > template.openflow.json`];if(e=="import")return[`${n} import --file template.openflow.json --name "Imported workflow" --idempotency-key IMPORT_KEY --json`];if(e=="schema")return[`${n} schema read --json`,`${n} schema agent --json`,`${n} schema --flow FLOW_ID --input '{"action":"ACTION_ID"}' --json`];let t=bu(e);if(t==null)return pC(n);if(e=="check")return[`${n} check FLOW_ID --revision REVISION --json`];return t.examples.map((r)=>`${n} ${e} FLOW_ID${Object.keys(r).length==0?"":` --input '${JSON.stringify(r)}'`} --json`)}function pC(e){return[`${e} list --limit 20 --json`,`${e} read FLOW_ID --json`,`${e} live FLOW_ID --json`,`${e} schema code --json`,`${e} edit FLOW_ID --file edits.json --json`,`${e} connector search email --flow FLOW_ID --json`,`${e} run FLOW_ID --expected-revision REVISION_ID --idempotency-key RUN_KEY --wait --timeout 60000 --json`,`${e} runs wait RUN_ID --timeout 60000 --json`,`${e} runs resolve RUN_ID WAIT_ID approve --json`,`${e} runs events RUN_ID --after 0 --follow --timeout 60000 --json`]}import{basename as mC}from"path";async function Pb(e,n,t,r,o){let[i,s,a,...c]=t;switch(i){case"code-access":case"candidates":case"code-allow":case"code-remove":case"remove-usage":{let l=i=="code-access"?1:i=="candidates"?2:i=="remove-usage"?3:4;if(i=="candidates"?t.length<l+1:t.length!=l+1)throw new O("cli.invalid-arguments",`Invalid arguments for connector ${i}. See --help.`);let u=fC(n),d;if(i=="code-access")d=r.publication==null?await e.getConnectorAccess(u):await e.getPublishedConnectorAccess(u,r.publication);else if(i=="candidates")d=await e.listProviderAccessBindingCandidates(u,t.slice(2));else{let g=Number(t.at(-1));if(!Number.isSafeInteger(g)||g<0)throw new O("cli.invalid-arguments","Access revision must be a nonnegative integer.");if(i=="remove-usage"){let h=await lb(e,n,r);d=await e.removeConnectionUsage(u,a,h.draft.revisionId,g,r.idempotencyKey)}else if(i=="code-allow")d=await e.addProviderAccessBinding(u,a,c[0],g);else d=await e.removeProviderAccessBinding(u,a,c[0],g)}F(o,r.json,{...d,kind:`connector.${i}`},JSON.stringify(d,null,2));return}case"providers":{if(s!=null)throw new O("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector providers [--flow <flow>] [--json]`);let l=await e.listConnectorProviders(void 0,n?.flowId);F(o,r.json,{providers:l,kind:"connector.providers",version:1},l.map((u)=>`${u.serviceName} ${u.serviceId}`).join(`
67
+ `));return}case"teams":{if(s!=null)throw new O("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector teams [--json]`);let l=await e.listConnectorTeams();F(o,r.json,{...l,kind:"connector.teams"},l.teams.map((u)=>`${u.name} ${u.id}`).join(`
68
+ `));return}case"search":{if(s==null||a!=null)throw new O("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector search <query> [--json]`);let l=s.trim();if(l.length==0||l.length>256)throw new O("cli.invalid-arguments","Connector search query must contain 1\u2013256 characters.");let u=await e.searchConnectorActions(l,void 0,n?.flowId);F(o,r.json,{actions:u.map(Yl),kind:"connector.search",query:l,version:1},u.map(lu).join(`
69
+ `));return}case"show":{if(s==null||a!=null)throw new O("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector show <action> [--json]`);let l=await ub(e,s,n?.flowId);F(o,r.json,{action:l,kind:"connector.show",version:1},lu(l));return}case"connections":{if(s==null||a!=null)throw new O("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector connections <service> [--json]`);let l=await e.listConnectorConnections(s,void 0,n?.flowId);F(o,r.json,{connections:l,kind:"connector.connections",serviceId:s,version:1},l.map(fb).join(`
70
+ `));return}default:throw new O("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector <providers|teams|search|show|connections> ...`)}}async function Tb(e,n,t,r){let[o,i,s]=n;switch(o){case"search":{if(s!=null)throw new O("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger search [query] [--json]`);let a=i?.trim().toLowerCase();if(a!=null&&(a.length==0||a.length>256))throw new O("cli.invalid-arguments","Trigger search query must contain 1\u2013256 characters.");let c=tu(await e.listTriggerKeys(),a);F(r,t.json,{keys:c,kind:"trigger.search",query:a,version:1},c.map(cu).join(`
71
+ `));return}case"show":{if(i==null||s!=null)throw new O("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger show <key> [--json]`);let a=await pb(e,i);F(r,t.json,{definition:a,kind:"trigger.show",version:1},cu(a));return}default:throw new O("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger <search|show> ...`)}}function fC(e){if(e==null)throw new O("cli.invalid-arguments","A Flow reference is required.");return e.flowId}function Hi(e){if(e.publication==null)return`not-published ${e.flowId}`;return[`live ${e.flowId} ${e.publication.publicationId} ${e.publication.revisionId} ${e.status} enabled=${e.enabled}`,`inputDefs=${JSON.stringify(e.inputDefs)}`,...e.entries.flatMap((n)=>[`${n.type} ${n.nodeId} ${n.name}`,..."binding"in n?[` health=${n.binding.health}${n.binding.lastErrorCode==null?"":` error=${n.binding.lastErrorCode}`}`,...n.binding.listener==null?[]:[` listener=${JSON.stringify(n.binding.listener)}`],...n.binding.endpointUrl==null?[]:[` url=${n.binding.endpointUrl}`]]:[],..."provider"in n?[` provider=${n.provider} inputs=${JSON.stringify(n.inputs)}`]:[],` config=${JSON.stringify(n.config)}`])].join(`
72
+ `)}async function $b(e,n,t,r){pe(n,1,`${r.commandPrefix??"oo flow"} run <flow> [--source draft|live] [--trigger <name|id>] [--outputs <json|@file|->] [--input <json|@file|->] [--wait] [--json]`);let o=await ve(e,n[0]),i=await hb(t,r),s=t.source=="live"?t.expectedPublication==null?await e.getLive(o.flowId):{publication:await Wr(e,o.flowId,t.expectedPublication)}:void 0;if(t.source=="live"&&s?.publication==null)throw new O("live.not-found",`Flow ${JSON.stringify(n[0])} has no Live Publication.`);let a=s?.publication?.revisionId??t.expectedRevision??o.draftRevisionId,c=await e.getRevision(o.flowId,a),l=Object.entries(c.content.document.graph.nodes).filter(([,D])=>!("inputs"in D)),u=l.filter(([,D])=>D.kind=="start"),d=u.length==1?u[0][0]:l.length==1&&l[0]?.[1].kind=="manual"?l[0][0]:void 0,g=t.trigger??d;if(g==null)throw new O("run.trigger-required","Choose a start node with --trigger <name|id>.",{candidates:l.map(([D,L])=>({triggerId:D,name:L.name}))});let h=db(c.content,g),y={};if(t.outputs!=null){let D=await Cn(t.outputs,"--outputs","run.input-unreadable",r);try{let L=JSON.parse(D);if(L==null||typeof L!=="object"||Array.isArray(L))throw Error("Expected output object.");y=L}catch{throw new O("run.input-invalid","Trigger outputs must be valid JSON.")}}let S={nodeId:h.triggerId,outputs:y},R;if(s?.publication!=null)R=await e.createLiveRun(s.publication.publicationId,{inputs:i,trigger:S,idempotencyKey:t.idempotencyKey});else R=await e.createDraftRun(o.flowId,a,{inputs:i,trigger:S,idempotencyKey:t.idempotencyKey});let N=t.wait?await uu(e,R,r,t.timeoutMs):{run:R,timedOut:!1};return F(r,t.json,{kind:"run.create",idempotencyKey:t.idempotencyKey,...N,version:1},Kr(N.run)),Gr(N.run,N.timedOut)}async function Nb(e,n,t,r){let[o,...i]=n;switch(o){case"list":{if(pe(i,0,`${r.commandPrefix??"oo flow"} runs list --flow <flow> [--status <status>] [--pending-wait] [--cursor <cursor>] [--limit <count>] [--json]`),t.flow==null)throw new O("cli.invalid-arguments",`${r.commandPrefix??"oo flow"} runs list requires --flow <flow>.`);let s=await ve(e,t.flow),a=await e.listRuns(s.flowId,{...t.cursor==null?{}:{cursor:t.cursor},limit:t.limit??au,...t.status==null?{}:{status:t.status},...t.pendingWait==null?{}:{pendingWait:t.pendingWait}});F(r,t.json,{kind:"run.list",...a,version:1},a.runs.map(mb).join(`
73
+ `));return}case"show":{pe(i,1,`${r.commandPrefix??"oo flow"} runs show <run> [--json]`);let s=await e.getRun(i[0]);F(r,t.json,{kind:"run.show",run:s,version:1},Kr(s));return}case"wait":{pe(i,1,`${r.commandPrefix??"oo flow"} runs wait <run> [--timeout <milliseconds>] [--json]`);let s=i[0],a=Date.now()+(t.timeoutMs??60000);try{let c=await e.getRun(s,AbortSignal.timeout(t.timeoutMs??60000)),l=await uu(e,c,r,Math.max(0,a-Date.now()));return F(r,t.json,{kind:"run.wait",runId:s,...l,version:1},Kr(l.run)),Gr(l.run,l.timedOut)}catch(c){if(Date.now()>=a||c instanceof Error&&c.name=="TimeoutError")return F(r,t.json,{kind:"run.wait",runId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(c instanceof O)throw c;throw new O("run.wait-failed",c instanceof Error?c.message:String(c),{runId:s})}}case"resolve":{pe(i,3,`${r.commandPrefix??"oo flow"} runs resolve <run> <wait> <continue|approve|reject> [--comment <text>] [--json]`);let[s,a,c]=i;if(c!="continue"&&c!="approve"&&c!="reject")throw new O("cli.invalid-arguments","Invalid Wait action.");let l=await e.resolveRunWait(s,a,c,t.comment);F(r,t.json,{kind:"run.resolve",resolution:l,version:1},JSON.stringify(l));return}case"events":{pe(i,1,`${r.commandPrefix??"oo flow"} runs events <run> [--after <sequence>] [--limit <count>] [--follow] [--timeout <milliseconds>] [--json]`);let s=i[0],a=t.after??0,c=Date.now()+(t.timeoutMs??60000),l;try{do{if(t.follow&&Date.now()>=c)break;let u=await e.getRunEvents(s,{after:a,limit:t.limit??au},t.follow?AbortSignal.timeout(Math.max(1,c-Date.now())):void 0);if(a=u.nextAfter,F(r,t.json,{...u,kind:"run.events",runId:s,version:1},u.events.map(gb).join(`
74
+ `)),!t.follow)return;if(l=await e.getRun(s,AbortSignal.timeout(Math.max(1,c-Date.now()))),cb(u.events.at(-1)))return Gr(l);if(t.after!=null&&u.events.length==0&&u.done)return Gr(l);if(l.waits.length>0)return F(r,t.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!1,version:1},Kr(l)),2;let d=c-Date.now();if(d<=0)break;if(u.events.length==0)await r.wait(Math.min(1000,d))}while(t.follow)}catch(u){if(!t.follow||Date.now()<c&&!(u instanceof Error&&u.name=="TimeoutError"))throw new O("run.events-failed",u instanceof Error?u.message:String(u),{runId:s,nextAfter:a})}return F(r,t.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!0,version:1},`timeout ${s} ${a}`),3}case"results":{pe(i,1,`${r.commandPrefix??"oo flow"} runs results <run> [--after <resultId>]`);let s=await e.listRunResults(i[0],t.resultAfter);F(r,t.json,{kind:"run.results",...s},JSON.stringify(s));return}case"read-result":{pe(i,2,`${r.commandPrefix??"oo flow"} runs read-result <run> <result> [--pointer <pointer>] [--offset <offset>] [--limit <limit>] [--max-bytes <bytes>]`);let s=await e.readRunResult(i[0],i[1],{pointer:t.pointer??"",offset:t.offset??0,...t.limit==null?{}:{limit:t.limit},...t.maxBytes==null?{}:{maxBytes:t.maxBytes}});F(r,t.json,{kind:"run.result-page",...s},JSON.stringify(s));return}case"download-result":{pe(i,2,`${r.commandPrefix??"oo flow"} runs download-result <run> <result>`);let s=await e.downloadRunResult(i[0],i[1]);r.stdout.write(await s.text());return}case"result":{pe(i,1,`${r.commandPrefix??"oo flow"} runs result <run> [--json]`);let s=await e.getRunResult(i[0]);return F(r,t.json,{kind:"run.result",result:s,version:1},JSON.stringify(s)),s.status=="completed"?0:1}case"cancel":{pe(i,1,`${r.commandPrefix??"oo flow"} runs cancel <run> [--json]`);let s=await e.cancelRun(i[0]);F(r,t.json,{cancellation:s,kind:"run.cancel",version:1},`${s.status} ${s.runId} ${s.cancelAccepted?"accepted":"already-terminal"}`);return}default:throw new O("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} runs <list|show|wait|resolve|events|result|results|read-result|download-result|cancel>`)}}async function zb(e,n,t,r){pe(n,1,`${r.commandPrefix??"oo flow"} publish <flow> [--json]`);let o=await ve(e,n[0]),i=t.expectedPublication=="none"?null:t.expectedPublication??(await e.getLive(o.flowId)).publication?.publicationId??null,s=await e.publishFlow(o.flowId,t.expectedRevision??o.draftRevisionId,i,{idempotencyKey:t.idempotencyKey}),a=await du(e,o.flowId,s,r,t.timeoutMs);if(s=a.operation,s.status=="pending")return F(r,t.json,{kind:"publication.publish",expectedPublicationId:i,idempotencyKey:t.idempotencyKey,flowId:o.flowId,...a,version:1},JSON.stringify(s)),3;if(s.status=="failed")throw new O(s.issue.code,s.issue.message,{...s.issue.nodeId==null?{}:{nodeId:s.issue.nodeId},operationId:s.operationId,flowId:o.flowId,idempotencyKey:t.idempotencyKey});let c=[],l=`${r.commandPrefix??"oo flow"} live ${o.flowId} --json`,u;try{if(u=await e.getLiveDetails(o.flowId),u.publication?.publicationId!=s.publicationId)c.push({code:"live.publication-changed",message:`Publication ${s.publicationId} succeeded. Current Live is ${u.publication?.publicationId??"not-published"}; the returned entries describe that current version.`})}catch{c.push({code:"live.details-read-failed",message:`Publication ${s.publicationId} succeeded, but its current online entries could not be read. Query ${l}.`})}let d=u?.publication?.publicationId==s.publicationId?u.publication:void 0;if(d==null)try{d=await Wr(e,o.flowId,s.publicationId)}catch{c.push({code:"publication.read-failed",message:`Publication ${s.publicationId} succeeded, but its metadata could not be read. Query ${l}.`})}F(r,t.json,{kind:"publication.publish",expectedPublicationId:i,idempotencyKey:t.idempotencyKey,operation:s,...d==null?{}:{publication:d},...u==null?{}:{live:u},...c.length==0?{}:{warnings:c},version:1},[d==null?`published ${s.publicationId} ${s.revisionId}`:Br(d),...u==null?[]:[Hi(u)],...c.map((g)=>`Warning: ${g.message}`)].join(`
75
+ `))}async function Db(e,n,t,r){let[o,i,s,...a]=n;if(i==null||a.length>0)throw new O("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`);let c=await ve(e,i);if(o=="list"){if(s!=null)throw new O("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications list <flow> [--cursor <cursor>] [--limit <count>]`);let l=await e.listPublications(c.flowId,{...t.cursor==null?{}:{cursor:t.cursor},limit:t.limit??su});F(r,t.json,{flow:c,kind:"publication.list",...l,version:1},l.publications.map(Br).join(`
76
+ `));return}if((o=="operation"||o=="wait")&&s!=null){let l=Date.now()+(t.timeoutMs??60000);try{let u=await e.getPublishOperation(c.flowId,s,o=="wait"?AbortSignal.timeout(t.timeoutMs??60000):void 0),d=o=="wait"?await du(e,c.flowId,u,r,Math.max(0,l-Date.now())):{operation:u,timedOut:!1};return F(r,t.json,{kind:`publication.${o}`,flowId:c.flowId,...d,version:1},JSON.stringify(d.operation)),d.operation.status=="failed"?1:d.operation.status=="pending"?3:0}catch(u){if(o=="wait"&&(Date.now()>=l||u instanceof Error&&u.name=="TimeoutError"))return F(r,t.json,{kind:"publication.wait",flowId:c.flowId,operationId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(u instanceof O)throw u;throw new O("publication.wait-failed",u instanceof Error?u.message:String(u),{flowId:c.flowId,operationId:s})}}if(o=="show"&&s!=null){let l=await Wr(e,c.flowId,s);F(r,t.json,{kind:"publication.show",publication:l,version:1},Br(l));return}throw new O("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`)}async function qb(e,n,t,r){pe(n,2,`${r.commandPrefix??"oo flow"} rollback <flow> <publication> [--json]`);let o=await ve(e,n[0]),i=await Wr(e,o.flowId,n[1]),s=t.expectedPublication??(await e.getLive(o.flowId)).publication?.publicationId;if(s==null)throw new O("live.not-found",`Flow ${JSON.stringify(n[0])} has no Live Publication.`);let a=await e.rollbackFlow(o.flowId,i.publicationId,s,{idempotencyKey:t.idempotencyKey});F(r,t.json,{kind:"publication.rollback",expectedPublicationId:s,idempotencyKey:t.idempotencyKey,publication:a,version:1},Br(a))}async function Lb(e,n,t,r){let[o,...i]=t.positionals;switch(o){case"canvas":{if(pe(i,1,`${r.commandPrefix??"oo flow"} canvas <flow> (--input JSON|@file|- | --file path|-) [--json]`),t.file!=null&&t.input!=null)throw new O("cli.invalid-arguments","Choose --input or --file.");let s=t.file==null?t.input:t.file=="-"?"-":`@${t.file}`;if(s==null)throw new O("cli.invalid-arguments","Canvas requires --input or --file.");let a=rt.safeParse(JSON.parse(await Cn(s,"input","flow.authoring-unreadable",r)));if(!a.success)throw new O("cli.invalid-arguments",a.error.message);let c=await ve(e,i[0]),l=await e.broadcastCanvas(c.flowId,a.data);F(r,t.json,{...l,kind:"flow.canvas"},`Broadcast canvas ${a.data.type} for ${c.flowId}; execution is not confirmed.`);return}case"read":case"search":case"edit":{pe(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> [--input JSON|@file|-] [--file path|-] --json`);let s=await ve(e,i[0]);if(t.file!=null&&t.input!=null)throw new O("cli.invalid-arguments","Choose --input or --file.");let a=t.file==null?t.input:t.file=="-"?"-":`@${t.file}`,c=a==null?{}:JSON.parse(await Cn(a,"input","flow.authoring-unreadable",r)),l=o=="read"?await e.readAuthoring(s.flowId,Gi.authoringRead(c)):o=="search"?await e.searchAuthoring(s.flowId,Gi.authoringSearch(c)):await e.editAuthoring(s.flowId,Gi.authoringEdit(c));r.stdout.write(`${JSON.stringify(l)}
77
+ `);return}case"connector":{let a=["code-access","candidates","code-allow","code-remove","remove-usage"].includes(i[0]??"")?await gC(e,i.slice(1)):t.flow==null?void 0:await ve(e,t.flow);return await Pb(e,a,i,t,r)}case"event-source":{if(i.length!=1||i[0]!="list")throw new O("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} event-source list [--json]`);let s=await e.listEventSources(),a=`No event sources are visible to this identity. Run "${r.commandPrefix??"oo flow"} workbench" to create and verify a Feishu event source, then list again.`;F(r,t.json,{...s,kind:"event-source.list",...s.sources.length==0?{guidance:a}:{}},s.sources.length==0?a:s.sources.map((c)=>[c.sourceId,c.name,c.teamId??"-",c.connectionId,!c.enabled?"disabled":c.verifiedAt==null?"unverified":"verified",c.eventTypes.join(",")].join("\t")).join(`
78
+ `));return}case"run":return await $b(e,i,t,r);case"runs":return await Nb(e,i,t,r);case"publish":return await zb(e,i,t,r);case"publications":return await Db(e,i,t,r);case"rollback":return await qb(e,i,t,r);case"trigger":return await Tb(e,i,t,r);case"open":case"workbench":{if(i.length>1)throw new O("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} ${o} [flow] [--json]`);if(n.getWorkbenchUrl==null)throw new O("workbench.unavailable","This CLI host cannot provide a Workbench URL.");let s=i[0]==null?void 0:await ve(e,i[0]),a=await n.getWorkbenchUrl(s?.flowId);if(o=="open")await r.openUrl(a);F(r,t.json,{...s==null?{}:{flow:s},kind:`flow.${o}`,url:a,version:1},a);return}case"list":{pe(i,0,`${r.commandPrefix??"oo flow"} list [--json]`);let s=await e.listFlows({cursor:t.cursor,limit:t.limit??100});F(r,t.json,{...s,kind:"flow.list",version:1},s.flows.map(Fn).join(`
79
+ `));return}case"export":{pe(i,1,`${r.commandPrefix??"oo flow"} export <flow>`);let s=await ve(e,i[0]);r.stdout.write(jy(await e.exportFlow(s.flowId)));return}case"import":{if(pe(i,0,`${r.commandPrefix??"oo flow"} import --file <path|-> [--name name] [--json]`),t.file==null)throw new O("cli.invalid-arguments","Import requires --file <path|->.");let s=Oy(await Cn(t.file=="-"?"-":`@${t.file}`,"file","flow.import-unreadable",r)),a=t.name??s.name??(t.file=="-"?Pu(r.language??"en"):_y(mC(t.file))),c=await e.importFlow(s,{name:Wi(a,"Flow"),idempotencyKey:t.idempotencyKey});F(r,t.json,{flow:c,idempotencyKey:t.idempotencyKey,kind:"flow.import",version:1},Fn(c));return}case"create":{pe(i,1,`${r.commandPrefix??"oo flow"} create <name> [--json]`);let s=await e.createFlow(Wi(i[0],"Flow"),t.idempotencyKey);F(r,t.json,{flow:s,idempotencyKey:t.idempotencyKey,kind:"flow.create",version:1},Fn(s));return}case"live":{pe(i,1,`${r.commandPrefix??"oo flow"} live <flow> [--json]`);let s=await ve(e,i[0]),a=await e.getLiveDetails(s.flowId);F(r,t.json,{kind:"flow.live",live:a,version:1},Hi(a));return}case"show":{pe(i,1,`${r.commandPrefix??"oo flow"} show <flow> [--json]`);let s=await ve(e,i[0]);F(r,t.json,{flow:s,kind:"flow.show",version:1},Fn(s));return}case"rename":{pe(i,2,`${r.commandPrefix??"oo flow"} rename <flow> <new-name> [--json]`);let s=await ve(e,i[0]),a=await e.renameFlow(s.flowId,Wi(i[1],"Flow"));F(r,t.json,{flow:a,kind:"flow.rename",version:1},Fn(a));return}case"delete":{if(pe(i,1,`${r.commandPrefix??"oo flow"} delete <flow> --yes [--json]`),!t.yes)throw new O("flow.confirmation-required","Flow deletion requires --yes.");let s=await ve(e,i[0]),a=await e.deleteFlow(s.flowId);F(r,t.json,{flow:a,kind:"flow.delete",version:1},Fn(a));return}case"enable":case"disable":{if(pe(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> --expected-publication <publicationId>`),t.expectedPublication==null||t.expectedPublication=="none")throw new O("cli.invalid-arguments","--expected-publication must identify the observed Live publication.");let s=await ve(e,i[0]),a=await e.setFlowEnabled(s.flowId,t.expectedPublication,o=="enable");F(r,t.json,{flow:a,kind:`flow.${o}`,version:1},Fn(a));return}case"check":{pe(i,1,`${r.commandPrefix??"oo flow"} check <flow> [--revision <revisionId>] [--json]`);let s=await ve(e,i[0]),a=t.revision??s.draftRevisionId,c=await e.checkAuthoring(s.flowId,a);return F(r,t.json,{check:c,valid:c.valid,revisionId:a,kind:"flow.check",scope:"revision",version:1},`${c.valid?"valid":"invalid"} revision ${s.name} ${s.flowId}`),c.valid?0:1}default:throw new O("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} <list|create|show|live|read|search|edit|canvas|schema|rename|delete|check|enable|disable|connector|event-source|trigger|run|runs|publish|publications|rollback|workbench>`)}}async function gC(e,n){let t=n[0];if(t==null)throw new O("cli.invalid-arguments","A Flow reference is required.");return await ve(e,t)}var qt={};var Mb=(e)=>e,Qi=Object.is,hC=(e,n)=>{if(Qi(e,n))return!0;if(!Array.isArray(e)||!Array.isArray(n))return!1;let t=e.length;if(n.length!==t)return!1;for(let r=0;r<t;r++)if(!Qi(e[r],n[r]))return!1;return!0},yC=(e)=>e.value,bC=(e)=>e.map(yC),wC=(e)=>e.$version,Yi=(e,n)=>{try{e(n)}catch(t){console.error(t)}},Fb=(e,n)=>(e.set=n,e);var vC=Promise.resolve(),wu=new Set,kC=new Set,Qr=wu,vu,xC=()=>{let e=Qr;Qr=Qr===wu?kC:wu,vu=!1;for(let n of e)n.t();e.clear()},SC=(e)=>{Qr.add(e),vu=vu||vC.then(xC)},IC=(e)=>Qr.delete(e);var Vb=new FinalizationRegistry(Yi),Zb=class{constructor(e,n,t){if(this.#r=e,this.q=(n?.equal??Qi)||void 0,this.e=n?.eager,this.m=n?.name,this.#n=n?.onDisposeValue,t){let r=new WeakRef(this),o=()=>{if(i){let s=i;i=void 0,s()}},i=t(()=>{let s=r.deref();if(s)s.n();else o()});if(i)Vb.register(this,this.#e=o)}}g=this;b=new Map;s=4;v;c=qt;q;e;m;u=()=>{if(this.s&4){this.s&=-5;let e=this.#r();if(this.c===qt)this.w(e);else if(!this.q?.(e,this.c)){if(this.w(e),this.s&1)this.s|=2}}return this.c};n=()=>{if(this.#o)console.error(this.c,Error(`${this.m||""} disposed`));if(this.s|=4,this.b.size){if(this.s|=1,this[3])this.#t(3);if(this[2]){if(this.u(),this.s&2)this.#t(2)}if(this[1])SC(this);else this.s&=-4}};a(e,n){let t=this.b.get(e);if(t)this[t]--;return this.b.set(e,n),this[n]++,()=>this.r(e)}r(e){if(e){let n=this.b.get(e);if(n)this.b.delete(e),this[n]--}else this.b.clear(),this[1]=this[2]=this[3]=0,IC(this)}t(){if(this[1]){if(this.u(),this.s&2)this.#t(1)}this.s&=-4}d(){let e=this.c;if(this.r(),Vb.unregister(this),this.#e?.(),this.#o=!0,this.#n&&e!==qt)this.#n(e)}w(e){this.w=this.q?.(e,e)?this.y:this.x,this.w(e)}x(e){let n=this.c;if(this.c=e,this.v=Symbol(),this.#n&&n!==qt&&n!==e)this.#n(n)}y(e){let n=this.c;if(this.c=this.v=e,this.#n&&n!==qt&&n!==e)this.#n(n)}[1]=0;[2]=0;[3]=0;#e;#n;#r;#t(e){for(let[n,t]of this.b)if(t===e)Yi(n,this.c)}#o},CC=class{#e=new WeakSet;constructor(e){this.g=e.g,this.e=e.e,this.u=e.u,this.n=e.n,this.b=e.b}get v(){return this.g.v}g;b;e;u;n;a(e,n){return this.#e.add(e),this.g.a(e,n)}r(e){if(e){if(this.#e.has(e))this.#e.delete(e),this.g.r(e)}else for(let n of this.g.b.keys())this.r(n)}d(){this.r()}},ku=class{#e;constructor(e){this.#e=e,this.get=e.u,e.u()}get name(){return this.#e.m}get $version(){return this.get(),this.#e.v}get value(){return this.get()}set value(e){this.set?.(e)}set;get;ref(e){let n=new ku(new CC(this.#e));return e&&this.set?Fb(n,this.set):n}reaction(e,n=this.#e.e){return this.#e.a(e,n?2:1)}subscribe(e,n=this.#e.e){let t=this.reaction(e,n);return Yi(e,this.get()),t}$valCompute(e){return this.#e.a(e,3)}unsubscribe(e){this.#e.r(e)}dispose(){this.#e.d()}toString(){return String(this.get())}toJSON(e){let n=this.get();return n&&n.toJSON?n.toJSON(e):n}},EC=(e,n)=>{let t=e,o=new Zb(()=>t,n),i=(a)=>{if(!o.q?.(a,t))t=a,o.n()};return[new ku(o),i]},xu=(e,n)=>Fb(...EC(e,n));var Jb=(e,n,t)=>new ku(new Zb(e,t,n)),Ub=(e,n=Mb,t)=>{let r,o;return Jb(()=>{let i=e.map(wC);if(!o||!hC(i,o))o=i,r=n(bC(e));return r},(i)=>{let s=e.map((a)=>a.$valCompute(i));return()=>s.forEach(Yi)},t)};var Su=(e,n=Mb,t)=>{let r,o=qt;return Jb(()=>{let i=e.$version;if(!Qi(i,o))o=i,r=n(e.value);return r},(i)=>e.$valCompute(i),t)};var Bb=(e,n={},t="")=>{for(let[r,o]of Object.entries(e))if(typeof o==="string")n[t+r]=o;else Bb(o,n,t+r+".");return n},OC=(e)=>{let n=[],t=[],r=/{{(\S+?)}}/gi,o,i=0;while(o=r.exec(e))n.push(e.slice(i,o.index),""),t.push(o[1]),i=o.index+o[0].length;if(n.push(e.slice(i)),t.length<=0)return!1;return(s)=>{for(let a=t.length-1;a>=0;a--)n[a*2+1]=s[t[a]]??t[a];return n.join("")}},Kb=class e{constructor(n,t,r){this.t=(i,s)=>this.t$.get()(i,s),this.fetcher=r?.fetcher;let o=new Map;this.locales$=xu(t),this.lang$=xu(n),this.locale$=Ub([this.lang$,this.locales$],([i,s])=>s[i]||{}),this.a=Su(this.locale$,Bb),this.t$=Su(this.a,(i)=>((s,a,c)=>{if(c){let l=c["@"];if(l!=null){let u=`${a}@${l}`;if(s[u])a=u}else{let u=c[":option"];if(u!=null){let d;a=s[d=`${a}.${u}`]||s[d=`${a}.other`]?d:a}}if(s[a]){let u=o.get(a);if(u??o.set(a,u=OC(s[a])),u)return u(c)}}return s[a]||a}).bind(o.clear(),i))}static async preload(n,t){return new e(n,{[n]:await t(n)},{fetcher:t})}get lang(){return this.lang$.value}get locales(){return this.locales$.value}get locale(){return this.locale$.value}async switchLang(n){if(!this.locales$.value[n]&&this.fetcher)this.addLocale(n,await this.fetcher(n));this.lang$.set(n)}hasKey(n){return!!this.a.value[n]}addLocale(n,t){this.locales$.set({...this.locales,[n]:t})}dispose(){this.lang$.dispose(),this.t$.dispose(),this.locales$.dispose(),this.locale$.dispose(),this.a.dispose()}};var Wb={help:{usage:"Usage: {{command}}",title:"Open Flow commands",options:"Options: --json, --cursor <cursor>, --limit <count>"}};var Gb={help:{usage:"Utilisation : {{command}}",title:"Commandes Open Flow",options:"Options : --json, --cursor <cursor>, --limit <count>"}};var Hb={help:{usage:"\u4F7F\u3044\u65B9\uFF1A{{command}}",title:"Open Flow \u30B3\u30DE\u30F3\u30C9",options:"\u30AA\u30D7\u30B7\u30E7\u30F3\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var Qb={help:{usage:"\uC0AC\uC6A9\uBC95: {{command}}",title:"Open Flow \uBA85\uB839\uC5B4",options:"\uC635\uC158: --json, --cursor <cursor>, --limit <count>"}};var Yb={help:{usage:"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435: {{command}}",title:"\u041A\u043E\u043C\u0430\u043D\u0434\u044B Open Flow",options:"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B: --json, --cursor <cursor>, --limit <count>"}};var Xb={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9009\u9879\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var ew={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9078\u9805\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var NC={en:Wb,"zh-CN":Xb,"zh-TW":ew,ja:Hb,ko:Qb,ru:Yb,fr:Gb},zC=Object.fromEntries(is.map((e)=>[e,NC[e]]));function nw(e=Ru){return new Kb(to([e]),zC)}function DC(e,n){let t=n.filter((i)=>!i.startsWith("-")),r=yu(t,e.commandPrefix);while(r.length==0&&t.length>0)t.pop(),r=yu(t,e.commandPrefix);let o=nw(e.language);try{let i=r.length==1?bu(r[0].command):void 0,s=Ab(r.length==1?r[0].command:"",e.commandPrefix),a={kind:"cli.help",version:1,commands:r.length==1?r:r.map(({command:c,usage:l})=>({command:c,usage:l})),...i==null?{}:{request:i.request},examples:s,exitCodes:{0:"Success or accepted asynchronous operation.",1:"Error or unsuccessful terminal Run.",2:"Run is waiting for an explicit action; inspect run.waits.",3:"Waiting timed out or publication is pending; the operation continues."},notes:i==null?[...e.scopeGuidance??["The oo host selects the team for the whole invocation with --team <name>; Flow commands use that authenticated scope."],"--timeout is a wait budget in milliseconds (default 60000).","--follow --json writes NDJSON pages immediately; resume from nextAfter.","Use read/search to locate nodes, schema read|search|edit|check for requests, and schema <type> for configuration and ports.","Use edit with baseRevision, requestId and an ordered edits array. Read selected text before an exact text.edit.","Retry mutations with the same idempotency key, fixed revision/publication and identical arguments."]:[i.guidance,...r[0].command=="check"?[]:["Use either --input (literal JSON, @file, or - for stdin) or --file (path or -), never both."]]};return n.includes("--json")?JSON.stringify(a):[o.t("help.title"),"",...r.map((c)=>r.length!=1?c.usage:`${c.usage}
80
80
  Options: ${c.options.map((l)=>l.name+(l.value?" <value>":"")+(l.description==null?"":`: ${l.description}`)).join(`
81
81
  `)}`),"",o.t("help.options"),"",...a.notes,"",...s].join(`
82
- `)}finally{o.dispose()}}function kC(e){return e.length==0||e.includes("--help")||e.includes("-h")}function SC(e){return e.positionals[0]=="schema"&&e.flow==null}async function Bb(e,n,t){let r,o;try{if(kC(e))return t.stdout.write(`${xC(t,e)}
83
- `),0;r=cb(e);let i=wb(r.positionals);if(i==null)throw new E("cli.invalid-arguments",`Unknown command. Use ${t.commandPrefix??"oo flow"} --help.`);for(let a of r.options)if(a!="json"&&!i.includes(a))throw new E("cli.invalid-arguments",`Option --${a} is not supported by this command.`);if(r.options.includes("idempotency-key")){let a=r.positionals[0]=="run"&&r.source=="live";if(i.includes("expected-revision")&&!a&&r.expectedRevision==null)throw new E("cli.invalid-arguments","An explicit idempotency key requires --expected-revision for a repeatable mutation.");if((a||r.positionals[0]=="publish"||r.positionals[0]=="rollback")&&r.expectedPublication==null)throw new E("cli.invalid-arguments","An explicit idempotency key requires --expected-publication (use none for the first publication).")}if(r.timeoutMs!=null&&r.positionals[0]=="run"&&!r.wait)throw new E("cli.invalid-arguments","--timeout requires --wait for run.");if(r.timeoutMs!=null&&r.positionals[0]=="runs"&&r.positionals[1]=="events"&&!r.follow)throw new E("cli.invalid-arguments","--timeout requires --follow for events.");if(r.positionals[0]=="run"&&(r.source=="live"&&r.expectedRevision!=null||r.source=="draft"&&r.expectedPublication!=null))throw new E("cli.invalid-arguments","Use --expected-revision for draft runs and --expected-publication for live runs.");if(SC(r)){if(r.positionals.length>2)throw new E("cli.invalid-arguments",`Usage: ${t.commandPrefix??"oo flow"} schema [read|search|edit|check|edits|node-type|input|outputs]`);let a=vb(r.positionals[1]);if(a==null)throw new E("cli.invalid-arguments","Unknown schema. Use read, search, edit, check, or a node type such as agent or code.");return t.stdout.write(`${JSON.stringify(a)}
84
- `),0}let s=new eu(async(a,c)=>{let l=new Headers(c?.headers).get("idempotency-key");return o=l==null?void 0:{path:a,idempotencyKey:l,...typeof c?.body=="string"?{request:JSON.parse(c.body)}:{}},await n.request(a,c)},"cli");if(r.positionals[0]=="schema"&&r.flow!=null){let a=r.input==null?{type:r.positionals[1]}:JSON.parse(await Cn(r.input,"input","flow.authoring-unreadable",t)),c=await ve(s,r.flow);return t.stdout.write(`${JSON.stringify(await s.authoringSchema(c.flowId,a))}
85
- `),0}return await jb(s,n,r,t)??0}catch(i){let s;if(i instanceof E)s=i;else if(i instanceof Pe)s=ab(i);else s=new E("flow.unexpected",i instanceof Error?i.message:String(i));if(o!=null&&(!(i instanceof Pe)&&!(i instanceof E)||i instanceof Pe&&i.code=="response.invalid"))s=new E("flow.mutation-outcome-unknown","The mutation outcome is unknown. Retry the exact request with the same idempotency key.",o);if(e.includes("--json"))t.stderr.write(`${JSON.stringify({error:{code:s.code,...s.details==null?{}:{details:s.details},message:s.message},version:1})}
82
+ `)}finally{o.dispose()}}function qC(e){return e.length==0||e.includes("--help")||e.includes("-h")}function LC(e){return e.positionals[0]=="schema"&&e.flow==null}async function tw(e,n,t){let r,o;try{if(qC(e))return t.stdout.write(`${DC(t,e)}
83
+ `),0;r=bb(e);let i=_b(r.positionals);if(i==null)throw new O("cli.invalid-arguments",`Unknown command. Use ${t.commandPrefix??"oo flow"} --help.`);for(let a of r.options)if(a!="json"&&!i.includes(a))throw new O("cli.invalid-arguments",`Option --${a} is not supported by this command.`);if(r.options.includes("idempotency-key")){let a=r.positionals[0]=="run"&&r.source=="live";if(i.includes("expected-revision")&&!a&&r.expectedRevision==null)throw new O("cli.invalid-arguments","An explicit idempotency key requires --expected-revision for a repeatable mutation.");if((a||r.positionals[0]=="publish"||r.positionals[0]=="rollback")&&r.expectedPublication==null)throw new O("cli.invalid-arguments","An explicit idempotency key requires --expected-publication (use none for the first publication).")}if(r.timeoutMs!=null&&r.positionals[0]=="run"&&!r.wait)throw new O("cli.invalid-arguments","--timeout requires --wait for run.");if(r.timeoutMs!=null&&r.positionals[0]=="runs"&&r.positionals[1]=="events"&&!r.follow)throw new O("cli.invalid-arguments","--timeout requires --follow for events.");if(r.positionals[0]=="run"&&(r.source=="live"&&r.expectedRevision!=null||r.source=="draft"&&r.expectedPublication!=null))throw new O("cli.invalid-arguments","Use --expected-revision for draft runs and --expected-publication for live runs.");if(LC(r)){if(r.positionals.length>2)throw new O("cli.invalid-arguments",`Usage: ${t.commandPrefix??"oo flow"} schema [read|search|edit|check|edits|node-type|input|outputs]`);let a=Rb(r.positionals[1]);if(a==null)throw new O("cli.invalid-arguments","Unknown schema. Use read, search, edit, check, or a node type such as agent or code.");return t.stdout.write(`${JSON.stringify(a)}
84
+ `),0}let s=new iu(async(a,c)=>{let l=new Headers(c?.headers).get("idempotency-key");return o=l==null?void 0:{path:a,idempotencyKey:l,...typeof c?.body=="string"?{request:JSON.parse(c.body)}:{}},await n.request(a,c)},"cli");if(r.positionals[0]=="schema"&&r.flow!=null){let a=r.input==null?{type:r.positionals[1]}:JSON.parse(await Cn(r.input,"input","flow.authoring-unreadable",t)),c=await ve(s,r.flow);return t.stdout.write(`${JSON.stringify(await s.authoringSchema(c.flowId,a))}
85
+ `),0}return await Lb(s,n,r,t)??0}catch(i){let s;if(i instanceof O)s=i;else if(i instanceof Pe)s=yb(i);else s=new O("flow.unexpected",i instanceof Error?i.message:String(i));if(o!=null&&(!(i instanceof Pe)&&!(i instanceof O)||i instanceof Pe&&i.code=="response.invalid"))s=new O("flow.mutation-outcome-unknown","The mutation outcome is unknown. Retry the exact request with the same idempotency key.",o);if(e.includes("--json"))t.stderr.write(`${JSON.stringify({error:{code:s.code,...s.details==null?{}:{details:s.details},message:s.message},version:1})}
86
86
  `);else t.stderr.write(`${s.code}: ${s.message}
87
- `);return 1}}async function EC(e){let n=process.platform=="darwin"?["open",e]:process.platform=="win32"?["rundll32","url.dll,FileProtocolHandler",e]:["xdg-open",e],t=IC(n[0],n.slice(1),{stdio:"ignore"});if(await new Promise((o,i)=>{t.once("error",i),t.once("exit",o)})!=0)throw Error("The system browser could not be opened.")}async function Kb(e,n,t){if(e.includes("--version")||e.includes("-v"))return process.stdout.write(e.includes("--json")?`${JSON.stringify({version:t.version})}
87
+ `);return 1}}async function ZC(e){let n=process.platform=="darwin"?["open",e]:process.platform=="win32"?["rundll32","url.dll,FileProtocolHandler",e]:["xdg-open",e],t=VC(n[0],n.slice(1),{stdio:"ignore"});if(await new Promise((o,i)=>{t.once("error",i),t.once("exit",o)})!=0)throw Error("The system browser could not be opened.")}async function rw(e,n,t){if(e.includes("--version")||e.includes("-v"))return process.stdout.write(e.includes("--json")?`${JSON.stringify({version:t.version})}
88
88
  `:`${t.version}
89
- `),0;return await Bb(e,{request:n.cloudRequest??(async()=>{throw new E("host.unavailable","Open Flow Control API is not configured in this CLI host.")}),getWorkbenchUrl:n.getWorkbenchUrl},{commandPrefix:t.commandPrefix,scopeGuidance:t.scopeGuidance,env:process.env,language:to([n.language]),openUrl:EC,readFile:async(r)=>await CC(r,"utf8"),readStdin:async()=>{let r="";for await(let o of process.stdin)r+=String(o);return r},stderr:process.stderr,stdout:process.stdout,wait:async(r)=>await OC(r)})}async function w1(e,n={}){return await Kb(e,n,{version:Iu})}export{w1 as runOpenFlowCommand};
89
+ `),0;return await tw(e,{request:n.cloudRequest??(async()=>{throw new O("host.unavailable","Open Flow Control API is not configured in this CLI host.")}),getWorkbenchUrl:n.getWorkbenchUrl},{commandPrefix:t.commandPrefix,scopeGuidance:t.scopeGuidance,env:process.env,language:to([n.language]),openUrl:ZC,readFile:async(r)=>await MC(r,"utf8"),readStdin:async()=>{let r="";for await(let o of process.stdin)r+=String(o);return r},stderr:process.stderr,stdout:process.stdout,wait:async(r)=>await FC(r)})}async function W1(e,n={}){return await rw(e,n,{version:_u})}export{W1 as runOpenFlowCommand};