eve 0.67.2 → 0.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1116) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/bin/eve.js +15 -0
  3. package/dist/src/_virtual/_rolldown/runtime.js +1 -1
  4. package/dist/src/approval/definition.d.ts +19 -5
  5. package/dist/src/channel/adapter.d.ts +2 -0
  6. package/dist/src/channel/auth/oidc.js +1 -1
  7. package/dist/src/channel/channel-address.d.ts +1 -4
  8. package/dist/src/channel/channel-address.js +1 -1
  9. package/dist/src/channel/channel-operations.d.ts +4 -11
  10. package/dist/src/channel/channel-operations.js +1 -1
  11. package/dist/src/channel/compiled-channel.d.ts +0 -2
  12. package/dist/src/channel/compiled-channel.js +2 -2
  13. package/dist/src/channel/cross-channel-receive.d.ts +1 -3
  14. package/dist/src/channel/cross-channel-receive.js +1 -1
  15. package/dist/src/channel/forwarded-principal.js +1 -1
  16. package/dist/src/channel/schedule-auth.d.ts +16 -0
  17. package/dist/src/channel/schedule-auth.js +1 -1
  18. package/dist/src/channel/session-callback.js +1 -1
  19. package/dist/src/channel/session.d.ts +3 -8
  20. package/dist/src/channel/session.js +1 -1
  21. package/dist/src/channel/task-card.d.ts +121 -0
  22. package/dist/src/channel/task-card.js +1 -0
  23. package/dist/src/channel/types.d.ts +12 -54
  24. package/dist/src/chunks/{use-eve-agent-DXcE_8Ja.js → use-eve-agent-D_5129A9.js} +295 -205
  25. package/dist/src/chunks/{use-eve-agent-D4HVZBjn.js → use-eve-agent-Dab2MnT2.js} +295 -205
  26. package/dist/src/cli/commands/info.d.ts +11 -0
  27. package/dist/src/cli/commands/info.js +1 -1
  28. package/dist/src/cli/commands/init-agent-workspace.js +1 -1
  29. package/dist/src/cli/commands/init.js +1 -1
  30. package/dist/src/cli/dev/command-options.d.ts +3 -2
  31. package/dist/src/cli/dev/command.js +1 -1
  32. package/dist/src/cli/dev/local-server-process.js +1 -1
  33. package/dist/src/cli/dev/tui/blocks.d.ts +19 -18
  34. package/dist/src/cli/dev/tui/blocks.js +3 -3
  35. package/dist/src/cli/dev/tui/command-typeahead.d.ts +3 -6
  36. package/dist/src/cli/dev/tui/diagnostic-presentation.d.ts +10 -0
  37. package/dist/src/cli/dev/tui/diagnostic-presentation.js +3 -2
  38. package/dist/src/cli/dev/tui/prompt-placeholder.d.ts +2 -0
  39. package/dist/src/cli/dev/tui/prompt-placeholder.js +1 -0
  40. package/dist/src/cli/dev/tui/rail.d.ts +1 -1
  41. package/dist/src/cli/dev/tui/runner.d.ts +25 -2
  42. package/dist/src/cli/dev/tui/runner.js +3 -3
  43. package/dist/src/cli/dev/tui/status-line.d.ts +4 -2
  44. package/dist/src/cli/dev/tui/status-line.js +1 -1
  45. package/dist/src/cli/dev/tui/subagent-pump.d.ts +44 -52
  46. package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
  47. package/dist/src/cli/dev/tui/task-activity.d.ts +55 -0
  48. package/dist/src/cli/dev/tui/task-activity.js +1 -0
  49. package/dist/src/cli/dev/tui/terminal-renderer.d.ts +13 -30
  50. package/dist/src/cli/dev/tui/terminal-renderer.js +11 -11
  51. package/dist/src/cli/dev/tui/theme.d.ts +1 -1
  52. package/dist/src/cli/dev/tui/theme.js +1 -1
  53. package/dist/src/cli/dev/tui/tool-block-groups.d.ts +6 -9
  54. package/dist/src/cli/dev/tui/tool-block-groups.js +1 -1
  55. package/dist/src/cli/dev/tui/tool-presentation.d.ts +16 -3
  56. package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
  57. package/dist/src/cli/dev/tui/traces/trace-conversation.js +3 -1
  58. package/dist/src/cli/dev/tui/traces/trace-view.js +1 -1
  59. package/dist/src/cli/dev/tui/tui.js +1 -1
  60. package/dist/src/cli/dev/tui/types.d.ts +11 -5
  61. package/dist/src/cli/dev/ui-options.d.ts +2 -2
  62. package/dist/src/cli/option-parsers.d.ts +3 -1
  63. package/dist/src/cli/option-parsers.js +1 -1
  64. package/dist/src/cli/ui/terminal-text.js +1 -1
  65. package/dist/src/client/agent-info-schema.d.ts +150 -9
  66. package/dist/src/client/agent-info-schema.js +1 -1
  67. package/dist/src/client/agent-session.d.ts +28 -0
  68. package/dist/src/client/agent-session.js +1 -0
  69. package/dist/src/client/eve-agent-store-helpers.d.ts +1 -1
  70. package/dist/src/client/eve-agent-store-helpers.js +2 -2
  71. package/dist/src/client/eve-agent-store.js +1 -1
  72. package/dist/src/client/index.d.ts +2 -1
  73. package/dist/src/client/index.js +1 -1
  74. package/dist/src/client/message-action-parts.js +1 -1
  75. package/dist/src/client/message-reducer.js +1 -1
  76. package/dist/src/client/message-task-parts.d.ts +8 -0
  77. package/dist/src/client/message-task-parts.js +1 -0
  78. package/dist/src/client/optimistic-message-submissions.js +1 -1
  79. package/dist/src/client/session-controls.d.ts +0 -1
  80. package/dist/src/client/session-utils.d.ts +10 -0
  81. package/dist/src/client/session-utils.js +1 -1
  82. package/dist/src/client/session.d.ts +8 -16
  83. package/dist/src/client/session.js +1 -1
  84. package/dist/src/client/stream-version.js +1 -1
  85. package/dist/src/client/types.d.ts +2 -4
  86. package/dist/src/compiled/.vendor-stamp.json +3 -2
  87. package/dist/src/compiled/@eve/catalog/index.js +1 -1
  88. package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +55 -55
  89. package/dist/src/compiled/@vercel/blob/index.js +1 -1
  90. package/dist/src/compiled/@vercel/connect/LICENSE +202 -0
  91. package/dist/src/compiled/@vercel/connect/authorization-details.d.ts +11 -0
  92. package/dist/src/compiled/@vercel/connect/authorization.d.ts +47 -0
  93. package/dist/src/compiled/@vercel/connect/connector.d.ts +32 -0
  94. package/dist/src/compiled/@vercel/connect/index.d.ts +5 -0
  95. package/dist/src/compiled/@vercel/connect/index.js +26 -0
  96. package/dist/src/compiled/@vercel/connect/installation.d.ts +48 -0
  97. package/dist/src/compiled/@vercel/connect/token.d.ts +137 -0
  98. package/dist/src/compiled/@vercel/oidc/index.js +1 -1
  99. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  100. package/dist/src/compiled/@workflow/world-vercel/index.js +1 -1
  101. package/dist/src/compiler/bundled-extension.d.ts +7 -1
  102. package/dist/src/compiler/bundled-extension.js +1 -1
  103. package/dist/src/compiler/default-tool-policy.d.ts +2 -2
  104. package/dist/src/compiler/default-tool-policy.js +1 -1
  105. package/dist/src/compiler/development-extensions.js +1 -1
  106. package/dist/src/compiler/extension-compatibility.d.ts +54 -18
  107. package/dist/src/compiler/extension-compatibility.js +1 -1
  108. package/dist/src/compiler/extension-mount-bindings.d.ts +5 -0
  109. package/dist/src/compiler/extension-mount-bindings.js +1 -0
  110. package/dist/src/compiler/load-binding-namespace.d.ts +10 -2
  111. package/dist/src/compiler/load-binding-namespace.js +1 -1
  112. package/dist/src/compiler/manifest.d.ts +19 -17
  113. package/dist/src/compiler/manifest.js +1 -1
  114. package/dist/src/compiler/module-lifecycle.d.ts +2 -2
  115. package/dist/src/compiler/module-lifecycle.js +1 -1
  116. package/dist/src/compiler/module-map.d.ts +1 -1
  117. package/dist/src/compiler/module-map.js +3 -3
  118. package/dist/src/compiler/normalize-manifest-helpers.d.ts +18 -1
  119. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  120. package/dist/src/compiler/normalize-manifest-types.d.ts +2 -0
  121. package/dist/src/compiler/normalize-manifest.js +1 -1
  122. package/dist/src/compiler/normalize-subagent.js +1 -1
  123. package/dist/src/compiler/normalize-tool.js +1 -1
  124. package/dist/src/compiler/project-sources.d.ts +4 -0
  125. package/dist/src/compiler/project-sources.js +1 -1
  126. package/dist/src/compiler/remote-agent-node.js +1 -1
  127. package/dist/src/compiler/source-graph.d.ts +5 -0
  128. package/dist/src/compiler/source-graph.js +1 -1
  129. package/dist/src/computer-use/extension/extension.d.ts +2 -0
  130. package/dist/src/computer-use/extension/extension.js +1 -0
  131. package/dist/src/computer-use/extension/lib/command-failure.d.ts +7 -0
  132. package/dist/src/computer-use/extension/lib/command-failure.js +2 -0
  133. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-sandbox.d.ts +8 -0
  134. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-sandbox.js +3 -3
  135. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use.d.ts +2 -0
  136. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use.js +2 -1
  137. package/dist/src/computer-use/extension/lib/sandbox.d.ts +1 -0
  138. package/dist/src/computer-use/extension/lib/sandbox.js +1 -0
  139. package/dist/src/computer-use/extension/lib/shell.d.ts +1 -0
  140. package/dist/src/computer-use/extension/lib/shell.js +1 -0
  141. package/dist/src/computer-use/extension/tools/computer_use.js +1 -0
  142. package/dist/src/computer-use/tools.d.ts +1 -0
  143. package/dist/src/computer-use/tools.js +1 -0
  144. package/dist/src/context/build-dynamic-tools.js +1 -1
  145. package/dist/src/context/dynamic-subagent-lifecycle.d.ts +5 -0
  146. package/dist/src/context/dynamic-subagent-lifecycle.js +1 -1
  147. package/dist/src/context/dynamic-tool-lifecycle.d.ts +1 -1
  148. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  149. package/dist/src/context/dynamic-tool-metadata.d.ts +1 -1
  150. package/dist/src/context/hook-lifecycle.d.ts +4 -3
  151. package/dist/src/context/hook-lifecycle.js +1 -1
  152. package/dist/src/context/key-names.d.ts +0 -1
  153. package/dist/src/context/key-names.js +1 -1
  154. package/dist/src/context/keys.d.ts +8 -14
  155. package/dist/src/context/keys.js +1 -1
  156. package/dist/src/context/memory-lifecycle.js +1 -1
  157. package/dist/src/context/memory-tools.d.ts +0 -1
  158. package/dist/src/context/provider.d.ts +1 -3
  159. package/dist/src/context/run-step.d.ts +2 -3
  160. package/dist/src/context/run-step.js +1 -1
  161. package/dist/src/context/serialize.js +1 -1
  162. package/dist/src/discover/bundled-extension.js +1 -1
  163. package/dist/src/discover/discover-agent.js +1 -1
  164. package/dist/src/discover/extensions.d.ts +0 -7
  165. package/dist/src/discover/extensions.js +1 -1
  166. package/dist/src/discover/manifest.d.ts +4 -0
  167. package/dist/src/evals/assertions/run.d.ts +4 -3
  168. package/dist/src/evals/assertions/run.js +1 -1
  169. package/dist/src/evals/index.d.ts +1 -1
  170. package/dist/src/evals/match.d.ts +4 -4
  171. package/dist/src/evals/mock-model.js +1 -1
  172. package/dist/src/evals/runner/derive-run-facts.d.ts +3 -3
  173. package/dist/src/evals/runner/derive-run-facts.js +1 -1
  174. package/dist/src/evals/runner/reporters/assertion-scores.d.ts +19 -0
  175. package/dist/src/evals/runner/reporters/assertion-scores.js +1 -0
  176. package/dist/src/evals/runner/reporters/braintrust.js +1 -1
  177. package/dist/src/evals/runner/reporters/datadog-client.d.ts +123 -0
  178. package/dist/src/evals/runner/reporters/datadog-client.js +4 -0
  179. package/dist/src/evals/runner/reporters/datadog.d.ts +9 -98
  180. package/dist/src/evals/runner/reporters/datadog.js +2 -3
  181. package/dist/src/evals/session-content.js +1 -1
  182. package/dist/src/evals/session.d.ts +4 -4
  183. package/dist/src/evals/session.js +2 -2
  184. package/dist/src/evals/types.d.ts +18 -15
  185. package/dist/src/eve-channel/create-request.d.ts +5 -4
  186. package/dist/src/eve-channel/create-request.js +1 -1
  187. package/dist/src/eve-channel/index.d.ts +0 -9
  188. package/dist/src/eve-channel/index.js +1 -1
  189. package/dist/src/eve-channel/request.d.ts +3 -7
  190. package/dist/src/eve-channel/request.js +1 -1
  191. package/dist/src/eve-channel/support.d.ts +15 -5
  192. package/dist/src/eve-channel/support.js +1 -1
  193. package/dist/src/eve-channel/turn-policy-request.d.ts +2 -0
  194. package/dist/src/eve-channel/turn-policy-request.js +1 -0
  195. package/dist/src/eve-channel/types.d.ts +4 -0
  196. package/dist/src/execution/agent-sessions/context.d.ts +60 -0
  197. package/dist/src/execution/agent-sessions/context.js +1 -0
  198. package/dist/src/{subagents/remote-dispatch.d.ts → execution/agent-sessions/remote.d.ts} +17 -40
  199. package/dist/src/execution/agent-sessions/remote.js +1 -0
  200. package/dist/src/execution/agent-sessions/requests.d.ts +20 -0
  201. package/dist/src/execution/agent-sessions/requests.js +1 -0
  202. package/dist/src/execution/agent-sessions/session.d.ts +12 -0
  203. package/dist/src/execution/agent-sessions/session.js +1 -0
  204. package/dist/src/execution/agent-sessions/steps.d.ts +59 -0
  205. package/dist/src/execution/agent-sessions/steps.js +1 -0
  206. package/dist/src/execution/agent-sessions/target.d.ts +45 -0
  207. package/dist/src/execution/agent-sessions/target.js +1 -0
  208. package/dist/src/execution/agent-sessions/usage.d.ts +18 -0
  209. package/dist/src/execution/agent-sessions/usage.js +1 -0
  210. package/dist/src/execution/authorization-callback-match.d.ts +2 -4
  211. package/dist/src/execution/authorization-callback-match.js +1 -1
  212. package/dist/src/execution/cancel-descendant-turns-step.d.ts +1 -5
  213. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  214. package/dist/src/execution/cancelled-model-call-batch.js +1 -1
  215. package/dist/src/execution/connection-announcement.d.ts +7 -0
  216. package/dist/src/execution/connection-announcement.js +4 -0
  217. package/dist/src/execution/continuation-conflict-step.d.ts +2 -3
  218. package/dist/src/execution/continuation-conflict-step.js +1 -1
  219. package/dist/src/execution/coordination-dispatch-shared.d.ts +9 -27
  220. package/dist/src/execution/coordination-dispatch-shared.js +1 -1
  221. package/dist/src/execution/coordination-dispatch-step.d.ts +3 -2
  222. package/dist/src/execution/coordination-dispatch-step.js +1 -1
  223. package/dist/src/execution/create-session-step.d.ts +0 -1
  224. package/dist/src/execution/create-session-step.js +1 -1
  225. package/dist/src/execution/deliver-payloads.js +1 -1
  226. package/dist/src/execution/durable-session-store.d.ts +0 -1
  227. package/dist/src/execution/dynamic-connections.js +1 -1
  228. package/dist/src/execution/dynamic-workflow/program-step.js +1 -1
  229. package/dist/src/execution/dynamic-workflow/schema.d.ts +1 -3
  230. package/dist/src/execution/dynamic-workflow/schema.js +1 -1
  231. package/dist/src/execution/dynamic-workflow/tool.d.ts +1 -1
  232. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  233. package/dist/src/execution/dynamic-workflow/workflow.js +1 -1
  234. package/dist/src/execution/forward-session-input.d.ts +4 -0
  235. package/dist/src/execution/forward-session-input.js +1 -0
  236. package/dist/src/execution/legacy-remote-agent/protocol.d.ts +41 -0
  237. package/dist/src/execution/legacy-remote-agent/protocol.js +1 -0
  238. package/dist/src/execution/legacy-session/authorization.js +1 -1
  239. package/dist/src/execution/legacy-session/completion-step.js +1 -1
  240. package/dist/src/execution/legacy-session/inbox.js +1 -1
  241. package/dist/src/execution/legacy-session/input.js +1 -1
  242. package/dist/src/execution/legacy-session/interrupt-step.js +1 -1
  243. package/dist/src/execution/model-call-batching.js +1 -1
  244. package/dist/src/execution/node-step.d.ts +1 -1
  245. package/dist/src/execution/node-step.js +1 -1
  246. package/dist/src/execution/proxied-deliver-step.d.ts +9 -6
  247. package/dist/src/execution/proxied-deliver-step.js +1 -1
  248. package/dist/src/execution/publish-session-events.d.ts +130 -0
  249. package/dist/src/execution/publish-session-events.js +1 -0
  250. package/dist/src/execution/route-child-delivery.d.ts +5 -4
  251. package/dist/src/execution/route-child-delivery.js +1 -3
  252. package/dist/src/execution/runtime-context.js +1 -1
  253. package/dist/src/execution/sandbox/prewarm.js +1 -1
  254. package/dist/src/execution/session/admission.d.ts +1 -12
  255. package/dist/src/execution/session/admission.js +1 -1
  256. package/dist/src/execution/session/entry-input.d.ts +0 -2
  257. package/dist/src/execution/session/entry.js +1 -1
  258. package/dist/src/execution/session/finalization.js +1 -1
  259. package/dist/src/execution/session/handoff-steps.d.ts +13 -2
  260. package/dist/src/execution/session/handoff-steps.js +1 -1
  261. package/dist/src/execution/session/handoff.d.ts +17 -3
  262. package/dist/src/execution/session/handoff.js +1 -1
  263. package/dist/src/execution/session/input-queue.d.ts +27 -28
  264. package/dist/src/execution/session/input-queue.js +1 -1
  265. package/dist/src/execution/session/next-input.d.ts +5 -0
  266. package/dist/src/execution/session/next-input.js +1 -1
  267. package/dist/src/execution/session/pending-turn-state.d.ts +2 -0
  268. package/dist/src/execution/session/pending-turn-state.js +1 -1
  269. package/dist/src/execution/session/principal.d.ts +14 -0
  270. package/dist/src/execution/session/principal.js +1 -0
  271. package/dist/src/execution/session/program.js +1 -1
  272. package/dist/src/execution/session/route-selected-delivery.js +1 -1
  273. package/dist/src/execution/session/state-cursor.d.ts +17 -15
  274. package/dist/src/execution/session/state-cursor.js +1 -1
  275. package/dist/src/execution/session/state-delta.d.ts +33 -0
  276. package/dist/src/execution/session/state-delta.js +1 -0
  277. package/dist/src/execution/session/timeout-steps.js +1 -1
  278. package/dist/src/execution/session/turn-event-handler.d.ts +27 -0
  279. package/dist/src/execution/session/turn-event-handler.js +1 -0
  280. package/dist/src/execution/session/turn-step-result.d.ts +1 -3
  281. package/dist/src/execution/session/turn-step-result.js +1 -1
  282. package/dist/src/execution/session/turn-step-types.d.ts +24 -15
  283. package/dist/src/execution/session/turn-step.d.ts +2 -2
  284. package/dist/src/execution/session/turn-step.js +1 -1
  285. package/dist/src/execution/session/turn-waiting-step.d.ts +4 -0
  286. package/dist/src/execution/session/turn-waiting-step.js +1 -0
  287. package/dist/src/execution/session/turn.d.ts +33 -2
  288. package/dist/src/execution/session/turn.js +1 -1
  289. package/dist/src/execution/session-callback-request.js +1 -1
  290. package/dist/src/execution/session-event-stream.d.ts +33 -0
  291. package/dist/src/execution/session-event-stream.js +1 -0
  292. package/dist/src/execution/session-inbox/inbox.d.ts +2 -0
  293. package/dist/src/execution/session-inbox/inbox.js +1 -1
  294. package/dist/src/execution/session-inbox/protocol.js +1 -1
  295. package/dist/src/execution/session-inbox/release-step.js +1 -1
  296. package/dist/src/execution/session-inbox/resume.js +1 -1
  297. package/dist/src/execution/session-workflow-tool-run.d.ts +11 -2
  298. package/dist/src/execution/session-workflow-tool-run.js +1 -1
  299. package/dist/src/execution/session.d.ts +0 -1
  300. package/dist/src/execution/session.js +2 -2
  301. package/dist/src/execution/settle-cancelled-turn-step.d.ts +21 -9
  302. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  303. package/dist/src/execution/stable-workflow-names.d.ts +0 -1
  304. package/dist/src/execution/stable-workflow-names.js +1 -1
  305. package/dist/src/execution/tasks/calls.d.ts +42 -0
  306. package/dist/src/execution/tasks/calls.js +1 -0
  307. package/dist/src/execution/tasks/model-step.d.ts +58 -0
  308. package/dist/src/execution/tasks/model-step.js +1 -0
  309. package/dist/src/execution/tasks/render.d.ts +66 -0
  310. package/dist/src/execution/tasks/render.js +8 -0
  311. package/dist/src/execution/tasks/session.d.ts +19 -0
  312. package/dist/src/execution/tasks/session.js +1 -0
  313. package/dist/src/execution/tasks/start.d.ts +34 -0
  314. package/dist/src/execution/tasks/start.js +1 -0
  315. package/dist/src/execution/tasks/steps.d.ts +31 -0
  316. package/dist/src/execution/tasks/steps.js +1 -0
  317. package/dist/src/execution/tasks/table.d.ts +192 -0
  318. package/dist/src/execution/tasks/table.js +1 -0
  319. package/dist/src/execution/tasks/task-id-input.d.ts +19 -0
  320. package/dist/src/execution/tasks/task-id-input.js +1 -0
  321. package/dist/src/execution/tasks/tool-entry-point.d.ts +11 -0
  322. package/dist/src/execution/tasks/tool-entry-point.js +1 -0
  323. package/dist/src/execution/tasks/workflow-target.d.ts +2 -0
  324. package/dist/src/execution/tasks/workflow-target.js +1 -1
  325. package/dist/src/execution/terminal-session-completion-step.js +1 -1
  326. package/dist/src/execution/terminal-session-failure-step.js +1 -1
  327. package/dist/src/execution/terminate-child-sessions-step.d.ts +2 -9
  328. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  329. package/dist/src/execution/tool-auth.js +1 -1
  330. package/dist/src/execution/tools/agent-router-workflow.d.ts +1 -1
  331. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  332. package/dist/src/execution/tools/agent-router.d.ts +1 -1
  333. package/dist/src/execution/tools/agent-router.js +1 -1
  334. package/dist/src/execution/tools/connection-approval.d.ts +25 -0
  335. package/dist/src/execution/tools/connection-approval.js +1 -0
  336. package/dist/src/execution/tools/connection-search-rank.d.ts +21 -0
  337. package/dist/src/execution/tools/connection-search-rank.js +1 -0
  338. package/dist/src/execution/tools/connection-target.d.ts +13 -0
  339. package/dist/src/execution/tools/connection-target.js +1 -0
  340. package/dist/src/execution/tools/connection-tools.d.ts +10 -0
  341. package/dist/src/execution/tools/connection-tools.js +2 -0
  342. package/dist/src/execution/tools/load-skill.js +1 -1
  343. package/dist/src/execution/tools/workflow/answer.d.ts +10 -4
  344. package/dist/src/execution/tools/workflow/answer.js +1 -1
  345. package/dist/src/execution/tools/workflow/ask.d.ts +73 -10
  346. package/dist/src/execution/tools/workflow/ask.js +1 -1
  347. package/dist/src/execution/tools/workflow/body.d.ts +60 -19
  348. package/dist/src/execution/tools/workflow/body.js +1 -1
  349. package/dist/src/execution/tools/workflow/cancel.d.ts +7 -2
  350. package/dist/src/execution/tools/workflow/cancel.js +1 -1
  351. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.d.ts +10 -4
  352. package/dist/src/execution/tools/workflow/emit-workflow-tool-run-report-step.js +1 -1
  353. package/dist/src/execution/tools/workflow/{background.d.ts → harness-definition.d.ts} +6 -6
  354. package/dist/src/execution/tools/workflow/harness-definition.js +1 -0
  355. package/dist/src/execution/tools/workflow/interrupt.d.ts +6 -0
  356. package/dist/src/execution/tools/workflow/interrupt.js +1 -0
  357. package/dist/src/execution/tools/workflow/messages.d.ts +135 -10
  358. package/dist/src/execution/tools/workflow/messages.js +1 -1
  359. package/dist/src/execution/tools/workflow/owner-inbox.js +1 -1
  360. package/dist/src/execution/tools/workflow/owner.d.ts +15 -4
  361. package/dist/src/execution/tools/workflow/owner.js +1 -1
  362. package/dist/src/execution/tools/workflow/serve.d.ts +3 -0
  363. package/dist/src/execution/tools/workflow/serve.js +1 -0
  364. package/dist/src/execution/tools/workflow/start.d.ts +18 -11
  365. package/dist/src/execution/tools/workflow/start.js +1 -1
  366. package/dist/src/execution/tools/workflow/step-execution.js +1 -1
  367. package/dist/src/execution/tools/workflow/step.js +1 -1
  368. package/dist/src/execution/tools/workflow/types.d.ts +0 -10
  369. package/dist/src/execution/tools/workflow/withdraw-step.d.ts +31 -0
  370. package/dist/src/execution/tools/workflow/withdraw-step.js +1 -0
  371. package/dist/src/execution/tools/workflow/workflow-owner-blocking.d.ts +3 -5
  372. package/dist/src/execution/tools/workflow/workflow-owner-blocking.js +1 -1
  373. package/dist/src/execution/tools/workflow/workflow.d.ts +3 -3
  374. package/dist/src/execution/tools/workflow/workflow.js +1 -1
  375. package/dist/src/execution/web-fetch/request.js +1 -1
  376. package/dist/src/execution/workflow-callback-url.d.ts +0 -5
  377. package/dist/src/execution/workflow-callback-url.js +1 -1
  378. package/dist/src/execution/workflow-runtime.d.ts +3 -5
  379. package/dist/src/execution/workflow-runtime.js +1 -1
  380. package/dist/src/execution/workflow-webhook-route.js +1 -1
  381. package/dist/src/extensions/code/extension/lib/connect-authentication.js +1 -1
  382. package/dist/src/extensions/code/extension/lib/github-shell.js +1 -1
  383. package/dist/src/extensions/code/extension/lib/prwatch-github.js +1 -1
  384. package/dist/src/extensions/code/extension/lib/sandbox.d.ts +3 -2
  385. package/dist/src/extensions/code/extension/lib/sandbox.js +1 -1
  386. package/dist/src/extensions/code/extension/lib/signed-commit.d.ts +1 -1
  387. package/dist/src/extensions/code/extension/lib/signed-commit.js +2 -2
  388. package/dist/src/extensions/code/tools.d.ts +2 -1
  389. package/dist/src/extensions/code/tools.js +1 -1
  390. package/dist/src/framework/sources/modules/agent.d.ts +1 -0
  391. package/dist/src/framework/sources/modules/agent.js +1 -1
  392. package/dist/src/framework/sources/registry.js +1 -1
  393. package/dist/src/harness/action-presentation.js +1 -1
  394. package/dist/src/harness/action-result-helpers.d.ts +1 -0
  395. package/dist/src/harness/action-result-helpers.js +1 -1
  396. package/dist/src/harness/advertised-tools.d.ts +1 -1
  397. package/dist/src/harness/advertised-tools.js +1 -1
  398. package/dist/src/harness/announcements.d.ts +22 -0
  399. package/dist/src/harness/announcements.js +1 -0
  400. package/dist/src/harness/approval-candidates.d.ts +10 -2
  401. package/dist/src/harness/approval-candidates.js +1 -1
  402. package/dist/src/harness/approval-delivery-coordinator.d.ts +4 -5
  403. package/dist/src/harness/approval-delivery-coordinator.js +1 -1
  404. package/dist/src/harness/approval-recheck.d.ts +7 -0
  405. package/dist/src/harness/approval-recheck.js +1 -0
  406. package/dist/src/harness/authorization-event-fields.d.ts +13 -0
  407. package/dist/src/harness/authorization-event-fields.js +1 -0
  408. package/dist/src/harness/authorization.d.ts +2 -1
  409. package/dist/src/harness/authorization.js +1 -1
  410. package/dist/src/harness/coordination.d.ts +31 -27
  411. package/dist/src/harness/coordination.js +1 -1
  412. package/dist/src/harness/current-messages.d.ts +6 -1
  413. package/dist/src/harness/current-messages.js +1 -1
  414. package/dist/src/harness/emission.d.ts +7 -1
  415. package/dist/src/harness/emission.js +1 -1
  416. package/dist/src/harness/execute-tool.d.ts +4 -15
  417. package/dist/src/harness/hitl/session-limit-input-requests.d.ts +2 -0
  418. package/dist/src/harness/hitl/session-limit-input-requests.js +1 -1
  419. package/dist/src/harness/input-request-resolution.d.ts +5 -2
  420. package/dist/src/harness/input-request-resolution.js +1 -1
  421. package/dist/src/harness/input-requests.js +1 -1
  422. package/dist/src/harness/messages.d.ts +11 -3
  423. package/dist/src/harness/messages.js +1 -1
  424. package/dist/src/harness/nested-actions.d.ts +23 -0
  425. package/dist/src/harness/nested-actions.js +1 -0
  426. package/dist/src/harness/pending-input-batches.d.ts +8 -6
  427. package/dist/src/harness/pending-input-batches.js +1 -1
  428. package/dist/src/harness/provider-tool-history.d.ts +7 -2
  429. package/dist/src/harness/provider-tool-history.js +1 -1
  430. package/dist/src/harness/proxy-input-requests.d.ts +41 -36
  431. package/dist/src/harness/proxy-input-requests.js +1 -1
  432. package/dist/src/harness/session-limit-enforcement.js +1 -1
  433. package/dist/src/harness/stale-input-responses.js +1 -1
  434. package/dist/src/harness/step-hooks.js +1 -1
  435. package/dist/src/harness/tool-loop.js +2 -2
  436. package/dist/src/harness/tool-model-output.js +1 -1
  437. package/dist/src/harness/tool-presentation.js +1 -1
  438. package/dist/src/harness/tools.d.ts +1 -5
  439. package/dist/src/harness/tools.js +1 -1
  440. package/dist/src/harness/turn-tag-state.d.ts +6 -5
  441. package/dist/src/harness/types.d.ts +7 -15
  442. package/dist/src/harness/workflow-dispatch.d.ts +30 -0
  443. package/dist/src/harness/workflow-dispatch.js +1 -0
  444. package/dist/src/harness/workflow-tool-runs.d.ts +5 -65
  445. package/dist/src/harness/workflow-tool-runs.js +1 -1
  446. package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
  447. package/dist/src/instrumentation/lifecycle.d.ts +5 -2
  448. package/dist/src/instrumentation/lifecycle.js +1 -1
  449. package/dist/src/instrumentation/native-events.d.ts +0 -7
  450. package/dist/src/instrumentation/native-events.js +1 -1
  451. package/dist/src/instrumentation/runtime.d.ts +1 -4
  452. package/dist/src/instrumentation/runtime.js +1 -1
  453. package/dist/src/instrumentation/state.d.ts +0 -6
  454. package/dist/src/instrumentation/state.js +1 -1
  455. package/dist/src/internal/application/package.js +1 -1
  456. package/dist/src/internal/authored-definition/schema-backed.d.ts +10 -0
  457. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  458. package/dist/src/internal/authored-module-loader.d.ts +12 -6
  459. package/dist/src/internal/authored-module-loader.js +2 -2
  460. package/dist/src/internal/authored-module-map-loader.js +1 -1
  461. package/dist/src/internal/authored-package-boundary.d.ts +3 -0
  462. package/dist/src/internal/authored-package-boundary.js +1 -1
  463. package/dist/src/internal/bundler/extension-mount-plugin.d.ts +14 -0
  464. package/dist/src/internal/bundler/extension-mount-plugin.js +1 -0
  465. package/dist/src/internal/bundler/extension-scope-plugin.d.ts +8 -11
  466. package/dist/src/internal/bundler/extension-scope-plugin.js +2 -3
  467. package/dist/src/internal/invocation/workflow-execution.d.ts +2 -2
  468. package/dist/src/internal/invocation/workflow-execution.js +1 -1
  469. package/dist/src/internal/mount-state.d.ts +1 -0
  470. package/dist/src/internal/mount-state.js +1 -0
  471. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.d.ts +2 -2
  472. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -1
  473. package/dist/src/internal/nitro/dev-runtime-artifacts.d.ts +2 -4
  474. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  475. package/dist/src/internal/nitro/dev-runtime-generation-metadata.d.ts +13 -0
  476. package/dist/src/internal/nitro/dev-runtime-generation-metadata.js +1 -0
  477. package/dist/src/internal/nitro/development-generation.d.ts +2 -0
  478. package/dist/src/internal/nitro/development-generation.js +1 -1
  479. package/dist/src/internal/nitro/host/build-application.js +1 -1
  480. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  481. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.d.ts +1 -0
  482. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
  483. package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
  484. package/dist/src/internal/nitro/host/dev-workflow-world-setup.d.ts +1 -0
  485. package/dist/src/internal/nitro/host/dev-workflow-world-setup.js +1 -1
  486. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  487. package/dist/src/internal/nitro/host/start-development-server.js +1 -1
  488. package/dist/src/internal/nitro/host/types.d.ts +2 -0
  489. package/dist/src/internal/nitro/host/workspace-extensions.js +1 -1
  490. package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
  491. package/dist/src/internal/node-esm-compat-banner.js +1 -1
  492. package/dist/src/internal/workflow/cancel-expired-development-run.d.ts +2 -0
  493. package/dist/src/internal/workflow/cancel-expired-development-run.js +1 -0
  494. package/dist/src/internal/workflow/development-runtime-compatibility.d.ts +12 -0
  495. package/dist/src/internal/workflow/development-runtime-compatibility.js +1 -0
  496. package/dist/src/internal/workflow/development-world-client.js +1 -1
  497. package/dist/src/internal/workflow/development-world-protocol.d.ts +9 -0
  498. package/dist/src/internal/workflow/development-world-server.d.ts +2 -0
  499. package/dist/src/internal/workflow/development-world-server.js +1 -1
  500. package/dist/src/internal/workflow/is-inactive-workflow-run-error.d.ts +2 -0
  501. package/dist/src/internal/workflow/is-inactive-workflow-run-error.js +1 -0
  502. package/dist/src/internal/workflow-bundle/authored-workflow-directives.d.ts +4 -3
  503. package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -1
  504. package/dist/src/internal/workflow-bundle/builder.js +1 -1
  505. package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.js +1 -1
  506. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  507. package/dist/src/models/auto.d.ts +6 -0
  508. package/dist/src/models/auto.js +2 -2
  509. package/dist/src/protocol/message-version.d.ts +1 -0
  510. package/dist/src/protocol/message-version.js +1 -1
  511. package/dist/src/protocol/message.d.ts +126 -67
  512. package/dist/src/protocol/message.js +2 -2
  513. package/dist/src/protocol/remote-agent-protocol.d.ts +16 -0
  514. package/dist/src/protocol/remote-agent-protocol.js +1 -0
  515. package/dist/src/protocol/routes.d.ts +0 -6
  516. package/dist/src/protocol/routes.js +1 -1
  517. package/dist/src/protocol/task-tools.d.ts +21 -0
  518. package/dist/src/protocol/task-tools.js +1 -0
  519. package/dist/src/public/channels/auth.js +1 -1
  520. package/dist/src/public/channels/chat-sdk/chatSdkChannel.d.ts +25 -16
  521. package/dist/src/public/channels/chat-sdk/chatSdkChannel.js +2 -2
  522. package/dist/src/public/channels/chat-sdk/index.d.ts +1 -1
  523. package/dist/src/public/channels/chat-sdk/input-actions.d.ts +8 -0
  524. package/dist/src/public/channels/chat-sdk/input-actions.js +1 -0
  525. package/dist/src/public/channels/index.d.ts +1 -1
  526. package/dist/src/public/channels/linq/linqChannel.js +1 -1
  527. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  528. package/dist/src/public/channels/slack/action-status.d.ts +11 -12
  529. package/dist/src/public/channels/slack/action-status.js +1 -1
  530. package/dist/src/public/channels/slack/api.js +1 -1
  531. package/dist/src/public/channels/slack/attachments.js +1 -1
  532. package/dist/src/public/channels/slack/auth.d.ts +3 -0
  533. package/dist/src/public/channels/slack/auth.js +1 -1
  534. package/dist/src/public/channels/slack/connections.d.ts +6 -6
  535. package/dist/src/public/channels/slack/connections.js +1 -1
  536. package/dist/src/public/channels/slack/defaults.d.ts +13 -19
  537. package/dist/src/public/channels/slack/defaults.js +4 -4
  538. package/dist/src/public/channels/slack/hitl.d.ts +22 -13
  539. package/dist/src/public/channels/slack/hitl.js +2 -2
  540. package/dist/src/public/channels/slack/index.d.ts +4 -3
  541. package/dist/src/public/channels/slack/index.js +1 -1
  542. package/dist/src/public/channels/slack/input-response.d.ts +1 -5
  543. package/dist/src/public/channels/slack/input-response.js +1 -1
  544. package/dist/src/public/channels/slack/interaction-cards.js +1 -1
  545. package/dist/src/public/channels/slack/interactions.js +1 -1
  546. package/dist/src/public/channels/slack/renderers.d.ts +76 -0
  547. package/dist/src/public/channels/slack/renderers.js +1 -0
  548. package/dist/src/public/channels/slack/session-operations.d.ts +6 -0
  549. package/dist/src/public/channels/slack/session-operations.js +1 -1
  550. package/dist/src/public/channels/slack/slackChannel.d.ts +47 -103
  551. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  552. package/dist/src/public/channels/slack/task-card.d.ts +24 -0
  553. package/dist/src/public/channels/slack/task-card.js +1 -0
  554. package/dist/src/public/channels/telegram/hitl.d.ts +7 -1
  555. package/dist/src/public/channels/telegram/hitl.js +2 -1
  556. package/dist/src/public/channels/telegram/state.js +1 -1
  557. package/dist/src/public/channels/telegram/telegramChannel.d.ts +5 -0
  558. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  559. package/dist/src/public/definitions/channel.d.ts +6 -1
  560. package/dist/src/public/definitions/channel.js +1 -1
  561. package/dist/src/public/definitions/connections/mcp.d.ts +4 -6
  562. package/dist/src/public/definitions/connections/openapi.d.ts +7 -8
  563. package/dist/src/public/definitions/extension.d.ts +2 -2
  564. package/dist/src/public/definitions/extension.js +1 -1
  565. package/dist/src/public/definitions/hook.d.ts +16 -4
  566. package/dist/src/public/definitions/state.d.ts +4 -2
  567. package/dist/src/public/definitions/state.js +1 -1
  568. package/dist/src/public/memory/index.d.ts +0 -1
  569. package/dist/src/public/models/openai/index.d.ts +1 -1
  570. package/dist/src/public/models/openai/index.js +1 -1
  571. package/dist/src/public/schedules/index.d.ts +1 -0
  572. package/dist/src/public/schedules/index.js +1 -1
  573. package/dist/src/public/server/index.d.ts +28 -0
  574. package/dist/src/public/server/index.js +1 -0
  575. package/dist/src/public/tools/index.d.ts +3 -2
  576. package/dist/src/public/tools/index.js +1 -1
  577. package/dist/src/public/tools/no-reply.d.ts +1 -0
  578. package/dist/src/public/tools/no-reply.js +1 -0
  579. package/dist/src/runtime/agent/bootstrap-model-utils.d.ts +6 -7
  580. package/dist/src/runtime/agent/bootstrap-model-utils.js +1 -1
  581. package/dist/src/runtime/agent/bootstrap.d.ts +0 -1
  582. package/dist/src/runtime/agent/bootstrap.js +1 -1
  583. package/dist/src/runtime/agent/mock-model-adapter.js +1 -1
  584. package/dist/src/runtime/agent/mock-model-fixtures.d.ts +1 -1
  585. package/dist/src/runtime/agent/mock-model-fixtures.js +2 -2
  586. package/dist/src/runtime/channels/registry.js +1 -1
  587. package/dist/src/runtime/connections/mcp-client.d.ts +1 -2
  588. package/dist/src/runtime/connections/openapi-client.js +1 -1
  589. package/dist/src/runtime/connections/scoped-authorization.d.ts +1 -1
  590. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  591. package/dist/src/runtime/connections/tool-result.d.ts +27 -0
  592. package/dist/src/runtime/connections/tool-result.js +2 -0
  593. package/dist/src/runtime/connections/tool-signature.d.ts +14 -0
  594. package/dist/src/runtime/connections/tool-signature.js +1 -0
  595. package/dist/src/runtime/local-dev-capability.js +1 -1
  596. package/dist/src/runtime/prompt/compose.d.ts +1 -3
  597. package/dist/src/runtime/prompt/compose.js +3 -3
  598. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  599. package/dist/src/runtime/resolve-tool.js +1 -1
  600. package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
  601. package/dist/src/runtime/sessions/runtime-context-keys.js +1 -1
  602. package/dist/src/runtime/sessions/turn.d.ts +1 -16
  603. package/dist/src/runtime/subagents/dynamic-remote-agent-config.js +1 -1
  604. package/dist/src/runtime/subagents/registry.js +1 -1
  605. package/dist/src/runtime/subagents/workflow-reference.d.ts +6 -3
  606. package/dist/src/runtime/subagents/workflow-reference.js +1 -1
  607. package/dist/src/runtime/subagents/workflow.d.ts +12 -6
  608. package/dist/src/runtime/subagents/workflow.js +1 -1
  609. package/dist/src/runtime/tools/registry.js +1 -1
  610. package/dist/src/self-modification/extension/classify-registry-item.d.ts +3 -0
  611. package/dist/src/self-modification/extension/classify-registry-item.js +1 -1
  612. package/dist/src/self-modification/extension/subagents/agent/agent.d.ts +1 -1
  613. package/dist/src/self-modification/extension/subagents/agent/agent.js +1 -1
  614. package/dist/src/self-modification/extension/subagents/agent/instructions.js +7 -7
  615. package/dist/src/self-modification/extension/subagents/agent/tools/registry_add.js +1 -1
  616. package/dist/src/self-modification/extension/subagents/agent/tools/search_registry.d.ts +2 -0
  617. package/dist/src/self-modification/extension/subagents/agent/tools/search_registry.js +1 -1
  618. package/dist/src/self-modification/extension/subagents/agent/tools/search_traces.js +1 -1
  619. package/dist/src/self-modification/scaffold.d.ts +2 -0
  620. package/dist/src/self-modification/scaffold.js +7 -0
  621. package/dist/src/self-modification/setup.js +1 -7
  622. package/dist/src/setup/boxes/model-capabilities.d.ts +2 -2
  623. package/dist/src/setup/boxes/model-capabilities.js +1 -1
  624. package/dist/src/setup/boxes/select-model.js +1 -1
  625. package/dist/src/setup/integrations/shopify/templates.d.ts +1 -1
  626. package/dist/src/setup/integrations/shopify/templates.js +31 -19
  627. package/dist/src/setup/integrations/web/setup.d.ts +0 -2
  628. package/dist/src/setup/integrations/web/setup.js +3 -3
  629. package/dist/src/setup/scaffold/create/agent-paths.d.ts +5 -0
  630. package/dist/src/setup/scaffold/create/agent-paths.js +1 -0
  631. package/dist/src/setup/scaffold/create/instructions-template.d.ts +1 -0
  632. package/dist/src/setup/scaffold/create/instructions-template.js +8 -0
  633. package/dist/src/setup/scaffold/create/project.js +3 -10
  634. package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
  635. package/dist/src/setup/scaffold/create/web-template.js +1 -1
  636. package/dist/src/shared/action-request-name.d.ts +3 -0
  637. package/dist/src/shared/action-request-name.js +1 -0
  638. package/dist/src/shared/action-types.d.ts +49 -21
  639. package/dist/src/shared/action-types.js +1 -1
  640. package/dist/src/shared/agent-definition.d.ts +0 -7
  641. package/dist/src/shared/chatgpt-model.d.ts +1 -1
  642. package/dist/src/shared/chatgpt-model.js +1 -1
  643. package/dist/src/shared/connection-types.d.ts +2 -3
  644. package/dist/src/shared/default-agent-model.d.ts +10 -1
  645. package/dist/src/shared/default-agent-model.js +1 -1
  646. package/dist/src/shared/extension-mount.d.ts +2 -0
  647. package/dist/src/shared/extension-mount.js +1 -0
  648. package/dist/src/shared/format-duration.d.ts +2 -0
  649. package/dist/src/shared/format-duration.js +1 -0
  650. package/dist/src/shared/gateway-model-catalog.d.ts +25 -2
  651. package/dist/src/shared/gateway-model-catalog.js +1 -1
  652. package/dist/src/shared/input.d.ts +1 -0
  653. package/dist/src/shared/memory-state.d.ts +1 -0
  654. package/dist/src/shared/memory-state.js +1 -1
  655. package/dist/src/shared/model-helper.d.ts +2 -2
  656. package/dist/src/shared/model-helper.js +1 -1
  657. package/dist/src/shared/model-summary.d.ts +2 -6
  658. package/dist/src/shared/model-summary.js +1 -1
  659. package/dist/src/shared/presentation-text.d.ts +5 -0
  660. package/dist/src/shared/presentation-text.js +1 -1
  661. package/dist/src/shared/serialized-observability-state.d.ts +0 -4
  662. package/dist/src/shared/serialized-observability-state.js +1 -1
  663. package/dist/src/shared/value-delta.d.ts +39 -0
  664. package/dist/src/shared/value-delta.js +1 -0
  665. package/dist/src/subagents/adapter-state.d.ts +0 -2
  666. package/dist/src/subagents/adapter-state.js +1 -1
  667. package/dist/src/subagents/adapter.js +1 -1
  668. package/dist/src/subagents/callback-route.js +1 -1
  669. package/dist/src/subagents/event-proxy-step.d.ts +16 -29
  670. package/dist/src/subagents/event-proxy-step.js +1 -1
  671. package/dist/src/subagents/hitl-proxy.d.ts +35 -17
  672. package/dist/src/subagents/hitl-proxy.js +1 -1
  673. package/dist/src/subagents/invocation.d.ts +1 -2
  674. package/dist/src/subagents/parent-notification.d.ts +2 -1
  675. package/dist/src/subagents/parent-notification.js +1 -1
  676. package/dist/src/subagents/token-budget.d.ts +8 -9
  677. package/dist/src/subagents/token-budget.js +1 -1
  678. package/dist/src/subagents/tool.d.ts +6 -12
  679. package/dist/src/subagents/tool.js +1 -1
  680. package/dist/src/svelte/index.js +1 -1
  681. package/dist/src/svelte/use-eve-agent.js +1 -1
  682. package/dist/src/tools/behavior.d.ts +5 -5
  683. package/dist/src/tools/definition.d.ts +58 -14
  684. package/dist/src/tools/definition.js +1 -1
  685. package/dist/src/tools/durable-callbacks.d.ts +1 -1
  686. package/dist/src/tools/dynamic.d.ts +6 -0
  687. package/dist/src/tools/framework/agent-contract.d.ts +2 -5
  688. package/dist/src/tools/framework/agent-contract.js +1 -1
  689. package/dist/src/tools/framework/agent.d.ts +2 -5
  690. package/dist/src/tools/framework/agent.js +1 -1
  691. package/dist/src/tools/framework/connection-tools.d.ts +3 -0
  692. package/dist/src/tools/framework/connection-tools.js +1 -0
  693. package/dist/src/tools/provided/agent-router.d.ts +6 -3
  694. package/dist/src/tools/provided/agent-router.js +1 -1
  695. package/dist/src/{execution/tools → tools/provided}/ask-question-workflow.d.ts +3 -4
  696. package/dist/src/tools/provided/ask-question-workflow.js +1 -0
  697. package/dist/src/tools/provided/ask-question.d.ts +20 -5
  698. package/dist/src/tools/provided/ask-question.js +2 -1
  699. package/dist/src/tools/provided/interrupted.d.ts +18 -0
  700. package/dist/src/tools/provided/interrupted.js +1 -0
  701. package/dist/src/tools/provided/no-reply.d.ts +19 -0
  702. package/dist/src/tools/provided/no-reply.js +1 -0
  703. package/dist/src/tools/provided/sleep-workflow.d.ts +4 -0
  704. package/dist/src/tools/provided/sleep-workflow.js +1 -0
  705. package/dist/src/tools/provided/sleep.d.ts +11 -5
  706. package/dist/src/tools/provided/sleep.js +1 -1
  707. package/dist/src/tools/provided/task-cancel.d.ts +6 -0
  708. package/dist/src/tools/provided/task-cancel.js +1 -0
  709. package/dist/src/tools/provided/task-wait.d.ts +9 -0
  710. package/dist/src/tools/provided/task-wait.js +1 -0
  711. package/dist/src/tools/provided/workflow.d.ts +2 -2
  712. package/dist/src/tools/provided/workflow.js +1 -1
  713. package/dist/src/tools/schema-emission.d.ts +23 -0
  714. package/dist/src/tools/schema-emission.js +1 -0
  715. package/dist/src/tools/schema.d.ts +22 -8
  716. package/dist/src/tools/schema.js +1 -1
  717. package/dist/src/tools/workflow-definition.d.ts +187 -85
  718. package/dist/src/tools/workflow-definition.js +1 -1
  719. package/dist/src/tools/workflow-entry-point.d.ts +3 -0
  720. package/dist/src/tools/workflow-entry-point.js +1 -0
  721. package/dist/src/tracing/agent-action-instrumentation.d.ts +1 -3
  722. package/dist/src/tracing/agent-action-instrumentation.js +1 -1
  723. package/dist/src/tracing/agent-invocation-coordinator.d.ts +9 -18
  724. package/dist/src/tracing/agent-invocation-coordinator.js +1 -1
  725. package/dist/src/tracing/agent-otel-content.d.ts +0 -2
  726. package/dist/src/tracing/agent-otel-content.js +3 -3
  727. package/dist/src/tracing/agent-otel-provider.js +2 -2
  728. package/dist/src/tracing/agent-otel-runtime-context.d.ts +20 -0
  729. package/dist/src/tracing/agent-otel-runtime-context.js +1 -1
  730. package/dist/src/tracing/agent-otel-usage.js +1 -1
  731. package/dist/src/tracing/agent-span-contract.d.ts +1 -1
  732. package/dist/src/tracing/agent-span-contract.js +1 -1
  733. package/dist/src/tracing/agent-span-id-generator.d.ts +0 -1
  734. package/dist/src/tracing/agent-span-id-generator.js +1 -1
  735. package/dist/src/tracing/agent-trace-context-codec.d.ts +1 -2
  736. package/dist/src/tracing/agent-trace-context-codec.js +1 -1
  737. package/dist/src/tracing/agent-trace-context-store.d.ts +2 -27
  738. package/dist/src/tracing/agent-trace-context-store.js +1 -1
  739. package/dist/src/tracing/agent-trace-state.d.ts +1 -19
  740. package/dist/src/tracing/content-attributes.js +1 -1
  741. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  742. package/dist/src/vue/index.js +1 -1
  743. package/dist/src/vue/use-eve-agent.js +1 -1
  744. package/docs/agent-config.md +36 -13
  745. package/docs/channels/chat-sdk.mdx +15 -4
  746. package/docs/channels/custom.mdx +89 -17
  747. package/docs/channels/eve.mdx +1 -1
  748. package/docs/channels/mcp.mdx +1 -1
  749. package/docs/channels/overview.mdx +14 -56
  750. package/docs/channels/slack.mdx +230 -35
  751. package/docs/channels/telegram.mdx +2 -0
  752. package/docs/concepts/built-in-tools.md +36 -28
  753. package/docs/concepts/context-control.md +2 -2
  754. package/docs/concepts/execution-model-and-durability.mdx +10 -11
  755. package/docs/concepts/project-structure.mdx +1 -1
  756. package/docs/concepts/sessions-runs-and-streaming.md +67 -47
  757. package/docs/connections/mcp.mdx +4 -4
  758. package/docs/connections/openapi.mdx +2 -2
  759. package/docs/connections/overview.mdx +2 -2
  760. package/docs/evals/assertions.mdx +5 -5
  761. package/docs/evals/cases.mdx +1 -1
  762. package/docs/evals/reporters.mdx +6 -4
  763. package/docs/extensions.md +11 -2
  764. package/docs/guides/auth-and-route-protection.md +1 -1
  765. package/docs/guides/client/streaming.mdx +31 -11
  766. package/docs/guides/deployment/vercel.mdx +1 -1
  767. package/docs/guides/dev-tui.md +13 -3
  768. package/docs/guides/dynamic-capabilities.md +15 -10
  769. package/docs/guides/evaluate.md +29 -2
  770. package/docs/guides/frontend/overview.mdx +5 -7
  771. package/docs/guides/hooks.md +48 -12
  772. package/docs/guides/instrumentation/instrumentation.mdx +2 -0
  773. package/docs/guides/remote-agents.md +12 -14
  774. package/docs/guides/self-modification.md +10 -0
  775. package/docs/install-integrations.mdx +1 -1
  776. package/docs/instructions.mdx +1 -1
  777. package/docs/patterns/multi-tenant-approvals.md +1 -1
  778. package/docs/protocols/ucp.mdx +20 -16
  779. package/docs/reference/cli.md +96 -22
  780. package/docs/reference/typescript-api.md +43 -41
  781. package/docs/schedules.mdx +14 -34
  782. package/docs/subagents/index.mdx +24 -56
  783. package/docs/tools/human-in-the-loop.md +50 -13
  784. package/docs/tools/meta.json +1 -1
  785. package/docs/tools/overview.mdx +79 -59
  786. package/docs/tools/tasks-upgrade.md +201 -0
  787. package/docs/tools/tasks.md +315 -0
  788. package/docs/tools/workflows.mdx +368 -154
  789. package/package.json +41 -14
  790. package/dist/src/channel/activity-renderer.d.ts +0 -21
  791. package/dist/src/channel/activity-renderer.js +0 -1
  792. package/dist/src/channel/activity-sink.d.ts +0 -2
  793. package/dist/src/channel/activity-sink.js +0 -1
  794. package/dist/src/eve-channel/activity-observer-request.d.ts +0 -7
  795. package/dist/src/eve-channel/activity-observer-request.js +0 -1
  796. package/dist/src/eve-channel/delivery-policy-request.d.ts +0 -4
  797. package/dist/src/eve-channel/delivery-policy-request.js +0 -1
  798. package/dist/src/execution/activity-cohort.d.ts +0 -20
  799. package/dist/src/execution/activity-cohort.js +0 -1
  800. package/dist/src/execution/activity-collector.d.ts +0 -12
  801. package/dist/src/execution/activity-collector.js +0 -1
  802. package/dist/src/execution/activity-events.d.ts +0 -8
  803. package/dist/src/execution/activity-events.js +0 -1
  804. package/dist/src/execution/activity-route.d.ts +0 -2
  805. package/dist/src/execution/activity-route.js +0 -1
  806. package/dist/src/execution/activity-work-id.d.ts +0 -9
  807. package/dist/src/execution/activity-work-id.js +0 -1
  808. package/dist/src/execution/activity-work.d.ts +0 -30
  809. package/dist/src/execution/activity-work.js +0 -1
  810. package/dist/src/execution/cancel-indexed-session-tasks-step.d.ts +0 -7
  811. package/dist/src/execution/cancel-indexed-session-tasks-step.js +0 -1
  812. package/dist/src/execution/dispatch-action-failures.d.ts +0 -8
  813. package/dist/src/execution/dispatch-action-failures.js +0 -1
  814. package/dist/src/execution/dispatch-start-operation.d.ts +0 -15
  815. package/dist/src/execution/dispatch-start-operation.js +0 -1
  816. package/dist/src/execution/publish-channel-event.d.ts +0 -23
  817. package/dist/src/execution/publish-channel-event.js +0 -1
  818. package/dist/src/execution/scheduled-launch-delivery.d.ts +0 -7
  819. package/dist/src/execution/scheduled-launch-delivery.js +0 -1
  820. package/dist/src/execution/session/event-sink.d.ts +0 -26
  821. package/dist/src/execution/session/event-sink.js +0 -1
  822. package/dist/src/execution/session-activity-projection.d.ts +0 -16
  823. package/dist/src/execution/session-activity-projection.js +0 -1
  824. package/dist/src/execution/session-activity-renderer-step.d.ts +0 -15
  825. package/dist/src/execution/session-activity-renderer-step.js +0 -1
  826. package/dist/src/execution/session-activity.d.ts +0 -3
  827. package/dist/src/execution/session-activity.js +0 -1
  828. package/dist/src/execution/submit-activity.d.ts +0 -7
  829. package/dist/src/execution/submit-activity.js +0 -1
  830. package/dist/src/execution/task-event-callback.d.ts +0 -12
  831. package/dist/src/execution/task-event-callback.js +0 -1
  832. package/dist/src/execution/task-input-capability.d.ts +0 -4
  833. package/dist/src/execution/task-input-capability.js +0 -1
  834. package/dist/src/execution/task-input-response-route.d.ts +0 -2
  835. package/dist/src/execution/task-input-response-route.js +0 -1
  836. package/dist/src/execution/tasks/child/notify.d.ts +0 -44
  837. package/dist/src/execution/tasks/child/notify.js +0 -1
  838. package/dist/src/execution/tasks/parent/control-shared.d.ts +0 -23
  839. package/dist/src/execution/tasks/parent/control-shared.js +0 -1
  840. package/dist/src/execution/tasks/parent/delegate.d.ts +0 -35
  841. package/dist/src/execution/tasks/parent/delegate.js +0 -1
  842. package/dist/src/execution/tasks/parent/dispatch.d.ts +0 -22
  843. package/dist/src/execution/tasks/parent/dispatch.js +0 -1
  844. package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +0 -27
  845. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +0 -1
  846. package/dist/src/execution/tasks/parent/run-parent.d.ts +0 -58
  847. package/dist/src/execution/tasks/parent/run-parent.js +0 -1
  848. package/dist/src/execution/tasks/parent/subagent-task-projection.d.ts +0 -26
  849. package/dist/src/execution/tasks/parent/subagent-task-projection.js +0 -1
  850. package/dist/src/execution/tasks/parent/task-cancel.d.ts +0 -12
  851. package/dist/src/execution/tasks/parent/task-cancel.js +0 -1
  852. package/dist/src/execution/tasks/parent/tool-execution.d.ts +0 -45
  853. package/dist/src/execution/tasks/parent/tool-execution.js +0 -1
  854. package/dist/src/execution/terminal-session-event.d.ts +0 -13
  855. package/dist/src/execution/terminal-session-event.js +0 -1
  856. package/dist/src/execution/tools/ask-question-workflow.js +0 -1
  857. package/dist/src/execution/tools/ask-question.d.ts +0 -19
  858. package/dist/src/execution/tools/ask-question.js +0 -2
  859. package/dist/src/execution/tools/connection-search.d.ts +0 -2
  860. package/dist/src/execution/tools/connection-search.js +0 -2
  861. package/dist/src/execution/tools/sleep-workflow.d.ts +0 -3
  862. package/dist/src/execution/tools/sleep-workflow.js +0 -1
  863. package/dist/src/execution/tools/sleep.d.ts +0 -10
  864. package/dist/src/execution/tools/sleep.js +0 -1
  865. package/dist/src/execution/tools/subagent/accept-event-step.d.ts +0 -7
  866. package/dist/src/execution/tools/subagent/accept-event-step.js +0 -1
  867. package/dist/src/execution/tools/subagent/emit-event-step.d.ts +0 -12
  868. package/dist/src/execution/tools/subagent/emit-event-step.js +0 -1
  869. package/dist/src/execution/tools/subagent/invoke-agent.d.ts +0 -42
  870. package/dist/src/execution/tools/subagent/invoke-agent.js +0 -1
  871. package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +0 -44
  872. package/dist/src/execution/tools/subagent/invoke-preparation.js +0 -1
  873. package/dist/src/execution/tools/subagent/invoke-step.d.ts +0 -64
  874. package/dist/src/execution/tools/subagent/invoke-step.js +0 -1
  875. package/dist/src/execution/tools/subagent/receipt-identity.d.ts +0 -11
  876. package/dist/src/execution/tools/subagent/receipt-identity.js +0 -1
  877. package/dist/src/execution/tools/subagent/start.d.ts +0 -51
  878. package/dist/src/execution/tools/subagent/start.js +0 -1
  879. package/dist/src/execution/tools/subagent/steer.d.ts +0 -13
  880. package/dist/src/execution/tools/subagent/steer.js +0 -1
  881. package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +0 -24
  882. package/dist/src/execution/tools/subagent/task-agent-requests.js +0 -1
  883. package/dist/src/execution/tools/subagent/task-cancel.d.ts +0 -10
  884. package/dist/src/execution/tools/subagent/task-cancel.js +0 -1
  885. package/dist/src/execution/tools/tasks.d.ts +0 -3
  886. package/dist/src/execution/tools/tasks.js +0 -1
  887. package/dist/src/execution/tools/workflow/background.js +0 -1
  888. package/dist/src/execution/tools/workflow/workflow-owner-background.d.ts +0 -14
  889. package/dist/src/execution/tools/workflow/workflow-owner-background.js +0 -1
  890. package/dist/src/extensions/code/extension/tools/computer_use.js +0 -1
  891. package/dist/src/harness/background-tools.d.ts +0 -45
  892. package/dist/src/harness/background-tools.js +0 -1
  893. package/dist/src/instrumentation/background-task-runtime.d.ts +0 -18
  894. package/dist/src/instrumentation/background-task-runtime.js +0 -1
  895. package/dist/src/node_modules/.pnpm/@vercel_cli-config@0.3.0/node_modules/@vercel/cli-config/dist/index.js +0 -21
  896. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/envpath.js +0 -1
  897. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errors.js +0 -2
  898. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/errutils.js +0 -1
  899. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/exec.js +0 -1
  900. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/fsutils.js +0 -1
  901. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/index.js +0 -1
  902. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/lookup.js +0 -1
  903. package/dist/src/node_modules/.pnpm/@vercel_cli-exec@1.0.1/node_modules/@vercel/cli-exec/dist/safety.js +0 -1
  904. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/authorization.js +0 -1
  905. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/connector.js +0 -1
  906. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/index.js +0 -1
  907. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/installation.js +0 -1
  908. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/base-url.js +0 -1
  909. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/default-scopes.js +0 -1
  910. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/env.js +0 -1
  911. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/internal/url-validation.js +0 -1
  912. package/dist/src/node_modules/.pnpm/@vercel_connect@2.3.3_@ai-sdk_mcp@2.0.52_zod@4.5.4__@auth_core@0.41.2_@chat-adapter_sla_a37674779346d612fa7d2ca9bd316494/node_modules/@vercel/connect/dist/token.js +0 -1
  913. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/auth-errors.js +0 -1
  914. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/exchange-vercel-oidc-token.js +0 -1
  915. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-context.js +0 -1
  916. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-sync.js +0 -1
  917. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-with-refresh.js +0 -2
  918. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/index.js +0 -1
  919. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/oauth.js +0 -1
  920. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-error.js +0 -1
  921. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-io.js +0 -1
  922. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token-util.js +0 -2
  923. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/token.js +0 -1
  924. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/verify-vercel-oidc-token.js +0 -1
  925. package/dist/src/node_modules/.pnpm/@vercel_oidc@3.8.9/node_modules/@vercel/oidc/dist/version.js +0 -1
  926. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js +0 -1
  927. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js +0 -1
  928. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js +0 -1
  929. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js +0 -1
  930. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js +0 -1
  931. package/dist/src/node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -1
  932. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/index.js +0 -1
  933. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/command.js +0 -1
  934. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/error.js +0 -2
  935. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/kill.js +0 -1
  936. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/promise.js +0 -1
  937. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stdio.js +0 -1
  938. package/dist/src/node_modules/.pnpm/execa@5.1.1/node_modules/execa/lib/stream.js +0 -1
  939. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/buffer-stream.js +0 -1
  940. package/dist/src/node_modules/.pnpm/get-stream@6.0.1/node_modules/get-stream/index.js +0 -1
  941. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/core.js +0 -1
  942. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/main.js +0 -1
  943. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/realtime.js +0 -1
  944. package/dist/src/node_modules/.pnpm/human-signals@2.1.0/node_modules/human-signals/build/src/signals.js +0 -1
  945. package/dist/src/node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js +0 -1
  946. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js +0 -1
  947. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js +0 -1
  948. package/dist/src/node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js +0 -1
  949. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/index.js +0 -1
  950. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/decrypt.js +0 -1
  951. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/compact/encrypt.js +0 -1
  952. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/decrypt.js +0 -1
  953. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/flattened/encrypt.js +0 -1
  954. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/decrypt.js +0 -1
  955. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwe/general/encrypt.js +0 -1
  956. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/embedded.js +0 -1
  957. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwk/thumbprint.js +0 -1
  958. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/local.js +0 -1
  959. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwks/remote.js +0 -1
  960. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/sign.js +0 -1
  961. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/compact/verify.js +0 -1
  962. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/sign.js +0 -1
  963. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/flattened/verify.js +0 -1
  964. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/sign.js +0 -1
  965. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jws/general/verify.js +0 -1
  966. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/decrypt.js +0 -1
  967. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/encrypt.js +0 -1
  968. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/produce.js +0 -1
  969. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/sign.js +0 -1
  970. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/unsecured.js +0 -1
  971. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/jwt/verify.js +0 -1
  972. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/export.js +0 -1
  973. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_key_pair.js +0 -1
  974. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/generate_secret.js +0 -1
  975. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/key/import.js +0 -1
  976. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/aesgcmkw.js +0 -1
  977. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/buffer_utils.js +0 -1
  978. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/cek.js +0 -1
  979. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_iv_length.js +0 -1
  980. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_key_type.js +0 -1
  981. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/check_p2s.js +0 -1
  982. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/crypto_key.js +0 -1
  983. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/decrypt_key_management.js +0 -1
  984. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/encrypt_key_management.js +0 -1
  985. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/epoch.js +0 -1
  986. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/invalid_key_input.js +0 -1
  987. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_disjoint.js +0 -1
  988. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_jwk.js +0 -1
  989. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/is_object.js +0 -1
  990. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/iv.js +0 -1
  991. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/jwt_claims_set.js +0 -1
  992. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/private_symbols.js +0 -1
  993. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/secs.js +0 -1
  994. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_algorithms.js +0 -1
  995. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/lib/validate_crit.js +0 -1
  996. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/aeskw.js +0 -1
  997. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/asn1.js +0 -1
  998. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/base64url.js +0 -1
  999. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/cbc_tag.js +0 -1
  1000. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_cek_length.js +0 -1
  1001. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/check_key_length.js +0 -1
  1002. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ciphers.js +0 -1
  1003. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/decrypt.js +0 -1
  1004. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/digest.js +0 -1
  1005. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/dsa_digest.js +0 -1
  1006. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/ecdhes.js +0 -1
  1007. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/encrypt.js +0 -1
  1008. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/fetch_jwks.js +0 -1
  1009. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/generate.js +0 -1
  1010. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_named_curve.js +0 -1
  1011. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/get_sign_verify_key.js +0 -1
  1012. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/hmac_digest.js +0 -1
  1013. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_like.js +0 -1
  1014. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/is_key_object.js +0 -1
  1015. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/jwk_to_key.js +0 -1
  1016. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/key_to_jwk.js +0 -1
  1017. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/node_key.js +0 -1
  1018. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/normalize_key.js +0 -1
  1019. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/pbes2kw.js +0 -1
  1020. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/random.js +0 -1
  1021. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/rsaes.js +0 -1
  1022. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/runtime.js +0 -1
  1023. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/sign.js +0 -1
  1024. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/timing_safe_equal.js +0 -1
  1025. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/verify.js +0 -1
  1026. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/runtime/webcrypto.js +0 -1
  1027. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/base64url.js +0 -1
  1028. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_jwt.js +0 -1
  1029. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/decode_protected_header.js +0 -1
  1030. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/errors.js +0 -1
  1031. package/dist/src/node_modules/.pnpm/jose@5.10.0/node_modules/jose/dist/node/cjs/util/runtime.js +0 -1
  1032. package/dist/src/node_modules/.pnpm/merge-stream@2.0.0/node_modules/merge-stream/index.js +0 -1
  1033. package/dist/src/node_modules/.pnpm/mimic-fn@2.1.0/node_modules/mimic-fn/index.js +0 -1
  1034. package/dist/src/node_modules/.pnpm/npm-run-path@4.0.1/node_modules/npm-run-path/index.js +0 -1
  1035. package/dist/src/node_modules/.pnpm/onetime@5.1.2/node_modules/onetime/index.js +0 -1
  1036. package/dist/src/node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js +0 -1
  1037. package/dist/src/node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js +0 -1
  1038. package/dist/src/node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js +0 -1
  1039. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js +0 -1
  1040. package/dist/src/node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js +0 -1
  1041. package/dist/src/node_modules/.pnpm/strip-final-newline@2.0.0/node_modules/strip-final-newline/index.js +0 -2
  1042. package/dist/src/node_modules/.pnpm/which@2.0.2/node_modules/which/which.js +0 -1
  1043. package/dist/src/protocol/activity.d.ts +0 -112
  1044. package/dist/src/protocol/activity.js +0 -1
  1045. package/dist/src/protocol/agent-handle-error.d.ts +0 -13
  1046. package/dist/src/protocol/agent-handle-error.js +0 -1
  1047. package/dist/src/public/channels/slack/activity-plan.d.ts +0 -5
  1048. package/dist/src/public/channels/slack/activity-plan.js +0 -1
  1049. package/dist/src/public/channels/slack/activity.d.ts +0 -63
  1050. package/dist/src/public/channels/slack/activity.js +0 -2
  1051. package/dist/src/public/tools/connection-search.d.ts +0 -1
  1052. package/dist/src/public/tools/connection-search.js +0 -1
  1053. package/dist/src/public/tools/task-cancel.d.ts +0 -1
  1054. package/dist/src/public/tools/task-cancel.js +0 -1
  1055. package/dist/src/runtime/prompt/connections.d.ts +0 -9
  1056. package/dist/src/runtime/prompt/connections.js +0 -2
  1057. package/dist/src/shared/boundary-hook-error.d.ts +0 -4
  1058. package/dist/src/shared/boundary-hook-error.js +0 -1
  1059. package/dist/src/shared/empty-delivery.d.ts +0 -3
  1060. package/dist/src/shared/empty-delivery.js +0 -1
  1061. package/dist/src/subagents/agent-handle-errors.d.ts +0 -25
  1062. package/dist/src/subagents/agent-handle-errors.js +0 -1
  1063. package/dist/src/subagents/callback-step.d.ts +0 -11
  1064. package/dist/src/subagents/callback-step.js +0 -1
  1065. package/dist/src/subagents/continuation-bundle.d.ts +0 -13
  1066. package/dist/src/subagents/continuation-bundle.js +0 -1
  1067. package/dist/src/subagents/handle-dispatch.d.ts +0 -65
  1068. package/dist/src/subagents/handle-dispatch.js +0 -1
  1069. package/dist/src/subagents/handles/operation-id.d.ts +0 -15
  1070. package/dist/src/subagents/handles/operation-id.js +0 -1
  1071. package/dist/src/subagents/handles/prompt.d.ts +0 -52
  1072. package/dist/src/subagents/handles/prompt.js +0 -3
  1073. package/dist/src/subagents/handles/query.d.ts +0 -41
  1074. package/dist/src/subagents/handles/query.js +0 -1
  1075. package/dist/src/subagents/handles/state-key.d.ts +0 -8
  1076. package/dist/src/subagents/handles/state-key.js +0 -1
  1077. package/dist/src/subagents/handles/store.d.ts +0 -217
  1078. package/dist/src/subagents/handles/store.js +0 -1
  1079. package/dist/src/subagents/handles/transitions.d.ts +0 -103
  1080. package/dist/src/subagents/handles/transitions.js +0 -1
  1081. package/dist/src/subagents/remote-dispatch.js +0 -1
  1082. package/dist/src/subagents/start-local.d.ts +0 -29
  1083. package/dist/src/subagents/start-local.js +0 -1
  1084. package/dist/src/subagents/start-remote.d.ts +0 -21
  1085. package/dist/src/subagents/start-remote.js +0 -1
  1086. package/dist/src/tasks/delivery-context.d.ts +0 -32
  1087. package/dist/src/tasks/delivery-context.js +0 -4
  1088. package/dist/src/tasks/delivery-policy.d.ts +0 -14
  1089. package/dist/src/tasks/delivery-policy.js +0 -1
  1090. package/dist/src/tasks/json.d.ts +0 -88
  1091. package/dist/src/tasks/json.js +0 -1
  1092. package/dist/src/tasks/notification.d.ts +0 -10
  1093. package/dist/src/tasks/notification.js +0 -1
  1094. package/dist/src/tasks/task-id.d.ts +0 -31
  1095. package/dist/src/tasks/task-id.js +0 -1
  1096. package/dist/src/tasks/task-inbox-token.d.ts +0 -2
  1097. package/dist/src/tasks/task-inbox-token.js +0 -1
  1098. package/dist/src/tasks/transitions.d.ts +0 -17
  1099. package/dist/src/tasks/transitions.js +0 -1
  1100. package/dist/src/tasks/types.d.ts +0 -136
  1101. package/dist/src/tasks/types.js +0 -1
  1102. package/dist/src/tools/framework/connection-search.d.ts +0 -3
  1103. package/dist/src/tools/framework/connection-search.js +0 -1
  1104. package/dist/src/tools/framework/task-cancel.d.ts +0 -4
  1105. package/dist/src/tools/framework/task-cancel.js +0 -1
  1106. package/dist/src/tools/framework/task-contract.d.ts +0 -19
  1107. package/dist/src/tools/framework/task-contract.js +0 -1
  1108. package/dist/src/tools/native-definition.d.ts +0 -7
  1109. package/dist/src/tools/native-definition.js +0 -1
  1110. package/dist/src/tracing/agent-invocation-terminal.d.ts +0 -18
  1111. package/dist/src/tracing/agent-invocation-terminal.js +0 -1
  1112. /package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-driver-source.d.ts +0 -0
  1113. /package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-driver-source.js +0 -0
  1114. /package/dist/src/{extensions/code → computer-use}/extension/tools/computer_use.d.ts +0 -0
  1115. /package/dist/src/execution/{tools/subagent → agent-sessions}/metadata.d.ts +0 -0
  1116. /package/dist/src/execution/{tools/subagent → agent-sessions}/metadata.js +0 -0
@@ -5,7 +5,7 @@ import{a as e,s as t,t as n}from"../../_chunks/workflow/rolldown-runtime-B_knIdu
5
5
  `),this.maxHeaderSize=t.maxHeaderSize??65536,this.maxBoundaryBuffer=t.maxBoundaryBuffer??8192}async*parseStream(e){let t=e.getReader(),n=new Pn,r=this.startProducer(t,n);try{yield*this.consumeMessages(n)}finally{n.cancel(),this.closeCurrentPayload();try{await t.cancel()}catch{}await r}}async startProducer(e,t){try{for(;!t.isTerminal;){let n;try{n=await e.read()}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.constructor.name===`AbortError`||e.name===`TimeoutError`||e.constructor.name===`TimeoutError`))break;throw e}let{done:r,value:i}=n;if(r){if(this.buffer!==null&&this.buffer.length>0){let e=this.write(new Uint8Array);for(let n of e){if(t.isTerminal)break;t.enqueue(n)}}if(this.state!==4)throw this.state===0?new F(`Invalid multipart stream: missing initial boundary`):new F(`Unexpected end of stream`);break}if(!(i instanceof Uint8Array))throw new F(`Invalid chunk type: expected Uint8Array, got ${typeof i}`);let a=this.write(i);for(let e of a){if(t.isTerminal)break;t.enqueue(e)}}t.isTerminal||t.finish()}catch(e){this.closeCurrentPayload(e),t.isTerminal||t.finish(e)}finally{try{e.releaseLock()}catch{}}}async*consumeMessages(e){for(;;){let t=await e.dequeue();if(t===null)break;yield t}}write(e){let t=[];if(this.state===4)throw new F(`Unexpected data after end of stream`);let n=0,r=e.length;if(this.buffer!==null){let t=this.buffer.length,n=t+r;if(this.state===2){if(n>this.maxHeaderSize)throw new F(`Buffer size limit exceeded: ${n} bytes > ${this.maxHeaderSize} bytes. This may indicate malformed multipart data with oversized headers.`)}else if(t>this.maxBoundaryBuffer)throw new F(`Boundary buffer limit exceeded: ${t} bytes > ${this.maxBoundaryBuffer} bytes. This may indicate malformed multipart data with invalid boundaries.`);let i=new Uint8Array(n);i.set(this.buffer,0),i.set(e,t),e=i,r=e.length,this.buffer=null}if(r===0&&this.state===0)throw new F(`Invalid multipart stream: missing initial boundary`);for(;;){if(this.state===3){if(r-n<this.boundaryLength){let t=e.subarray(n);if(t.length>this.maxBoundaryBuffer)throw new F(`Boundary buffer limit exceeded: ${t.length} > ${this.maxBoundaryBuffer}`);this.buffer=t;break}let t=this.findBoundary(e,n);if(t===-1){let t=this.findPartialTailBoundary(e);if(t===-1)this.writeBody(n===0?e:e.subarray(n));else{this.writeBody(e.subarray(n,t));let r=e.subarray(t);if(r.length>this.maxBoundaryBuffer)throw new F(`Partial boundary too large: ${r.length} > ${this.maxBoundaryBuffer}`);this.buffer=r}break}this.writeBody(e.subarray(n,t)),this.finishMessage(),n=t+this.boundaryLength,this.state=1}if(this.state===1){if(r-n<2){let t=e.subarray(n);if(t.length>this.maxBoundaryBuffer)throw new F(`After-boundary buffer limit exceeded: ${t.length} > ${this.maxBoundaryBuffer}`);this.buffer=t;break}if(e[n]===45&&e[n+1]===45){this.state=4;break}if(e[n]===13&&e[n+1]===10)n+=2;else if(e[n]===10)n+=1;else throw new F(`Invalid character after boundary: expected CRLF or LF, got 0x${e[n].toString(16)}`);this.state=2}if(this.state===2){if(r-n<4){let t=e.subarray(n);if(t.length>this.maxHeaderSize)throw new F(`Header buffer limit exceeded: ${t.length} > ${this.maxHeaderSize}`);this.buffer=t;break}let i=this.findDoubleNewline(e,n),a=4;if(i===-1&&(i=An(`
6
6
 
7
7
  `)(e,n),a=2),i===-1){let t=e.subarray(n);if(t.length>this.maxHeaderSize)throw new F(`Headers too large: ${t.length} > ${this.maxHeaderSize} bytes`);this.buffer=t;break}let o=e.subarray(n,i);this.currentHeaders=Mn(o);let s=this.createStreamingMessage();t.push(s),n=i+a,this.state=3;continue}if(this.state===0){if(r<this.openingBoundaryLength){if(e.length>this.maxBoundaryBuffer)throw new F(`Initial chunk too large for boundary detection: ${e.length} > ${this.maxBoundaryBuffer}`);this.buffer=e;break}if(this.findOpeningBoundary(e)!==0)throw new F(`Invalid multipart stream: missing initial boundary`);n=this.openingBoundaryLength,this.state=1}}return t}createStreamingMessage(){let e=new Headers(this.currentHeaders),t=new ReadableStream({start:e=>{this.currentPayloadController=e}});return this.currentHeaders=new Headers,{headers:e,payload:t}}writeBody(e){this.currentPayloadController&&this.currentPayloadController.enqueue(e)}finishMessage(){this.currentPayloadController&&=(this.currentPayloadController.close(),null)}closeCurrentPayload(e){if(this.currentPayloadController){try{e?this.currentPayloadController.error(e):this.currentPayloadController.close()}catch{}this.currentPayloadController=null}}};const Ln=(e,t,n)=>{let r=e instanceof RegExp?Rn(e,n):e,i=t instanceof RegExp?Rn(t,n):t,a=r!==null&&i!=null&&zn(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},Rn=(e,t)=>{let n=t.match(e);return n?n[0]:null},zn=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},Bn=`\0SLASH`+Math.random()+`\0`,Vn=`\0OPEN`+Math.random()+`\0`,Hn=`\0CLOSE`+Math.random()+`\0`,Un=`\0COMMA`+Math.random()+`\0`,Wn=`\0PERIOD`+Math.random()+`\0`,Gn=new RegExp(Bn,`g`),Kn=new RegExp(Vn,`g`),qn=new RegExp(Hn,`g`),Jn=new RegExp(Un,`g`),Yn=new RegExp(Wn,`g`),Xn=/\\\\/g,Zn=/\\{/g,Qn=/\\}/g,$n=/\\,/g,er=/\\\./g;function tr(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function nr(e){return e.replace(Xn,Bn).replace(Zn,Vn).replace(Qn,Hn).replace($n,Un).replace(er,Wn)}function rr(e){return e.replace(Gn,`\\`).replace(Kn,`{`).replace(qn,`}`).replace(Jn,`,`).replace(Yn,`.`)}function ir(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}function ar(e){let t=[],n=``;for(;;){let r=Ln(`{`,`}`,e);if(!r){let r=e.split(`,`);return r[0]=n+r[0],ir(t,r),t}let{pre:i,body:a,post:o}=r,s=i.split(`,`);if(s[0]=n+s[0],s[s.length-1]+=`{`+a+`}`,!o.length)return ir(t,s),t;n=s.pop(),ir(t,s),e=o}}function or(e,t={}){if(!e)return[];let{max:n=1e5,maxLength:r=4e6,maxDepth:i=1e3,maxRewrites:a=1e3}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),pr(nr(e),n,r,i,0,a,!0).map(rr)}function sr(e){return`{`+e+`}`}function cr(e){return/^-?0\d/.test(e)}function lr(e,t){return e<=t}function ur(e,t){return e>=t}function dr(e,t,n,r,i,a){let o=[],s=0;for(let c=0;c<e.length;c++)for(let l=0;l<n.length;l++){if(o.length>=r)return o;let u=e[c]+t+n[l];if(!a||u){if(s+u.length>i)return o;o.push(u),s+=u.length}}return o}function fr(e,t,n,r){let i=e.split(/\.\./),a=[];if(i[0]===void 0||i[1]===void 0)return a;let o=tr(i[0]),s=tr(i[1]),c=Math.max(i[0].length,i[1].length),l=i.length===3&&i[2]!==void 0?Math.max(Math.abs(tr(i[2])),1):1,u=lr;s<o&&(l*=-1,u=ur);let d=i.some(cr),f=0;for(let e=o;u(e,s)&&a.length<n;e+=l){let n;if(t)n=String.fromCharCode(e),n===`\\`&&(n=``);else if(n=String(e),d){let t=c-n.length;if(t>0){let r=Array(t+1).join(`0`);n=e<0?`-`+r+n.slice(1):r+n}}if(f+n.length>r)break;a.push(n),f+=n.length}return a}function pr(e,t,n,r,i,a,o){if(i>r)return[e];let s=[``],c=0,l=!1,u=!0;for(;;){let d=Ln(`{`,`}`,e);if(!d)return dr(s,e,[``],t,n,l);let f=d.pre;if(/\$$/.test(f)){if(s=dr(s,f+`{`+d.body+`}`,[``],t,n,l&&!d.post.length),u=!1,!d.post.length)break;e=d.post;continue}let p=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(d.body),m=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(d.body),h=p||m,g=d.body.indexOf(`,`)>=0;if(!h&&!g){if(c<a&&d.post.match(/,(?!,).*\}/)){c++,e=d.pre+`{`+d.body+Hn+d.post,o=!0;continue}return dr(s,f+`{`+d.body+`}`+d.post,[``],t,n,l)}u&&=(l=o&&!h,!1);let _;if(h)_=fr(d.body,m,t,n);else{let o=ar(d.body);if(o.length===1&&o[0]!==void 0&&(o=pr(o[0],t,n,r,i+1,a,!1).map(sr),o.length===1)){if(s=dr(s,f+o[0],[``],t,n,l&&!d.post.length),!d.post.length)break;e=d.post;continue}let c=l&&!d.post.length&&!f;for(let e=0;c&&e<s.length;e++)s[e]&&(c=!1);_=[];let u=0;outer:for(let e=0;e<o.length;e++){let s=pr(o[e],t,n,r,i+1,a,!1);for(let e=0;e<s.length;e++){let r=s[e];if(!c||r){if(_.length>=t||u+r.length>n)break outer;_.push(r),u+=r.length}}}}if(s=dr(s,f,_,t,n,l&&!d.post.length),!d.post.length)break;e=d.post}return s}const mr=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},hr={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},gr=e=>e.replace(/[[\]\\-]/g,`\\$&`),_r=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),vr=e=>e.join(``),yr=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(hr))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(gr(d)+`-`+gr(t)):t===d&&r.push(gr(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(gr(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(gr(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let e=r[0].length===2?r[0].slice(-1):r[0];return[_r(e),!1,u-n,!1]}let f=`[`+(l?`^`:``)+vr(r)+`]`,p=`[`+(l?``:`^`)+vr(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},br=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\])\]/g,`$1$2`).replace(/\\([^/])/g,`$1`):t?e.replace(/\[([^/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,`$1$2`).replace(/\\([^/{}])/g,`$1`);var I;const xr=new Set([`!`,`?`,`+`,`*`,`@`]),Sr=e=>xr.has(e),Cr=e=>Sr(e.type),wr=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),Tr=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),Er=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),Dr=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),Or=`(?!\\.)`,kr=new Set([`[`,`.`]),Ar=new Set([`..`,`.`]),jr=new Set(`().*{}+?[]^$\\!`),Mr=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),Nr=`[^/]+?`;let Pr=0;var Fr=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Pr;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.#l=this.type?this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof I&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof I&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new I(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&Sr(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new I(n,t);u=I.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new I(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&Sr(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new I(n,d);d.push(o),u=I.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new I(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,Tr)}#m(e,t=wr){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=Er){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new I(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!Dr.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=Dr.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new I(null,void 0,t);return I.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!Cr(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?I.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Ar.has(this.#r[0]))){let n=kr,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?`(?!(?:^|/)\\.\\.?(?:$|/))`:o?Or:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,br(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,br(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?Or:``)+Nr;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?Or:``)+`[^/]*?)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,br(i),this.#t=!!this.#t,this.#n]}#x(){if(Cr(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(jr.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?Nr:`[^/]*?`,t=!0;continue}if(o=!1,c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=yr(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=`[^/]`,t=!0;continue}i+=Mr(c)}return[i,br(e),!!t,a]}};I=Fr;const Ir=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),L=(e,t,n={})=>(mr(t),!n.nocomment&&t.charAt(0)===`#`?!1:new ci(t,n).match(e)),Lr=/^\*+([^+@!?*[(]*)$/,Rr=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),zr=e=>t=>t.endsWith(e),Br=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Vr=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Hr=/^\*+\.\*+$/,Ur=e=>!e.startsWith(`.`)&&e.includes(`.`),Wr=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Gr=/^\.\*+$/,Kr=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),qr=/^\*+$/,Jr=e=>e.length!==0&&!e.startsWith(`.`),Yr=e=>e.length!==0&&e!==`.`&&e!==`..`,Xr=/^\?+([^+@!?*[(]*)?$/,Zr=([e,t=``])=>{let n=ti([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Qr=([e,t=``])=>{let n=ni([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},$r=([e,t=``])=>{let n=ni([e]);return t?e=>n(e)&&e.endsWith(t):n},ei=([e,t=``])=>{let n=ti([e]);return t?e=>n(e)&&e.endsWith(t):n},ti=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},ni=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},ri=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,ii={win32:{sep:`\\`},posix:{sep:`/`}};L.sep=ri===`win32`?ii.win32.sep:ii.posix.sep;const R=Symbol(`globstar **`);L.GLOBSTAR=R,L.filter=(e,t={})=>n=>L(n,e,t);const z=(e,t={})=>Object.assign({},e,t);L.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return L;let t=L;return Object.assign((n,r,i={})=>t(n,r,z(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,z(e,n))}static defaults(n){return t.defaults(z(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,z(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,z(e,r))}},unescape:(n,r={})=>t.unescape(n,z(e,r)),escape:(n,r={})=>t.escape(n,z(e,r)),filter:(n,r={})=>t.filter(n,z(e,r)),defaults:n=>t.defaults(z(e,n)),makeRe:(n,r={})=>t.makeRe(n,z(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,z(e,r)),match:(n,r,i={})=>t.match(n,r,z(e,i)),sep:t.sep,GLOBSTAR:R})};const ai=(e,t={})=>(mr(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:or(e,{max:t.braceExpandMax}));L.braceExpand=ai,L.makeRe=(e,t={})=>new ci(e,t).makeRe(),L.match=(e,t,n={})=>{let r=new ci(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};const oi=/[?*]|[+@!]\(.*?\)|\[|\]/,si=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var ci=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){mr(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||ri,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!oi.test(e[2]))&&!oi.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t of e)for(let e=0;e<t.length;e++)t[e]===`**`&&(t[e]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];(n!==1||r!==``||e[0]!==``)&&(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];(e!==1||r!==``||n[0]!==``)&&(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(R)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(R,i),o=t.lastIndexOf(R),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===R?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===R)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return ai(this.pattern,this.options)}parse(e){mr(e);let t=this.options;if(e===`**`)return R;if(e===``)return``;let n,r=null;(n=e.match(qr))?r=t.dot?Yr:Jr:(n=e.match(Lr))?r=(t.nocase?t.dot?Vr:Br:t.dot?zr:Rr)(n[1]):(n=e.match(Xr))?r=(t.nocase?t.dot?Qr:Zr:t.dot?$r:ei)(n):(n=e.match(Hr))?r=t.dot?Wr:Ur:(n=e.match(Gr))&&(r=Kr);let i=Fr.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?`[^/]*?`:t.dot?`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`:`(?:(?!(?:\\/|^)\\.).)*?`,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?si(e):e===R?R:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e===R&&a!==R&&(a===void 0?i!==void 0&&i!==R?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==R&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=R))});let i=t.filter(e=>e!==R);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e of i){let i=r;if(n.matchBase&&e.length===1&&(i=[a]),this.matchOne(i,e,t))return n.flipNegate?!0:!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return L.defaults(e).Minimatch}};L.AST=Fr,L.Minimatch=ci,L.escape=Ir,L.unescape=br;var li=n(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),ui=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{version:()=>u}),t.exports=c(l);let u=`3.8.0`;0&&(t.exports={version:u})})),di=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{exchangeVercelOidcToken:()=>p}),t.exports=c(l);var u=ui();let d=new class{constructor(e){this.maxEntries=e,this.entries=new Map}get(e){let t=this.entries.get(e);if(t!==void 0){if(t.expiresAt<=Date.now()){this.entries.delete(e);return}return this.entries.delete(e),this.entries.set(e,t),t.token}}set({key:e,token:t,expiresAt:n}){for(this.entries.delete(e),this.entries.set(e,{token:t,expiresAt:n});this.entries.size>this.maxEntries;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}}(1e3);async function f(e){let t=JSON.stringify([e.token,e.audience,e.jti]),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function p(e){let t=await f(e);if(!e.skipCache){let e=d.get(t);if(e!==void 0)return e}let n=await fetch(`https://oidc.vercel.com/~token`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,"User-Agent":`@vercel/oidc@${u.version}`},body:JSON.stringify({token:e.token,aud:e.audience,...e.jti?{jti:e.jti}:void 0})});if(!n.ok)throw Error(`Failed to exchange token: ${await m(n)}`);let r;try{r=await n.json()}catch{throw Error(`Failed to exchange token: response was not valid JSON`)}if(!r||typeof r!=`object`||!(`token`in r)||typeof r.token!=`string`)throw Error(`Failed to exchange token: response did not contain a token`);let{token:i}=r,a=`expiry`in r&&typeof r.expiry==`number`?r.expiry:void 0;if(a!==void 0){let e=a*1e3;e>Date.now()&&d.set({key:t,token:i,expiresAt:e})}return i}async function m(e){try{let t=await e.json();if(t&&typeof t==`object`&&`error`in t&&typeof t.error==`string`)return t.error}catch{}return e.statusText||`HTTP ${e.status}`}0&&(t.exports={exchangeVercelOidcToken:p})})),fi=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),pi=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getVercelOidcTokenSync:()=>d}),t.exports=c(l);var u=fi();function d(){let e=(0,u.getContext)().headers?.[`x-vercel-oidc-token`]??process.env.VERCEL_OIDC_TOKEN;if(!e)throw Error(`The 'x-vercel-oidc-token' header is missing from the request.`);return e}0&&(t.exports={getVercelOidcTokenSync:d})})),mi=n(((e,n)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{getVercelOidcToken:()=>m}),n.exports=l(u);var d=di(),f=pi(),p=jt();async function m(e){let n=``,r;try{n=(0,f.getVercelOidcTokenSync)()}catch(e){r=e}try{let[{getTokenPayload:r,isExpired:i},{refreshToken:a}]=await Promise.all([await import(`../../_chunks/workflow/token-util-DaeRTzDa.js`).then(e=>t(e.t())),await import(`../../_chunks/workflow/token-BhlnqoHM.js`).then(e=>t(e.default))]);(!n||i(r(n),e?.expirationBufferMs))&&(await a(e),n=(0,f.getVercelOidcTokenSync)())}catch(e){let t=r instanceof Error?r.message:``;throw e instanceof Error&&(t=`${t}
8
- ${e.message}`),t?new p.VercelOidcTokenError(t):e}return e?.audience&&(n=await(0,d.exchangeVercelOidcToken)({token:n,audience:e.audience,jti:e.jti,skipCache:e.skipCache})),n}0&&(n.exports={getVercelOidcToken:m})})),hi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`);t.default=(e,t)=>(0,n.createHash)(e).update(t).digest()})),B=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decoder=e.encoder=void 0,e.concat=r,e.p2s=i,e.uint64be=o,e.uint32be=s,e.lengthAndInput=c,e.concatKdf=l;let t=hi();e.encoder=new TextEncoder,e.decoder=new TextDecoder;let n=2**32;function r(...e){let t=e.reduce((e,{length:t})=>e+t,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function i(t,n){return r(e.encoder.encode(t),new Uint8Array([0]),n)}function a(e,t,r){if(t<0||t>=n)throw RangeError(`value must be >= 0 and <= ${n-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,t&255],r)}function o(e){let t=Math.floor(e/n),r=e%n,i=new Uint8Array(8);return a(i,t,0),a(i,r,4),i}function s(e){let t=new Uint8Array(4);return a(t,e),t}function c(e){return r(s(e.length),e)}async function l(e,n,r){let i=Math.ceil((n>>3)/32),a=new Uint8Array(i*32);for(let n=0;n<i;n++){let i=new Uint8Array(4+e.length+r.length);i.set(s(n+1)),i.set(e,4),i.set(r,4+e.length),a.set(await(0,t.default)(`sha256`,i),n*32)}return a.slice(0,n>>3)}})),V=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=t.encodeBase64=t.decodeBase64=void 0;let n=e(`node:buffer`),r=B();function i(e){let t=e;return t instanceof Uint8Array&&(t=r.decoder.decode(t)),t}t.encode=e=>n.Buffer.from(e).toString(`base64url`),t.decodeBase64=e=>new Uint8Array(n.Buffer.from(e,`base64`)),t.encodeBase64=e=>n.Buffer.from(e).toString(`base64`),t.decode=e=>new Uint8Array(n.Buffer.from(i(e),`base64url`))})),H=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.JWSSignatureVerificationFailed=e.JWKSTimeout=e.JWKSMultipleMatchingKeys=e.JWKSNoMatchingKey=e.JWKSInvalid=e.JWKInvalid=e.JWTInvalid=e.JWSInvalid=e.JWEInvalid=e.JWEDecryptionFailed=e.JOSENotSupported=e.JOSEAlgNotAllowed=e.JWTExpired=e.JWTClaimValidationFailed=e.JOSEError=void 0;var t=class extends Error{static code=`ERR_JOSE_GENERIC`;code=`ERR_JOSE_GENERIC`;constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};e.JOSEError=t,e.JWTClaimValidationFailed=class extends t{static code=`ERR_JWT_CLAIM_VALIDATION_FAILED`;code=`ERR_JWT_CLAIM_VALIDATION_FAILED`;claim;reason;payload;constructor(e,t,n=`unspecified`,r=`unspecified`){super(e,{cause:{claim:n,reason:r,payload:t}}),this.claim=n,this.reason=r,this.payload=t}},e.JWTExpired=class extends t{static code=`ERR_JWT_EXPIRED`;code=`ERR_JWT_EXPIRED`;claim;reason;payload;constructor(e,t,n=`unspecified`,r=`unspecified`){super(e,{cause:{claim:n,reason:r,payload:t}}),this.claim=n,this.reason=r,this.payload=t}},e.JOSEAlgNotAllowed=class extends t{static code=`ERR_JOSE_ALG_NOT_ALLOWED`;code=`ERR_JOSE_ALG_NOT_ALLOWED`},e.JOSENotSupported=class extends t{static code=`ERR_JOSE_NOT_SUPPORTED`;code=`ERR_JOSE_NOT_SUPPORTED`},e.JWEDecryptionFailed=class extends t{static code=`ERR_JWE_DECRYPTION_FAILED`;code=`ERR_JWE_DECRYPTION_FAILED`;constructor(e=`decryption operation failed`,t){super(e,t)}},e.JWEInvalid=class extends t{static code=`ERR_JWE_INVALID`;code=`ERR_JWE_INVALID`},e.JWSInvalid=class extends t{static code=`ERR_JWS_INVALID`;code=`ERR_JWS_INVALID`},e.JWTInvalid=class extends t{static code=`ERR_JWT_INVALID`;code=`ERR_JWT_INVALID`},e.JWKInvalid=class extends t{static code=`ERR_JWK_INVALID`;code=`ERR_JWK_INVALID`},e.JWKSInvalid=class extends t{static code=`ERR_JWKS_INVALID`;code=`ERR_JWKS_INVALID`},e.JWKSNoMatchingKey=class extends t{static code=`ERR_JWKS_NO_MATCHING_KEY`;code=`ERR_JWKS_NO_MATCHING_KEY`;constructor(e=`no applicable key found in the JSON Web Key Set`,t){super(e,t)}},e.JWKSMultipleMatchingKeys=class extends t{[Symbol.asyncIterator];static code=`ERR_JWKS_MULTIPLE_MATCHING_KEYS`;code=`ERR_JWKS_MULTIPLE_MATCHING_KEYS`;constructor(e=`multiple matching keys found in the JSON Web Key Set`,t){super(e,t)}},e.JWKSTimeout=class extends t{static code=`ERR_JWKS_TIMEOUT`;code=`ERR_JWKS_TIMEOUT`;constructor(e=`request timed out`,t){super(e,t)}},e.JWSSignatureVerificationFailed=class extends t{static code=`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`;code=`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`;constructor(e=`signature verification failed`,t){super(e,t)}}})),gi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=e(`node:crypto`);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.randomFillSync}})})),_i=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bitLength=r;let t=H(),n=gi();function r(e){switch(e){case`A128GCM`:case`A128GCMKW`:case`A192GCM`:case`A192GCMKW`:case`A256GCM`:case`A256GCMKW`:return 96;case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return 128;default:throw new t.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}e.default=e=>(0,n.default)(new Uint8Array(r(e)>>3))})),vi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H(),n=_i();e.default=(e,r)=>{if(r.length<<3!==(0,n.bitLength)(e))throw new t.JWEInvalid(`Invalid Initialization Vector length`)}})),U=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:util`);t.default=e=>n.types.isKeyObject(e)})),yi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H(),n=U();e.default=(e,r)=>{let i;switch(e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:i=parseInt(e.slice(-3),10);break;case`A128GCM`:case`A192GCM`:case`A256GCM`:i=parseInt(e.slice(1,4),10);break;default:throw new t.JOSENotSupported(`Content Encryption Algorithm ${e} is not supported either by JOSE or your javascript runtime`)}if(r instanceof Uint8Array){let e=r.byteLength<<3;if(e!==i)throw new t.JWEInvalid(`Invalid Content Encryption Key length. Expected ${i} bits, got ${e} bits`);return}if((0,n.default)(r)&&r.type===`secret`){let e=r.symmetricKeySize<<3;if(e!==i)throw new t.JWEInvalid(`Invalid Content Encryption Key length. Expected ${i} bits, got ${e} bits`);return}throw TypeError(`Invalid Content Encryption Key type`)}})),bi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=e(`node:crypto`).timingSafeEqual})),xi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;let n=e(`node:crypto`),r=B();function i(e,t,i,a,o,s){let c=(0,r.concat)(e,t,i,(0,r.uint64be)(e.length<<3)),l=(0,n.createHmac)(`sha${a}`,o);return l.update(c),l.digest().slice(0,s>>3)}})),W=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isCryptoKey=void 0;let n=e(`node:crypto`),r=e(`node:util`);t.default=n.webcrypto,t.isCryptoKey=e=>r.types.isCryptoKey(e)})),Si=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkSigCryptoKey=o,e.checkEncCryptoKey=s;function t(e,t=`algorithm.name`){return TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function n(e,t){return e.name===t}function r(e){return parseInt(e.name.slice(4),10)}function i(e){switch(e){case`ES256`:return`P-256`;case`ES384`:return`P-384`;case`ES512`:return`P-521`;default:throw Error(`unreachable`)}}function a(e,t){if(t.length&&!t.some(t=>e.usages.includes(t))){let e=`CryptoKey does not support this operation, its usages must include `;if(t.length>2){let n=t.pop();e+=`one of ${t.join(`, `)}, or ${n}.`}else t.length===2?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw TypeError(e)}}function o(e,o,...s){switch(o){case`HS256`:case`HS384`:case`HS512`:{if(!n(e.algorithm,`HMAC`))throw t(`HMAC`);let i=parseInt(o.slice(2),10);if(r(e.algorithm.hash)!==i)throw t(`SHA-${i}`,`algorithm.hash`);break}case`RS256`:case`RS384`:case`RS512`:{if(!n(e.algorithm,`RSASSA-PKCS1-v1_5`))throw t(`RSASSA-PKCS1-v1_5`);let i=parseInt(o.slice(2),10);if(r(e.algorithm.hash)!==i)throw t(`SHA-${i}`,`algorithm.hash`);break}case`PS256`:case`PS384`:case`PS512`:{if(!n(e.algorithm,`RSA-PSS`))throw t(`RSA-PSS`);let i=parseInt(o.slice(2),10);if(r(e.algorithm.hash)!==i)throw t(`SHA-${i}`,`algorithm.hash`);break}case`EdDSA`:if(e.algorithm.name!==`Ed25519`&&e.algorithm.name!==`Ed448`)throw t(`Ed25519 or Ed448`);break;case`ES256`:case`ES384`:case`ES512`:{if(!n(e.algorithm,`ECDSA`))throw t(`ECDSA`);let r=i(o);if(e.algorithm.namedCurve!==r)throw t(r,`algorithm.namedCurve`);break}default:throw TypeError(`CryptoKey does not support this operation`)}a(e,s)}function s(e,i,...o){switch(i){case`A128GCM`:case`A192GCM`:case`A256GCM`:{if(!n(e.algorithm,`AES-GCM`))throw t(`AES-GCM`);let r=parseInt(i.slice(1,4),10);if(e.algorithm.length!==r)throw t(r,`algorithm.length`);break}case`A128KW`:case`A192KW`:case`A256KW`:{if(!n(e.algorithm,`AES-KW`))throw t(`AES-KW`);let r=parseInt(i.slice(1,4),10);if(e.algorithm.length!==r)throw t(r,`algorithm.length`);break}case`ECDH`:switch(e.algorithm.name){case`ECDH`:case`X25519`:case`X448`:break;default:throw t(`ECDH, X25519, or X448`)}break;case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:if(!n(e.algorithm,`PBKDF2`))throw t(`PBKDF2`);break;case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:{if(!n(e.algorithm,`RSA-OAEP`))throw t(`RSA-OAEP`);let a=parseInt(i.slice(9),10)||1;if(r(e.algorithm.hash)!==a)throw t(`SHA-${a}`,`algorithm.hash`);break}default:throw TypeError(`CryptoKey does not support this operation`)}a(e,o)}})),G=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.withAlg=n;function t(e,t,...n){if(n=n.filter(Boolean),n.length>2){let t=n.pop();e+=`one of type ${n.join(`, `)}, or ${t}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t==`function`&&t.name?e+=` Received function ${t.name}`:typeof t==`object`&&t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}e.default=(e,...n)=>t(`Key must be `,e,...n);function n(e,n,...r){return t(`Key for the ${e} algorithm must be `,n,...r)}})),Ci=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r;t.default=e=>(r||=new Set((0,n.getCiphers)()),r.has(e))})),K=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.types=void 0;let t=W(),n=U();e.default=e=>(0,n.default)(e)||(0,t.isCryptoKey)(e);let r=[`KeyObject`];e.types=r,(globalThis.CryptoKey||t.default?.CryptoKey)&&r.push(`CryptoKey`)})),wi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r=vi(),i=yi(),a=B(),o=H(),s=bi(),c=xi(),l=W(),u=Si(),d=U(),f=G(),p=Ci(),m=K();function h(e,t,r,i,l,u){let f=parseInt(e.slice(1,4),10);(0,d.default)(t)&&(t=t.export());let m=t.subarray(f>>3),h=t.subarray(0,f>>3),g=parseInt(e.slice(-3),10),_=`aes-${f}-cbc`;if(!(0,p.default)(_))throw new o.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);let v=(0,c.default)(u,i,r,g,h,f),y;try{y=(0,s.default)(l,v)}catch{}if(!y)throw new o.JWEDecryptionFailed;let b;try{let e=(0,n.createDecipheriv)(_,m,i);b=(0,a.concat)(e.update(r),e.final())}catch{}if(!b)throw new o.JWEDecryptionFailed;return b}function g(e,t,r,i,a,s){let c=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,p.default)(c))throw new o.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);try{let e=(0,n.createDecipheriv)(c,t,i,{authTagLength:16});e.setAuthTag(a),s.byteLength&&e.setAAD(s,{plaintextLength:r.length});let o=e.update(r);return e.final(),o}catch{throw new o.JWEDecryptionFailed}}t.default=(e,t,a,s,c,p)=>{let _;if((0,l.isCryptoKey)(t))(0,u.checkEncCryptoKey)(t,e,`decrypt`),_=n.KeyObject.from(t);else if(t instanceof Uint8Array||(0,d.default)(t))_=t;else throw TypeError((0,f.default)(t,...m.types,`Uint8Array`));if(!s)throw new o.JWEInvalid(`JWE Initialization Vector missing`);if(!c)throw new o.JWEInvalid(`JWE Authentication Tag missing`);switch((0,i.default)(e,_),(0,r.default)(e,s),e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return h(e,_,a,s,c,p);case`A128GCM`:case`A192GCM`:case`A256GCM`:return g(e,_,a,s,c,p);default:throw new o.JOSENotSupported(`Unsupported JWE Content Encryption Algorithm`)}}})),Ti=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=(...e)=>{let t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(let e of t){let t=Object.keys(e);if(!n||n.size===0){n=new Set(t);continue}for(let e of t){if(n.has(e))return!1;n.add(e)}}return!0}})),q=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;function t(e){return typeof e==`object`&&!!e}function n(e){if(!t(e)||Object.prototype.toString.call(e)!==`[object Object]`)return!1;if(Object.getPrototypeOf(e)===null)return!0;let n=e;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}})),Ei=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unwrap=t.wrap=void 0;let n=e(`node:buffer`),r=e(`node:crypto`),i=H(),a=B(),o=W(),s=Si(),c=U(),l=G(),u=Ci(),d=K();function f(e,t){if(e.symmetricKeySize<<3!==parseInt(t.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${t}`)}function p(e,t,n){if((0,c.default)(e))return e;if(e instanceof Uint8Array)return(0,r.createSecretKey)(e);if((0,o.isCryptoKey)(e))return(0,s.checkEncCryptoKey)(e,t,n),r.KeyObject.from(e);throw TypeError((0,l.default)(e,...d.types,`Uint8Array`))}t.wrap=(e,t,o)=>{let s=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,u.default)(s))throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);let c=p(t,e,`wrapKey`);f(c,e);let l=(0,r.createCipheriv)(s,c,n.Buffer.alloc(8,166));return(0,a.concat)(l.update(o),l.final())},t.unwrap=(e,t,o)=>{let s=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,u.default)(s))throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);let c=p(t,e,`unwrapKey`);f(c,e);let l=(0,r.createDecipheriv)(s,c,n.Buffer.alloc(8,166));return(0,a.concat)(l.update(o),l.final())}})),Di=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isJWK=n,e.isPrivateJWK=r,e.isPublicJWK=i,e.isSecretJWK=a;let t=q();function n(e){return(0,t.default)(e)&&typeof e.kty==`string`}function r(e){return e.kty!==`oct`&&typeof e.d==`string`}function i(e){return e.kty!==`oct`&&e.d===void 0}function a(e){return n(e)&&e.kty===`oct`&&typeof e.k==`string`}})),Oi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.weakMap=void 0;let n=e(`node:crypto`),r=H(),i=W(),a=U(),o=G(),s=K(),c=Di();t.weakMap=new WeakMap;let l=e=>{switch(e){case`prime256v1`:return`P-256`;case`secp384r1`:return`P-384`;case`secp521r1`:return`P-521`;case`secp256k1`:return`secp256k1`;default:throw new r.JOSENotSupported(`Unsupported key curve for this operation`)}};t.default=(e,t)=>{let r;if((0,i.isCryptoKey)(e))r=n.KeyObject.from(e);else if((0,a.default)(e))r=e;else if((0,c.isJWK)(e))return e.crv;else throw TypeError((0,o.default)(e,...s.types));if(r.type===`secret`)throw TypeError(`only "private" or "public" type keys can be used for this operation`);switch(r.asymmetricKeyType){case`ed25519`:case`ed448`:return`Ed${r.asymmetricKeyType.slice(2)}`;case`x25519`:case`x448`:return`X${r.asymmetricKeyType.slice(1)}`;case`ec`:{let e=r.asymmetricKeyDetails.namedCurve;return t?e:l(e)}default:throw TypeError(`Invalid asymmetric key type for this operation`)}}})),ki=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ecdhAllowed=void 0,t.deriveKey=p,t.generateEpk=m;let n=e(`node:crypto`),r=e(`node:util`),i=Oi(),a=B(),o=H(),s=W(),c=Si(),l=U(),u=G(),d=K(),f=(0,r.promisify)(n.generateKeyPair);async function p(e,t,r,i,o=new Uint8Array,f=new Uint8Array){let p;if((0,s.isCryptoKey)(e))(0,c.checkEncCryptoKey)(e,`ECDH`),p=n.KeyObject.from(e);else if((0,l.default)(e))p=e;else throw TypeError((0,u.default)(e,...d.types));let m;if((0,s.isCryptoKey)(t))(0,c.checkEncCryptoKey)(t,`ECDH`,`deriveBits`),m=n.KeyObject.from(t);else if((0,l.default)(t))m=t;else throw TypeError((0,u.default)(t,...d.types));let h=(0,a.concat)((0,a.lengthAndInput)(a.encoder.encode(r)),(0,a.lengthAndInput)(o),(0,a.lengthAndInput)(f),(0,a.uint32be)(i)),g=(0,n.diffieHellman)({privateKey:m,publicKey:p});return(0,a.concatKdf)(g,i,h)}async function m(e){let t;if((0,s.isCryptoKey)(e))t=n.KeyObject.from(e);else if((0,l.default)(e))t=e;else throw TypeError((0,u.default)(e,...d.types));switch(t.asymmetricKeyType){case`x25519`:return f(`x25519`);case`x448`:return f(`x448`);case`ec`:{let e=(0,i.default)(t);return f(`ec`,{namedCurve:e})}default:throw new o.JOSENotSupported(`Invalid or unsupported EPK`)}}t.ecdhAllowed=e=>[`P-256`,`P-384`,`P-521`,`X25519`,`X448`].includes((0,i.default)(e))})),Ai=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;let t=H();function n(e){if(!(e instanceof Uint8Array)||e.length<8)throw new t.JWEInvalid(`PBES2 Salt Input must be 8 or more octets`)}})),ji=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;let n=e(`node:util`),r=e(`node:crypto`),i=gi(),a=B(),o=V(),s=Ei(),c=Ai(),l=W(),u=Si(),d=U(),f=G(),p=K(),m=(0,n.promisify)(r.pbkdf2);function h(e,t){if((0,d.default)(e))return e.export();if(e instanceof Uint8Array)return e;if((0,l.isCryptoKey)(e))return(0,u.checkEncCryptoKey)(e,t,`deriveBits`,`deriveKey`),r.KeyObject.from(e).export();throw TypeError((0,f.default)(e,...p.types,`Uint8Array`))}t.encrypt=async(e,t,n,r=2048,l=(0,i.default)(new Uint8Array(16)))=>{(0,c.default)(l);let u=(0,a.p2s)(e,l),d=parseInt(e.slice(13,16),10)>>3,f=h(t,e),p=await m(f,u,r,d,`sha${e.slice(8,11)}`);return{encryptedKey:await(0,s.wrap)(e.slice(-6),p,n),p2c:r,p2s:(0,o.encode)(l)}},t.decrypt=async(e,t,n,r,i)=>{(0,c.default)(i);let o=(0,a.p2s)(e,i),l=parseInt(e.slice(13,16),10)>>3,u=h(t,e),d=await m(u,o,r,l,`sha${e.slice(8,11)}`);return(0,s.unwrap)(e.slice(-6),d,n)}})),Mi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`);t.default=(e,t)=>{let r;try{r=e instanceof n.KeyObject?e.asymmetricKeyDetails?.modulusLength:Buffer.from(e.n,`base64url`).byteLength<<3}catch{}if(typeof r!=`number`||r<2048)throw TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}})),Ni=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;let n=e(`node:crypto`),r=e(`node:util`),i=Mi(),a=W(),o=Si(),s=U(),c=G(),l=K(),u=(e,t)=>{if(e.asymmetricKeyType!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa`);(0,i.default)(e,t)},d=(0,r.deprecate)(()=>n.constants.RSA_PKCS1_PADDING,`The RSA1_5 "alg" (JWE Algorithm) is deprecated and will be removed in the next major revision.`),f=e=>{switch(e){case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:return n.constants.RSA_PKCS1_OAEP_PADDING;case`RSA1_5`:return d();default:return}},p=e=>{switch(e){case`RSA-OAEP`:return`sha1`;case`RSA-OAEP-256`:return`sha256`;case`RSA-OAEP-384`:return`sha384`;case`RSA-OAEP-512`:return`sha512`;default:return}};function m(e,t,...r){if((0,s.default)(e))return e;if((0,a.isCryptoKey)(e))return(0,o.checkEncCryptoKey)(e,t,...r),n.KeyObject.from(e);throw TypeError((0,c.default)(e,...l.types))}t.encrypt=(e,t,r)=>{let i=f(e),a=p(e),o=m(t,e,`wrapKey`,`encrypt`);return u(o,e),(0,n.publicEncrypt)({key:o,oaepHash:a,padding:i},r)},t.decrypt=(e,t,r)=>{let i=f(e),a=p(e),o=m(t,e,`unwrapKey`,`decrypt`);return u(o,e),(0,n.privateDecrypt)({key:o,oaepHash:a,padding:i},r)}})),Pi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={}})),Fi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bitLength=r;let t=H(),n=gi();function r(e){switch(e){case`A128GCM`:return 128;case`A192GCM`:return 192;case`A256GCM`:case`A128CBC-HS256`:return 256;case`A192CBC-HS384`:return 384;case`A256CBC-HS512`:return 512;default:throw new t.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}e.default=e=>(0,n.default)(new Uint8Array(r(e)>>3))})),Ii=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromX509=t.fromSPKI=t.fromPKCS8=t.toPKCS8=t.toSPKI=void 0;let n=e(`node:crypto`),r=e(`node:buffer`),i=W(),a=U(),o=G(),s=K(),c=(e,t,r)=>{let c;if((0,i.isCryptoKey)(r)){if(!r.extractable)throw TypeError(`CryptoKey is not extractable`);c=n.KeyObject.from(r)}else if((0,a.default)(r))c=r;else throw TypeError((0,o.default)(r,...s.types));if(c.type!==e)throw TypeError(`key is not a ${e} key`);return c.export({format:`pem`,type:t})};t.toSPKI=e=>c(`public`,`spki`,e),t.toPKCS8=e=>c(`private`,`pkcs8`,e),t.fromPKCS8=e=>(0,n.createPrivateKey)({key:r.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,``),`base64`),type:`pkcs8`,format:`der`}),t.fromSPKI=e=>(0,n.createPublicKey)({key:r.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,``),`base64`),type:`spki`,format:`der`}),t.fromX509=e=>(0,n.createPublicKey)({key:e,type:`spki`,format:`pem`})})),Li=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`);t.default=e=>e.d?(0,n.createPrivateKey)({format:`jwk`,key:e}):(0,n.createPublicKey)({format:`jwk`,key:e})})),Ri=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.importSPKI=o,e.importX509=s,e.importPKCS8=c,e.importJWK=l;let t=V(),n=Ii(),r=Li(),i=H(),a=q();async function o(e,t,r){if(typeof e!=`string`||e.indexOf(`-----BEGIN PUBLIC KEY-----`)!==0)throw TypeError(`"spki" must be SPKI formatted string`);return(0,n.fromSPKI)(e,t,r)}async function s(e,t,r){if(typeof e!=`string`||e.indexOf(`-----BEGIN CERTIFICATE-----`)!==0)throw TypeError(`"x509" must be X.509 formatted string`);return(0,n.fromX509)(e,t,r)}async function c(e,t,r){if(typeof e!=`string`||e.indexOf(`-----BEGIN PRIVATE KEY-----`)!==0)throw TypeError(`"pkcs8" must be PKCS#8 formatted string`);return(0,n.fromPKCS8)(e,t,r)}async function l(e,n){if(!(0,a.default)(e))throw TypeError(`JWK must be an object`);switch(n||=e.alg,e.kty){case`oct`:if(typeof e.k!=`string`||!e.k)throw TypeError(`missing "k" (Key Value) Parameter value`);return(0,t.decode)(e.k);case`RSA`:if(e.oth!==void 0)throw new i.JOSENotSupported(`RSA JWK "oth" (Other Primes Info) Parameter value is not supported`);case`EC`:case`OKP`:return(0,r.default)({...e,alg:n});default:throw new i.JOSENotSupported(`Unsupported "kty" (Key Type) Parameter value`)}}})),zi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkKeyTypeWithJwk=void 0;let t=G(),n=K(),r=Di(),i=e=>e?.[Symbol.toStringTag],a=(e,t,n)=>{if(t.use!==void 0&&t.use!==`sig`)throw TypeError(`Invalid key for this operation, when present its use must be sig`);if(t.key_ops!==void 0&&t.key_ops.includes?.(n)!==!0)throw TypeError(`Invalid key for this operation, when present its key_ops must include ${n}`);if(t.alg!==void 0&&t.alg!==e)throw TypeError(`Invalid key for this operation, when present its alg must be ${e}`);return!0},o=(e,o,s,c)=>{if(!(o instanceof Uint8Array)){if(c&&r.isJWK(o)){if(r.isSecretJWK(o)&&a(e,o,s))return;throw TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`)}if(!(0,n.default)(o))throw TypeError((0,t.withAlg)(e,o,...n.types,`Uint8Array`,c?`JSON Web Key`:null));if(o.type!==`secret`)throw TypeError(`${i(o)} instances for symmetric algorithms must be of type "secret"`)}},s=(e,o,s,c)=>{if(c&&r.isJWK(o))switch(s){case`sign`:if(r.isPrivateJWK(o)&&a(e,o,s))return;throw TypeError(`JSON Web Key for this operation be a private JWK`);case`verify`:if(r.isPublicJWK(o)&&a(e,o,s))return;throw TypeError(`JSON Web Key for this operation be a public JWK`)}if(!(0,n.default)(o))throw TypeError((0,t.withAlg)(e,o,...n.types,c?`JSON Web Key`:null));if(o.type===`secret`)throw TypeError(`${i(o)} instances for asymmetric algorithms must not be of type "secret"`);if(s===`sign`&&o.type===`public`)throw TypeError(`${i(o)} instances for asymmetric algorithm signing must be of type "private"`);if(s===`decrypt`&&o.type===`public`)throw TypeError(`${i(o)} instances for asymmetric algorithm decryption must be of type "private"`);if(o.algorithm&&s===`verify`&&o.type===`private`)throw TypeError(`${i(o)} instances for asymmetric algorithm verifying must be of type "public"`);if(o.algorithm&&s===`encrypt`&&o.type===`private`)throw TypeError(`${i(o)} instances for asymmetric algorithm encryption must be of type "public"`)};function c(e,t,n,r){t.startsWith(`HS`)||t===`dir`||t.startsWith(`PBES2`)||/^A\d{3}(?:GCM)?KW$/.test(t)?o(t,n,r,e):s(t,n,r,e)}e.default=c.bind(void 0,!1),e.checkKeyTypeWithJwk=c.bind(void 0,!0)})),Bi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r=vi(),i=yi(),a=B(),o=xi(),s=W(),c=Si(),l=U(),u=G(),d=_i(),f=H(),p=Ci(),m=K();function h(e,t,r,i,s){let c=parseInt(e.slice(1,4),10);(0,l.default)(r)&&(r=r.export());let u=r.subarray(c>>3),d=r.subarray(0,c>>3),m=`aes-${c}-cbc`;if(!(0,p.default)(m))throw new f.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);let h=(0,n.createCipheriv)(m,u,i),g=(0,a.concat)(h.update(t),h.final()),_=parseInt(e.slice(-3),10);return{ciphertext:g,tag:(0,o.default)(s,i,g,_,d,c),iv:i}}function g(e,t,r,i,a){let o=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,p.default)(o))throw new f.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);let s=(0,n.createCipheriv)(o,r,i,{authTagLength:16});a.byteLength&&s.setAAD(a,{plaintextLength:t.length});let c=s.update(t);return s.final(),{ciphertext:c,tag:s.getAuthTag(),iv:i}}t.default=(e,t,a,o,p)=>{let _;if((0,s.isCryptoKey)(a))(0,c.checkEncCryptoKey)(a,e,`encrypt`),_=n.KeyObject.from(a);else if(a instanceof Uint8Array||(0,l.default)(a))_=a;else throw TypeError((0,u.default)(a,...m.types,`Uint8Array`));switch((0,i.default)(e,_),o?(0,r.default)(e,o):o=(0,d.default)(e),e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return h(e,t,_,o,p);case`A128GCM`:case`A192GCM`:case`A256GCM`:return g(e,t,_,o,p);default:throw new f.JOSENotSupported(`Unsupported JWE Content Encryption Algorithm`)}}})),Vi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.wrap=i,e.unwrap=a;let t=Bi(),n=wi(),r=V();async function i(e,n,i,a){let o=e.slice(0,7),s=await(0,t.default)(o,i,n,a,new Uint8Array);return{encryptedKey:s.ciphertext,iv:(0,r.encode)(s.iv),tag:(0,r.encode)(s.tag)}}async function a(e,t,r,i,a){let o=e.slice(0,7);return(0,n.default)(o,t,r,i,a,new Uint8Array)}})),Hi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ei(),n=ki(),r=ji(),i=Ni(),a=V(),o=Pi(),s=H(),c=Fi(),l=Ri(),u=zi(),d=q(),f=Vi();async function p(e,p,m,h,g){switch((0,u.default)(e,p,`decrypt`),p=await o.default.normalizePrivateKey?.(p,e)||p,e){case`dir`:if(m!==void 0)throw new s.JWEInvalid(`Encountered unexpected JWE Encrypted Key`);return p;case`ECDH-ES`:if(m!==void 0)throw new s.JWEInvalid(`Encountered unexpected JWE Encrypted Key`);case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{if(!(0,d.default)(h.epk))throw new s.JWEInvalid(`JOSE Header "epk" (Ephemeral Public Key) missing or invalid`);if(!n.ecdhAllowed(p))throw new s.JOSENotSupported(`ECDH with the provided key is not allowed or not supported by your javascript runtime`);let r=await(0,l.importJWK)(h.epk,e),i,o;if(h.apu!==void 0){if(typeof h.apu!=`string`)throw new s.JWEInvalid(`JOSE Header "apu" (Agreement PartyUInfo) invalid`);try{i=(0,a.decode)(h.apu)}catch{throw new s.JWEInvalid(`Failed to base64url decode the apu`)}}if(h.apv!==void 0){if(typeof h.apv!=`string`)throw new s.JWEInvalid(`JOSE Header "apv" (Agreement PartyVInfo) invalid`);try{o=(0,a.decode)(h.apv)}catch{throw new s.JWEInvalid(`Failed to base64url decode the apv`)}}let u=await n.deriveKey(r,p,e===`ECDH-ES`?h.enc:e,e===`ECDH-ES`?(0,c.bitLength)(h.enc):parseInt(e.slice(-5,-2),10),i,o);if(e===`ECDH-ES`)return u;if(m===void 0)throw new s.JWEInvalid(`JWE Encrypted Key missing`);return(0,t.unwrap)(e.slice(-6),u,m)}case`RSA1_5`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:if(m===void 0)throw new s.JWEInvalid(`JWE Encrypted Key missing`);return(0,i.decrypt)(e,p,m);case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:{if(m===void 0)throw new s.JWEInvalid(`JWE Encrypted Key missing`);if(typeof h.p2c!=`number`)throw new s.JWEInvalid(`JOSE Header "p2c" (PBES2 Count) missing or invalid`);let t=g?.maxPBES2Count||1e4;if(h.p2c>t)throw new s.JWEInvalid(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`);if(typeof h.p2s!=`string`)throw new s.JWEInvalid(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`);let n;try{n=(0,a.decode)(h.p2s)}catch{throw new s.JWEInvalid(`Failed to base64url decode the p2s`)}return(0,r.decrypt)(e,p,m,h.p2c,n)}case`A128KW`:case`A192KW`:case`A256KW`:if(m===void 0)throw new s.JWEInvalid(`JWE Encrypted Key missing`);return(0,t.unwrap)(e,p,m);case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:{if(m===void 0)throw new s.JWEInvalid(`JWE Encrypted Key missing`);if(typeof h.iv!=`string`)throw new s.JWEInvalid(`JOSE Header "iv" (Initialization Vector) missing or invalid`);if(typeof h.tag!=`string`)throw new s.JWEInvalid(`JOSE Header "tag" (Authentication Tag) missing or invalid`);let t;try{t=(0,a.decode)(h.iv)}catch{throw new s.JWEInvalid(`Failed to base64url decode the iv`)}let n;try{n=(0,a.decode)(h.tag)}catch{throw new s.JWEInvalid(`Failed to base64url decode the tag`)}return(0,f.unwrap)(e,p,m,t,n)}default:throw new s.JOSENotSupported(`Invalid or unsupported "alg" (JWE Algorithm) header value`)}}e.default=p})),Ui=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H();function n(e,n,r,i,a){if(a.crit!==void 0&&i?.crit===void 0)throw new e(`"crit" (Critical) Header Parameter MUST be integrity protected`);if(!i||i.crit===void 0)return new Set;if(!Array.isArray(i.crit)||i.crit.length===0||i.crit.some(e=>typeof e!=`string`||e.length===0))throw new e(`"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present`);let o;o=r===void 0?n:new Map([...Object.entries(r),...n.entries()]);for(let n of i.crit){if(!o.has(n))throw new t.JOSENotSupported(`Extension Header Parameter "${n}" is not recognized`);if(a[n]===void 0)throw new e(`Extension Header Parameter "${n}" is missing`);if(o.get(n)&&i[n]===void 0)throw new e(`Extension Header Parameter "${n}" MUST be integrity protected`)}return new Set(i.crit)}e.default=n})),Wi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=(e,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(e=>typeof e!=`string`)))throw TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}})),Gi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.flattenedDecrypt=d;let t=V(),n=wi(),r=H(),i=Ti(),a=q(),o=Hi(),s=B(),c=Fi(),l=Ui(),u=Wi();async function d(e,d,f){if(!(0,a.default)(e))throw new r.JWEInvalid(`Flattened JWE must be an object`);if(e.protected===void 0&&e.header===void 0&&e.unprotected===void 0)throw new r.JWEInvalid(`JOSE Header missing`);if(e.iv!==void 0&&typeof e.iv!=`string`)throw new r.JWEInvalid(`JWE Initialization Vector incorrect type`);if(typeof e.ciphertext!=`string`)throw new r.JWEInvalid(`JWE Ciphertext missing or incorrect type`);if(e.tag!==void 0&&typeof e.tag!=`string`)throw new r.JWEInvalid(`JWE Authentication Tag incorrect type`);if(e.protected!==void 0&&typeof e.protected!=`string`)throw new r.JWEInvalid(`JWE Protected Header incorrect type`);if(e.encrypted_key!==void 0&&typeof e.encrypted_key!=`string`)throw new r.JWEInvalid(`JWE Encrypted Key incorrect type`);if(e.aad!==void 0&&typeof e.aad!=`string`)throw new r.JWEInvalid(`JWE AAD incorrect type`);if(e.header!==void 0&&!(0,a.default)(e.header))throw new r.JWEInvalid(`JWE Shared Unprotected Header incorrect type`);if(e.unprotected!==void 0&&!(0,a.default)(e.unprotected))throw new r.JWEInvalid(`JWE Per-Recipient Unprotected Header incorrect type`);let p;if(e.protected)try{let n=(0,t.decode)(e.protected);p=JSON.parse(s.decoder.decode(n))}catch{throw new r.JWEInvalid(`JWE Protected Header is invalid`)}if(!(0,i.default)(p,e.header,e.unprotected))throw new r.JWEInvalid(`JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint`);let m={...p,...e.header,...e.unprotected};if((0,l.default)(r.JWEInvalid,new Map,f?.crit,p,m),m.zip!==void 0)throw new r.JOSENotSupported(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`);let{alg:h,enc:g}=m;if(typeof h!=`string`||!h)throw new r.JWEInvalid(`missing JWE Algorithm (alg) in JWE Header`);if(typeof g!=`string`||!g)throw new r.JWEInvalid(`missing JWE Encryption Algorithm (enc) in JWE Header`);let _=f&&(0,u.default)(`keyManagementAlgorithms`,f.keyManagementAlgorithms),v=f&&(0,u.default)(`contentEncryptionAlgorithms`,f.contentEncryptionAlgorithms);if(_&&!_.has(h)||!_&&h.startsWith(`PBES2`))throw new r.JOSEAlgNotAllowed(`"alg" (Algorithm) Header Parameter value not allowed`);if(v&&!v.has(g))throw new r.JOSEAlgNotAllowed(`"enc" (Encryption Algorithm) Header Parameter value not allowed`);let y;if(e.encrypted_key!==void 0)try{y=(0,t.decode)(e.encrypted_key)}catch{throw new r.JWEInvalid(`Failed to base64url decode the encrypted_key`)}let b=!1;typeof d==`function`&&(d=await d(p,e),b=!0);let x;try{x=await(0,o.default)(h,d,y,m,f)}catch(e){if(e instanceof TypeError||e instanceof r.JWEInvalid||e instanceof r.JOSENotSupported)throw e;x=(0,c.default)(g)}let S,C;if(e.iv!==void 0)try{S=(0,t.decode)(e.iv)}catch{throw new r.JWEInvalid(`Failed to base64url decode the iv`)}if(e.tag!==void 0)try{C=(0,t.decode)(e.tag)}catch{throw new r.JWEInvalid(`Failed to base64url decode the tag`)}let w=s.encoder.encode(e.protected??``),ee;ee=e.aad===void 0?w:(0,s.concat)(w,s.encoder.encode(`.`),s.encoder.encode(e.aad));let te;try{te=(0,t.decode)(e.ciphertext)}catch{throw new r.JWEInvalid(`Failed to base64url decode the ciphertext`)}let ne={plaintext:await(0,n.default)(g,x,te,S,C,ee)};if(e.protected!==void 0&&(ne.protectedHeader=p),e.aad!==void 0)try{ne.additionalAuthenticatedData=(0,t.decode)(e.aad)}catch{throw new r.JWEInvalid(`Failed to base64url decode the aad`)}return e.unprotected!==void 0&&(ne.sharedUnprotectedHeader=e.unprotected),e.header!==void 0&&(ne.unprotectedHeader=e.header),b?{...ne,key:d}:ne}})),Ki=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.compactDecrypt=i;let t=Gi(),n=H(),r=B();async function i(e,i,a){if(e instanceof Uint8Array&&(e=r.decoder.decode(e)),typeof e!=`string`)throw new n.JWEInvalid(`Compact JWE must be a string or Uint8Array`);let{0:o,1:s,2:c,3:l,4:u,length:d}=e.split(`.`);if(d!==5)throw new n.JWEInvalid(`Invalid Compact JWE`);let f=await(0,t.flattenedDecrypt)({ciphertext:l,iv:c||void 0,protected:o,tag:u||void 0,encrypted_key:s||void 0},i,a),p={plaintext:f.plaintext,protectedHeader:f.protectedHeader};return typeof i==`function`?{...p,key:f.key}:p}})),qi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generalDecrypt=i;let t=Gi(),n=H(),r=q();async function i(e,i,a){if(!(0,r.default)(e))throw new n.JWEInvalid(`General JWE must be an object`);if(!Array.isArray(e.recipients)||!e.recipients.every(r.default))throw new n.JWEInvalid(`JWE Recipients missing or incorrect type`);if(!e.recipients.length)throw new n.JWEInvalid(`JWE Recipients has no members`);for(let n of e.recipients)try{return await(0,t.flattenedDecrypt)({aad:e.aad,ciphertext:e.ciphertext,encrypted_key:n.encrypted_key,header:n.header,iv:e.iv,protected:e.protected,tag:e.tag,unprotected:e.unprotected},i,a)}catch{}throw new n.JWEDecryptionFailed}})),Ji=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.unprotected=void 0,e.unprotected=Symbol()})),Yi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r=V(),i=H(),a=W(),o=U(),s=G(),c=K();t.default=e=>{let t;if((0,a.isCryptoKey)(e)){if(!e.extractable)throw TypeError(`CryptoKey is not extractable`);t=n.KeyObject.from(e)}else if((0,o.default)(e))t=e;else if(e instanceof Uint8Array)return{kty:`oct`,k:(0,r.encode)(e)};else throw TypeError((0,s.default)(e,...c.types,`Uint8Array`));if(t.type!==`secret`&&![`rsa`,`ec`,`ed25519`,`x25519`,`ed448`,`x448`].includes(t.asymmetricKeyType))throw new i.JOSENotSupported(`Unsupported key asymmetricKeyType`);return t.export({format:`jwk`})}})),Xi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.exportSPKI=i,e.exportPKCS8=a,e.exportJWK=o;let t=Ii(),n=Ii(),r=Yi();async function i(e){return(0,t.toSPKI)(e)}async function a(e){return(0,n.toPKCS8)(e)}async function o(e){return(0,r.default)(e)}})),Zi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ei(),n=ki(),r=ji(),i=Ni(),a=V(),o=Pi(),s=Fi(),c=H(),l=Xi(),u=zi(),d=Vi();async function f(e,f,p,m,h={}){let g,_,v;switch((0,u.default)(e,p,`encrypt`),p=await o.default.normalizePublicKey?.(p,e)||p,e){case`dir`:v=p;break;case`ECDH-ES`:case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{if(!n.ecdhAllowed(p))throw new c.JOSENotSupported(`ECDH with the provided key is not allowed or not supported by your javascript runtime`);let{apu:r,apv:i}=h,{epk:o}=h;o||=(await n.generateEpk(p)).privateKey;let{x:u,y:d,crv:y,kty:b}=await(0,l.exportJWK)(o),x=await n.deriveKey(p,o,e===`ECDH-ES`?f:e,e===`ECDH-ES`?(0,s.bitLength)(f):parseInt(e.slice(-5,-2),10),r,i);if(_={epk:{x:u,crv:y,kty:b}},b===`EC`&&(_.epk.y=d),r&&(_.apu=(0,a.encode)(r)),i&&(_.apv=(0,a.encode)(i)),e===`ECDH-ES`){v=x;break}v=m||(0,s.default)(f);let S=e.slice(-6);g=await(0,t.wrap)(S,x,v);break}case`RSA1_5`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:v=m||(0,s.default)(f),g=await(0,i.encrypt)(e,p,v);break;case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:{v=m||(0,s.default)(f);let{p2c:t,p2s:n}=h;({encryptedKey:g,..._}=await(0,r.encrypt)(e,p,v,t,n));break}case`A128KW`:case`A192KW`:case`A256KW`:v=m||(0,s.default)(f),g=await(0,t.wrap)(e,p,v);break;case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:{v=m||(0,s.default)(f);let{iv:t}=h;({encryptedKey:g,..._}=await(0,d.wrap)(e,p,v,t));break}default:throw new c.JOSENotSupported(`Invalid or unsupported "alg" (JWE Algorithm) header value`)}return{cek:v,encryptedKey:g,parameters:_}}e.default=f})),Qi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FlattenedEncrypt=void 0;let t=V(),n=Ji(),r=Bi(),i=Zi(),a=H(),o=Ti(),s=B(),c=Ui();e.FlattenedEncrypt=class{_plaintext;_protectedHeader;_sharedUnprotectedHeader;_unprotectedHeader;_aad;_cek;_iv;_keyManagementParameters;constructor(e){if(!(e instanceof Uint8Array))throw TypeError(`plaintext must be an instance of Uint8Array`);this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError(`setKeyManagementParameters can only be called once`);return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw TypeError(`setSharedUnprotectedHeader can only be called once`);return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError(`setContentEncryptionKey can only be called once`);return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError(`setInitializationVector can only be called once`);return this._iv=e,this}async encrypt(e,l){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new a.JWEInvalid(`either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()`);if(!(0,o.default)(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new a.JWEInvalid(`JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint`);let u={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if((0,c.default)(a.JWEInvalid,new Map,l?.crit,this._protectedHeader,u),u.zip!==void 0)throw new a.JOSENotSupported(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`);let{alg:d,enc:f}=u;if(typeof d!=`string`||!d)throw new a.JWEInvalid(`JWE "alg" (Algorithm) Header Parameter missing or invalid`);if(typeof f!=`string`||!f)throw new a.JWEInvalid(`JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid`);let p;if(this._cek&&(d===`dir`||d===`ECDH-ES`))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${d}`);let m;{let t;({cek:m,encryptedKey:p,parameters:t}=await(0,i.default)(d,f,e,this._cek,this._keyManagementParameters)),t&&(l&&n.unprotected in l?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...t}:this.setUnprotectedHeader(t):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...t}:this.setProtectedHeader(t))}let h,g,_;g=this._protectedHeader?s.encoder.encode((0,t.encode)(JSON.stringify(this._protectedHeader))):s.encoder.encode(``),this._aad?(_=(0,t.encode)(this._aad),h=(0,s.concat)(g,s.encoder.encode(`.`),s.encoder.encode(_))):h=g;let{ciphertext:v,tag:y,iv:b}=await(0,r.default)(f,this._plaintext,m,this._iv,h),x={ciphertext:(0,t.encode)(v)};return b&&(x.iv=(0,t.encode)(b)),y&&(x.tag=(0,t.encode)(y)),p&&(x.encrypted_key=(0,t.encode)(p)),_&&(x.aad=_),this._protectedHeader&&(x.protected=s.decoder.decode(g)),this._sharedUnprotectedHeader&&(x.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(x.header=this._unprotectedHeader),x}}})),$i=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GeneralEncrypt=void 0;let t=Qi(),n=Ji(),r=H(),i=Fi(),a=Ti(),o=Zi(),s=V(),c=Ui();var l=class{parent;unprotectedHeader;key;options;constructor(e,t,n){this.parent=e,this.key=t,this.options=n}setUnprotectedHeader(e){if(this.unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this.unprotectedHeader=e,this}addRecipient(...e){return this.parent.addRecipient(...e)}encrypt(...e){return this.parent.encrypt(...e)}done(){return this.parent}};e.GeneralEncrypt=class{_plaintext;_recipients=[];_protectedHeader;_unprotectedHeader;_aad;constructor(e){this._plaintext=e}addRecipient(e,t){let n=new l(this,e,{crit:t?.crit});return this._recipients.push(n),n}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setSharedUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}async encrypt(){if(!this._recipients.length)throw new r.JWEInvalid(`at least one recipient must be added`);if(this._recipients.length===1){let[e]=this._recipients,n=await new t.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(e.unprotectedHeader).encrypt(e.key,{...e.options}),r={ciphertext:n.ciphertext,iv:n.iv,recipients:[{}],tag:n.tag};return n.aad&&(r.aad=n.aad),n.protected&&(r.protected=n.protected),n.unprotected&&(r.unprotected=n.unprotected),n.encrypted_key&&(r.recipients[0].encrypted_key=n.encrypted_key),n.header&&(r.recipients[0].header=n.header),r}let e;for(let t=0;t<this._recipients.length;t++){let n=this._recipients[t];if(!(0,a.default)(this._protectedHeader,this._unprotectedHeader,n.unprotectedHeader))throw new r.JWEInvalid(`JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint`);let i={...this._protectedHeader,...this._unprotectedHeader,...n.unprotectedHeader},{alg:o}=i;if(typeof o!=`string`||!o)throw new r.JWEInvalid(`JWE "alg" (Algorithm) Header Parameter missing or invalid`);if(o===`dir`||o===`ECDH-ES`)throw new r.JWEInvalid(`"dir" and "ECDH-ES" alg may only be used with a single recipient`);if(typeof i.enc!=`string`||!i.enc)throw new r.JWEInvalid(`JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid`);if(!e)e=i.enc;else if(e!==i.enc)throw new r.JWEInvalid(`JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients`);if((0,c.default)(r.JWEInvalid,new Map,n.options.crit,this._protectedHeader,i),i.zip!==void 0)throw new r.JOSENotSupported(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`)}let l=(0,i.default)(e),u={ciphertext:``,iv:``,recipients:[],tag:``};for(let r=0;r<this._recipients.length;r++){let i=this._recipients[r],a={};u.recipients.push(a);let c={...this._protectedHeader,...this._unprotectedHeader,...i.unprotectedHeader}.alg.startsWith(`PBES2`)?2048+r:void 0;if(r===0){let e=await new t.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(l).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(i.unprotectedHeader).setKeyManagementParameters({p2c:c}).encrypt(i.key,{...i.options,[n.unprotected]:!0});u.ciphertext=e.ciphertext,u.iv=e.iv,u.tag=e.tag,e.aad&&(u.aad=e.aad),e.protected&&(u.protected=e.protected),e.unprotected&&(u.unprotected=e.unprotected),a.encrypted_key=e.encrypted_key,e.header&&(a.header=e.header);continue}let{encryptedKey:d,parameters:f}=await(0,o.default)(i.unprotectedHeader?.alg||this._protectedHeader?.alg||this._unprotectedHeader?.alg,e,i.key,l,{p2c:c});a.encrypted_key=(0,s.encode)(d),(i.unprotectedHeader||f)&&(a.header={...i.unprotectedHeader,...f})}return u}}})),ea=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;let t=H();function n(e){switch(e){case`PS256`:case`RS256`:case`ES256`:case`ES256K`:return`sha256`;case`PS384`:case`RS384`:case`ES384`:return`sha384`;case`PS512`:case`RS512`:case`ES512`:return`sha512`;case`EdDSA`:return;default:throw new t.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}})),ta=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;let n=e(`node:crypto`),r=Oi(),i=H(),a=Mi(),o=new Map([[`ES256`,`P-256`],[`ES256K`,`secp256k1`],[`ES384`,`P-384`],[`ES512`,`P-521`]]);function s(e,t){let s,c,l;if(t instanceof n.KeyObject)s=t.asymmetricKeyType,c=t.asymmetricKeyDetails;else switch(l=!0,t.kty){case`RSA`:s=`rsa`;break;case`EC`:s=`ec`;break;case`OKP`:if(t.crv===`Ed25519`){s=`ed25519`;break}if(t.crv===`Ed448`){s=`ed448`;break}throw TypeError(`Invalid key for this operation, its crv must be Ed25519 or Ed448`);default:throw TypeError(`Invalid key for this operation, its kty must be RSA, OKP, or EC`)}let u;switch(e){case`EdDSA`:if(![`ed25519`,`ed448`].includes(s))throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448`);break;case`RS256`:case`RS384`:case`RS512`:if(s!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa`);(0,a.default)(t,e);break;case`PS256`:case`PS384`:case`PS512`:if(s===`rsa-pss`){let{hashAlgorithm:t,mgf1HashAlgorithm:n,saltLength:r}=c,i=parseInt(e.slice(-3),10);if(t!==void 0&&(t!==`sha${i}`||n!==t))throw TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}`);if(r!==void 0&&r>i>>3)throw TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}`)}else if(s!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss`);(0,a.default)(t,e),u={padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST};break;case`ES256`:case`ES256K`:case`ES384`:case`ES512`:{if(s!==`ec`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be ec`);let n=(0,r.default)(t),i=o.get(e);if(n!==i)throw TypeError(`Invalid key curve for the algorithm, its curve must be ${i}, got ${n}`);u={dsaEncoding:`ieee-p1363`};break}default:throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}return l?{format:`jwk`,key:t,...u}:u?{...u,key:t}:t}})),na=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;let t=H();function n(e){switch(e){case`HS256`:return`sha256`;case`HS384`:return`sha384`;case`HS512`:return`sha512`;default:throw new t.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}})),ra=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;let n=e(`node:crypto`),r=W(),i=Si(),a=G(),o=K(),s=Di();function c(e,t,c){if(t instanceof Uint8Array){if(!e.startsWith(`HS`))throw TypeError((0,a.default)(t,...o.types));return(0,n.createSecretKey)(t)}if(t instanceof n.KeyObject)return t;if((0,r.isCryptoKey)(t))return(0,i.checkSigCryptoKey)(t,e,c),n.KeyObject.from(t);if(s.isJWK(t))return e.startsWith(`HS`)?(0,n.createSecretKey)(Buffer.from(t.k,`base64url`)):t;throw TypeError((0,a.default)(t,...o.types,`Uint8Array`,`JSON Web Key`))}})),ia=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r=e(`node:util`),i=ea(),a=na(),o=ta(),s=ra(),c=(0,r.promisify)(n.sign);t.default=async(e,t,r)=>{let l=(0,s.default)(e,t,`sign`);if(e.startsWith(`HS`)){let t=n.createHmac((0,a.default)(e),l);return t.update(r),t.digest()}return c((0,i.default)(e),r,(0,o.default)(e,l))}})),aa=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r=e(`node:util`),i=ea(),a=ta(),o=ia(),s=ra(),c=(0,r.promisify)(n.verify);t.default=async(e,t,r,l)=>{let u=(0,s.default)(e,t,`verify`);if(e.startsWith(`HS`)){let t=await(0,o.default)(e,u,l),i=r;try{return n.timingSafeEqual(i,t)}catch{return!1}}let d=(0,i.default)(e),f=(0,a.default)(e,u);try{return await c(d,l,f,r)}catch{return!1}}})),oa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.flattenedVerify=f;let t=V(),n=aa(),r=H(),i=B(),a=Ti(),o=q(),s=zi(),c=Ui(),l=Wi(),u=Di(),d=Ri();async function f(e,f,p){if(!(0,o.default)(e))throw new r.JWSInvalid(`Flattened JWS must be an object`);if(e.protected===void 0&&e.header===void 0)throw new r.JWSInvalid(`Flattened JWS must have either of the "protected" or "header" members`);if(e.protected!==void 0&&typeof e.protected!=`string`)throw new r.JWSInvalid(`JWS Protected Header incorrect type`);if(e.payload===void 0)throw new r.JWSInvalid(`JWS Payload missing`);if(typeof e.signature!=`string`)throw new r.JWSInvalid(`JWS Signature missing or incorrect type`);if(e.header!==void 0&&!(0,o.default)(e.header))throw new r.JWSInvalid(`JWS Unprotected Header incorrect type`);let m={};if(e.protected)try{let n=(0,t.decode)(e.protected);m=JSON.parse(i.decoder.decode(n))}catch{throw new r.JWSInvalid(`JWS Protected Header is invalid`)}if(!(0,a.default)(m,e.header))throw new r.JWSInvalid(`JWS Protected and JWS Unprotected Header Parameter names must be disjoint`);let h={...m,...e.header},g=(0,c.default)(r.JWSInvalid,new Map([[`b64`,!0]]),p?.crit,m,h),_=!0;if(g.has(`b64`)&&(_=m.b64,typeof _!=`boolean`))throw new r.JWSInvalid(`The "b64" (base64url-encode payload) Header Parameter must be a boolean`);let{alg:v}=h;if(typeof v!=`string`||!v)throw new r.JWSInvalid(`JWS "alg" (Algorithm) Header Parameter missing or invalid`);let y=p&&(0,l.default)(`algorithms`,p.algorithms);if(y&&!y.has(v))throw new r.JOSEAlgNotAllowed(`"alg" (Algorithm) Header Parameter value not allowed`);if(_){if(typeof e.payload!=`string`)throw new r.JWSInvalid(`JWS Payload must be a string`)}else if(typeof e.payload!=`string`&&!(e.payload instanceof Uint8Array))throw new r.JWSInvalid(`JWS Payload must be a string or an Uint8Array instance`);let b=!1;typeof f==`function`?(f=await f(m,e),b=!0,(0,s.checkKeyTypeWithJwk)(v,f,`verify`),(0,u.isJWK)(f)&&(f=await(0,d.importJWK)(f,v))):(0,s.checkKeyTypeWithJwk)(v,f,`verify`);let x=(0,i.concat)(i.encoder.encode(e.protected??``),i.encoder.encode(`.`),typeof e.payload==`string`?i.encoder.encode(e.payload):e.payload),S;try{S=(0,t.decode)(e.signature)}catch{throw new r.JWSInvalid(`Failed to base64url decode the signature`)}if(!await(0,n.default)(v,f,S,x))throw new r.JWSSignatureVerificationFailed;let C;if(_)try{C=(0,t.decode)(e.payload)}catch{throw new r.JWSInvalid(`Failed to base64url decode the payload`)}else C=typeof e.payload==`string`?i.encoder.encode(e.payload):e.payload;let w={payload:C};return e.protected!==void 0&&(w.protectedHeader=m),e.header!==void 0&&(w.unprotectedHeader=e.header),b?{...w,key:f}:w}})),sa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.compactVerify=i;let t=oa(),n=H(),r=B();async function i(e,i,a){if(e instanceof Uint8Array&&(e=r.decoder.decode(e)),typeof e!=`string`)throw new n.JWSInvalid(`Compact JWS must be a string or Uint8Array`);let{0:o,1:s,2:c,length:l}=e.split(`.`);if(l!==3)throw new n.JWSInvalid(`Invalid Compact JWS`);let u=await(0,t.flattenedVerify)({payload:s,protected:o,signature:c},i,a),d={payload:u.payload,protectedHeader:u.protectedHeader};return typeof i==`function`?{...d,key:u.key}:d}})),ca=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generalVerify=i;let t=oa(),n=H(),r=q();async function i(e,i,a){if(!(0,r.default)(e))throw new n.JWSInvalid(`General JWS must be an object`);if(!Array.isArray(e.signatures)||!e.signatures.every(r.default))throw new n.JWSInvalid(`JWS Signatures missing or incorrect type`);for(let n of e.signatures)try{return await(0,t.flattenedVerify)({header:n.header,payload:e.payload,protected:n.protected,signature:n.signature},i,a)}catch{}throw new n.JWSSignatureVerificationFailed}})),la=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=e=>Math.floor(e.getTime()/1e3)})),ua=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;e.default=e=>{let n=t.exec(e);if(!n||n[4]&&n[1])throw TypeError(`Invalid time period format`);let r=parseFloat(n[2]),i=n[3].toLowerCase(),a;switch(i){case`sec`:case`secs`:case`second`:case`seconds`:case`s`:a=Math.round(r);break;case`minute`:case`minutes`:case`min`:case`mins`:case`m`:a=Math.round(r*60);break;case`hour`:case`hours`:case`hr`:case`hrs`:case`h`:a=Math.round(r*3600);break;case`day`:case`days`:case`d`:a=Math.round(r*86400);break;case`week`:case`weeks`:case`w`:a=Math.round(r*604800);break;default:a=Math.round(r*31557600)}return n[1]===`-`||n[4]===`ago`?-a:a}})),da=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H(),n=B(),r=la(),i=ua(),a=q(),o=e=>e.toLowerCase().replace(/^application\//,``),s=(e,t)=>typeof e==`string`?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1;e.default=(e,c,l={})=>{let u;try{u=JSON.parse(n.decoder.decode(c))}catch{}if(!(0,a.default)(u))throw new t.JWTInvalid(`JWT Claims Set must be a top-level JSON object`);let{typ:d}=l;if(d&&(typeof e.typ!=`string`||o(e.typ)!==o(d)))throw new t.JWTClaimValidationFailed(`unexpected "typ" JWT header value`,u,`typ`,`check_failed`);let{requiredClaims:f=[],issuer:p,subject:m,audience:h,maxTokenAge:g}=l,_=[...f];g!==void 0&&_.push(`iat`),h!==void 0&&_.push(`aud`),m!==void 0&&_.push(`sub`),p!==void 0&&_.push(`iss`);for(let e of new Set(_.reverse()))if(!(e in u))throw new t.JWTClaimValidationFailed(`missing required "${e}" claim`,u,e,`missing`);if(p&&!(Array.isArray(p)?p:[p]).includes(u.iss))throw new t.JWTClaimValidationFailed(`unexpected "iss" claim value`,u,`iss`,`check_failed`);if(m&&u.sub!==m)throw new t.JWTClaimValidationFailed(`unexpected "sub" claim value`,u,`sub`,`check_failed`);if(h&&!s(u.aud,typeof h==`string`?[h]:h))throw new t.JWTClaimValidationFailed(`unexpected "aud" claim value`,u,`aud`,`check_failed`);let v;switch(typeof l.clockTolerance){case`string`:v=(0,i.default)(l.clockTolerance);break;case`number`:v=l.clockTolerance;break;case`undefined`:v=0;break;default:throw TypeError(`Invalid clockTolerance option type`)}let{currentDate:y}=l,b=(0,r.default)(y||new Date);if((u.iat!==void 0||g)&&typeof u.iat!=`number`)throw new t.JWTClaimValidationFailed(`"iat" claim must be a number`,u,`iat`,`invalid`);if(u.nbf!==void 0){if(typeof u.nbf!=`number`)throw new t.JWTClaimValidationFailed(`"nbf" claim must be a number`,u,`nbf`,`invalid`);if(u.nbf>b+v)throw new t.JWTClaimValidationFailed(`"nbf" claim timestamp check failed`,u,`nbf`,`check_failed`)}if(u.exp!==void 0){if(typeof u.exp!=`number`)throw new t.JWTClaimValidationFailed(`"exp" claim must be a number`,u,`exp`,`invalid`);if(u.exp<=b-v)throw new t.JWTExpired(`"exp" claim timestamp check failed`,u,`exp`,`check_failed`)}if(g){let e=b-u.iat,n=typeof g==`number`?g:(0,i.default)(g);if(e-v>n)throw new t.JWTExpired(`"iat" claim timestamp check failed (too far in the past)`,u,`iat`,`check_failed`);if(e<0-v)throw new t.JWTClaimValidationFailed(`"iat" claim timestamp check failed (it should be in the past)`,u,`iat`,`check_failed`)}return u}})),fa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.jwtVerify=i;let t=sa(),n=da(),r=H();async function i(e,i,a){let o=await(0,t.compactVerify)(e,i,a);if(o.protectedHeader.crit?.includes(`b64`)&&o.protectedHeader.b64===!1)throw new r.JWTInvalid(`JWTs MUST NOT use unencoded payload`);let s={payload:(0,n.default)(o.protectedHeader,o.payload,a),protectedHeader:o.protectedHeader};return typeof i==`function`?{...s,key:o.key}:s}})),pa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.jwtDecrypt=i;let t=Ki(),n=da(),r=H();async function i(e,i,a){let o=await(0,t.compactDecrypt)(e,i,a),s=(0,n.default)(o.protectedHeader,o.plaintext,a),{protectedHeader:c}=o;if(c.iss!==void 0&&c.iss!==s.iss)throw new r.JWTClaimValidationFailed(`replicated "iss" claim header parameter mismatch`,s,`iss`,`mismatch`);if(c.sub!==void 0&&c.sub!==s.sub)throw new r.JWTClaimValidationFailed(`replicated "sub" claim header parameter mismatch`,s,`sub`,`mismatch`);if(c.aud!==void 0&&JSON.stringify(c.aud)!==JSON.stringify(s.aud))throw new r.JWTClaimValidationFailed(`replicated "aud" claim header parameter mismatch`,s,`aud`,`mismatch`);let l={payload:s,protectedHeader:c};return typeof i==`function`?{...l,key:o.key}:l}})),ma=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CompactEncrypt=void 0;let t=Qi();e.CompactEncrypt=class{_flattened;constructor(e){this._flattened=new t.FlattenedEncrypt(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){let n=await this._flattened.encrypt(e,t);return[n.protected,n.encrypted_key,n.iv,n.ciphertext,n.tag].join(`.`)}}})),ha=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FlattenedSign=void 0;let t=V(),n=ia(),r=Ti(),i=H(),a=B(),o=zi(),s=Ui();e.FlattenedSign=class{_payload;_protectedHeader;_unprotectedHeader;constructor(e){if(!(e instanceof Uint8Array))throw TypeError(`payload must be an instance of Uint8Array`);this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}async sign(e,c){if(!this._protectedHeader&&!this._unprotectedHeader)throw new i.JWSInvalid(`either setProtectedHeader or setUnprotectedHeader must be called before #sign()`);if(!(0,r.default)(this._protectedHeader,this._unprotectedHeader))throw new i.JWSInvalid(`JWS Protected and JWS Unprotected Header Parameter names must be disjoint`);let l={...this._protectedHeader,...this._unprotectedHeader},u=(0,s.default)(i.JWSInvalid,new Map([[`b64`,!0]]),c?.crit,this._protectedHeader,l),d=!0;if(u.has(`b64`)&&(d=this._protectedHeader.b64,typeof d!=`boolean`))throw new i.JWSInvalid(`The "b64" (base64url-encode payload) Header Parameter must be a boolean`);let{alg:f}=l;if(typeof f!=`string`||!f)throw new i.JWSInvalid(`JWS "alg" (Algorithm) Header Parameter missing or invalid`);(0,o.checkKeyTypeWithJwk)(f,e,`sign`);let p=this._payload;d&&(p=a.encoder.encode((0,t.encode)(p)));let m;m=this._protectedHeader?a.encoder.encode((0,t.encode)(JSON.stringify(this._protectedHeader))):a.encoder.encode(``);let h=(0,a.concat)(m,a.encoder.encode(`.`),p),g=await(0,n.default)(f,e,h),_={signature:(0,t.encode)(g),payload:``};return d&&(_.payload=a.decoder.decode(p)),this._unprotectedHeader&&(_.header=this._unprotectedHeader),this._protectedHeader&&(_.protected=a.decoder.decode(m)),_}}})),ga=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CompactSign=void 0;let t=ha();e.CompactSign=class{_flattened;constructor(e){this._flattened=new t.FlattenedSign(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){let n=await this._flattened.sign(e,t);if(n.payload===void 0)throw TypeError(`use the flattened module for creating JWS with b64: false`);return`${n.protected}.${n.payload}.${n.signature}`}}})),_a=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GeneralSign=void 0;let t=ha(),n=H();var r=class{parent;protectedHeader;unprotectedHeader;options;key;constructor(e,t,n){this.parent=e,this.key=t,this.options=n}setProtectedHeader(e){if(this.protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this.protectedHeader=e,this}setUnprotectedHeader(e){if(this.unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this.unprotectedHeader=e,this}addSignature(...e){return this.parent.addSignature(...e)}sign(...e){return this.parent.sign(...e)}done(){return this.parent}};e.GeneralSign=class{_payload;_signatures=[];constructor(e){this._payload=e}addSignature(e,t){let n=new r(this,e,t);return this._signatures.push(n),n}async sign(){if(!this._signatures.length)throw new n.JWSInvalid(`at least one signature must be added`);let e={signatures:[],payload:``};for(let r=0;r<this._signatures.length;r++){let i=this._signatures[r],a=new t.FlattenedSign(this._payload);a.setProtectedHeader(i.protectedHeader),a.setUnprotectedHeader(i.unprotectedHeader);let{payload:o,...s}=await a.sign(i.key,i.options);if(r===0)e.payload=o;else if(e.payload!==o)throw new n.JWSInvalid(`inconsistent use of JWS Unencoded Payload (RFC7797)`);e.signatures.push(s)}return e}}})),va=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ProduceJWT=void 0;let t=la(),n=q(),r=ua();function i(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}e.ProduceJWT=class{_payload;constructor(e={}){if(!(0,n.default)(e))throw TypeError(`JWT Claims Set MUST be an object`);this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return this._payload=typeof e==`number`?{...this._payload,nbf:i(`setNotBefore`,e)}:e instanceof Date?{...this._payload,nbf:i(`setNotBefore`,(0,t.default)(e))}:{...this._payload,nbf:(0,t.default)(new Date)+(0,r.default)(e)},this}setExpirationTime(e){return this._payload=typeof e==`number`?{...this._payload,exp:i(`setExpirationTime`,e)}:e instanceof Date?{...this._payload,exp:i(`setExpirationTime`,(0,t.default)(e))}:{...this._payload,exp:(0,t.default)(new Date)+(0,r.default)(e)},this}setIssuedAt(e){return this._payload=e===void 0?{...this._payload,iat:(0,t.default)(new Date)}:e instanceof Date?{...this._payload,iat:i(`setIssuedAt`,(0,t.default)(e))}:typeof e==`string`?{...this._payload,iat:i(`setIssuedAt`,(0,t.default)(new Date)+(0,r.default)(e))}:{...this._payload,iat:i(`setIssuedAt`,e)},this}}})),ya=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SignJWT=void 0;let t=ga(),n=H(),r=B(),i=va();e.SignJWT=class extends i.ProduceJWT{_protectedHeader;setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,i){let a=new t.CompactSign(r.encoder.encode(JSON.stringify(this._payload)));if(a.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes(`b64`)&&this._protectedHeader.b64===!1)throw new n.JWTInvalid(`JWTs MUST NOT use unencoded payload`);return a.sign(e,i)}}})),ba=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EncryptJWT=void 0;let t=ma(),n=B(),r=va();e.EncryptJWT=class extends r.ProduceJWT{_cek;_iv;_keyManagementParameters;_protectedHeader;_replicateIssuerAsHeader;_replicateSubjectAsHeader;_replicateAudienceAsHeader;setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError(`setKeyManagementParameters can only be called once`);return this._keyManagementParameters=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError(`setContentEncryptionKey can only be called once`);return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError(`setInitializationVector can only be called once`);return this._iv=e,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(e,r){let i=new t.CompactEncrypt(n.encoder.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),i.setProtectedHeader(this._protectedHeader),this._iv&&i.setInitializationVector(this._iv),this._cek&&i.setContentEncryptionKey(this._cek),this._keyManagementParameters&&i.setKeyManagementParameters(this._keyManagementParameters),i.encrypt(e,r)}}})),xa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.calculateJwkThumbprint=s,e.calculateJwkThumbprintUri=c;let t=hi(),n=V(),r=H(),i=B(),a=q(),o=(e,t)=>{if(typeof e!=`string`||!e)throw new r.JWKInvalid(`${t} missing or invalid`)};async function s(e,s){if(!(0,a.default)(e))throw TypeError(`JWK must be an object`);if(s??=`sha256`,s!==`sha256`&&s!==`sha384`&&s!==`sha512`)throw TypeError(`digestAlgorithm must one of "sha256", "sha384", or "sha512"`);let c;switch(e.kty){case`EC`:o(e.crv,`"crv" (Curve) Parameter`),o(e.x,`"x" (X Coordinate) Parameter`),o(e.y,`"y" (Y Coordinate) Parameter`),c={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case`OKP`:o(e.crv,`"crv" (Subtype of Key Pair) Parameter`),o(e.x,`"x" (Public Key) Parameter`),c={crv:e.crv,kty:e.kty,x:e.x};break;case`RSA`:o(e.e,`"e" (Exponent) Parameter`),o(e.n,`"n" (Modulus) Parameter`),c={e:e.e,kty:e.kty,n:e.n};break;case`oct`:o(e.k,`"k" (Key Value) Parameter`),c={k:e.k,kty:e.kty};break;default:throw new r.JOSENotSupported(`"kty" (Key Type) Parameter missing or unsupported`)}let l=i.encoder.encode(JSON.stringify(c));return(0,n.encode)(await(0,t.default)(s,l))}async function c(e,t){t??=`sha256`;let n=await s(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${n}`}})),Sa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EmbeddedJWK=i;let t=Ri(),n=q(),r=H();async function i(e,i){let a={...e,...i?.header};if(!(0,n.default)(a.jwk))throw new r.JWSInvalid(`"jwk" (JSON Web Key) Header Parameter must be a JSON object`);let o=await(0,t.importJWK)({...a.jwk,ext:!0},a.alg);if(o instanceof Uint8Array||o.type!==`public`)throw new r.JWSInvalid(`"jwk" (JSON Web Key) Header Parameter must be a public key`);return o}})),Ca=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLocalJWKSet=u;let t=Ri(),n=H(),r=q();function i(e){switch(typeof e==`string`&&e.slice(0,2)){case`RS`:case`PS`:return`RSA`;case`ES`:return`EC`;case`Ed`:return`OKP`;default:throw new n.JOSENotSupported(`Unsupported "alg" value for a JSON Web Key Set`)}}function a(e){return e&&typeof e==`object`&&Array.isArray(e.keys)&&e.keys.every(o)}function o(e){return(0,r.default)(e)}function s(e){return typeof structuredClone==`function`?structuredClone(e):JSON.parse(JSON.stringify(e))}var c=class{_jwks;_cached=new WeakMap;constructor(e){if(!a(e))throw new n.JWKSInvalid(`JSON Web Key Set malformed`);this._jwks=s(e)}async getKey(e,t){let{alg:r,kid:a}={...e,...t?.header},o=i(r),s=this._jwks.keys.filter(e=>{let t=o===e.kty;if(t&&typeof a==`string`&&(t=a===e.kid),t&&typeof e.alg==`string`&&(t=r===e.alg),t&&typeof e.use==`string`&&(t=e.use===`sig`),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes(`verify`)),t&&r===`EdDSA`&&(t=e.crv===`Ed25519`||e.crv===`Ed448`),t)switch(r){case`ES256`:t=e.crv===`P-256`;break;case`ES256K`:t=e.crv===`secp256k1`;break;case`ES384`:t=e.crv===`P-384`;break;case`ES512`:t=e.crv===`P-521`}return t}),{0:c,length:u}=s;if(u===0)throw new n.JWKSNoMatchingKey;if(u!==1){let e=new n.JWKSMultipleMatchingKeys,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(let e of s)try{yield await l(t,e,r)}catch{}},e}return l(this._cached,c,r)}};async function l(e,r,i){let a=e.get(r)||e.set(r,{}).get(r);if(a[i]===void 0){let e=await(0,t.importJWK)({...r,ext:!0},i);if(e instanceof Uint8Array||e.type!==`public`)throw new n.JWKSInvalid(`JSON Web Key Set members must be public keys`);a[i]=e}return a[i]}function u(e){let t=new c(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>s(t._jwks),enumerable:!0,configurable:!1,writable:!1}}),n}})),wa=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:http`),r=e(`node:https`),i=e(`node:events`),a=H(),o=B();t.default=async(e,t,s)=>{let c;switch(e.protocol){case`https:`:c=r.get;break;case`http:`:c=n.get;break;default:throw TypeError(`Unsupported URL protocol.`)}let{agent:l,headers:u}=s,d=c(e.href,{agent:l,timeout:t,headers:u}),[f]=await Promise.race([(0,i.once)(d,`response`),(0,i.once)(d,`timeout`)]);if(!f)throw d.destroy(),new a.JWKSTimeout;if(f.statusCode!==200)throw new a.JOSEError(`Expected 200 OK from the JSON Web Key Set HTTP response`);let p=[];for await(let e of f)p.push(e);try{return JSON.parse(o.decoder.decode((0,o.concat)(...p)))}catch{throw new a.JOSEError(`Failed to parse the JSON Web Key Set HTTP response as JSON`)}}})),Ta=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.experimental_jwksCache=e.jwksCache=void 0,e.createRemoteJWKSet=l;let t=wa(),n=H(),r=Ca(),i=q();function a(){return typeof WebSocketPair<`u`||typeof navigator<`u`&&navigator.userAgent===`Cloudflare-Workers`||typeof EdgeRuntime<`u`&&EdgeRuntime===`vercel`}let o;(typeof navigator>`u`||!navigator.userAgent?.startsWith?.(`Mozilla/5.0 `))&&(o=`jose/v5.9.6`),e.jwksCache=Symbol();function s(e,t){return!(typeof e!=`object`||!e||!(`uat`in e)||typeof e.uat!=`number`||Date.now()-e.uat>=t||!(`jwks`in e)||!(0,i.default)(e.jwks)||!Array.isArray(e.jwks.keys)||!Array.prototype.every.call(e.jwks.keys,i.default))}var c=class{_url;_timeoutDuration;_cooldownDuration;_cacheMaxAge;_jwksTimestamp;_pendingFetch;_options;_local;_cache;constructor(t,n){if(!(t instanceof URL))throw TypeError(`url must be an instance of URL`);this._url=new URL(t.href),this._options={agent:n?.agent,headers:n?.headers},this._timeoutDuration=typeof n?.timeoutDuration==`number`?n?.timeoutDuration:5e3,this._cooldownDuration=typeof n?.cooldownDuration==`number`?n?.cooldownDuration:3e4,this._cacheMaxAge=typeof n?.cacheMaxAge==`number`?n?.cacheMaxAge:6e5,n?.[e.jwksCache]!==void 0&&(this._cache=n?.[e.jwksCache],s(n?.[e.jwksCache],this._cacheMaxAge)&&(this._jwksTimestamp=this._cache.uat,this._local=(0,r.createLocalJWKSet)(this._cache.jwks)))}coolingDown(){return typeof this._jwksTimestamp==`number`&&Date.now()<this._jwksTimestamp+this._cooldownDuration}fresh(){return typeof this._jwksTimestamp==`number`&&Date.now()<this._jwksTimestamp+this._cacheMaxAge}async getKey(e,t){(!this._local||!this.fresh())&&await this.reload();try{return await this._local(e,t)}catch(r){if(r instanceof n.JWKSNoMatchingKey&&this.coolingDown()===!1)return await this.reload(),this._local(e,t);throw r}}async reload(){this._pendingFetch&&a()&&(this._pendingFetch=void 0);let e=new Headers(this._options.headers);o&&!e.has(`User-Agent`)&&(e.set(`User-Agent`,o),this._options.headers=Object.fromEntries(e.entries())),this._pendingFetch||=(0,t.default)(this._url,this._timeoutDuration,this._options).then(e=>{this._local=(0,r.createLocalJWKSet)(e),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=e),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(e=>{throw this._pendingFetch=void 0,e}),await this._pendingFetch}};function l(e,t){let n=new c(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!n._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>n._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}e.experimental_jwksCache=e.jwksCache})),Ea=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UnsecuredJWT=void 0;let t=V(),n=B(),r=H(),i=da(),a=va();e.UnsecuredJWT=class extends a.ProduceJWT{encode(){return`${t.encode(JSON.stringify({alg:`none`}))}.${t.encode(JSON.stringify(this._payload))}.`}static decode(e,a){if(typeof e!=`string`)throw new r.JWTInvalid(`Unsecured JWT must be a string`);let{0:o,1:s,2:c,length:l}=e.split(`.`);if(l!==3||c!==``)throw new r.JWTInvalid(`Invalid Unsecured JWT`);let u;try{if(u=JSON.parse(n.decoder.decode(t.decode(o))),u.alg!==`none`)throw Error()}catch{throw new r.JWTInvalid(`Invalid Unsecured JWT`)}return{payload:(0,i.default)(u,t.decode(s),a),header:u}}}})),Da=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=void 0;let t=V();e.encode=t.encode,e.decode=t.decode})),Oa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decodeProtectedHeader=i;let t=Da(),n=B(),r=q();function i(e){let i;if(typeof e==`string`){let t=e.split(`.`);(t.length===3||t.length===5)&&([i]=t)}else if(typeof e==`object`&&e){if(`protected`in e)i=e.protected;else throw TypeError(`Token does not contain a Protected Header`)}try{if(typeof i!=`string`||!i)throw Error();let e=JSON.parse(n.decoder.decode((0,t.decode)(i)));if(!(0,r.default)(e))throw Error();return e}catch{throw TypeError(`Invalid Token or Protected Header formatting`)}}})),ka=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decodeJwt=a;let t=Da(),n=B(),r=q(),i=H();function a(e){if(typeof e!=`string`)throw new i.JWTInvalid(`JWTs must use Compact JWS serialization, JWT must be a string`);let{1:a,length:o}=e.split(`.`);if(o===5)throw new i.JWTInvalid(`Only JWTs using Compact JWS serialization can be decoded`);if(o!==3)throw new i.JWTInvalid(`Invalid JWT`);if(!a)throw new i.JWTInvalid(`JWTs must contain a payload`);let s;try{s=(0,t.decode)(a)}catch{throw new i.JWTInvalid(`Failed to base64url decode the payload`)}let c;try{c=JSON.parse(n.decoder.decode(s))}catch{throw new i.JWTInvalid(`Failed to parse the decoded payload as JSON`)}if(!(0,r.default)(c))throw new i.JWTInvalid(`Invalid JWT Claims Set`);return c}})),Aa=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateSecret=s,t.generateKeyPair=c;let n=e(`node:crypto`),r=e(`node:util`),i=gi(),a=H(),o=(0,r.promisify)(n.generateKeyPair);async function s(e,t){let r;switch(e){case`HS256`:case`HS384`:case`HS512`:case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:r=parseInt(e.slice(-3),10);break;case`A128KW`:case`A192KW`:case`A256KW`:case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:case`A128GCM`:case`A192GCM`:case`A256GCM`:r=parseInt(e.slice(1,4),10);break;default:throw new a.JOSENotSupported(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`)}return(0,n.createSecretKey)((0,i.default)(new Uint8Array(r>>3)))}async function c(e,t){switch(e){case`RS256`:case`RS384`:case`RS512`:case`PS256`:case`PS384`:case`PS512`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:case`RSA1_5`:{let e=t?.modulusLength??2048;if(typeof e!=`number`||e<2048)throw new a.JOSENotSupported(`Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used`);return await o(`rsa`,{modulusLength:e,publicExponent:65537})}case`ES256`:return o(`ec`,{namedCurve:`P-256`});case`ES256K`:return o(`ec`,{namedCurve:`secp256k1`});case`ES384`:return o(`ec`,{namedCurve:`P-384`});case`ES512`:return o(`ec`,{namedCurve:`P-521`});case`EdDSA`:switch(t?.crv){case void 0:case`Ed25519`:return o(`ed25519`);case`Ed448`:return o(`ed448`);default:throw new a.JOSENotSupported(`Invalid or unsupported crv option provided, supported values are Ed25519 and Ed448`)}case`ECDH-ES`:case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{let e=t?.crv??`P-256`;switch(e){case void 0:case`P-256`:case`P-384`:case`P-521`:return o(`ec`,{namedCurve:e});case`X25519`:return o(`x25519`);case`X448`:return o(`x448`);default:throw new a.JOSENotSupported(`Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448`)}}default:throw new a.JOSENotSupported(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`)}}})),ja=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateKeyPair=n;let t=Aa();async function n(e,n){return(0,t.generateKeyPair)(e,n)}})),Ma=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateSecret=n;let t=Aa();async function n(e,n){return(0,t.generateSecret)(e,n)}})),Na=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=`node:crypto`})),Pa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=Na().default})),Fa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.cryptoRuntime=e.base64url=e.generateSecret=e.generateKeyPair=e.errors=e.decodeJwt=e.decodeProtectedHeader=e.importJWK=e.importX509=e.importPKCS8=e.importSPKI=e.exportJWK=e.exportSPKI=e.exportPKCS8=e.UnsecuredJWT=e.experimental_jwksCache=e.jwksCache=e.createRemoteJWKSet=e.createLocalJWKSet=e.EmbeddedJWK=e.calculateJwkThumbprintUri=e.calculateJwkThumbprint=e.EncryptJWT=e.SignJWT=e.GeneralSign=e.FlattenedSign=e.CompactSign=e.FlattenedEncrypt=e.CompactEncrypt=e.jwtDecrypt=e.jwtVerify=e.generalVerify=e.flattenedVerify=e.compactVerify=e.GeneralEncrypt=e.generalDecrypt=e.flattenedDecrypt=e.compactDecrypt=void 0;var t=Ki();Object.defineProperty(e,"compactDecrypt",{enumerable:!0,get:function(){return t.compactDecrypt}});var n=Gi();Object.defineProperty(e,"flattenedDecrypt",{enumerable:!0,get:function(){return n.flattenedDecrypt}});var r=qi();Object.defineProperty(e,"generalDecrypt",{enumerable:!0,get:function(){return r.generalDecrypt}});var i=$i();Object.defineProperty(e,"GeneralEncrypt",{enumerable:!0,get:function(){return i.GeneralEncrypt}});var a=sa();Object.defineProperty(e,"compactVerify",{enumerable:!0,get:function(){return a.compactVerify}});var o=oa();Object.defineProperty(e,"flattenedVerify",{enumerable:!0,get:function(){return o.flattenedVerify}});var s=ca();Object.defineProperty(e,"generalVerify",{enumerable:!0,get:function(){return s.generalVerify}});var c=fa();Object.defineProperty(e,"jwtVerify",{enumerable:!0,get:function(){return c.jwtVerify}});var l=pa();Object.defineProperty(e,"jwtDecrypt",{enumerable:!0,get:function(){return l.jwtDecrypt}});var u=ma();Object.defineProperty(e,"CompactEncrypt",{enumerable:!0,get:function(){return u.CompactEncrypt}});var d=Qi();Object.defineProperty(e,"FlattenedEncrypt",{enumerable:!0,get:function(){return d.FlattenedEncrypt}});var f=ga();Object.defineProperty(e,"CompactSign",{enumerable:!0,get:function(){return f.CompactSign}});var p=ha();Object.defineProperty(e,"FlattenedSign",{enumerable:!0,get:function(){return p.FlattenedSign}});var m=_a();Object.defineProperty(e,"GeneralSign",{enumerable:!0,get:function(){return m.GeneralSign}});var h=ya();Object.defineProperty(e,"SignJWT",{enumerable:!0,get:function(){return h.SignJWT}});var g=ba();Object.defineProperty(e,"EncryptJWT",{enumerable:!0,get:function(){return g.EncryptJWT}});var _=xa();Object.defineProperty(e,"calculateJwkThumbprint",{enumerable:!0,get:function(){return _.calculateJwkThumbprint}}),Object.defineProperty(e,"calculateJwkThumbprintUri",{enumerable:!0,get:function(){return _.calculateJwkThumbprintUri}});var v=Sa();Object.defineProperty(e,"EmbeddedJWK",{enumerable:!0,get:function(){return v.EmbeddedJWK}});var y=Ca();Object.defineProperty(e,"createLocalJWKSet",{enumerable:!0,get:function(){return y.createLocalJWKSet}});var b=Ta();Object.defineProperty(e,"createRemoteJWKSet",{enumerable:!0,get:function(){return b.createRemoteJWKSet}}),Object.defineProperty(e,"jwksCache",{enumerable:!0,get:function(){return b.jwksCache}}),Object.defineProperty(e,"experimental_jwksCache",{enumerable:!0,get:function(){return b.experimental_jwksCache}});var x=Ea();Object.defineProperty(e,"UnsecuredJWT",{enumerable:!0,get:function(){return x.UnsecuredJWT}});var S=Xi();Object.defineProperty(e,"exportPKCS8",{enumerable:!0,get:function(){return S.exportPKCS8}}),Object.defineProperty(e,"exportSPKI",{enumerable:!0,get:function(){return S.exportSPKI}}),Object.defineProperty(e,"exportJWK",{enumerable:!0,get:function(){return S.exportJWK}});var C=Ri();Object.defineProperty(e,"importSPKI",{enumerable:!0,get:function(){return C.importSPKI}}),Object.defineProperty(e,"importPKCS8",{enumerable:!0,get:function(){return C.importPKCS8}}),Object.defineProperty(e,"importX509",{enumerable:!0,get:function(){return C.importX509}}),Object.defineProperty(e,"importJWK",{enumerable:!0,get:function(){return C.importJWK}});var w=Oa();Object.defineProperty(e,"decodeProtectedHeader",{enumerable:!0,get:function(){return w.decodeProtectedHeader}});var ee=ka();Object.defineProperty(e,"decodeJwt",{enumerable:!0,get:function(){return ee.decodeJwt}}),e.errors=H();var te=ja();Object.defineProperty(e,"generateKeyPair",{enumerable:!0,get:function(){return te.generateKeyPair}});var ne=Ma();Object.defineProperty(e,"generateSecret",{enumerable:!0,get:function(){return ne.generateSecret}}),e.base64url=Da();var re=Pa();Object.defineProperty(e,"cryptoRuntime",{enumerable:!0,get:function(){return re.default}})})),Ia=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{verifyVercelOidcToken:()=>h}),t.exports=c(l);var u=Fa();let d=`https://oidc.vercel.com`,f=new URL(`https://oidc.vercel.com/.well-known/jwks`),p=[`RS256`],m=(0,u.createRemoteJWKSet)(f);async function h(e,t){let{algorithms:n,projectId:r=process.env.VERCEL_PROJECT_ID,environment:i=process.env.VERCEL_TARGET_ENV||process.env.VERCEL_ENV,ownerId:a,...o}=t??{};if(r===`*`&&a===void 0&&!g(o.audience))throw TypeError(`Expected ownerId or audience to be provided when projectId is '*'.`);let s=await(0,u.jwtVerify)(e,m,{...o,algorithms:n??p});return _(s.payload.iss),v({actual:s.payload.project_id,claim:`project_id`,env:`VERCEL_PROJECT_ID`,expected:r,option:`projectId`}),v({actual:s.payload.environment,claim:`environment`,env:`VERCEL_TARGET_ENV or VERCEL_ENV`,expected:i,option:`environment`}),y({actual:s.payload.owner_id,claim:`owner_id`,expected:a}),s}function g(e){return Array.isArray(e)?e.length>0:e!==void 0}function _(e){if(e!==d&&(typeof e!=`string`||!e.startsWith(`${d}/`)))throw TypeError(`Expected Vercel OIDC token iss claim to be "${d}" or to start with "${d}/".`)}function v({actual:e,claim:t,env:n,expected:r,option:i}){if(r!==`*`){if(r===void 0||r.length===0)throw TypeError(`Expected ${n} to be set or ${i} to be provided. Pass ${i}: '*' to allow any ${t} claim.`);if(!(Array.isArray(r)&&typeof e==`string`&&r.includes(e))&&e!==r)throw TypeError(Array.isArray(r)?`Expected Vercel OIDC token ${t} claim to be one of: ${r.map(e=>`"${e}"`).join(`, `)}.`:`Expected Vercel OIDC token ${t} claim to be "${r}".`)}}function y({actual:e,claim:t,expected:n}){if(n!==void 0&&e!==n)throw TypeError(`Expected Vercel OIDC token ${t} claim to be "${n}".`)}0&&(t.exports={verifyVercelOidcToken:h})})),La=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>m.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>m.RefreshAccessTokenFailedError,exchangeVercelOidcToken:()=>h.exchangeVercelOidcToken,getContext:()=>f.getContext,getVercelOidcToken:()=>u.getVercelOidcToken,getVercelOidcTokenSync:()=>d.getVercelOidcTokenSync,getVercelToken:()=>g.getVercelToken,verifyVercelOidcToken:()=>p.verifyVercelOidcToken}),t.exports=c(l);var u=mi(),d=pi(),f=fi(),p=Ia(),m=Mt(),h=di(),g=Nt();0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,exchangeVercelOidcToken,getContext,getVercelOidcToken,getVercelOidcTokenSync,getVercelToken,verifyVercelOidcToken})})),Ra=t(li(),1),za=La();async function Ba(e){let t=0,n=e.getReader(),r=[];try{for(;;){let{done:e,value:i}=await n.read();if(e)break;r.push(i),t+=i.length}}finally{n.releaseLock()}return Buffer.concat(r,t)}var Va=class{contentType=`application/json`;replacer;reviver;constructor(e={}){this.replacer=e.replacer,this.reviver=e.reviver}serialize(e){return Buffer.from(JSON.stringify(e,this.replacer),`utf8`)}async deserialize(e){let t=await Ba(e);return JSON.parse(t.toString(`utf8`),this.reviver)}},Ha=class extends Error{constructor(e){super(`Message ${e} not found`),this.name=`MessageNotFoundError`}},Ua=class extends Error{constructor(e,t){super(`Message ${e} not available for processing${t?`: ${t}`:``}`),this.name=`MessageNotAvailableError`}},Wa=class extends Error{constructor(e,t){super(`Message ${e} is corrupted: ${t}`),this.name=`MessageCorruptedError`}},Ga=class extends Error{retryAfter;constructor(e=`Too many requests`,t){super(e),this.name=`TooManyRequestsError`,this.retryAfter=t}},Ka=class extends Error{constructor(e=`Missing or invalid authentication token`){super(e),this.name=`UnauthorizedError`}},qa=class extends Error{constructor(e=`Queue environment doesn't match token environment`){super(e),this.name=`ForbiddenError`}},Ja=class extends Error{constructor(e){super(e),this.name=`BadRequestError`}},Ya=class extends Error{constructor(e=`Unexpected server error`){super(e),this.name=`InternalServerError`}},Xa=class extends Error{constructor(e,t=1,n=10){super(`Invalid limit: ${e}. Limit must be between ${t} and ${n}.`),this.name=`InvalidLimitError`}},Za=class extends Error{constructor(e){super(`Message ${e} has already been processed`),this.name=`MessageAlreadyProcessedError`}},Qa=class extends Error{deploymentId;constructor(e,t){super(e),this.name=`ConsumerDiscoveryError`,this.deploymentId=t}},$a=class extends Error{constructor(e=`Consumer registry not configured`){super(e),this.name=`ConsumerRegistryNotConfiguredError`}},eo=300,to=30,no=60,ro=10,io=3e3,ao=3,oo=250;function so(e){return Math.min(no,Math.max(ro,e/5))}var co=class{client;topicName;consumerGroupName;visibilityTimeout;constructor(e,t,n,r={}){this.client=e,this.topicName=t,this.consumerGroupName=n,this.visibilityTimeout=Math.max(to,r.visibilityTimeoutSeconds??eo)}isClientError(e){return e instanceof Ua||e instanceof Ha||e instanceof Ja||e instanceof Ka||e instanceof qa}isNetworkError(e){return e instanceof TypeError}async directiveCallWithRetries(e){let t;for(let n=1;n<=ao;n++)try{return await e()}catch(e){if(t=e,n===ao)throw e;if(e instanceof Ga){if(e.retryAfter===void 0)throw e;await new Promise(t=>setTimeout(t,e.retryAfter*1e3));continue}if(!this.isNetworkError(e))throw e;let r=oo*n,i=r/2+r/2*Math.random();await new Promise(e=>setTimeout(e,i))}throw t}startVisibilityExtension(e,t){let n=!0,r=!1,i,a=null,o=so(this.visibilityTimeout)*1e3,s=o;if(t?.visibilityDeadline){let e=t.visibilityDeadline.getTime()-Date.now();s=e>0?so(e/1e3)*1e3:0}let c=new Promise(e=>{i=e}),l=()=>{r||(r=!0,i())},u=async()=>{if(!n){l();return}try{await this.client.changeVisibility({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e,visibilityTimeoutSeconds:this.visibilityTimeout}),n?a=setTimeout(()=>u(),o):l()}catch(t){if(this.isClientError(t)){console.error(`Visibility extension failed with client error for receipt handle ${e} (stopping retries):`,t),l();return}console.error(`Failed to extend visibility for receipt handle ${e} (will retry in ${io/1e3}s):`,t),n?a=setTimeout(()=>u(),io):l()}};return a=setTimeout(()=>u(),s),async(e=!1)=>{n=!1,a&&=(clearTimeout(a),null),e?await c:l()}}async finalizePayload(e){let t=this.client.getTransport();if(t.finalize&&e!=null)try{await t.finalize(e)}catch(e){console.warn(`Failed to finalize message payload:`,e)}}async processMessage(e,t,n){let r=this.startVisibilityExtension(e.receiptHandle,n),i={messageId:e.messageId,deliveryCount:e.deliveryCount,createdAt:e.createdAt,expiresAt:e.expiresAt??new Date(e.createdAt.getTime()+864e5),topicName:this.topicName,consumerGroup:this.consumerGroupName,region:this.client.getRegion()};try{await t(e.payload,i),await r(),await this.client.acknowledgeMessage({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle})}catch(t){if(await r(),n?.retry){let r;try{r=n.retry(t,i)}catch(e){console.warn(`retry handler threw:`,e)}if(r){if(`acknowledge`in r&&r.acknowledge){try{await this.directiveCallWithRetries(()=>this.client.acknowledgeMessage({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle}))}catch(e){console.warn(`Failed to acknowledge message:`,e)}await this.finalizePayload(e.payload);return}if(`afterSeconds`in r&&typeof r.afterSeconds==`number`){try{await this.directiveCallWithRetries(()=>this.client.changeVisibility({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle,visibilityTimeoutSeconds:r.afterSeconds}))}catch(e){console.warn(`Failed to reschedule message for retry:`,e)}await this.finalizePayload(e.payload);return}}}throw await this.finalizePayload(e.payload),t}}async consumeMessage(e,t,n){await this.processMessage(t,e,n)}async consume(e,t){let n=t?.retry;if(t&&`messageId`in t){let r=await this.client.receiveMessageById({queueName:this.topicName,consumerGroup:this.consumerGroupName,messageId:t.messageId,visibilityTimeoutSeconds:this.visibilityTimeout});return await this.processMessage(r.message,e,{retry:n}),1}{let r=t&&`limit`in t?t.limit:1,i=0;for await(let t of this.client.receiveMessages({queueName:this.topicName,consumerGroup:this.consumerGroupName,visibilityTimeoutSeconds:this.visibilityTimeout,limit:r}))i++,await this.processMessage(t,e,{retry:n});return i}}get name(){return this.consumerGroupName}get topic(){return this.topicName}},lo=class{client;topicName;constructor(e,t){this.client=e,this.topicName=t}async publish(e,t){let n=await this.client.sendMessage({queueName:this.topicName,payload:e,idempotencyKey:t?.idempotencyKey,retentionSeconds:t?.retentionSeconds,delaySeconds:t?.delaySeconds,headers:t?.headers,telemetry:t?.telemetry});return n.messageId&&X()&&cs(this.topicName,n.messageId,this.client.getRegion(),t?.delaySeconds,t?.retentionSeconds),{messageId:n.messageId}}consumerGroup(e,t){return new co(this.client,this.topicName,e,t)}get name(){return this.topicName}},uo=`com.vercel.queue.v1beta`,fo=`com.vercel.queue.v2beta`;function po(e,t){let n=t.slice(0,-1);return e.startsWith(n)}function mo(e){return typeof e==`object`&&!!e}function ho(e,t){if(!t||!t.includes(`application/cloudevents+json`))throw Error(`Invalid content type: expected 'application/cloudevents+json'`);if(!mo(e)||!e.type||!e.source||!e.id||!mo(e.data))throw Error(`Invalid CloudEvent: missing required fields`);if(e.type!==`com.vercel.queue.v1beta`)throw Error(`Invalid CloudEvent type: expected '${uo}', got '${String(e.type)}'`);let{data:n}=e,r=[];if(`queueName`in n||r.push(`queueName`),`consumerGroup`in n||r.push(`consumerGroup`),`messageId`in n||r.push(`messageId`),r.length>0)throw Error(`Missing required CloudEvent data fields: ${r.join(`, `)}`);return{queueName:String(n.queueName),consumerGroup:String(n.consumerGroup),messageId:String(n.messageId)}}function J(e,t){if(e instanceof Headers)return e.get(t);let n=e[t];return Array.isArray(n)?n[0]??null:n??null}function go(e){let t=J(e,`ce-type`);if(t!==`com.vercel.queue.v2beta`)throw Error(`Invalid CloudEvent type: expected '${fo}', got '${t}'`);let n=J(e,`ce-vqsqueuename`),r=J(e,`ce-vqsconsumergroup`),i=J(e,`ce-vqsmessageid`),a=[];if(n||a.push(`ce-vqsqueuename`),r||a.push(`ce-vqsconsumergroup`),i||a.push(`ce-vqsmessageid`),a.length>0)throw Error(`Missing required CloudEvent headers: ${a.join(`, `)}`);let o=J(e,`ce-vqsregion`)??void 0;if(o!==void 0&&!/^[a-z]{2,5}[0-9]{1,2}$/.test(o))throw Error(`Invalid ce-vqsregion header: ${JSON.stringify(o)}. Region must match /^[a-z]{2,5}[0-9]{1,2}$/ (e.g. "iad1", "lhr1").`);let s={queueName:n,consumerGroup:r,messageId:i,region:o},c=J(e,`ce-vqsreceipthandle`);if(!c)return s;let l={...s,receiptHandle:c},u=J(e,`ce-vqsdeliverycount`);u&&(l.deliveryCount=parseInt(u,10));let d=J(e,`ce-vqscreatedat`);d&&(l.createdAt=d);let f=J(e,`ce-vqsexpiresat`);f&&(l.expiresAt=f);let p=J(e,`content-type`);p&&(l.contentType=p);let m=J(e,`ce-vqsvisibilitydeadline`);return m&&(l.visibilityDeadline=m),l}function _o(e,t){if(J(t,`ce-type`)===`com.vercel.queue.v2beta`){let n=go(t);return`receiptHandle`in n&&(n.parsedPayload=e),n}return ho(e,J(t,`content-type`))}async function vo(e){if(e.headers.get(`ce-type`)===`com.vercel.queue.v2beta`){let t=go(e.headers);return`receiptHandle`in t&&e.body&&(t.rawBody=e.body),t}let t;try{t=await e.json()}catch{throw Error(`Failed to parse CloudEvent from request body`)}let n={};return e.headers.forEach((e,t)=>{n[t]=e}),_o(t,n)}async function yo(e,t,n){let{queueName:r,consumerGroup:i,messageId:a}=t;if(!n?.client)throw Error(`HandleCallbackOptions.client is required`);let o=Us(n.client);t.region&&(o=o.withRegion(t.region));let s=new lo(o,r).consumerGroup(i,n?.visibilityTimeoutSeconds===void 0?void 0:{visibilityTimeoutSeconds:n.visibilityTimeoutSeconds});if(`receiptHandle`in t){let r=o.getTransport(),i;if(t.rawBody)i=await r.deserialize(t.rawBody);else if(t.parsedPayload!==void 0)i=t.parsedPayload;else throw Error(`Binary mode callback with receipt handle is missing payload`);let c={messageId:a,payload:i,deliveryCount:t.deliveryCount??1,createdAt:t.createdAt?new Date(t.createdAt):new Date,expiresAt:t.expiresAt?new Date(t.expiresAt):void 0,contentType:t.contentType??r.contentType,receiptHandle:t.receiptHandle},l=t.visibilityDeadline?new Date(t.visibilityDeadline):void 0;await s.consumeMessage(e,c,{visibilityDeadline:l,retry:n?.retry})}else await s.consume(e,{messageId:a,retry:n?.retry})}var Y=Ra.default.cyan(`[queue]`),bo=Ra.default.green(`✓`),xo=Ra.default.red(`✗`),So=Ra.default.yellow(`↻`);function X(){return process.env.NODE_ENV===`development`&&process.env.VERCEL_DEPLOYMENT_ID===void 0}var Z=Symbol.for(`@vercel/queue.devRouteMappings`);function Co(e){let t=``;for(let n of e)n===`_`?t+=`__`:n===`/`?t+=`_S`:n===`.`?t+=`_D`:/[A-Za-z0-9-]/.test(n)?t+=n:t+=`_`+n.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`);return t}function wo(){let e=globalThis;if(Z in e)return e[Z]??null;try{let t=j.join(process.cwd(),`vercel.json`);if(!Bt.existsSync(t))return e[Z]=null,null;let n=JSON.parse(Bt.readFileSync(t,`utf-8`));if(!n.functions)return e[Z]=null,null;let r=[];for(let[e,t]of Object.entries(n.functions))if(t.experimentalTriggers){for(let n of t.experimentalTriggers)if(n.type?.startsWith(`queue/`)&&n.topic){if(n.type!==`queue/v2beta`){console.warn(`${Y} Unsupported trigger type "${n.type}" for topic "${n.topic}" in ${e}. Use "queue/v2beta" instead.`);continue}r.push({filePath:e,topic:n.topic,consumer:Co(e),retryAfterSeconds:n.retryAfterSeconds})}}return e[Z]=r.length>0?r:null,e[Z]}catch(t){return console.warn(`${Y} Failed to read vercel.json:`,t),e[Z]=null,null}}function To(e){let t=wo();return t?t.filter(t=>t.topic.includes(`*`)?po(e,t.topic):t.topic===e):[]}function Eo(e,t){return To(e).find(e=>e.consumer===t)?.retryAfterSeconds}function Do(e){return/^src\/(app|pages|server)\//.test(e)?e.slice(4):null}function Oo(e,t){return e===t||L(e,t)}function ko(e){let t=wo();if(!t)return[];let n=process.cwd(),r;try{r=j.relative(n,e)}catch{return[]}let i=r.replace(/\\/g,`/`),a=Do(i);return t.filter(e=>Oo(i,e.filePath)||a!==null&&Oo(a,e.filePath))}function Ao(e){let t=e.match(/\((.+?):\d+:\d+\)/);if(t||=e.match(/at\s+(.+?):\d+:\d+/),!t)return null;let n=t[1].trim();if(n===`native`||n.startsWith(`node:`)||n.startsWith(`internal`))return null;if(n.startsWith(`file://`))try{n=new URL(n).pathname}catch{return null}return/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(n)?null:(n.startsWith(`./`)&&(n=n.slice(2)),n)}var jo;function Mo(){if(jo)return jo;try{let e=typeof __dirname<`u`?__dirname:j.dirname(new URL(import.meta.url).pathname);jo=j.resolve(e,`..`)}catch{jo=``}return jo}function No(){let e=Error().stack;if(!e)return null;let t=e.split(`
8
+ ${e.message}`),t?new p.VercelOidcTokenError(t):e}return e?.audience&&(n=await(0,d.exchangeVercelOidcToken)({token:n,audience:e.audience,jti:e.jti,skipCache:e.skipCache})),n}0&&(n.exports={getVercelOidcToken:m})})),hi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`);t.default=(e,t)=>(0,n.createHash)(e).update(t).digest()})),B=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decoder=e.encoder=void 0,e.concat=r,e.p2s=i,e.uint64be=o,e.uint32be=s,e.lengthAndInput=c,e.concatKdf=l;let t=hi();e.encoder=new TextEncoder,e.decoder=new TextDecoder;let n=2**32;function r(...e){let t=e.reduce((e,{length:t})=>e+t,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function i(t,n){return r(e.encoder.encode(t),new Uint8Array([0]),n)}function a(e,t,r){if(t<0||t>=n)throw RangeError(`value must be >= 0 and <= ${n-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,t&255],r)}function o(e){let t=Math.floor(e/n),r=e%n,i=new Uint8Array(8);return a(i,t,0),a(i,r,4),i}function s(e){let t=new Uint8Array(4);return a(t,e),t}function c(e){return r(s(e.length),e)}async function l(e,n,r){let i=Math.ceil((n>>3)/32),a=new Uint8Array(i*32);for(let n=0;n<i;n++){let i=new Uint8Array(4+e.length+r.length);i.set(s(n+1)),i.set(e,4),i.set(r,4+e.length),a.set(await(0,t.default)(`sha256`,i),n*32)}return a.slice(0,n>>3)}})),V=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decode=t.encode=t.encodeBase64=t.decodeBase64=void 0;let n=e(`node:buffer`),r=B();function i(e){let t=e;return t instanceof Uint8Array&&(t=r.decoder.decode(t)),t}t.encode=e=>n.Buffer.from(e).toString(`base64url`),t.decodeBase64=e=>new Uint8Array(n.Buffer.from(e,`base64`)),t.encodeBase64=e=>n.Buffer.from(e).toString(`base64`),t.decode=e=>new Uint8Array(n.Buffer.from(i(e),`base64url`))})),H=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.JWSSignatureVerificationFailed=e.JWKSTimeout=e.JWKSMultipleMatchingKeys=e.JWKSNoMatchingKey=e.JWKSInvalid=e.JWKInvalid=e.JWTInvalid=e.JWSInvalid=e.JWEInvalid=e.JWEDecryptionFailed=e.JOSENotSupported=e.JOSEAlgNotAllowed=e.JWTExpired=e.JWTClaimValidationFailed=e.JOSEError=void 0;var t=class extends Error{static code=`ERR_JOSE_GENERIC`;code=`ERR_JOSE_GENERIC`;constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};e.JOSEError=t,e.JWTClaimValidationFailed=class extends t{static code=`ERR_JWT_CLAIM_VALIDATION_FAILED`;code=`ERR_JWT_CLAIM_VALIDATION_FAILED`;claim;reason;payload;constructor(e,t,n=`unspecified`,r=`unspecified`){super(e,{cause:{claim:n,reason:r,payload:t}}),this.claim=n,this.reason=r,this.payload=t}},e.JWTExpired=class extends t{static code=`ERR_JWT_EXPIRED`;code=`ERR_JWT_EXPIRED`;claim;reason;payload;constructor(e,t,n=`unspecified`,r=`unspecified`){super(e,{cause:{claim:n,reason:r,payload:t}}),this.claim=n,this.reason=r,this.payload=t}},e.JOSEAlgNotAllowed=class extends t{static code=`ERR_JOSE_ALG_NOT_ALLOWED`;code=`ERR_JOSE_ALG_NOT_ALLOWED`},e.JOSENotSupported=class extends t{static code=`ERR_JOSE_NOT_SUPPORTED`;code=`ERR_JOSE_NOT_SUPPORTED`},e.JWEDecryptionFailed=class extends t{static code=`ERR_JWE_DECRYPTION_FAILED`;code=`ERR_JWE_DECRYPTION_FAILED`;constructor(e=`decryption operation failed`,t){super(e,t)}},e.JWEInvalid=class extends t{static code=`ERR_JWE_INVALID`;code=`ERR_JWE_INVALID`},e.JWSInvalid=class extends t{static code=`ERR_JWS_INVALID`;code=`ERR_JWS_INVALID`},e.JWTInvalid=class extends t{static code=`ERR_JWT_INVALID`;code=`ERR_JWT_INVALID`},e.JWKInvalid=class extends t{static code=`ERR_JWK_INVALID`;code=`ERR_JWK_INVALID`},e.JWKSInvalid=class extends t{static code=`ERR_JWKS_INVALID`;code=`ERR_JWKS_INVALID`},e.JWKSNoMatchingKey=class extends t{static code=`ERR_JWKS_NO_MATCHING_KEY`;code=`ERR_JWKS_NO_MATCHING_KEY`;constructor(e=`no applicable key found in the JSON Web Key Set`,t){super(e,t)}},e.JWKSMultipleMatchingKeys=class extends t{[Symbol.asyncIterator];static code=`ERR_JWKS_MULTIPLE_MATCHING_KEYS`;code=`ERR_JWKS_MULTIPLE_MATCHING_KEYS`;constructor(e=`multiple matching keys found in the JSON Web Key Set`,t){super(e,t)}},e.JWKSTimeout=class extends t{static code=`ERR_JWKS_TIMEOUT`;code=`ERR_JWKS_TIMEOUT`;constructor(e=`request timed out`,t){super(e,t)}},e.JWSSignatureVerificationFailed=class extends t{static code=`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`;code=`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`;constructor(e=`signature verification failed`,t){super(e,t)}}})),gi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=e(`node:crypto`);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return n.randomFillSync}})})),_i=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bitLength=r;let t=H(),n=gi();function r(e){switch(e){case`A128GCM`:case`A128GCMKW`:case`A192GCM`:case`A192GCMKW`:case`A256GCM`:case`A256GCMKW`:return 96;case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return 128;default:throw new t.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}e.default=e=>(0,n.default)(new Uint8Array(r(e)>>3))})),vi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H(),n=_i();e.default=(e,r)=>{if(r.length<<3!==(0,n.bitLength)(e))throw new t.JWEInvalid(`Invalid Initialization Vector length`)}})),U=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:util`);t.default=e=>n.types.isKeyObject(e)})),yi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H(),n=U();e.default=(e,r)=>{let i;switch(e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:i=parseInt(e.slice(-3),10);break;case`A128GCM`:case`A192GCM`:case`A256GCM`:i=parseInt(e.slice(1,4),10);break;default:throw new t.JOSENotSupported(`Content Encryption Algorithm ${e} is not supported either by JOSE or your javascript runtime`)}if(r instanceof Uint8Array){let e=r.byteLength<<3;if(e!==i)throw new t.JWEInvalid(`Invalid Content Encryption Key length. Expected ${i} bits, got ${e} bits`);return}if((0,n.default)(r)&&r.type===`secret`){let e=r.symmetricKeySize<<3;if(e!==i)throw new t.JWEInvalid(`Invalid Content Encryption Key length. Expected ${i} bits, got ${e} bits`);return}throw TypeError(`Invalid Content Encryption Key type`)}})),bi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=e(`node:crypto`).timingSafeEqual})),xi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;let n=e(`node:crypto`),r=B();function i(e,t,i,a,o,s){let c=(0,r.concat)(e,t,i,(0,r.uint64be)(e.length<<3)),l=(0,n.createHmac)(`sha${a}`,o);return l.update(c),l.digest().slice(0,s>>3)}})),W=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isCryptoKey=void 0;let n=e(`node:crypto`),r=e(`node:util`);t.default=n.webcrypto,t.isCryptoKey=e=>r.types.isCryptoKey(e)})),Si=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkSigCryptoKey=o,e.checkEncCryptoKey=s;function t(e,t=`algorithm.name`){return TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function n(e,t){return e.name===t}function r(e){return parseInt(e.name.slice(4),10)}function i(e){switch(e){case`ES256`:return`P-256`;case`ES384`:return`P-384`;case`ES512`:return`P-521`;default:throw Error(`unreachable`)}}function a(e,t){if(t.length&&!t.some(t=>e.usages.includes(t))){let e=`CryptoKey does not support this operation, its usages must include `;if(t.length>2){let n=t.pop();e+=`one of ${t.join(`, `)}, or ${n}.`}else t.length===2?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw TypeError(e)}}function o(e,o,...s){switch(o){case`HS256`:case`HS384`:case`HS512`:{if(!n(e.algorithm,`HMAC`))throw t(`HMAC`);let i=parseInt(o.slice(2),10);if(r(e.algorithm.hash)!==i)throw t(`SHA-${i}`,`algorithm.hash`);break}case`RS256`:case`RS384`:case`RS512`:{if(!n(e.algorithm,`RSASSA-PKCS1-v1_5`))throw t(`RSASSA-PKCS1-v1_5`);let i=parseInt(o.slice(2),10);if(r(e.algorithm.hash)!==i)throw t(`SHA-${i}`,`algorithm.hash`);break}case`PS256`:case`PS384`:case`PS512`:{if(!n(e.algorithm,`RSA-PSS`))throw t(`RSA-PSS`);let i=parseInt(o.slice(2),10);if(r(e.algorithm.hash)!==i)throw t(`SHA-${i}`,`algorithm.hash`);break}case`EdDSA`:if(e.algorithm.name!==`Ed25519`&&e.algorithm.name!==`Ed448`)throw t(`Ed25519 or Ed448`);break;case`Ed25519`:if(!n(e.algorithm,`Ed25519`))throw t(`Ed25519`);break;case`ES256`:case`ES384`:case`ES512`:{if(!n(e.algorithm,`ECDSA`))throw t(`ECDSA`);let r=i(o);if(e.algorithm.namedCurve!==r)throw t(r,`algorithm.namedCurve`);break}default:throw TypeError(`CryptoKey does not support this operation`)}a(e,s)}function s(e,i,...o){switch(i){case`A128GCM`:case`A192GCM`:case`A256GCM`:{if(!n(e.algorithm,`AES-GCM`))throw t(`AES-GCM`);let r=parseInt(i.slice(1,4),10);if(e.algorithm.length!==r)throw t(r,`algorithm.length`);break}case`A128KW`:case`A192KW`:case`A256KW`:{if(!n(e.algorithm,`AES-KW`))throw t(`AES-KW`);let r=parseInt(i.slice(1,4),10);if(e.algorithm.length!==r)throw t(r,`algorithm.length`);break}case`ECDH`:switch(e.algorithm.name){case`ECDH`:case`X25519`:case`X448`:break;default:throw t(`ECDH, X25519, or X448`)}break;case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:if(!n(e.algorithm,`PBKDF2`))throw t(`PBKDF2`);break;case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:{if(!n(e.algorithm,`RSA-OAEP`))throw t(`RSA-OAEP`);let a=parseInt(i.slice(9),10)||1;if(r(e.algorithm.hash)!==a)throw t(`SHA-${a}`,`algorithm.hash`);break}default:throw TypeError(`CryptoKey does not support this operation`)}a(e,o)}})),G=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.withAlg=n;function t(e,t,...n){if(n=n.filter(Boolean),n.length>2){let t=n.pop();e+=`one of type ${n.join(`, `)}, or ${t}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t==`function`&&t.name?e+=` Received function ${t.name}`:typeof t==`object`&&t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}e.default=(e,...n)=>t(`Key must be `,e,...n);function n(e,n,...r){return t(`Key for the ${e} algorithm must be `,n,...r)}})),Ci=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r;t.default=e=>(r||=new Set((0,n.getCiphers)()),r.has(e))})),K=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.types=void 0;let t=W(),n=U();e.default=e=>(0,n.default)(e)||(0,t.isCryptoKey)(e);let r=[`KeyObject`];e.types=r,(globalThis.CryptoKey||t.default?.CryptoKey)&&r.push(`CryptoKey`)})),wi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r=vi(),i=yi(),a=B(),o=H(),s=bi(),c=xi(),l=W(),u=Si(),d=U(),f=G(),p=Ci(),m=K();function h(e,t,r,i,l,u){let f=parseInt(e.slice(1,4),10);(0,d.default)(t)&&(t=t.export());let m=t.subarray(f>>3),h=t.subarray(0,f>>3),g=parseInt(e.slice(-3),10),_=`aes-${f}-cbc`;if(!(0,p.default)(_))throw new o.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);let v=(0,c.default)(u,i,r,g,h,f),y;try{y=(0,s.default)(l,v)}catch{}if(!y)throw new o.JWEDecryptionFailed;let b;try{let e=(0,n.createDecipheriv)(_,m,i);b=(0,a.concat)(e.update(r),e.final())}catch{}if(!b)throw new o.JWEDecryptionFailed;return b}function g(e,t,r,i,a,s){let c=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,p.default)(c))throw new o.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);try{let e=(0,n.createDecipheriv)(c,t,i,{authTagLength:16});e.setAuthTag(a),s.byteLength&&e.setAAD(s,{plaintextLength:r.length});let o=e.update(r);return e.final(),o}catch{throw new o.JWEDecryptionFailed}}t.default=(e,t,a,s,c,p)=>{let _;if((0,l.isCryptoKey)(t))(0,u.checkEncCryptoKey)(t,e,`decrypt`),_=n.KeyObject.from(t);else if(t instanceof Uint8Array||(0,d.default)(t))_=t;else throw TypeError((0,f.default)(t,...m.types,`Uint8Array`));if(!s)throw new o.JWEInvalid(`JWE Initialization Vector missing`);if(!c)throw new o.JWEInvalid(`JWE Authentication Tag missing`);switch((0,i.default)(e,_),(0,r.default)(e,s),e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return h(e,_,a,s,c,p);case`A128GCM`:case`A192GCM`:case`A256GCM`:return g(e,_,a,s,c,p);default:throw new o.JOSENotSupported(`Unsupported JWE Content Encryption Algorithm`)}}})),Ti=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=(...e)=>{let t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(let e of t){let t=Object.keys(e);if(!n||n.size===0){n=new Set(t);continue}for(let e of t){if(n.has(e))return!1;n.add(e)}}return!0}})),q=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;function t(e){return typeof e==`object`&&!!e}function n(e){if(!t(e)||Object.prototype.toString.call(e)!==`[object Object]`)return!1;if(Object.getPrototypeOf(e)===null)return!0;let n=e;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}})),Ei=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unwrap=t.wrap=void 0;let n=e(`node:buffer`),r=e(`node:crypto`),i=H(),a=B(),o=W(),s=Si(),c=U(),l=G(),u=Ci(),d=K();function f(e,t){if(e.symmetricKeySize<<3!==parseInt(t.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${t}`)}function p(e,t,n){if((0,c.default)(e))return e;if(e instanceof Uint8Array)return(0,r.createSecretKey)(e);if((0,o.isCryptoKey)(e))return(0,s.checkEncCryptoKey)(e,t,n),r.KeyObject.from(e);throw TypeError((0,l.default)(e,...d.types,`Uint8Array`))}t.wrap=(e,t,o)=>{let s=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,u.default)(s))throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);let c=p(t,e,`wrapKey`);f(c,e);let l=(0,r.createCipheriv)(s,c,n.Buffer.alloc(8,166));return(0,a.concat)(l.update(o),l.final())},t.unwrap=(e,t,o)=>{let s=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!(0,u.default)(s))throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`);let c=p(t,e,`unwrapKey`);f(c,e);let l=(0,r.createDecipheriv)(s,c,n.Buffer.alloc(8,166));return(0,a.concat)(l.update(o),l.final())}})),Di=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isJWK=n,e.isPrivateJWK=r,e.isPublicJWK=i,e.isSecretJWK=a;let t=q();function n(e){return(0,t.default)(e)&&typeof e.kty==`string`}function r(e){return e.kty!==`oct`&&typeof e.d==`string`}function i(e){return e.kty!==`oct`&&e.d===void 0}function a(e){return n(e)&&e.kty===`oct`&&typeof e.k==`string`}})),Oi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.weakMap=void 0;let n=e(`node:crypto`),r=H(),i=W(),a=U(),o=G(),s=K(),c=Di();t.weakMap=new WeakMap;let l=e=>{switch(e){case`prime256v1`:return`P-256`;case`secp384r1`:return`P-384`;case`secp521r1`:return`P-521`;case`secp256k1`:return`secp256k1`;default:throw new r.JOSENotSupported(`Unsupported key curve for this operation`)}};t.default=(e,t)=>{let r;if((0,i.isCryptoKey)(e))r=n.KeyObject.from(e);else if((0,a.default)(e))r=e;else if((0,c.isJWK)(e))return e.crv;else throw TypeError((0,o.default)(e,...s.types));if(r.type===`secret`)throw TypeError(`only "private" or "public" type keys can be used for this operation`);switch(r.asymmetricKeyType){case`ed25519`:case`ed448`:return`Ed${r.asymmetricKeyType.slice(2)}`;case`x25519`:case`x448`:return`X${r.asymmetricKeyType.slice(1)}`;case`ec`:{let e=r.asymmetricKeyDetails.namedCurve;return t?e:l(e)}default:throw TypeError(`Invalid asymmetric key type for this operation`)}}})),ki=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ecdhAllowed=void 0,t.deriveKey=p,t.generateEpk=m;let n=e(`node:crypto`),r=e(`node:util`),i=Oi(),a=B(),o=H(),s=W(),c=Si(),l=U(),u=G(),d=K(),f=(0,r.promisify)(n.generateKeyPair);async function p(e,t,r,i,o=new Uint8Array,f=new Uint8Array){let p;if((0,s.isCryptoKey)(e))(0,c.checkEncCryptoKey)(e,`ECDH`),p=n.KeyObject.from(e);else if((0,l.default)(e))p=e;else throw TypeError((0,u.default)(e,...d.types));let m;if((0,s.isCryptoKey)(t))(0,c.checkEncCryptoKey)(t,`ECDH`,`deriveBits`),m=n.KeyObject.from(t);else if((0,l.default)(t))m=t;else throw TypeError((0,u.default)(t,...d.types));let h=(0,a.concat)((0,a.lengthAndInput)(a.encoder.encode(r)),(0,a.lengthAndInput)(o),(0,a.lengthAndInput)(f),(0,a.uint32be)(i)),g=(0,n.diffieHellman)({privateKey:m,publicKey:p});return(0,a.concatKdf)(g,i,h)}async function m(e){let t;if((0,s.isCryptoKey)(e))t=n.KeyObject.from(e);else if((0,l.default)(e))t=e;else throw TypeError((0,u.default)(e,...d.types));switch(t.asymmetricKeyType){case`x25519`:return f(`x25519`);case`x448`:return f(`x448`);case`ec`:{let e=(0,i.default)(t);return f(`ec`,{namedCurve:e})}default:throw new o.JOSENotSupported(`Invalid or unsupported EPK`)}}t.ecdhAllowed=e=>[`P-256`,`P-384`,`P-521`,`X25519`,`X448`].includes((0,i.default)(e))})),Ai=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;let t=H();function n(e){if(!(e instanceof Uint8Array)||e.length<8)throw new t.JWEInvalid(`PBES2 Salt Input must be 8 or more octets`)}})),ji=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;let n=e(`node:util`),r=e(`node:crypto`),i=gi(),a=B(),o=V(),s=Ei(),c=Ai(),l=W(),u=Si(),d=U(),f=G(),p=K(),m=(0,n.promisify)(r.pbkdf2);function h(e,t){if((0,d.default)(e))return e.export();if(e instanceof Uint8Array)return e;if((0,l.isCryptoKey)(e))return(0,u.checkEncCryptoKey)(e,t,`deriveBits`,`deriveKey`),r.KeyObject.from(e).export();throw TypeError((0,f.default)(e,...p.types,`Uint8Array`))}t.encrypt=async(e,t,n,r=2048,l=(0,i.default)(new Uint8Array(16)))=>{(0,c.default)(l);let u=(0,a.p2s)(e,l),d=parseInt(e.slice(13,16),10)>>3,f=h(t,e),p=await m(f,u,r,d,`sha${e.slice(8,11)}`);return{encryptedKey:await(0,s.wrap)(e.slice(-6),p,n),p2c:r,p2s:(0,o.encode)(l)}},t.decrypt=async(e,t,n,r,i)=>{(0,c.default)(i);let o=(0,a.p2s)(e,i),l=parseInt(e.slice(13,16),10)>>3,u=h(t,e),d=await m(u,o,r,l,`sha${e.slice(8,11)}`);return(0,s.unwrap)(e.slice(-6),d,n)}})),Mi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`);t.default=(e,t)=>{let r;try{r=e instanceof n.KeyObject?e.asymmetricKeyDetails?.modulusLength:Buffer.from(e.n,`base64url`).byteLength<<3}catch{}if(typeof r!=`number`||r<2048)throw TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}})),Ni=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;let n=e(`node:crypto`),r=e(`node:util`),i=Mi(),a=W(),o=Si(),s=U(),c=G(),l=K(),u=(e,t)=>{if(e.asymmetricKeyType!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa`);(0,i.default)(e,t)},d=(0,r.deprecate)(()=>n.constants.RSA_PKCS1_PADDING,`The RSA1_5 "alg" (JWE Algorithm) is deprecated and will be removed in the next major revision.`),f=e=>{switch(e){case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:return n.constants.RSA_PKCS1_OAEP_PADDING;case`RSA1_5`:return d();default:return}},p=e=>{switch(e){case`RSA-OAEP`:return`sha1`;case`RSA-OAEP-256`:return`sha256`;case`RSA-OAEP-384`:return`sha384`;case`RSA-OAEP-512`:return`sha512`;default:return}};function m(e,t,...r){if((0,s.default)(e))return e;if((0,a.isCryptoKey)(e))return(0,o.checkEncCryptoKey)(e,t,...r),n.KeyObject.from(e);throw TypeError((0,c.default)(e,...l.types))}t.encrypt=(e,t,r)=>{let i=f(e),a=p(e),o=m(t,e,`wrapKey`,`encrypt`);return u(o,e),(0,n.publicEncrypt)({key:o,oaepHash:a,padding:i},r)},t.decrypt=(e,t,r)=>{let i=f(e),a=p(e),o=m(t,e,`unwrapKey`,`decrypt`);return u(o,e),(0,n.privateDecrypt)({key:o,oaepHash:a,padding:i},r)}})),Pi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default={}})),Fi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bitLength=r;let t=H(),n=gi();function r(e){switch(e){case`A128GCM`:return 128;case`A192GCM`:return 192;case`A256GCM`:case`A128CBC-HS256`:return 256;case`A192CBC-HS384`:return 384;case`A256CBC-HS512`:return 512;default:throw new t.JOSENotSupported(`Unsupported JWE Algorithm: ${e}`)}}e.default=e=>(0,n.default)(new Uint8Array(r(e)>>3))})),Ii=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromX509=t.fromSPKI=t.fromPKCS8=t.toPKCS8=t.toSPKI=void 0;let n=e(`node:crypto`),r=e(`node:buffer`),i=W(),a=U(),o=G(),s=K(),c=(e,t,r)=>{let c;if((0,i.isCryptoKey)(r)){if(!r.extractable)throw TypeError(`CryptoKey is not extractable`);c=n.KeyObject.from(r)}else if((0,a.default)(r))c=r;else throw TypeError((0,o.default)(r,...s.types));if(c.type!==e)throw TypeError(`key is not a ${e} key`);return c.export({format:`pem`,type:t})};t.toSPKI=e=>c(`public`,`spki`,e),t.toPKCS8=e=>c(`private`,`pkcs8`,e),t.fromPKCS8=e=>(0,n.createPrivateKey)({key:r.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,``),`base64`),type:`pkcs8`,format:`der`}),t.fromSPKI=e=>(0,n.createPublicKey)({key:r.Buffer.from(e.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,``),`base64`),type:`spki`,format:`der`}),t.fromX509=e=>(0,n.createPublicKey)({key:e,type:`spki`,format:`pem`})})),Li=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`);t.default=e=>e.d?(0,n.createPrivateKey)({format:`jwk`,key:e}):(0,n.createPublicKey)({format:`jwk`,key:e})})),Ri=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.importSPKI=o,e.importX509=s,e.importPKCS8=c,e.importJWK=l;let t=V(),n=Ii(),r=Li(),i=H(),a=q();async function o(e,t,r){if(typeof e!=`string`||e.indexOf(`-----BEGIN PUBLIC KEY-----`)!==0)throw TypeError(`"spki" must be SPKI formatted string`);return(0,n.fromSPKI)(e,t,r)}async function s(e,t,r){if(typeof e!=`string`||e.indexOf(`-----BEGIN CERTIFICATE-----`)!==0)throw TypeError(`"x509" must be X.509 formatted string`);return(0,n.fromX509)(e,t,r)}async function c(e,t,r){if(typeof e!=`string`||e.indexOf(`-----BEGIN PRIVATE KEY-----`)!==0)throw TypeError(`"pkcs8" must be PKCS#8 formatted string`);return(0,n.fromPKCS8)(e,t,r)}async function l(e,n){if(!(0,a.default)(e))throw TypeError(`JWK must be an object`);switch(n||=e.alg,e.kty){case`oct`:if(typeof e.k!=`string`||!e.k)throw TypeError(`missing "k" (Key Value) Parameter value`);return(0,t.decode)(e.k);case`RSA`:if(`oth`in e&&e.oth!==void 0)throw new i.JOSENotSupported(`RSA JWK "oth" (Other Primes Info) Parameter value is not supported`);case`EC`:case`OKP`:return(0,r.default)({...e,alg:n});default:throw new i.JOSENotSupported(`Unsupported "kty" (Key Type) Parameter value`)}}})),zi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkKeyTypeWithJwk=void 0;let t=G(),n=K(),r=Di(),i=e=>e?.[Symbol.toStringTag],a=(e,t,n)=>{if(t.use!==void 0&&t.use!==`sig`)throw TypeError(`Invalid key for this operation, when present its use must be sig`);if(t.key_ops!==void 0&&t.key_ops.includes?.(n)!==!0)throw TypeError(`Invalid key for this operation, when present its key_ops must include ${n}`);if(t.alg!==void 0&&t.alg!==e)throw TypeError(`Invalid key for this operation, when present its alg must be ${e}`);return!0},o=(e,o,s,c)=>{if(!(o instanceof Uint8Array)){if(c&&r.isJWK(o)){if(r.isSecretJWK(o)&&a(e,o,s))return;throw TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`)}if(!(0,n.default)(o))throw TypeError((0,t.withAlg)(e,o,...n.types,`Uint8Array`,c?`JSON Web Key`:null));if(o.type!==`secret`)throw TypeError(`${i(o)} instances for symmetric algorithms must be of type "secret"`)}},s=(e,o,s,c)=>{if(c&&r.isJWK(o))switch(s){case`sign`:if(r.isPrivateJWK(o)&&a(e,o,s))return;throw TypeError(`JSON Web Key for this operation be a private JWK`);case`verify`:if(r.isPublicJWK(o)&&a(e,o,s))return;throw TypeError(`JSON Web Key for this operation be a public JWK`)}if(!(0,n.default)(o))throw TypeError((0,t.withAlg)(e,o,...n.types,c?`JSON Web Key`:null));if(o.type===`secret`)throw TypeError(`${i(o)} instances for asymmetric algorithms must not be of type "secret"`);if(s===`sign`&&o.type===`public`)throw TypeError(`${i(o)} instances for asymmetric algorithm signing must be of type "private"`);if(s===`decrypt`&&o.type===`public`)throw TypeError(`${i(o)} instances for asymmetric algorithm decryption must be of type "private"`);if(o.algorithm&&s===`verify`&&o.type===`private`)throw TypeError(`${i(o)} instances for asymmetric algorithm verifying must be of type "public"`);if(o.algorithm&&s===`encrypt`&&o.type===`private`)throw TypeError(`${i(o)} instances for asymmetric algorithm encryption must be of type "public"`)};function c(e,t,n,r){t.startsWith(`HS`)||t===`dir`||t.startsWith(`PBES2`)||/^A\d{3}(?:GCM)?KW$/.test(t)?o(t,n,r,e):s(t,n,r,e)}e.default=c.bind(void 0,!1),e.checkKeyTypeWithJwk=c.bind(void 0,!0)})),Bi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r=vi(),i=yi(),a=B(),o=xi(),s=W(),c=Si(),l=U(),u=G(),d=_i(),f=H(),p=Ci(),m=K();function h(e,t,r,i,s){let c=parseInt(e.slice(1,4),10);(0,l.default)(r)&&(r=r.export());let u=r.subarray(c>>3),d=r.subarray(0,c>>3),m=`aes-${c}-cbc`;if(!(0,p.default)(m))throw new f.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);let h=(0,n.createCipheriv)(m,u,i),g=(0,a.concat)(h.update(t),h.final()),_=parseInt(e.slice(-3),10);return{ciphertext:g,tag:(0,o.default)(s,i,g,_,d,c),iv:i}}function g(e,t,r,i,a){let o=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!(0,p.default)(o))throw new f.JOSENotSupported(`alg ${e} is not supported by your javascript runtime`);let s=(0,n.createCipheriv)(o,r,i,{authTagLength:16});a.byteLength&&s.setAAD(a,{plaintextLength:t.length});let c=s.update(t);return s.final(),{ciphertext:c,tag:s.getAuthTag(),iv:i}}t.default=(e,t,a,o,p)=>{let _;if((0,s.isCryptoKey)(a))(0,c.checkEncCryptoKey)(a,e,`encrypt`),_=n.KeyObject.from(a);else if(a instanceof Uint8Array||(0,l.default)(a))_=a;else throw TypeError((0,u.default)(a,...m.types,`Uint8Array`));switch((0,i.default)(e,_),o?(0,r.default)(e,o):o=(0,d.default)(e),e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return h(e,t,_,o,p);case`A128GCM`:case`A192GCM`:case`A256GCM`:return g(e,t,_,o,p);default:throw new f.JOSENotSupported(`Unsupported JWE Content Encryption Algorithm`)}}})),Vi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.wrap=i,e.unwrap=a;let t=Bi(),n=wi(),r=V();async function i(e,n,i,a){let o=e.slice(0,7),s=await(0,t.default)(o,i,n,a,new Uint8Array);return{encryptedKey:s.ciphertext,iv:(0,r.encode)(s.iv),tag:(0,r.encode)(s.tag)}}async function a(e,t,r,i,a){let o=e.slice(0,7);return(0,n.default)(o,t,r,i,a,new Uint8Array)}})),Hi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ei(),n=ki(),r=ji(),i=Ni(),a=V(),o=Pi(),s=H(),c=Fi(),l=Ri(),u=zi(),d=q(),f=Vi();async function p(e,p,m,h,g){switch((0,u.default)(e,p,`decrypt`),p=await o.default.normalizePrivateKey?.(p,e)||p,e){case`dir`:if(m!==void 0)throw new s.JWEInvalid(`Encountered unexpected JWE Encrypted Key`);return p;case`ECDH-ES`:if(m!==void 0)throw new s.JWEInvalid(`Encountered unexpected JWE Encrypted Key`);case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{if(!(0,d.default)(h.epk))throw new s.JWEInvalid(`JOSE Header "epk" (Ephemeral Public Key) missing or invalid`);if(!n.ecdhAllowed(p))throw new s.JOSENotSupported(`ECDH with the provided key is not allowed or not supported by your javascript runtime`);let r=await(0,l.importJWK)(h.epk,e),i,o;if(h.apu!==void 0){if(typeof h.apu!=`string`)throw new s.JWEInvalid(`JOSE Header "apu" (Agreement PartyUInfo) invalid`);try{i=(0,a.decode)(h.apu)}catch{throw new s.JWEInvalid(`Failed to base64url decode the apu`)}}if(h.apv!==void 0){if(typeof h.apv!=`string`)throw new s.JWEInvalid(`JOSE Header "apv" (Agreement PartyVInfo) invalid`);try{o=(0,a.decode)(h.apv)}catch{throw new s.JWEInvalid(`Failed to base64url decode the apv`)}}let u=await n.deriveKey(r,p,e===`ECDH-ES`?h.enc:e,e===`ECDH-ES`?(0,c.bitLength)(h.enc):parseInt(e.slice(-5,-2),10),i,o);if(e===`ECDH-ES`)return u;if(m===void 0)throw new s.JWEInvalid(`JWE Encrypted Key missing`);return(0,t.unwrap)(e.slice(-6),u,m)}case`RSA1_5`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:if(m===void 0)throw new s.JWEInvalid(`JWE Encrypted Key missing`);return(0,i.decrypt)(e,p,m);case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:{if(m===void 0)throw new s.JWEInvalid(`JWE Encrypted Key missing`);if(typeof h.p2c!=`number`)throw new s.JWEInvalid(`JOSE Header "p2c" (PBES2 Count) missing or invalid`);let t=g?.maxPBES2Count||1e4;if(h.p2c>t)throw new s.JWEInvalid(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`);if(typeof h.p2s!=`string`)throw new s.JWEInvalid(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`);let n;try{n=(0,a.decode)(h.p2s)}catch{throw new s.JWEInvalid(`Failed to base64url decode the p2s`)}return(0,r.decrypt)(e,p,m,h.p2c,n)}case`A128KW`:case`A192KW`:case`A256KW`:if(m===void 0)throw new s.JWEInvalid(`JWE Encrypted Key missing`);return(0,t.unwrap)(e,p,m);case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:{if(m===void 0)throw new s.JWEInvalid(`JWE Encrypted Key missing`);if(typeof h.iv!=`string`)throw new s.JWEInvalid(`JOSE Header "iv" (Initialization Vector) missing or invalid`);if(typeof h.tag!=`string`)throw new s.JWEInvalid(`JOSE Header "tag" (Authentication Tag) missing or invalid`);let t;try{t=(0,a.decode)(h.iv)}catch{throw new s.JWEInvalid(`Failed to base64url decode the iv`)}let n;try{n=(0,a.decode)(h.tag)}catch{throw new s.JWEInvalid(`Failed to base64url decode the tag`)}return(0,f.unwrap)(e,p,m,t,n)}default:throw new s.JOSENotSupported(`Invalid or unsupported "alg" (JWE Algorithm) header value`)}}e.default=p})),Ui=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H();function n(e,n,r,i,a){if(a.crit!==void 0&&i?.crit===void 0)throw new e(`"crit" (Critical) Header Parameter MUST be integrity protected`);if(!i||i.crit===void 0)return new Set;if(!Array.isArray(i.crit)||i.crit.length===0||i.crit.some(e=>typeof e!=`string`||e.length===0))throw new e(`"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present`);let o;o=r===void 0?n:new Map([...Object.entries(r),...n.entries()]);for(let n of i.crit){if(!o.has(n))throw new t.JOSENotSupported(`Extension Header Parameter "${n}" is not recognized`);if(a[n]===void 0)throw new e(`Extension Header Parameter "${n}" is missing`);if(o.get(n)&&i[n]===void 0)throw new e(`Extension Header Parameter "${n}" MUST be integrity protected`)}return new Set(i.crit)}e.default=n})),Wi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=(e,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(e=>typeof e!=`string`)))throw TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}})),Gi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.flattenedDecrypt=d;let t=V(),n=wi(),r=H(),i=Ti(),a=q(),o=Hi(),s=B(),c=Fi(),l=Ui(),u=Wi();async function d(e,d,f){if(!(0,a.default)(e))throw new r.JWEInvalid(`Flattened JWE must be an object`);if(e.protected===void 0&&e.header===void 0&&e.unprotected===void 0)throw new r.JWEInvalid(`JOSE Header missing`);if(e.iv!==void 0&&typeof e.iv!=`string`)throw new r.JWEInvalid(`JWE Initialization Vector incorrect type`);if(typeof e.ciphertext!=`string`)throw new r.JWEInvalid(`JWE Ciphertext missing or incorrect type`);if(e.tag!==void 0&&typeof e.tag!=`string`)throw new r.JWEInvalid(`JWE Authentication Tag incorrect type`);if(e.protected!==void 0&&typeof e.protected!=`string`)throw new r.JWEInvalid(`JWE Protected Header incorrect type`);if(e.encrypted_key!==void 0&&typeof e.encrypted_key!=`string`)throw new r.JWEInvalid(`JWE Encrypted Key incorrect type`);if(e.aad!==void 0&&typeof e.aad!=`string`)throw new r.JWEInvalid(`JWE AAD incorrect type`);if(e.header!==void 0&&!(0,a.default)(e.header))throw new r.JWEInvalid(`JWE Shared Unprotected Header incorrect type`);if(e.unprotected!==void 0&&!(0,a.default)(e.unprotected))throw new r.JWEInvalid(`JWE Per-Recipient Unprotected Header incorrect type`);let p;if(e.protected)try{let n=(0,t.decode)(e.protected);p=JSON.parse(s.decoder.decode(n))}catch{throw new r.JWEInvalid(`JWE Protected Header is invalid`)}if(!(0,i.default)(p,e.header,e.unprotected))throw new r.JWEInvalid(`JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint`);let m={...p,...e.header,...e.unprotected};if((0,l.default)(r.JWEInvalid,new Map,f?.crit,p,m),m.zip!==void 0)throw new r.JOSENotSupported(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`);let{alg:h,enc:g}=m;if(typeof h!=`string`||!h)throw new r.JWEInvalid(`missing JWE Algorithm (alg) in JWE Header`);if(typeof g!=`string`||!g)throw new r.JWEInvalid(`missing JWE Encryption Algorithm (enc) in JWE Header`);let _=f&&(0,u.default)(`keyManagementAlgorithms`,f.keyManagementAlgorithms),v=f&&(0,u.default)(`contentEncryptionAlgorithms`,f.contentEncryptionAlgorithms);if(_&&!_.has(h)||!_&&h.startsWith(`PBES2`))throw new r.JOSEAlgNotAllowed(`"alg" (Algorithm) Header Parameter value not allowed`);if(v&&!v.has(g))throw new r.JOSEAlgNotAllowed(`"enc" (Encryption Algorithm) Header Parameter value not allowed`);let y;if(e.encrypted_key!==void 0)try{y=(0,t.decode)(e.encrypted_key)}catch{throw new r.JWEInvalid(`Failed to base64url decode the encrypted_key`)}let b=!1;typeof d==`function`&&(d=await d(p,e),b=!0);let x;try{x=await(0,o.default)(h,d,y,m,f)}catch(e){if(e instanceof TypeError||e instanceof r.JWEInvalid||e instanceof r.JOSENotSupported)throw e;x=(0,c.default)(g)}let S,C;if(e.iv!==void 0)try{S=(0,t.decode)(e.iv)}catch{throw new r.JWEInvalid(`Failed to base64url decode the iv`)}if(e.tag!==void 0)try{C=(0,t.decode)(e.tag)}catch{throw new r.JWEInvalid(`Failed to base64url decode the tag`)}let w=s.encoder.encode(e.protected??``),ee;ee=e.aad===void 0?w:(0,s.concat)(w,s.encoder.encode(`.`),s.encoder.encode(e.aad));let te;try{te=(0,t.decode)(e.ciphertext)}catch{throw new r.JWEInvalid(`Failed to base64url decode the ciphertext`)}let ne={plaintext:await(0,n.default)(g,x,te,S,C,ee)};if(e.protected!==void 0&&(ne.protectedHeader=p),e.aad!==void 0)try{ne.additionalAuthenticatedData=(0,t.decode)(e.aad)}catch{throw new r.JWEInvalid(`Failed to base64url decode the aad`)}return e.unprotected!==void 0&&(ne.sharedUnprotectedHeader=e.unprotected),e.header!==void 0&&(ne.unprotectedHeader=e.header),b?{...ne,key:d}:ne}})),Ki=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.compactDecrypt=i;let t=Gi(),n=H(),r=B();async function i(e,i,a){if(e instanceof Uint8Array&&(e=r.decoder.decode(e)),typeof e!=`string`)throw new n.JWEInvalid(`Compact JWE must be a string or Uint8Array`);let{0:o,1:s,2:c,3:l,4:u,length:d}=e.split(`.`);if(d!==5)throw new n.JWEInvalid(`Invalid Compact JWE`);let f=await(0,t.flattenedDecrypt)({ciphertext:l,iv:c||void 0,protected:o,tag:u||void 0,encrypted_key:s||void 0},i,a),p={plaintext:f.plaintext,protectedHeader:f.protectedHeader};return typeof i==`function`?{...p,key:f.key}:p}})),qi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generalDecrypt=i;let t=Gi(),n=H(),r=q();async function i(e,i,a){if(!(0,r.default)(e))throw new n.JWEInvalid(`General JWE must be an object`);if(!Array.isArray(e.recipients)||!e.recipients.every(r.default))throw new n.JWEInvalid(`JWE Recipients missing or incorrect type`);if(!e.recipients.length)throw new n.JWEInvalid(`JWE Recipients has no members`);for(let n of e.recipients)try{return await(0,t.flattenedDecrypt)({aad:e.aad,ciphertext:e.ciphertext,encrypted_key:n.encrypted_key,header:n.header,iv:e.iv,protected:e.protected,tag:e.tag,unprotected:e.unprotected},i,a)}catch{}throw new n.JWEDecryptionFailed}})),Ji=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.unprotected=void 0,e.unprotected=Symbol()})),Yi=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r=V(),i=H(),a=W(),o=U(),s=G(),c=K();t.default=e=>{let t;if((0,a.isCryptoKey)(e)){if(!e.extractable)throw TypeError(`CryptoKey is not extractable`);t=n.KeyObject.from(e)}else if((0,o.default)(e))t=e;else if(e instanceof Uint8Array)return{kty:`oct`,k:(0,r.encode)(e)};else throw TypeError((0,s.default)(e,...c.types,`Uint8Array`));if(t.type!==`secret`&&![`rsa`,`ec`,`ed25519`,`x25519`,`ed448`,`x448`].includes(t.asymmetricKeyType))throw new i.JOSENotSupported(`Unsupported key asymmetricKeyType`);return t.export({format:`jwk`})}})),Xi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.exportSPKI=i,e.exportPKCS8=a,e.exportJWK=o;let t=Ii(),n=Ii(),r=Yi();async function i(e){return(0,t.toSPKI)(e)}async function a(e){return(0,n.toPKCS8)(e)}async function o(e){return(0,r.default)(e)}})),Zi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ei(),n=ki(),r=ji(),i=Ni(),a=V(),o=Pi(),s=Fi(),c=H(),l=Xi(),u=zi(),d=Vi();async function f(e,f,p,m,h={}){let g,_,v;switch((0,u.default)(e,p,`encrypt`),p=await o.default.normalizePublicKey?.(p,e)||p,e){case`dir`:v=p;break;case`ECDH-ES`:case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{if(!n.ecdhAllowed(p))throw new c.JOSENotSupported(`ECDH with the provided key is not allowed or not supported by your javascript runtime`);let{apu:r,apv:i}=h,{epk:o}=h;o||=(await n.generateEpk(p)).privateKey;let{x:u,y:d,crv:y,kty:b}=await(0,l.exportJWK)(o),x=await n.deriveKey(p,o,e===`ECDH-ES`?f:e,e===`ECDH-ES`?(0,s.bitLength)(f):parseInt(e.slice(-5,-2),10),r,i);if(_={epk:{x:u,crv:y,kty:b}},b===`EC`&&(_.epk.y=d),r&&(_.apu=(0,a.encode)(r)),i&&(_.apv=(0,a.encode)(i)),e===`ECDH-ES`){v=x;break}v=m||(0,s.default)(f);let S=e.slice(-6);g=await(0,t.wrap)(S,x,v);break}case`RSA1_5`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:v=m||(0,s.default)(f),g=await(0,i.encrypt)(e,p,v);break;case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:{v=m||(0,s.default)(f);let{p2c:t,p2s:n}=h;({encryptedKey:g,..._}=await(0,r.encrypt)(e,p,v,t,n));break}case`A128KW`:case`A192KW`:case`A256KW`:v=m||(0,s.default)(f),g=await(0,t.wrap)(e,p,v);break;case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:{v=m||(0,s.default)(f);let{iv:t}=h;({encryptedKey:g,..._}=await(0,d.wrap)(e,p,v,t));break}default:throw new c.JOSENotSupported(`Invalid or unsupported "alg" (JWE Algorithm) header value`)}return{cek:v,encryptedKey:g,parameters:_}}e.default=f})),Qi=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FlattenedEncrypt=void 0;let t=V(),n=Ji(),r=Bi(),i=Zi(),a=H(),o=Ti(),s=B(),c=Ui();e.FlattenedEncrypt=class{_plaintext;_protectedHeader;_sharedUnprotectedHeader;_unprotectedHeader;_aad;_cek;_iv;_keyManagementParameters;constructor(e){if(!(e instanceof Uint8Array))throw TypeError(`plaintext must be an instance of Uint8Array`);this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError(`setKeyManagementParameters can only be called once`);return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw TypeError(`setSharedUnprotectedHeader can only be called once`);return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError(`setContentEncryptionKey can only be called once`);return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError(`setInitializationVector can only be called once`);return this._iv=e,this}async encrypt(e,l){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new a.JWEInvalid(`either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()`);if(!(0,o.default)(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new a.JWEInvalid(`JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint`);let u={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if((0,c.default)(a.JWEInvalid,new Map,l?.crit,this._protectedHeader,u),u.zip!==void 0)throw new a.JOSENotSupported(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`);let{alg:d,enc:f}=u;if(typeof d!=`string`||!d)throw new a.JWEInvalid(`JWE "alg" (Algorithm) Header Parameter missing or invalid`);if(typeof f!=`string`||!f)throw new a.JWEInvalid(`JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid`);let p;if(this._cek&&(d===`dir`||d===`ECDH-ES`))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${d}`);let m;{let t;({cek:m,encryptedKey:p,parameters:t}=await(0,i.default)(d,f,e,this._cek,this._keyManagementParameters)),t&&(l&&n.unprotected in l?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...t}:this.setUnprotectedHeader(t):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...t}:this.setProtectedHeader(t))}let h,g,_;g=this._protectedHeader?s.encoder.encode((0,t.encode)(JSON.stringify(this._protectedHeader))):s.encoder.encode(``),this._aad?(_=(0,t.encode)(this._aad),h=(0,s.concat)(g,s.encoder.encode(`.`),s.encoder.encode(_))):h=g;let{ciphertext:v,tag:y,iv:b}=await(0,r.default)(f,this._plaintext,m,this._iv,h),x={ciphertext:(0,t.encode)(v)};return b&&(x.iv=(0,t.encode)(b)),y&&(x.tag=(0,t.encode)(y)),p&&(x.encrypted_key=(0,t.encode)(p)),_&&(x.aad=_),this._protectedHeader&&(x.protected=s.decoder.decode(g)),this._sharedUnprotectedHeader&&(x.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(x.header=this._unprotectedHeader),x}}})),$i=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GeneralEncrypt=void 0;let t=Qi(),n=Ji(),r=H(),i=Fi(),a=Ti(),o=Zi(),s=V(),c=Ui();var l=class{parent;unprotectedHeader;key;options;constructor(e,t,n){this.parent=e,this.key=t,this.options=n}setUnprotectedHeader(e){if(this.unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this.unprotectedHeader=e,this}addRecipient(...e){return this.parent.addRecipient(...e)}encrypt(...e){return this.parent.encrypt(...e)}done(){return this.parent}};e.GeneralEncrypt=class{_plaintext;_recipients=[];_protectedHeader;_unprotectedHeader;_aad;constructor(e){this._plaintext=e}addRecipient(e,t){let n=new l(this,e,{crit:t?.crit});return this._recipients.push(n),n}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setSharedUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}async encrypt(){if(!this._recipients.length)throw new r.JWEInvalid(`at least one recipient must be added`);if(this._recipients.length===1){let[e]=this._recipients,n=await new t.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(e.unprotectedHeader).encrypt(e.key,{...e.options}),r={ciphertext:n.ciphertext,iv:n.iv,recipients:[{}],tag:n.tag};return n.aad&&(r.aad=n.aad),n.protected&&(r.protected=n.protected),n.unprotected&&(r.unprotected=n.unprotected),n.encrypted_key&&(r.recipients[0].encrypted_key=n.encrypted_key),n.header&&(r.recipients[0].header=n.header),r}let e;for(let t=0;t<this._recipients.length;t++){let n=this._recipients[t];if(!(0,a.default)(this._protectedHeader,this._unprotectedHeader,n.unprotectedHeader))throw new r.JWEInvalid(`JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint`);let i={...this._protectedHeader,...this._unprotectedHeader,...n.unprotectedHeader},{alg:o}=i;if(typeof o!=`string`||!o)throw new r.JWEInvalid(`JWE "alg" (Algorithm) Header Parameter missing or invalid`);if(o===`dir`||o===`ECDH-ES`)throw new r.JWEInvalid(`"dir" and "ECDH-ES" alg may only be used with a single recipient`);if(typeof i.enc!=`string`||!i.enc)throw new r.JWEInvalid(`JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid`);if(!e)e=i.enc;else if(e!==i.enc)throw new r.JWEInvalid(`JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients`);if((0,c.default)(r.JWEInvalid,new Map,n.options.crit,this._protectedHeader,i),i.zip!==void 0)throw new r.JOSENotSupported(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`)}let l=(0,i.default)(e),u={ciphertext:``,iv:``,recipients:[],tag:``};for(let r=0;r<this._recipients.length;r++){let i=this._recipients[r],a={};u.recipients.push(a);let c={...this._protectedHeader,...this._unprotectedHeader,...i.unprotectedHeader}.alg.startsWith(`PBES2`)?2048+r:void 0;if(r===0){let e=await new t.FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(l).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(i.unprotectedHeader).setKeyManagementParameters({p2c:c}).encrypt(i.key,{...i.options,[n.unprotected]:!0});u.ciphertext=e.ciphertext,u.iv=e.iv,u.tag=e.tag,e.aad&&(u.aad=e.aad),e.protected&&(u.protected=e.protected),e.unprotected&&(u.unprotected=e.unprotected),a.encrypted_key=e.encrypted_key,e.header&&(a.header=e.header);continue}let{encryptedKey:d,parameters:f}=await(0,o.default)(i.unprotectedHeader?.alg||this._protectedHeader?.alg||this._unprotectedHeader?.alg,e,i.key,l,{p2c:c});a.encrypted_key=(0,s.encode)(d),(i.unprotectedHeader||f)&&(a.header={...i.unprotectedHeader,...f})}return u}}})),ea=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;let t=H();function n(e){switch(e){case`PS256`:case`RS256`:case`ES256`:case`ES256K`:return`sha256`;case`PS384`:case`RS384`:case`ES384`:return`sha384`;case`PS512`:case`RS512`:case`ES512`:return`sha512`;case`Ed25519`:case`EdDSA`:return;default:throw new t.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}})),ta=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;let n=e(`node:crypto`),r=Oi(),i=H(),a=Mi(),o=new Map([[`ES256`,`P-256`],[`ES256K`,`secp256k1`],[`ES384`,`P-384`],[`ES512`,`P-521`]]);function s(e,t){let s,c,l;if(t instanceof n.KeyObject)s=t.asymmetricKeyType,c=t.asymmetricKeyDetails;else switch(l=!0,t.kty){case`RSA`:s=`rsa`;break;case`EC`:s=`ec`;break;case`OKP`:if(t.crv===`Ed25519`){s=`ed25519`;break}if(t.crv===`Ed448`){s=`ed448`;break}throw TypeError(`Invalid key for this operation, its crv must be Ed25519 or Ed448`);default:throw TypeError(`Invalid key for this operation, its kty must be RSA, OKP, or EC`)}let u;switch(e){case`Ed25519`:if(s!==`ed25519`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be ed25519`);break;case`EdDSA`:if(![`ed25519`,`ed448`].includes(s))throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448`);break;case`RS256`:case`RS384`:case`RS512`:if(s!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa`);(0,a.default)(t,e);break;case`PS256`:case`PS384`:case`PS512`:if(s===`rsa-pss`){let{hashAlgorithm:t,mgf1HashAlgorithm:n,saltLength:r}=c,i=parseInt(e.slice(-3),10);if(t!==void 0&&(t!==`sha${i}`||n!==t))throw TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}`);if(r!==void 0&&r>i>>3)throw TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}`)}else if(s!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss`);(0,a.default)(t,e),u={padding:n.constants.RSA_PKCS1_PSS_PADDING,saltLength:n.constants.RSA_PSS_SALTLEN_DIGEST};break;case`ES256`:case`ES256K`:case`ES384`:case`ES512`:{if(s!==`ec`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be ec`);let n=(0,r.default)(t),i=o.get(e);if(n!==i)throw TypeError(`Invalid key curve for the algorithm, its curve must be ${i}, got ${n}`);u={dsaEncoding:`ieee-p1363`};break}default:throw new i.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}return l?{format:`jwk`,key:t,...u}:u?{...u,key:t}:t}})),na=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=n;let t=H();function n(e){switch(e){case`HS256`:return`sha256`;case`HS384`:return`sha384`;case`HS512`:return`sha512`;default:throw new t.JOSENotSupported(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}})),ra=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;let n=e(`node:crypto`),r=W(),i=Si(),a=G(),o=K(),s=Di();function c(e,t,c){if(t instanceof Uint8Array){if(!e.startsWith(`HS`))throw TypeError((0,a.default)(t,...o.types));return(0,n.createSecretKey)(t)}if(t instanceof n.KeyObject)return t;if((0,r.isCryptoKey)(t))return(0,i.checkSigCryptoKey)(t,e,c),n.KeyObject.from(t);if(s.isJWK(t))return e.startsWith(`HS`)?(0,n.createSecretKey)(Buffer.from(t.k,`base64url`)):t;throw TypeError((0,a.default)(t,...o.types,`Uint8Array`,`JSON Web Key`))}})),ia=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r=e(`node:util`),i=ea(),a=na(),o=ta(),s=ra(),c=(0,r.promisify)(n.sign);t.default=async(e,t,r)=>{let l=(0,s.default)(e,t,`sign`);if(e.startsWith(`HS`)){let t=n.createHmac((0,a.default)(e),l);return t.update(r),t.digest()}return c((0,i.default)(e),r,(0,o.default)(e,l))}})),aa=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:crypto`),r=e(`node:util`),i=ea(),a=ta(),o=ia(),s=ra(),c=(0,r.promisify)(n.verify);t.default=async(e,t,r,l)=>{let u=(0,s.default)(e,t,`verify`);if(e.startsWith(`HS`)){let t=await(0,o.default)(e,u,l),i=r;try{return n.timingSafeEqual(i,t)}catch{return!1}}let d=(0,i.default)(e),f=(0,a.default)(e,u);try{return await c(d,l,f,r)}catch{return!1}}})),oa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.flattenedVerify=f;let t=V(),n=aa(),r=H(),i=B(),a=Ti(),o=q(),s=zi(),c=Ui(),l=Wi(),u=Di(),d=Ri();async function f(e,f,p){if(!(0,o.default)(e))throw new r.JWSInvalid(`Flattened JWS must be an object`);if(e.protected===void 0&&e.header===void 0)throw new r.JWSInvalid(`Flattened JWS must have either of the "protected" or "header" members`);if(e.protected!==void 0&&typeof e.protected!=`string`)throw new r.JWSInvalid(`JWS Protected Header incorrect type`);if(e.payload===void 0)throw new r.JWSInvalid(`JWS Payload missing`);if(typeof e.signature!=`string`)throw new r.JWSInvalid(`JWS Signature missing or incorrect type`);if(e.header!==void 0&&!(0,o.default)(e.header))throw new r.JWSInvalid(`JWS Unprotected Header incorrect type`);let m={};if(e.protected)try{let n=(0,t.decode)(e.protected);m=JSON.parse(i.decoder.decode(n))}catch{throw new r.JWSInvalid(`JWS Protected Header is invalid`)}if(!(0,a.default)(m,e.header))throw new r.JWSInvalid(`JWS Protected and JWS Unprotected Header Parameter names must be disjoint`);let h={...m,...e.header},g=(0,c.default)(r.JWSInvalid,new Map([[`b64`,!0]]),p?.crit,m,h),_=!0;if(g.has(`b64`)&&(_=m.b64,typeof _!=`boolean`))throw new r.JWSInvalid(`The "b64" (base64url-encode payload) Header Parameter must be a boolean`);let{alg:v}=h;if(typeof v!=`string`||!v)throw new r.JWSInvalid(`JWS "alg" (Algorithm) Header Parameter missing or invalid`);let y=p&&(0,l.default)(`algorithms`,p.algorithms);if(y&&!y.has(v))throw new r.JOSEAlgNotAllowed(`"alg" (Algorithm) Header Parameter value not allowed`);if(_){if(typeof e.payload!=`string`)throw new r.JWSInvalid(`JWS Payload must be a string`)}else if(typeof e.payload!=`string`&&!(e.payload instanceof Uint8Array))throw new r.JWSInvalid(`JWS Payload must be a string or an Uint8Array instance`);let b=!1;typeof f==`function`?(f=await f(m,e),b=!0,(0,s.checkKeyTypeWithJwk)(v,f,`verify`),(0,u.isJWK)(f)&&(f=await(0,d.importJWK)(f,v))):(0,s.checkKeyTypeWithJwk)(v,f,`verify`);let x=(0,i.concat)(i.encoder.encode(e.protected??``),i.encoder.encode(`.`),typeof e.payload==`string`?i.encoder.encode(e.payload):e.payload),S;try{S=(0,t.decode)(e.signature)}catch{throw new r.JWSInvalid(`Failed to base64url decode the signature`)}if(!await(0,n.default)(v,f,S,x))throw new r.JWSSignatureVerificationFailed;let C;if(_)try{C=(0,t.decode)(e.payload)}catch{throw new r.JWSInvalid(`Failed to base64url decode the payload`)}else C=typeof e.payload==`string`?i.encoder.encode(e.payload):e.payload;let w={payload:C};return e.protected!==void 0&&(w.protectedHeader=m),e.header!==void 0&&(w.unprotectedHeader=e.header),b?{...w,key:f}:w}})),sa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.compactVerify=i;let t=oa(),n=H(),r=B();async function i(e,i,a){if(e instanceof Uint8Array&&(e=r.decoder.decode(e)),typeof e!=`string`)throw new n.JWSInvalid(`Compact JWS must be a string or Uint8Array`);let{0:o,1:s,2:c,length:l}=e.split(`.`);if(l!==3)throw new n.JWSInvalid(`Invalid Compact JWS`);let u=await(0,t.flattenedVerify)({payload:s,protected:o,signature:c},i,a),d={payload:u.payload,protectedHeader:u.protectedHeader};return typeof i==`function`?{...d,key:u.key}:d}})),ca=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generalVerify=i;let t=oa(),n=H(),r=q();async function i(e,i,a){if(!(0,r.default)(e))throw new n.JWSInvalid(`General JWS must be an object`);if(!Array.isArray(e.signatures)||!e.signatures.every(r.default))throw new n.JWSInvalid(`JWS Signatures missing or incorrect type`);for(let n of e.signatures)try{return await(0,t.flattenedVerify)({header:n.header,payload:e.payload,protected:n.protected,signature:n.signature},i,a)}catch{}throw new n.JWSSignatureVerificationFailed}})),la=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=e=>Math.floor(e.getTime()/1e3)})),ua=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;e.default=e=>{let n=t.exec(e);if(!n||n[4]&&n[1])throw TypeError(`Invalid time period format`);let r=parseFloat(n[2]),i=n[3].toLowerCase(),a;switch(i){case`sec`:case`secs`:case`second`:case`seconds`:case`s`:a=Math.round(r);break;case`minute`:case`minutes`:case`min`:case`mins`:case`m`:a=Math.round(r*60);break;case`hour`:case`hours`:case`hr`:case`hrs`:case`h`:a=Math.round(r*3600);break;case`day`:case`days`:case`d`:a=Math.round(r*86400);break;case`week`:case`weeks`:case`w`:a=Math.round(r*604800);break;default:a=Math.round(r*31557600)}return n[1]===`-`||n[4]===`ago`?-a:a}})),da=n((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=H(),n=B(),r=la(),i=ua(),a=q(),o=e=>e.toLowerCase().replace(/^application\//,``),s=(e,t)=>typeof e==`string`?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1;e.default=(e,c,l={})=>{let u;try{u=JSON.parse(n.decoder.decode(c))}catch{}if(!(0,a.default)(u))throw new t.JWTInvalid(`JWT Claims Set must be a top-level JSON object`);let{typ:d}=l;if(d&&(typeof e.typ!=`string`||o(e.typ)!==o(d)))throw new t.JWTClaimValidationFailed(`unexpected "typ" JWT header value`,u,`typ`,`check_failed`);let{requiredClaims:f=[],issuer:p,subject:m,audience:h,maxTokenAge:g}=l,_=[...f];g!==void 0&&_.push(`iat`),h!==void 0&&_.push(`aud`),m!==void 0&&_.push(`sub`),p!==void 0&&_.push(`iss`);for(let e of new Set(_.reverse()))if(!(e in u))throw new t.JWTClaimValidationFailed(`missing required "${e}" claim`,u,e,`missing`);if(p&&!(Array.isArray(p)?p:[p]).includes(u.iss))throw new t.JWTClaimValidationFailed(`unexpected "iss" claim value`,u,`iss`,`check_failed`);if(m&&u.sub!==m)throw new t.JWTClaimValidationFailed(`unexpected "sub" claim value`,u,`sub`,`check_failed`);if(h&&!s(u.aud,typeof h==`string`?[h]:h))throw new t.JWTClaimValidationFailed(`unexpected "aud" claim value`,u,`aud`,`check_failed`);let v;switch(typeof l.clockTolerance){case`string`:v=(0,i.default)(l.clockTolerance);break;case`number`:v=l.clockTolerance;break;case`undefined`:v=0;break;default:throw TypeError(`Invalid clockTolerance option type`)}let{currentDate:y}=l,b=(0,r.default)(y||new Date);if((u.iat!==void 0||g)&&typeof u.iat!=`number`)throw new t.JWTClaimValidationFailed(`"iat" claim must be a number`,u,`iat`,`invalid`);if(u.nbf!==void 0){if(typeof u.nbf!=`number`)throw new t.JWTClaimValidationFailed(`"nbf" claim must be a number`,u,`nbf`,`invalid`);if(u.nbf>b+v)throw new t.JWTClaimValidationFailed(`"nbf" claim timestamp check failed`,u,`nbf`,`check_failed`)}if(u.exp!==void 0){if(typeof u.exp!=`number`)throw new t.JWTClaimValidationFailed(`"exp" claim must be a number`,u,`exp`,`invalid`);if(u.exp<=b-v)throw new t.JWTExpired(`"exp" claim timestamp check failed`,u,`exp`,`check_failed`)}if(g){let e=b-u.iat,n=typeof g==`number`?g:(0,i.default)(g);if(e-v>n)throw new t.JWTExpired(`"iat" claim timestamp check failed (too far in the past)`,u,`iat`,`check_failed`);if(e<0-v)throw new t.JWTClaimValidationFailed(`"iat" claim timestamp check failed (it should be in the past)`,u,`iat`,`check_failed`)}return u}})),fa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.jwtVerify=i;let t=sa(),n=da(),r=H();async function i(e,i,a){let o=await(0,t.compactVerify)(e,i,a);if(o.protectedHeader.crit?.includes(`b64`)&&o.protectedHeader.b64===!1)throw new r.JWTInvalid(`JWTs MUST NOT use unencoded payload`);let s={payload:(0,n.default)(o.protectedHeader,o.payload,a),protectedHeader:o.protectedHeader};return typeof i==`function`?{...s,key:o.key}:s}})),pa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.jwtDecrypt=i;let t=Ki(),n=da(),r=H();async function i(e,i,a){let o=await(0,t.compactDecrypt)(e,i,a),s=(0,n.default)(o.protectedHeader,o.plaintext,a),{protectedHeader:c}=o;if(c.iss!==void 0&&c.iss!==s.iss)throw new r.JWTClaimValidationFailed(`replicated "iss" claim header parameter mismatch`,s,`iss`,`mismatch`);if(c.sub!==void 0&&c.sub!==s.sub)throw new r.JWTClaimValidationFailed(`replicated "sub" claim header parameter mismatch`,s,`sub`,`mismatch`);if(c.aud!==void 0&&JSON.stringify(c.aud)!==JSON.stringify(s.aud))throw new r.JWTClaimValidationFailed(`replicated "aud" claim header parameter mismatch`,s,`aud`,`mismatch`);let l={payload:s,protectedHeader:c};return typeof i==`function`?{...l,key:o.key}:l}})),ma=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CompactEncrypt=void 0;let t=Qi();e.CompactEncrypt=class{_flattened;constructor(e){this._flattened=new t.FlattenedEncrypt(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){let n=await this._flattened.encrypt(e,t);return[n.protected,n.encrypted_key,n.iv,n.ciphertext,n.tag].join(`.`)}}})),ha=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FlattenedSign=void 0;let t=V(),n=ia(),r=Ti(),i=H(),a=B(),o=zi(),s=Ui();e.FlattenedSign=class{_payload;_protectedHeader;_unprotectedHeader;constructor(e){if(!(e instanceof Uint8Array))throw TypeError(`payload must be an instance of Uint8Array`);this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}async sign(e,c){if(!this._protectedHeader&&!this._unprotectedHeader)throw new i.JWSInvalid(`either setProtectedHeader or setUnprotectedHeader must be called before #sign()`);if(!(0,r.default)(this._protectedHeader,this._unprotectedHeader))throw new i.JWSInvalid(`JWS Protected and JWS Unprotected Header Parameter names must be disjoint`);let l={...this._protectedHeader,...this._unprotectedHeader},u=(0,s.default)(i.JWSInvalid,new Map([[`b64`,!0]]),c?.crit,this._protectedHeader,l),d=!0;if(u.has(`b64`)&&(d=this._protectedHeader.b64,typeof d!=`boolean`))throw new i.JWSInvalid(`The "b64" (base64url-encode payload) Header Parameter must be a boolean`);let{alg:f}=l;if(typeof f!=`string`||!f)throw new i.JWSInvalid(`JWS "alg" (Algorithm) Header Parameter missing or invalid`);(0,o.checkKeyTypeWithJwk)(f,e,`sign`);let p=this._payload;d&&(p=a.encoder.encode((0,t.encode)(p)));let m;m=this._protectedHeader?a.encoder.encode((0,t.encode)(JSON.stringify(this._protectedHeader))):a.encoder.encode(``);let h=(0,a.concat)(m,a.encoder.encode(`.`),p),g=await(0,n.default)(f,e,h),_={signature:(0,t.encode)(g),payload:``};return d&&(_.payload=a.decoder.decode(p)),this._unprotectedHeader&&(_.header=this._unprotectedHeader),this._protectedHeader&&(_.protected=a.decoder.decode(m)),_}}})),ga=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CompactSign=void 0;let t=ha();e.CompactSign=class{_flattened;constructor(e){this._flattened=new t.FlattenedSign(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){let n=await this._flattened.sign(e,t);if(n.payload===void 0)throw TypeError(`use the flattened module for creating JWS with b64: false`);return`${n.protected}.${n.payload}.${n.signature}`}}})),_a=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GeneralSign=void 0;let t=ha(),n=H();var r=class{parent;protectedHeader;unprotectedHeader;options;key;constructor(e,t,n){this.parent=e,this.key=t,this.options=n}setProtectedHeader(e){if(this.protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this.protectedHeader=e,this}setUnprotectedHeader(e){if(this.unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this.unprotectedHeader=e,this}addSignature(...e){return this.parent.addSignature(...e)}sign(...e){return this.parent.sign(...e)}done(){return this.parent}};e.GeneralSign=class{_payload;_signatures=[];constructor(e){this._payload=e}addSignature(e,t){let n=new r(this,e,t);return this._signatures.push(n),n}async sign(){if(!this._signatures.length)throw new n.JWSInvalid(`at least one signature must be added`);let e={signatures:[],payload:``};for(let r=0;r<this._signatures.length;r++){let i=this._signatures[r],a=new t.FlattenedSign(this._payload);a.setProtectedHeader(i.protectedHeader),a.setUnprotectedHeader(i.unprotectedHeader);let{payload:o,...s}=await a.sign(i.key,i.options);if(r===0)e.payload=o;else if(e.payload!==o)throw new n.JWSInvalid(`inconsistent use of JWS Unencoded Payload (RFC7797)`);e.signatures.push(s)}return e}}})),va=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ProduceJWT=void 0;let t=la(),n=q(),r=ua();function i(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}e.ProduceJWT=class{_payload;constructor(e={}){if(!(0,n.default)(e))throw TypeError(`JWT Claims Set MUST be an object`);this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return this._payload=typeof e==`number`?{...this._payload,nbf:i(`setNotBefore`,e)}:e instanceof Date?{...this._payload,nbf:i(`setNotBefore`,(0,t.default)(e))}:{...this._payload,nbf:(0,t.default)(new Date)+(0,r.default)(e)},this}setExpirationTime(e){return this._payload=typeof e==`number`?{...this._payload,exp:i(`setExpirationTime`,e)}:e instanceof Date?{...this._payload,exp:i(`setExpirationTime`,(0,t.default)(e))}:{...this._payload,exp:(0,t.default)(new Date)+(0,r.default)(e)},this}setIssuedAt(e){return this._payload=e===void 0?{...this._payload,iat:(0,t.default)(new Date)}:e instanceof Date?{...this._payload,iat:i(`setIssuedAt`,(0,t.default)(e))}:typeof e==`string`?{...this._payload,iat:i(`setIssuedAt`,(0,t.default)(new Date)+(0,r.default)(e))}:{...this._payload,iat:i(`setIssuedAt`,e)},this}}})),ya=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SignJWT=void 0;let t=ga(),n=H(),r=B(),i=va();e.SignJWT=class extends i.ProduceJWT{_protectedHeader;setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,i){let a=new t.CompactSign(r.encoder.encode(JSON.stringify(this._payload)));if(a.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes(`b64`)&&this._protectedHeader.b64===!1)throw new n.JWTInvalid(`JWTs MUST NOT use unencoded payload`);return a.sign(e,i)}}})),ba=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EncryptJWT=void 0;let t=ma(),n=B(),r=va();e.EncryptJWT=class extends r.ProduceJWT{_cek;_iv;_keyManagementParameters;_protectedHeader;_replicateIssuerAsHeader;_replicateSubjectAsHeader;_replicateAudienceAsHeader;setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError(`setKeyManagementParameters can only be called once`);return this._keyManagementParameters=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError(`setContentEncryptionKey can only be called once`);return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError(`setInitializationVector can only be called once`);return this._iv=e,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(e,r){let i=new t.CompactEncrypt(n.encoder.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),i.setProtectedHeader(this._protectedHeader),this._iv&&i.setInitializationVector(this._iv),this._cek&&i.setContentEncryptionKey(this._cek),this._keyManagementParameters&&i.setKeyManagementParameters(this._keyManagementParameters),i.encrypt(e,r)}}})),xa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.calculateJwkThumbprint=s,e.calculateJwkThumbprintUri=c;let t=hi(),n=V(),r=H(),i=B(),a=q(),o=(e,t)=>{if(typeof e!=`string`||!e)throw new r.JWKInvalid(`${t} missing or invalid`)};async function s(e,s){if(!(0,a.default)(e))throw TypeError(`JWK must be an object`);if(s??=`sha256`,s!==`sha256`&&s!==`sha384`&&s!==`sha512`)throw TypeError(`digestAlgorithm must one of "sha256", "sha384", or "sha512"`);let c;switch(e.kty){case`EC`:o(e.crv,`"crv" (Curve) Parameter`),o(e.x,`"x" (X Coordinate) Parameter`),o(e.y,`"y" (Y Coordinate) Parameter`),c={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case`OKP`:o(e.crv,`"crv" (Subtype of Key Pair) Parameter`),o(e.x,`"x" (Public Key) Parameter`),c={crv:e.crv,kty:e.kty,x:e.x};break;case`RSA`:o(e.e,`"e" (Exponent) Parameter`),o(e.n,`"n" (Modulus) Parameter`),c={e:e.e,kty:e.kty,n:e.n};break;case`oct`:o(e.k,`"k" (Key Value) Parameter`),c={k:e.k,kty:e.kty};break;default:throw new r.JOSENotSupported(`"kty" (Key Type) Parameter missing or unsupported`)}let l=i.encoder.encode(JSON.stringify(c));return(0,n.encode)(await(0,t.default)(s,l))}async function c(e,t){t??=`sha256`;let n=await s(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${n}`}})),Sa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.EmbeddedJWK=i;let t=Ri(),n=q(),r=H();async function i(e,i){let a={...e,...i?.header};if(!(0,n.default)(a.jwk))throw new r.JWSInvalid(`"jwk" (JSON Web Key) Header Parameter must be a JSON object`);let o=await(0,t.importJWK)({...a.jwk,ext:!0},a.alg);if(o instanceof Uint8Array||o.type!==`public`)throw new r.JWSInvalid(`"jwk" (JSON Web Key) Header Parameter must be a public key`);return o}})),Ca=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLocalJWKSet=u;let t=Ri(),n=H(),r=q();function i(e){switch(typeof e==`string`&&e.slice(0,2)){case`RS`:case`PS`:return`RSA`;case`ES`:return`EC`;case`Ed`:return`OKP`;default:throw new n.JOSENotSupported(`Unsupported "alg" value for a JSON Web Key Set`)}}function a(e){return e&&typeof e==`object`&&Array.isArray(e.keys)&&e.keys.every(o)}function o(e){return(0,r.default)(e)}function s(e){return typeof structuredClone==`function`?structuredClone(e):JSON.parse(JSON.stringify(e))}var c=class{_jwks;_cached=new WeakMap;constructor(e){if(!a(e))throw new n.JWKSInvalid(`JSON Web Key Set malformed`);this._jwks=s(e)}async getKey(e,t){let{alg:r,kid:a}={...e,...t?.header},o=i(r),s=this._jwks.keys.filter(e=>{let t=o===e.kty;if(t&&typeof a==`string`&&(t=a===e.kid),t&&typeof e.alg==`string`&&(t=r===e.alg),t&&typeof e.use==`string`&&(t=e.use===`sig`),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes(`verify`)),t)switch(r){case`ES256`:t=e.crv===`P-256`;break;case`ES256K`:t=e.crv===`secp256k1`;break;case`ES384`:t=e.crv===`P-384`;break;case`ES512`:t=e.crv===`P-521`;break;case`Ed25519`:t=e.crv===`Ed25519`;break;case`EdDSA`:t=e.crv===`Ed25519`||e.crv===`Ed448`}return t}),{0:c,length:u}=s;if(u===0)throw new n.JWKSNoMatchingKey;if(u!==1){let e=new n.JWKSMultipleMatchingKeys,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(let e of s)try{yield await l(t,e,r)}catch{}},e}return l(this._cached,c,r)}};async function l(e,r,i){let a=e.get(r)||e.set(r,{}).get(r);if(a[i]===void 0){let e=await(0,t.importJWK)({...r,ext:!0},i);if(e instanceof Uint8Array||e.type!==`public`)throw new n.JWKSInvalid(`JSON Web Key Set members must be public keys`);a[i]=e}return a[i]}function u(e){let t=new c(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>s(t._jwks),enumerable:!0,configurable:!1,writable:!1}}),n}})),wa=n((t=>{Object.defineProperty(t,"__esModule",{value:!0});let n=e(`node:http`),r=e(`node:https`),i=e(`node:events`),a=H(),o=B();t.default=async(e,t,s)=>{let c;switch(e.protocol){case`https:`:c=r.get;break;case`http:`:c=n.get;break;default:throw TypeError(`Unsupported URL protocol.`)}let{agent:l,headers:u}=s,d=c(e.href,{agent:l,timeout:t,headers:u}),[f]=await Promise.race([(0,i.once)(d,`response`),(0,i.once)(d,`timeout`)]);if(!f)throw d.destroy(),new a.JWKSTimeout;if(f.statusCode!==200)throw new a.JOSEError(`Expected 200 OK from the JSON Web Key Set HTTP response`);let p=[];for await(let e of f)p.push(e);try{return JSON.parse(o.decoder.decode((0,o.concat)(...p)))}catch{throw new a.JOSEError(`Failed to parse the JSON Web Key Set HTTP response as JSON`)}}})),Ta=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.experimental_jwksCache=e.jwksCache=void 0,e.createRemoteJWKSet=l;let t=wa(),n=H(),r=Ca(),i=q();function a(){return typeof WebSocketPair<`u`||typeof navigator<`u`&&navigator.userAgent===`Cloudflare-Workers`||typeof EdgeRuntime<`u`&&EdgeRuntime===`vercel`}let o;(typeof navigator>`u`||!navigator.userAgent?.startsWith?.(`Mozilla/5.0 `))&&(o=`jose/v5.10.0`),e.jwksCache=Symbol();function s(e,t){return!(typeof e!=`object`||!e||!(`uat`in e)||typeof e.uat!=`number`||Date.now()-e.uat>=t||!(`jwks`in e)||!(0,i.default)(e.jwks)||!Array.isArray(e.jwks.keys)||!Array.prototype.every.call(e.jwks.keys,i.default))}var c=class{_url;_timeoutDuration;_cooldownDuration;_cacheMaxAge;_jwksTimestamp;_pendingFetch;_options;_local;_cache;constructor(t,n){if(!(t instanceof URL))throw TypeError(`url must be an instance of URL`);this._url=new URL(t.href),this._options={agent:n?.agent,headers:n?.headers},this._timeoutDuration=typeof n?.timeoutDuration==`number`?n?.timeoutDuration:5e3,this._cooldownDuration=typeof n?.cooldownDuration==`number`?n?.cooldownDuration:3e4,this._cacheMaxAge=typeof n?.cacheMaxAge==`number`?n?.cacheMaxAge:6e5,n?.[e.jwksCache]!==void 0&&(this._cache=n?.[e.jwksCache],s(n?.[e.jwksCache],this._cacheMaxAge)&&(this._jwksTimestamp=this._cache.uat,this._local=(0,r.createLocalJWKSet)(this._cache.jwks)))}coolingDown(){return typeof this._jwksTimestamp==`number`&&Date.now()<this._jwksTimestamp+this._cooldownDuration}fresh(){return typeof this._jwksTimestamp==`number`&&Date.now()<this._jwksTimestamp+this._cacheMaxAge}async getKey(e,t){(!this._local||!this.fresh())&&await this.reload();try{return await this._local(e,t)}catch(r){if(r instanceof n.JWKSNoMatchingKey&&this.coolingDown()===!1)return await this.reload(),this._local(e,t);throw r}}async reload(){this._pendingFetch&&a()&&(this._pendingFetch=void 0);let e=new Headers(this._options.headers);o&&!e.has(`User-Agent`)&&(e.set(`User-Agent`,o),this._options.headers=Object.fromEntries(e.entries())),this._pendingFetch||=(0,t.default)(this._url,this._timeoutDuration,this._options).then(e=>{this._local=(0,r.createLocalJWKSet)(e),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=e),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(e=>{throw this._pendingFetch=void 0,e}),await this._pendingFetch}};function l(e,t){let n=new c(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!n._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>n._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}e.experimental_jwksCache=e.jwksCache})),Ea=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.UnsecuredJWT=void 0;let t=V(),n=B(),r=H(),i=da(),a=va();e.UnsecuredJWT=class extends a.ProduceJWT{encode(){return`${t.encode(JSON.stringify({alg:`none`}))}.${t.encode(JSON.stringify(this._payload))}.`}static decode(e,a){if(typeof e!=`string`)throw new r.JWTInvalid(`Unsecured JWT must be a string`);let{0:o,1:s,2:c,length:l}=e.split(`.`);if(l!==3||c!==``)throw new r.JWTInvalid(`Invalid Unsecured JWT`);let u;try{if(u=JSON.parse(n.decoder.decode(t.decode(o))),u.alg!==`none`)throw Error()}catch{throw new r.JWTInvalid(`Invalid Unsecured JWT`)}return{payload:(0,i.default)(u,t.decode(s),a),header:u}}}})),Da=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decode=e.encode=void 0;let t=V();e.encode=t.encode,e.decode=t.decode})),Oa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decodeProtectedHeader=i;let t=Da(),n=B(),r=q();function i(e){let i;if(typeof e==`string`){let t=e.split(`.`);(t.length===3||t.length===5)&&([i]=t)}else if(typeof e==`object`&&e){if(`protected`in e)i=e.protected;else throw TypeError(`Token does not contain a Protected Header`)}try{if(typeof i!=`string`||!i)throw Error();let e=JSON.parse(n.decoder.decode((0,t.decode)(i)));if(!(0,r.default)(e))throw Error();return e}catch{throw TypeError(`Invalid Token or Protected Header formatting`)}}})),ka=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.decodeJwt=a;let t=Da(),n=B(),r=q(),i=H();function a(e){if(typeof e!=`string`)throw new i.JWTInvalid(`JWTs must use Compact JWS serialization, JWT must be a string`);let{1:a,length:o}=e.split(`.`);if(o===5)throw new i.JWTInvalid(`Only JWTs using Compact JWS serialization can be decoded`);if(o!==3)throw new i.JWTInvalid(`Invalid JWT`);if(!a)throw new i.JWTInvalid(`JWTs must contain a payload`);let s;try{s=(0,t.decode)(a)}catch{throw new i.JWTInvalid(`Failed to base64url decode the payload`)}let c;try{c=JSON.parse(n.decoder.decode(s))}catch{throw new i.JWTInvalid(`Failed to parse the decoded payload as JSON`)}if(!(0,r.default)(c))throw new i.JWTInvalid(`Invalid JWT Claims Set`);return c}})),Aa=n((t=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateSecret=s,t.generateKeyPair=c;let n=e(`node:crypto`),r=e(`node:util`),i=gi(),a=H(),o=(0,r.promisify)(n.generateKeyPair);async function s(e,t){let r;switch(e){case`HS256`:case`HS384`:case`HS512`:case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:r=parseInt(e.slice(-3),10);break;case`A128KW`:case`A192KW`:case`A256KW`:case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:case`A128GCM`:case`A192GCM`:case`A256GCM`:r=parseInt(e.slice(1,4),10);break;default:throw new a.JOSENotSupported(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`)}return(0,n.createSecretKey)((0,i.default)(new Uint8Array(r>>3)))}async function c(e,t){switch(e){case`RS256`:case`RS384`:case`RS512`:case`PS256`:case`PS384`:case`PS512`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:case`RSA1_5`:{let e=t?.modulusLength??2048;if(typeof e!=`number`||e<2048)throw new a.JOSENotSupported(`Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used`);return await o(`rsa`,{modulusLength:e,publicExponent:65537})}case`ES256`:return o(`ec`,{namedCurve:`P-256`});case`ES256K`:return o(`ec`,{namedCurve:`secp256k1`});case`ES384`:return o(`ec`,{namedCurve:`P-384`});case`ES512`:return o(`ec`,{namedCurve:`P-521`});case`Ed25519`:return o(`ed25519`);case`EdDSA`:switch(t?.crv){case void 0:case`Ed25519`:return o(`ed25519`);case`Ed448`:return o(`ed448`);default:throw new a.JOSENotSupported(`Invalid or unsupported crv option provided, supported values are Ed25519 and Ed448`)}case`ECDH-ES`:case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{let e=t?.crv??`P-256`;switch(e){case void 0:case`P-256`:case`P-384`:case`P-521`:return o(`ec`,{namedCurve:e});case`X25519`:return o(`x25519`);case`X448`:return o(`x448`);default:throw new a.JOSENotSupported(`Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448`)}}default:throw new a.JOSENotSupported(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`)}}})),ja=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateKeyPair=n;let t=Aa();async function n(e,n){return(0,t.generateKeyPair)(e,n)}})),Ma=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateSecret=n;let t=Aa();async function n(e,n){return(0,t.generateSecret)(e,n)}})),Na=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=`node:crypto`})),Pa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=Na().default})),Fa=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.cryptoRuntime=e.base64url=e.generateSecret=e.generateKeyPair=e.errors=e.decodeJwt=e.decodeProtectedHeader=e.importJWK=e.importX509=e.importPKCS8=e.importSPKI=e.exportJWK=e.exportSPKI=e.exportPKCS8=e.UnsecuredJWT=e.experimental_jwksCache=e.jwksCache=e.createRemoteJWKSet=e.createLocalJWKSet=e.EmbeddedJWK=e.calculateJwkThumbprintUri=e.calculateJwkThumbprint=e.EncryptJWT=e.SignJWT=e.GeneralSign=e.FlattenedSign=e.CompactSign=e.FlattenedEncrypt=e.CompactEncrypt=e.jwtDecrypt=e.jwtVerify=e.generalVerify=e.flattenedVerify=e.compactVerify=e.GeneralEncrypt=e.generalDecrypt=e.flattenedDecrypt=e.compactDecrypt=void 0;var t=Ki();Object.defineProperty(e,"compactDecrypt",{enumerable:!0,get:function(){return t.compactDecrypt}});var n=Gi();Object.defineProperty(e,"flattenedDecrypt",{enumerable:!0,get:function(){return n.flattenedDecrypt}});var r=qi();Object.defineProperty(e,"generalDecrypt",{enumerable:!0,get:function(){return r.generalDecrypt}});var i=$i();Object.defineProperty(e,"GeneralEncrypt",{enumerable:!0,get:function(){return i.GeneralEncrypt}});var a=sa();Object.defineProperty(e,"compactVerify",{enumerable:!0,get:function(){return a.compactVerify}});var o=oa();Object.defineProperty(e,"flattenedVerify",{enumerable:!0,get:function(){return o.flattenedVerify}});var s=ca();Object.defineProperty(e,"generalVerify",{enumerable:!0,get:function(){return s.generalVerify}});var c=fa();Object.defineProperty(e,"jwtVerify",{enumerable:!0,get:function(){return c.jwtVerify}});var l=pa();Object.defineProperty(e,"jwtDecrypt",{enumerable:!0,get:function(){return l.jwtDecrypt}});var u=ma();Object.defineProperty(e,"CompactEncrypt",{enumerable:!0,get:function(){return u.CompactEncrypt}});var d=Qi();Object.defineProperty(e,"FlattenedEncrypt",{enumerable:!0,get:function(){return d.FlattenedEncrypt}});var f=ga();Object.defineProperty(e,"CompactSign",{enumerable:!0,get:function(){return f.CompactSign}});var p=ha();Object.defineProperty(e,"FlattenedSign",{enumerable:!0,get:function(){return p.FlattenedSign}});var m=_a();Object.defineProperty(e,"GeneralSign",{enumerable:!0,get:function(){return m.GeneralSign}});var h=ya();Object.defineProperty(e,"SignJWT",{enumerable:!0,get:function(){return h.SignJWT}});var g=ba();Object.defineProperty(e,"EncryptJWT",{enumerable:!0,get:function(){return g.EncryptJWT}});var _=xa();Object.defineProperty(e,"calculateJwkThumbprint",{enumerable:!0,get:function(){return _.calculateJwkThumbprint}}),Object.defineProperty(e,"calculateJwkThumbprintUri",{enumerable:!0,get:function(){return _.calculateJwkThumbprintUri}});var v=Sa();Object.defineProperty(e,"EmbeddedJWK",{enumerable:!0,get:function(){return v.EmbeddedJWK}});var y=Ca();Object.defineProperty(e,"createLocalJWKSet",{enumerable:!0,get:function(){return y.createLocalJWKSet}});var b=Ta();Object.defineProperty(e,"createRemoteJWKSet",{enumerable:!0,get:function(){return b.createRemoteJWKSet}}),Object.defineProperty(e,"jwksCache",{enumerable:!0,get:function(){return b.jwksCache}}),Object.defineProperty(e,"experimental_jwksCache",{enumerable:!0,get:function(){return b.experimental_jwksCache}});var x=Ea();Object.defineProperty(e,"UnsecuredJWT",{enumerable:!0,get:function(){return x.UnsecuredJWT}});var S=Xi();Object.defineProperty(e,"exportPKCS8",{enumerable:!0,get:function(){return S.exportPKCS8}}),Object.defineProperty(e,"exportSPKI",{enumerable:!0,get:function(){return S.exportSPKI}}),Object.defineProperty(e,"exportJWK",{enumerable:!0,get:function(){return S.exportJWK}});var C=Ri();Object.defineProperty(e,"importSPKI",{enumerable:!0,get:function(){return C.importSPKI}}),Object.defineProperty(e,"importPKCS8",{enumerable:!0,get:function(){return C.importPKCS8}}),Object.defineProperty(e,"importX509",{enumerable:!0,get:function(){return C.importX509}}),Object.defineProperty(e,"importJWK",{enumerable:!0,get:function(){return C.importJWK}});var w=Oa();Object.defineProperty(e,"decodeProtectedHeader",{enumerable:!0,get:function(){return w.decodeProtectedHeader}});var ee=ka();Object.defineProperty(e,"decodeJwt",{enumerable:!0,get:function(){return ee.decodeJwt}}),e.errors=H();var te=ja();Object.defineProperty(e,"generateKeyPair",{enumerable:!0,get:function(){return te.generateKeyPair}});var ne=Ma();Object.defineProperty(e,"generateSecret",{enumerable:!0,get:function(){return ne.generateSecret}}),e.base64url=Da();var re=Pa();Object.defineProperty(e,"cryptoRuntime",{enumerable:!0,get:function(){return re.default}})})),Ia=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{verifyVercelOidcToken:()=>h}),t.exports=c(l);var u=Fa();let d=`https://oidc.vercel.com`,f=new URL(`https://oidc.vercel.com/.well-known/jwks`),p=[`RS256`],m=(0,u.createRemoteJWKSet)(f);async function h(e,t){let{algorithms:n,projectId:r=process.env.VERCEL_PROJECT_ID,environment:i=process.env.VERCEL_TARGET_ENV||process.env.VERCEL_ENV,ownerId:a,...o}=t??{};if(r===`*`&&a===void 0&&!g(o.audience))throw TypeError(`Expected ownerId or audience to be provided when projectId is '*'.`);let s=await(0,u.jwtVerify)(e,m,{...o,algorithms:n??p});return _(s.payload.iss),v({actual:s.payload.project_id,claim:`project_id`,env:`VERCEL_PROJECT_ID`,expected:r,option:`projectId`}),v({actual:s.payload.environment,claim:`environment`,env:`VERCEL_TARGET_ENV or VERCEL_ENV`,expected:i,option:`environment`}),y({actual:s.payload.owner_id,claim:`owner_id`,expected:a}),s}function g(e){return Array.isArray(e)?e.length>0:e!==void 0}function _(e){if(e!==d&&(typeof e!=`string`||!e.startsWith(`${d}/`)))throw TypeError(`Expected Vercel OIDC token iss claim to be "${d}" or to start with "${d}/".`)}function v({actual:e,claim:t,env:n,expected:r,option:i}){if(r!==`*`){if(r===void 0||r.length===0)throw TypeError(`Expected ${n} to be set or ${i} to be provided. Pass ${i}: '*' to allow any ${t} claim.`);if(!(Array.isArray(r)&&typeof e==`string`&&r.includes(e))&&e!==r)throw TypeError(Array.isArray(r)?`Expected Vercel OIDC token ${t} claim to be one of: ${r.map(e=>`"${e}"`).join(`, `)}.`:`Expected Vercel OIDC token ${t} claim to be "${r}".`)}}function y({actual:e,claim:t,expected:n}){if(n!==void 0&&e!==n)throw TypeError(`Expected Vercel OIDC token ${t} claim to be "${n}".`)}0&&(t.exports={verifyVercelOidcToken:h})})),La=n(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>m.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>m.RefreshAccessTokenFailedError,exchangeVercelOidcToken:()=>h.exchangeVercelOidcToken,getContext:()=>f.getContext,getVercelOidcToken:()=>u.getVercelOidcToken,getVercelOidcTokenSync:()=>d.getVercelOidcTokenSync,getVercelToken:()=>g.getVercelToken,verifyVercelOidcToken:()=>p.verifyVercelOidcToken}),t.exports=c(l);var u=mi(),d=pi(),f=fi(),p=Ia(),m=Mt(),h=di(),g=Nt();0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,exchangeVercelOidcToken,getContext,getVercelOidcToken,getVercelOidcTokenSync,getVercelToken,verifyVercelOidcToken})})),Ra=t(li(),1),za=La();async function Ba(e){let t=0,n=e.getReader(),r=[];try{for(;;){let{done:e,value:i}=await n.read();if(e)break;r.push(i),t+=i.length}}finally{n.releaseLock()}return Buffer.concat(r,t)}var Va=class{contentType=`application/json`;replacer;reviver;constructor(e={}){this.replacer=e.replacer,this.reviver=e.reviver}serialize(e){return Buffer.from(JSON.stringify(e,this.replacer),`utf8`)}async deserialize(e){let t=await Ba(e);return JSON.parse(t.toString(`utf8`),this.reviver)}},Ha=class extends Error{constructor(e){super(`Message ${e} not found`),this.name=`MessageNotFoundError`}},Ua=class extends Error{constructor(e,t){super(`Message ${e} not available for processing${t?`: ${t}`:``}`),this.name=`MessageNotAvailableError`}},Wa=class extends Error{constructor(e,t){super(`Message ${e} is corrupted: ${t}`),this.name=`MessageCorruptedError`}},Ga=class extends Error{retryAfter;constructor(e=`Too many requests`,t){super(e),this.name=`TooManyRequestsError`,this.retryAfter=t}},Ka=class extends Error{constructor(e=`Missing or invalid authentication token`){super(e),this.name=`UnauthorizedError`}},qa=class extends Error{constructor(e=`Queue environment doesn't match token environment`){super(e),this.name=`ForbiddenError`}},Ja=class extends Error{constructor(e){super(e),this.name=`BadRequestError`}},Ya=class extends Error{constructor(e=`Unexpected server error`){super(e),this.name=`InternalServerError`}},Xa=class extends Error{constructor(e,t=1,n=10){super(`Invalid limit: ${e}. Limit must be between ${t} and ${n}.`),this.name=`InvalidLimitError`}},Za=class extends Error{constructor(e){super(`Message ${e} has already been processed`),this.name=`MessageAlreadyProcessedError`}},Qa=class extends Error{deploymentId;constructor(e,t){super(e),this.name=`ConsumerDiscoveryError`,this.deploymentId=t}},$a=class extends Error{constructor(e=`Consumer registry not configured`){super(e),this.name=`ConsumerRegistryNotConfiguredError`}},eo=300,to=30,no=60,ro=10,io=3e3,ao=3,oo=250;function so(e){return Math.min(no,Math.max(ro,e/5))}var co=class{client;topicName;consumerGroupName;visibilityTimeout;constructor(e,t,n,r={}){this.client=e,this.topicName=t,this.consumerGroupName=n,this.visibilityTimeout=Math.max(to,r.visibilityTimeoutSeconds??eo)}isClientError(e){return e instanceof Ua||e instanceof Ha||e instanceof Ja||e instanceof Ka||e instanceof qa}isNetworkError(e){return e instanceof TypeError}async directiveCallWithRetries(e){let t;for(let n=1;n<=ao;n++)try{return await e()}catch(e){if(t=e,n===ao)throw e;if(e instanceof Ga){if(e.retryAfter===void 0)throw e;await new Promise(t=>setTimeout(t,e.retryAfter*1e3));continue}if(!this.isNetworkError(e))throw e;let r=oo*n,i=r/2+r/2*Math.random();await new Promise(e=>setTimeout(e,i))}throw t}startVisibilityExtension(e,t){let n=!0,r=!1,i,a=null,o=so(this.visibilityTimeout)*1e3,s=o;if(t?.visibilityDeadline){let e=t.visibilityDeadline.getTime()-Date.now();s=e>0?so(e/1e3)*1e3:0}let c=new Promise(e=>{i=e}),l=()=>{r||(r=!0,i())},u=async()=>{if(!n){l();return}try{await this.client.changeVisibility({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e,visibilityTimeoutSeconds:this.visibilityTimeout}),n?a=setTimeout(()=>u(),o):l()}catch(t){if(this.isClientError(t)){console.error(`Visibility extension failed with client error for receipt handle ${e} (stopping retries):`,t),l();return}console.error(`Failed to extend visibility for receipt handle ${e} (will retry in ${io/1e3}s):`,t),n?a=setTimeout(()=>u(),io):l()}};return a=setTimeout(()=>u(),s),async(e=!1)=>{n=!1,a&&=(clearTimeout(a),null),e?await c:l()}}async finalizePayload(e){let t=this.client.getTransport();if(t.finalize&&e!=null)try{await t.finalize(e)}catch(e){console.warn(`Failed to finalize message payload:`,e)}}async processMessage(e,t,n){let r=this.startVisibilityExtension(e.receiptHandle,n),i={messageId:e.messageId,deliveryCount:e.deliveryCount,createdAt:e.createdAt,expiresAt:e.expiresAt??new Date(e.createdAt.getTime()+864e5),topicName:this.topicName,consumerGroup:this.consumerGroupName,region:this.client.getRegion()};try{await t(e.payload,i),await r(),await this.client.acknowledgeMessage({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle})}catch(t){if(await r(),n?.retry){let r;try{r=n.retry(t,i)}catch(e){console.warn(`retry handler threw:`,e)}if(r){if(`acknowledge`in r&&r.acknowledge){try{await this.directiveCallWithRetries(()=>this.client.acknowledgeMessage({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle}))}catch(e){console.warn(`Failed to acknowledge message:`,e)}await this.finalizePayload(e.payload);return}if(`afterSeconds`in r&&typeof r.afterSeconds==`number`){try{await this.directiveCallWithRetries(()=>this.client.changeVisibility({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle,visibilityTimeoutSeconds:r.afterSeconds}))}catch(e){console.warn(`Failed to reschedule message for retry:`,e)}await this.finalizePayload(e.payload);return}}}throw await this.finalizePayload(e.payload),t}}async consumeMessage(e,t,n){await this.processMessage(t,e,n)}async consume(e,t){let n=t?.retry;if(t&&`messageId`in t){let r=await this.client.receiveMessageById({queueName:this.topicName,consumerGroup:this.consumerGroupName,messageId:t.messageId,visibilityTimeoutSeconds:this.visibilityTimeout});return await this.processMessage(r.message,e,{retry:n}),1}{let r=t&&`limit`in t?t.limit:1,i=0;for await(let t of this.client.receiveMessages({queueName:this.topicName,consumerGroup:this.consumerGroupName,visibilityTimeoutSeconds:this.visibilityTimeout,limit:r}))i++,await this.processMessage(t,e,{retry:n});return i}}get name(){return this.consumerGroupName}get topic(){return this.topicName}},lo=class{client;topicName;constructor(e,t){this.client=e,this.topicName=t}async publish(e,t){let n=await this.client.sendMessage({queueName:this.topicName,payload:e,idempotencyKey:t?.idempotencyKey,retentionSeconds:t?.retentionSeconds,delaySeconds:t?.delaySeconds,headers:t?.headers,telemetry:t?.telemetry});return n.messageId&&X()&&cs(this.topicName,n.messageId,this.client.getRegion(),t?.delaySeconds,t?.retentionSeconds),{messageId:n.messageId}}consumerGroup(e,t){return new co(this.client,this.topicName,e,t)}get name(){return this.topicName}},uo=`com.vercel.queue.v1beta`,fo=`com.vercel.queue.v2beta`;function po(e,t){let n=t.slice(0,-1);return e.startsWith(n)}function mo(e){return typeof e==`object`&&!!e}function ho(e,t){if(!t||!t.includes(`application/cloudevents+json`))throw Error(`Invalid content type: expected 'application/cloudevents+json'`);if(!mo(e)||!e.type||!e.source||!e.id||!mo(e.data))throw Error(`Invalid CloudEvent: missing required fields`);if(e.type!==`com.vercel.queue.v1beta`)throw Error(`Invalid CloudEvent type: expected '${uo}', got '${String(e.type)}'`);let{data:n}=e,r=[];if(`queueName`in n||r.push(`queueName`),`consumerGroup`in n||r.push(`consumerGroup`),`messageId`in n||r.push(`messageId`),r.length>0)throw Error(`Missing required CloudEvent data fields: ${r.join(`, `)}`);return{queueName:String(n.queueName),consumerGroup:String(n.consumerGroup),messageId:String(n.messageId)}}function J(e,t){if(e instanceof Headers)return e.get(t);let n=e[t];return Array.isArray(n)?n[0]??null:n??null}function go(e){let t=J(e,`ce-type`);if(t!==`com.vercel.queue.v2beta`)throw Error(`Invalid CloudEvent type: expected '${fo}', got '${t}'`);let n=J(e,`ce-vqsqueuename`),r=J(e,`ce-vqsconsumergroup`),i=J(e,`ce-vqsmessageid`),a=[];if(n||a.push(`ce-vqsqueuename`),r||a.push(`ce-vqsconsumergroup`),i||a.push(`ce-vqsmessageid`),a.length>0)throw Error(`Missing required CloudEvent headers: ${a.join(`, `)}`);let o=J(e,`ce-vqsregion`)??void 0;if(o!==void 0&&!/^[a-z]{2,5}[0-9]{1,2}$/.test(o))throw Error(`Invalid ce-vqsregion header: ${JSON.stringify(o)}. Region must match /^[a-z]{2,5}[0-9]{1,2}$/ (e.g. "iad1", "lhr1").`);let s={queueName:n,consumerGroup:r,messageId:i,region:o},c=J(e,`ce-vqsreceipthandle`);if(!c)return s;let l={...s,receiptHandle:c},u=J(e,`ce-vqsdeliverycount`);u&&(l.deliveryCount=parseInt(u,10));let d=J(e,`ce-vqscreatedat`);d&&(l.createdAt=d);let f=J(e,`ce-vqsexpiresat`);f&&(l.expiresAt=f);let p=J(e,`content-type`);p&&(l.contentType=p);let m=J(e,`ce-vqsvisibilitydeadline`);return m&&(l.visibilityDeadline=m),l}function _o(e,t){if(J(t,`ce-type`)===`com.vercel.queue.v2beta`){let n=go(t);return`receiptHandle`in n&&(n.parsedPayload=e),n}return ho(e,J(t,`content-type`))}async function vo(e){if(e.headers.get(`ce-type`)===`com.vercel.queue.v2beta`){let t=go(e.headers);return`receiptHandle`in t&&e.body&&(t.rawBody=e.body),t}let t;try{t=await e.json()}catch{throw Error(`Failed to parse CloudEvent from request body`)}let n={};return e.headers.forEach((e,t)=>{n[t]=e}),_o(t,n)}async function yo(e,t,n){let{queueName:r,consumerGroup:i,messageId:a}=t;if(!n?.client)throw Error(`HandleCallbackOptions.client is required`);let o=Us(n.client);t.region&&(o=o.withRegion(t.region));let s=new lo(o,r).consumerGroup(i,n?.visibilityTimeoutSeconds===void 0?void 0:{visibilityTimeoutSeconds:n.visibilityTimeoutSeconds});if(`receiptHandle`in t){let r=o.getTransport(),i;if(t.rawBody)i=await r.deserialize(t.rawBody);else if(t.parsedPayload!==void 0)i=t.parsedPayload;else throw Error(`Binary mode callback with receipt handle is missing payload`);let c={messageId:a,payload:i,deliveryCount:t.deliveryCount??1,createdAt:t.createdAt?new Date(t.createdAt):new Date,expiresAt:t.expiresAt?new Date(t.expiresAt):void 0,contentType:t.contentType??r.contentType,receiptHandle:t.receiptHandle},l=t.visibilityDeadline?new Date(t.visibilityDeadline):void 0;await s.consumeMessage(e,c,{visibilityDeadline:l,retry:n?.retry})}else await s.consume(e,{messageId:a,retry:n?.retry})}var Y=Ra.default.cyan(`[queue]`),bo=Ra.default.green(`✓`),xo=Ra.default.red(`✗`),So=Ra.default.yellow(`↻`);function X(){return process.env.NODE_ENV===`development`&&process.env.VERCEL_DEPLOYMENT_ID===void 0}var Z=Symbol.for(`@vercel/queue.devRouteMappings`);function Co(e){let t=``;for(let n of e)n===`_`?t+=`__`:n===`/`?t+=`_S`:n===`.`?t+=`_D`:/[A-Za-z0-9-]/.test(n)?t+=n:t+=`_`+n.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`);return t}function wo(){let e=globalThis;if(Z in e)return e[Z]??null;try{let t=j.join(process.cwd(),`vercel.json`);if(!Bt.existsSync(t))return e[Z]=null,null;let n=JSON.parse(Bt.readFileSync(t,`utf-8`));if(!n.functions)return e[Z]=null,null;let r=[];for(let[e,t]of Object.entries(n.functions))if(t.experimentalTriggers){for(let n of t.experimentalTriggers)if(n.type?.startsWith(`queue/`)&&n.topic){if(n.type!==`queue/v2beta`){console.warn(`${Y} Unsupported trigger type "${n.type}" for topic "${n.topic}" in ${e}. Use "queue/v2beta" instead.`);continue}r.push({filePath:e,topic:n.topic,consumer:Co(e),retryAfterSeconds:n.retryAfterSeconds})}}return e[Z]=r.length>0?r:null,e[Z]}catch(t){return console.warn(`${Y} Failed to read vercel.json:`,t),e[Z]=null,null}}function To(e){let t=wo();return t?t.filter(t=>t.topic.includes(`*`)?po(e,t.topic):t.topic===e):[]}function Eo(e,t){return To(e).find(e=>e.consumer===t)?.retryAfterSeconds}function Do(e){return/^src\/(app|pages|server)\//.test(e)?e.slice(4):null}function Oo(e,t){return e===t||L(e,t)}function ko(e){let t=wo();if(!t)return[];let n=process.cwd(),r;try{r=j.relative(n,e)}catch{return[]}let i=r.replace(/\\/g,`/`),a=Do(i);return t.filter(e=>Oo(i,e.filePath)||a!==null&&Oo(a,e.filePath))}function Ao(e){let t=e.match(/\((.+?):\d+:\d+\)/);if(t||=e.match(/at\s+(.+?):\d+:\d+/),!t)return null;let n=t[1].trim();if(n===`native`||n.startsWith(`node:`)||n.startsWith(`internal`))return null;if(n.startsWith(`file://`))try{n=new URL(n).pathname}catch{return null}return/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(n)?null:(n.startsWith(`./`)&&(n=n.slice(2)),n)}var jo;function Mo(){if(jo)return jo;try{let e=typeof __dirname<`u`?__dirname:j.dirname(new URL(import.meta.url).pathname);jo=j.resolve(e,`..`)}catch{jo=``}return jo}function No(){let e=Error().stack;if(!e)return null;let t=e.split(`
9
9
  `).slice(1),n=Mo();for(let e of t){let t=Ao(e);if(!t)continue;let r=j.isAbsolute(t)?t:j.resolve(process.cwd(),t),i;try{i=Bt.realpathSync(r)}catch{i=r}if(!(n&&i.startsWith(n)))return i}return null}var Po=Symbol.for(`@vercel/queue.devHandlerRegistry`);function Fo(){let e=globalThis;return e[Po]||(e[Po]=new Map),e[Po]}function Io(e,t,n,r){let i=ko(j.isAbsolute(e)?e:j.resolve(process.cwd(),e));if(i.length===0)return!1;let a=Fo();for(let e of i){let i=e.topic,o=a.get(i)??[],s={consumerGroup:e.consumer,handler:t,client:n,options:r},c=o.findIndex(t=>t.consumerGroup===e.consumer);c>=0?o[c]=s:o.push(s),a.set(i,o)}return!0}function Lo(e,t,n,r){let i=r??No();if(!i){console.warn(`${Y} Could not determine caller file path for handler registration.`);return}if(!Io(i,e,t,n)){let e=wo();if(e&&e.length>0)return;let t=process.cwd(),n;try{n=j.relative(t,i).replace(/\\/g,`/`)}catch{n=i}console.warn(`${Y} handleCallback() in ${n} has no matching experimentalTriggers in vercel.json. This handler won't receive messages.
10
10
 
11
11
  Add a trigger to vercel.json:
@@ -1,12 +1,18 @@
1
1
  import { type ProgrammaticAgentSource } from "#compiler/source-graph.js";
2
+ import { type JsonObject } from "#shared/json.js";
2
3
  /** The small descriptor used for extensions shipped inside eve. */
3
4
  export interface BundledExtensionDescriptor {
4
- readonly loadMount: () => Promise<unknown>;
5
+ readonly entryPath: string;
6
+ readonly importSpecifier: string;
7
+ readonly config: JsonObject;
5
8
  readonly namespace: string;
6
9
  readonly sourceDirectory: string;
7
10
  }
8
11
  export interface BundledExtensionMount {
9
12
  readonly declaration: ProgrammaticAgentSource;
13
+ readonly entryPath: string;
14
+ readonly importSpecifier: string;
15
+ readonly config: JsonObject;
10
16
  readonly namespace: string;
11
17
  readonly packageName: string;
12
18
  readonly packageRoot: string;
@@ -1 +1 @@
1
- import{resolveInstalledPackageInfo,resolvePackageRoot}from"#internal/application/package.js";import{packageStateNamespace}from"#discover/extensions.js";import{defineProgrammaticExtensionMountDeclaration}from"#compiler/source-graph.js";function createBundledExtensionMount(e){let t=resolveInstalledPackageInfo(),n=t.name,r=resolvePackageRoot(),i=`eve@${t.version}:development-extensions-v1`,a=`extensions/${e.namespace}.ts`,o=defineProgrammaticExtensionMountDeclaration({id:`eve:development-extension:${e.namespace}`,revision:i,modules:[{logicalPath:a,loadNamespace:async()=>{let t=globalThis,r=Symbol.for(`eve.ext-config-scope`),i=t[r];t[r]=packageStateNamespace(n);try{return{default:await e.loadMount()}}finally{i===void 0?delete t[r]:t[r]=i}}}]});return Object.freeze({declaration:o,namespace:e.namespace,packageName:n,packageRoot:r,sourceRoot:e.sourceDirectory,specifier:`${n}/${e.namespace}`})}export{createBundledExtensionMount};
1
+ import{resolveInstalledPackageInfo,resolvePackageRoot}from"#internal/application/package.js";import{defineProgrammaticExtensionMountDeclaration}from"#compiler/source-graph.js";import{parseJsonObject}from"#shared/json.js";function createBundledExtensionMount(e){let t=resolveInstalledPackageInfo(),n=t.name,r=resolvePackageRoot(),i=`eve@${t.version}:development-extensions-v1`,a=`extensions/${e.namespace}.ts`,o=parseJsonObject(e.config),s=defineProgrammaticExtensionMountDeclaration({id:`eve:development-extension:${e.namespace}`,revision:i,modules:[{logicalPath:a,loadNamespace:async()=>{let{default:t}=await import(e.importSpecifier);return{default:t(o)}}}]});return Object.freeze({declaration:s,entryPath:e.entryPath,importSpecifier:e.importSpecifier,config:o,namespace:e.namespace,packageName:n,packageRoot:r,sourceRoot:e.sourceDirectory,specifier:`${n}/${e.namespace}`})}export{createBundledExtensionMount};