eve 0.47.7 → 0.49.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.
- package/CHANGELOG.md +35 -0
- package/dist/src/channel/channel-address.js +1 -1
- package/dist/src/channel/delivery-metadata.d.ts +1 -0
- package/dist/src/channel/delivery-metadata.js +1 -1
- package/dist/src/channel/types.d.ts +20 -8
- package/dist/src/chunks/{use-eve-agent-Dg5S44kG.js → use-eve-agent-BZnOzAVd.js} +25 -5
- package/dist/src/chunks/{use-eve-agent-B5zw1dwj.js → use-eve-agent-Bgp6INfi.js} +25 -5
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/integration-connect.d.ts +2 -1
- package/dist/src/cli/commands/integration-connect.js +1 -1
- package/dist/src/cli/commands/register-integration-commands.d.ts +3 -1
- package/dist/src/cli/commands/register-integration-commands.js +1 -1
- package/dist/src/cli/commands/registry-metadata.d.ts +30 -0
- package/dist/src/cli/commands/registry-metadata.js +1 -1
- package/dist/src/cli/commands/registry-package.d.ts +6 -0
- package/dist/src/cli/commands/registry-package.js +1 -1
- package/dist/src/cli/commands/registry-pnpm-build-policy-flow.d.ts +30 -0
- package/dist/src/cli/commands/registry-pnpm-build-policy-flow.js +1 -0
- package/dist/src/cli/commands/registry-pnpm-build-policy.d.ts +12 -0
- package/dist/src/cli/commands/registry-pnpm-build-policy.js +6 -0
- package/dist/src/cli/commands/registry-recovery.d.ts +4 -0
- package/dist/src/cli/commands/registry-recovery.js +1 -1
- package/dist/src/cli/commands/registry.d.ts +1 -1
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/dev/command-options.d.ts +2 -0
- package/dist/src/cli/dev/run-interactive-ui.js +1 -1
- package/dist/src/cli/dev/tui/blocks.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/registry-result-message.d.ts +17 -0
- package/dist/src/cli/dev/tui/registry-result-message.js +3 -0
- package/dist/src/cli/dev/tui/runner.d.ts +11 -4
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +9 -3
- package/dist/src/cli/dev/tui/setup-commands.js +2 -3
- package/dist/src/cli/dev/tui/setup-flow.d.ts +15 -5
- package/dist/src/cli/dev/tui/setup-panel.d.ts +6 -1
- package/dist/src/cli/dev/tui/setup-panel.js +4 -4
- package/dist/src/cli/dev/tui/setup-selection-input.d.ts +1 -0
- package/dist/src/cli/dev/tui/setup-selection-input.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/tui-prompter.js +1 -1
- package/dist/src/cli/dev/tui/tui.d.ts +3 -4
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/run.js +2 -2
- package/dist/src/client/agent-info-schema.d.ts +1 -0
- package/dist/src/client/agent-info-schema.js +1 -1
- package/dist/src/client/open-stream.d.ts +1 -0
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +7 -6
- package/dist/src/compiled/@opentelemetry/api/index.d.ts +6 -0
- package/dist/src/compiled/@workflow/builders/LICENSE.md +201 -0
- package/dist/src/compiled/@workflow/builders/index.d.ts +62 -0
- package/dist/src/compiled/@workflow/builders/index.js +1 -0
- package/dist/src/compiled/@workflow/core/attribute-changes.d.ts +2 -4
- package/dist/src/compiled/@workflow/core/capabilities.d.ts +10 -9
- package/dist/src/compiled/@workflow/core/capture-stack.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/class-serialization.d.ts +8 -8
- package/dist/src/compiled/@workflow/core/context-violation-error.d.ts +5 -5
- package/dist/src/compiled/@workflow/core/create-hook.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/describe-error.d.ts +7 -7
- package/dist/src/compiled/@workflow/core/encryption.d.ts +5 -5
- package/dist/src/compiled/@workflow/core/events-consumer.d.ts +49 -14
- package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +4 -4
- package/dist/src/compiled/@workflow/core/global.d.ts +4 -2
- package/dist/src/compiled/@workflow/core/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/log-format.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/private.d.ts +40 -78
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/replay-payload-cache.d.ts +13 -17
- package/dist/src/compiled/@workflow/core/runtime/compute-instance.d.ts +4 -3
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +27 -27
- package/dist/src/compiled/@workflow/core/runtime/count-step-started-events.d.ts +7 -7
- package/dist/src/compiled/@workflow/core/runtime/deployment-guard.d.ts +7 -7
- package/dist/src/compiled/@workflow/core/runtime/get-port-lazy.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/runtime/get-world-lazy.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +30 -49
- package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +21 -10
- package/dist/src/compiled/@workflow/core/runtime/quickjs-runtime.d.ts +31 -15
- package/dist/src/compiled/@workflow/core/runtime/quickjs-serde.d.ts +10 -10
- package/dist/src/compiled/@workflow/core/runtime/replay-budget.d.ts +4 -4
- package/dist/src/compiled/@workflow/core/runtime/replay-recovery-reporter.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +20 -12
- package/dist/src/compiled/@workflow/core/runtime/resume-latency.d.ts +37 -30
- package/dist/src/compiled/@workflow/core/runtime/run-id-time.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/runtime/run.d.ts +22 -5
- package/dist/src/compiled/@workflow/core/runtime/runs.d.ts +4 -4
- package/dist/src/compiled/@workflow/core/runtime/start.d.ts +3 -3
- package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +14 -14
- package/dist/src/compiled/@workflow/core/runtime/step-latency.d.ts +42 -25
- package/dist/src/compiled/@workflow/core/runtime/step-ownership.d.ts +6 -6
- package/dist/src/compiled/@workflow/core/runtime/step-single-flight.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +38 -24
- package/dist/src/compiled/@workflow/core/runtime/unserializable-step.d.ts +34 -0
- package/dist/src/compiled/@workflow/core/runtime/vm-mode.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/runtime/wait-continuation.d.ts +31 -9
- package/dist/src/compiled/@workflow/core/runtime/wait-until.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/runtime/world-compatibility.d.ts +20 -9
- package/dist/src/compiled/@workflow/core/runtime/world-init.d.ts +5 -5
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/sealed-box.d.ts +7 -7
- package/dist/src/compiled/@workflow/core/serialization/codec-devalue-vm.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/codec-devalue.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/codec.d.ts +4 -4
- package/dist/src/compiled/@workflow/core/serialization/compression.d.ts +12 -11
- package/dist/src/compiled/@workflow/core/serialization/encryption.d.ts +7 -7
- package/dist/src/compiled/@workflow/core/serialization/format.d.ts +6 -6
- package/dist/src/compiled/@workflow/core/serialization/hardened.d.ts +23 -22
- package/dist/src/compiled/@workflow/core/serialization/index.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/reducers/class-vm.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/reducers/step-function-vm.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization/types.d.ts +5 -5
- package/dist/src/compiled/@workflow/core/serialization/workflow-vm.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/serialization-format.d.ts +11 -11
- package/dist/src/compiled/@workflow/core/serialization.d.ts +18 -19
- package/dist/src/compiled/@workflow/core/source-map.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +5 -5
- package/dist/src/compiled/@workflow/core/step/writable-stream.d.ts +3 -3
- package/dist/src/compiled/@workflow/core/symbols.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +71 -20
- package/dist/src/compiled/@workflow/core/telemetry.d.ts +15 -3
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/vm/script-cache.d.ts +9 -11
- package/dist/src/compiled/@workflow/core/workflow/abort-controller.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow/world-init-stub.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/index.d.ts +18 -18
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/analytics.d.ts +3 -2
- package/dist/src/compiled/@workflow/world/attributes-validation.d.ts +28 -0
- package/dist/src/compiled/@workflow/world/attributes.d.ts +8 -107
- package/dist/src/compiled/@workflow/world/env-config.d.ts +5 -5
- package/dist/src/compiled/@workflow/world/event-metadata.d.ts +132 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +42 -96
- package/dist/src/compiled/@workflow/world/hooks.d.ts +12 -11
- package/dist/src/compiled/@workflow/world/index.d.ts +3 -3
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +94 -39
- package/dist/src/compiled/@workflow/world/queue.d.ts +29 -22
- package/dist/src/compiled/@workflow/world/runs.d.ts +20 -0
- package/dist/src/compiled/@workflow/world/slot-identity.d.ts +3 -3
- package/dist/src/compiled/@workflow/world/spec-version.d.ts +82 -15
- package/dist/src/compiled/@workflow/world/ulid.d.ts +2 -2
- package/dist/src/compiled/@workflow/world-local/index.js +5 -5
- package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-DXbpwBdw.js → attribute-changes-BwAadFfB.js} +3 -3
- package/dist/src/compiled/_chunks/workflow/debug-log-CVPstO1D.js +1 -0
- package/dist/src/compiled/_chunks/workflow/dist-CgbVZs5l.js +40 -0
- package/dist/src/compiled/_chunks/workflow/dist-DjojkP5e.js +3 -0
- package/dist/src/compiled/_chunks/workflow/frames-CZ9eHShe.js +3 -0
- package/dist/src/compiled/_chunks/workflow/global-singleton-BNinwFrL.js +1 -0
- package/dist/src/compiled/_chunks/workflow/private-CZFMABEf.js +1 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-BToMtPbH.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-DzyAoGh4.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-3_A5uOp-.js +1 -0
- package/dist/src/compiled/_chunks/workflow/undici-DfxNX5og.js +95 -0
- package/dist/src/compiled/_chunks/workflow/wait-until-BtySPYD0.js +15 -0
- package/dist/src/compiled/_chunks/workflow/ws-transport-PnVVxT0R.js +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +2 -2
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +2 -2
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-tool.js +1 -1
- package/dist/src/context/keys.d.ts +3 -8
- package/dist/src/eve-channel/index.js +1 -1
- package/dist/src/eve-channel/types.d.ts +7 -7
- package/dist/src/execution/accepted-delivery-deployment.d.ts +7 -0
- package/dist/src/execution/accepted-delivery-deployment.js +1 -0
- package/dist/src/execution/agent-handle-dispatch.js +1 -1
- package/dist/src/execution/cancel-descendant-turns-step.d.ts +4 -1
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/continuation-conflict-step.d.ts +10 -0
- package/dist/src/execution/continuation-conflict-step.js +1 -0
- package/dist/src/execution/delegated-parent-notification.js +1 -1
- package/dist/src/execution/delegation-tool.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +14 -31
- package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-start.d.ts +33 -0
- package/dist/src/execution/dispatch-runtime-actions-start.js +1 -0
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/dispatch-turn-step.js +1 -1
- package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.d.ts +2 -0
- package/dist/src/execution/durable-session-migrations/turn-workflow-v1-to-v2.js +1 -0
- package/dist/src/execution/durable-session-migrations/turn-workflow.d.ts +25 -3
- package/dist/src/execution/durable-session-migrations/turn-workflow.js +1 -1
- package/dist/src/execution/dynamic-connections.js +1 -1
- package/dist/src/execution/eve-workflow-attributes.js +1 -1
- package/dist/src/execution/finalize-terminal-session.d.ts +17 -0
- package/dist/src/execution/finalize-terminal-session.js +1 -0
- package/dist/src/execution/inline-turn.d.ts +29 -0
- package/dist/src/execution/inline-turn.js +1 -0
- package/dist/src/execution/next-driver-action.d.ts +9 -4
- package/dist/src/execution/node-step.js +1 -1
- package/dist/src/execution/parked-delivery-wait.js +1 -1
- package/dist/src/execution/pending-turn-state.d.ts +1 -0
- package/dist/src/execution/pending-turn-state.js +1 -1
- package/dist/src/execution/proxied-deliver-step.js +1 -1
- package/dist/src/execution/remote-agent-dispatch.d.ts +2 -0
- package/dist/src/execution/remote-agent-dispatch.js +1 -1
- package/dist/src/execution/runtime-errors.d.ts +0 -12
- package/dist/src/execution/runtime-errors.js +1 -1
- package/dist/src/execution/session-command-token.d.ts +2 -0
- package/dist/src/execution/session-command-token.js +1 -1
- package/dist/src/execution/session-timeout-steps.js +1 -1
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/stable-workflow-names.d.ts +12 -0
- package/dist/src/execution/stable-workflow-names.js +1 -0
- package/dist/src/execution/subagent-event-proxy-step.d.ts +3 -0
- package/dist/src/execution/subagent-event-proxy-step.js +1 -1
- package/dist/src/execution/subagent-hitl-proxy.d.ts +2 -1
- package/dist/src/execution/subagent-hitl-proxy.js +1 -1
- package/dist/src/execution/subagent-start-local.js +1 -1
- package/dist/src/execution/subagent-start-remote.d.ts +2 -0
- package/dist/src/execution/subagent-start-remote.js +1 -1
- package/dist/src/execution/tasks/child/steps.d.ts +2 -0
- package/dist/src/execution/tasks/child/steps.js +1 -1
- package/dist/src/execution/tasks/child/workflow.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
- package/dist/src/execution/tasks/parent/dispatch.js +1 -1
- package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -1
- package/dist/src/execution/tasks/parent/run-parent.js +1 -1
- package/dist/src/execution/tasks/parent/tool-execution.js +1 -1
- package/dist/src/execution/terminal-session-completion-step.js +1 -1
- package/dist/src/execution/terminal-session-event.d.ts +13 -0
- package/dist/src/execution/terminal-session-event.js +1 -0
- package/dist/src/execution/terminal-session-failure-step.d.ts +1 -0
- package/dist/src/execution/terminal-session-failure-step.js +1 -1
- package/dist/src/execution/tool-run/answer.d.ts +3 -0
- package/dist/src/execution/tool-run/answer.js +1 -0
- package/dist/src/execution/tool-run/background.d.ts +14 -0
- package/dist/src/execution/tool-run/background.js +1 -0
- package/dist/src/execution/tool-run/cancel.d.ts +7 -0
- package/dist/src/execution/tool-run/cancel.js +1 -0
- package/dist/src/execution/tool-run/dispatch.d.ts +24 -0
- package/dist/src/execution/tool-run/dispatch.js +1 -0
- package/dist/src/execution/tool-run/emit-run-report-step.d.ts +7 -0
- package/dist/src/execution/tool-run/emit-run-report-step.js +1 -0
- package/dist/src/execution/tool-run/messages.d.ts +70 -0
- package/dist/src/execution/tool-run/messages.js +1 -0
- package/dist/src/execution/tool-run/owner-channels.d.ts +29 -0
- package/dist/src/execution/tool-run/owner-channels.js +1 -0
- package/dist/src/execution/tool-run/owner-inbox.d.ts +11 -0
- package/dist/src/execution/tool-run/owner-inbox.js +1 -0
- package/dist/src/execution/tool-run/owner.d.ts +13 -0
- package/dist/src/execution/tool-run/owner.js +1 -0
- package/dist/src/execution/tool-run/resume-hook-step.d.ts +4 -0
- package/dist/src/execution/tool-run/resume-hook-step.js +1 -0
- package/dist/src/execution/tool-run/run-control.d.ts +18 -0
- package/dist/src/execution/tool-run/run-control.js +1 -0
- package/dist/src/execution/tool-run/start.d.ts +11 -0
- package/dist/src/execution/tool-run/start.js +1 -0
- package/dist/src/execution/tool-run/types.d.ts +21 -0
- package/dist/src/execution/tool-run/types.js +1 -0
- package/dist/src/execution/tool-run/workflow.d.ts +9 -0
- package/dist/src/execution/tool-run/workflow.js +1 -0
- package/dist/src/execution/tools/subagent/local.js +1 -1
- package/dist/src/execution/turn-cancellation-control.d.ts +2 -0
- package/dist/src/execution/turn-cancellation-control.js +1 -1
- package/dist/src/execution/turn-control-receiver.js +1 -1
- package/dist/src/execution/turn-dispatch.d.ts +4 -2
- package/dist/src/execution/turn-dispatch.js +1 -1
- package/dist/src/execution/turn-execution-cursor.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/wire/session-inbox-contract.d.ts +2 -2
- package/dist/src/execution/wire/session-inbox-contract.js +1 -1
- package/dist/src/execution/wire/session-inbox-encoder.d.ts +6 -2
- package/dist/src/execution/wire/session-inbox-encoder.js +1 -1
- package/dist/src/execution/wire/session-inbox-resume.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v1.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.d.ts +0 -2
- package/dist/src/execution/wire/session-inbox-wire.v2-migration.js +1 -1
- package/dist/src/execution/wire/session-inbox-wire.v2.migration.d.ts +3 -0
- package/dist/src/execution/wire/session-inbox-wire.v2.migration.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v3.d.ts +480 -0
- package/dist/src/execution/wire/session-inbox-wire.v3.js +1 -0
- package/dist/src/execution/wire/session-inbox-wire.v3.migration.d.ts +3 -0
- package/dist/src/execution/wire/session-inbox-wire.v3.migration.js +1 -0
- package/dist/src/execution/workflow-entry-finalization.js +1 -1
- package/dist/src/execution/workflow-entry.d.ts +5 -1
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-registry.d.ts +5 -0
- package/dist/src/execution/workflow-registry.js +1 -0
- package/dist/src/execution/workflow-runtime.d.ts +17 -19
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/execution/workflow-webhook-route.d.ts +4 -0
- package/dist/src/execution/workflow-webhook-route.js +1 -0
- package/dist/src/harness/attachment-staging.js +1 -1
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/proxy-input-requests.d.ts +10 -0
- package/dist/src/harness/proxy-input-requests.js +1 -1
- package/dist/src/harness/runtime-actions.d.ts +2 -0
- package/dist/src/harness/runtime-actions.js +1 -1
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/tool-loop.js +2 -2
- package/dist/src/harness/tool-runs.d.ts +21 -0
- package/dist/src/harness/tool-runs.js +1 -0
- package/dist/src/harness/tools.js +1 -1
- package/dist/src/instrumentation/content-policy.d.ts +3 -1
- package/dist/src/instrumentation/content-policy.js +1 -1
- package/dist/src/instrumentation/runtime.d.ts +2 -2
- package/dist/src/instrumentation/runtime.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/attachments/errors.d.ts +3 -0
- package/dist/src/internal/authored-module-loader.d.ts +7 -1
- package/dist/src/internal/authored-module-loader.js +3 -3
- package/dist/src/internal/authored-package-boundary.js +1 -1
- package/dist/src/internal/authored-runtime-modules.d.ts +2 -0
- package/dist/src/internal/authored-runtime-modules.js +1 -1
- package/dist/src/internal/nitro/development-generation.d.ts +2 -0
- package/dist/src/internal/nitro/development-generation.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/host/dev-host-fingerprint.js +1 -1
- package/dist/src/internal/nitro/routes/agent-info/build-agent-info-response.js +1 -1
- package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
- package/dist/src/internal/workflow/development-world-client.js +1 -1
- package/dist/src/internal/workflow-bundle/authored-workflow-directives.d.ts +17 -0
- package/dist/src/internal/workflow-bundle/authored-workflow-directives.js +1 -0
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.d.ts +19 -0
- package/dist/src/internal/workflow-bundle/authored-workflow-modules.js +1 -0
- package/dist/src/internal/workflow-bundle/builder-support.d.ts +17 -2
- package/dist/src/internal/workflow-bundle/builder-support.js +4 -3
- package/dist/src/internal/workflow-bundle/builder.d.ts +2 -2
- package/dist/src/internal/workflow-bundle/builder.js +2 -2
- package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.d.ts +2 -0
- package/dist/src/internal/workflow-bundle/dynamic-capability-transform-plugin.js +1 -1
- package/dist/src/internal/workflow-bundle/dynamic-tool-ast-references.d.ts +3 -0
- package/dist/src/internal/workflow-bundle/dynamic-tool-transform.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-builders.d.ts +6 -2
- package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-core-shim.d.ts +3 -0
- package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -1
- package/dist/src/internal/workflow-bundle/workflow-directive-ast.d.ts +7 -0
- package/dist/src/internal/workflow-bundle/workflow-directive-ast.js +1 -0
- package/dist/src/internal/workflow-bundle/workflow-transformer.d.ts +15 -1
- package/dist/src/internal/workflow-bundle/workflow-transformer.js +4 -4
- package/dist/src/packages/eve-catalog/src/index.js +1 -1
- package/dist/src/protocol/baggage.d.ts +6 -0
- package/dist/src/protocol/baggage.js +1 -0
- package/dist/src/public/channels/slack/attachments.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +7 -1
- package/dist/src/public/channels/slack/slackChannel.js +1 -1
- package/dist/src/public/channels/teams/attachments.d.ts +2 -2
- package/dist/src/public/channels/teams/attachments.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.js +1 -1
- package/dist/src/public/channels/telegram/attachments.js +1 -1
- package/dist/src/public/definitions/remote-agent.d.ts +6 -3
- package/dist/src/public/workflow/index.d.ts +3 -0
- package/dist/src/public/workflow/index.js +1 -0
- package/dist/src/public/workflow-modules.d.js +1 -0
- package/dist/src/public/workflow-modules.d.ts +11 -0
- package/dist/src/runtime/actions/keys.js +1 -1
- package/dist/src/runtime/tools/registry.js +1 -1
- package/dist/src/setup/connection-connector.d.ts +4 -2
- package/dist/src/setup/connection-connector.js +2 -2
- package/dist/src/setup/flows/login.js +1 -1
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/provider.d.ts +5 -0
- package/dist/src/setup/flows/provider.js +4 -4
- package/dist/src/setup/flows/registry-session.d.ts +24 -7
- package/dist/src/setup/flows/registry-session.js +1 -1
- package/dist/src/setup/flows/registry.d.ts +35 -29
- package/dist/src/setup/flows/registry.js +2 -1
- package/dist/src/setup/integrations/web/setup.d.ts +0 -2
- package/dist/src/setup/integrations/web/setup.js +1 -1
- package/dist/src/setup/prompter.d.ts +24 -4
- package/dist/src/setup/prompter.js +1 -1
- package/dist/src/setup/scaffold/connections/catalog.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/vercel-project.js +0 -0
- package/dist/src/shared/dispatch-action.d.ts +6 -0
- package/dist/src/shared/forwarded-trace-policy.d.ts +28 -0
- package/dist/src/shared/forwarded-trace-policy.js +1 -0
- package/dist/src/shared/instrumentation-decision.d.ts +3 -0
- package/dist/src/shared/instrumentation-decision.js +1 -1
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/tools/behavior.d.ts +6 -0
- package/dist/src/tools/definition.d.ts +39 -3
- package/dist/src/tracing/agent-otel-provider.js +2 -2
- package/dist/src/tracing/agent-otel-session-context.js +1 -1
- package/dist/src/tracing/agent-trace-context-store.d.ts +1 -1
- package/dist/src/tracing/agent-trace-context-store.js +1 -1
- package/dist/src/tracing/otel-declaration.d.ts +5 -3
- package/dist/src/tracing/otel-registration.d.ts +1 -1
- package/dist/src/tracing/otel-registration.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/channels/custom.mdx +6 -0
- package/docs/channels/eve.mdx +14 -6
- package/docs/channels/mcp.mdx +4 -1
- package/docs/channels/teams.mdx +6 -1
- package/docs/concepts/sessions-runs-and-streaming.md +4 -2
- package/docs/guides/auth-and-route-protection.md +5 -1
- package/docs/guides/client/messages.mdx +6 -0
- package/docs/guides/dev-tui.md +30 -18
- package/docs/guides/instrumentation.md +1 -1
- package/docs/guides/remote-agents.md +25 -0
- package/docs/install-integrations.mdx +2 -0
- package/docs/instructions.mdx +1 -1
- package/docs/memory/custom-provider.md +214 -0
- package/docs/memory/file.md +129 -0
- package/docs/memory/meta.json +5 -0
- package/docs/memory/overview.mdx +282 -0
- package/docs/patterns/multi-tenant-memory.md +12 -20
- package/docs/reference/cli.md +2 -2
- package/docs/tools/meta.json +1 -1
- package/docs/tools/overview.mdx +7 -0
- package/docs/tools/workflows.mdx +288 -0
- package/package.json +18 -7
- package/dist/src/compiled/_chunks/workflow/dist-CqvWKNQv.js +0 -3
- package/dist/src/compiled/_chunks/workflow/dist-Dk0aQqFO.js +0 -40
- package/dist/src/compiled/_chunks/workflow/dist-DpYyXbJv.js +0 -1
- package/dist/src/compiled/_chunks/workflow/env-config-L94XftKz.js +0 -1
- package/dist/src/compiled/_chunks/workflow/frames-Dl2Hcma4.js +0 -3
- package/dist/src/compiled/_chunks/workflow/private-CuQ4HTFC.js +0 -1
- package/dist/src/compiled/_chunks/workflow/resume-hook-E-Nkx8q_.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-cIeex2KF.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-CxFsdxB_.js +0 -1
- package/dist/src/compiled/_chunks/workflow/spec-version-DBUVfF_R.js +0 -1
- package/dist/src/compiled/_chunks/workflow/undici-DznrXKcM.js +0 -95
- package/dist/src/compiled/_chunks/workflow/wait-until-BZHmJCAW.js +0 -15
- package/dist/src/compiled/_chunks/workflow/ws-transport-Ct6yyRWZ.js +0 -1
- package/dist/src/internal/authored-directive-prologue.d.ts +0 -4
- package/dist/src/internal/authored-directive-prologue.js +0 -1
- package/docs/memory.md +0 -408
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Ar as e,Or as t,jr as n,kr as r}from"./wait-until-BtySPYD0.js";import{i}from"./dist-DjojkP5e.js";import{nt as a,ot as o}from"./dist-CgbVZs5l.js";function s(e,t){let n=Error.captureStackTrace;n?.(e,t)}const c=Symbol.for(`nodejs.util.inspect.custom`);function l(e){return`code`in e?`\`${e.code}\``:`dim`in e?e.dim:e.text}function u(e){return`code`in e?t(e.code):`dim`in e?r(e.dim):e.text}function d(e){return e.type===`docs`?`docs: ${e.url}`:e.segments.map(l).join(``)}function f(t){return t.type===`docs`?e(t.url):t.segments.map(u).join(``)}function p(e){let t=[e.title.map(l).join(``)];return e.details.forEach((n,r)=>{let i=r===e.details.length-1,a=i?`╰▶ `:`├▶ `,o=i?` `:`│ `;d(n).split(`
|
|
2
2
|
`).forEach((e,n)=>{t.push(`${n===0?a:o}${e}`)})}),t.join(`
|
|
3
|
-
`)}function m(
|
|
3
|
+
`)}function m(e){return n(e.title.map(u).join(``),e.details.map(f))}var h=class extends Error{fatal=!0;#e;constructor(e){super(p(e)),this.#e=e}[c](){let e=m(this.#e),t=this.message.split(`
|
|
4
4
|
`).length,n=(this.stack??``).split(`
|
|
5
5
|
`).slice(t).join(`
|
|
6
|
-
`);return n?`${this.name}: ${e}\n${n}`:`${this.name}: ${e}`}toString(){return`${this.name}: ${m(this.#e)}`}},g=class extends h{name=`NotInWorkflowContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a workflow function`}],details:[{type:`docs`,url:t}]})}},_=class extends h{name=`NotInStepContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a step function`}],details:[{type:`docs`,url:t}]})}},v=class extends h{name=`NotInWorkflowOrStepContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a workflow or step function`}],details:[{type:`docs`,url:t}]})}};const y=Symbol.for(`WORKFLOW_CONTEXT`);function b(){let e=globalThis[y];if(!e){let e=new v(`getWorkflowMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-workflow-metadata`);throw s(e,b),e}return e}var x=class extends h{name=`UnavailableInWorkflowContextError`;constructor(e,t){let n=globalThis[y]?.workflowName,r=(()=>{if(!n)return null;let e=n.match(/^(workflow\/|step\/)(.*)$/);return e?[{dim:e[1]},{text:e[2]}]:[{text:n}]})(),i=r?{type:`plain`,segments:[{text:`this call was made from the `},...r,{text:` workflow context.`}]}:{type:`plain`,segments:[{text:`this call was made from a workflow context.`}]};super({title:[{code:e},{text:` cannot be called from a workflow context.`}],details:[{type:`plain`,segments:[{text:`calling this in a workflow context can cause determinism issues.`}]},i,{type:`docs`,url:t}]})}};function S(e,t,n){let r=new g(e,t);throw s(r,n),r}function C(e,t,n){let r=new _(e,t);throw s(r,n),r}function w(e,t,n){let r=new v(e,t);throw s(r,n),r}function T(e,t,n){let r=new x(e,t);throw s(r,n),r}function E(e,t={}){if(typeof e!=`object`||!e||Array.isArray(e))throw new i(`setAttributes requires a plain object, got ${e===null?`null`:Array.isArray(e)?`array`:typeof e}`);let n=Object.entries(e).map(([e,t])=>({key:e,value:t===void 0?null:t}));if(n.length===0)return n;let r=t.allowReservedAttributes===!0;try{
|
|
6
|
+
`);return n?`${this.name}: ${e}\n${n}`:`${this.name}: ${e}`}toString(){return`${this.name}: ${m(this.#e)}`}},g=class extends h{name=`NotInWorkflowContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a workflow function`}],details:[{type:`docs`,url:t}]})}},_=class extends h{name=`NotInStepContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a step function`}],details:[{type:`docs`,url:t}]})}},v=class extends h{name=`NotInWorkflowOrStepContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a workflow or step function`}],details:[{type:`docs`,url:t}]})}};const y=Symbol.for(`WORKFLOW_CONTEXT`);function b(){let e=globalThis[y];if(!e){let e=new v(`getWorkflowMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-workflow-metadata`);throw s(e,b),e}return e}var x=class extends h{name=`UnavailableInWorkflowContextError`;constructor(e,t){let n=globalThis[y]?.workflowName,r=(()=>{if(!n)return null;let e=n.match(/^(workflow\/|step\/)(.*)$/);return e?[{dim:e[1]},{text:e[2]}]:[{text:n}]})(),i=r?{type:`plain`,segments:[{text:`this call was made from the `},...r,{text:` workflow context.`}]}:{type:`plain`,segments:[{text:`this call was made from a workflow context.`}]};super({title:[{code:e},{text:` cannot be called from a workflow context.`}],details:[{type:`plain`,segments:[{text:`calling this in a workflow context can cause determinism issues.`}]},i,{type:`docs`,url:t}]})}};function S(e,t,n){let r=new g(e,t);throw s(r,n),r}function C(e,t,n){let r=new _(e,t);throw s(r,n),r}function w(e,t,n){let r=new v(e,t);throw s(r,n),r}function T(e,t,n){let r=new x(e,t);throw s(r,n),r}function E(e,t={}){if(typeof e!=`object`||!e||Array.isArray(e))throw new i(`setAttributes requires a plain object, got ${e===null?`null`:Array.isArray(e)?`array`:typeof e}`);let n=Object.entries(e).map(([e,t])=>({key:e,value:t===void 0?null:t}));if(n.length===0)return n;let r=t.allowReservedAttributes===!0;try{o(n,{allowReservedAttributes:r})}catch(e){throw e instanceof a?new i(e.message):e}return n}export{w as a,b as c,v as d,S as i,_ as l,x as n,T as o,C as r,y as s,E as t,g as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){let e=typeof process<`u`?process.env.DEBUG:void 0;return typeof e==`string`?e.includes(`workflow:`)||e===`*`:!1}function t(...t){e()&&console.debug(...t)}export{t};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-8V8biNmG.js";import t from"node:crypto";const n=Object.freeze({status:`aborted`});function r(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}const i=Symbol(`zod_brand`);var a=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},o=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};const s={};function c(e){return e&&Object.assign(s,e),s}var l=e({BIGINT_FORMAT_RANGES:()=>je,Class:()=>Qe,NUMBER_FORMAT_RANGES:()=>Ae,aborted:()=>ze,allowsEval:()=>xe,assert:()=>re,assertEqual:()=>u,assertIs:()=>te,assertNever:()=>ne,assertNotEqual:()=>ee,assignProp:()=>f,base64ToUint8Array:()=>Ke,base64urlToUint8Array:()=>Je,cached:()=>se,captureStackTrace:()=>ye,cleanEnum:()=>Ge,cleanRegex:()=>le,clone:()=>g,cloneDef:()=>pe,createTransparentProxy:()=>De,defineLazy:()=>d,esc:()=>_e,escapeRegex:()=>h,extend:()=>Pe,finalizeIssue:()=>y,floatSafeRemainder:()=>ue,getElementAtPath:()=>me,getEnumValues:()=>ie,getLengthableOrigin:()=>He,getParsedType:()=>we,getSizableOrigin:()=>Ve,hexToUint8Array:()=>Xe,isObject:()=>be,isPlainObject:()=>m,issue:()=>We,joinValues:()=>ae,jsonStringifyReplacer:()=>oe,merge:()=>Ie,mergeDefs:()=>p,normalizeParams:()=>_,nullish:()=>ce,numKeys:()=>Ce,objectClone:()=>fe,omit:()=>Ne,optionalKeys:()=>ke,parsedType:()=>Ue,partial:()=>Le,pick:()=>Me,prefixIssues:()=>v,primitiveTypes:()=>Ee,promiseAllObject:()=>he,propertyKeyTypes:()=>Te,randomString:()=>ge,required:()=>Re,safeExtend:()=>Fe,shallowClone:()=>Se,slugify:()=>ve,stringifyPrimitive:()=>Oe,uint8ArrayToBase64:()=>qe,uint8ArrayToBase64url:()=>Ye,uint8ArrayToHex:()=>Ze,unwrapMessage:()=>Be});function u(e){return e}function ee(e){return e}function te(e){}function ne(e){throw Error(`Unexpected value in exhaustive check`)}function re(e){}function ie(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function ae(e,t=`|`){return e.map(e=>Oe(e)).join(t)}function oe(e,t){return typeof t==`bigint`?t.toString():t}function se(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function ce(e){return e==null}function le(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ue(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}const de=Symbol(`evaluating`);function d(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==de)return r===void 0&&(r=de,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function fe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function f(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function p(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function pe(e){return p(e._zod.def)}function me(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function he(e){let t=Object.keys(e),n=t.map(t=>e[t]);return Promise.all(n).then(e=>{let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n})}function ge(e=10){let t=``;for(let n=0;n<e;n++)t+=`abcdefghijklmnopqrstuvwxyz`[Math.floor(Math.random()*26)];return t}function _e(e){return JSON.stringify(e)}function ve(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const ye=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function be(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const xe=se(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function m(e){if(be(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(be(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Se(e){return m(e)?{...e}:Array.isArray(e)?[...e]:e}function Ce(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const we=e=>{let t=typeof e;switch(t){case`undefined`:return`undefined`;case`string`:return`string`;case`number`:return Number.isNaN(e)?`nan`:`number`;case`boolean`:return`boolean`;case`function`:return`function`;case`bigint`:return`bigint`;case`symbol`:return`symbol`;case`object`:return Array.isArray(e)?`array`:e===null?`null`:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?`promise`:typeof Map<`u`&&e instanceof Map?`map`:typeof Set<`u`&&e instanceof Set?`set`:typeof Date<`u`&&e instanceof Date?`date`:typeof File<`u`&&e instanceof File?`file`:`object`;default:throw Error(`Unknown data type: ${t}`)}},Te=new Set([`string`,`number`,`symbol`]),Ee=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function g(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function De(e){let t;return new Proxy({},{get(n,r,i){return t??=e(),Reflect.get(t,r,i)},set(n,r,i,a){return t??=e(),Reflect.set(t,r,i,a)},has(n,r){return t??=e(),Reflect.has(t,r)},deleteProperty(n,r){return t??=e(),Reflect.deleteProperty(t,r)},ownKeys(n){return t??=e(),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??=e(),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??=e(),Reflect.defineProperty(t,r,i)}})}function Oe(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ke(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}const Ae={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},je={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Me(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return g(e,p(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return f(this,`shape`,e),e},checks:[]}))}function Ne(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return g(e,p(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return f(this,`shape`,r),r},checks:[]}))}function Pe(e,t){if(!m(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return g(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return f(this,`shape`,n),n}}))}function Fe(e,t){if(!m(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return g(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return f(this,`shape`,n),n}}))}function Ie(e,t){return g(e,p(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return f(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Le(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return g(t,p(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return f(this,`shape`,i),i},checks:[]}))}function Re(e,t,n){return g(t,p(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return f(this,`shape`,i),i}}))}function ze(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function v(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Be(e){return typeof e==`string`?e:e?.message}function y(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Be(e.inst?._zod.def?.error?.(e))??Be(t?.error?.(e))??Be(n.customError?.(e))??Be(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ve(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}function He(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ue(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function We(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Ge(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Ke(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function qe(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Je(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return Ke(t+`=`.repeat((4-t.length%4)%4))}function Ye(e){return qe(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Xe(e){let t=e.replace(/^0x/,``);if(t.length%2!=0)throw Error(`Invalid hex string length`);let n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=Number.parseInt(t.slice(e,e+2),16);return n}function Ze(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var Qe=class{constructor(...e){}};const $e=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,oe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},et=r(`$ZodError`,$e),b=r(`$ZodError`,$e,{Parent:Error});function tt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function nt(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function rt(e,t=e=>e.message){let n={errors:[]},r=(e,i=[])=>{var a,o;for(let s of e.issues)if(s.code===`invalid_union`&&s.errors.length)s.errors.map(e=>r({issues:e},s.path));else if(s.code===`invalid_key`)r({issues:s.issues},s.path);else if(s.code===`invalid_element`)r({issues:s.issues},s.path);else{let e=[...i,...s.path];if(e.length===0){n.errors.push(t(s));continue}let r=n,c=0;for(;c<e.length;){let n=e[c],i=c===e.length-1;typeof n==`string`?(r.properties??={},(a=r.properties)[n]??(a[n]={errors:[]}),r=r.properties[n]):(r.items??=[],(o=r.items)[n]??(o[n]={errors:[]}),r=r.items[n]),i&&r.errors.push(t(s)),c++}}};return r(e),n}function it(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function at(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${it(e.path)}`);return t.join(`
|
|
2
|
+
`)}const ot=e=>(t,n,r,i)=>{let o=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new a;if(s.issues.length){let t=new((i?.Err)??e)(s.issues.map(e=>y(e,o,c())));throw ye(t,i?.callee),t}return s.value},st=ot(b),ct=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>y(e,a,c())));throw ye(t,i?.callee),t}return o.value},lt=ct(b),ut=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new a;return o.issues.length?{success:!1,error:new(e??et)(o.issues.map(e=>y(e,i,c())))}:{success:!0,data:o.value}},dt=ut(b),ft=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>y(e,i,c())))}:{success:!0,data:a.value}},pt=ft(b),mt=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ot(e)(t,n,i)},ht=mt(b),gt=e=>(t,n,r)=>ot(e)(t,n,r),_t=gt(b),vt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ct(e)(t,n,i)},yt=vt(b),bt=e=>async(t,n,r)=>ct(e)(t,n,r),xt=bt(b),St=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ut(e)(t,n,i)},Ct=St(b),wt=e=>(t,n,r)=>ut(e)(t,n,r),Tt=wt(b),Et=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ft(e)(t,n,i)},Dt=Et(b),Ot=e=>async(t,n,r)=>ft(e)(t,n,r),kt=Ot(b);var At=e({base64:()=>nn,base64url:()=>rn,bigint:()=>mn,boolean:()=>_n,browserEmail:()=>Yt,cidrv4:()=>en,cidrv6:()=>tn,cuid:()=>jt,cuid2:()=>Mt,date:()=>ln,datetime:()=>fn,domain:()=>on,duration:()=>Lt,e164:()=>sn,email:()=>Wt,emoji:()=>Xt,extendedDuration:()=>Rt,guid:()=>zt,hex:()=>Sn,hostname:()=>an,html5Email:()=>Gt,idnEmail:()=>Jt,integer:()=>hn,ipv4:()=>Zt,ipv6:()=>Qt,ksuid:()=>Ft,lowercase:()=>bn,mac:()=>$t,md5_base64:()=>En,md5_base64url:()=>Dn,md5_hex:()=>Tn,nanoid:()=>It,null:()=>vn,number:()=>gn,rfc5322Email:()=>Kt,sha1_base64:()=>kn,sha1_base64url:()=>An,sha1_hex:()=>On,sha256_base64:()=>Mn,sha256_base64url:()=>Nn,sha256_hex:()=>jn,sha384_base64:()=>Fn,sha384_base64url:()=>In,sha384_hex:()=>Pn,sha512_base64:()=>Rn,sha512_base64url:()=>zn,sha512_hex:()=>Ln,string:()=>pn,time:()=>dn,ulid:()=>Nt,undefined:()=>yn,unicodeEmail:()=>qt,uppercase:()=>xn,uuid:()=>Bt,uuid4:()=>Vt,uuid6:()=>Ht,uuid7:()=>Ut,xid:()=>Pt});const jt=/^[cC][^\s-]{8,}$/,Mt=/^[0-9a-z]+$/,Nt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Pt=/^[0-9a-vA-V]{20}$/,Ft=/^[A-Za-z0-9]{27}$/,It=/^[a-zA-Z0-9_-]{21}$/,Lt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,zt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Bt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Vt=Bt(4),Ht=Bt(6),Ut=Bt(7),Wt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Gt=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Kt=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,qt=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Jt=qt,Yt=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;function Xt(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}const Zt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,$t=e=>{let t=h(e??`:`);return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},en=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rn=/^[A-Za-z0-9_-]*$/,an=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,on=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,sn=/^\+[1-9]\d{6,14}$/,cn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,ln=RegExp(`^${cn}$`);function un(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function dn(e){return RegExp(`^${un(e)}$`)}function fn(e){let t=un({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${cn}T(?:${r})$`)}const pn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},mn=/^-?\d+n?$/,hn=/^-?\d+$/,gn=/^-?\d+(?:\.\d+)?$/,_n=/^(?:true|false)$/i,vn=/^null$/i,yn=/^undefined$/i,bn=/^[^A-Z]*$/,xn=/^[^a-z]*$/,Sn=/^[0-9a-fA-F]*$/;function Cn(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function wn(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const Tn=/^[0-9a-fA-F]{32}$/,En=Cn(22,`==`),Dn=wn(22),On=/^[0-9a-fA-F]{40}$/,kn=Cn(27,`=`),An=wn(27),jn=/^[0-9a-fA-F]{64}$/,Mn=Cn(43,`=`),Nn=wn(43),Pn=/^[0-9a-fA-F]{96}$/,Fn=Cn(64,``),In=wn(64),Ln=/^[0-9a-fA-F]{128}$/,Rn=Cn(86,`==`),zn=wn(86),x=r(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Bn={number:`number`,bigint:`bigint`,object:`date`},Vn=r(`$ZodCheckLessThan`,(e,t)=>{x.init(e,t);let n=Bn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Hn=r(`$ZodCheckGreaterThan`,(e,t)=>{x.init(e,t);let n=Bn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Un=r(`$ZodCheckMultipleOf`,(e,t)=>{x.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):ue(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Wn=r(`$ZodCheckNumberFormat`,(e,t)=>{x.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ae[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=hn)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Gn=r(`$ZodCheckBigIntFormat`,(e,t)=>{x.init(e,t);let[n,r]=je[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{let a=i.value;a<n&&i.issues.push({origin:`bigint`,input:a,code:`too_small`,minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>r&&i.issues.push({origin:`bigint`,input:a,code:`too_big`,maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),Kn=r(`$ZodCheckMaxSize`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ce(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;r.size<=t.maximum||n.issues.push({origin:Ve(r),code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qn=r(`$ZodCheckMinSize`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ce(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;r.size>=t.minimum||n.issues.push({origin:Ve(r),code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Jn=r(`$ZodCheckSizeEquals`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ce(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{let r=n.value,i=r.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Ve(r),...a?{code:`too_big`,maximum:t.size}:{code:`too_small`,minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Yn=r(`$ZodCheckMaxLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ce(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=He(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Xn=r(`$ZodCheckMinLength`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ce(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=He(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Zn=r(`$ZodCheckLengthEquals`,(e,t)=>{var n;x.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ce(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=He(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Qn=r(`$ZodCheckStringFormat`,(e,t)=>{var n,r;x.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),$n=r(`$ZodCheckRegex`,(e,t)=>{Qn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),er=r(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=bn,Qn.init(e,t)}),tr=r(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=xn,Qn.init(e,t)}),nr=r(`$ZodCheckIncludes`,(e,t)=>{x.init(e,t);let n=h(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),rr=r(`$ZodCheckStartsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`^${h(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ir=r(`$ZodCheckEndsWith`,(e,t)=>{x.init(e,t);let n=RegExp(`.*${h(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function ar(e,t,n){e.issues.length&&t.issues.push(...v(n,e.issues))}const or=r(`$ZodCheckProperty`,(e,t)=>{x.init(e,t),e._zod.check=e=>{let n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>ar(n,e,t.property));ar(n,e,t.property)}}),sr=r(`$ZodCheckMimeType`,(e,t)=>{x.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:`invalid_value`,values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),cr=r(`$ZodCheckOverwrite`,(e,t)=>{x.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var lr=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
3
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
4
|
+
`))}};const ur={major:4,minor:3,patch:6},S=r(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ur;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=ze(e),i;for(let o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&n?.async===!1)throw new a;if(i||s instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(r||=ze(e,t))});else{if(e.issues.length===t)continue;r||=ze(e,t)}}return i?i.then(()=>e):e},n=(n,i,o)=>{if(ze(n))return n.aborted=!0,n;let s=t(i,r,o);if(s instanceof Promise){if(o.async===!1)throw new a;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(i,o)=>{if(o.skipChecks)return e._zod.parse(i,o);if(o.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,o)):n(t,i,o)}let s=e._zod.parse(i,o);if(s instanceof Promise){if(o.async===!1)throw new a;return s.then(e=>t(e,r,o))}return t(s,r,o)}}d(e,`~standard`,()=>({validate:t=>{try{let n=dt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return pt(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),dr=r(`$ZodString`,(e,t)=>{S.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??pn(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),C=r(`$ZodStringFormat`,(e,t)=>{Qn.init(e,t),dr.init(e,t)}),fr=r(`$ZodGUID`,(e,t)=>{t.pattern??=zt,C.init(e,t)}),pr=r(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Bt(e)}else t.pattern??=Bt();C.init(e,t)}),mr=r(`$ZodEmail`,(e,t)=>{t.pattern??=Wt,C.init(e,t)}),hr=r(`$ZodURL`,(e,t)=>{C.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),gr=r(`$ZodEmoji`,(e,t)=>{t.pattern??=Xt(),C.init(e,t)}),_r=r(`$ZodNanoID`,(e,t)=>{t.pattern??=It,C.init(e,t)}),vr=r(`$ZodCUID`,(e,t)=>{t.pattern??=jt,C.init(e,t)}),yr=r(`$ZodCUID2`,(e,t)=>{t.pattern??=Mt,C.init(e,t)}),br=r(`$ZodULID`,(e,t)=>{t.pattern??=Nt,C.init(e,t)}),xr=r(`$ZodXID`,(e,t)=>{t.pattern??=Pt,C.init(e,t)}),Sr=r(`$ZodKSUID`,(e,t)=>{t.pattern??=Ft,C.init(e,t)}),Cr=r(`$ZodISODateTime`,(e,t)=>{t.pattern??=fn(t),C.init(e,t)}),wr=r(`$ZodISODate`,(e,t)=>{t.pattern??=ln,C.init(e,t)}),Tr=r(`$ZodISOTime`,(e,t)=>{t.pattern??=dn(t),C.init(e,t)}),Er=r(`$ZodISODuration`,(e,t)=>{t.pattern??=Lt,C.init(e,t)}),Dr=r(`$ZodIPv4`,(e,t)=>{t.pattern??=Zt,C.init(e,t),e._zod.bag.format=`ipv4`}),Or=r(`$ZodIPv6`,(e,t)=>{t.pattern??=Qt,C.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),kr=r(`$ZodMAC`,(e,t)=>{t.pattern??=$t(t.delimiter),C.init(e,t),e._zod.bag.format=`mac`}),Ar=r(`$ZodCIDRv4`,(e,t)=>{t.pattern??=en,C.init(e,t)}),jr=r(`$ZodCIDRv6`,(e,t)=>{t.pattern??=tn,C.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Mr(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Nr=r(`$ZodBase64`,(e,t)=>{t.pattern??=nn,C.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Mr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Pr(e){if(!rn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Mr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const Fr=r(`$ZodBase64URL`,(e,t)=>{t.pattern??=rn,C.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Pr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ir=r(`$ZodE164`,(e,t)=>{t.pattern??=sn,C.init(e,t)});function Lr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const Rr=r(`$ZodJWT`,(e,t)=>{C.init(e,t),e._zod.check=n=>{Lr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),zr=r(`$ZodCustomStringFormat`,(e,t)=>{C.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:`invalid_format`,format:t.format,input:n.value,inst:e,continue:!t.abort})}}),Br=r(`$ZodNumber`,(e,t)=>{S.init(e,t),e._zod.pattern=e._zod.bag.pattern??gn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Vr=r(`$ZodNumberFormat`,(e,t)=>{Wn.init(e,t),Br.init(e,t)}),Hr=r(`$ZodBoolean`,(e,t)=>{S.init(e,t),e._zod.pattern=_n,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Ur=r(`$ZodBigInt`,(e,t)=>{S.init(e,t),e._zod.pattern=mn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value==`bigint`||n.issues.push({expected:`bigint`,code:`invalid_type`,input:n.value,inst:e}),n}}),Wr=r(`$ZodBigIntFormat`,(e,t)=>{Gn.init(e,t),Ur.init(e,t)}),Gr=r(`$ZodSymbol`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r==`symbol`||t.issues.push({expected:`symbol`,code:`invalid_type`,input:r,inst:e}),t}}),Kr=r(`$ZodUndefined`,(e,t)=>{S.init(e,t),e._zod.pattern=yn,e._zod.values=new Set([void 0]),e._zod.optin=`optional`,e._zod.optout=`optional`,e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),qr=r(`$ZodNull`,(e,t)=>{S.init(e,t),e._zod.pattern=vn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Jr=r(`$ZodAny`,(e,t)=>{S.init(e,t),e._zod.parse=e=>e}),Yr=r(`$ZodUnknown`,(e,t)=>{S.init(e,t),e._zod.parse=e=>e}),Xr=r(`$ZodNever`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),Zr=r(`$ZodVoid`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),Qr=r(`$ZodDate`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function $r(e,t,n){e.issues.length&&t.issues.push(...v(n,e.issues)),t.value[n]=e.value}const ei=r(`$ZodArray`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>$r(t,n,e))):$r(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function ti(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...v(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ni(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=ke(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ri(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>ti(e,n,i,t,u))):ti(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}const ii=r(`$ZodObject`,(e,t)=>{if(S.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=se(()=>ni(t));d(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=be,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>ti(n,t,e,s,r))):ti(i,t,e,s,r)}return i?ri(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),ai=r(`$ZodObjectJIT`,(e,t)=>{ii.init(e,t);let n=e._zod.parse,r=se(()=>ni(t)),i=e=>{let t=new lr([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=_e(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=_e(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
5
|
+
if (${n}.issues.length) {
|
|
6
|
+
if (${o} in input) {
|
|
7
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
8
|
+
...iss,
|
|
9
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
10
|
+
})));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (${n}.value === undefined) {
|
|
15
|
+
if (${o} in input) {
|
|
16
|
+
newResult[${o}] = undefined;
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
newResult[${o}] = ${n}.value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
`):t.write(`
|
|
23
|
+
if (${n}.issues.length) {
|
|
24
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
25
|
+
...iss,
|
|
26
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (${n}.value === undefined) {
|
|
31
|
+
if (${o} in input) {
|
|
32
|
+
newResult[${o}] = undefined;
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
newResult[${o}] = ${n}.value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=be,c=!s.jitless,l=c&&xe.value,u=t.catchall,ee;e._zod.parse=(s,te)=>{ee??=r.value;let ne=s.value;return o(ne)?c&&l&&te?.async===!1&&te.jitless!==!0?(a||=i(t.shape),s=a(s,te),u?ri([],ne,s,te,ee,e):s):n(s,te):(s.issues.push({expected:`object`,code:`invalid_type`,input:ne,inst:e}),s)}});function oi(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!ze(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>y(e,r,c())))}),t)}const si=r(`$ZodUnion`,(e,t)=>{S.init(e,t),d(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),d(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),d(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),d(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>le(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>oi(t,i,e,a)):oi(s,i,e,a)}});function ci(e,t,n,r){let i=e.filter(e=>e.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>y(e,r,c())))}):t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:[],inclusive:!1}),t)}const li=r(`$ZodXor`,(e,t)=>{si.init(e,t),t.inclusive=!1;let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);t instanceof Promise?(s.push(t),o=!0):s.push(t)}return o?Promise.all(s).then(t=>ci(t,i,e,a)):ci(s,i,e,a)}}),ui=r(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,si.init(e,t);let n=e._zod.parse;d(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=se(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!be(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),di=r(`$ZodIntersection`,(e,t)=>{S.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>pi(e,t,n)):pi(e,i,a)}});function fi(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(m(e)&&m(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=fi(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=fi(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function pi(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),ze(e))return e;let o=fi(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const mi=r(`$ZodTuple`,(e,t)=>{S.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=[...n].reverse().findIndex(e=>e._zod.optin!==`optional`),c=s===-1?0:n.length-s;if(!t.rest){let t=a.length>n.length,i=a.length<c-1;if(t||i)return r.issues.push({...t?{code:`too_big`,maximum:n.length,inclusive:!0}:{code:`too_small`,minimum:n.length},input:a,inst:e,origin:`array`}),r}let l=-1;for(let e of n){if(l++,l>=a.length&&l>=c)continue;let t=e._zod.run({value:a[l],issues:[]},i);t instanceof Promise?o.push(t.then(e=>hi(e,r,l))):hi(t,r,l)}if(t.rest){let e=a.slice(n.length);for(let n of e){l++;let e=t.rest._zod.run({value:n,issues:[]},i);e instanceof Promise?o.push(e.then(e=>hi(e,r,l))):hi(e,r,l)}}return o.length?Promise.all(o).then(()=>r):r}});function hi(e,t,n){e.issues.length&&t.issues.push(...v(n,e.issues)),t.value[n]=e.value}const gi=r(`$ZodRecord`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!m(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...v(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...v(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&gn.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>y(e,r,c())),input:o,path:[o],inst:e});continue}let l=t.valueType._zod.run({value:i[o],issues:[]},r);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&n.issues.push(...v(o,e.issues)),n.value[s.value]=e.value})):(l.issues.length&&n.issues.push(...v(o,l.issues)),n.value[s.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),_i=r(`$ZodMap`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:`map`,code:`invalid_type`,input:i,inst:e}),n;let a=[];n.value=new Map;for(let[o,s]of i){let c=t.keyType._zod.run({value:o,issues:[]},r),l=t.valueType._zod.run({value:s,issues:[]},r);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([t,a])=>{vi(t,a,n,o,i,e,r)})):vi(c,l,n,o,i,e,r)}return a.length?Promise.all(a).then(()=>n):n}});function vi(e,t,n,r,i,a,o){e.issues.length&&(Te.has(typeof r)?n.issues.push(...v(r,e.issues)):n.issues.push({code:`invalid_key`,origin:`map`,input:i,inst:a,issues:e.issues.map(e=>y(e,o,c()))})),t.issues.length&&(Te.has(typeof r)?n.issues.push(...v(r,t.issues)):n.issues.push({origin:`map`,code:`invalid_element`,input:i,inst:a,key:r,issues:t.issues.map(e=>y(e,o,c()))})),n.value.set(e.value,t.value)}const yi=r(`$ZodSet`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:`set`,code:`invalid_type`}),n;let a=[];n.value=new Set;for(let e of i){let i=t.valueType._zod.run({value:e,issues:[]},r);i instanceof Promise?a.push(i.then(e=>bi(e,n))):bi(i,n)}return a.length?Promise.all(a).then(()=>n):n}});function bi(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const xi=r(`$ZodEnum`,(e,t)=>{S.init(e,t);let n=ie(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Te.has(typeof e)).map(e=>typeof e==`string`?h(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Si=r(`$ZodLiteral`,(e,t)=>{if(S.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?h(e):e?h(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Ci=r(`$ZodFile`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r instanceof File||t.issues.push({expected:`file`,code:`invalid_type`,input:r,inst:e}),t}}),wi=r(`$ZodTransform`,(e,t)=>{S.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new o(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new a;return n.value=i,n}});function Ti(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Ei=r(`$ZodOptional`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),d(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${le(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Ti(t,e.value)):Ti(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Di=r(`$ZodExactOptional`,(e,t)=>{Ei.init(e,t),d(e._zod,`values`,()=>t.innerType._zod.values),d(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Oi=r(`$ZodNullable`,(e,t)=>{S.init(e,t),d(e._zod,`optin`,()=>t.innerType._zod.optin),d(e._zod,`optout`,()=>t.innerType._zod.optout),d(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${le(e.source)}|null)$`):void 0}),d(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),ki=r(`$ZodDefault`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Ai(e,t)):Ai(r,t)}});function Ai(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ji=r(`$ZodPrefault`,(e,t)=>{S.init(e,t),e._zod.optin=`optional`,d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Mi=r(`$ZodNonOptional`,(e,t)=>{S.init(e,t),d(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Ni(t,e)):Ni(i,e)}});function Ni(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Pi=r(`$ZodSuccess`,(e,t)=>{S.init(e,t),e._zod.parse=(e,n)=>{if(n.direction===`backward`)throw new o(`ZodSuccess`);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>(e.value=t.issues.length===0,e)):(e.value=r.issues.length===0,e)}}),Fi=r(`$ZodCatch`,(e,t)=>{S.init(e,t),d(e._zod,`optin`,()=>t.innerType._zod.optin),d(e._zod,`optout`,()=>t.innerType._zod.optout),d(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>y(e,n,c()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>y(e,n,c()))},input:e.value}),e.issues=[]),e)}}),Ii=r(`$ZodNaN`,(e,t)=>{S.init(e,t),e._zod.parse=(t,n)=>((typeof t.value!=`number`||!Number.isNaN(t.value))&&t.issues.push({input:t.value,inst:e,expected:`nan`,code:`invalid_type`}),t)}),Li=r(`$ZodPipe`,(e,t)=>{S.init(e,t),d(e._zod,`values`,()=>t.in._zod.values),d(e._zod,`optin`,()=>t.in._zod.optin),d(e._zod,`optout`,()=>t.out._zod.optout),d(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Ri(e,t.in,n)):Ri(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Ri(e,t.out,n)):Ri(r,t.out,n)}});function Ri(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const zi=r(`$ZodCodec`,(e,t)=>{S.init(e,t),d(e._zod,`values`,()=>t.in._zod.values),d(e._zod,`optin`,()=>t.in._zod.optin),d(e._zod,`optout`,()=>t.out._zod.optout),d(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if((n.direction||`forward`)===`forward`){let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Bi(e,t,n)):Bi(r,t,n)}else{let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Bi(e,t,n)):Bi(r,t,n)}}});function Bi(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||`forward`)===`forward`){let r=t.transform(e.value,e);return r instanceof Promise?r.then(r=>Vi(e,r,t.out,n)):Vi(e,r,t.out,n)}else{let r=t.reverseTransform(e.value,e);return r instanceof Promise?r.then(r=>Vi(e,r,t.in,n)):Vi(e,r,t.in,n)}}function Vi(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}const Hi=r(`$ZodReadonly`,(e,t)=>{S.init(e,t),d(e._zod,`propValues`,()=>t.innerType._zod.propValues),d(e._zod,`values`,()=>t.innerType._zod.values),d(e._zod,`optin`,()=>t.innerType?._zod?.optin),d(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Ui):Ui(r)}});function Ui(e){return e.value=Object.freeze(e.value),e}const Wi=r(`$ZodTemplateLiteral`,(e,t)=>{S.init(e,t);let n=[];for(let e of t.parts)if(typeof e==`object`&&e){if(!e._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...e._zod.traits].shift()}`);let t=e._zod.pattern instanceof RegExp?e._zod.pattern.source:e._zod.pattern;if(!t)throw Error(`Invalid template literal part: ${e._zod.traits}`);let r=+!!t.startsWith(`^`),i=t.endsWith(`$`)?t.length-1:t.length;n.push(t.slice(r,i))}else if(e===null||Ee.has(typeof e))n.push(h(`${e}`));else throw Error(`Invalid template literal part: ${e}`);e._zod.pattern=RegExp(`^${n.join(``)}$`),e._zod.parse=(n,r)=>typeof n.value==`string`?(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:`invalid_format`,format:t.format??`template_literal`,pattern:e._zod.pattern.source}),n):(n.issues.push({input:n.value,inst:e,expected:`string`,code:`invalid_type`}),n)}),Gi=r(`$ZodFunction`,(e,t)=>(S.init(e,t),e._def=t,e._zod.def=t,e.implement=t=>{if(typeof t!=`function`)throw Error(`implement() must be called with a function`);return function(...n){let r=e._def.input?st(e._def.input,n):n,i=Reflect.apply(t,this,r);return e._def.output?st(e._def.output,i):i}},e.implementAsync=t=>{if(typeof t!=`function`)throw Error(`implementAsync() must be called with a function`);return async function(...n){let r=e._def.input?await lt(e._def.input,n):n,i=await Reflect.apply(t,this,r);return e._def.output?await lt(e._def.output,i):i}},e._zod.parse=(t,n)=>typeof t.value==`function`?(e._def.output&&e._def.output._zod.def.type===`promise`?t.value=e.implementAsync(t.value):t.value=e.implement(t.value),t):(t.issues.push({code:`invalid_type`,expected:`function`,input:t.value,inst:e}),t),e.input=(...t)=>{let n=e.constructor;return Array.isArray(t[0])?new n({type:`function`,input:new mi({type:`tuple`,items:t[0],rest:t[1]}),output:e._def.output}):new n({type:`function`,input:t[0],output:e._def.output})},e.output=t=>{let n=e.constructor;return new n({type:`function`,input:e._def.input,output:t})},e)),Ki=r(`$ZodPromise`,(e,t)=>{S.init(e,t),e._zod.parse=(e,n)=>Promise.resolve(e.value).then(e=>t.innerType._zod.run({value:e,issues:[]},n))}),qi=r(`$ZodLazy`,(e,t)=>{S.init(e,t),d(e._zod,`innerType`,()=>t.getter()),d(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),d(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),d(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),d(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Ji=r(`$ZodCustom`,(e,t)=>{x.init(e,t),S.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Yi(t,n,r,e));Yi(i,n,r,e)}});function Yi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(We(e))}}var Xi;const Zi=Symbol(`ZodOutput`),Qi=Symbol(`ZodInput`);var $i=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ea(){return new $i}(Xi=globalThis).__zod_globalRegistry??(Xi.__zod_globalRegistry=ea());const w=globalThis.__zod_globalRegistry;function ta(e,t){return new e({type:`string`,..._(t)})}function na(e,t){return new e({type:`string`,coerce:!0,..._(t)})}function ra(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,..._(t)})}function ia(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,..._(t)})}function aa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,..._(t)})}function oa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,..._(t)})}function sa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,..._(t)})}function ca(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,..._(t)})}function la(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,..._(t)})}function ua(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,..._(t)})}function da(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,..._(t)})}function fa(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,..._(t)})}function pa(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,..._(t)})}function ma(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,..._(t)})}function ha(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,..._(t)})}function ga(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,..._(t)})}function _a(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,..._(t)})}function va(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,..._(t)})}function ya(e,t){return new e({type:`string`,format:`mac`,check:`string_format`,abort:!1,..._(t)})}function ba(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,..._(t)})}function xa(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,..._(t)})}function Sa(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,..._(t)})}function Ca(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,..._(t)})}function wa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,..._(t)})}function Ta(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,..._(t)})}const Ea={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Da(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,..._(t)})}function Oa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,..._(t)})}function ka(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,..._(t)})}function Aa(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,..._(t)})}function ja(e,t){return new e({type:`number`,checks:[],..._(t)})}function Ma(e,t){return new e({type:`number`,coerce:!0,checks:[],..._(t)})}function Na(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,..._(t)})}function Pa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float32`,..._(t)})}function Fa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`float64`,..._(t)})}function Ia(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`int32`,..._(t)})}function La(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`uint32`,..._(t)})}function Ra(e,t){return new e({type:`boolean`,..._(t)})}function za(e,t){return new e({type:`boolean`,coerce:!0,..._(t)})}function Ba(e,t){return new e({type:`bigint`,..._(t)})}function Va(e,t){return new e({type:`bigint`,coerce:!0,..._(t)})}function Ha(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`int64`,..._(t)})}function Ua(e,t){return new e({type:`bigint`,check:`bigint_format`,abort:!1,format:`uint64`,..._(t)})}function Wa(e,t){return new e({type:`symbol`,..._(t)})}function Ga(e,t){return new e({type:`undefined`,..._(t)})}function Ka(e,t){return new e({type:`null`,..._(t)})}function qa(e){return new e({type:`any`})}function Ja(e){return new e({type:`unknown`})}function Ya(e,t){return new e({type:`never`,..._(t)})}function Xa(e,t){return new e({type:`void`,..._(t)})}function Za(e,t){return new e({type:`date`,..._(t)})}function Qa(e,t){return new e({type:`date`,coerce:!0,..._(t)})}function $a(e,t){return new e({type:`nan`,..._(t)})}function eo(e,t){return new Vn({check:`less_than`,..._(t),value:e,inclusive:!1})}function T(e,t){return new Vn({check:`less_than`,..._(t),value:e,inclusive:!0})}function to(e,t){return new Hn({check:`greater_than`,..._(t),value:e,inclusive:!1})}function E(e,t){return new Hn({check:`greater_than`,..._(t),value:e,inclusive:!0})}function no(e){return to(0,e)}function ro(e){return eo(0,e)}function io(e){return T(0,e)}function ao(e){return E(0,e)}function oo(e,t){return new Un({check:`multiple_of`,..._(t),value:e})}function so(e,t){return new Kn({check:`max_size`,..._(t),maximum:e})}function co(e,t){return new qn({check:`min_size`,..._(t),minimum:e})}function lo(e,t){return new Jn({check:`size_equals`,..._(t),size:e})}function uo(e,t){return new Yn({check:`max_length`,..._(t),maximum:e})}function fo(e,t){return new Xn({check:`min_length`,..._(t),minimum:e})}function po(e,t){return new Zn({check:`length_equals`,..._(t),length:e})}function mo(e,t){return new $n({check:`string_format`,format:`regex`,..._(t),pattern:e})}function ho(e){return new er({check:`string_format`,format:`lowercase`,..._(e)})}function go(e){return new tr({check:`string_format`,format:`uppercase`,..._(e)})}function _o(e,t){return new nr({check:`string_format`,format:`includes`,..._(t),includes:e})}function vo(e,t){return new rr({check:`string_format`,format:`starts_with`,..._(t),prefix:e})}function yo(e,t){return new ir({check:`string_format`,format:`ends_with`,..._(t),suffix:e})}function bo(e,t,n){return new or({check:`property`,property:e,schema:t,..._(n)})}function xo(e,t){return new sr({check:`mime_type`,mime:e,..._(t)})}function So(e){return new cr({check:`overwrite`,tx:e})}function Co(e){return So(t=>t.normalize(e))}function wo(){return So(e=>e.trim())}function To(){return So(e=>e.toLowerCase())}function Eo(){return So(e=>e.toUpperCase())}function Do(){return So(e=>ve(e))}function Oo(e,t,n){return new e({type:`array`,element:t,..._(n)})}function ko(e,t,n){return new e({type:`union`,options:t,..._(n)})}function Ao(e,t,n){return new e({type:`union`,options:t,inclusive:!1,..._(n)})}function jo(e,t,n,r){return new e({type:`union`,options:n,discriminator:t,..._(r)})}function Mo(e,t,n){return new e({type:`intersection`,left:t,right:n})}function No(e,t,n,r){let i=n instanceof S;return new e({type:`tuple`,items:t,rest:i?n:null,..._(i?r:n)})}function Po(e,t,n,r){return new e({type:`record`,keyType:t,valueType:n,..._(r)})}function Fo(e,t,n,r){return new e({type:`map`,keyType:t,valueType:n,..._(r)})}function Io(e,t,n){return new e({type:`set`,valueType:t,..._(n)})}function Lo(e,t,n){return new e({type:`enum`,entries:Array.isArray(t)?Object.fromEntries(t.map(e=>[e,e])):t,..._(n)})}function Ro(e,t,n){return new e({type:`enum`,entries:t,..._(n)})}function zo(e,t,n){return new e({type:`literal`,values:Array.isArray(t)?t:[t],..._(n)})}function Bo(e,t){return new e({type:`file`,..._(t)})}function Vo(e,t){return new e({type:`transform`,transform:t})}function Ho(e,t){return new e({type:`optional`,innerType:t})}function Uo(e,t){return new e({type:`nullable`,innerType:t})}function Wo(e,t,n){return new e({type:`default`,innerType:t,get defaultValue(){return typeof n==`function`?n():Se(n)}})}function Go(e,t,n){return new e({type:`nonoptional`,innerType:t,..._(n)})}function Ko(e,t){return new e({type:`success`,innerType:t})}function qo(e,t,n){return new e({type:`catch`,innerType:t,catchValue:typeof n==`function`?n:()=>n})}function Jo(e,t,n){return new e({type:`pipe`,in:t,out:n})}function Yo(e,t){return new e({type:`readonly`,innerType:t})}function Xo(e,t,n){return new e({type:`template_literal`,parts:t,..._(n)})}function Zo(e,t){return new e({type:`lazy`,getter:t})}function Qo(e,t){return new e({type:`promise`,innerType:t})}function $o(e,t,n){let r=_(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function es(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,..._(n)})}function ts(e){let t=ns(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(We(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(We(r))}},e(n.value,n)));return t}function ns(e,t){let n=new x({check:`custom`,..._(t)});return n._zod.check=e,n}function rs(e){let t=new x({check:`describe`});return t._zod.onattach=[t=>{let n=w.get(t)??{};w.add(t,{...n,description:e})}],t._zod.check=()=>{},t}function is(e){let t=new x({check:`meta`});return t._zod.onattach=[t=>{let n=w.get(t)??{};w.add(t,{...n,...e})}],t._zod.check=()=>{},t}function as(e,t){let n=_(t),r=n.truthy??[`true`,`1`,`yes`,`on`,`y`,`enabled`],i=n.falsy??[`false`,`0`,`no`,`off`,`n`,`disabled`];n.case!==`sensitive`&&(r=r.map(e=>typeof e==`string`?e.toLowerCase():e),i=i.map(e=>typeof e==`string`?e.toLowerCase():e));let a=new Set(r),o=new Set(i),s=e.Codec??zi,c=e.Boolean??Hr,l=new s({type:`pipe`,in:new(e.String??dr)({type:`string`,error:n.error}),out:new c({type:`boolean`,error:n.error}),transform:((e,t)=>{let r=e;return n.case!==`sensitive`&&(r=r.toLowerCase()),a.has(r)?!0:o.has(r)?!1:(t.issues.push({code:`invalid_value`,expected:`stringbool`,values:[...a,...o],input:t.value,inst:l,continue:!1}),{})}),reverseTransform:((e,t)=>e===!0?r[0]||`true`:i[0]||`false`),error:n.error});return l}function os(e,t,n,r={}){let i=_(r),a={..._(r),check:`string_format`,type:`string`,format:t,fn:typeof n==`function`?n:e=>n.test(e),...i};return n instanceof RegExp&&(a.pattern=n),new e(a)}function ss(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??w,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function D(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,D(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&O(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function cs(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
39
|
+
|
|
40
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ls(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ds(t,`input`,e.processors),output:ds(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function O(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return O(r.element,n);if(r.type===`set`)return O(r.valueType,n);if(r.type===`lazy`)return O(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return O(r.innerType,n);if(r.type===`intersection`)return O(r.left,n)||O(r.right,n);if(r.type===`record`||r.type===`map`)return O(r.keyType,n)||O(r.valueType,n);if(r.type===`pipe`)return O(r.in,n)||O(r.out,n);if(r.type===`object`){for(let e in r.shape)if(O(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(O(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(O(e,n))return!0;return!!(r.rest&&O(r.rest,n))}return!1}const us=(e,t={})=>n=>{let r=ss({...n,processors:t});return D(e,r),cs(r,e),ls(r,e)},ds=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ss({...i??{},target:a,io:t,processors:n});return D(e,o),cs(o,e),ls(o,e)},fs={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ps=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=fs[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ms=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},hs=(e,t,n,r)=>{n.type=`boolean`},gs=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`BigInt cannot be represented in JSON Schema`)},_s=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Symbols cannot be represented in JSON Schema`)},vs=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ys=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},bs=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},xs=(e,t,n,r)=>{n.not={}},Ss=(e,t,n,r)=>{},Cs=(e,t,n,r)=>{},ws=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Date cannot be represented in JSON Schema`)},Ts=(e,t,n,r)=>{let i=e._zod.def,a=ie(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Es=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Ds=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`NaN cannot be represented in JSON Schema`)},Os=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},ks=(e,t,n,r)=>{let i=n,a={type:`string`,format:`binary`,contentEncoding:`binary`},{minimum:o,maximum:s,mime:c}=e._zod.bag;o!==void 0&&(a.minLength=o),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(i,a)):(Object.assign(i,a),i.anyOf=c.map(e=>({contentMediaType:e}))):Object.assign(i,a)},As=(e,t,n,r)=>{n.type=`boolean`},js=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Ms=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Function types cannot be represented in JSON Schema`)},Ns=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ps=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Map cannot be represented in JSON Schema`)},Fs=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Set cannot be represented in JSON Schema`)},Is=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=D(a.element,t,{...r,path:[...r.path,`items`]})},Ls=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=D(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=D(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Rs=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>D(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},zs=(e,t,n,r)=>{let i=e._zod.def,a=D(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=D(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Bs=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>D(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?D(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:ee}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof ee==`number`&&(i.maxItems=ee)},Vs=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=D(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=D(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=D(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Hs=(e,t,n,r)=>{let i=e._zod.def,a=D(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Us=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ws=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Gs=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Ks=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},qs=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;D(a,t,r);let o=t.seen.get(e);o.ref=a},Js=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ys=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Xs=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Zs=(e,t,n,r)=>{let i=e._zod.innerType;D(i,t,r);let a=t.seen.get(e);a.ref=i},Qs={string:ps,number:ms,boolean:hs,bigint:gs,symbol:_s,null:vs,undefined:ys,void:bs,never:xs,any:Ss,unknown:Cs,date:ws,enum:Ts,literal:Es,nan:Ds,template_literal:Os,file:ks,success:As,custom:js,function:Ms,transform:Ns,map:Ps,set:Fs,array:Is,object:Ls,union:Rs,intersection:zs,tuple:Bs,record:Vs,nullable:Hs,nonoptional:Us,default:Ws,prefault:Gs,catch:Ks,pipe:qs,readonly:Js,promise:Ys,optional:Xs,lazy:Zs};function $s(e,t){if(`_idmap`in e){let n=e,r=ss({...t,processors:Qs}),i={};for(let e of n._idmap.entries()){let[t,n]=e;D(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;cs(r,n),a[t]=ls(r,n)}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=ss({...t,processors:Qs});return D(e,n),cs(n,e),ls(n,e)}var ec=e({ZodISODate:()=>rc,ZodISODateTime:()=>tc,ZodISODuration:()=>sc,ZodISOTime:()=>ac,date:()=>ic,datetime:()=>nc,duration:()=>cc,time:()=>oc});const tc=r(`ZodISODateTime`,(e,t)=>{Cr.init(e,t),M.init(e,t)});function nc(e){return Da(tc,e)}const rc=r(`ZodISODate`,(e,t)=>{wr.init(e,t),M.init(e,t)});function ic(e){return Oa(rc,e)}const ac=r(`ZodISOTime`,(e,t)=>{Tr.init(e,t),M.init(e,t)});function oc(e){return ka(ac,e)}const sc=r(`ZodISODuration`,(e,t)=>{Er.init(e,t),M.init(e,t)});function cc(e){return Aa(sc,e)}const lc=(e,t)=>{et.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>nt(e,t)},flatten:{value:t=>tt(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,oe,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,oe,2)}},isEmpty:{get(){return e.issues.length===0}}})},uc=r(`ZodError`,lc),k=r(`ZodError`,lc,{Parent:Error}),dc=ot(k),fc=ct(k),pc=ut(k),mc=ft(k),hc=mt(k),gc=gt(k),_c=vt(k),vc=bt(k),yc=St(k),bc=wt(k),xc=Et(k),Sc=Ot(k);var Cc=e({ZodAny:()=>Rl,ZodArray:()=>ql,ZodBase64:()=>sl,ZodBase64URL:()=>ll,ZodBigInt:()=>Ol,ZodBigIntFormat:()=>Al,ZodBoolean:()=>Dl,ZodCIDRv4:()=>rl,ZodCIDRv6:()=>al,ZodCUID:()=>Vc,ZodCUID2:()=>Uc,ZodCatch:()=>Lu,ZodCodec:()=>Uu,ZodCustom:()=>td,ZodCustomStringFormat:()=>hl,ZodDate:()=>Gl,ZodDefault:()=>ku,ZodDiscriminatedUnion:()=>nu,ZodE164:()=>dl,ZodEmail:()=>Ec,ZodEmoji:()=>Lc,ZodEnum:()=>hu,ZodExactOptional:()=>wu,ZodFile:()=>vu,ZodFunction:()=>$u,ZodGUID:()=>Oc,ZodIPv4:()=>Zc,ZodIPv6:()=>tl,ZodIntersection:()=>iu,ZodJWT:()=>pl,ZodKSUID:()=>Yc,ZodLazy:()=>Yu,ZodLiteral:()=>_u,ZodMAC:()=>$c,ZodMap:()=>du,ZodNaN:()=>zu,ZodNanoID:()=>zc,ZodNever:()=>Vl,ZodNonOptional:()=>Nu,ZodNull:()=>Il,ZodNullable:()=>Eu,ZodNumber:()=>bl,ZodNumberFormat:()=>xl,ZodObject:()=>Yl,ZodOptional:()=>Su,ZodPipe:()=>Vu,ZodPrefault:()=>ju,ZodPromise:()=>Zu,ZodReadonly:()=>Gu,ZodRecord:()=>cu,ZodSet:()=>pu,ZodString:()=>Tc,ZodStringFormat:()=>M,ZodSuccess:()=>Fu,ZodSymbol:()=>Nl,ZodTemplateLiteral:()=>qu,ZodTransform:()=>bu,ZodTuple:()=>ou,ZodType:()=>A,ZodULID:()=>Gc,ZodURL:()=>Pc,ZodUUID:()=>N,ZodUndefined:()=>Fl,ZodUnion:()=>Ql,ZodUnknown:()=>Bl,ZodVoid:()=>Ul,ZodXID:()=>qc,ZodXor:()=>eu,_ZodString:()=>wc,_default:()=>Au,_function:()=>ed,any:()=>zl,array:()=>R,base64:()=>cl,base64url:()=>ul,bigint:()=>kl,boolean:()=>F,catch:()=>Ru,check:()=>nd,cidrv4:()=>il,cidrv6:()=>ol,codec:()=>Wu,cuid:()=>Hc,cuid2:()=>Wc,custom:()=>rd,date:()=>Kl,describe:()=>od,discriminatedUnion:()=>ru,e164:()=>fl,email:()=>Dc,emoji:()=>Rc,enum:()=>V,exactOptional:()=>Tu,file:()=>yu,float32:()=>Cl,float64:()=>wl,function:()=>ed,guid:()=>kc,hash:()=>yl,hex:()=>vl,hostname:()=>_l,httpUrl:()=>Ic,instanceof:()=>cd,int:()=>Sl,int32:()=>Tl,int64:()=>jl,intersection:()=>au,ipv4:()=>Qc,ipv6:()=>nl,json:()=>ud,jwt:()=>ml,keyof:()=>Jl,ksuid:()=>Xc,lazy:()=>Xu,literal:()=>H,looseObject:()=>Zl,looseRecord:()=>uu,mac:()=>el,map:()=>fu,meta:()=>sd,nan:()=>Bu,nanoid:()=>Bc,nativeEnum:()=>gu,never:()=>Hl,nonoptional:()=>Pu,null:()=>Ll,nullable:()=>Du,nullish:()=>Ou,number:()=>P,object:()=>z,optional:()=>Cu,partialRecord:()=>lu,pipe:()=>Hu,prefault:()=>Mu,preprocess:()=>dd,promise:()=>Qu,readonly:()=>Ku,record:()=>B,refine:()=>id,set:()=>mu,strictObject:()=>Xl,string:()=>j,stringFormat:()=>gl,stringbool:()=>ld,success:()=>Iu,superRefine:()=>ad,symbol:()=>Pl,templateLiteral:()=>Ju,transform:()=>xu,tuple:()=>su,uint32:()=>El,uint64:()=>Ml,ulid:()=>Kc,undefined:()=>I,union:()=>$l,unknown:()=>L,url:()=>Fc,uuid:()=>Ac,uuidv4:()=>jc,uuidv6:()=>Mc,uuidv7:()=>Nc,void:()=>Wl,xid:()=>Jc,xor:()=>tu});const A=r(`ZodType`,(e,t)=>(S.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ds(e,`input`),output:ds(e,`output`)}}),e.toJSONSchema=us(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(p(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>g(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>dc(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>pc(e,t,n),e.parseAsync=async(t,n)=>fc(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>mc(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>hc(e,t,n),e.decode=(t,n)=>gc(e,t,n),e.encodeAsync=async(t,n)=>_c(e,t,n),e.decodeAsync=async(t,n)=>vc(e,t,n),e.safeEncode=(t,n)=>yc(e,t,n),e.safeDecode=(t,n)=>bc(e,t,n),e.safeEncodeAsync=async(t,n)=>xc(e,t,n),e.safeDecodeAsync=async(t,n)=>Sc(e,t,n),e.refine=(t,n)=>e.check(id(t,n)),e.superRefine=t=>e.check(ad(t)),e.overwrite=t=>e.check(So(t)),e.optional=()=>Cu(e),e.exactOptional=()=>Tu(e),e.nullable=()=>Du(e),e.nullish=()=>Cu(Du(e)),e.nonoptional=t=>Pu(e,t),e.array=()=>R(e),e.or=t=>$l([e,t]),e.and=t=>au(e,t),e.transform=t=>Hu(e,xu(t)),e.default=t=>Au(e,t),e.prefault=t=>Mu(e,t),e.catch=t=>Ru(e,t),e.pipe=t=>Hu(e,t),e.readonly=()=>Ku(e),e.describe=t=>{let n=e.clone();return w.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return w.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return w.get(e);let n=e.clone();return w.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),wc=r(`_ZodString`,(e,t)=>{dr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ps(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(mo(...t)),e.includes=(...t)=>e.check(_o(...t)),e.startsWith=(...t)=>e.check(vo(...t)),e.endsWith=(...t)=>e.check(yo(...t)),e.min=(...t)=>e.check(fo(...t)),e.max=(...t)=>e.check(uo(...t)),e.length=(...t)=>e.check(po(...t)),e.nonempty=(...t)=>e.check(fo(1,...t)),e.lowercase=t=>e.check(ho(t)),e.uppercase=t=>e.check(go(t)),e.trim=()=>e.check(wo()),e.normalize=(...t)=>e.check(Co(...t)),e.toLowerCase=()=>e.check(To()),e.toUpperCase=()=>e.check(Eo()),e.slugify=()=>e.check(Do())}),Tc=r(`ZodString`,(e,t)=>{dr.init(e,t),wc.init(e,t),e.email=t=>e.check(ra(Ec,t)),e.url=t=>e.check(la(Pc,t)),e.jwt=t=>e.check(Ta(pl,t)),e.emoji=t=>e.check(ua(Lc,t)),e.guid=t=>e.check(ia(Oc,t)),e.uuid=t=>e.check(aa(N,t)),e.uuidv4=t=>e.check(oa(N,t)),e.uuidv6=t=>e.check(sa(N,t)),e.uuidv7=t=>e.check(ca(N,t)),e.nanoid=t=>e.check(da(zc,t)),e.guid=t=>e.check(ia(Oc,t)),e.cuid=t=>e.check(fa(Vc,t)),e.cuid2=t=>e.check(pa(Uc,t)),e.ulid=t=>e.check(ma(Gc,t)),e.base64=t=>e.check(Sa(sl,t)),e.base64url=t=>e.check(Ca(ll,t)),e.xid=t=>e.check(ha(qc,t)),e.ksuid=t=>e.check(ga(Yc,t)),e.ipv4=t=>e.check(_a(Zc,t)),e.ipv6=t=>e.check(va(tl,t)),e.cidrv4=t=>e.check(ba(rl,t)),e.cidrv6=t=>e.check(xa(al,t)),e.e164=t=>e.check(wa(dl,t)),e.datetime=t=>e.check(nc(t)),e.date=t=>e.check(ic(t)),e.time=t=>e.check(oc(t)),e.duration=t=>e.check(cc(t))});function j(e){return ta(Tc,e)}const M=r(`ZodStringFormat`,(e,t)=>{C.init(e,t),wc.init(e,t)}),Ec=r(`ZodEmail`,(e,t)=>{mr.init(e,t),M.init(e,t)});function Dc(e){return ra(Ec,e)}const Oc=r(`ZodGUID`,(e,t)=>{fr.init(e,t),M.init(e,t)});function kc(e){return ia(Oc,e)}const N=r(`ZodUUID`,(e,t)=>{pr.init(e,t),M.init(e,t)});function Ac(e){return aa(N,e)}function jc(e){return oa(N,e)}function Mc(e){return sa(N,e)}function Nc(e){return ca(N,e)}const Pc=r(`ZodURL`,(e,t)=>{hr.init(e,t),M.init(e,t)});function Fc(e){return la(Pc,e)}function Ic(e){return la(Pc,{protocol:/^https?$/,hostname:on,..._(e)})}const Lc=r(`ZodEmoji`,(e,t)=>{gr.init(e,t),M.init(e,t)});function Rc(e){return ua(Lc,e)}const zc=r(`ZodNanoID`,(e,t)=>{_r.init(e,t),M.init(e,t)});function Bc(e){return da(zc,e)}const Vc=r(`ZodCUID`,(e,t)=>{vr.init(e,t),M.init(e,t)});function Hc(e){return fa(Vc,e)}const Uc=r(`ZodCUID2`,(e,t)=>{yr.init(e,t),M.init(e,t)});function Wc(e){return pa(Uc,e)}const Gc=r(`ZodULID`,(e,t)=>{br.init(e,t),M.init(e,t)});function Kc(e){return ma(Gc,e)}const qc=r(`ZodXID`,(e,t)=>{xr.init(e,t),M.init(e,t)});function Jc(e){return ha(qc,e)}const Yc=r(`ZodKSUID`,(e,t)=>{Sr.init(e,t),M.init(e,t)});function Xc(e){return ga(Yc,e)}const Zc=r(`ZodIPv4`,(e,t)=>{Dr.init(e,t),M.init(e,t)});function Qc(e){return _a(Zc,e)}const $c=r(`ZodMAC`,(e,t)=>{kr.init(e,t),M.init(e,t)});function el(e){return ya($c,e)}const tl=r(`ZodIPv6`,(e,t)=>{Or.init(e,t),M.init(e,t)});function nl(e){return va(tl,e)}const rl=r(`ZodCIDRv4`,(e,t)=>{Ar.init(e,t),M.init(e,t)});function il(e){return ba(rl,e)}const al=r(`ZodCIDRv6`,(e,t)=>{jr.init(e,t),M.init(e,t)});function ol(e){return xa(al,e)}const sl=r(`ZodBase64`,(e,t)=>{Nr.init(e,t),M.init(e,t)});function cl(e){return Sa(sl,e)}const ll=r(`ZodBase64URL`,(e,t)=>{Fr.init(e,t),M.init(e,t)});function ul(e){return Ca(ll,e)}const dl=r(`ZodE164`,(e,t)=>{Ir.init(e,t),M.init(e,t)});function fl(e){return wa(dl,e)}const pl=r(`ZodJWT`,(e,t)=>{Rr.init(e,t),M.init(e,t)});function ml(e){return Ta(pl,e)}const hl=r(`ZodCustomStringFormat`,(e,t)=>{zr.init(e,t),M.init(e,t)});function gl(e,t,n={}){return os(hl,e,t,n)}function _l(e){return os(hl,`hostname`,an,e)}function vl(e){return os(hl,`hex`,Sn,e)}function yl(e,t){let n=`${e}_${t?.enc??`hex`}`,r=At[n];if(!r)throw Error(`Unrecognized hash format: ${n}`);return os(hl,n,r,t)}const bl=r(`ZodNumber`,(e,t)=>{Br.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ms(e,t,n,r),e.gt=(t,n)=>e.check(to(t,n)),e.gte=(t,n)=>e.check(E(t,n)),e.min=(t,n)=>e.check(E(t,n)),e.lt=(t,n)=>e.check(eo(t,n)),e.lte=(t,n)=>e.check(T(t,n)),e.max=(t,n)=>e.check(T(t,n)),e.int=t=>e.check(Sl(t)),e.safe=t=>e.check(Sl(t)),e.positive=t=>e.check(to(0,t)),e.nonnegative=t=>e.check(E(0,t)),e.negative=t=>e.check(eo(0,t)),e.nonpositive=t=>e.check(T(0,t)),e.multipleOf=(t,n)=>e.check(oo(t,n)),e.step=(t,n)=>e.check(oo(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function P(e){return ja(bl,e)}const xl=r(`ZodNumberFormat`,(e,t)=>{Vr.init(e,t),bl.init(e,t)});function Sl(e){return Na(xl,e)}function Cl(e){return Pa(xl,e)}function wl(e){return Fa(xl,e)}function Tl(e){return Ia(xl,e)}function El(e){return La(xl,e)}const Dl=r(`ZodBoolean`,(e,t)=>{Hr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hs(e,t,n,r)});function F(e){return Ra(Dl,e)}const Ol=r(`ZodBigInt`,(e,t)=>{Ur.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gs(e,t,n,r),e.gte=(t,n)=>e.check(E(t,n)),e.min=(t,n)=>e.check(E(t,n)),e.gt=(t,n)=>e.check(to(t,n)),e.gte=(t,n)=>e.check(E(t,n)),e.min=(t,n)=>e.check(E(t,n)),e.lt=(t,n)=>e.check(eo(t,n)),e.lte=(t,n)=>e.check(T(t,n)),e.max=(t,n)=>e.check(T(t,n)),e.positive=t=>e.check(to(BigInt(0),t)),e.negative=t=>e.check(eo(BigInt(0),t)),e.nonpositive=t=>e.check(T(BigInt(0),t)),e.nonnegative=t=>e.check(E(BigInt(0),t)),e.multipleOf=(t,n)=>e.check(oo(t,n));let n=e._zod.bag;e.minValue=n.minimum??null,e.maxValue=n.maximum??null,e.format=n.format??null});function kl(e){return Ba(Ol,e)}const Al=r(`ZodBigIntFormat`,(e,t)=>{Wr.init(e,t),Ol.init(e,t)});function jl(e){return Ha(Al,e)}function Ml(e){return Ua(Al,e)}const Nl=r(`ZodSymbol`,(e,t)=>{Gr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_s(e,t,n,r)});function Pl(e){return Wa(Nl,e)}const Fl=r(`ZodUndefined`,(e,t)=>{Kr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ys(e,t,n,r)});function I(e){return Ga(Fl,e)}const Il=r(`ZodNull`,(e,t)=>{qr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vs(e,t,n,r)});function Ll(e){return Ka(Il,e)}const Rl=r(`ZodAny`,(e,t)=>{Jr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function zl(){return qa(Rl)}const Bl=r(`ZodUnknown`,(e,t)=>{Yr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function L(){return Ja(Bl)}const Vl=r(`ZodNever`,(e,t)=>{Xr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xs(e,t,n,r)});function Hl(e){return Ya(Vl,e)}const Ul=r(`ZodVoid`,(e,t)=>{Zr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bs(e,t,n,r)});function Wl(e){return Xa(Ul,e)}const Gl=r(`ZodDate`,(e,t)=>{Qr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ws(e,t,n,r),e.min=(t,n)=>e.check(E(t,n)),e.max=(t,n)=>e.check(T(t,n));let n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function Kl(e){return Za(Gl,e)}const ql=r(`ZodArray`,(e,t)=>{ei.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Is(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(fo(t,n)),e.nonempty=t=>e.check(fo(1,t)),e.max=(t,n)=>e.check(uo(t,n)),e.length=(t,n)=>e.check(po(t,n)),e.unwrap=()=>e.element});function R(e,t){return Oo(ql,e,t)}function Jl(e){let t=e._zod.def.shape;return V(Object.keys(t))}const Yl=r(`ZodObject`,(e,t)=>{ai.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ls(e,t,n,r),d(e,`shape`,()=>t.shape),e.keyof=()=>V(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:L()}),e.loose=()=>e.clone({...e._zod.def,catchall:L()}),e.strict=()=>e.clone({...e._zod.def,catchall:Hl()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Pe(e,t),e.safeExtend=t=>Fe(e,t),e.merge=t=>Ie(e,t),e.pick=t=>Me(e,t),e.omit=t=>Ne(e,t),e.partial=(...t)=>Le(Su,e,t[0]),e.required=(...t)=>Re(Nu,e,t[0])});function z(e,t){let n={type:`object`,shape:e??{},..._(t)};return new Yl(n)}function Xl(e,t){return new Yl({type:`object`,shape:e,catchall:Hl(),..._(t)})}function Zl(e,t){return new Yl({type:`object`,shape:e,catchall:L(),..._(t)})}const Ql=r(`ZodUnion`,(e,t)=>{si.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rs(e,t,n,r),e.options=t.options});function $l(e,t){return new Ql({type:`union`,options:e,..._(t)})}const eu=r(`ZodXor`,(e,t)=>{Ql.init(e,t),li.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rs(e,t,n,r),e.options=t.options});function tu(e,t){return new eu({type:`union`,options:e,inclusive:!1,..._(t)})}const nu=r(`ZodDiscriminatedUnion`,(e,t)=>{Ql.init(e,t),ui.init(e,t)});function ru(e,t,n){return new nu({type:`union`,options:t,discriminator:e,..._(n)})}const iu=r(`ZodIntersection`,(e,t)=>{di.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zs(e,t,n,r)});function au(e,t){return new iu({type:`intersection`,left:e,right:t})}const ou=r(`ZodTuple`,(e,t)=>{mi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bs(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function su(e,t,n){let r=t instanceof S;return new ou({type:`tuple`,items:e,rest:r?t:null,..._(r?n:t)})}const cu=r(`ZodRecord`,(e,t)=>{gi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vs(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function B(e,t,n){return new cu({type:`record`,keyType:e,valueType:t,..._(n)})}function lu(e,t,n){let r=g(e);return r._zod.values=void 0,new cu({type:`record`,keyType:r,valueType:t,..._(n)})}function uu(e,t,n){return new cu({type:`record`,keyType:e,valueType:t,mode:`loose`,..._(n)})}const du=r(`ZodMap`,(e,t)=>{_i.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ps(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...t)=>e.check(co(...t)),e.nonempty=t=>e.check(co(1,t)),e.max=(...t)=>e.check(so(...t)),e.size=(...t)=>e.check(lo(...t))});function fu(e,t,n){return new du({type:`map`,keyType:e,valueType:t,..._(n)})}const pu=r(`ZodSet`,(e,t)=>{yi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fs(e,t,n,r),e.min=(...t)=>e.check(co(...t)),e.nonempty=t=>e.check(co(1,t)),e.max=(...t)=>e.check(so(...t)),e.size=(...t)=>e.check(lo(...t))});function mu(e,t){return new pu({type:`set`,valueType:e,..._(t)})}const hu=r(`ZodEnum`,(e,t)=>{xi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ts(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new hu({...t,checks:[],..._(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new hu({...t,checks:[],..._(r),entries:i})}});function V(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new hu({type:`enum`,entries:n,..._(t)})}function gu(e,t){return new hu({type:`enum`,entries:e,..._(t)})}const _u=r(`ZodLiteral`,(e,t)=>{Si.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Es(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function H(e,t){return new _u({type:`literal`,values:Array.isArray(e)?e:[e],..._(t)})}const vu=r(`ZodFile`,(e,t)=>{Ci.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ks(e,t,n,r),e.min=(t,n)=>e.check(co(t,n)),e.max=(t,n)=>e.check(so(t,n)),e.mime=(t,n)=>e.check(xo(Array.isArray(t)?t:[t],n))});function yu(e){return Bo(vu,e)}const bu=r(`ZodTransform`,(e,t)=>{wi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ns(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new o(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(We(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(We(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function xu(e){return new bu({type:`transform`,transform:e})}const Su=r(`ZodOptional`,(e,t)=>{Ei.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cu(e){return new Su({type:`optional`,innerType:e})}const wu=r(`ZodExactOptional`,(e,t)=>{Di.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tu(e){return new wu({type:`optional`,innerType:e})}const Eu=r(`ZodNullable`,(e,t)=>{Oi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Du(e){return new Eu({type:`nullable`,innerType:e})}function Ou(e){return Cu(Du(e))}const ku=r(`ZodDefault`,(e,t)=>{ki.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ws(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Au(e,t){return new ku({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Se(t)}})}const ju=r(`ZodPrefault`,(e,t)=>{ji.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mu(e,t){return new ju({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Se(t)}})}const Nu=r(`ZodNonOptional`,(e,t)=>{Mi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Us(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Pu(e,t){return new Nu({type:`nonoptional`,innerType:e,..._(t)})}const Fu=r(`ZodSuccess`,(e,t)=>{Pi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>As(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Iu(e){return new Fu({type:`success`,innerType:e})}const Lu=r(`ZodCatch`,(e,t)=>{Fi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ks(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ru(e,t){return new Lu({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const zu=r(`ZodNaN`,(e,t)=>{Ii.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ds(e,t,n,r)});function Bu(e){return $a(zu,e)}const Vu=r(`ZodPipe`,(e,t)=>{Li.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qs(e,t,n,r),e.in=t.in,e.out=t.out});function Hu(e,t){return new Vu({type:`pipe`,in:e,out:t})}const Uu=r(`ZodCodec`,(e,t)=>{Vu.init(e,t),zi.init(e,t)});function Wu(e,t,n){return new Uu({type:`pipe`,in:e,out:t,transform:n.decode,reverseTransform:n.encode})}const Gu=r(`ZodReadonly`,(e,t)=>{Hi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Js(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ku(e){return new Gu({type:`readonly`,innerType:e})}const qu=r(`ZodTemplateLiteral`,(e,t)=>{Wi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Os(e,t,n,r)});function Ju(e,t){return new qu({type:`template_literal`,parts:e,..._(t)})}const Yu=r(`ZodLazy`,(e,t)=>{qi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zs(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Xu(e){return new Yu({type:`lazy`,getter:e})}const Zu=r(`ZodPromise`,(e,t)=>{Ki.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ys(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qu(e){return new Zu({type:`promise`,innerType:e})}const $u=r(`ZodFunction`,(e,t)=>{Gi.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ms(e,t,n,r)});function ed(e){return new $u({type:`function`,input:Array.isArray(e?.input)?su(e?.input):e?.input??R(L()),output:e?.output??L()})}const td=r(`ZodCustom`,(e,t)=>{Ji.init(e,t),A.init(e,t),e._zod.processJSONSchema=(t,n,r)=>js(e,t,n,r)});function nd(e){let t=new x({check:`custom`});return t._zod.check=e,t}function rd(e,t){return $o(td,e??(()=>!0),t)}function id(e,t={}){return es(td,e,t)}function ad(e){return ts(e)}const od=rs,sd=is;function cd(e,t={}){let n=new td({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,..._(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}const ld=(...e)=>as({Codec:Uu,Boolean:Dl,String:Tc},...e);function ud(e){let t=Xu(()=>$l([j(e),P(),F(),Ll(),R(t),B(j(),t)]));return t}function dd(e,t){return Hu(xu(e),t)}var fd=e({bigint:()=>gd,boolean:()=>hd,date:()=>U,number:()=>md,string:()=>pd});function pd(e){return na(Tc,e)}function md(e){return Ma(bl,e)}function hd(e){return za(Dl,e)}function gd(e){return Va(Ol,e)}function U(e){return Qa(Gl,e)}const _d=`$rootRunId`,vd=`$parentRunId`,yd=new TextEncoder;var W=class extends Error{constructor(e){super(e),this.name=`AttributeValidationError`}};function bd(e,t){if(typeof e!=`string`)throw new W(`Attribute key must be a string, got ${typeof e}`);if(e.length===0)throw new W(`Attribute key must not be empty`);if(e.length>256)throw new W(`Attribute key length ${e.length} exceeds limit 256: ${JSON.stringify(e.slice(0,32))}…`);if(!t&&e.startsWith(`$`))throw new W(`Attribute key ${JSON.stringify(e)} starts with reserved prefix "\$" — that namespace is reserved for framework/library code. Set { allowReservedAttributes: true } only if your caller is framework-level.`)}function xd(e){if(e!==null&&typeof e!=`string`)throw new W(`Attribute value must be a string or null, got ${typeof e}`);if(e===null)return;let t=yd.encode(e).length;if(t>256)throw new W(`Attribute value byte length ${t} exceeds limit 256`)}function Sd(e,t,n){return t===null?n?.has(e)?-1:0:+(n===void 0||!n.has(e))}function Cd(e,t={}){let n=new Set,r=t.existingKeys===void 0?void 0:t.existingKeys instanceof Set?t.existingKeys:new Set(t.existingKeys),i=r?.size??0;for(let{key:t,value:a}of e){if(n.has(t))throw new W(`Attribute key ${JSON.stringify(t)} appears more than once in the same batch`);n.add(t),i+=Sd(t,a,r)}if(i>64)throw new W(`Run attribute count would exceed limit 64 (post-merge ${i})`)}function wd(e,t={}){for(let{key:n,value:r}of e)bd(n,t.allowReservedAttributes===!0),xd(r);Cd(e,t)}function Td(e,t){let n={...e??{}};for(let{key:e,value:r}of t)r===null?delete n[e]:n[e]=r;return n}const Ed=new TextEncoder,Dd=R(z({key:j().min(1,{error:`Attribute key must not be empty`}).max(256,{error:`Attribute key exceeds limit 256`}),value:j().refine(e=>Ed.encode(e).length<=256,{error:`Attribute value exceeds limit 256 UTF-8 bytes`}).nullable()})).superRefine((e,t)=>{try{Cd(e)}catch(n){if(!(n instanceof W))throw n;t.addIssue({code:`custom`,message:n.message,input:e})}});function Od(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function kd(e){return e.eventType===`noop`}const Ad={attr_set:`attr_set`,step_created:`step_created`,step_started:`step_started`,step_retrying:`step_retrying`,step_completed:`step_terminal`,step_failed:`step_terminal`,wait_created:`wait_created`,wait_completed:`wait_completed`,hook_created:`hook_created`,hook_disposed:`hook_disposed`,run_started:`run_started`};function jd(e){return Od(Ad,e)}function Md(e){let t=jd(e.eventType);if(t!==void 0)return t===`run_started`?{eventClass:t,entity:``}:e.correlationId?{eventClass:t,entity:e.correlationId}:void 0}const Nd={run_created:[`input`],run_started:[`input`],run_completed:[`output`],run_failed:[`error`],step_created:[`input`],step_started:[`input`],step_completed:[`result`],step_failed:[`error`],step_retrying:[`error`],hook_created:[`metadata`],hook_received:[`payload`]},Pd=[];function Fd(e){return Od(Nd,e)??Pd}function Id(e){return Fd(e)[0]}const G=$l([cd(Uint8Array),zl()]),K=V([`run_created`,`run_started`,`run_completed`,`run_failed`,`run_cancelled`,`attr_set`,`step_created`,`step_completed`,`step_failed`,`step_retrying`,`step_started`,`hook_created`,`hook_received`,`hook_disposed`,`hook_conflict`,`wait_created`,`wait_completed`,`noop`]);K.extract([`run_created`,`run_started`,`run_completed`,`run_failed`,`run_cancelled`]).options;const Ld=K.extract([`run_completed`,`run_failed`,`run_cancelled`]).options;function Rd(e){return Ld.includes(e)}const zd=K.extract([`step_created`,`step_completed`,`step_failed`,`step_retrying`,`step_started`]).options;function Bd(e){return zd.includes(e)}K.extract([`step_completed`,`step_failed`]).options;const Vd=K.extract([`hook_created`,`hook_received`,`hook_disposed`]).options;function Hd(e){return Vd.includes(e)}const Ud=K.extract([`hook_disposed`,`hook_received`]).options;function Wd(e){return Ud.includes(e)}K.extract([`wait_created`,`wait_completed`]).options;const Gd=K.extract([`step_created`,`hook_created`,`wait_created`]).options;function Kd(e){return Gd.includes(e)}function qd(e,t){if(t!==`none`||!(`eventData`in e))return e;let n=e.eventData;if(!n||typeof n!=`object`){let{eventData:t,...n}=e;return n}let r=Fd(e.eventType);if(r.length===0)return e;let i={...n};for(let e of r)delete i[e];let{eventData:a,...o}=e;return{...o,...Object.keys(i).length>0?{eventData:i}:{}}}const q=z({eventType:K,correlationId:j().optional(),specVersion:P().optional()}),Jd={ttfs:P().optional(),stso:P().optional(),stepCount:P().int().positive().optional(),eventCount:P().int().positive().optional(),rsfs:P().optional(),finalSchedulingReplay:P().optional(),optimizations:R(j()).optional()},Yd=q.extend({eventType:H(`step_completed`),correlationId:j(),eventData:z({stepName:j().optional(),workflowName:j().optional(),result:G,...Jd})}),Xd=q.extend({eventType:H(`step_failed`),correlationId:j(),eventData:z({stepName:j().optional(),error:G,...Jd})}),Zd=q.extend({eventType:H(`step_retrying`),correlationId:j(),eventData:z({stepName:j().optional(),error:G,retryAfter:U().optional()})}),Qd=q.extend({eventType:H(`step_started`),correlationId:j(),eventData:z({stepName:j().optional(),attempt:P().optional(),workflowName:j().optional(),input:G.optional(),ownerMessageId:j().optional()}).optional()}),$d=q.extend({eventType:H(`step_created`),correlationId:j(),eventData:z({stepName:j(),workflowName:j().optional(),input:G})}),ef=q.extend({eventType:H(`hook_created`),correlationId:j(),eventData:z({token:j(),tokenRetentionUntil:U().optional(),metadata:G.optional(),isWebhook:F().optional(),isSystem:F().optional()})}),tf=q.extend({eventType:H(`hook_received`),correlationId:j(),eventData:z({token:j().optional(),payload:G})}),nf=q.extend({eventType:H(`hook_disposed`),correlationId:j(),eventData:z({token:j().optional()}).optional()}),rf=q.extend({eventType:H(`hook_conflict`),correlationId:j(),eventData:z({token:j(),conflictingRunId:j().optional()})}),af=q.extend({eventType:H(`noop`),eventData:z({sealed:F().optional()}).passthrough().optional()}),of=q.extend({eventType:H(`wait_created`),correlationId:j(),eventData:z({resumeAt:U()})}),sf=q.extend({eventType:H(`wait_completed`),correlationId:j(),eventData:z({resumeAt:U().optional()}).optional()}),cf=ru(`type`,[z({type:H(`workflow`)}),z({type:H(`step`),stepId:j(),attempt:P()})]),lf=q.extend({eventType:H(`attr_set`),correlationId:j().optional(),eventData:z({changes:Dd,writer:cf,allowReservedAttributes:H(!0).optional()})}),uf=q.extend({eventType:H(`run_created`),eventData:z({deploymentId:j(),workflowName:j(),input:G,executionContext:B(j(),zl()).optional(),attributes:B(j(),j()).optional(),allowReservedAttributes:H(!0).optional(),encryptionPublicKey:j().optional()})}),df=q.extend({eventType:H(`run_started`),eventData:z({input:G.optional(),deploymentId:j().optional(),workflowName:j().optional(),executionContext:B(j(),zl()).optional(),attributes:B(j(),j()).optional(),allowReservedAttributes:H(!0).optional(),encryptionPublicKey:j().optional()}).optional()}),ff=q.extend({eventType:H(`run_completed`),eventData:z({output:G.optional()})}),pf=q.extend({eventType:H(`run_failed`),eventData:z({error:G,errorCode:j().optional()})}),mf=q.extend({eventType:H(`run_cancelled`),eventData:z({cancelReason:j().max(512).optional()}).optional()});ru(`eventType`,[uf,df,ff,pf,mf,lf,$d,Yd,Xd,Zd,Qd,ef,tf,nf,of,sf]);const hf=ru(`eventType`,[uf,df,ff,pf,mf,lf,$d,Yd,Xd,Zd,Qd,ef,tf,nf,rf,of,sf,af]).and(z({runId:j(),eventId:j(),createdAt:U(),occurredAt:U().optional(),specVersion:P().optional(),resumeId:j().optional()}));function gf(e){return Kd(e.eventType)?!0:e.eventType===`step_started`&&typeof e.eventData?.stepName==`string`&&e.eventData.input!==void 0}const _f=V([`pending`,`running`,`completed`,`failed`,`cancelled`]),vf=_f.extract([`completed`,`failed`,`cancelled`]).options;function yf(e){return vf.includes(e)}const bf=z({runId:j(),status:_f,deploymentId:j(),workflowName:j(),specVersion:P().optional(),executionContext:B(j(),zl()).optional(),input:G.optional(),output:G.optional(),error:G.optional(),errorCode:j().optional(),attributes:B(j(),j()).default({}),encryptionPublicKey:j().optional(),expiredAt:U().optional(),startedAt:U().optional(),completedAt:U().optional(),createdAt:U(),updatedAt:U()}),xf=ru(`status`,[bf.extend({status:V([`pending`,`running`]),output:I().optional(),error:I().optional(),completedAt:I().optional()}),bf.extend({status:H(`cancelled`),output:I().optional(),error:I().optional(),completedAt:U()}),bf.extend({status:H(`completed`),output:G,error:I().optional(),completedAt:U()}),bf.extend({status:H(`failed`),output:I().optional(),error:G,completedAt:U()})]),Sf=z({runIds:R(j()).min(1).max(500).refine(e=>new Set(e).size===e.length,{message:`runIds must not contain duplicates`}),cancelReason:j().max(512).optional()}),Cf=ru(`outcome`,[z({runId:j(),outcome:H(`cancelled`)}),z({runId:j(),outcome:H(`already_cancelled`)}),z({runId:j(),outcome:H(`not_cancellable`),status:j()}),z({runId:j(),outcome:H(`not_found`)}),z({runId:j(),outcome:H(`failed`),code:j(),retryable:F()})]),wf=z({summary:z({requested:P(),cancelled:P(),alreadyCancelled:P(),notCancellable:P(),notFound:P(),failed:P()}),results:R(Cf)}),Tf=V([`pending`,`running`,`completed`,`failed`,`cancelled`]),Ef=z({runId:j(),stepId:j(),stepName:j(),status:Tf,input:G.optional(),output:G.optional(),error:G.optional(),attempt:P(),startedAt:U().optional(),completedAt:U().optional(),createdAt:U(),updatedAt:U(),retryAfter:U().optional(),specVersion:P().optional()}),Df=Tf.extract([`completed`,`failed`,`cancelled`]).options;function Of(e){return Df.includes(e)}const kf=V([`waiting`,`completed`]),Af=z({waitId:j(),runId:j(),status:kf,resumeAt:U().optional(),completedAt:U().optional(),createdAt:U(),updatedAt:U(),specVersion:P().optional()}),jf=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/,J=dd(e=>typeof e==`string`&&jf.test(e)?`${e.replace(` `,`T`)}Z`:e,U()),Y=J.nullable().optional(),X=j().nullable().optional(),Z=F().nullable().optional(),Mf=z({runId:j(),status:_f,deploymentId:j(),workflowName:j(),specVersion:md().optional(),attributes:B(j(),j()).default({}),createdAt:J,updatedAt:J,startedAt:Y,completedAt:Y,errorCode:X,workflowCoreVersion:X,workflowEncryptionEnabled:Z}),Nf=z({runId:j(),stepId:j(),stepName:X,status:Tf,attempt:P().optional(),createdAt:J,updatedAt:J,startedAt:Y,completedAt:Y,retryAfter:Y,errorCode:X,workflowCoreVersion:X,workflowEncryptionEnabled:Z,computeInstanceId:X}),Pf=z({runId:j(),eventId:j(),eventType:K,correlationId:X,entityId:X,stepName:X,workflowName:j(),deploymentId:j(),specVersion:md().optional(),runCreatedAt:J,createdAt:J,region:X,vercelId:X,requestId:X,computeInstanceId:X,resumeAt:Y,retryAfter:Y,errorCode:X,workflowCoreVersion:X,isWebhook:Z,isSystem:Z,workflowEncryptionEnabled:Z}),Ff=z({runId:j(),hookId:j(),status:V([`created`,`received`,`disposed`,`conflict`]),createdAt:J,updatedAt:J,receivedAt:Y,disposedAt:Y,isWebhook:Z,isSystem:Z,workflowCoreVersion:X,workflowEncryptionEnabled:Z}),If=z({runId:j(),waitId:j(),status:kf,resumeAt:Y,createdAt:J,updatedAt:J,completedAt:Y,workflowCoreVersion:X,workflowEncryptionEnabled:Z}),Lf=z({key:j(),runCount:md(),firstSeenAt:U(),lastSeenAt:U()}),Rf=Symbol.for(`@workflow/world//warnedEnvValues/v1`),zf=globalThis,Bf=zf[Rf]??=new Set;function Vf(e,t){Bf.has(e)||(Bf.add(e),console.warn(`[workflow] ${t}`))}function Hf(e,t,n={}){let r=process.env[e];if(r===void 0||r===``)return t;let{min:i=0,max:a,integer:o=!1}=n,s=Number(r);return!Number.isFinite(s)||o&&!Number.isInteger(s)?(Vf(`${e}=${r}`,`Ignoring ${e}: not a ${o?`finite integer`:`finite number`}; using default ${t}`),t):s<i?(Vf(`${e}=${r}`,`${e} below minimum ${i}; clamped`),i):a!==void 0&&s>a?(Vf(`${e}=${r}`,`${e} above maximum ${a}; clamped`),a):s}function Uf(e,t,n=process.env){let r=n[e];if(r===void 0||r===``)return t;let i=r.toLowerCase();return i===`0`||i===`false`?!1:i===`1`||i===`true`?!0:(Vf(`${e}=${r}`,`Ignoring ${e}: expected 0/1/true/false; using default ${t}`),t)}const Wf=25e3;function Gf(){let e=Hf(`WORKFLOW_MAX_EVENTS`,Wf,{integer:!0});return e>0?e:Wf}const Kf=j().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_$/,`Must match __wkf_workflow_ or __{namespace}_wkf_workflow_`),qf=j().regex(/^__(?:[a-z][a-z0-9]*_)?wkf_workflow_.+$/,`Must be a valid queue name with a recognized prefix`),Jf=j().regex(/^[a-z][a-z0-9]*$/,`Must be lowercase alphanumeric, starting with a letter`);function Yf(e){return e??process.env.WORKFLOW_QUEUE_NAMESPACE??void 0}function Xf(e,t){if(e!==`workflow`)throw Error(`Unsupported queue kind: ${e}`);return t===void 0?`__wkf_workflow_`:(Jf.parse(t),`__${t}_wkf_workflow_`)}function Zf(e){let t=e.match(/^(__(?:[a-z][a-z0-9]*_)?wkf_workflow_)(.+)$/);if(!t)throw Error(`Invalid queue name: ${e}`);return{prefix:Kf.parse(t[1]),id:t[2]}}const Qf=j().brand().describe(`A stored queue message ID`),$f=B(j(),j()),ep=z({input:L(),deploymentId:j(),workflowName:j(),specVersion:P(),executionContext:B(j(),zl()).optional(),attributes:B(j(),j()).optional(),allowReservedAttributes:H(!0).optional(),environment:j().optional()}),tp=z({input:rd(e=>e instanceof Uint8Array,{message:`stepInput.input must be a Uint8Array`})}),np=z({resumeId:j(),hookId:j(),token:j(),payload:L(),payloadDigest:j(),deploymentId:j().optional()}),rp=z({resumeRequestedAtMs:P(),queuePublishRequestedAtMs:P(),strategy:j().optional(),consumerStartedAtMs:P().optional(),replayStartedAtMs:P().optional(),nextStepEncounteredAtMs:P().optional(),setupSource:j().optional()}),ip=z({runId:j(),traceCarrier:$f.optional(),requestedAt:U().optional(),replayDivergence:z({eventId:j(),count:P().int().positive()}).optional(),preconditionReinvocations:P().int().positive().optional(),serverErrorRetryCount:P().int().optional(),deploymentMismatchRetryCount:P().int().nonnegative().optional(),waitContinuation:z({correlationId:j(),attempt:P().int().nonnegative()}).optional().catch(void 0),stepId:j().optional(),stepName:j().optional(),runInput:ep.optional(),hookInput:np.optional(),stepInput:tp.optional(),hookResumeTiming:rp.optional().catch(void 0)}),ap=z({__healthCheck:H(!0),correlationId:j(),runId:j().optional()}),op=$l([ap,ip]),sp=z({deploymentId:j(),workflowName:j(),runSpecVersion:P().optional(),workflowCoreVersion:j().optional(),traceCarrier:$f.optional(),encryptionPublicKey:j().optional(),hookResumeInputVersion:P().optional()}),cp=z({hookResumeDedupVersion:P()}),lp=z({runId:j(),hookId:j(),token:j(),ownerId:j(),projectId:j(),environment:j(),metadata:G.optional(),createdAt:U(),specVersion:P().optional(),isWebhook:F().optional(),isSystem:F().optional(),tokenRetentionUntil:U().optional(),resumeContext:sp.optional(),resumeCapabilities:cp.optional()}),up=`WORKFLOW_NODE_HTTP`;function dp(e=process.env){return Uf(up,!1,e)}async function fp(e,t,n,r){let i=Xf(`workflow`,Yf(r)),a=0;for(let r of[`pending`,`running`]){let o,s=!0;for(;s;){let c=await e.list({status:r,resolveData:`none`,pagination:{cursor:o}});for(let e of c.data)try{await t(`${i}${e.workflowName}`,{runId:e.runId}),a++}catch(t){console.warn(`[${n}] Failed to re-enqueue run ${e.runId}: ${t}`)}s=c.hasMore,o=c.cursor??void 0}}a>0&&pp()&&console.debug(`[${n}] Re-enqueued ${a} active run(s) on startup`)}function pp(){let e=typeof process<`u`?process.env.DEBUG:void 0;return typeof e==`string`?e.includes(`workflow:`)||e===`*`:!1}const mp=Xu(()=>$l([j(),P(),F(),Ll(),R(mp),B(j(),mp)])),hp=z({currentLookbackDays:P(),maxLookbackDays:P(),currentWindowStart:U(),maxWindowStart:U(),upgradeAvailable:F()}),gp=e=>z({data:R(e),cursor:j().nullable(),hasMore:F(),pageInfo:hp.optional()}),_p=z({message:j(),stack:j().optional(),code:j().optional()}),vp=`evnt_`;function yp(e){if(e.length!==26)return!1;for(let t=0;t<10;t++)if(e[t]!==`0`)return!1;for(let t=10;t<26;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return!0}function bp(e){let t=e.indexOf(`_`);return t===-1?e:e.slice(t+1)}function xp(e){return yp(bp(e))}function Sp(e){if(!Number.isSafeInteger(e)||e<1)throw RangeError(`Invalid event slot: ${e}`);return`${vp}${String(e).padStart(26,`0`)}`}function Cp(e){let t=bp(e);if(!yp(t))return null;let n=Number(t);return Number.isSafeInteger(n)&&n>=1?n:null}function wp(e){let t=Cp(e);if(t===null)throw Error(`Event id is not slot-numbered: ${e}. This World allocates event positions the runtime cannot read.`);return t}function Tp(e=process.env){return Uf(`WORKFLOW_SEALED_LOG`,!0,e)?7:6}function Ep(e){return e==null||e<=1}function Dp(e){return e!=null&&e>7}const Op=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`;var Q;(function(e){e.Base32IncorrectEncoding=`B32_ENC_INVALID`,e.DecodeTimeInvalidCharacter=`DEC_TIME_CHAR`,e.DecodeTimeValueMalformed=`DEC_TIME_MALFORMED`,e.EncodeTimeNegative=`ENC_TIME_NEG`,e.EncodeTimeSizeExceeded=`ENC_TIME_SIZE_EXCEED`,e.EncodeTimeValueMalformed=`ENC_TIME_MALFORMED`,e.PRNGDetectFailure=`PRNG_DETECT`,e.ULIDInvalid=`ULID_INVALID`,e.Unexpected=`UNEXPECTED`,e.UUIDInvalid=`UUID_INVALID`})(Q||={});var $=class extends Error{constructor(e,t){super(`${t} (${e})`),this.name=`ULIDError`,this.code=e}};function kp(e){let t=Math.floor(e()*32)%32;return Op.charAt(t)}function Ap(e,t,n){return t>e.length-1?e:e.substr(0,t)+n+e.substr(t+1)}function jp(e){let t,n=e.length,r,i,a=e;for(;!t&&n-->=0;){if(r=a[n],i=Op.indexOf(r),i===-1)throw new $(Q.Base32IncorrectEncoding,`Incorrectly encoded string`);if(i===31){a=Ap(a,n,Op[0]);continue}t=Ap(a,n,Op[i+1])}if(typeof t==`string`)return t;throw new $(Q.Base32IncorrectEncoding,`Failed incrementing string`)}function Mp(e){if(e.length!==26)throw new $(Q.DecodeTimeValueMalformed,`Malformed ULID`);let t=e.substr(0,10).toUpperCase().split(``).reverse().reduce((e,t,n)=>{let r=Op.indexOf(t);if(r===-1)throw new $(Q.DecodeTimeInvalidCharacter,`Time decode error: Invalid character: ${t}`);return e+=r*32**n},0);if(t>0xffffffffffff)throw new $(Q.DecodeTimeValueMalformed,`Malformed ULID: timestamp too large: ${t}`);return t}function Np(e){let n=Pp(),r=n&&(n.crypto||n.msCrypto)||(t===void 0?null:t);if(typeof r?.getRandomValues==`function`)return()=>{let e=new Uint8Array(1);return r.getRandomValues(e),e[0]/256};if(typeof r?.randomBytes==`function`)return()=>r.randomBytes(1).readUInt8()/256;if(t?.randomBytes)return()=>t.randomBytes(1).readUInt8()/256;throw new $(Q.PRNGDetectFailure,`Failed to find a reliable PRNG`)}function Pp(){return Lp()?self:typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:null}function Fp(e,t){let n=``;for(;e>0;e--)n=kp(t)+n;return n}function Ip(e,t=10){if(isNaN(e))throw new $(Q.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>0xffffffffffff)throw new $(Q.EncodeTimeSizeExceeded,`Cannot encode a time larger than 281474976710655: ${e}`);if(e<0)throw new $(Q.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new $(Q.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let n,r=``;for(let i=t;i>0;i--)n=e%32,r=Op.charAt(n)+r,e=(e-n)/32;return r}function Lp(){return typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope}function Rp(e){let t=e||Np(),n=0,r;return function(e){let i=!e||isNaN(e)?Date.now():e;if(i<=n){let e=r=jp(r);return Ip(n,10)+e}n=i;let a=r=Fp(16,t);return Ip(i,10)+a}}function zp(e,t){let n=t||Np();return Ip(!e||isNaN(e)?Date.now():e,10)+Fp(16,n)}const Bp=j().ulid(),Vp=Ju([`wrun_`,Kc()]),Hp=1440*60*1e3,Up=300*1e3;function Wp(e){if(yp(e))return null;let t=Bp.safeParse(e);return t.success?new Date(Mp(t.data)):null}function Gp(e,t,n=Hp,r=Up){let i=Wp(e.startsWith(t)?e.slice(t.length):e);if(!i)return`Invalid runId: "${e}" is not a valid ULID`;let a=new Date().getTime()-i.getTime();return a>0&&a<=n||a<=0&&-a<=r?null:`Invalid runId timestamp: embedded timestamp is ${Math.round(Math.abs(a)/1e3)}s in the ${a>0?`past`:`future`} (threshold: ${Math.round((a>0?n:r)/1e3)}s)`}var Kp=e({ANALYTICS_EVENTS_GET_MANY_LIMIT:()=>100,ATTRIBUTE_KEY_MAX_LENGTH:()=>256,ATTRIBUTE_MAX_PER_RUN:()=>64,ATTRIBUTE_VALUE_MAX_BYTES:()=>256,BULK_CANCEL_MAX_RUN_IDS:()=>500,DEFAULT_TIMESTAMP_THRESHOLD_FUTURE_MS:()=>Up,DEFAULT_TIMESTAMP_THRESHOLD_MS:()=>DEFAULT_TIMESTAMP_THRESHOLD_MS,DEFAULT_TIMESTAMP_THRESHOLD_PAST_MS:()=>Hp,EVENT_ID_BODY_LENGTH:()=>26,EVENT_ID_PREFIX:()=>vp,FIRST_EVENT_SLOT:()=>1,HOOK_RESUME_DEDUP_VERSION:()=>1,HOOK_RESUME_INPUT_VERSION:()=>1,HookSchema:()=>lp,NODE_HTTP_DEFAULT:()=>!1,NODE_HTTP_ENV_VAR:()=>up,RESERVED_ATTRIBUTE_KEY_PREFIX:()=>`$`,RUN_ENTITY_KEY:()=>``,SEALED_LOG_ENV_VAR:()=>`WORKFLOW_SEALED_LOG`,SPEC_VERSION_CURRENT:()=>7,SPEC_VERSION_LEGACY:()=>1,SPEC_VERSION_MAX_SUPPORTED:()=>7,SPEC_VERSION_SUPPORTS_ATTRIBUTES:()=>4,SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT:()=>3,SPEC_VERSION_SUPPORTS_COMPRESSION:()=>5,SPEC_VERSION_SUPPORTS_EVENT_SOURCING:()=>2,SPEC_VERSION_SUPPORTS_SEALED_LOG:()=>7,SPEC_VERSION_SUPPORTS_SLOT_IDENTITY:()=>6});export{Md as $,Co as $a,Et as $c,Ma as $i,yu as $n,Nr as $o,su as $r,dr as $s,Yl as $t,Lf as A,ga as Aa,Kn as Ac,ec as Ai,n as Al,Ll as An,Ua as Ao,Ou as Ar,Rr as As,Lc as At,wf as B,so as Ba,rr as Bc,qa as Bi,il as Bn,ca as Bo,B as Br,qr as Bs,Yc as Bt,qf as C,_a as Ca,ir as Cc,mc as Ci,Ue as Cl,eu as Cn,Xo as Co,sd as Cr,Dr as Cs,td as Ct,Yf as D,Aa as Da,Vn as Dc,tc as Di,o as Dl,V as Dn,wo as Do,Hl as Dr,Er as Ds,nu as Dt,Zf as E,Da as Ea,Zn as Ec,rc as Ei,a as El,Au as En,Vo as Eo,gu as Er,Cr as Es,ku as Et,If as F,eo as Fa,Wn as Fc,cs as Fi,cl as Fn,go as Fo,Hu as Fr,_i as Fs,Oc as Ft,K as G,$a as Ga,bt as Gc,Ra as Gi,rd as Gn,is as Go,j as Gr,ai as Gs,zu as Gt,xf as H,fo as Ha,tr as Hc,Sa as Hi,Wu as Hn,ha as Ho,Cc as Hr,Br as Hs,_u as Ht,Af as I,T as Ia,cr as Ic,ls as Ii,ul as In,la as Io,Mu as Ir,Ii as Is,Zc as It,Hd as J,ro as Ja,ot as Jc,ba as Ji,ru as Jn,Zi as Jo,Iu as Jr,ji as Js,Nu as Jt,gf as K,da as Ka,mt as Kc,qo as Ki,Kl as Kn,$i as Ko,gl as Kr,Ei as Ks,zc as Kt,Ef as L,ya as La,or as Lc,ss as Li,kl as Ln,aa as Lo,dd as Lr,_r as Ls,tl as Lt,Ff as M,po as Ma,Xn as Mc,$s as Mi,s as Ml,Wl as Mn,Ga as Mo,z as Mr,qi as Ms,wu as Mt,Mf as N,zo as Na,qn as Nc,ds as Ni,zl as Nn,ko as No,Cu as Nr,Si as Ns,vu as Nt,Hf as O,ka as Oa,er as Oc,sc as Oi,i as Ol,ed as On,No as Oo,Pu as Or,Tr as Os,dl as Ot,Nf as P,ho as Pa,Un as Pc,us as Pi,R as Pn,Ja as Po,lu as Pr,kr as Ps,$u as Pt,G as Q,io as Qa,St as Qc,Qa as Qi,Tu as Qn,ei as Qo,xu as Qr,yi as Qs,xl as Qt,Of as R,Fo as Ra,$n as Rc,D as Ri,F as Rn,oa as Ro,Qu as Rr,Xr as Rs,iu as Rt,op as S,Mo as Sa,Gn as Sc,pc as Si,ae as Sl,qc as Sn,Wa as So,fu as Sr,fr as Ss,Uu as St,Xf as T,Oa as Ta,nr as Tc,k as Ti,l as Tl,Ru as Tn,Eo as To,Bc as Tr,wr as Ts,Gl as Tt,yf as U,co as Ua,At as Uc,Ca as Ui,Hc as Un,Ao as Uo,mu as Ur,Vr as Us,$c as Ut,bf as V,xo as Va,Qn as Vc,Oo as Vi,ol as Vn,Xa as Vo,id as Vr,Oi as Vs,Yu as Vt,hf as W,oo as Wa,gt as Wc,Ba as Wi,Wc as Wn,rs as Wo,Xl as Wr,ii as Ws,du as Wt,Rd as X,ao as Xa,wt as Xc,Va as Xi,Dc as Xn,ea as Xo,Pl as Xr,Hi as Xs,Eu as Xt,Bd as Y,Ya,ct as Yc,xa as Yi,fl as Yn,w as Yo,ad as Yr,Ki as Ys,Il as Yt,qd as Z,Go as Za,Ot as Zc,za as Zi,Rc as Zn,Jr as Zo,Ju as Zr,gi as Zs,bl as Zt,fp as _,ia as _a,Pr as _c,fc as _i,nt as _l,N as _n,ta as _o,Xu as _r,gr as _s,rl as _t,Mp as a,Wo as aa,mi as ac,Fc as ai,yt as al,cu as an,Jo as ao,_l as ar,jr as as,Td as at,ap as b,Ia as ba,lr as bc,yc as bi,rt as bl,Bl as bn,Ko as bo,uu as br,Ci as bs,Uc as bt,Ep as c,ra as ca,hr as cc,Mc as ci,Tt as cl,M as cn,bo as co,Tl as cr,Fi as cs,U as ct,Cp as d,Lo as da,si as dc,tu as di,Dt as dl,qu as dn,es as do,Qc as dr,zr as ds,ql as dt,na as ea,C as ec,El as ei,ut as el,Su as en,Ka as eo,Cl as er,Fr as es,Id as et,xp as f,Bo as fa,Yr as fc,gc as fi,dt as fl,bu as fn,mo as fo,nl as fr,Qr as fs,sl as ft,_p as g,E as ga,Mr as gc,dc as gi,tt as gl,Pc as gn,vo as go,Xc as gr,mr as gs,Dl as gt,gp as h,to as ha,li as hc,_c as hi,b as hl,Gc as hn,Do as ho,Jl as hr,Ir as hs,Al as ht,Vp as i,Za as ia,wi as ic,L as ii,ht as il,Gu as in,So as io,vl as ir,Ar as is,_d as it,Pf as j,Zo as ja,sr as jc,Qs as ji,c as jl,I as jn,ma as jo,P as jr,Sr as js,hu as jt,Gf as k,Ta as ka,Yn as kc,ac as ki,r as kl,cd as kn,La as ko,Du as kr,di as ks,Ec as kt,Tp as l,ua as la,pr as lc,Nc as li,kt as ll,Fu as ln,Yo as lo,jl as lr,zi as ls,md as lt,Sp as m,Fa as ma,xr as mc,hc as mi,et as ml,A as mn,lo as mo,ml as mr,ui as ms,Ol as mt,Wp as n,pa as na,Gr as nc,Kc as ni,_t as nl,ju as nn,ja as no,kc as nr,Wr as ns,W as nt,Rp as o,jo as oa,S as oc,Ac as oi,st as ol,pu as on,no as oo,Ic as or,vr as os,wd as ot,wp as p,Pa as pa,Zr as pc,vc as pi,pt as pl,ou as pn,Io as po,ud as pr,ki as ps,ll as pt,Wd as q,Ro as qa,vt as qc,ns as qi,od as qn,Qi as qo,ld as qr,Li as qs,Vl as qt,Gp as r,$o as ra,Wi as rc,$l as ri,xt as rl,Zu as rn,Ho as ro,yl as rr,Hr as rs,vd as rt,zp as s,wa as sa,br as sc,jc as si,lt as sl,Tc as sn,Qo as so,Sl as sr,yr as ss,fd as st,Kp as t,fa as ta,Pi as tc,Ml as ti,ft as tl,Vu as tn,Uo as to,wl as tr,Ur as ts,kd as tt,Dp as u,yo as ua,Kr as uc,Jc as ui,Ct as ul,Nl as un,Po as uo,au as ur,Ji as us,Rl as ut,dp as v,_o as va,Lr as vc,bc as vi,at as vl,Fl as vn,os as vo,H as vr,xi as vs,al as vt,ip as w,va as wa,Hn as wc,uc as wi,Oe as wl,wc as wn,To as wo,Bu as wr,Or as ws,hl as wt,Qf as x,Ha as xa,x as xc,xc as xi,g as xl,Ul as xn,ts as xo,el as xr,Gi as xs,Lu as xt,lp as y,Na as ya,ur as yc,Sc as yi,it as yl,Ql as yn,as as yo,Zl as yr,Di as ys,Vc as yt,Sf as z,uo as za,Jn as zc,Ea as zi,nd as zn,sa as zo,Ku as zr,Mi as zs,pl as zt};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,t}from"./rolldown-runtime-8V8biNmG.js";function n(e,t,n){return n===1?e:t}var r=t(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),i=e(r(),1);function a(e){if(typeof e==`string`){let t=(0,i.default)(e);if(typeof t!=`number`||t<0)throw Error(`Invalid duration: "${e}". Expected a valid duration string like "1s", "1m", "1h", etc.`);return new Date(Date.now()+t)}else if(typeof e==`number`){if(e<0||!Number.isFinite(e))throw Error(`Invalid duration: ${e}. Expected a non-negative finite number of milliseconds.`);return new Date(Date.now()+e)}else if(e instanceof Date||e&&typeof e==`object`&&typeof e.getTime==`function`)return e instanceof Date?e:new Date(e.getTime());else throw Error(`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.`)}const o={USER_ERROR:`USER_ERROR`,RUNTIME_ERROR:`RUNTIME_ERROR`,CORRUPTED_EVENT_LOG:`CORRUPTED_EVENT_LOG`,REPLAY_DIVERGENCE:`REPLAY_DIVERGENCE`,MAX_DELIVERIES_EXCEEDED:`MAX_DELIVERIES_EXCEEDED`,MAX_EVENTS_EXCEEDED:`MAX_EVENTS_EXCEEDED`,REPLAY_TIMEOUT:`REPLAY_TIMEOUT`,WORLD_CONTRACT_ERROR:`WORLD_CONTRACT_ERROR`,DEPLOYMENT_MISMATCH:`DEPLOYMENT_MISMATCH`};function s(e){return typeof e==`object`&&!!e&&`name`in e&&`message`in e}function c(e,t){if(t.length===0)return e;let n=[e];return t.forEach((e,r)=>{let i=r===t.length-1,a=i?`╰▶ `:`├▶ `,o=i?` `:`│ `;`${e.label}: ${e.value}`.split(`
|
|
2
|
+
`).forEach((e,t)=>{n.push(`${t===0?a:o}${e}`)})}),n.join(`
|
|
3
|
+
`)}function l(e,t){let n=[];return e&&n.push({label:`hint`,value:e}),t&&n.push({label:`docs`,value:`https://workflow-sdk.dev/err/${t}`}),n}const u={NODE_JS_MODULE_IN_WORKFLOW:`node-js-module-in-workflow`,START_INVALID_WORKFLOW_FUNCTION:`start-invalid-workflow-function`,SERIALIZATION_FAILED:`serialization-failed`,WEBHOOK_INVALID_RESPOND_WITH_VALUE:`webhook-invalid-respond-with-value`,WEBHOOK_RESPONSE_NOT_SENT:`webhook-response-not-sent`,FETCH_IN_WORKFLOW_FUNCTION:`fetch-in-workflow`,TIMEOUT_FUNCTIONS_IN_WORKFLOW:`timeout-in-workflow`,HOOK_CONFLICT:`hook-conflict`,CORRUPTED_EVENT_LOG:`corrupted-event-log`,REPLAY_DIVERGENCE:`replay-divergence`,STEP_NOT_REGISTERED:`step-not-registered`,WORKFLOW_NOT_REGISTERED:`workflow-not-registered`,RUNTIME_DECRYPTION_FAILED:`runtime-decryption-failed`,DEPLOYMENT_MISMATCH:`deployment-mismatch`};var d=class extends Error{cause;constructor(e,t){let n=c(e,l(void 0,t?.slug));super(n,{cause:t?.cause}),t?.cause!==void 0&&(this.cause=t.cause),t?.cause instanceof Error&&(this.stack=`${this.stack}\nCaused by: ${t.cause.stack}`)}static is(e){return s(e)&&e.name===`WorkflowError`}},f=class extends d{status;code;url;retryAfter;constructor(e,t){super(e,{cause:t?.cause}),this.name=`WorkflowWorldError`,this.status=t?.status,this.code=t?.code,this.url=t?.url,this.retryAfter=t?.retryAfter}static is(e){return s(e)&&e.name===`WorkflowWorldError`}},p=class extends d{runId;errorCode;constructor(e,t,n={}){let r=t instanceof Error?t.message:typeof t==`string`?t:t&&typeof t==`object`&&`message`in t?String(t.message):`Unknown error`;super(`Workflow run "${e}" failed: ${r}`,{cause:t}),this.name=`WorkflowRunFailedError`,this.runId=e,n.errorCode!==void 0&&(this.errorCode=n.errorCode)}static is(e){return s(e)&&e.name===`WorkflowRunFailedError`}},m=class extends d{runId;status;constructor(e,t){super(`Workflow run "${e}" has not completed`,{}),this.name=`WorkflowRunNotCompletedError`,this.runId=e,this.status=t}static is(e){return s(e)&&e.name===`WorkflowRunNotCompletedError`}},h=class extends d{constructor(e,t){super(e,{...t}),this.name=`WorkflowRuntimeError`}static is(e){return s(e)&&e.name===`WorkflowRuntimeError`}},g=class extends h{constructor(e,t){super(e,{...t,slug:u.CORRUPTED_EVENT_LOG}),this.name=`CorruptedEventLogError`}static is(e){return s(e)&&e.name===`CorruptedEventLogError`}},_=class extends h{eventId;constructor(e,t){super(e,{...t,slug:u.REPLAY_DIVERGENCE}),this.name=`ReplayDivergenceError`,this.eventId=t.eventId}static is(e){return s(e)&&e.name===`ReplayDivergenceError`&&typeof e.eventId==`string`}},v=class extends d{eventCount;limit;constructor(e,t,n){super(`Workflow exceeded the maximum of ${t} events per run`,n),this.name=`MaxEventsExceededError`,this.eventCount=e,this.limit=t}static is(e){return s(e)&&e.name===`MaxEventsExceededError`}},y=class extends h{constructor(e,t){super(e,{cause:t?.cause,slug:u.RUNTIME_DECRYPTION_FAILED}),this.name=`RuntimeDecryptionError`,t?.context!==void 0&&(this.context=t.context)}static is(e){return s(e)&&e.name===`RuntimeDecryptionError`}},b=class extends d{hint;constructor(e,t){let n=c(e,l(t?.hint,void 0));super(n,{cause:t?.cause}),this.name=`WorkflowBuildError`,this.hint=t?.hint}static is(e){return s(e)&&e.name===`WorkflowBuildError`}},x=class extends d{hint;fatal=!0;constructor(e,t){let n=c(e,l(t?.hint,void 0));super(n,{cause:t?.cause}),this.name=`SerializationError`,this.hint=t?.hint}static is(e){return s(e)&&e.name===`SerializationError`}},S=class extends h{stepName;constructor(e){super(`Step "${e}" is not registered in the current deployment. This usually indicates a build or bundling issue that caused the step to not be included in the deployment.`,{slug:u.STEP_NOT_REGISTERED}),this.name=`StepNotRegisteredError`,this.stepName=e}static is(e){return s(e)&&e.name===`StepNotRegisteredError`}},C=class extends h{workflowName;constructor(e){super(`Workflow "${e}" is not registered in the current deployment. This usually means a run was started against a deployment that does not have this workflow, or there was a build/bundling issue.`,{slug:u.WORKFLOW_NOT_REGISTERED}),this.name=`WorkflowNotRegisteredError`,this.workflowName=e}static is(e){return s(e)&&e.name===`WorkflowNotRegisteredError`}},w=class extends h{runId;expectedDeploymentId;actualDeploymentId;recoveryAttempts;constructor(e,t,r,i){let a=i?.recoveryAttempts??0,o=a>0?` The runtime re-routed the message to "${t}" ${a} ${n(`time`,`times`,a)} and it kept arriving elsewhere, so the run was stopped to protect against code-skew errors.`:` The run was stopped to protect against code-skew errors.`;super(`Workflow run "${e}" is pinned to deployment "${t}", but was received by deployment "${r}".${o} Verify that the run's deployment is still available and that queue callbacks are routed to it.`,{slug:u.DEPLOYMENT_MISMATCH,cause:i?.cause}),this.name=`WorkflowDeploymentMismatchError`,this.runId=e,this.expectedDeploymentId=t,this.actualDeploymentId=r,this.recoveryAttempts=a}static is(e){return s(e)&&e.name===`WorkflowDeploymentMismatchError`}},T=class extends d{runId;constructor(e){super(`Workflow run "${e}" not found`,{}),this.name=`WorkflowRunNotFoundError`,this.runId=e}static is(e){return s(e)&&e.name===`WorkflowRunNotFoundError`}},E=class extends d{token;conflictingRunId;constructor(e,t){super(`Hook token "${e}" is already in use by another workflow${t?` (run "${t}")`:``}`,{slug:u.HOOK_CONFLICT}),this.name=`HookConflictError`,this.token=e,t!==void 0&&(this.conflictingRunId=t)}static is(e){return s(e)&&e.name===`HookConflictError`}},D=class extends d{token;constructor(e){super(`Hook not found`,{}),this.name=`HookNotFoundError`,this.token=e}static is(e){return s(e)&&e.name===`HookNotFoundError`}},O=class extends f{constructor(e){super(e),this.name=`EntityConflictError`}static is(e){return s(e)&&e.name===`EntityConflictError`}},k=class extends f{constructor(e){super(e),this.name=`RunExpiredError`}static is(e){return s(e)&&e.name===`RunExpiredError`}},A=class extends f{runId;streamId;expiredAt;constructor(e,t,n,r){super(e,{status:410,code:`stream-expired`}),this.runId=t,this.streamId=n,this.expiredAt=r,this.name=`StreamExpiredError`}static is(e){return s(e)&&e.name===`StreamExpiredError`}},j=class extends f{constructor(e,t){super(e,{retryAfter:t?.retryAfter}),this.name=`TooEarlyError`}static is(e){return s(e)&&e.name===`TooEarlyError`}},M=class extends f{retryAfter;constructor(e,t){super(e),this.name=`ThrottleError`,this.retryAfter=t?.retryAfter}static is(e){return s(e)&&e.name===`ThrottleError`}},N=class extends f{details;constructor(e,t){super(e,{status:412,retryAfter:t?.retryAfter}),this.name=`PreconditionFailedError`,this.details=t?.details}static is(e){return s(e)&&e.name===`PreconditionFailedError`}},P=class extends d{runId;constructor(e){super(`Workflow run "${e}" cancelled`,{}),this.name=`WorkflowRunCancelledError`,this.runId=e}static is(e){return s(e)&&e.name===`WorkflowRunCancelledError`}},F=class extends d{runSpecVersion;worldSpecVersion;constructor(e,t){super(`Run requires spec version ${e}, but world supports version ${t}. Please upgrade 'workflow' package.`),this.name=`RunNotSupportedError`,this.runSpecVersion=e,this.worldSpecVersion=t}static is(e){return s(e)&&e.name===`RunNotSupportedError`}},I=class extends Error{fatal=!0;constructor(e){super(e),this.name=`FatalError`}static is(e){return s(e)?e.name===`FatalError`||e.fatal===!0:!1}},L=class extends Error{retryAfter;constructor(e,t={}){super(e),this.name=`RetryableError`,t.retryAfter===void 0?this.retryAfter=new Date(Date.now()+1e3):this.retryAfter=a(t.retryAfter)}static is(e){return s(e)&&e.name===`RetryableError`}};const R="Your current vercel account does not have access to this resource. Use `vercel login` or `vercel switch` to ensure you are linked to the right account.",z=Symbol.for(`@workflow/errors//FatalError`),B=Symbol.for(`@workflow/errors//RetryableError`),V=Symbol.for(`@workflow/errors//HookConflictError`),H=Symbol.for(`@workflow/errors//RuntimeDecryptionError`);typeof globalThis<`u`&&(Object.hasOwn(globalThis,z)||Object.defineProperty(globalThis,z,{value:I,writable:!1,enumerable:!1,configurable:!1}),Object.hasOwn(globalThis,B)||Object.defineProperty(globalThis,B,{value:L,writable:!1,enumerable:!1,configurable:!1}),Object.hasOwn(globalThis,V)||Object.defineProperty(globalThis,V,{value:E,writable:!1,enumerable:!1,configurable:!1}),Object.hasOwn(globalThis,H)||Object.defineProperty(globalThis,H,{value:y,writable:!1,enumerable:!1,configurable:!1}));export{o as A,C,T as D,m as E,r as M,n as N,h as O,d as S,p as T,M as _,E as a,b,N as c,k as d,F as f,A as g,S as h,I as i,a as j,f as k,_ as l,x as m,u as n,D as o,y as p,O as r,v as s,g as t,L as u,j as v,P as w,w as x,R as y};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as e,i as t,t as n}from"./rolldown-runtime-8V8biNmG.js";import{t as r}from"./global-singleton-BNinwFrL.js";import{_ as i,c as a,d as o,g as s,k as c,r as l,v as u}from"./dist-DjojkP5e.js";import{Br as d,Gr as f,O as p,ii as m,v as h}from"./dist-CgbVZs5l.js";import{i as ee,n as g,t as _}from"./undici-DfxNX5og.js";import{n as v,r as y,t as b}from"./token-util-DjMgNdXS.js";import{createRequire as te}from"module";import{inspect as x}from"node:util";import S from"node:os";var C=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})})),ne=n(((t,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:()=>p,getVercelOidcTokenSync:()=>m}),n.exports=l(u);var d=C(),f=y();async function p(t){let n=``,r;try{n=m()}catch(e){r=e}try{let[{getTokenPayload:r,isExpired:i},{refreshToken:a}]=await Promise.all([await import(`./token-util-DjMgNdXS.js`).then(t=>e(t.t())),await import(`./token-DGzfw-Vb.js`).then(t=>e(t.default))]);(!n||i(r(n),t?.expirationBufferMs))&&(await a(t),n=m())}catch(e){let t=r instanceof Error?r.message:``;throw e instanceof Error&&(t=`${t}
|
|
2
|
+
${e.message}`),t?new f.VercelOidcTokenError(t):e}return n}function m(){let e=(0,d.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. Do you have the OIDC option enabled in the Vercel project settings?`);return e}0&&(n.exports={getVercelOidcToken:p,getVercelOidcTokenSync:m})})),re=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:()=>f.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>f.RefreshAccessTokenFailedError,getContext:()=>d.getContext,getVercelOidcToken:()=>u.getVercelOidcToken,getVercelOidcTokenSync:()=>u.getVercelOidcTokenSync,getVercelToken:()=>p.getVercelToken}),t.exports=c(l);var u=ne(),d=C(),f=v(),p=b();0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,getContext,getVercelOidcToken,getVercelOidcTokenSync,getVercelToken})})),ie=re();let ae;try{ae=new TextDecoder}catch{}let w,T,E=0;const oe=[],se=57337,ce={};let le=11281e4,D=1681e4,O=oe,ue=0,k={},A,de,fe=0,j=0,M,N,P=[],pe=[],F,I,me,he={useRecords:!1,mapsAsObjects:!0},ge=!1,_e=2;try{Function(``)}catch{_e=1/0}var ve=class e{constructor(e){if(e&&((e.keyMap||e._keyMap)&&!e.useRecords&&(e.useRecords=!1,e.mapsAsObjects=!0),e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.getStructures&&(e.getShared=e.getStructures),e.getShared&&!e.structures&&((e.structures=[]).uninitialized=!0),e.keyMap)){this.mapKey=new Map;for(let[t,n]of Object.entries(e.keyMap))this.mapKey.set(n,t)}Object.assign(this,e)}decodeKey(e){return this.keyMap&&this.mapKey.get(e)||e}encodeKey(e){return this.keyMap&&this.keyMap.hasOwnProperty(e)?this.keyMap[e]:e}encodeKeys(e){if(!this._keyMap)return e;let t=new Map;for(let[n,r]of Object.entries(e))t.set(this._keyMap.hasOwnProperty(n)?this._keyMap[n]:n,r);return t}decodeKeys(e){if(!this._keyMap||e.constructor.name!=`Map`)return e;if(!this._mapKey){this._mapKey=new Map;for(let[e,t]of Object.entries(this._keyMap))this._mapKey.set(t,e)}let t={};return e.forEach((e,n)=>t[R(this._mapKey.has(n)?this._mapKey.get(n):n)]=e),t}mapDecode(e,t){let n=this.decode(e);if(this._keyMap)switch(n.constructor.name){case`Array`:return n.map(e=>this.decodeKeys(e))}return n}decode(t,n){if(w)return Ve(()=>(He(),this?this.decode(t,n):e.prototype.decode.call(he,t,n)));T=n>-1?n:t.length,E=0,ue=0,j=0,de=null,O=oe,M=null,w=t;try{I=t.dataView||=new DataView(t.buffer,t.byteOffset,t.byteLength)}catch(e){throw w=null,t instanceof Uint8Array?e:Error(`Source must be a Uint8Array or Buffer but was a `+(t&&typeof t==`object`?t.constructor.name:typeof t))}if(this instanceof e){if(k=this,F=this.sharedValues&&(this.pack?Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),this.structures)return A=this.structures,ye();(!A||A.length>0)&&(A=[])}else k=he,(!A||A.length>0)&&(A=[]),F=null;return ye()}decodeMultiple(e,t){let n,r=0;try{let i=e.length;ge=!0;let a=this?this.decode(e,i):We.decode(e,i);if(t){if(t(a)===!1)return;for(;E<i;)if(r=E,t(ye())===!1)return}else{for(n=[a];E<i;)r=E,n.push(ye());return n}}catch(e){throw e.lastPosition=r,e.values=n,e}finally{ge=!1,He()}}};function ye(){try{let e=L();if(M){if(E>=M.postBundlePosition){let e=Error(`Unexpected bundle position`);throw e.incomplete=!0,e}E=M.postBundlePosition,M=null}if(E==T)A=null,w=null,N&&=null;else if(E>T){let e=Error(`Unexpected end of CBOR data`);throw e.incomplete=!0,e}else if(!ge)throw Error(`Data read, but end of buffer not reached`);return e}catch(e){throw He(),(e instanceof RangeError||e.message.startsWith(`Unexpected end of buffer`))&&(e.incomplete=!0),e}}function L(){let e=w[E++],t=e>>5;if(e&=31,e>23)switch(e){case 24:e=w[E++];break;case 25:if(t==7)return Ae();e=I.getUint16(E),E+=2;break;case 26:if(t==7){let e=I.getFloat32(E);if(k.useFloat32>2){let t=Ue[(w[E]&127)<<1|w[E+1]>>7];return E+=4,(t*e+(e>0?.5:-.5)>>0)/t}return E+=4,e}e=I.getUint32(E),E+=4;break;case 27:if(t==7){let e=I.getFloat64(E);return E+=8,e}if(t>1){if(I.getUint32(E)>0)throw Error(`JavaScript does not support arrays, maps, or strings with length over 4294967295`);e=I.getUint32(E+4)}else k.int64AsNumber?(e=I.getUint32(E)*4294967296,e+=I.getUint32(E+4)):e=I.getBigUint64(E);E+=8;break;case 31:switch(t){case 2:case 3:throw Error(`Indefinite length not supported for byte or text strings`);case 4:let e=[],n,r=0;for(;(n=L())!=ce;){if(r>=le)throw Error(`Array length exceeds ${le}`);e[r++]=n}return t==4?e:t==3?e.join(``):Buffer.concat(e);case 5:let i;if(k.mapsAsObjects){let e={},t=0;if(k.keyMap)for(;(i=L())!=ce;){if(t++>=D)throw Error(`Property count exceeds ${D}`);e[R(k.decodeKey(i))]=L()}else for(;(i=L())!=ce;){if(t++>=D)throw Error(`Property count exceeds ${D}`);e[R(i)]=L()}return e}else{me&&=(k.mapsAsObjects=!0,!1);let e=new Map;if(k.keyMap){let t=0;for(;(i=L())!=ce;){if(t++>=D)throw Error(`Map size exceeds ${D}`);e.set(k.decodeKey(i),L())}}else{let t=0;for(;(i=L())!=ce;){if(t++>=D)throw Error(`Map size exceeds ${D}`);e.set(i,L())}}return e}case 7:return ce;default:throw Error(`Invalid major type for indefinite length `+t)}default:throw Error(`Unknown token `+e)}switch(t){case 0:return e;case 1:return~e;case 2:return De(e);case 3:if(j>=E)return de.slice(E-fe,(E+=e)-fe);if(j==0&&T<140&&e<32){let t=e<16?Ee(e):Te(e);if(t!=null)return t}return Se(e);case 4:if(e>=le)throw Error(`Array length exceeds ${le}`);let t=Array(e);for(let n=0;n<e;n++)t[n]=L();return t;case 5:if(e>=D)throw Error(`Map size exceeds ${le}`);if(k.mapsAsObjects){let t={};if(k.keyMap)for(let n=0;n<e;n++)t[R(k.decodeKey(L()))]=L();else for(let n=0;n<e;n++)t[R(L())]=L();return t}else{me&&=(k.mapsAsObjects=!0,!1);let t=new Map;if(k.keyMap)for(let n=0;n<e;n++)t.set(k.decodeKey(L()),L());else for(let n=0;n<e;n++)t.set(L(),L());return t}case 6:if(e>=se){let t=A[e&8191];if(t)return t.read||=xe(t),t.read();if(e<65536){if(e==57343){let e=ze(),t=L(),n=L();je(t,n);let r={};if(k.keyMap)for(let t=2;t<e;t++){let e=k.decodeKey(n[t-2]);r[R(e)]=L()}else for(let t=2;t<e;t++){let e=n[t-2];r[R(e)]=L()}return r}else if(e==57342){let e=ze(),t=L();for(let n=2;n<e;n++)je(t++,L());return L()}else if(e==se)return Re();if(k.getShared&&(Be(),t=A[e&8191],t))return t.read||=xe(t),t.read()}}let n=P[e];if(n)return n.handlesRead?n(L):n(L());{let t=L();for(let n=0;n<pe.length;n++){let r=pe[n](e,t);if(r!==void 0)return r}return new B(t,e)}case 7:switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:let t=(F||H())[e];if(t!==void 0)return t;throw Error(`Unknown token `+e)}default:if(isNaN(e)){let e=Error(`Unexpected end of CBOR data`);throw e.incomplete=!0,e}throw Error(`Unknown CBOR token `+e)}}const be=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function xe(e){if(!e)throw Error(`Structure is required in record definition`);function t(){let e=w[E++];if(e&=31,e>23)switch(e){case 24:e=w[E++];break;case 25:e=I.getUint16(E),E+=2;break;case 26:e=I.getUint32(E),E+=4;break;default:throw Error(`Expected array header, but got `+w[E-1])}let t=this.compiledReader;for(;t;){if(t.propertyCount===e)return t(L);t=t.next}if(this.slowReads++>=_e){let n=this.length==e?this:this.slice(0,e);return t=k.keyMap?Function(`r`,`return {`+n.map(e=>k.decodeKey(e)).map(e=>be.test(e)?R(e)+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`}`):Function(`r`,`return {`+n.map(e=>be.test(e)?R(e)+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`}`),this.compiledReader&&(t.next=this.compiledReader),t.propertyCount=e,this.compiledReader=t,t(L)}let n={};if(k.keyMap)for(let t=0;t<e;t++)n[R(k.decodeKey(this[t]))]=L();else for(let t=0;t<e;t++)n[R(this[t])]=L();return n}return e.slowReads=0,t}function R(e){if(typeof e==`string`)return e===`__proto__`?`__proto_`:e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return e.toString();if(e==null)return e+``;throw Error(`Invalid property name type `+typeof e)}let Se=we;function Ce(e){Se=t(1);function t(t){return function(t){let n=O[ue++];if(n==null){if(M)return we(t);let r=e(E,T,t,w);if(typeof r==`string`)n=r,O=oe;else if(O=r,ue=1,j=1,n=O[0],n===void 0)throw Error(`Unexpected end of buffer`)}let r=n.length;return r<=t?(E+=t,n):(de=n,fe=E,j=E+r,E+=t,n.slice(0,t))}}}function we(e){let t;if(e<16&&(t=Ee(e)))return t;if(e>64&&ae)return ae.decode(w.subarray(E,E+=e));let n=E+e,r=[];for(t=``;E<n;){let e=w[E++];if(!(e&128))r.push(e);else if((e&224)==192){let t=w[E++]&63;r.push((e&31)<<6|t)}else if((e&240)==224){let t=w[E++]&63,n=w[E++]&63;r.push((e&31)<<12|t<<6|n)}else if((e&248)==240){let t=w[E++]&63,n=w[E++]&63,i=w[E++]&63,a=(e&7)<<18|t<<12|n<<6|i;a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a)}else r.push(e);r.length>=4096&&(t+=z.apply(String,r),r.length=0)}return r.length>0&&(t+=z.apply(String,r)),t}let z=String.fromCharCode;function Te(e){let t=E,n=Array(e);for(let r=0;r<e;r++){let e=w[E++];if((e&128)>0){E=t;return}n[r]=e}return z.apply(String,n)}function Ee(e){if(e<4)if(e<2){if(e===0)return``;{let e=w[E++];if((e&128)>1){--E;return}return z(e)}}else{let t=w[E++],n=w[E++];if((t&128)>0||(n&128)>0){E-=2;return}if(e<3)return z(t,n);let r=w[E++];if((r&128)>0){E-=3;return}return z(t,n,r)}else{let t=w[E++],n=w[E++],r=w[E++],i=w[E++];if((t&128)>0||(n&128)>0||(r&128)>0||(i&128)>0){E-=4;return}if(e<6){if(e===4)return z(t,n,r,i);{let e=w[E++];if((e&128)>0){E-=5;return}return z(t,n,r,i,e)}}else if(e<8){let a=w[E++],o=w[E++];if((a&128)>0||(o&128)>0){E-=6;return}if(e<7)return z(t,n,r,i,a,o);let s=w[E++];if((s&128)>0){E-=7;return}return z(t,n,r,i,a,o,s)}else{let a=w[E++],o=w[E++],s=w[E++],c=w[E++];if((a&128)>0||(o&128)>0||(s&128)>0||(c&128)>0){E-=8;return}if(e<10){if(e===8)return z(t,n,r,i,a,o,s,c);{let e=w[E++];if((e&128)>0){E-=9;return}return z(t,n,r,i,a,o,s,c,e)}}else if(e<12){let l=w[E++],u=w[E++];if((l&128)>0||(u&128)>0){E-=10;return}if(e<11)return z(t,n,r,i,a,o,s,c,l,u);let d=w[E++];if((d&128)>0){E-=11;return}return z(t,n,r,i,a,o,s,c,l,u,d)}else{let l=w[E++],u=w[E++],d=w[E++],f=w[E++];if((l&128)>0||(u&128)>0||(d&128)>0||(f&128)>0){E-=12;return}if(e<14){if(e===12)return z(t,n,r,i,a,o,s,c,l,u,d,f);{let e=w[E++];if((e&128)>0){E-=13;return}return z(t,n,r,i,a,o,s,c,l,u,d,f,e)}}else{let p=w[E++],m=w[E++];if((p&128)>0||(m&128)>0){E-=14;return}if(e<15)return z(t,n,r,i,a,o,s,c,l,u,d,f,p,m);let h=w[E++];if((h&128)>0){E-=15;return}return z(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}}}}}function De(e){return k.copyBuffers?Uint8Array.prototype.slice.call(w,E,E+=e):w.subarray(E,E+=e)}let Oe=new Float32Array(1),ke=new Uint8Array(Oe.buffer,0,4);function Ae(){let e=w[E++],t=w[E++],n=(e&127)>>2;if(n===31)return t||e&3?NaN:e&128?-1/0:1/0;if(n===0){let n=((e&3)<<8|t)/(1<<24);return e&128?-n:n}return ke[3]=e&128|(n>>1)+56,ke[2]=(e&7)<<5|t>>3,ke[1]=t<<5,ke[0]=0,Oe[0]}Array(4096);var B=class{constructor(e,t){this.value=e,this.tag=t}};P[0]=e=>new Date(e),P[1]=e=>new Date(Math.round(e*1e3)),P[2]=e=>{let t=BigInt(0);for(let n=0,r=e.byteLength;n<r;n++)t=BigInt(e[n])+(t<<BigInt(8));return t},P[3]=e=>BigInt(-1)-P[2](e),P[4]=e=>+(e[1]+`e`+e[0]),P[5]=e=>e[1]*Math.exp(e[0]*Math.log(2));const je=(e,t)=>{e-=57344;let n=A[e];n&&n.isShared&&((A.restoreStructures||=[])[e]=n),A[e]=t,t.read=xe(t)};P[105]=e=>{let t=e.length,n=e[1];je(e[0],n);let r={};for(let i=2;i<t;i++){let t=n[i-2];r[R(t)]=e[i]}return r},P[14]=e=>M?M[0].slice(M.position0,M.position0+=e):new B(e,14),P[15]=e=>M?M[1].slice(M.position1,M.position1+=e):new B(e,15);let Me={Error,RegExp};P[27]=e=>(Me[e[0]]||Error)(e[1],e[2]);const Ne=e=>{if(w[E++]!=132){let e=Error(`Packed values structure must be followed by a 4 element array`);throw w.length<E&&(e.incomplete=!0),e}let t=e();if(!t||!t.length){let e=Error(`Packed values structure must be followed by a 4 element array`);throw e.incomplete=!0,e}return F=F?t.concat(F.slice(t.length)):t,F.prefixes=e(),F.suffixes=e(),e()};Ne.handlesRead=!0,P[51]=Ne,P[6]=e=>{if(!F)if(k.getShared)Be();else return new B(e,6);if(typeof e==`number`)return F[16+(e>=0?2*e:-2*e-1)];let t=Error(`No support for non-integer packed references yet`);throw e===void 0&&(t.incomplete=!0),t},P[28]=e=>{N||(N=new Map,N.id=0);let t=N.id++,n=E,r=w[E],i;i=r>>5==4?[]:{};let a={target:i};N.set(t,a);let o=e();return a.used?(Object.getPrototypeOf(i)!==Object.getPrototypeOf(o)&&(E=n,i=o,N.set(t,{target:i}),o=e()),Object.assign(i,o)):(a.target=o,o)},P[28].handlesRead=!0,P[29]=e=>{let t=N.get(e);return t.used=!0,t.target},P[258]=e=>new Set(e),(P[259]=e=>(k.mapsAsObjects&&(k.mapsAsObjects=!1,me=!0),e())).handlesRead=!0;function V(e,t){return typeof e==`string`?e+t:e instanceof Array?e.concat(t):Object.assign({},e,t)}function H(){if(!F)if(k.getShared)Be();else throw Error(`No packed values available`);return F}pe.push((e,t)=>{if(e>=225&&e<=255)return V(H().prefixes[e-224],t);if(e>=28704&&e<=32767)return V(H().prefixes[e-28672],t);if(e>=1879052288&&e<=2147483647)return V(H().prefixes[e-1879048192],t);if(e>=216&&e<=223)return V(t,H().suffixes[e-216]);if(e>=27647&&e<=28671)return V(t,H().suffixes[e-27639]);if(e>=1811940352&&e<=1879048191)return V(t,H().suffixes[e-1811939328]);if(e==1399353956)return{packedValues:F,structures:A.slice(0),version:t};if(e==55799)return t});const Pe=new Uint8Array(new Uint16Array([1]).buffer)[0]==1,Fe=[Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,typeof BigUint64Array>`u`?{name:`BigUint64Array`}:BigUint64Array,Int8Array,Int16Array,Int32Array,typeof BigInt64Array>`u`?{name:`BigInt64Array`}:BigInt64Array,Float32Array,Float64Array],Ie=[64,68,69,70,71,72,77,78,79,85,86];for(let e=0;e<Fe.length;e++)Le(Fe[e],Ie[e]);function Le(e,t){let n=`get`+e.name.slice(0,-5),r;typeof e==`function`?r=e.BYTES_PER_ELEMENT:e=null;for(let i=0;i<2;i++){if(!i&&r==1)continue;let a=r==2?1:r==4?2:r==8?3:0;P[i?t:t-4]=r==1||i==Pe?n=>{if(!e)throw Error(`Could not find typed array for code `+t);return!k.copyBuffers&&(r===1||r===2&&!(n.byteOffset&1)||r===4&&!(n.byteOffset&3)||r===8&&!(n.byteOffset&7))?new e(n.buffer,n.byteOffset,n.byteLength>>a):new e(Uint8Array.prototype.slice.call(n,0).buffer)}:r=>{if(!e)throw Error(`Could not find typed array for code `+t);let o=new DataView(r.buffer,r.byteOffset,r.byteLength),s=r.length>>a,c=new e(s),l=o[n];for(let e=0;e<s;e++)c[e]=l.call(o,e<<a,i);return c}}}function Re(){let e=ze(),t=E+L();for(let t=2;t<e;t++){let e=ze();E+=e}let n=E;return E=t,M=[we(ze()),we(ze())],M.position0=0,M.position1=0,M.postBundlePosition=E,E=n,L()}function ze(){let e=w[E++]&31;if(e>23)switch(e){case 24:e=w[E++];break;case 25:e=I.getUint16(E),E+=2;break;case 26:e=I.getUint32(E),E+=4;break}return e}function Be(){if(k.getShared){let e=Ve(()=>(w=null,k.getShared()))||{},t=e.structures||[];k.sharedVersion=e.version,F=k.sharedValues=e.packedValues,A===!0?k.structures=A=t:A.splice.apply(A,[0,t.length].concat(t))}}function Ve(e){let t=T,n=E,r=ue,i=fe,a=j,o=de,s=O,c=N,l=M,u=new Uint8Array(w.slice(0,T)),d=A,f=k,p=ge,m=e();return T=t,E=n,ue=r,fe=i,j=a,de=o,O=s,N=c,M=l,w=u,ge=p,A=d,k=f,I=new DataView(w.buffer,w.byteOffset,w.byteLength),m}function He(){w=null,N=null,A=null}const Ue=Array(147);for(let e=0;e<256;e++)Ue[e]=+(`1e`+Math.floor(45.15-e*.30103));let We=new ve({useRecords:!1});const Ge=We.decode;We.decodeMultiple;const Ke={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let qe;try{qe=new TextEncoder}catch{}let Je,Ye;const Xe=typeof globalThis==`object`&&globalThis.Buffer,Ze=Xe!==void 0,Qe=Ze?Xe.allocUnsafeSlow:Uint8Array,$e=Ze?Xe:Uint8Array,et=Ze?4294967296:2144337920;let tt,U,W,G=0,K,q=null;const nt=/[\u0080-\uFFFF]/,J=Symbol(`record-id`);var rt=class extends ve{constructor(e){super(e),this.offset=0;let t,n,r,i,a;e||={};let o=$e.prototype.utf8Write?function(e,t,n){return U.utf8Write(e,t,n)}:qe&&qe.encodeInto?function(e,t){return qe.encodeInto(e,U.subarray(t)).written}:!1,s=this,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(l??=c?128:0,l>8190)throw Error(`Maximum maxSharedStructure is 8190`);let u=e.sequential;u&&(l=0),this.structures||=[],this.saveStructures&&(this.saveShared=this.saveStructures);let d,f,p=e.sharedValues,m;if(p){m=Object.create(null);for(let e=0,t=p.length;e<t;e++)m[p[e]]=e}let h=[],ee=0,g=0;this.mapEncode=function(e,t){if(this._keyMap&&!this._mapped)switch(e.constructor.name){case`Array`:e=e.map(e=>this.encodeKeys(e));break}return this.encode(e,t)},this.encode=function(o,c){if(U||(U=new Qe(8192),W=new DataView(U.buffer,0,8192),G=0),K=U.length-10,K-G<2048?(U=new Qe(U.length),W=new DataView(U.buffer,0,U.length),K=U.length-10,G=0):c===512&&(G=G+7&2147483640),t=G,s.useSelfDescribedHeader&&(W.setUint32(G,3654940416),G+=3),a=s.structuredClone?new Map:null,s.bundleStrings&&typeof o!=`string`?(q=[],q.size=1/0):q=null,n=s.structures,n){if(n.uninitialized){let e=s.getShared()||{};s.structures=n=e.structures||[],s.sharedVersion=e.version;let t=s.sharedValues=e.packedValues;if(t){m={};for(let e=0,n=t.length;e<n;e++)m[t[e]]=e}}let e=n.length;if(e>l&&!u&&(e=l),!n.transitions){n.transitions=Object.create(null);for(let t=0;t<e;t++){let e=n[t];if(!e)continue;let r,i=n.transitions;for(let n=0,a=e.length;n<a;n++){i[J]===void 0&&(i[J]=t);let a=e[n];r=i[a],r||=i[a]=Object.create(null),i=r}i[J]=t|1048576}}u||(n.nextId=e)}if(r&&=!1,i=n||[],f=m,e.pack){let t=new Map;if(t.values=[],t.encoder=s,t.maxValues=e.maxPrivatePackedValues||(m?16:1/0),t.objectMap=m||!1,t.samplingPackedValues=d,ct(o,t),t.values.length>0){U[G++]=216,U[G++]=51,Y(4);let e=t.values;_(e),Y(0),Y(0),f=Object.create(m||null);for(let t=0,n=e.length;t<n;t++)f[e[t]]=t}}tt=c&yt;try{if(tt)return;if(_(o),q&&ft(t,_),s.offset=G,a&&a.idsToInsert){G+=a.idsToInsert.length*2,G>K&&y(G),s.offset=G;let e=dt(U.subarray(t,G),a.idsToInsert);return a=null,e}return c&512?(U.start=t,U.end=G,U):U.subarray(t,G)}finally{if(n){if(g<10&&g++,n.length>l&&(n.length=l),ee>1e4)n.transitions=null,g=0,ee=0,h.length>0&&(h=[]);else if(h.length>0&&!u){for(let e=0,t=h.length;e<t;e++)h[e][J]=void 0;h=[]}}if(r&&s.saveShared){s.structures.length>l&&(s.structures=s.structures.slice(0,l));let e=U.subarray(t,G);return s.updateSharedData()===!1?s.encode(o):e}c&1024&&(G=t)}},this.findCommonStringsToPack=()=>(d=new Map,m||=Object.create(null),e=>{let t=e&&e.threshold||4,n=this.pack?e.maxPrivatePackedValues||16:0;p||=this.sharedValues=[];for(let[e,i]of d)i.count>t&&(m[e]=n++,p.push(e),r=!0);for(;this.saveShared&&this.updateSharedData()===!1;);d=null});let _=n=>{G>K&&(U=y(G));var r=typeof n,i;if(r===`string`){if(f){let t=f[n];if(t>=0){t<16?U[G++]=t+224:(U[G++]=198,t&1?_(15-t>>1):_(t-16>>1));return}else if(d&&!e.pack){let e=d.get(n);e?e.count++:d.set(n,{count:1})}}let r=n.length;if(q&&r>=4&&r<1024){if((q.size+=r)>61440){let e,n=(q[0]?q[0].length*3+q[1].length:0)+10;G+n>K&&(U=y(G+n)),U[G++]=217,U[G++]=223,U[G++]=249,U[G++]=q.position?132:130,U[G++]=26,e=G-t,G+=4,q.position&&ft(t,_),q=[``,``],q.size=0,q.position=e}let e=nt.test(n);q[+!e]+=n,U[G++]=e?206:207,_(r);return}let a;a=r<32?1:r<256?2:r<65536?3:5;let s=r*3;if(G+s>K&&(U=y(G+s)),r<64||!o){let e,t,o,s=G+a;for(e=0;e<r;e++)t=n.charCodeAt(e),t<128?U[s++]=t:t<2048?(U[s++]=t>>6|192,U[s++]=t&63|128):(t&64512)==55296&&((o=n.charCodeAt(e+1))&64512)==56320?(t=65536+((t&1023)<<10)+(o&1023),e++,U[s++]=t>>18|240,U[s++]=t>>12&63|128,U[s++]=t>>6&63|128,U[s++]=t&63|128):(U[s++]=t>>12|224,U[s++]=t>>6&63|128,U[s++]=t&63|128);i=s-G-a}else i=o(n,G+a,s);i<24?U[G++]=96|i:i<256?(a<2&&U.copyWithin(G+2,G+1,G+1+i),U[G++]=120,U[G++]=i):i<65536?(a<3&&U.copyWithin(G+3,G+2,G+2+i),U[G++]=121,U[G++]=i>>8,U[G++]=i&255):(a<5&&U.copyWithin(G+5,G+3,G+3+i),U[G++]=122,W.setUint32(G,i),G+=4),G+=i}else if(r===`number`)if(!this.alwaysUseFloat&&n>>>0===n)n<24?U[G++]=n:n<256?(U[G++]=24,U[G++]=n):n<65536?(U[G++]=25,U[G++]=n>>8,U[G++]=n&255):(U[G++]=26,W.setUint32(G,n),G+=4);else if(!this.alwaysUseFloat&&n>>0===n)n>=-24?U[G++]=31-n:n>=-256?(U[G++]=56,U[G++]=~n):n>=-65536?(U[G++]=57,W.setUint16(G,~n),G+=2):(U[G++]=58,W.setUint32(G,~n),G+=4);else{let e;if((e=this.useFloat32)>0&&n<4294967296&&n>=-2147483648){U[G++]=250,W.setFloat32(G,n);let t;if(e<4||(t=n*Ue[(U[G]&127)<<1|U[G+1]>>7])>>0===t){G+=4;return}else G--}U[G++]=251,W.setFloat64(G,n),G+=8}else if(r===`object`)if(!n)U[G++]=246;else{if(a){let e=a.get(n);if(e){if(U[G++]=216,U[G++]=29,U[G++]=25,!e.references){let t=a.idsToInsert||=[];e.references=[],t.push(e)}e.references.push(G-t),G+=2;return}else a.set(n,{offset:G-t})}let e=n.constructor;if(e===Object)v(n);else if(e===Array){i=n.length,i<24?U[G++]=128|i:Y(i);for(let e=0;e<i;e++)_(n[e])}else if(e===Map)if((this.mapsAsObjects?this.useTag259ForMaps!==!1:this.useTag259ForMaps)&&(U[G++]=217,U[G++]=1,U[G++]=3),i=n.size,i<24?U[G++]=160|i:i<256?(U[G++]=184,U[G++]=i):i<65536?(U[G++]=185,U[G++]=i>>8,U[G++]=i&255):(U[G++]=186,W.setUint32(G,i),G+=4),s.keyMap)for(let[e,t]of n)_(s.encodeKey(e)),_(t);else for(let[e,t]of n)_(e),_(t);else{for(let e=0,t=Je.length;e<t;e++){let t=Ye[e];if(n instanceof t){let t=Je[e],r=t.tag;r??=t.getTag&&t.getTag.call(this,n),r<24?U[G++]=192|r:r<256?(U[G++]=216,U[G++]=r):r<65536?(U[G++]=217,U[G++]=r>>8,U[G++]=r&255):r>-1&&(U[G++]=218,W.setUint32(G,r),G+=4),t.encode.call(this,n,_,y);return}}if(n[Symbol.iterator]){if(tt){let e=Error(`Iterable should be serialized as iterator`);throw e.iteratorNotHandled=!0,e}U[G++]=159;for(let e of n)_(e);U[G++]=255;return}if(n[Symbol.asyncIterator]||st(n)){let e=Error(`Iterable/blob should be serialized as iterator`);throw e.iteratorNotHandled=!0,e}if(this.useToJSON&&n.toJSON){let e=n.toJSON();if(e!==n)return _(e)}v(n)}}else if(r===`boolean`)U[G++]=n?245:244;else if(r===`bigint`){if(n<BigInt(1)<<BigInt(64)&&n>=0)U[G++]=27,W.setBigUint64(G,n);else if(n>-(BigInt(1)<<BigInt(64))&&n<0)U[G++]=59,W.setBigUint64(G,-n-BigInt(1));else if(this.largeBigIntToFloat)U[G++]=251,W.setFloat64(G,Number(n));else{n>=BigInt(0)?U[G++]=194:(U[G++]=195,n=BigInt(-1)-n);let e=[];for(;n;)e.push(Number(n&BigInt(255))),n>>=BigInt(8);ut(new Uint8Array(e.reverse()),y);return}G+=8}else if(r===`undefined`)U[G++]=247;else throw Error(`Unknown type: `+r)},v=this.useRecords===!1?this.variableMapSize?e=>{let t=Object.keys(e),n=Object.values(e),r=t.length;if(r<24?U[G++]=160|r:r<256?(U[G++]=184,U[G++]=r):r<65536?(U[G++]=185,U[G++]=r>>8,U[G++]=r&255):(U[G++]=186,W.setUint32(G,r),G+=4),s.keyMap)for(let e=0;e<r;e++)_(s.encodeKey(t[e])),_(n[e]);else for(let e=0;e<r;e++)_(t[e]),_(n[e])}:e=>{U[G++]=185;let n=G-t;G+=2;let r=0;if(s.keyMap)for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(_(s.encodeKey(t)),_(e[t]),r++);else for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(_(t),_(e[t]),r++);U[n+++t]=r>>8,U[n+t]=r&255}:(e,t)=>{let n,a=i.transitions||=Object.create(null),o=0,s=0,c,u;if(this.keyMap){u=Object.keys(e).map(e=>this.encodeKey(e)),s=u.length;for(let e=0;e<s;e++){let t=u[e];n=a[t],n||(n=a[t]=Object.create(null),o++),a=n}}else for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(n=a[t],n||(a[J]&1048576&&(c=a[J]&65535),n=a[t]=Object.create(null),o++),a=n,s++);let d=a[J];if(d!==void 0)d&=65535,U[G++]=217,U[G++]=d>>8|224,U[G++]=d&255;else if(u||=a.__keys__||=Object.keys(e),c===void 0?(d=i.nextId++,d||(d=0,i.nextId=1),d>=256&&(i.nextId=(d=l)+1)):d=c,i[d]=u,d<l){U[G++]=217,U[G++]=d>>8|224,U[G++]=d&255,a=i.transitions;for(let e=0;e<s;e++)(a[J]===void 0||a[J]&1048576)&&(a[J]=d),a=a[u[e]];a[J]=d|1048576,r=!0}else{if(a[J]=d,W.setUint32(G,3655335680),G+=3,o&&(ee+=g*o),h.length>=256-l&&(h.shift()[J]=void 0),h.push(a),Y(s+2),_(57344+d),_(u),t)return;for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&_(e[t]);return}if(s<24?U[G++]=128|s:Y(s),!t)for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&_(e[t])},y=e=>{let n;if(e>16777216){if(e-t>et)throw Error(`Encoded buffer would be larger than maximum buffer size`);n=Math.min(et,Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096)*4096)}else n=(Math.max(e-t<<2,U.length-1)>>12)+1<<12;let r=new Qe(n);return W=new DataView(r.buffer,0,n),U.copy?U.copy(r,0,t,e):r.set(U.slice(t,e)),G-=t,t=0,K=r.length-10,U=r},b=100,te=1e3;this.encodeAsIterable=function(e,t){return ne(e,t,x)},this.encodeAsAsyncIterable=function(e,t){return ne(e,t,re)};function*x(e,n,r){let i=e.constructor;if(i===Object){let t=s.useRecords!==!1;t?v(e,!0):it(Object.keys(e).length,160);for(let r in e){let i=e[r];t||_(r),i&&typeof i==`object`?n[r]?yield*x(i,n[r]):yield*S(i,n,r):_(i)}}else if(i===Array){let r=e.length;Y(r);for(let i=0;i<r;i++){let r=e[i];r&&(typeof r==`object`||G-t>b)?n.element?yield*x(r,n.element):yield*S(r,n,`element`):_(r)}}else if(e[Symbol.iterator]&&!e.buffer){U[G++]=159;for(let r of e)r&&(typeof r==`object`||G-t>b)?n.element?yield*x(r,n.element):yield*S(r,n,`element`):_(r);U[G++]=255}else st(e)?(it(e.size,64),yield U.subarray(t,G),yield e,C()):e[Symbol.asyncIterator]?(U[G++]=159,yield U.subarray(t,G),yield e,C(),U[G++]=255):_(e);r&&G>t?yield U.subarray(t,G):G-t>b&&(yield U.subarray(t,G),C())}function*S(e,n,r){let i=G-t;try{_(e),G-t>b&&(yield U.subarray(t,G),C())}catch(a){if(a.iteratorNotHandled)n[r]={},G=t+i,yield*x.call(this,e,n[r]);else throw a}}function C(){b=te,s.encode(null,yt)}function ne(e,t,n){return b=t&&t.chunkThreshold?te=t.chunkThreshold:100,e&&typeof e==`object`?(s.encode(null,yt),n(e,s.iterateProperties||={},!0)):[s.encode(e)]}async function*re(e,t){for(let n of x(e,t,!0)){let e=n.constructor;if(e===$e||e===Uint8Array)yield n;else if(st(n)){let e=n.stream().getReader(),t;for(;!(t=await e.read()).done;)yield t.value}else if(n[Symbol.asyncIterator])for await(let e of n)C(),e?yield*re(e,t.async||={}):yield s.encode(e);else yield n}}}useBuffer(e){U=e,W=new DataView(U.buffer,U.byteOffset,U.byteLength),G=0}clearSharedData(){this.structures&&=[],this.sharedValues&&=void 0}updateSharedData(){let e=this.sharedVersion||0;this.sharedVersion=e+1;let t=this.structures.slice(0),n=new at(t,this.sharedValues,this.sharedVersion),r=this.saveShared(n,t=>(t&&t.version||0)==e);return r===!1?(n=this.getShared()||{},this.structures=n.structures||[],this.sharedValues=n.packedValues,this.sharedVersion=n.version,this.structures.nextId=this.structures.length):t.forEach((e,t)=>this.structures[t]=e),r}};function it(e,t){e<24?U[G++]=t|e:e<256?(U[G++]=t|24,U[G++]=e):e<65536?(U[G++]=t|25,U[G++]=e>>8,U[G++]=e&255):(U[G++]=t|26,W.setUint32(G,e),G+=4)}var at=class{constructor(e,t,n){this.structures=e,this.packedValues=t,this.version=n}};function Y(e){e<24?U[G++]=128|e:e<256?(U[G++]=152,U[G++]=e):e<65536?(U[G++]=153,U[G++]=e>>8,U[G++]=e&255):(U[G++]=154,W.setUint32(G,e),G+=4)}const ot=typeof Blob>`u`?function(){}:Blob;function st(e){if(e instanceof ot)return!0;let t=e[Symbol.toStringTag];return t===`Blob`||t===`File`}function ct(e,t){switch(typeof e){case`string`:if(e.length>3){if(t.objectMap[e]>-1||t.values.length>=t.maxValues)return;let n=t.get(e);if(n)++n.count==2&&t.values.push(e);else if(t.set(e,{count:1}),t.samplingPackedValues){let n=t.samplingPackedValues.get(e);n?n.count++:t.samplingPackedValues.set(e,{count:1})}}break;case`object`:if(e)if(e instanceof Array)for(let n=0,r=e.length;n<r;n++)ct(e[n],t);else{let r=!t.encoder.useRecords;for(var n in e)e.hasOwnProperty(n)&&(r&&ct(n,t),ct(e[n],t))}break;case`function`:console.log(e)}}const lt=new Uint8Array(new Uint16Array([1]).buffer)[0]==1;Ye=[Date,Set,Error,RegExp,B,ArrayBuffer,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,typeof BigUint64Array>`u`?function(){}:BigUint64Array,Int8Array,Int16Array,Int32Array,typeof BigInt64Array>`u`?function(){}:BigInt64Array,Float32Array,Float64Array,at],Je=[{tag:1,encode(e,t){let n=e.getTime()/1e3;(this.useTimestamp32||e.getMilliseconds()===0)&&n>=0&&n<4294967296?(U[G++]=26,W.setUint32(G,n),G+=4):(U[G++]=251,W.setFloat64(G,n),G+=8)}},{tag:258,encode(e,t){t(Array.from(e))}},{tag:27,encode(e,t){t([e.name,e.message])}},{tag:27,encode(e,t){t([`RegExp`,e.source,e.flags])}},{getTag(e){return e.tag},encode(e,t){t(e.value)}},{encode(e,t,n){ut(e,n)}},{getTag(e){if(e.constructor===Uint8Array&&(this.tagUint8Array||Ze&&this.tagUint8Array!==!1))return 64},encode(e,t,n){ut(e,n)}},X(68,1),X(69,2),X(70,4),X(71,8),X(72,1),X(77,2),X(78,4),X(79,8),X(85,4),X(86,8),{encode(e,t){let n=e.packedValues||[],r=e.structures||[];if(n.values.length>0){U[G++]=216,U[G++]=51,Y(4);let e=n.values;t(e),Y(0),Y(0),packedObjectMap=Object.create(sharedPackedObjectMap||null);for(let t=0,n=e.length;t<n;t++)packedObjectMap[e[t]]=t}if(r){W.setUint32(G,3655335424),G+=3;let n=r.slice(0);n.unshift(57344),n.push(new B(e.version,1399353956)),t(n)}else t(new B(e.version,1399353956))}}];function X(e,t){return!lt&&t>1&&(e-=4),{tag:e,encode:function(e,t){let n=e.byteLength,r=e.byteOffset||0,i=e.buffer||e;t(Ze?Xe.from(i,r,n):new Uint8Array(i,r,n))}}}function ut(e,t){let n=e.byteLength;n<24?U[G++]=64+n:n<256?(U[G++]=88,U[G++]=n):n<65536?(U[G++]=89,U[G++]=n>>8,U[G++]=n&255):(U[G++]=90,W.setUint32(G,n),G+=4),G+n>=U.length&&t(G+n),U.set(e.buffer?e:new Uint8Array(e),G),G+=n}function dt(e,t){let n,r=t.length*2,i=e.length-r;t.sort((e,t)=>e.offset>t.offset?1:-1);for(let n=0;n<t.length;n++){let r=t[n];r.id=n;for(let t of r.references)e[t++]=n>>8,e[t]=n&255}for(;n=t.pop();){let t=n.offset;e.copyWithin(t+r,t,i),r-=2;let a=t+r;e[a++]=216,e[a++]=28,i=t}return e}function ft(e,t){W.setUint32(q.position+e,G-q.position-e+1);let n=q;q=null,t(n[0]),t(n[1])}let pt=new rt({useRecords:!1});const mt=pt.encode;pt.encodeAsIterable,pt.encodeAsAsyncIterable;const{NEVER:ht,ALWAYS:gt,DECIMAL_ROUND:_t,DECIMAL_FIT:vt}=Ke,yt=2048;if(!(process.env.CBOR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.CBOR_NATIVE_ACCELERATION_DISABLED.toLowerCase()===`true`)){let e;try{e=typeof t==`function`?t(`cbor-extract`):te(import.meta.url)(`cbor-extract`),e&&Ce(e.extractStrings)}catch{}}var bt=_();const xt=`5.0.0-beta.43`,Z=r(`@workflow/world-vercel//httpPools`,1,()=>({dispatcher:void 0,streamDispatcher:void 0,streamCloseDispatcher:void 0,nodeHttpAgents:void 0})),St={connections:8,keepAliveTimeout:1e4},Ct=3e5,wt=3e5,Tt={...St,allowH2:!1,pipelining:1},Et={...St,allowH2:!0,pipelining:100,initialWindowSize:4194304,connectionWindowSize:16777216},Dt={...St,allowH2:!1,pipelining:1},Ot={...St,allowH2:!0,pipelining:1},kt={retryAfter:!0,statusCodes:[500,502,503,504]},At={retryAfter:!0,methods:[`PUT`],statusCodes:[429]},jt={retryAfter:!0,methods:[`PUT`],statusCodes:[429,500,502,503,504]};function Mt(){return process.env.WORKFLOW_H2_MULTIPLEX!==`0`}function Nt(e){if(!e||typeof e!=`object`||Array.isArray(e))return NaN;let t=e,n=t[`content-length`]??t[`Content-Length`];return typeof n==`string`||typeof n==`number`?Number(n):NaN}function Pt(e){return(t,n)=>{let r=t.body,i=!!r&&typeof r!=`string`&&!Buffer.isBuffer(r)&&typeof r[Symbol.asyncIterator]==`function`,a=Nt(t.headers);return!i||!(a>=0)||a>1048576?e({...t,idempotent:!0},n):((async()=>{try{let i=[];for await(let e of r)i.push(Buffer.from(e));e({...t,body:Buffer.concat(i),idempotent:!0},n)}catch(e){n.onError?.(e)}})(),!0)}}const Ft=new Set([`UND_ERR_INFO`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`]);function It(e){let t=e;for(let e=0;t&&e<8;e++){let e=t.code;if(typeof e==`string`&&Ft.has(e))return!0;t=t.cause}return!1}function Lt(e,t){let n,r=0,i=0;function a(e){let t=setTimeout(()=>{Promise.resolve(e.close?.()).catch(()=>void 0)},5e3),n=setTimeout(()=>{Promise.resolve(e.destroy?.()).catch(()=>void 0)},6e4);t.unref?.(),n.unref?.()}return{get(){return n??=e(),n},note(e,o){if(!n||e!==n)return;if(o===void 0){r=0;return}if(!It(o)||(r++,r<3))return;let s=Date.now();if(s-i<5e3)return;i=s,r=0;let c=n;n=void 0,console.warn(`[workflow] ${t}: rebuilding connection pool after 3 consecutive transport failures`),a(c)}}}const Rt=r(`@workflow/world-vercel//eventsDispatcherRecycler@${xt}`,1,()=>Lt(()=>Jt(),`events transport`));function zt(e,t){Rt.note(e,t)}function Bt(e,t){return e?.dispatcher?e.dispatcher:h()?void 0:t()}function Vt(e){if(!e?.dispatcher&&h())return Z.nodeHttpAgents??=g({maxSockets:St.connections,keepAliveMs:St.keepAliveTimeout}),Z.nodeHttpAgents}function Ht(e){return Bt(e,Zt)}function Ut(e){return e?.dispatcher??Zt()}function Wt(e){return Bt(e,()=>Rt.get())}function Gt(e){return Bt(e,Qt)}function Kt(e){return Bt(e,$t)}function qt(e,t){return new bt.RetryAgent(new bt.Agent(e),t)}function Jt(e){let t=Mt(),n=new bt.RetryAgent(new bt.Agent({...t?Et:Dt,...e}),kt);return t?Yt(n,n.compose(Pt)):n}function Yt(e,t){return new Proxy(t,{get:(t,n)=>n===`close`||n===`destroy`?e[n].bind(e):t[n]})}function Xt(e,t){return new bt.RetryAgent(new bt.Agent({...Ot,...t}),e)}function Zt(){return Z.dispatcher??=qt(Tt,kt),Z.dispatcher}function Qt(){return Z.streamDispatcher??=Xt(At),Z.streamDispatcher}function $t(){return Z.streamCloseDispatcher??=Xt(jt),Z.streamCloseDispatcher}const en=r(`@workflow/world-vercel//telemetry`,1,()=>({apiPromise:null,tracerPromise:null}));async function tn(){return en.apiPromise||=import(`../../@opentelemetry/api/index.js`).catch(e=>(typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`)&&console.warn(`[workflow] @opentelemetry/api unavailable — world-vercel spans disabled:`,e instanceof Error?e.message:e),null)),en.apiPromise}function nn(){return typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`)}let rn=!1;function an(e,t){if(!(rn||!nn())){rn=!0;try{let n=globalThis[Symbol.for(`opentelemetry.js.api.1`)],r=e.trace.getTracerProvider(),i=r.getDelegate?.()??r,a=t.startSpan(`workflow.otel.probe.world_vercel`);console.warn(`[workflow:otel-diag] world-vercel`,JSON.stringify({globalRegistrationVersion:n?.version??null,providerCtor:r?.constructor?.name??null,delegateCtor:i?.constructor?.name??null,tracerCtor:t?.constructor?.name??null,probeCtor:a?.constructor?.name??null,probeRecording:a.isRecording()})),a.end()}catch(e){console.warn(`[workflow:otel-diag] world-vercel failed:`,e instanceof Error?e.message:e)}}}async function on(){return en.tracerPromise||=tn().then(e=>{if(!e)return null;let t=e.trace.getTracer(`workflow`);return an(e,t),t}),en.tracerPromise}async function sn(e,...t){let[n,r]=await Promise.all([on(),tn()]),{fn:i,opts:a}=typeof t[0]==`function`?{fn:t[0],opts:{}}:{fn:t[1],opts:t[0]};if(!i)throw Error(`Function to trace must be provided`);return!n||!r?await i():n.startActiveSpan(e,a,async e=>{try{let t=await i(e);return e.setStatus({code:r.SpanStatusCode.OK}),t}catch(t){throw e.setStatus({code:r.SpanStatusCode.ERROR,message:t.message}),t}finally{e.end()}})}async function cn(e){let t=await tn();if(t)return t.SpanKind[e]}async function ln(e){let t=await tn();if(!t)return;let n={};t.propagation.inject(t.context.active(),n);for(let[t,r]of Object.entries(n))e.set(t,r)}function Q(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const un=Q(`http.request.method`),dn=Q(`url.full`),fn=Q(`server.address`),pn=Q(`server.port`),mn=Q(`http.response.status_code`),$=Q(`error.type`),hn=Q(`network.protocol.name`),gn=Q(`workflow.world.parse.format`),_n=Q(`peer.service`),vn=Q(`rpc.system`),yn=Q(`rpc.service`),bn=Q(`rpc.method`),xn=Q(`workflow.run.id`),Sn=Q(`step.id`),Cn=Q(`workflow.stream.name`),wn=Q(`workflow.stream.operation`),Tn=Q(`workflow.stream.start_index`),En=Q(`workflow.events.transport`),Dn=Q(`workflow.http.transport`),On=Q(`workflow.event.type`),kn=Q(`workflow.client.version`),An=Q(`step.stso_ms`),jn=Q(`step.latency_optimizations`),Mn=Q(`workflow.events.ws.url`),Nn=Q(`workflow.events.ws.req_id`),Pn=Q(`workflow.events.ws.reconnect_attempt`),Fn=()=>p(`WORKFLOW_REQUEST_TIMEOUT_MS`,6e4,{integer:!0,min:1e4,max:12e4}),In=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`),Ln=[`x-vercel-id`,`x-vercel-error`,`x-vercel-mitigated`];function Rn(e){return Ln.flatMap(t=>{let n=e.get(t);return n?[`${t}=${n}`]:[]})}function zn(e){let t=Rn(e);return t.length>0?` (${t.join(`; `)})`:``}function Bn(e,t,n,r){if(!In)return;let i=Rn(n.headers),a=i.length>0?`; ${i.join(`; `)}`:``;console.debug(`[workflow:world-vercel:http] ${e} ${t} -> ${n.status} (${r}ms${a})`)}function Vn(e,t,n){if(!process.env.DEBUG)return;let r=Array.from(n.entries()).filter(([e])=>e.toLowerCase()!==`authorization`).map(([e,t])=>`-H "${e}: ${t}"`).join(` `);console.error(`Failed to fetch, reproduce with:\ncurl -X ${e} ${r} "${t}"`)}function Hn(e){if(!e)return;let t=parseInt(e,10);return Number.isNaN(t)?void 0:t}function Un(e){let t={};return e.forEach((e,n)=>{t[n]=e}),t}function Wn(e,t,n={}){let{retryAfter:r,code:d,url:f,mitigated:p,details:m}=n;if(e===409)return new l(t);if(e===410){if(d===`stream-expired`){let e=m&&typeof m==`object`?m:void 0,n=typeof e?.expiredAt==`string`?new Date(e.expiredAt):void 0;return new s(t,typeof e?.runId==`string`?e.runId:void 0,typeof e?.streamId==`string`?e.streamId:void 0,n&&!Number.isNaN(n.getTime())?n:void 0)}return new o(t)}return e===412?new a(t,{retryAfter:r,details:m}):e===425?new u(t,{retryAfter:r}):e===429?Gn(e,p)?new c(`${t} (x-vercel-mitigated=challenge)`,{url:f,status:e,code:`TRANSPORT`,retryAfter:r}):new i(t,{retryAfter:r}):new c(t,{url:f,status:e,code:d,retryAfter:r})}function Gn(e,t){return e===429&&t===`challenge`}async function Kn(e){return e?.token??process.env.VERCEL_TOKEN??await(0,ie.getVercelOidcToken)().catch(()=>null)}function qn(e){try{let t=new URL(e),n=t.protocol===`https:`||t.protocol===`wss:`;return{serverAddress:t.hostname,serverPort:t.port?parseInt(t.port,10):n?443:80}}catch{return{}}}function Jn(e){let{method:t,url:n,peerService:r}=e,{serverAddress:i,serverPort:a}=qn(n);return{...un(t),...dn(n),...i?fn(i):{},...a?pn(a):{},..._n(r),...vn(`http`),...yn(r)}}async function Yn(e,t){let{method:n,url:r,peerService:i=`workflow-server`,spanName:a,attributes:o}=e;return sn(a??`http ${n}`,{kind:await cn(`CLIENT`)},async e=>{if(a&&In&&e){let t=e.spanContext();console.warn(`[workflow:otel-diag] span-open`,JSON.stringify({spanName:a,traceId:t.traceId,spanId:t.spanId,recording:e.isRecording()}))}return e?.setAttributes(Jn({method:n,url:r,peerService:i})),o&&e?.setAttributes(o),t(e)})}function Xn(e,t){e?.setAttributes({...mn(t)}),(t<200||t>=300)&&e?.setAttributes({...$(`HTTP ${t}`)})}async function Zn(e){let{method:t,url:n,headers:r,body:i,dispatcher:a,peerService:o,timeoutMs:s=Fn(),signal:l,injectTraceContext:u=!0,cacheBust:d=!0,logLabel:f,buildError:p,spanName:m,attributes:h,durationAttribute:g,onTransportOutcome:_}=e,v=f??n;return Yn({method:t,url:n,peerService:o,spanName:m,attributes:h},async e=>{u&&await ln(r),d&&r.set(`X-Request-Time`,Date.now().toString());let o=s==null?void 0:AbortSignal.timeout(s),f=l&&o?AbortSignal.any([l,o]):l??o,m=Date.now(),h;try{let o=a?void 0:Vt();e?.setAttributes({...Dn(o?`node-http`:`undici`)}),h=o?await ee(n,{method:t,headers:r,body:i,signal:f,agents:o,headersTimeoutMs:Ct,bodyTimeoutMs:wt}):await fetch(n,{method:t,headers:r,body:i,signal:f,dispatcher:a})}catch(r){let i=Date.now()-m;if(_?.(r),r instanceof Error&&(r.name===`TimeoutError`||r.name===`AbortError`)){let a=new c(`${t} ${v} timed out after ${i}ms`,{url:n,cause:r});throw e?.setAttributes({...$(`TIMEOUT`)}),e?.recordException?.(a),a}throw r}let y=Date.now()-m;if(_?.(),Bn(t,v,h,y),Xn(e,h.status),g&&e?.setAttributes({[g]:y}),!h.ok){if(Vn(t,n,r),p){let t=await p(h);throw e?.recordException?.(t),t}let i=await h.text().catch(()=>``),a=Wn(h.status,`${t} ${v} -> HTTP ${h.status}: ${h.statusText}${i?` ${i}`:``}${zn(h.headers)}`,{url:n,retryAfter:Hn(h.headers.get(`Retry-After`))});throw e?.recordException?.(a),a}return h})}const Qn=new Set([`GET`,`HEAD`]),$n=new Set([`UND_ERR_REQ_RETRY`,`UND_ERR_SOCKET`,`UND_ERR_CONNECT`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CLOSED`,`ECONNRESET`,`ECONNREFUSED`,`ENOTFOUND`,`EAI_AGAIN`,`EPIPE`,`ETIMEDOUT`]);function er(e){let t=e;for(let e=0;t!=null&&e<5;e++){if(typeof t==`object`&&`code`in t){let e=t.code;if(typeof e==`string`&&$n.has(e))return e}t=t?.cause}}const tr=()=>process.env.VERCEL_WORKFLOW_SERVER_URL||``,nr=()=>process.env.WORKFLOW_TEST_LIMIT_OVERRIDES?.trim()||``;function rr(e){return e}const ir=(...e)=>e.filter(Boolean).join(` `),ar=()=>{let e=process.env.VERCEL_DEPLOYMENT_ID;return e?`@workflow/world-vercel/${xt} node-${process.version} ${S.platform()} (${S.arch()}) ${e}`:`@workflow/world-vercel/${xt} node-${process.version} ${S.platform()} (${S.arch()})`},or=e=>{let t=e?.projectConfig,n=tr()||`https://vercel-workflow.com`,r=process.env.WORKFLOW_VERCEL_BACKEND_URL,i=!!(t?.projectId&&t?.teamId);return{baseUrl:i?r||`https://api.vercel.com/v1/workflow`:`${n}/api`,usingProxy:i}},sr=e=>{let t=e?.projectConfig;return t?t.environment||`production`:process.env.VERCEL_TARGET_ENV||process.env.VERCEL_ENV||void 0},cr=(e,t)=>{let n=e?.projectConfig,r=new Headers(e?.headers);r.set(`User-Agent`,ir(ar(),r.get(`User-Agent`)));let i=nr();i&&r.set(`x-workflow-test-limit-overrides`,i),n&&(r.set(`x-vercel-environment`,sr(e)),n.projectId&&r.set(`x-vercel-project-id`,n.projectId),n.teamId&&r.set(`x-vercel-team-id`,n.teamId));let a=tr();return a&&t.usingProxy&&r.set(`x-vercel-workflow-api-url`,a),r};async function lr(e){let{baseUrl:t,usingProxy:n}=or(e),r=cr(e,{usingProxy:n});if(n){if(!e?.token)throw Error(`world-vercel: api-workflow proxy requested (${t}) but no Vercel auth token was provided. Pass one as \`config.token\` (the SDK reads it from \`WORKFLOW_VERCEL_AUTH_TOKEN\`).`);r.set(`Authorization`,`Bearer ${e.token}`)}else{let t;try{t=await(0,ie.getVercelOidcToken)()}catch{}let n=e?.token??t;n&&r.set(`Authorization`,`Bearer ${n}`),t&&r.set(`x-vercel-trusted-oidc-idp-token`,t)}return{baseUrl:t,headers:r,usingProxy:n}}async function ur({endpoint:e,options:t={},config:n={},schema:r,data:i,onResponse:a,retryConnectTimeout:o=!1}){let s=(t.method||`GET`).toUpperCase(),{baseUrl:l,headers:u}=await lr(n),d=`${l}${e}`;return sn(`http ${s}`,{kind:await cn(`CLIENT`)},async l=>{l?.setAttributes(Jn({method:s,url:d,peerService:`workflow-server`})),u.set(`Accept`,`application/cbor`),await ln(u);let f;i!==void 0&&(u.set(`Content-Type`,`application/cbor`),f=mt(i));let p=Qn.has(s),m,h=``;for(let r=0;;r++){u.set(`X-Request-Time`,Date.now().toString());let i=AbortSignal.timeout(Fn()),g=t.signal?AbortSignal.any([t.signal,i]):i,_=Date.now(),v;try{let e=Vt(n);l?.setAttributes({...Dn(e?`node-http`:`undici`)}),v=e?await ee(d,{method:s,headers:u,body:f,signal:g,agents:e,headersTimeoutMs:Ct,bodyTimeoutMs:wt}):await fetch(new Request(d,{...t,body:f,headers:u,signal:g}),{dispatcher:Ht(n)})}catch(t){let n=Date.now()-_;if(t instanceof Error&&(t.name===`TimeoutError`||t.name===`AbortError`)){let r=new c(`${s} ${e} timed out after ${n}ms`,{url:d,code:`TIMEOUT`,cause:t});throw l?.setAttributes({...$(`TIMEOUT`)}),l?.recordException?.(r),r}let i=er(t);if(i){if(o&&p&&i===`UND_ERR_CONNECT_TIMEOUT`&&r===0){await new Promise(e=>setTimeout(e,100));continue}let a=new c(`${s} ${e} transport failure after ${n}ms (${i})`,{url:d,code:`TRANSPORT`,cause:t});throw l?.setAttributes({...$(`TRANSPORT`)}),l?.recordException?.(a),a}throw t}let y=Date.now()-_;if(h=zn(v.headers),Bn(s,e,v,y),l?.setAttributes({...mn(v.status)}),!v.ok){let t=await fr(v).then(e=>e.data).catch(()=>({})),n=t.code??t.error;Vn(s,d,u);let r=Hn(v.headers.get(`Retry-After`)),i=(t.message||`${s} ${e} -> HTTP ${v.status}: ${v.statusText}`)+h,a=Wn(v.status,i,{url:d,code:n,retryAfter:r,mitigated:v.headers.get(`x-vercel-mitigated`),details:t.details});throw l?.setAttributes({...$(n||`HTTP ${v.status}`)}),l?.recordException?.(a),a}a?.(v);try{m=await sn(`world.parse`,async e=>{let t=await fr(v),n=(v.headers.get(`Content-Type`)||``).includes(`application/cbor`);return e?.setAttributes({...gn(n?`cbor`:`json`)}),t});break}catch(t){if(p&&r<2){let n=100*2**r;l?.setAttributes({...$(`PARSE_ERROR_RETRYING`)}),In&&console.debug(`[workflow:world-vercel:http] ${s} ${e} body parse failed (attempt ${r+1}/3); retrying in ${n}ms: ${t}`),await new Promise(e=>setTimeout(e,n));continue}let n=v.headers.get(`Content-Type`)||`unknown`;throw new c(`Failed to parse response body for ${s} ${e}${h} (Content-Type: ${n}):\n\n${t}`,{url:d,code:`PARSE_ERROR`,cause:t})}}return await sn(`world.validate`,async()=>{let t=r.safeParse(m.data);if(!t.success){let n=t.error.issues.map(e=>` ${e.path.length>0?e.path.join(`.`):`<root>`}: ${e.message}`).join(`
|
|
3
|
+
`),r=process.env.DEBUG?`\n\nResponse context: ${m.getDebugContext()}`:``;throw new c(`Schema validation failed for ${s} ${e}${h}:\n${n}${r}`,{url:d,code:`SCHEMA_VALIDATION`,cause:t.error})}return t.data})})}function dr(e){let t=x(e,{depth:3,maxArrayLength:10,breakLength:120});return t.length>500?`${t.slice(0,500)}...`:t}async function fr(e){let t=e.headers.get(`Content-Type`)||``;if(t.includes(`application/cbor`)){let n=await e.arrayBuffer(),r=Ge(new Uint8Array(n));return{data:r,getDebugContext:()=>`Content-Type: ${t}, ${n.byteLength} bytes (CBOR), preview: ${dr(r)}`}}let n=await e.text(),r=JSON.parse(n);return{data:r,getDebugContext:()=>`Content-Type: ${t}, ${n.length} bytes, preview: ${dr(r)}`}}function pr(){return process.env.WORKFLOW_EVENTS_TRANSPORT?.trim().toLowerCase()!==`http`}function mr(){let e=process.env.WORKFLOW_INTERNAL_EVENTS_TRANSPORT_STRICT;return e===`1`||e===`true`}const hr=`application/vnd.workflow.v4-frames`;var gr=class extends Error{};const _r=d(f(),m());function vr(e,t){let n=new Uint8Array(mt(e)),r=new Uint8Array(4+n.byteLength+4+t.byteLength),i=new DataView(r.buffer);return i.setUint32(0,n.byteLength,!1),r.set(n,4),i.setUint32(4+n.byteLength,t.byteLength,!1),r.set(t,4+n.byteLength+4),r}async function*yr(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():xr(e.getReader()),n=new Uint8Array,r=async e=>{if(n.byteLength>=e)return!0;let r=[n],i=n.byteLength;for(;i<e;){let e;try{e=await t.next()}catch(e){throw new gr(`decodeFrames: source stream failed`,{cause:e})}if(e.done)return!1;e.value.byteLength!==0&&(r.push(e.value),i+=e.value.byteLength)}n=new Uint8Array(i);let a=0;for(let e of r)n.set(e,a),a+=e.byteLength;return!0},i=e=>{let t=n.subarray(0,e);return n=n.subarray(e),t};try{for(;;){if(!await r(4))return;let e=new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(i(4),!await r(e))throw new gr(`decodeFrames: truncated meta block`);let t=_r.parse(Ge(i(e)));if(!await r(4))throw new gr(`decodeFrames: truncated body length`);let a=new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(i(4),a>0&&!await r(a))throw new gr(`decodeFrames: truncated body bytes`);if(yield{meta:t,body:n.slice(0,a)},i(a),t._end===1)return}}finally{br(()=>t.return?.())}}function br(e){try{Promise.resolve(e()).catch(()=>{})}catch{}}async function*xr(e){try{for(;;){let{done:t,value:n}=await e.read();if(t)return;n&&(yield n)}}finally{br(()=>e.cancel())}}export{Ge as $,jn as A,Nn as B,$ as C,yn as D,bn as E,xn as F,Ht as G,cn as H,Cn as I,Kt as J,Wt as K,wn as L,kn as M,On as N,vn as O,En as P,mt as Q,Tn as R,Yn as S,_n as T,ln as U,Mn as V,sn as W,zt as X,Gt as Y,xt as Z,Bn as _,pr as a,Xn as b,cr as c,ur as d,re as et,sr as f,Un as g,Rn as h,vr as i,An as j,Sn as k,lr as l,Fn as m,hr as n,mr as o,Wn as p,Ut as q,yr as r,rr as s,gr as t,or as u,Zn as v,hn as w,Kn as x,Hn as y,Pn as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t,n){let r=Symbol.for(`${e}/v${t}`),i=globalThis,a=i[r];if(a!==void 0)return a;let o=n();return i[r]=o,o}export{e as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{N as e,O as t}from"./dist-DjojkP5e.js";function n(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function r(e){let t={get value(){let n=e();return Object.defineProperty(t,"value",{value:n}),n}};return t}var i=class t extends Error{items;steps;globalThis;stepCount;hookCount;waitCount;attributeCount;hookDisposedCount;abortCount;constructor(t,n){let r=[...t.values()],i=0,a=0,o=0,s=0,c=0,l=0;for(let e of r)e.type===`step`?i++:e.type===`hook`?e.disposed?c++:e.abortRequested?l++:a++:e.type===`wait`?o++:e.type===`attribute`&&s++;let u=[];i>0&&u.push(`${i} ${e(`step`,`steps`,i)}`),a>0&&u.push(`${a} ${e(`hook`,`hooks`,a)}`),o>0&&u.push(`${o} ${e(`wait`,`waits`,o)}`),s>0&&u.push(`${s} ${e(`attribute write`,`attribute writes`,s)}`),c>0&&u.push(`${c} hook ${e(`disposal`,`disposals`,c)}`);let d=e(`has`,`have`,i+a+o+s+c),f=+(i>0)+ +(a>0)+ +(o>0)+ +(s>0)+ +(c>0),p;p=f>1?`processed`:i>0?`run`:a>0||o>0?`created`:s>0?`written`:c>0?`processed`:`received`;let m=u.length>0?`${u.join(` and `)} ${d} not been ${p} yet`:`0 steps have not been run yet`;super(m),this.name=`WorkflowSuspension`,this.items=r,this.steps=r,this.globalThis=n,this.stepCount=i,this.hookCount=a,this.waitCount=o,this.attributeCount=s,this.hookDisposedCount=c,this.abortCount=l}static is(e){return e instanceof t}};function a(){throw new t(`This API is not available inside a workflow function. Workflow functions run in a deterministic VM; move the call to a step function for full Node.js access.`)}const o=Symbol.for(`@workflow/core//registeredSteps`),s=globalThis,c=s[o]??=new Map,l=new Set([`__builtin_response_array_buffer`,`__builtin_response_json`,`__builtin_response_text`]);function u(e){let t=e.split(`//`);if(t.length!==3||t[0]!==`step`)return[];let n=t[1],r=t[2],i=new Set,a=e=>{e!==n&&i.add(e)};if(n.startsWith(`./workflows/`)){let e=n.slice(2);a(`./example/${e}`),a(`./src/${e}`)}else if(n.startsWith(`./example/workflows/`)){let e=n.slice(10);a(`./${e}`),a(`./src/${e}`)}else if(n.startsWith(`./src/workflows/`)){let e=n.slice(6);a(`./${e}`),a(`./example/${e}`)}return Array.from(i,e=>`step//${e}//${r}`)}function d(e){if(l.has(e)){for(let[t,n]of c.entries())if(t.endsWith(`//${e}`))return n}}function f(e,t){c.set(e,t),t.stepId=e}function p(e){let t=c.get(e);if(t)return t;for(let t of u(e)){let e=c.get(t);if(e)return e}let n=d(e);if(n)return n}const m={hook:[`hook`,`wait`,`step`],wait:[`hook`,`step`],step:[`wait`,`hook`,`step`]};function h(e,t,n,r){return n>=t||!m[e].includes(r.kind)?!1:!(e===`step`&&!r.armed)}function g(e,t,n,r){let i=r.get(t);if(i!==void 0)return i;let a=_(e,t,n,r);return r.set(t,a),a}function _(e,t,n,r){if(!n.armed)return!1;for(let[i,a]of e)if(h(n.kind,t,i,a)&&!g(e,i,a,r))return!1;return!0}function v(){return process.env.WORKFLOW_LOG_ORDER_DRAWS!==`0`}function y(e){return e===0&&typeof setImmediate==`function`?new Promise(e=>setImmediate(e)):new Promise(t=>setTimeout(t,e))}async function b(e,t){for(;;){let n=e.mintCount??0,r=e.pendingDeliveries;if(await y(await e.promiseQueue.then(()=>!1,()=>!0)?50:0),(e.mintCount??0)!==n||r!==0||e.pendingDeliveries!==0)continue;let i=!1;for(let[n,r]of e.pendingDeliveryBarriers??[])if(n<t&&r.armed){i=!0;break}if(!i)return}}async function x(e,t,n){if(t===void 0||!e.pendingDeliveryBarriers)return;let r=e.pendingDeliveryBarriers,i=[];for(let[e,a]of r)h(n,t,e,a)&&i.push(a.released);if(i.length>0&&await Promise.all(i),v()){await b(e,t);return}i.length>0&&await new Promise(e=>setTimeout(e,0))}function S(e,r,i,a={}){let o=e.pendingDeliveryBarriers;if(!o||r===void 0)return{markDelivered:()=>{},arm:()=>{}};let s=a=>{if(o.has(r))throw new t(`Delivery barrier already registered at event index ${r}`);let{promise:s,resolve:c}=n(),l={kind:i,released:s,armed:a,retired:!1,retire:()=>{l.retired||(l.retired=!0,o.get(r)===l&&o.delete(r),c())}};return o.set(r,l),w(e),l},c=s(a.armed??!0),l=!1;return{markDelivered:()=>{l||(l=!0,c.retire())},arm:()=>{if(!l){if(c.retired){c=s(!0);return}if(o.get(r)!==c)throw new t(`Delivery barrier lost ownership of event index ${r}`);c.armed=!0}}}}const C=new WeakSet;function w(e){let t=e.pendingDeliveryBarriers;if(!t||C.has(e))return;C.add(e);let n=()=>{setTimeout(i,0)},r=()=>{setTimeout(i,50)},i=()=>{if(t.size===0){C.delete(e);return}if(!T(e)){e.promiseQueue.then(n,r);return}for(;t.size>0&&T(e);){let e,n;for(let[r,i]of t)(e===void 0||r<e)&&(e=r,n=i);n?.retire()}setTimeout(i,0)};setTimeout(i,0)}function T(e){return e.pendingDeliveries===0&&!E(e)}function E(e){let t=e.pendingDeliveryBarriers;if(!t||t.size===0)return!1;let n=new Map;for(let[e,r]of t)if(g(t,e,r,n))return!0;return!1}function D(e){return e.pendingDeliveries===0&&(!e.pendingDeliveryBarriers||e.pendingDeliveryBarriers.size===0)}function O(e,t){let n=()=>{D(e)?t():e.promiseQueue.then(()=>{setTimeout(n,0)})};setTimeout(n,0)}function k(e){let t=e.suspensionGeneration;O(e,()=>{t===e.suspensionGeneration&&e.onWorkflowError(new i(e.invocationsQueue,e.globalThis))})}export{S as a,k as c,r as d,n as f,D as i,a as l,p as n,f as o,E as r,O as s,x as t,i as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-8V8biNmG.js";import{$n as t,C as n,Ct as r,Dr as i,Et as a,I as o,On as s,Tt as c,Vn as l,Z as u,Zn as d,bt as f,cr as p,ct as m,er as h,ft as g,k as _,n as v,o as y,t as b,ur as x,xr as S,xt as C}from"./wait-until-BtySPYD0.js";import{O as w,d as T,n as E,o as D}from"./dist-DjojkP5e.js";import{U as O,c as k,o as A}from"./dist-CgbVZs5l.js";var j=e({getHookByToken:()=>V,resumeHook:()=>H,resumeWebhook:()=>W});const M=A();async function N(e){let t=await crypto.subtle.digest(`SHA-256`,e),n=new Uint8Array(t),r=``;for(let e of n)r+=e.toString(16).padStart(2,`0`);return r}const P=[25,100];function F(e,t){if(t?.(e))return!1;let n=e??{},r=n.status??n.statusCode;if(typeof r==`number`)return r>=500||r===408||r===429;let i=e?.name;return i!==`BadRequestError`&&i!==`UnauthorizedError`&&i!==`ForbiddenError`}async function I(e,t){let n;for(let r=0;r<=P.length;r++)try{await e();return}catch(e){if(n=e,!F(e,t))break;let i=P[r];i!==void 0&&await new Promise(e=>setTimeout(e,i))}throw D.is(n)?new w(`The hook resume was committed, but its workflow wake could not be published`,{cause:n}):n}function L(e){let t=e.executionContext?.workflowCoreVersion,n=e.executionContext?.traceCarrier,r=e.executionContext?.hookResumeInputVersion;return{deploymentId:e.deploymentId,workflowName:e.workflowName,runSpecVersion:e.specVersion,workflowCoreVersion:typeof t==`string`?t:void 0,traceCarrier:n&&typeof n==`object`?n:void 0,encryptionPublicKey:e.encryptionPublicKey,hookResumeInputVersion:typeof r==`number`?r:void 0}}async function R(e){if(e.resumeContext)return{resumeContext:e.resumeContext,source:`hook`};let t=await(await x()).runs.get(e.runId);return{resumeContext:L(t),source:`run_fallback`,run:t}}async function z(e,t){let n=await x(),r=t.run?await n.getEncryptionKeyForRun?.(t.run):await n.getEncryptionKeyForRun?.(e.runId,{deploymentId:t.resumeContext.deploymentId});return r?await i(r):void 0}async function B(e){let t=await x(),n=await t.hooks.getByToken(e),r;if(n.metadata!==void 0){let e=await R(n),i=e.run?await t.getEncryptionKeyForRun?.(e.run):await t.getEncryptionKeyForRun?.(n.runId,{deploymentId:e.resumeContext.deploymentId});r=i?await d(i):void 0,n.metadata=await o(n.metadata,n.runId,r)}return{hook:n,encryptionKey:r}}async function V(e){let{hook:t}=await B(e);return t}async function H(e,t,n){return U(e,t,n,!1,Date.now())}async function U(e,i,o,d,S){return await v(()=>g(`hook.resume`,async g=>{let v=await x();try{let f=typeof e==`string`,x=f?await v.hooks.getByToken(e):e,w=f||d,E=await R(x),{resumeContext:A}=E;if(g?.setAttributes({...c(x.token),...C(x.hookId),...l(x.runId),"workflow.hook.resume_context_source":E.source}),E.run&&O(E.run.status))throw new D(x.token);let j=n(A.workflowCoreVersion),P,F=o?void 0:p(A.encryptionPublicKey);if(F)P=t(F);else{let e=o??await z(x,E);j.supportedFormats.has(h.ENCRYPTED)||(e=void 0),P=e}let L=(A.runSpecVersion??0)>=5&&j.supportedFormats.has(h.GZIP),B=[],V=[],H=k(x.specVersion),U=await _(i,x.runId,P,B,globalThis,H,j.framedByteStreams,L,void 0,V);await Promise.all(B.map(e=>e.catch(e=>{if(e!==void 0)throw e}))),b(Promise.all(V),e=>{e!==void 0&&u.warn(`Background readback of hook payload failed`,{workflowRunId:x.runId,hookId:x.hookId,error:e instanceof Error?e.message:String(e)})}),g?.setAttributes({...s(A.workflowName)});let W=await m(A.traceCarrier);W&&g?.addLink?.(W);let G=y(A.workflowName),K={deploymentId:A.deploymentId,specVersion:A.runSpecVersion??1},q=((w?x.resumeCapabilities?.hookResumeDedupVersion??0:0)>=1||v.capabilities?.hookResumeDedup===!0)&&!H&&U instanceof Uint8Array;g?.setAttributes({"workflow.hook.resume_strategy":`sequential`});let J=q?M():void 0,Y=q?await N(U):void 0;J&&g?.setAttributes({"workflow.hook.resume_id":J});let X=e=>D.is(e)||T.is(e);try{await v.events.create(x.runId,{eventType:`hook_received`,specVersion:7,correlationId:x.hookId,eventData:{...H?{}:{token:x.token},payload:U}},{v1Compat:H,...J&&Y?{resumeId:J,resumePayloadDigest:Y}:{}})}catch(e){throw X(e)?new D(x.token):e}g?.setAttributes(r(!0));let Z=Date.now();return await I(()=>v.queue(G,{runId:x.runId,traceCarrier:A.traceCarrier??void 0,hookResumeTiming:{resumeRequestedAtMs:S,queuePublishRequestedAtMs:Z,strategy:`sequential`}},{...K,...J?{idempotencyKey:`hook-${J}`}:{}}),v.isDeploymentUnavailableError?.bind(v)),g?.setAttributes(a(!0)),x}catch(t){throw g?.setAttributes({...c(typeof e==`string`?e:e.token),...f(!1)}),t}}))}async function W(e,t){let n=Date.now(),{hook:r,encryptionKey:i}=await B(e);if(r.isWebhook===!1)throw new D(e);let a,o;if(r.metadata&&typeof r.metadata==`object`&&`respondWith`in r.metadata)if(r.metadata.respondWith===`manual`){let{readable:e,writable:n}=new TransformStream;o=e,t[S]=n}else if(r.metadata.respondWith instanceof Response)a=r.metadata.respondWith;else throw new w(`Invalid \`respondWith\` value: ${r.metadata.respondWith}`,{slug:E.WEBHOOK_INVALID_RESPOND_WITH_VALUE});else a=new Response(null,{status:202});if(await U(r,t,i,!0,n),o){let e=o.getReader(),t=await e.read();t.value&&(a=t.value),e.cancel()}if(!a)throw new w(`Workflow run did not send a response`,{slug:E.WEBHOOK_RESPONSE_NOT_SENT});return a}export{j as i,H as n,W as r,V as t};
|